Skip to content

Commit b512667

Browse files
committed
Merge branch 'refactor-coordinates' into cylindrical-to-cartesian into fake_mesh_fixture.hxx
1 parent 89c20ec commit b512667

1 file changed

Lines changed: 31 additions & 23 deletions

File tree

tests/unit/fake_mesh_fixture.hxx

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,32 @@ public:
4141
bout::globals::mpi = &mpi;
4242
bout::globals::mesh = &mesh_m;
4343
bout::globals::mesh->createDefaultRegions();
44-
mesh_m.setCoordinates(nullptr);
44+
static_cast<FakeMesh*>(bout::globals::mesh)->setCoordinates(nullptr);
4545
test_coords = std::make_shared<Coordinates>(
4646
bout::globals::mesh, Field2D{1.0}, Field2D{1.0}, Field2D{1.0}, Field2D{1.0},
4747
Field2D{1.0}, Field2D{1.0}, Field2D{1.0}, Field2D{1.0}, Field2D{0.0},
4848
Field2D{0.0}, Field2D{0.0}, Field2D{1.0}, Field2D{1.0}, Field2D{1.0},
4949
Field2D{0.0}, Field2D{0.0}, Field2D{0.0}, Field2D{0.0}, Field2D{0.0});
5050

51-
// Set some auxilliary variables
52-
// Usually set in geometry()
53-
// Note: For testing these are set to non-zero values
54-
test_coords->G1 = test_coords->G2 = test_coords->G3 = 0.1;
55-
5651
// Set nonuniform corrections
57-
test_coords->non_uniform = true;
58-
test_coords->d1_dx = test_coords->d1_dy = 0.2;
59-
test_coords->d1_dz = 0.0;
52+
test_coords->setNon_uniform(true);
53+
test_coords->setD1_dx(0.2);
54+
test_coords->setD1_dy(0.2);
55+
test_coords->setD1_dz(0.0);
56+
6057
#if BOUT_USE_METRIC_3D
61-
test_coords->Bxy.splitParallelSlices();
62-
test_coords->Bxy.yup() = test_coords->Bxy.ydown() = test_coords->Bxy;
58+
59+
FieldMetric mutable_Bxy = test_coords->Bxy();
60+
mutable_Bxy.splitParallelSlices();
61+
test_coords->setBxy(mutable_Bxy);
62+
63+
mutable_Bxy = test_coords->Bxy();
64+
mutable_Bxy.yup() = test_coords->Bxy();
65+
mutable_Bxy.ydown() = test_coords->Bxy();
66+
test_coords->setBxy(mutable_Bxy);
67+
6368
#endif
6469

65-
// No call to Coordinates::geometry() needed here
6670
mesh_m.setCoordinates(test_coords);
6771
mesh_m.setGridDataSource(new FakeGridDataSource());
6872
// May need a ParallelTransform to create fields, because create3D calls
@@ -90,21 +94,25 @@ public:
9094
Field2D{0.0, &mesh_staggered_m}, Field2D{0.0, &mesh_staggered_m},
9195
Field2D{0.0, &mesh_staggered_m}, Field2D{0.0, &mesh_staggered_m});
9296

93-
// Set some auxilliary variables
94-
test_coords_staggered->G1 = test_coords_staggered->G2 = test_coords_staggered->G3 =
95-
0.1;
96-
9797
// Set nonuniform corrections
98-
test_coords_staggered->non_uniform = true;
99-
test_coords_staggered->d1_dx = test_coords_staggered->d1_dy = 0.2;
100-
test_coords_staggered->d1_dz = 0.0;
98+
test_coords_staggered->setNon_uniform(true);
99+
test_coords_staggered->setD1_dx(0.2);
100+
test_coords_staggered->setD1_dy(0.2);
101+
test_coords_staggered->setD1_dz(0.0);
102+
101103
#if BOUT_USE_METRIC_3D
102-
test_coords_staggered->Bxy.splitParallelSlices();
103-
test_coords_staggered->Bxy.yup() = test_coords_staggered->Bxy.ydown() =
104-
test_coords_staggered->Bxy;
104+
105+
mutable_Bxy = test_coords_staggered->Bxy();
106+
mutable_Bxy.splitParallelSlices();
107+
test_coords_staggered->setBxy(mutable_Bxy);
108+
109+
mutable_Bxy = test_coords_staggered->Bxy();
110+
mutable_Bxy.yup() = test_coords_staggered->Bxy();
111+
mutable_Bxy.ydown() = test_coords_staggered->Bxy();
112+
test_coords_staggered->setBxy(mutable_Bxy);
113+
105114
#endif
106115

107-
// No call to Coordinates::geometry() needed here
108116
test_coords_staggered->setParallelTransform(
109117
bout::utils::make_unique<ParallelTransformIdentity>(mesh_staggered_m));
110118

0 commit comments

Comments
 (0)