Skip to content

Commit a3065a9

Browse files
committed
feat(intrinsic_array): support double-prec. & 3D
1 parent 24a667b commit a3065a9

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

src/intrinsic_array_m.F90

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@ module intrinsic_array_m
77
public :: intrinsic_array_t
88

99
type, extends(characterizable_t) :: intrinsic_array_t
10-
complex, allocatable :: complex_1D(:)
11-
integer, allocatable :: integer_1D(:)
12-
logical, allocatable :: logical_1D(:)
13-
real, allocatable :: real_1D(:)
10+
complex, allocatable :: complex_1D(:)
11+
integer, allocatable :: integer_1D(:)
12+
logical, allocatable :: logical_1D(:)
13+
real, allocatable :: real_1D(:)
14+
double precision, allocatable :: double_precision_1D(:)
1415

15-
complex, allocatable :: complex_2D(:,:)
16-
integer, allocatable :: integer_2D(:,:)
17-
logical, allocatable :: logical_2D(:,:)
18-
real, allocatable :: real_2D(:,:)
16+
complex, allocatable :: complex_2D(:,:)
17+
integer, allocatable :: integer_2D(:,:)
18+
logical, allocatable :: logical_2D(:,:)
19+
real, allocatable :: real_2D(:,:)
20+
double precision, allocatable :: double_precision_2D(:,:)
1921

20-
complex, allocatable :: complex_3D(:,:,:)
21-
integer, allocatable :: integer_3D(:,:,:)
22-
logical, allocatable :: logical_3D(:,:,:)
23-
real, allocatable :: real_3D(:,:,:)
22+
complex, allocatable :: complex_3D(:,:,:)
23+
integer, allocatable :: integer_3D(:,:,:)
24+
logical, allocatable :: logical_3D(:,:,:)
25+
real, allocatable :: real_3D(:,:,:)
26+
double precision, allocatable :: double_precision_3D(:,:,:)
2427
contains
2528
procedure :: as_character
2629
end type

src/intrinsic_array_s.F90

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
intrinsic_array%logical_1D = array
1919
type is(real)
2020
intrinsic_array%real_1D = array
21+
type is(double precision)
22+
intrinsic_array%double_precision_1D = array
2123
class default
2224
error stop "intrinsic_array_t construct: unsupported rank-2 type"
2325
end select
@@ -32,6 +34,8 @@
3234
intrinsic_array%logical_2D = array
3335
type is(real)
3436
intrinsic_array%real_2D = array
37+
type is(double precision)
38+
intrinsic_array%double_precision_2D = array
3539
class default
3640
error stop "intrinsic_array_t construct: unsupported rank-2 type"
3741
end select
@@ -46,6 +50,8 @@
4650
intrinsic_array%logical_3D = array
4751
type is(real)
4852
intrinsic_array%real_3D = array
53+
type is(double precision)
54+
intrinsic_array%double_precision_3D = array
4955
class default
5056
error stop "intrinsic_array_t construct: unsupported rank-3 type"
5157
end select
@@ -77,6 +83,9 @@
7783
else if (allocated(self%real_1D)) then
7884
character_self = repeat(" ", ncopies = single_number_width*size(self%real_1D))
7985
write(character_self, *) self%real_1D
86+
else if (allocated(self%double_precision_1D)) then
87+
character_self = repeat(" ", ncopies = single_number_width*size(self%double_precision_1D))
88+
write(character_self, *) self%double_precision_1D
8089
else if (allocated(self%complex_2D)) then
8190
character_self = repeat(" ", ncopies = single_number_width*size(self%complex_2D))
8291
write(character_self, *) self%complex_2D
@@ -89,6 +98,24 @@
8998
else if (allocated(self%real_2D)) then
9099
character_self = repeat(" ", ncopies = single_number_width*size(self%real_2D))
91100
write(character_self, *) self%real_2D
101+
else if (allocated(self%double_precision_2D)) then
102+
character_self = repeat(" ", ncopies = single_number_width*size(self%double_precision_2D))
103+
write(character_self, *) self%double_precision_2D
104+
else if (allocated(self%complex_2D)) then
105+
character_self = repeat(" ", ncopies = single_number_width*size(self%complex_3D))
106+
write(character_self, *) self%complex_3D
107+
else if (allocated(self%integer_3D)) then
108+
character_self = repeat(" ", ncopies = single_number_width*size(self%integer_3D))
109+
write(character_self, *) self%integer_3D
110+
else if (allocated(self%logical_3D)) then
111+
character_self = repeat(" ", ncopies = single_number_width*size(self%logical_1D))
112+
write(character_self, *) self%logical_3D
113+
else if (allocated(self%real_3D)) then
114+
character_self = repeat(" ", ncopies = single_number_width*size(self%real_3D))
115+
write(character_self, *) self%real_3D
116+
else if (allocated(self%double_precision_3D)) then
117+
character_self = repeat(" ", ncopies = single_number_width*size(self%double_precision_3D))
118+
write(character_self, *) self%double_precision_3D
92119
end if
93120

94121
character_self = trim(adjustl(character_self))

0 commit comments

Comments
 (0)