MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / Field2DInterpToTest

Class Field2DInterpToTest

tests/unit/mesh/test_interpolation.cxx:276–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276class Field2DInterpToTest : public ::testing::Test {
277protected:
278 Field2DInterpToTest() : input(mesh) {
279 input = 0.;
280 input(2, 2) = 2.;
281 input(1, 2) = 1.8;
282 input(0, 2) = 1.7;
283 input(3, 2) = 1.3;
284 input(4, 2) = 1.5;
285 input(2, 1) = 3.8;
286 input(2, 0) = 3.7;
287 input(2, 3) = 3.3;
288 input(2, 4) = 3.5;
289 }
290
291 static void SetUpTestCase() {
292 WithQuietOutput quiet_info{output_info};
293 WithQuietOutput quiet_warn{output_warn};
294 delete mesh;
295 mesh = new FakeMesh(nx, ny, nz);
296 mesh->StaggerGrids = true;
297 mesh->xstart = 2;
298 mesh->ystart = 2;
299 mesh->xend = nx - 3;
300 mesh->yend = ny - 3;
301
302 mesh->createDefaultRegions();
303
304 // We need Coordinates so a parallel transform is available as
305 // FieldFactory::create3D wants to un-field-align the result
306 for (const auto& location :
307 std::list<CELL_LOC>{CELL_CENTRE, CELL_XLOW, CELL_YLOW, CELL_ZLOW}) {
308
309 static_cast<FakeMesh*>(mesh)->setCoordinates(nullptr, location);
310 static_cast<FakeMesh*>(mesh)->setCoordinates(
311 std::make_shared<Coordinates>(
312 mesh, Field2D{1.0, mesh}, Field2D{1.0, mesh}, BoutReal{1.0},
313 Field2D{1.0, mesh}, Field2D{0.0, mesh}, Field2D{1.0, mesh},
314 Field2D{1.0, mesh}, Field2D{1.0, mesh}, Field2D{0.0, mesh},
315 Field2D{0.0, mesh}, Field2D{0.0, mesh}, Field2D{1.0, mesh},
316 Field2D{1.0, mesh}, Field2D{1.0, mesh}, Field2D{0.0, mesh},
317 Field2D{0.0, mesh}, Field2D{0.0, mesh}, Field2D{0.0, mesh},
318 Field2D{0.0, mesh}),
319 location);
320 // No call to Coordinates::geometry() needed here
321 mesh->getCoordinates(location)->setParallelTransform(
322 bout::utils::make_unique<ParallelTransformIdentity>(*mesh));
323 }
324 }
325
326 static void TearDownTestCase() {
327 delete mesh;
328 mesh = nullptr;
329 }
330
331 Field2D input;
332
333public:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected