Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isFci also to mesh #3001

Merged
merged 4 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Comment on lines +639 to +640
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally this would be:

Suggested change
std::shared_ptr<Coordinates>
getCoordinatesConst(const CELL_LOC location = CELL_CENTRE) const {
const Coordinates&
getCoordinates(const CELL_LOC location = CELL_CENTRE) const {

but maybe this is too likely to cause issues elsewhere

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a docstring

const auto coords = this->getCoordinatesConst();
if (coords == nullptr) {
return false;
}
if (not coords->hasParallelTransform()) {
dschwoerer marked this conversation as resolved.
Show resolved Hide resolved
return false;
}
return not coords->getParallelTransform().canToFromFieldAligned();
}

private:
/// Allocates default Coordinates objects
Expand Down
Loading