From 43be3b5c67fe62624e0ae7b8d421306f075a0f67 Mon Sep 17 00:00:00 2001 From: John Omotani Date: Sun, 30 Jun 2019 15:39:34 +0100 Subject: [PATCH 1/2] Move shiftZ(Field3D,...) functions into ParallelTransform --- include/bout/paralleltransform.hxx | 15 +++++++ include/field3d.hxx | 14 +++---- src/field/field3d.cxx | 54 +++++-------------------- src/mesh/parallel/paralleltransform.cxx | 50 +++++++++++++++++++++++ 4 files changed, 83 insertions(+), 50 deletions(-) create mode 100644 src/mesh/parallel/paralleltransform.cxx diff --git a/include/bout/paralleltransform.hxx b/include/bout/paralleltransform.hxx index 69a50a4b66..596d35216a 100644 --- a/include/bout/paralleltransform.hxx +++ b/include/bout/paralleltransform.hxx @@ -83,6 +83,21 @@ public: /// require a twist-shift at branch cuts on closed field lines? virtual bool requiresTwistShift(bool twist_shift_enabled, YDirectionType ytype) = 0; + /// Shift part of a Field3D by a given angle in Z + /// + /// @param[inout] var The variable to be modified in-place + /// @param[in] jx X index + /// @param[in] jy Y index + /// @param[in] zangle The Z angle to apply + virtual void shiftZ(Field3D& f, int jx, int jy, BoutReal zangle); + + /// Apply a phase shift by a given angle \p zangle in Z to all points + /// + /// @param[inout] var The variable to modify in-place + /// @param[in] zangle The angle to shift by in Z + /// @param[in] rgn The region to calculate the result over + void shiftZ(Field3D &var, BoutReal zangle, const std::string& rgn="RGN_ALL"); + protected: /// This method should be called in the constructor to check that if the grid /// has a 'parallel_transform' variable, it has the correct value diff --git a/include/field3d.hxx b/include/field3d.hxx index 273ed9b329..40d3878178 100644 --- a/include/field3d.hxx +++ b/include/field3d.hxx @@ -661,19 +661,19 @@ inline Field3D lowPass(const Field3D &var, int zmax, REGION rgn) { /// @param[in] jx X index /// @param[in] jy Y index /// @param[in] zangle The Z angle to apply -void shiftZ(Field3D &var, int jx, int jy, double zangle); +[[gnu::deprecated("Use ParallelTransform::shiftZ instead")]] +void shiftZ(Field3D& var, int jx, int jy, double zangle); /// Apply a phase shift by a given angle \p zangle in Z to all points /// /// @param[inout] var The variable to modify in-place /// @param[in] zangle The angle to shift by in Z /// @param[in] rgn The region to calculate the result over -void shiftZ(Field3D &var, BoutReal zangle, const std::string& rgn="RGN_ALL"); -[[gnu::deprecated("Please use shiftZ(const Field3D& var, BoutReal zangle, " - "const std::string& region = \"RGN_ALL\") instead")]] -inline void shiftZ(Field3D &var, BoutReal zangle, REGION rgn) { - return shiftZ(var, zangle, toString(rgn)); -} +[[gnu::deprecated("Use ParallelTransform::shiftZ instead")]] +void shiftZ(Field3D& var, BoutReal zangle, const std::string& rgn="RGN_ALL"); +[[gnu::deprecated("Please use ParallelTransform::shiftZ(const Field3D& var, BoutReal " + "zangle, const std::string& region = \"RGN_ALL\") instead")]] +void shiftZ(Field3D& var, BoutReal zangle, REGION rgn); /// Average in the Z direction /// diff --git a/src/field/field3d.cxx b/src/field/field3d.cxx index 99f5df0b91..dba15fe1c4 100644 --- a/src/field/field3d.cxx +++ b/src/field/field3d.cxx @@ -734,49 +734,6 @@ Field3D lowPass(const Field3D &var, int zmax, bool keep_zonal, const std::string return result; } -/* - * Use FFT to shift by an angle in the Z direction - */ -void shiftZ(Field3D &var, int jx, int jy, double zangle) { - TRACE("shiftZ"); - checkData(var); - var.allocate(); // Ensure that var is unique - Mesh *localmesh = var.getMesh(); - - int ncz = localmesh->LocalNz; - if(ncz == 1) - return; // Shifting doesn't do anything - - Array v(ncz/2 + 1); - - rfft(&(var(jx,jy,0)), ncz, v.begin()); // Forward FFT - - BoutReal zlength = var.getCoordinates()->zlength(); - - // Apply phase shift - for(int jz=1;jz<=ncz/2;jz++) { - BoutReal kwave=jz*2.0*PI/zlength; // wave number is 1/[rad] - v[jz] *= dcomplex(cos(kwave*zangle) , -sin(kwave*zangle)); - } - - irfft(v.begin(), ncz, &(var(jx,jy,0))); // Reverse FFT -} - -void shiftZ(Field3D &var, double zangle, const std::string& rgn) { - const auto region_str = toString(rgn); - - // Only allow a whitelist of regions for now - ASSERT2(region_str == "RGN_ALL" || region_str == "RGN_NOBNDRY" || - region_str == "RGN_NOX" || region_str == "RGN_NOY"); - - const Region ®ion = var.getRegion2D(region_str); - - // Could be OpenMP if shiftZ(Field3D, int, int, double) didn't throw - BOUT_FOR_SERIAL(i, region) { - shiftZ(var, i.x(), i.y(), zangle); - } -} - namespace { // Internal routine to avoid ugliness with interactions between CHECK // levels and UNUSED parameters @@ -805,6 +762,17 @@ void checkData(const Field3D &f, const std::string& region) { } #endif +void shiftZ(Field3D& var, int jx, int jy, double zangle) { + var.getCoordinates()->getParallelTransform().shiftZ(var, jx, jy, zangle); +} + +void shiftZ(Field3D& var, BoutReal zangle, const std::string& rgn) { + var.getCoordinates()->getParallelTransform().shiftZ(var, zangle, rgn); +} +void shiftZ(Field3D& var, BoutReal zangle, REGION rgn) { + var.getCoordinates()->getParallelTransform().shiftZ(var, zangle, toString(rgn)); +} + Field2D DC(const Field3D &f, const std::string& rgn) { TRACE("DC(Field3D)"); diff --git a/src/mesh/parallel/paralleltransform.cxx b/src/mesh/parallel/paralleltransform.cxx new file mode 100644 index 0000000000..36d8618b4e --- /dev/null +++ b/src/mesh/parallel/paralleltransform.cxx @@ -0,0 +1,50 @@ +/* + * Shared methods for all ParallelTransform classes + * + */ + +#include "bout/mesh.hxx" +#include "bout/paralleltransform.hxx" + +/* + * Use FFT to shift by an angle in the Z direction + */ +void ParallelTransform::shiftZ(Field3D &f, int jx, int jy, double zangle) { + TRACE("shiftZ"); + checkData(f); + f.allocate(); // Ensure that f is unique + Mesh *localmesh = f.getMesh(); + + int ncz = localmesh->LocalNz; + if(ncz == 1) + return; // Shifting doesn't do anything + + Array v(ncz/2 + 1); + + rfft(&(f(jx,jy,0)), ncz, v.begin()); // Forward FFT + + BoutReal zlength = f.getCoordinates()->zlength(); + + // Apply phase shift + for(int jz=1;jz<=ncz/2;jz++) { + BoutReal kwave=jz*2.0*PI/zlength; // wave number is 1/[rad] + v[jz] *= dcomplex(cos(kwave*zangle) , -sin(kwave*zangle)); + } + + irfft(v.begin(), ncz, &(f(jx,jy,0))); // Reverse FFT +} + +void ParallelTransform::shiftZ(Field3D &var, double zangle, const std::string& rgn) { + const auto region_str = toString(rgn); + + // Only allow a whitelist of regions for now + ASSERT2(region_str == "RGN_ALL" || region_str == "RGN_NOBNDRY" || + region_str == "RGN_NOX" || region_str == "RGN_NOY"); + + const Region ®ion = var.getRegion2D(region_str); + + // Could be OpenMP if shiftZ(Field3D, int, int, double) didn't throw + BOUT_FOR_SERIAL(i, region) { + shiftZ(var, i.x(), i.y(), zangle); + } +} From 0ee4384ffa586d0629f096c9615cf7e2191f3e4f Mon Sep 17 00:00:00 2001 From: John Omotani Date: Sun, 30 Jun 2019 15:59:41 +0100 Subject: [PATCH 2/2] Move applying twist-shift from BoutMesh into ParallelTransform Twist-shift at branch cuts not applied by a method ParallelTransform::applyTwistShift, which is called during communications for Field3Ds in BoutMesh::wait() (via Field3D::applyTwistShift() method): - ParallelTransformIdentity applies twist-shift to all fields (if TwistShift==true). - ShiftedMetric applies twist-shift only to field-aligned fields (checking TwistShift==true if a field-aligned field is found). - FCITransform does not twist-shift any field, checking that no field passed to it is field-aligned. The guard cells where a twist shift is needed are specified by 'Region's "TwistShiftDown" and "TwistShiftUp" created by BoutMesh. --- include/bout/paralleltransform.hxx | 33 +++++------ include/field3d.hxx | 6 +- src/field/field3d.cxx | 5 +- src/mesh/coordinates.cxx | 9 ++- src/mesh/impls/bout/boutmesh.cxx | 59 ++++++++----------- src/mesh/parallel/fci.hxx | 8 ++- src/mesh/parallel/identity.cxx | 22 +++++++ src/mesh/parallel/makefile | 2 +- src/mesh/parallel/paralleltransform.cxx | 2 + src/mesh/parallel/shiftedmetric.cxx | 46 +++++++++++++++ tests/unit/field/test_field_factory.cxx | 9 ++- tests/unit/field/test_initialprofiles.cxx | 3 +- tests/unit/include/test_derivs.cxx | 2 +- tests/unit/mesh/data/test_gridfromoptions.cxx | 3 +- tests/unit/mesh/test_interpolation.cxx | 3 +- tests/unit/mesh/test_paralleltransform.cxx | 18 ++++-- tests/unit/test_extras.hxx | 6 +- 17 files changed, 157 insertions(+), 79 deletions(-) diff --git a/include/bout/paralleltransform.hxx b/include/bout/paralleltransform.hxx index 596d35216a..ef957f2547 100644 --- a/include/bout/paralleltransform.hxx +++ b/include/bout/paralleltransform.hxx @@ -79,9 +79,8 @@ public: /// Output variables used by a ParallelTransform instance to the dump files virtual void outputVars(Datafile& UNUSED(file)) {} - /// If \p twist_shift_enabled is true, does a `Field3D` with Y direction \p ytype - /// require a twist-shift at branch cuts on closed field lines? - virtual bool requiresTwistShift(bool twist_shift_enabled, YDirectionType ytype) = 0; + /// If \p twist_shift_enabled is true, apply twist-shift to `Field3D f` + virtual void applyTwistShift(Field3D& f, bool twist_shift_enabled) = 0; /// Shift part of a Field3D by a given angle in Z /// @@ -113,7 +112,9 @@ protected: */ class ParallelTransformIdentity : public ParallelTransform { public: - ParallelTransformIdentity(Mesh& mesh_in) : ParallelTransform(mesh_in) { + ParallelTransformIdentity(Mesh& mesh_in, std::vector ShiftAngle_in) + : ParallelTransform(mesh_in), ShiftAngle(std::move(ShiftAngle_in)) { + // check the coordinate system used for the grid data source ParallelTransformIdentity::checkInputGrid(); } @@ -152,14 +153,12 @@ public: bool canToFromFieldAligned() override { return true; } - bool requiresTwistShift(bool twist_shift_enabled, YDirectionType UNUSED(ytype)) override { - // All Field3Ds require twist-shift, because all are effectively field-aligned, but - // allow twist-shift to be turned off by twist_shift_enabled - return twist_shift_enabled; - } + void applyTwistShift(Field3D& f, bool twist_shift_enabled); protected: void checkInputGrid() override; + + std::vector ShiftAngle; ///< Angle for twist-shift location }; /*! @@ -207,14 +206,7 @@ public: /// Save zShift to the output void outputVars(Datafile& file) override; - bool requiresTwistShift(bool twist_shift_enabled, YDirectionType ytype) override { - // Twist-shift only if field-aligned - if (ytype == YDirectionType::Aligned and not twist_shift_enabled) { - throw BoutException("'TwistShift = true' is required to communicate field-aligned " - "Field3Ds when using ShiftedMetric."); - } - return ytype == YDirectionType::Aligned; - } + void applyTwistShift(Field3D& f, bool twist_shift_enabled); protected: void checkInputGrid() override; @@ -235,7 +227,12 @@ private: /// orthogonal coordinates to field-aligned coordinates Tensor fromAlignedPhs; ///< Cache of phase shifts for transforming from /// field-aligned coordinates to X-Z orthogonal - /// coordinates + /// coordinates + + Matrix twistShiftDownPhs; ///< Cache of phase shifts for twist-shift by + /// ShiftAngle going down in Y + Matrix twistShiftUpPhs; ///< Cache of phase shifts for twist-shift by + /// ShiftAngle going up in Y /// Helper POD for parallel slice phase shifts struct ParallelSlicePhase { diff --git a/include/field3d.hxx b/include/field3d.hxx index 40d3878178..d719dfd529 100644 --- a/include/field3d.hxx +++ b/include/field3d.hxx @@ -297,9 +297,9 @@ class Field3D : public Field, public FieldData { Field3D& ynext(int offset); const Field3D& ynext(int offset) const; - /// If \p twist_shift_enabled is true, does this Field3D require a twist-shift at branch - /// cuts on closed field lines? - bool requiresTwistShift(bool twist_shift_enabled); + /// If \p twist_shift_enabled is true, apply twist-shift to this Field3D at branch cuts + /// on closed field lines? + void applyTwistShift(bool twist_shift_enabled); ///////////////////////////////////////////////////////// // Data access diff --git a/src/field/field3d.cxx b/src/field/field3d.cxx index dba15fe1c4..9d1011e244 100644 --- a/src/field/field3d.cxx +++ b/src/field/field3d.cxx @@ -208,9 +208,8 @@ Field3D &Field3D::ynext(int dir) { return const_cast(static_cast(*this).ynext(dir)); } -bool Field3D::requiresTwistShift(bool twist_shift_enabled) { - return getCoordinates()->getParallelTransform().requiresTwistShift(twist_shift_enabled, - getDirectionY()); +void Field3D::applyTwistShift(bool twist_shift_enabled) { + getCoordinates()->getParallelTransform().applyTwistShift(*this, twist_shift_enabled); } // Not in header because we need to access fieldmesh diff --git a/src/mesh/coordinates.cxx b/src/mesh/coordinates.cxx index 5b026dbe4f..2af51d8761 100644 --- a/src/mesh/coordinates.cxx +++ b/src/mesh/coordinates.cxx @@ -1102,7 +1102,14 @@ void Coordinates::setParallelTransform(Options* options) { if(ptstr == "identity") { // Identity method i.e. no transform needed - transform = bout::utils::make_unique(*localmesh); + + std::vector ShiftAngle(localmesh->LocalNx); + for (int x=0; xLocalNx; x++) { + localmesh->periodicY(x, ShiftAngle[x]); + } + + transform = bout::utils::make_unique(*localmesh, + ShiftAngle); } else if (ptstr == "shifted") { // Shifted metric method diff --git a/src/mesh/impls/bout/boutmesh.cxx b/src/mesh/impls/bout/boutmesh.cxx index ef11247a72..caa788eab7 100644 --- a/src/mesh/impls/bout/boutmesh.cxx +++ b/src/mesh/impls/bout/boutmesh.cxx @@ -1163,41 +1163,7 @@ int BoutMesh::wait(comm_handle handle) { // TWIST-SHIFT CONDITION // Loop over 3D fields for (const auto &var : ch->var_list.field3d()) { - if (var->requiresTwistShift(TwistShift)) { - - // Twist-shift only needed for field-aligned fields - int jx, jy; - - // Perform Twist-shift using shifting method - if (var->getDirectionY() == YDirectionType::Aligned) { - // Only variables in field-aligned coordinates need the twist-shift boundary - // condition to be applied - - // Lower boundary - if (TS_down_in && (DDATA_INDEST != -1)) { - for (jx = 0; jx < DDATA_XSPLIT; jx++) - for (jy = 0; jy != MYG; jy++) - shiftZ(*var, jx, jy, ShiftAngle[jx]); - } - if (TS_down_out && (DDATA_OUTDEST != -1)) { - for (jx = DDATA_XSPLIT; jx < LocalNx; jx++) - for (jy = 0; jy != MYG; jy++) - shiftZ(*var, jx, jy, ShiftAngle[jx]); - } - - // Upper boundary - if (TS_up_in && (UDATA_INDEST != -1)) { - for (jx = 0; jx < UDATA_XSPLIT; jx++) - for (jy = LocalNy - MYG; jy != LocalNy; jy++) - shiftZ(*var, jx, jy, -ShiftAngle[jx]); - } - if (TS_up_out && (UDATA_OUTDEST != -1)) { - for (jx = UDATA_XSPLIT; jx < LocalNx; jx++) - for (jy = LocalNy - MYG; jy != LocalNy; jy++) - shiftZ(*var, jx, jy, -ShiftAngle[jx]); - } - } - } + var->applyTwistShift(TwistShift); } #if CHECK > 0 @@ -1884,6 +1850,29 @@ void BoutMesh::topology() { if (UDATA_XSPLIT > LocalNx) UDATA_XSPLIT = LocalNx; + // Create Regions for applying twist-shift + auto twist_shift_down = Region(); + if (TS_down_in && (DDATA_INDEST != -1)) { + twist_shift_down += Region(0, DDATA_XSPLIT - 1, 0, ystart - 1, 0, 0, LocalNy, + 1, maxregionblocksize); + } + if (TS_down_out && (DDATA_OUTDEST != -1)) { + twist_shift_down += Region(DDATA_XSPLIT, LocalNx - 1, 0, ystart - 1, 0, 0, + LocalNy, 1, maxregionblocksize); + } + addRegion2D("TwistShiftDown", twist_shift_down); + + auto twist_shift_up = Region(); + if (TS_up_in && (UDATA_INDEST != -1)) { + twist_shift_up += Region(0, UDATA_XSPLIT - 1, yend + 1, LocalNy - 1, 0, 0, + LocalNy, 1, maxregionblocksize); + } + if (TS_up_out && (UDATA_OUTDEST != -1)) { + twist_shift_up += Region(UDATA_XSPLIT, LocalNx - 1, yend + 1, LocalNy - 1, 0, + 0, LocalNy, 1, maxregionblocksize); + } + addRegion2D("TwistShiftUp", twist_shift_up); + // Print out settings output_info.write("\tMYPE_IN_CORE = %d\n", MYPE_IN_CORE); output_info.write("\tDXS = %d, DIN = %d. DOUT = %d\n", DDATA_XSPLIT, DDATA_INDEST, diff --git a/src/mesh/parallel/fci.hxx b/src/mesh/parallel/fci.hxx index 19a7559e74..86270cb470 100644 --- a/src/mesh/parallel/fci.hxx +++ b/src/mesh/parallel/fci.hxx @@ -109,11 +109,13 @@ public: bool canToFromFieldAligned() override { return false; } - bool requiresTwistShift(bool UNUSED(twist_shift_enabled), MAYBE_UNUSED(YDirectionType ytype)) override { + void applyTwistShift(MAYBE_UNUSED(Field3D& f), bool UNUSED(twist_shift_enabled)) { // No Field3Ds require twist-shift, because they cannot be field-aligned - ASSERT1(ytype == YDirectionType::Standard); + ASSERT1(f.getDirectionY() == YDirectionType::Standard); + } - return false; + void shiftZ(Field3D& UNUSED(f), int UNUSED(jx), int UNUSED(jy), BoutReal UNUSED(zangle)) { + throw BoutException("FCI method cannot shift Field3D by an angle in Z"); } protected: diff --git a/src/mesh/parallel/identity.cxx b/src/mesh/parallel/identity.cxx index bf2bdc2930..6c9fec4fe7 100644 --- a/src/mesh/parallel/identity.cxx +++ b/src/mesh/parallel/identity.cxx @@ -35,3 +35,25 @@ void ParallelTransformIdentity::checkInputGrid() { } // else: parallel_transform variable not found in grid input, indicates older input // file so must rely on the user having ensured the type is correct } + +void ParallelTransformIdentity::applyTwistShift(Field3D& f, bool twist_shift_enabled) { + // All Field3Ds require twist-shift, because all are effectively field-aligned, but + // allow twist-shift to be turned off by twist_shift_enabled + if (twist_shift_enabled) { + // Lower boundary + // Note "TwistShiftDown" Region is empty if no twist-shift is required at the lower + // boundary of this processor + BOUT_FOR(i, f.getRegion2D("TwistShiftDown")) { + int x = i.x(); + ParallelTransform::shiftZ(f, x, i.y(), ShiftAngle[x]); + } + + // Upper boundary + // Note "TwistShiftUp" Region is empty if no twist-shift is required at the upper + // boundary of this processor + BOUT_FOR(i, f.getRegion2D("TwistShiftUp")) { + int x = i.x(); + ParallelTransform::shiftZ(f, x, i.y(), -ShiftAngle[x]); + } + } +} diff --git a/src/mesh/parallel/makefile b/src/mesh/parallel/makefile index 2e522318de..26fdbff1d5 100644 --- a/src/mesh/parallel/makefile +++ b/src/mesh/parallel/makefile @@ -2,7 +2,7 @@ BOUT_TOP = ../../.. DIRS = -SOURCEC = shiftedmetric.cxx fci.cxx identity.cxx +SOURCEC = shiftedmetric.cxx fci.cxx identity.cxx paralleltransform.cxx TARGET = lib include $(BOUT_TOP)/make.config diff --git a/src/mesh/parallel/paralleltransform.cxx b/src/mesh/parallel/paralleltransform.cxx index 36d8618b4e..8b4b59b36b 100644 --- a/src/mesh/parallel/paralleltransform.cxx +++ b/src/mesh/parallel/paralleltransform.cxx @@ -3,8 +3,10 @@ * */ +#include #include "bout/mesh.hxx" #include "bout/paralleltransform.hxx" +#include /* * Use FFT to shift by an angle in the Z direction diff --git a/src/mesh/parallel/shiftedmetric.cxx b/src/mesh/parallel/shiftedmetric.cxx index 2a27c67363..1c770aa4dd 100644 --- a/src/mesh/parallel/shiftedmetric.cxx +++ b/src/mesh/parallel/shiftedmetric.cxx @@ -72,6 +72,24 @@ void ShiftedMetric::cachePhases() { } } + // Allocate storage for our twist-shift phase information. + twistShiftDownPhs = Matrix(mesh.LocalNx, nmodes); + twistShiftUpPhs = Matrix(mesh.LocalNx, nmodes); + + // To/From field aligned phases + for (int ix=0; ix& phs, const YDirectionType y_direction_out, const std::string& region) const { diff --git a/tests/unit/field/test_field_factory.cxx b/tests/unit/field/test_field_factory.cxx index d11d0fb2bc..2f64d73db6 100644 --- a/tests/unit/field/test_field_factory.cxx +++ b/tests/unit/field/test_field_factory.cxx @@ -30,7 +30,8 @@ class FieldFactoryCreationTest : public FakeMeshFixture { static_cast(mesh)->setCoordinates(test_coords); mesh->getCoordinates()->setParallelTransform( - bout::utils::make_unique(*mesh)); + bout::utils::make_unique(*mesh, + std::vector())); for (const auto& location : std::list{CELL_CENTRE, CELL_XLOW, CELL_YLOW, CELL_ZLOW}) { @@ -39,7 +40,8 @@ class FieldFactoryCreationTest : public FakeMeshFixture { location); mesh_staggered->getCoordinates(location)->setParallelTransform( - bout::utils::make_unique(*mesh_staggered)); + bout::utils::make_unique(*mesh_staggered, + std::vector())); } } @@ -573,7 +575,8 @@ TYPED_TEST(FieldFactoryCreationTest, CreateOnMesh) { Field2D{0.0}, Field2D{0.0}, Field2D{0.0}, Field2D{0.0}, false)); localmesh.getCoordinates()->setParallelTransform( - bout::utils::make_unique(localmesh)); + bout::utils::make_unique(localmesh, + std::vector())); auto output = this->create("x", nullptr, &localmesh); diff --git a/tests/unit/field/test_initialprofiles.cxx b/tests/unit/field/test_initialprofiles.cxx index db4d7e2ec4..567036c3d0 100644 --- a/tests/unit/field/test_initialprofiles.cxx +++ b/tests/unit/field/test_initialprofiles.cxx @@ -26,7 +26,8 @@ class InitialProfileTest : public FakeMeshFixture { static_cast(mesh)->setCoordinates(test_coords); mesh->getCoordinates()->setParallelTransform( - bout::utils::make_unique(*mesh)); + bout::utils::make_unique(*mesh, + std::vector())); } virtual ~InitialProfileTest() { Options::cleanup(); } diff --git a/tests/unit/include/test_derivs.cxx b/tests/unit/include/test_derivs.cxx index e7b73acaae..7781120a55 100644 --- a/tests/unit/include/test_derivs.cxx +++ b/tests/unit/include/test_derivs.cxx @@ -140,7 +140,7 @@ class DerivativesTest } // We need the parallel slices for the y-direction - ParallelTransformIdentity identity{*mesh}; + ParallelTransformIdentity identity{*mesh, std::vector()}; identity.calcParallelSlices(input); identity.calcParallelSlices(velocity); }; diff --git a/tests/unit/mesh/data/test_gridfromoptions.cxx b/tests/unit/mesh/data/test_gridfromoptions.cxx index e926e83f93..d3a0ab00de 100644 --- a/tests/unit/mesh/data/test_gridfromoptions.cxx +++ b/tests/unit/mesh/data/test_gridfromoptions.cxx @@ -49,7 +49,8 @@ class GridFromOptionsTest : public ::testing::Test { // We need a parallel transform as FieldFactory::create3D wants to // un-field-align the result mesh_from_options.getCoordinates()->setParallelTransform( - bout::utils::make_unique(mesh_from_options)); + bout::utils::make_unique(mesh_from_options, + std::vector())); expected_2d = makeField( [](Field2D::ind_type& index) { diff --git a/tests/unit/mesh/test_interpolation.cxx b/tests/unit/mesh/test_interpolation.cxx index 7c03ee9d9f..d692d7eb45 100644 --- a/tests/unit/mesh/test_interpolation.cxx +++ b/tests/unit/mesh/test_interpolation.cxx @@ -74,7 +74,8 @@ class Field3DInterpToTest : public ::testing::Test { Field2D{0.0, mesh}, Field2D{0.0, mesh}, Field2D{0.0, mesh}, false), location); mesh->getCoordinates(location)->setParallelTransform( - bout::utils::make_unique(*mesh)); + bout::utils::make_unique(*mesh, + std::vector())); } } diff --git a/tests/unit/mesh/test_paralleltransform.cxx b/tests/unit/mesh/test_paralleltransform.cxx index 8085107572..27f96e15a5 100644 --- a/tests/unit/mesh/test_paralleltransform.cxx +++ b/tests/unit/mesh/test_paralleltransform.cxx @@ -13,7 +13,8 @@ using ParallelTransformTest = FakeMeshFixture; TEST_F(ParallelTransformTest, IdentityCalcParallelSlices) { - ParallelTransformIdentity transform{*bout::globals::mesh}; + ParallelTransformIdentity transform{*bout::globals::mesh, + std::vector()}; Field3D field{1.0}; @@ -25,7 +26,8 @@ TEST_F(ParallelTransformTest, IdentityCalcParallelSlices) { TEST_F(ParallelTransformTest, IdentityCalcTwoParallelSlices) { - ParallelTransformIdentity transform{*bout::globals::mesh}; + ParallelTransformIdentity transform{*bout::globals::mesh, + std::vector()}; bout::globals::mesh->ystart = 2; @@ -42,7 +44,8 @@ TEST_F(ParallelTransformTest, IdentityCalcTwoParallelSlices) { TEST_F(ParallelTransformTest, IdentityToFieldAligned) { - ParallelTransformIdentity transform{*bout::globals::mesh}; + ParallelTransformIdentity transform{*bout::globals::mesh, + std::vector()}; Field3D field{1.0}; @@ -54,7 +57,8 @@ TEST_F(ParallelTransformTest, IdentityToFieldAligned) { TEST_F(ParallelTransformTest, IdentityFromFieldAligned) { - ParallelTransformIdentity transform{*bout::globals::mesh}; + ParallelTransformIdentity transform{*bout::globals::mesh, + std::vector()}; Field3D field{1.0}; field.setDirectionY(YDirectionType::Aligned); @@ -67,7 +71,8 @@ TEST_F(ParallelTransformTest, IdentityFromFieldAligned) { TEST_F(ParallelTransformTest, IdentityToFieldAlignedFieldPerp) { - ParallelTransformIdentity transform{*bout::globals::mesh}; + ParallelTransformIdentity transform{*bout::globals::mesh, + std::vector()}; FieldPerp field{1.0}; field.setIndex(2); @@ -80,7 +85,8 @@ TEST_F(ParallelTransformTest, IdentityToFieldAlignedFieldPerp) { TEST_F(ParallelTransformTest, IdentityFromFieldAlignedFieldPerp) { - ParallelTransformIdentity transform{*bout::globals::mesh}; + ParallelTransformIdentity transform{*bout::globals::mesh, + std::vector()}; FieldPerp field{1.0}; field.setIndex(2); diff --git a/tests/unit/test_extras.hxx b/tests/unit/test_extras.hxx index 21a5398bb7..60dec292c8 100644 --- a/tests/unit/test_extras.hxx +++ b/tests/unit/test_extras.hxx @@ -397,7 +397,8 @@ public: // May need a ParallelTransform to create fields, because create3D calls // fromFieldAligned test_coords->setParallelTransform( - bout::utils::make_unique(*bout::globals::mesh)); + bout::utils::make_unique(*bout::globals::mesh, + std::vector())); delete mesh_staggered; mesh_staggered = new FakeMesh(nx, ny, nz); @@ -419,7 +420,8 @@ public: Field2D{0.0, mesh_staggered}, Field2D{0.0, mesh_staggered}, Field2D{0.0, mesh_staggered}, Field2D{0.0, mesh_staggered}, false); test_coords_staggered->setParallelTransform( - bout::utils::make_unique(*mesh_staggered)); + bout::utils::make_unique(*mesh_staggered, + std::vector())); } virtual ~FakeMeshFixture() {