Conversation
Makes it easier to reuse for other code
Mimicks the parallel case, to write FCI independent code
The boundary region does not match what is done for the parallel case, thus porting it to a iterator does not work.
hasBndryUpperY / hasBndryLowerY does not work for FCI and thus the request does not make sense / can be configured to throw. Thus it should not be checked if it is not needed.
BoundaryRegionIter has been delted
This allows to extend the boundary code to place the boundary further away from the boundary.
This is more general and takes the offset() into account, and thus works for cases where the boundary is between the first and second guard cell
Previously only the first boundary point was set
Taken from hermes-3, adopted for higher order
This allows to write code for FCI and non-FCI using templates.
Directly iterate over the points
Without this fix, boundary conditions set on yup/down fields are not applied when a boundary is copied from one field to another.
| #include "bout/sys/parallel_stencils.hxx" | ||
| #include "bout/sys/range.hxx" | ||
|
|
||
| class BoundaryRegionIter { |
There was a problem hiding this comment.
warning: destructor of 'BoundaryRegionIter' is public and non-virtual [cppcoreguidelines-virtual-class-destructor]
class BoundaryRegionIter {
^Additional context
include/bout/boundary_iterator.hxx:7: make it public and virtual
class BoundaryRegionIter {
^| public: | ||
| BoundaryRegionIter(int x, int y, int bx, int by, Mesh* mesh) | ||
| : dir(bx + by), x(x), y(y), bx(bx), by(by), localmesh(mesh) { | ||
| ASSERT3(bx * by == 0); |
There was a problem hiding this comment.
warning: no header providing "ASSERT3" is directly included [misc-include-cleaner]
include/bout/boundary_iterator.hxx:2:
- #include "bout/mesh.hxx"
+ #include "bout/assert.hxx"
+ #include "bout/mesh.hxx"| : dir(bx + by), x(x), y(y), bx(bx), by(by), localmesh(mesh) { | ||
| ASSERT3(bx * by == 0); | ||
| } | ||
| bool operator!=(const BoundaryRegionIter& rhs) { return ind() != rhs.ind(); } |
There was a problem hiding this comment.
warning: method 'operator!=' can be made const [readability-make-member-function-const]
| bool operator!=(const BoundaryRegionIter& rhs) { return ind() != rhs.ind(); } | |
| bool operator!=(const BoundaryRegionIter& rhs) const { return ind() != rhs.ind(); } |
| } | ||
| bool operator!=(const BoundaryRegionIter& rhs) { return ind() != rhs.ind(); } | ||
|
|
||
| Ind3D ind() const { return xyz2ind(x, y, z); } |
There was a problem hiding this comment.
warning: no header providing "Ind3D" is directly included [misc-include-cleaner]
include/bout/boundary_iterator.hxx:4:
- #include "bout/sys/parallel_stencils.hxx"
+ #include "bout/region.hxx"
+ #include "bout/sys/parallel_stencils.hxx"| virtual void _next() = 0; | ||
| BoundaryRegionIter& operator*() { return *this; } | ||
|
|
||
| void dirichlet_o2(Field3D& f, BoutReal value) const { |
There was a problem hiding this comment.
warning: no header providing "BoutReal" is directly included [misc-include-cleaner]
include/bout/boundary_iterator.hxx:2:
- #include "bout/mesh.hxx"
+ #include "bout/bout_types.hxx"
+ #include "bout/mesh.hxx"| protected: | ||
| int z{0}; | ||
| int x; | ||
| int y; |
There was a problem hiding this comment.
warning: member variable 'y' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
int y;
^| int z{0}; | ||
| int x; | ||
| int y; | ||
| const int bx; |
There was a problem hiding this comment.
warning: member 'bx' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]
const int bx;
^| int z{0}; | ||
| int x; | ||
| int y; | ||
| const int bx; |
There was a problem hiding this comment.
warning: member variable 'bx' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
const int bx;
^| int x; | ||
| int y; | ||
| const int bx; | ||
| const int by; |
There was a problem hiding this comment.
warning: member 'by' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]
const int by;
^| int x; | ||
| int y; | ||
| const int bx; | ||
| const int by; |
There was a problem hiding this comment.
warning: member variable 'by' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]
const int by;
^
This allows to implement unified BCs for yup/ydown as well as FCI / FA.
Taking into acount things like whether the boundary is next to the domain, or between the parallel slices.