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?
include/bout/fieldperp.hxx
Outdated
| } | ||
|
|
||
| /// Dummy functions to increase portability | ||
| bool hasParallelSlices() const { return true; } |
There was a problem hiding this comment.
warning: method 'hasParallelSlices' can be made static [readability-convert-member-functions-to-static]
| bool hasParallelSlices() const { return true; } | |
| static bool hasParallelSlices() { return true; } |
include/bout/fieldperp.hxx
Outdated
| bool hasParallelSlices() const { return true; } | ||
| void calcParallelSlices() const {} | ||
| void clearParallelSlices() {} | ||
| int numberParallelSlices() { return 0; } |
There was a problem hiding this comment.
warning: method 'numberParallelSlices' can be made static [readability-convert-member-functions-to-static]
| int numberParallelSlices() { return 0; } | |
| static int numberParallelSlices() { return 0; } |
| void clearParallelSlices() {} | ||
| int numberParallelSlices() { return 0; } | ||
|
|
||
| FieldPerp& yup(std::vector<FieldPerp>::size_type UNUSED(index) = 0) { return *this; } |
There was a problem hiding this comment.
warning: no header providing "std::vector" is directly included [misc-include-cleaner]
include/bout/fieldperp.hxx:25:
- class FieldPerp;
+ #include <vector>
+ class FieldPerp;
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/field2d.hxx
Outdated
| void calcParallelSlices() const {} | ||
| void splitParallelSlices() const {} | ||
| void clearParallelSlices() const {} | ||
| int numberParallelSlices() const { return 0; } |
There was a problem hiding this comment.
Should these be virtual? Or do they only need to be dummy methods?
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?
Make it easier to write FCI compatible code.