Skip to content

Commit

Permalink
Merge pull request #3001 from boutproject/is-fci-mesh
Browse files Browse the repository at this point in the history
Add isFci also to mesh
  • Loading branch information
bendudson authored Oct 28, 2024
2 parents 0a5e3da + 5ef1268 commit a4b8abf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/bout/mesh.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,19 @@ public:
return inserted.first->second;
}

std::shared_ptr<Coordinates>
getCoordinatesConst(const CELL_LOC location = CELL_CENTRE) const {
ASSERT1(location != CELL_DEFAULT);
ASSERT1(location != CELL_VSHIFT);

auto found = coords_map.find(location);
if (found != coords_map.end()) {
// True branch most common, returns immediately
return found->second;
}
throw BoutException("Coordinates not yet set. Use non-const version!");
}

/// Returns the non-CELL_CENTRE location
/// allowed as a staggered location
CELL_LOC getAllowedStaggerLoc(DIRECTION direction) const {
Expand Down Expand Up @@ -828,6 +841,16 @@ public:
ASSERT1(RegionID.has_value());
return region3D[RegionID.value()];
}
bool isFci() const {
const auto coords = this->getCoordinatesConst();
if (coords == nullptr) {
return false;
}
if (not coords->hasParallelTransform()) {
return false;
}
return not coords->getParallelTransform().canToFromFieldAligned();
}

private:
/// Allocates default Coordinates objects
Expand Down

0 comments on commit a4b8abf

Please sign in to comment.