Skip to content

Commit

Permalink
Remove redundant semicolons.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchapman committed Nov 22, 2023
1 parent 0ac62af commit 40de3ee
Showing 1 changed file with 32 additions and 33 deletions.
65 changes: 32 additions & 33 deletions src/mesh/coordinates.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ const Field2D interpolateAndExtrapolate(const Field2D& f, CELL_LOC location,
// this point should already be set correctly because the metric
// components have been interpolated to here.
if (extrap_start > 0 and f.getLocation() != location) {
ASSERT1(bndry->bx == 0 or localmesh->xstart > 1);
ASSERT1(bndry->by == 0 or localmesh->ystart > 1);
ASSERT1(bndry->bx == 0 or localmesh->xstart > 1)
ASSERT1(bndry->by == 0 or localmesh->ystart > 1)
// note that either bx or by is >0 here
result(bndry->x, bndry->y) =
(9.
Expand Down Expand Up @@ -1365,7 +1365,7 @@ void Coordinates::setParallelTransform(Options* options) {
Coordinates::FieldMetric Coordinates::DDX(const Field2D& f, CELL_LOC loc,
const std::string& method,
const std::string& region) {
ASSERT1(location == loc || loc == CELL_DEFAULT);
ASSERT1(location == loc || loc == CELL_DEFAULT)
return bout::derivatives::index::DDX(f, loc, method, region) / dx;
}
Field3D Coordinates::DDX(const Field3D& f, CELL_LOC outloc, const std::string& method,
Expand All @@ -1380,12 +1380,12 @@ Field3D Coordinates::DDX(const Field3D& f, CELL_LOC outloc, const std::string& m
}

return result;
};
}

Coordinates::FieldMetric Coordinates::DDY(const Field2D& f, CELL_LOC loc,
const std::string& method,
const std::string& region) const {
ASSERT1(location == loc || loc == CELL_DEFAULT);
ASSERT1(location == loc || loc == CELL_DEFAULT)
return bout::derivatives::index::DDY(f, loc, method, region) / dy;
}

Expand All @@ -1400,13 +1400,13 @@ Field3D Coordinates::DDY(const Field3D& f, CELL_LOC outloc, const std::string& m
}
#endif
return bout::derivatives::index::DDY(f, outloc, method, region) / dy;
};
}

Coordinates::FieldMetric Coordinates::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(location == loc || loc == CELL_DEFAULT)
ASSERT1(f.getMesh() == localmesh)
if (loc == CELL_DEFAULT) {
loc = f.getLocation();
}
Expand All @@ -1415,7 +1415,7 @@ Coordinates::FieldMetric Coordinates::DDZ(const Field2D& f, CELL_LOC loc,
Field3D Coordinates::DDZ(const Field3D& f, CELL_LOC outloc, const std::string& method,
const std::string& region) {
return bout::derivatives::index::DDZ(f, outloc, method, region) / dz;
};
}

/////////////////////////////////////////////////////////
// Parallel gradient
Expand All @@ -1424,16 +1424,15 @@ Coordinates::FieldMetric Coordinates::Grad_par(const Field2D& var,
MAYBE_UNUSED(CELL_LOC outloc),
const std::string& UNUSED(method)) {
TRACE("Coordinates::Grad_par( Field2D )");
ASSERT1(location == outloc
|| (outloc == CELL_DEFAULT && location == var.getLocation()));
ASSERT1(location == outloc || (outloc == CELL_DEFAULT && location == var.getLocation()))

return DDY(var) * invSg();
}

Field3D Coordinates::Grad_par(const Field3D& var, CELL_LOC outloc,
const std::string& method) {
TRACE("Coordinates::Grad_par( Field3D )");
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

return ::DDY(var, outloc, method) * invSg();
}
Expand All @@ -1445,14 +1444,14 @@ Field3D Coordinates::Grad_par(const Field3D& var, CELL_LOC outloc,
Coordinates::FieldMetric Coordinates::Vpar_Grad_par(const Field2D& v, const Field2D& f,
MAYBE_UNUSED(CELL_LOC outloc),
const std::string& UNUSED(method)) {
ASSERT1(location == outloc || (outloc == CELL_DEFAULT && location == f.getLocation()));
ASSERT1(location == outloc || (outloc == CELL_DEFAULT && location == f.getLocation()))

return VDDY(v, f) * invSg();
}

Field3D Coordinates::Vpar_Grad_par(const Field3D& v, const Field3D& f, CELL_LOC outloc,
const std::string& method) {
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

return VDDY(v, f, outloc, method) * invSg();
}
Expand All @@ -1463,7 +1462,7 @@ Field3D Coordinates::Vpar_Grad_par(const Field3D& v, const Field3D& f, CELL_LOC
Coordinates::FieldMetric Coordinates::Div_par(const Field2D& f, CELL_LOC outloc,
const std::string& method) {
TRACE("Coordinates::Div_par( Field2D )");
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

// Need Bxy at location of f, which might be different from location of this
// Coordinates object
Expand All @@ -1475,7 +1474,7 @@ Coordinates::FieldMetric Coordinates::Div_par(const Field2D& f, CELL_LOC outloc,
Field3D Coordinates::Div_par(const Field3D& f, CELL_LOC outloc,
const std::string& method) {
TRACE("Coordinates::Div_par( Field3D )");
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

// Need Bxy at location of f, which might be different from location of this
// Coordinates object
Expand Down Expand Up @@ -1504,7 +1503,7 @@ Field3D Coordinates::Div_par(const Field3D& f, CELL_LOC outloc,
Coordinates::FieldMetric Coordinates::Grad2_par2(const Field2D& f, CELL_LOC outloc,
const std::string& method) {
TRACE("Coordinates::Grad2_par2( Field2D )");
ASSERT1(location == outloc || (outloc == CELL_DEFAULT && location == f.getLocation()));
ASSERT1(location == outloc || (outloc == CELL_DEFAULT && location == f.getLocation()))

auto result = Grad2_par2_DDY_invSg(outloc, method) * DDY(f, outloc, method)
+ D2DY2(f, outloc, method) / covariantMetricTensor.Getg22();
Expand All @@ -1518,15 +1517,15 @@ Field3D Coordinates::Grad2_par2(const Field3D& f, CELL_LOC outloc,
if (outloc == CELL_DEFAULT) {
outloc = f.getLocation();
}
ASSERT1(location == outloc);
ASSERT1(location == outloc)

Field3D result = ::DDY(f, outloc, method);

Field3D r2 = D2DY2(f, outloc, method) / covariantMetricTensor.Getg22();

result = Grad2_par2_DDY_invSg(outloc, method) * result + r2;

ASSERT2(result.getLocation() == outloc);
ASSERT2(result.getLocation() == outloc)

return result;
}
Expand All @@ -1539,7 +1538,7 @@ Field3D Coordinates::Grad2_par2(const Field3D& f, CELL_LOC outloc,
Coordinates::FieldMetric Coordinates::Delp2(const Field2D& f, CELL_LOC outloc,
bool UNUSED(useFFT)) {
TRACE("Coordinates::Delp2( Field2D )");
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

auto result =
G1 * DDX(f, outloc) + contravariantMetricTensor.Getg11() * D2DX2(f, outloc);
Expand All @@ -1554,14 +1553,14 @@ Field3D Coordinates::Delp2(const Field3D& f, CELL_LOC outloc, bool useFFT) {
outloc = f.getLocation();
}

ASSERT1(location == outloc);
ASSERT1(f.getLocation() == outloc);
ASSERT1(location == outloc)
ASSERT1(f.getLocation() == outloc)

if (localmesh->GlobalNx == 1 && localmesh->GlobalNz == 1) {
// copy mesh, location, etc
return f * 0;
}
ASSERT2(localmesh->xstart > 0); // Need at least one guard cell
ASSERT2(localmesh->xstart > 0) // Need at least one guard cell

Field3D result{emptyFrom(f).setLocation(outloc)};

Expand Down Expand Up @@ -1608,9 +1607,9 @@ Field3D Coordinates::Delp2(const Field3D& f, CELL_LOC outloc, bool useFFT) {
+ contravariantMetricTensor.Getg11() * ::D2DX2(f, outloc)
+ contravariantMetricTensor.Getg33() * ::D2DZ2(f, outloc)
+ 2 * contravariantMetricTensor.Getg13() * ::D2DXDZ(f, outloc);
};
}

ASSERT2(result.getLocation() == outloc);
ASSERT2(result.getLocation() == outloc)

return result;
}
Expand All @@ -1622,14 +1621,14 @@ FieldPerp Coordinates::Delp2(const FieldPerp& f, CELL_LOC outloc, bool useFFT) {
outloc = f.getLocation();
}

ASSERT1(location == outloc);
ASSERT1(f.getLocation() == outloc);
ASSERT1(location == outloc)
ASSERT1(f.getLocation() == outloc)

if (localmesh->GlobalNx == 1 && localmesh->GlobalNz == 1) {
// copy mesh, location, etc
return f * 0;
}
ASSERT2(localmesh->xstart > 0); // Need at least one guard cell
ASSERT2(localmesh->xstart > 0) // Need at least one guard cell

FieldPerp result{emptyFrom(f).setLocation(outloc)};

Expand Down Expand Up @@ -1673,20 +1672,20 @@ FieldPerp Coordinates::Delp2(const FieldPerp& f, CELL_LOC outloc, bool useFFT) {
// yet
// result = G1 * ::DDX(f, outloc) + G3 * ::DDZ(f, outloc) + g11 * ::D2DX2(f, outloc)
// + g33 * ::D2DZ2(f, outloc) + 2 * g13 * ::D2DXDZ(f, outloc);
};
}

return result;
}

Coordinates::FieldMetric Coordinates::Laplace_par(const Field2D& f, CELL_LOC outloc) {
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

return D2DY2(f, outloc) / covariantMetricTensor.Getg22()
+ DDY(this_J / covariantMetricTensor.Getg22(), outloc) * DDY(f, outloc) / this_J;
}

Field3D Coordinates::Laplace_par(const Field3D& f, CELL_LOC outloc) {
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)
return D2DY2(f, outloc) / covariantMetricTensor.Getg22()
+ DDY(this_J / covariantMetricTensor.Getg22(), outloc) * ::DDY(f, outloc)
/ this_J;
Expand All @@ -1698,7 +1697,7 @@ Coordinates::FieldMetric Coordinates::Laplace(const Field2D& f, CELL_LOC outloc,
const std::string& dfdy_boundary_conditions,
const std::string& dfdy_dy_region) {
TRACE("Coordinates::Laplace( Field2D )");
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

auto result = G1 * DDX(f, outloc) + G2 * DDY(f, outloc)
+ contravariantMetricTensor.Getg11() * D2DX2(f, outloc)
Expand All @@ -1714,7 +1713,7 @@ Field3D Coordinates::Laplace(const Field3D& f, CELL_LOC outloc,
const std::string& dfdy_boundary_conditions,
const std::string& dfdy_dy_region) {
TRACE("Coordinates::Laplace( Field3D )");
ASSERT1(location == outloc || outloc == CELL_DEFAULT);
ASSERT1(location == outloc || outloc == CELL_DEFAULT)

Field3D result = G1 * ::DDX(f, outloc) + G2 * ::DDY(f, outloc) + G3 * ::DDZ(f, outloc)
+ contravariantMetricTensor.Getg11() * D2DX2(f, outloc)
Expand Down

0 comments on commit 40de3ee

Please sign in to comment.