MCPcopy Create free account
hub / github.com/NanoComp/meep / test_metal

Function test_metal

tests/three_d.cpp:93–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93int test_metal(double eps(const vec &), int splitting) {
94 double a = 10.0;
95 double ttot = 17.0;
96
97 grid_volume gv = vol3d(1.5, 0.5, 1.0, a);
98 structure s1(gv, eps);
99 structure s(gv, eps, no_pml(), identity(), splitting);
100
101 master_printf("Metal test using %d chunks...\n", splitting);
102 fields f(&s);
103 f.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(1.299, 0.299, 0.401), 1.0);
104 fields f1(&s1);
105 f1.add_point_source(Ez, 0.8, 0.6, 0.0, 4.0, vec(1.299, 0.299, 0.401), 1.0);
106 double field_energy_check_time = 8.0;
107 while (f.time() < ttot) {
108 f.step();
109 f1.step();
110 if (!compare_point(f, f1, vec(0.5, 0.5, 0.01))) return 0;
111 if (!compare_point(f, f1, vec(0.46, 0.33, 0.33))) return 0;
112 if (!compare_point(f, f1, vec(1.301, 0.301, 0.399))) return 0;
113 if (f.time() >= field_energy_check_time) {
114 if (!compare(f.field_energy(), f1.field_energy(), " total energy")) return 0;
115 if (!compare(f.electric_energy_in_box(gv.surroundings()),
116 f1.electric_energy_in_box(gv.surroundings()), "electric energy"))
117 return 0;
118 if (!compare(f.magnetic_energy_in_box(gv.surroundings()),
119 f1.magnetic_energy_in_box(gv.surroundings()), "magnetic energy"))
120 return 0;
121 field_energy_check_time += 5.0;
122 }
123 }
124 return 1;
125}
126
127int test_periodic(double eps(const vec &), int splitting) {
128 double a = 10.0;

Callers 1

mainFunction · 0.70

Calls 13

vol3dFunction · 0.85
identityFunction · 0.85
master_printfFunction · 0.85
add_point_sourceMethod · 0.80
timeMethod · 0.80
stepMethod · 0.80
field_energyMethod · 0.80
surroundingsMethod · 0.80
compare_pointFunction · 0.70
compareFunction · 0.70
vecClass · 0.50

Tested by

no test coverage detected