-
Notifications
You must be signed in to change notification settings - Fork 95
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 for fields #2887
base: next
Are you sure you want to change the base?
Add isFci for fields #2887
Conversation
Ensure this does not crash if coordinates or transform is not set. In this case no FCI transformation is set, and this returns false.
include/bout/field.hxx
Outdated
@@ -178,6 +178,18 @@ inline bool areFieldsCompatible(const Field& field1, const Field& field2) { | |||
#define ASSERT1_FIELDS_COMPATIBLE(field1, field2) ; | |||
#endif | |||
|
|||
template <typename F> | |||
inline bool isFci(const F& f) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe canBeFieldAligned
? Not sure.
Also, should this be a member function instead? Then it wouldn't need to be templated. If it should really be a free function, it would be good to add a static_assert
(see emptyFrom
etc) to give a nicer error message if passed the wrong type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
canBeFieldAligned
? Not sure.
But I want to know whether it is FCI. If we ever have a different, non-field aligned, non FCI method, we might need to reconsider, but I think isFci (or isFCI) is better, as you can use BOUT++ also for non magnetic simulations, and that is also not field aligned, but not FCI either.
Also, should this be a member function instead? Then it wouldn't need to be templated. If it should really be a free function, it would be good to add a
static_assert
(seeemptyFrom
etc) to give a nicer error message if passed the wrong type.
Good point, will make it a member function 👍
clang-tidy review says "All clean, LGTM! 👍" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
clang-tidy review says "All clean, LGTM! 👍" |
clang-tidy review says "All clean, LGTM! 👍" |
Add isFci also to mesh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
ASSERT1(location != CELL_DEFAULT); | ||
ASSERT1(location != CELL_VSHIFT); | ||
|
||
auto found = coords_map.find(location); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'getAllowedStaggerLoc' can be made static [readability-convert-member-functions-to-static]
auto found = coords_map.find(location); | |
static CELL_LOC getAllowedStaggerLoc(DIRECTION direction) { |
return false; | ||
} | ||
return not coords->getParallelTransform().canToFromFieldAligned(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: parameter 'location' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
} | |
createDefaultCoordinates(CELL_LOC location, |
3cd3407
to
ececfb8
Compare
@ZedThree clang-tidy-review is failing:
Is this maybe due to some of your recent changes? |
@dschwoerer Yes, but I don't understand what exactly. I need to investigate further |
No description provided.