Skip to content

Commit

Permalink
1.2.2 (core): fix default boundary markers in grid generation to be 1…
Browse files Browse the repository at this point in the history
… 2 3 4 5 6 for left right bottom top front back
  • Loading branch information
carsten-forty2 committed May 5, 2021
1 parent 20fe3dd commit 358df31
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
45 changes: 28 additions & 17 deletions core/src/mesh.cpp
Expand Up @@ -1704,10 +1704,10 @@ void Mesh::create2DGrid(const RVector & x, const RVector & y, int markerType,
if (std::abs(boundary(i).norm()[0] + 1.0) < TOLERANCE) boundary(i).setMarker(1);
// Right
else if (std::abs(boundary(i).norm()[0] - 1.0) < TOLERANCE) boundary(i).setMarker(2);
// Top
else if (std::abs(boundary(i).norm()[1] - 1.0) < TOLERANCE) boundary(i).setMarker(3);
// Bottom
else if (std::abs(boundary(i).norm()[1] + 1.0) < TOLERANCE) boundary(i).setMarker(4);
else if (std::abs(boundary(i).norm()[1] + 1.0) < TOLERANCE) boundary(i).setMarker(3);
// Top
else if (std::abs(boundary(i).norm()[1] - 1.0) < TOLERANCE) boundary(i).setMarker(4);
}
}
}
Expand Down Expand Up @@ -1782,31 +1782,42 @@ void Mesh::create3DGrid(const RVector & x, const RVector & y, const RVector & z,
if (worldBoundaryMarker){
// Left
if (std::abs(boundary(i).norm()[0] + 1.0) < TOLERANCE)
boundary(i).setMarker(MARKER_BOUND_HOMOGEN_NEUMANN);
boundary(i).setMarker(MARKER_BOUND_MIXED);
// Right
else if (std::abs(boundary(i).norm()[0] - 1.0) < TOLERANCE) boundary(i).setMarker(MARKER_BOUND_MIXED);
// Top
else if (std::abs(boundary(i).norm()[2] - 1.0) < TOLERANCE) boundary(i).setMarker(MARKER_BOUND_MIXED);
else if (std::abs(boundary(i).norm()[0] - 1.0) < TOLERANCE)
boundary(i).setMarker(MARKER_BOUND_MIXED);
// Bottom
else if (std::abs(boundary(i).norm()[2] + 1.0) < TOLERANCE) boundary(i).setMarker(MARKER_BOUND_MIXED);
else if (std::abs(boundary(i).norm()[2] + 1.0) < TOLERANCE)
boundary(i).setMarker(MARKER_BOUND_MIXED);
// Top
else if (std::abs(boundary(i).norm()[2] - 1.0) < TOLERANCE)
boundary(i).setMarker(MARKER_BOUND_HOMOGEN_NEUMANN);
// Front
else if (std::abs(boundary(i).norm()[1] - 1.0) < TOLERANCE) boundary(i).setMarker(MARKER_BOUND_MIXED);
else if (std::abs(boundary(i).norm()[1] + 1.0) < TOLERANCE)
boundary(i).setMarker(MARKER_BOUND_MIXED);
// Back
else if (std::abs(boundary(i).norm()[1] + 1.0) < TOLERANCE) boundary(i).setMarker(MARKER_BOUND_MIXED);
else if (std::abs(boundary(i).norm()[1] - 1.0) < TOLERANCE)
boundary(i).setMarker(MARKER_BOUND_MIXED);

} else {
// Left
if (std::abs(boundary(i).norm()[0] + 1.0) < TOLERANCE) boundary(i).setMarker(1);
if (std::abs(boundary(i).norm()[0] + 1.0) < TOLERANCE)
boundary(i).setMarker(1);
// Right
else if (std::abs(boundary(i).norm()[0] - 1.0) < TOLERANCE) boundary(i).setMarker(2);
// Top
else if (std::abs(boundary(i).norm()[2] - 1.0) < TOLERANCE) boundary(i).setMarker(3);
else if (std::abs(boundary(i).norm()[0] - 1.0) < TOLERANCE)
boundary(i).setMarker(2);
// Bottom
else if (std::abs(boundary(i).norm()[2] + 1.0) < TOLERANCE) boundary(i).setMarker(4);
else if (std::abs(boundary(i).norm()[2] + 1.0) < TOLERANCE)
boundary(i).setMarker(3);
// Top
else if (std::abs(boundary(i).norm()[2] - 1.0) < TOLERANCE)
boundary(i).setMarker(4);
// Front
else if (std::abs(boundary(i).norm()[1] - 1.0) < TOLERANCE) boundary(i).setMarker(5);
else if (std::abs(boundary(i).norm()[1] + 1.0) < TOLERANCE)
boundary(i).setMarker(5);
// Back
else if (std::abs(boundary(i).norm()[1] + 1.0) < TOLERANCE) boundary(i).setMarker(6);
else if (std::abs(boundary(i).norm()[1] - 1.0) < TOLERANCE)
boundary(i).setMarker(6);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions core/src/mesh.h
Expand Up @@ -245,14 +245,15 @@ class DLLEXPORT Mesh {
* marker: 1,2 for: left, right.*/
void createGrid(const RVector & x) { create1DGrid(x); }

/*! Create two dimensional grid. Boundary on the domain border will get the
* marker: 1,2,3,4 for: left, right, top, bottom*/
/*! Create two dimensional grid. Boundaries on the domain border will
get the markers: 1,2,3,4 for: left, right, bottom, top.*/
void createGrid(const RVector & x, const RVector & y,
int markerType=0, bool worldBoundaryMarker=false) {
create2DGrid(x, y, markerType, worldBoundaryMarker);
}
/*! Create three dimensional grid. Boundary on the domain border will get the
* marker: 1,2,3,4,5,6 for: left, right, top, bottom, front, back*/
/*! Create three dimensional grid.
Boundaries on the domain border will get the markers:
1,2,3,4,5,6 for: left, right, bottom, top, front, back*/
void createGrid(const RVector & x, const RVector & y, const RVector & z,
int markerType=0, bool worldBoundaryMarker=false){
create3DGrid(x, y, z, markerType, worldBoundaryMarker);
Expand Down

0 comments on commit 358df31

Please sign in to comment.