Conversation
Useful for templates
Allows to write code for Field3D, that also works for Field2D
include/bout/field3d.hxx
Outdated
|
|
||
| std::weak_ptr<Options> getTracking() { return tracking; }; | ||
|
|
||
| bool allowCalcParallelSlices{true}; |
There was a problem hiding this comment.
warning: member variable 'allowCalcParallelSlices' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes]
bool allowCalcParallelSlices{true};
^There was a problem hiding this comment.
Could we add a public getter (and setter) instead of making the member variable public?
ZedThree
left a comment
There was a problem hiding this comment.
Nice, thanks @dschwoerer! I guess my main question is could/should the new methods actually be virtual? Then we could just have a default empty implementation on Field.
include/bout/field3d.hxx
Outdated
|
|
||
| std::weak_ptr<Options> getTracking() { return tracking; }; | ||
|
|
||
| bool allowCalcParallelSlices{true}; |
There was a problem hiding this comment.
Could we add a public getter (and setter) instead of making the member variable public?
| /// Check if this field has yup and ydown fields | ||
| /// Return reference to yup field | ||
| Field3D& yup(std::vector<Field3D>::size_type index = 0) { | ||
| Field3D& yup(size_t index = 0) { |
There was a problem hiding this comment.
I would've thought we would also need these to be virtual to make things properly generic? Although I guess you're mostly interested in FieldMetric and compile-time polymorphism really, and not runtime polymorphism?
We could make these virtual by returning Field&, but we probably don't actually want that.
There was a problem hiding this comment.
Yes, that is the reason. We do not want to return Field, so there is no way to make this virtual.
Compile time polymorphism is right now sufficient, as long as 3D metrics are a compile time choice.
Make it easier to write FCI compatible code.