Skip to content

New Y-Boundaries for unified sheath code#3308

Open
dschwoerer wants to merge 51 commits intonextfrom
new-par-bc-unified
Open

New Y-Boundaries for unified sheath code#3308
dschwoerer wants to merge 51 commits intonextfrom
new-par-bc-unified

Conversation

@dschwoerer
Copy link
Contributor

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.

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
Copy link
Contributor

@github-actions github-actions bot left a 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

There were too many comments to post at once. Showing the first 25 out of 109. Check the log or trigger a new build to see more.

#include "bout/sys/parallel_stencils.hxx"
#include "bout/sys/range.hxx"

class BoundaryRegionIter {
Copy link
Contributor

Choose a reason for hiding this comment

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

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);
Copy link
Contributor

Choose a reason for hiding this comment

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

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(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: method 'operator!=' can be made const [readability-make-member-function-const]

Suggested change
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); }
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'by' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  const int by;
            ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants