Skip to content

Commit

Permalink
Add field 'mesh' to DifferentialOperators.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchapman committed Nov 26, 2023
1 parent ce34e02 commit 4ff8508
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion include/bout/differential_operators.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public:
using FieldMetric = Field2D;
#endif

DifferentialOperators(CELL_LOC& location, FieldMetric& dx, FieldMetric& dy,
DifferentialOperators(Mesh* mesh, CELL_LOC& location, FieldMetric& dx, FieldMetric& dy,
FieldMetric& dz);

FieldMetric DDX(const Field2D& f, CELL_LOC outloc = CELL_DEFAULT,
Expand Down Expand Up @@ -98,6 +98,7 @@ public:
Field2D Laplace_perpXY(const Field2D& A, const Field2D& f);

private:
Mesh* mesh;
CELL_LOC& location;
FieldMetric& dx;
FieldMetric& dy;
Expand Down
9 changes: 5 additions & 4 deletions src/mesh/differential_operators.cxx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

#include "bout/differential_operators.hxx"

DifferentialOperators::DifferentialOperators(CELL_LOC& location, FieldMetric& dx,
FieldMetric& dy, FieldMetric& dz)
: location(location), dx(dx), dy(dy), dz(dz) {}
DifferentialOperators::DifferentialOperators(Mesh* mesh, CELL_LOC& location,
FieldMetric& dx, FieldMetric& dy,
FieldMetric& dz)
: mesh(mesh), location(location), dx(dx), dy(dy), dz(dz) {}

DifferentialOperators::FieldMetric DifferentialOperators::DDX(const Field2D& f,
CELL_LOC loc,
Expand Down Expand Up @@ -51,7 +52,7 @@ DifferentialOperators::DDZ(const Field2D& f, CELL_LOC loc,
const std::string& UNUSED(method),
const std::string& UNUSED(region)) {
ASSERT1(location == loc || loc == CELL_DEFAULT)
ASSERT1(f.getMesh() == localmesh)
ASSERT1(f.getMesh() == mesh)
if (loc == CELL_DEFAULT) {
loc = f.getLocation();
}
Expand Down

0 comments on commit 4ff8508

Please sign in to comment.