14 integer(IK) ,
allocatable ::
index(:)
16 character(:, SK),
allocatable :: string_SK , stringNew_SK , stringInsertion_SK
17 character(
9, SK),
allocatable :: Array_SK(:) , ArrayNew_SK(:), ArrayInsertion_SK(:)
18 integer(IK) ,
allocatable :: Array_IK(:) , ArrayNew_IK(:), ArrayInsertion_IK(:)
19 complex(CK) ,
allocatable :: Array_CK(:) , ArrayNew_CK(:), ArrayInsertion_CK(:)
20 real(RK) ,
allocatable :: Array_RK(:) , ArrayNew_RK(:), ArrayInsertion_RK(:)
21 logical(LK) ,
allocatable :: Array_LK(:) , ArrayNew_LK(:), ArrayInsertion_LK(:)
23 type(display_type) :: disp
28 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
29 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
30 call disp%show(
"! Insert an array-like `insertion` at the specified locations in array.")
31 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
32 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
35 string_SK
= "OOOOOOOOO"
36 Array_SK
= [
"O",
"O",
"O",
"O",
"O",
"O",
"O",
"O",
"O"]
37 Array_IK
= [
1_IK,
2_IK,
3_IK,
4_IK,
5_IK,
6_IK,
7_IK,
8_IK,
9_IK]
38 Array_RK
= [
1._RK,
2._RK,
3._RK,
4._RK,
5._RK,
6._RK,
7._RK,
8._RK,
9._RK]
39 Array_CK
= [(
1._CK,
-1._CK), (
2._CK,
-2._CK), (
3._CK,
-3._CK), (
4._CK,
-4._CK), (
5._CK,
-5._CK), (
6._CK,
-6._CK), (
7._CK,
-7._CK), (
8._CK,
-8._CK), (
9._CK,
-9._CK)]
40 Array_LK
= [
.false._LK,
.false._LK,
.false._LK,
.false._LK,
.false._LK,
.false._LK,
.false._LK,
.false._LK,
.false._LK]
42 stringInsertion_SK
= "+%"
43 ArrayInsertion_SK
= [
"++",
"%%"]
44 ArrayInsertion_IK
= [
0_IK,
-1_IK]
45 ArrayInsertion_RK
= [
0._RK,
-1._RK]
46 ArrayInsertion_CK
= [(
0._CK,
-0._CK), (
-1._CK,
+1._CK)]
47 ArrayInsertion_LK
= [
.true._LK,
.true._LK]
49 index
= int([
1,
1,
1,
2,
4,
4,
-1,
size(Array_SK)
+ 1],
kind = IK)
52 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%")
53 call disp%show(
"! Insert string `insertion`.")
54 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%")
57 allocate(
character(
len(string_SK)
+size(index)
*len(stringInsertion_SK)) :: stringNew_SK)
59 call disp%show( string_SK, deliml
= SK_
"""" )
61 call disp%show( stringInsertion_SK, deliml
= SK_
"""" )
64 call disp%show(
"stringNew_SK = getInserted(string_SK, stringInsertion_SK, index = index)")
65 stringNew_SK
= getInserted(string_SK, stringInsertion_SK, index
= index)
67 call disp%show( stringNew_SK, deliml
= SK_
"""" )
70 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
71 call disp%show(
"! Insert character `insertion`.")
72 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
75 allocate(ArrayNew_SK(
size(Array_SK)
+ size(index)
* size(ArrayInsertion_SK)))
77 call disp%show( Array_SK, deliml
= SK_
"""" )
79 call disp%show( ArrayInsertion_SK, deliml
= SK_
"""" )
82 call disp%show(
"ArrayNew_SK = getInserted(Array_SK, ArrayInsertion_SK, index = index)")
83 ArrayNew_SK
= getInserted(Array_SK, ArrayInsertion_SK, index
= index)
85 call disp%show( ArrayNew_SK, deliml
= SK_
"""" )
88 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
89 call disp%show(
"! Insert logical `insertion`.")
90 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
93 allocate(ArrayNew_LK(
size(Array_LK)
+ size(index)
* size(ArrayInsertion_LK)))
100 call disp%show(
"ArrayNew_LK = getInserted(Array_LK, ArrayInsertion_LK, index = index)")
101 ArrayNew_LK
= getInserted(Array_LK, ArrayInsertion_LK, index
= index)
106 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
107 call disp%show(
"! Insert integer `insertion`.")
108 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
111 allocate(ArrayNew_IK(
size(Array_IK)
+ size(index)
* size(ArrayInsertion_IK)))
118 call disp%show(
"ArrayNew_IK = getInserted(Array_IK, ArrayInsertion_IK, index = index)")
119 ArrayNew_IK
= getInserted(Array_IK, ArrayInsertion_IK, index
= index)
124 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
125 call disp%show(
"! Insert complex `insertion`.")
126 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
129 allocate(ArrayNew_CK(
size(Array_CK)
+ size(index)
* size(ArrayInsertion_CK)))
136 call disp%show(
"ArrayNew_CK = getInserted(Array_CK, ArrayInsertion_CK, index = index)")
137 ArrayNew_CK
= getInserted(Array_CK, ArrayInsertion_CK, index
= index)
142 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%")
143 call disp%show(
"! Insert real `insertion`.")
144 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%")
147 allocate(ArrayNew_RK(
size(Array_RK)
+ size(index)
* size(ArrayInsertion_RK)))
154 call disp%show(
"ArrayNew_RK = getInserted(Array_RK, ArrayInsertion_RK, index = index)")
155 ArrayNew_RK
= getInserted(Array_RK, ArrayInsertion_RK, index
= index)
161 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
162 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
163 call disp%show(
"! Insert an scalar `insertion` at the specified locations in array.")
164 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
165 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
171 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%")
172 call disp%show(
"! Insert string `insertion`.")
173 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%")
176 allocate(
character(
len(string_SK)
+size(index)) :: stringNew_SK)
178 call disp%show( string_SK, deliml
= SK_
"""" )
179 call disp%show(
"stringInsertion_SK(1:1)")
180 call disp%show( stringInsertion_SK(
1:
1), deliml
= SK_
"""" )
183 call disp%show(
"stringNew_SK = getInserted(string_SK, stringInsertion_SK(1:1), index = index)")
184 stringNew_SK
= getInserted(string_SK, stringInsertion_SK(
1:
1), index
= index)
186 call disp%show( stringNew_SK, deliml
= SK_
"""" )
189 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
190 call disp%show(
"! Insert character `insertion`.")
191 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
194 allocate(ArrayNew_SK(
size(Array_SK)
+ size(index)))
196 call disp%show( Array_SK, deliml
= SK_
"""" )
197 call disp%show(
"ArrayInsertion_SK(1)")
198 call disp%show( ArrayInsertion_SK(
1), deliml
= SK_
"""" )
201 call disp%show(
"ArrayNew_SK = getInserted(Array_SK, ArrayInsertion_SK(1), index = index)")
202 ArrayNew_SK
= getInserted(Array_SK, ArrayInsertion_SK(
1), index
= index)
204 call disp%show( ArrayNew_SK, deliml
= SK_
"""" )
207 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
208 call disp%show(
"! Insert logical `insertion`.")
209 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
212 allocate(ArrayNew_LK(
size(Array_LK)
+ size(index)))
219 call disp%show(
"ArrayNew_LK = getInserted(Array_LK, ArrayInsertion_LK(1), index = index)")
220 ArrayNew_LK
= getInserted(Array_LK, ArrayInsertion_LK(
1), index
= index)
225 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
226 call disp%show(
"! Insert integer `insertion`.")
227 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
230 allocate(ArrayNew_IK(
size(Array_IK)
+ size(index)))
237 call disp%show(
"ArrayNew_IK = getInserted(Array_IK, ArrayInsertion_IK(1), index = index)")
238 ArrayNew_IK
= getInserted(Array_IK, ArrayInsertion_IK(
1), index
= index)
243 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
244 call disp%show(
"! Insert complex `insertion`.")
245 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
248 allocate(ArrayNew_CK(
size(Array_CK)
+ size(index)))
255 call disp%show(
"ArrayNew_CK = getInserted(Array_CK, ArrayInsertion_CK(1), index = index)")
256 ArrayNew_CK
= getInserted(Array_CK, ArrayInsertion_CK(
1), index
= index)
261 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%")
262 call disp%show(
"! Insert real `insertion`.")
263 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%")
266 allocate(ArrayNew_RK(
size(Array_RK)
+ size(index)))
273 call disp%show(
"ArrayNew_RK = getInserted(Array_RK, ArrayInsertion_RK(1), index = index)")
274 ArrayNew_RK
= getInserted(Array_RK, ArrayInsertion_RK(
1), index
= index)
281 if (
allocated(stringNew_SK))
deallocate(stringNew_SK)
282 if (
allocated(ArrayNew_SK))
deallocate(ArrayNew_SK)
283 if (
allocated(ArrayNew_IK))
deallocate(ArrayNew_IK)
284 if (
allocated(ArrayNew_RK))
deallocate(ArrayNew_RK)
285 if (
allocated(ArrayNew_CK))
deallocate(ArrayNew_CK)
286 if (
allocated(ArrayNew_LK))
deallocate(ArrayNew_LK)
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Generate and return an object of type display_type.
18+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
19stringNew_SK
= getInserted(string_SK, stringInsertion_SK, index
= index)
21"+%+%+%O+%OO+%+%OOOOO+%O+%"
28"O ",
"O ",
"O ",
"O ",
"O ",
"O ",
"O ",
"O ",
"O "
32+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
33ArrayNew_SK
= getInserted(Array_SK, ArrayInsertion_SK, index
= index)
35"++ ",
"%% ",
"++ ",
"%% ",
"++ ",
"%% ",
"O ",
"++ ",
"%% ",
"O ",
"O ",
"++ ",
"%% ",
"++ ",
"%% ",
"O ",
"O ",
"O ",
"O ",
"O ",
"++ ",
"%% ",
"O ",
"++ ",
"%% "
42F, F, F, F, F, F, F, F, F
46+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
47ArrayNew_LK
= getInserted(Array_LK, ArrayInsertion_LK, index
= index)
49T, T, T, T, T, T, F, T, T, F, F, T, T, T, T, F, F, F, F, F, T, T, F, T, T
56+1,
+2,
+3,
+4,
+5,
+6,
+7,
+8,
+9
60+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
61ArrayNew_IK
= getInserted(Array_IK, ArrayInsertion_IK, index
= index)
63+0,
-1,
+0,
-1,
+0,
-1,
+1,
+0,
-1,
+2,
+3,
+0,
-1,
+0,
-1,
+4,
+5,
+6,
+7,
+8,
+0,
-1,
+9,
+0,
-1
70(
+1.0000000000000000,
-1.0000000000000000), (
+2.0000000000000000,
-2.0000000000000000), (
+3.0000000000000000,
-3.0000000000000000), (
+4.0000000000000000,
-4.0000000000000000), (
+5.0000000000000000,
-5.0000000000000000), (
+6.0000000000000000,
-6.0000000000000000), (
+7.0000000000000000,
-7.0000000000000000), (
+8.0000000000000000,
-8.0000000000000000), (
+9.0000000000000000,
-9.0000000000000000)
72(
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000)
74+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
75ArrayNew_CK
= getInserted(Array_CK, ArrayInsertion_CK, index
= index)
77(
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000), (
+1.0000000000000000,
-1.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000), (
+2.0000000000000000,
-2.0000000000000000), (
+3.0000000000000000,
-3.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000), (
+4.0000000000000000,
-4.0000000000000000), (
+5.0000000000000000,
-5.0000000000000000), (
+6.0000000000000000,
-6.0000000000000000), (
+7.0000000000000000,
-7.0000000000000000), (
+8.0000000000000000,
-8.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000), (
+9.0000000000000000,
-9.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000)
84+1.0000000000000000,
+2.0000000000000000,
+3.0000000000000000,
+4.0000000000000000,
+5.0000000000000000,
+6.0000000000000000,
+7.0000000000000000,
+8.0000000000000000,
+9.0000000000000000
86+0.0000000000000000,
-1.0000000000000000
88+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
89ArrayNew_RK
= getInserted(Array_RK, ArrayInsertion_RK, index
= index)
91+0.0000000000000000,
-1.0000000000000000,
+0.0000000000000000,
-1.0000000000000000,
+0.0000000000000000,
-1.0000000000000000,
+1.0000000000000000,
+0.0000000000000000,
-1.0000000000000000,
+2.0000000000000000,
+3.0000000000000000,
+0.0000000000000000,
-1.0000000000000000,
+0.0000000000000000,
-1.0000000000000000,
+4.0000000000000000,
+5.0000000000000000,
+6.0000000000000000,
+7.0000000000000000,
+8.0000000000000000,
+0.0000000000000000,
-1.0000000000000000,
+9.0000000000000000,
+0.0000000000000000,
-1.0000000000000000
106stringInsertion_SK(
1:
1)
109+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
110stringNew_SK
= getInserted(string_SK, stringInsertion_SK(
1:
1), index
= index)
119"O ",
"O ",
"O ",
"O ",
"O ",
"O ",
"O ",
"O ",
"O "
123+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
124ArrayNew_SK
= getInserted(Array_SK, ArrayInsertion_SK(
1), index
= index)
126"++ ",
"++ ",
"++ ",
"O ",
"++ ",
"O ",
"O ",
"++ ",
"++ ",
"O ",
"O ",
"O ",
"O ",
"O ",
"++ ",
"O ",
"++ "
133F, F, F, F, F, F, F, F, F
137+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
138ArrayNew_LK
= getInserted(Array_LK, ArrayInsertion_LK(
1), index
= index)
140T, T, T, F, T, F, F, T, T, F, F, F, F, F, T, F, T
147+1,
+2,
+3,
+4,
+5,
+6,
+7,
+8,
+9
151+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
152ArrayNew_IK
= getInserted(Array_IK, ArrayInsertion_IK(
1), index
= index)
154+0,
+0,
+0,
+1,
+0,
+2,
+3,
+0,
+0,
+4,
+5,
+6,
+7,
+8,
+0,
+9,
+0
161(
+1.0000000000000000,
-1.0000000000000000), (
+2.0000000000000000,
-2.0000000000000000), (
+3.0000000000000000,
-3.0000000000000000), (
+4.0000000000000000,
-4.0000000000000000), (
+5.0000000000000000,
-5.0000000000000000), (
+6.0000000000000000,
-6.0000000000000000), (
+7.0000000000000000,
-7.0000000000000000), (
+8.0000000000000000,
-8.0000000000000000), (
+9.0000000000000000,
-9.0000000000000000)
163(
+0.0000000000000000,
-0.0000000000000000), (
-1.0000000000000000,
+1.0000000000000000)
165+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
166ArrayNew_CK
= getInserted(Array_CK, ArrayInsertion_CK(
1), index
= index)
168(
+0.0000000000000000,
-0.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
+1.0000000000000000,
-1.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
+2.0000000000000000,
-2.0000000000000000), (
+3.0000000000000000,
-3.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
+4.0000000000000000,
-4.0000000000000000), (
+5.0000000000000000,
-5.0000000000000000), (
+6.0000000000000000,
-6.0000000000000000), (
+7.0000000000000000,
-7.0000000000000000), (
+8.0000000000000000,
-8.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000), (
+9.0000000000000000,
-9.0000000000000000), (
+0.0000000000000000,
-0.0000000000000000)
175+1.0000000000000000,
+2.0000000000000000,
+3.0000000000000000,
+4.0000000000000000,
+5.0000000000000000,
+6.0000000000000000,
+7.0000000000000000,
+8.0000000000000000,
+9.0000000000000000
177+0.0000000000000000,
-1.0000000000000000
179+1,
+1,
+1,
+2,
+4,
+4,
-1,
+10
180ArrayNew_RK
= getInserted(Array_RK, ArrayInsertion_RK(
1), index
= index)
182+0.0000000000000000,
+0.0000000000000000,
+0.0000000000000000,
+1.0000000000000000,
+0.0000000000000000,
+2.0000000000000000,
+3.0000000000000000,
+0.0000000000000000,
+0.0000000000000000,
+4.0000000000000000,
+5.0000000000000000,
+6.0000000000000000,
+7.0000000000000000,
+8.0000000000000000,
+0.0000000000000000,
+9.0000000000000000,
+0.0000000000000000