Skip to content

Commit 7dac316

Browse files
Major cleanup for test utils
1 parent b4895b8 commit 7dac316

15 files changed

Lines changed: 854 additions & 343 deletions

src_main_pub/fdetypes.F90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
77
module FDETYPES
88

9-
109
#ifdef CompileWithOpenMP
1110
use omp_lib
1211
#endif
@@ -620,6 +619,7 @@ module FDETYPES
620619
logical :: thereArePMLMagneticMedia
621620
CHARACTER (LEN=BUFSIZE) :: nEntradaRoot
622621
type (coorsxyzP) :: Punto
622+
623623
end type
624624

625625
type media_matrices_t
@@ -846,6 +846,8 @@ logical function direction_eq(a,b)
846846
direction_eq = direction_eq .and. (a%orientation == b%orientation)
847847

848848
end function
849+
850+
849851
end module FDETYPES
850852

851853
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

src_output/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ add_library(fdtd-output
1111
)
1212
target_link_libraries(fdtd-output
1313
semba-types
14+
semba-components
1415
VTKFortran::VTKFortran
1516
)

src_output/movieProbeOutput.F90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module mod_movieProbeOutput
22
use FDETYPES
3+
use Report
34
use outputTypes
45
use mod_outputUtils
56
implicit none

src_output/output.F90

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module output
1515
WIRE_CURRENT_PROBE_ID = 1, &
1616
WIRE_CHARGE_PROBE_ID = 2, &
1717
BULK_PROBE_ID = 3, &
18-
VOLUMIC_CURRENT_PROBE_ID = 4
18+
VOLUMIC_CURRENT_PROBE_ID = 4, &
19+
MOVIE_PROBE_ID = 5
1920

2021
REAL(KIND=RKIND), save :: eps0, mu0
2122
REAL(KIND=RKIND), pointer, dimension(:), save :: InvEps, InvMu
@@ -45,7 +46,8 @@ module output
4546
init_wire_current_probe_output, &
4647
init_wire_charge_probe_output, &
4748
init_bulk_probe_output, &
48-
init_volumic_probe_output
49+
init_volumic_probe_output, &
50+
init_movie_probe_output
4951
!init_far_field, &
5052
!initime_movie_output, &
5153
!init_frequency_slice_output
@@ -107,11 +109,11 @@ subroutine init_outputs(sgg, media, sinpml_fullsize, control, outputs, ThereAreW
107109

108110
allocate (outputs(sgg%NumberRequest))
109111

110-
allocate (InvEps(0:sgg%NumMedia), InvMu(0:sgg%NumMedia))
112+
allocate (InvEps(0:sgg%NumMedia - 1), InvMu(0:sgg%NumMedia - 1))
111113
outputCount = 0
112114

113-
InvEps(0:sgg%NumMedia) = 1.0_RKIND/(Eps0*sgg%Med(0:sgg%NumMedia)%Epr)
114-
InvMu(0:sgg%NumMedia) = 1.0_RKIND/(Mu0*sgg%Med(0:sgg%NumMedia)%Mur)
115+
InvEps(0:sgg%NumMedia - 1) = 1.0_RKIND/(Eps0*sgg%Med(0:sgg%NumMedia - 1)%Epr)
116+
InvMu(0:sgg%NumMedia - 1) = 1.0_RKIND/(Mu0*sgg%Med(0:sgg%NumMedia - 1)%Mur)
115117

116118
do ii = 1, sgg%NumberRequest
117119
do i = 1, sgg%Observation(ii)%nP
@@ -159,13 +161,19 @@ subroutine init_outputs(sgg, media, sinpml_fullsize, control, outputs, ThereAreW
159161
call init_solver_output(outputs(outputCount)%bulkCurrentProbe, lowerBound, upperBound, outputRequestType, domain, outputTypeExtension, control%mpidir)
160162
!! call adjust_computation_range --- Required due to issues in mpi region edges
161163

162-
case (iCur, iCurX, iCurY, iCurZ)
164+
case (iCurX, iCurY, iCurZ)
163165
outputCount = outputCount + 1
164166
outputs(outputCount)%outputID = VOLUMIC_CURRENT_PROBE_ID
165167

166168
allocate (outputs(outputCount)%volumicCurrentProbe)
167169
call init_solver_output(outputs(outputCount)%volumicCurrentProbe, lowerBound, upperBound, outputRequestType, domain, media, sgg%Med, sinpml_fullsize, outputTypeExtension, control%mpidir, sgg%dt)
168170

171+
case (iCur)
172+
outputCount = outputCount + 1
173+
outputs(outputCount)%outputID = MOVIE_PROBE_ID
174+
175+
allocate (outputs(outputCount)%movieProbe)
176+
call init_solver_output(outputs(outputCount)%movieProbe, lowerBound, upperBound, outputRequestType, domain, media, sgg%Med, SINPML_fullsize, outputTypeExtension, control%mpidir)
169177
case default
170178
call stoponerror(0, 0, 'OutputRequestType type not implemented yet on new observations')
171179
end select

src_output/wireProbeOutput.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module mod_wireProbeOutput
2020
!===========================
2121

2222
contains
23-
subroutine init_wire_current_probe_output(this, coordinates, node, field, domain, media, outputTypeExtension, mpidir, wiresflavor)
23+
subroutine init_wire_current_probe_output(this, coordinates, node, field, domain, media, outputTypeExtension, mpidir, wiresflavor)
2424
type(wire_current_probe_output_t), intent(out) :: this
2525
integer(kind=SINGLE), intent(in) :: node
2626
integer(kind=SINGLE), intent(in) :: field, mpidir
@@ -183,7 +183,7 @@ end function get_probe_bounds_extension
183183

184184
end subroutine init_wire_current_probe_output
185185

186-
subroutine init_wire_charge_probe_output(this, coordinates, node, field, domain, outputTypeExtension, mpidir, wiresflavor)
186+
subroutine init_wire_charge_probe_output(this, coordinates, node, field, domain, outputTypeExtension, mpidir, wiresflavor)
187187
type(wire_charge_probe_output_t), intent(out) :: this
188188
integer(kind=SINGLE), intent(in) :: node
189189
integer(kind=SINGLE), intent(in) :: field, mpidir

test/observation/observation_testingTools.F90

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,6 @@ logical function approx_equal(a, b, tol) result(equal)
133133
equal = abs(a - b) <= tol
134134
end function approx_equal
135135

136-
function create_limit_type() result(r)
137-
use FDETYPES
138-
type(limit_t) :: r
139-
end function
140-
141136
function create_xyz_limit_array(XI,YI,ZI,XE,YE,ZE) result(arr)
142137
use FDETYPES
143138
type(XYZlimit_t), dimension(1:6) :: arr
Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
#include <gtest/gtest.h>
2-
3-
extern "C" int test_allocate_serialize_for_time_domain();
4-
extern "C" int test_allocate_serialize_for_frequency_domain();
5-
extern "C" int test_allocate_current();
6-
7-
extern "C" int test_initial_time_less_than_timestep();
8-
extern "C" int test_timestep_greater_and_mapvtk();
9-
extern "C" int test_timestep_greater_not_mapvtk();
10-
extern "C" int test_freqstep_zero_or_large();
11-
extern "C" int test_volumic_false_true_and_saveall();
12-
extern "C" int test_saveall_branch();
13-
extern "C" int test_final_less_than_initial();
14-
extern "C" int test_huge_cap();
15-
16-
extern "C" int test_init_time_movie_observation();
17-
18-
extern "C" int test_update_time_movie_observation();
19-
20-
TEST(observation, test_allocate_time ) {EXPECT_EQ(0, test_allocate_serialize_for_time_domain()); }
21-
TEST(observation, test_allocate_frequency ) {EXPECT_EQ(0, test_allocate_serialize_for_frequency_domain()); }
22-
TEST(observation, test_allocate_serialize_current) {EXPECT_EQ(0, test_allocate_current()); }
23-
24-
TEST(observation, test_preproces_initial_time_less_than_timestep) {EXPECT_EQ(0, test_initial_time_less_than_timestep()); }
25-
TEST(observation, test_preproces_timestep_greater_and_mapvtk ) {EXPECT_EQ(0, test_timestep_greater_and_mapvtk()); }
26-
TEST(observation, test_preproces_timestep_greater_not_mapvtk ) {EXPECT_EQ(0, test_timestep_greater_not_mapvtk()); }
27-
TEST(observation, test_preproces_freqstep_zero_or_large ) {EXPECT_EQ(0, test_freqstep_zero_or_large()); }
28-
TEST(observation, test_preproces_volumic_false_true_and_saveall ) {EXPECT_EQ(0, test_volumic_false_true_and_saveall()); }
29-
TEST(observation, test_preproces_saveall_branch ) {EXPECT_EQ(0, test_saveall_branch()); }
30-
TEST(observation, test_preproces_final_less_than_initial ) {EXPECT_EQ(0, test_final_less_than_initial()); }
31-
TEST(observation, test_preproces_huge_cap ) {EXPECT_EQ(0, test_huge_cap()); }
32-
33-
TEST(observation, test_init_movie_observation ) {EXPECT_EQ(0, test_init_time_movie_observation()); }
34-
35-
TEST(observation, test_update_movie_observation ) {EXPECT_EQ(0, test_update_time_movie_observation()); }
36-
2+
//
3+
//extern "C" int test_allocate_serialize_for_time_domain();
4+
//extern "C" int test_allocate_serialize_for_frequency_domain();
5+
//extern "C" int test_allocate_current();
6+
//
7+
//extern "C" int test_initial_time_less_than_timestep();
8+
//extern "C" int test_timestep_greater_and_mapvtk();
9+
//extern "C" int test_timestep_greater_not_mapvtk();
10+
//extern "C" int test_freqstep_zero_or_large();
11+
//extern "C" int test_volumic_false_true_and_saveall();
12+
//extern "C" int test_saveall_branch();
13+
//extern "C" int test_final_less_than_initial();
14+
//extern "C" int test_huge_cap();
15+
//
16+
//extern "C" int test_init_time_movie_observation();
17+
//
18+
//extern "C" int test_update_time_movie_observation();
19+
//
20+
//TEST(observation, test_allocate_time ) {EXPECT_EQ(0, test_allocate_serialize_for_time_domain()); }
21+
//TEST(observation, test_allocate_frequency ) {EXPECT_EQ(0, test_allocate_serialize_for_frequency_domain()); }
22+
//TEST(observation, test_allocate_serialize_current) {EXPECT_EQ(0, test_allocate_current()); }
23+
//
24+
//TEST(observation, test_preproces_initial_time_less_than_timestep) {EXPECT_EQ(0, test_initial_time_less_than_timestep()); }
25+
//TEST(observation, test_preproces_timestep_greater_and_mapvtk ) {EXPECT_EQ(0, test_timestep_greater_and_mapvtk()); }
26+
//TEST(observation, test_preproces_timestep_greater_not_mapvtk ) {EXPECT_EQ(0, test_timestep_greater_not_mapvtk()); }
27+
//TEST(observation, test_preproces_freqstep_zero_or_large ) {EXPECT_EQ(0, test_freqstep_zero_or_large()); }
28+
//TEST(observation, test_preproces_volumic_false_true_and_saveall ) {EXPECT_EQ(0, test_volumic_false_true_and_saveall()); }
29+
//TEST(observation, test_preproces_saveall_branch ) {EXPECT_EQ(0, test_saveall_branch()); }
30+
//TEST(observation, test_preproces_final_less_than_initial ) {EXPECT_EQ(0, test_final_less_than_initial()); }
31+
//TEST(observation, test_preproces_huge_cap ) {EXPECT_EQ(0, test_huge_cap()); }
32+
//
33+
//TEST(observation, test_init_movie_observation ) {EXPECT_EQ(0, test_init_time_movie_observation()); }
34+
//
35+
//TEST(observation, test_update_movie_observation ) {EXPECT_EQ(0, test_update_time_movie_observation()); }
36+
//
37+
//

test/observation/test_observation_update.F90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ integer function test_update_time_movie_observation() bind(C) result(err)
33
use FDETYPES_TOOLS
44
use Observa
55
use observation_testingTools
6+
use mod_sggMethods
67

78
type(SGGFDTDINFO) :: sgg
89
type(media_matrices_t) :: media
@@ -21,10 +22,10 @@ integer function test_update_time_movie_observation() bind(C) result(err)
2122

2223
type(output_t), pointer, dimension(:) :: output
2324

24-
sgg = create_base_sgg()
25+
call sgg_init(sgg)
2526
call set_sgg_data(sgg)
2627

27-
media = create_media(sgg%Alloc)
28+
media = create_geometry_media_from_sggAlloc(sgg%Alloc)
2829
tag_numbers = create_tag_list(sgg%Alloc)
2930

3031
ThereAreObservation = .false.

test/observation/test_preprocess.F90

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ integer function test_initial_time_less_than_timestep() bind(C) result(err)
2525

2626
finalTimeIndex = 20
2727
dt = 0.1
28-
tiempo => create_time_array(100, dt)
28+
call init_time_array(tiempo, 100, dt)
2929

3030
saveall = .true.
3131

@@ -69,7 +69,7 @@ integer function test_timestep_greater_and_mapvtk() bind(C) result(err)
6969

7070
finalTimeIndex = 90
7171
dt = 0.1
72-
tiempo => create_time_array(100, dt)
72+
call init_time_array(tiempo, 100, dt)
7373

7474
saveall = .false.
7575

@@ -142,7 +142,7 @@ integer function test_freqstep_zero_or_large() bind(C) result(err)
142142

143143
finalTimeIndex = 90
144144
dt = 0.1_RKIND_tiempo
145-
tiempo => create_time_array(100, dt)
145+
call init_time_array(tiempo, 100, dt)
146146
saveall = .false.
147147

148148
! Case A: FreqStep = 0 -> should be set to FinalFreq-InitialFreq
@@ -195,7 +195,7 @@ integer function test_volumic_false_true_and_saveall() bind(C) result(err)
195195

196196
finalTimeIndex = 90
197197
dt = 0.1_RKIND
198-
tiempo => create_time_array(100, dt)
198+
call init_time_array(tiempo, 100, dt)
199199
saveall = .false.
200200

201201
! Case Volumic = .false. and global saveall = .false.
@@ -246,7 +246,7 @@ integer function test_saveall_branch() bind(C) result(err)
246246

247247
finalTimeIndex = 90
248248
dt = 0.1_RKIND
249-
tiempo => create_time_array(100, dt)
249+
call init_time_array(tiempo, 100, dt)
250250
saveall = .false.
251251

252252
obs%Volumic = .false.
@@ -285,7 +285,7 @@ integer function test_final_less_than_initial() bind(C) result(err)
285285

286286
finalTimeIndex = 90
287287
dt = 0.1_RKIND_tiempo
288-
tiempo => create_time_array(100, dt)
288+
call init_time_array(tiempo, 100, dt)
289289
saveall = .false.
290290

291291
obs%Volumic = .false.
@@ -323,7 +323,7 @@ integer function test_huge_cap() bind(C) result(err)
323323

324324
finalTimeIndex = 90
325325
dt = 0.1_RKIND
326-
tiempo => create_time_array(100, dt)
326+
call init_time_array(tiempo, 100, dt)
327327
huge4 = huge(1.0_4)
328328
saveall = .false.
329329

0 commit comments

Comments
 (0)