Class allowing the definition of a patch position in the Cartesian mesh. More...
#include <arcane/cartesianmesh/AMRPatchPosition.h>
Public Member Functions | |
| AMRPatchPosition () | |
| Constructor for a null position. A null position is defined by a level = -2. | |
| AMRPatchPosition (Int32 level, CartCoord3 min_point, CartCoord3 max_point, Int32 overlap_layer_size) | |
| AMRPatchPosition (const AMRPatchPosition &src) | |
| Copy constructor. | |
| AMRPatchPosition & | operator= (const AMRPatchPosition &)=default |
| bool | operator== (const AMRPatchPosition &other) const =default |
| Int32 | level () const |
| Method to retrieve the patch level. | |
| void | setLevel (Int32 level) |
| Method to set the patch level. | |
| CartCoord3 | minPoint () const |
| Method to retrieve the min position of the enclosing box. | |
| void | setMinPoint (CartCoord3 min_point) |
| Method to set the min position of the enclosing box. | |
| CartCoord3 | maxPoint () const |
| Method to retrieve the max position of the enclosing box. | |
| void | setMaxPoint (CartCoord3 max_point) |
| Method to set the max position of the enclosing box. | |
| Int32 | overlapLayerSize () const |
| Method to retrieve the number of overlap cell layers of the patch. | |
| void | setOverlapLayerSize (Int32 layer_size) |
| Method to set the number of overlap cell layers of the patch. | |
| CartCoord3 | minPointWithOverlap () const |
| Method to retrieve the min position of the enclosing box including the overlap cell layer. | |
| CartCoord3 | maxPointWithOverlap () const |
| Method to retrieve the max position of the enclosing box including the overlap cell layer. | |
| Int64 | nbCells () const |
| Method to know the number of cells in the patch according to its position. | |
| std::pair< AMRPatchPosition, AMRPatchPosition > | cut (CartCoord cut_point, Integer dim) const |
| Method to cut the patch into two patches according to a cut point. | |
| bool | canBeFusion (const AMRPatchPosition &other_patch) const |
| Method to know if our patch can be merged with other_patch. | |
| bool | fusion (AMRPatchPosition &other_patch) |
| Method to merge other_patch with ours. | |
| bool | isNull () const |
| Method to know if the patch is null. | |
| AMRPatchPosition | patchUp (Integer dim, Int32 higher_level, Int32 overlap_layer_size_top_level) const |
| Method to create an AMRPatchPosition for the higher level. | |
| AMRPatchPosition | patchDown (Integer dim, Int32 higher_level, Int32 overlap_layer_size_top_level) const |
| Method to create an AMRPatchPosition for the lower level. | |
| CartCoord3 | length () const |
| Method to know the size of the patch (in number of cells per direction). | |
| bool | isIn (CartCoord x, CartCoord y, CartCoord z) const |
| Method to know if a cell at position x,y,z is included in this patch. | |
| bool | isIn (CartCoord3 coord) const |
| Method to know if a cell is included in this patch. | |
| bool | isInWithOverlap (CartCoord x, CartCoord y, CartCoord z) const |
| Method to know if a cell at position x,y,z is included in this patch with overlap layer. | |
| bool | isInWithOverlap (CartCoord3 coord) const |
| Method to know if a cell is included in this patch with overlap layer. | |
| bool | isInWithOverlap (CartCoord x, CartCoord y, CartCoord z, Integer overlap) const |
| Method to know if a cell at position x,y,z is included in this patch with a specified overlap layer. | |
| bool | isInWithOverlap (CartCoord3 coord, Integer overlap) const |
| Method to know if a cell is included in this patch with a specified overlap layer. | |
| bool | haveIntersection (const AMRPatchPosition &other) const |
| Method to know if our patch is in contact with other. | |
| void | computeOverlapLayerSize (Int32 higher_level, Int32 overlap_layer_size_top_level) |
| Method to calculate the number of overlap cell layers for our patch. | |
Static Public Member Functions | |
| static Int32 | computeOverlapLayerSize (Int32 level, Int32 higher_level, Int32 overlap_layer_size_top_level) |
| Method to calculate the number of overlap cell layers for a given level. | |
Private Attributes | |
| Int32 | m_level |
| CartCoord3 | m_min_point |
| CartCoord3 | m_max_point |
| Int32 | m_overlap_layer_size |
Class allowing the definition of a patch position in the Cartesian mesh.
The position of a patch is designated by the position of two cells in the grid. The "min" position and the "max" position form an enclosing box.
Cell positions can be obtained via the CartesianMeshNumberingMng.
Definition at line 50 of file AMRPatchPosition.h.
| Arcane::AMRPatchPosition::AMRPatchPosition | ( | ) |
Constructor for a null position. A null position is defined by a level = -2.
Definition at line 31 of file AMRPatchPosition.cc.
Referenced by AMRPatchPosition(), canBeFusion(), cut(), fusion(), haveIntersection(), patchDown(), and patchUp().
| Arcane::AMRPatchPosition::AMRPatchPosition | ( | Int32 | level, |
| CartCoord3 | min_point, | ||
| CartCoord3 | max_point, | ||
| Int32 | overlap_layer_size ) |
Definition at line 40 of file AMRPatchPosition.cc.
| Arcane::AMRPatchPosition::AMRPatchPosition | ( | const AMRPatchPosition & | src | ) |
Copy constructor.
| src | The position to copy. |
Definition at line 51 of file AMRPatchPosition.cc.
References AMRPatchPosition(), level(), maxPoint(), minPoint(), and overlapLayerSize().
| bool Arcane::AMRPatchPosition::canBeFusion | ( | const AMRPatchPosition & | other_patch | ) | const |
Method to know if our patch can be merged with other_patch.
| other_patch | The patch to check. |
Definition at line 199 of file AMRPatchPosition.cc.
References AMRPatchPosition(), level(), maxPoint(), and minPoint().
Referenced by fusion().
| void Arcane::AMRPatchPosition::computeOverlapLayerSize | ( | Int32 | higher_level, |
| Int32 | overlap_layer_size_top_level ) |
Method to calculate the number of overlap cell layers for our patch.
| higher_level | The highest refinement level. |
| overlap_layer_size_top_level | The number of layers for the highest refinement level. |
Definition at line 438 of file AMRPatchPosition.cc.
References computeOverlapLayerSize().
|
static |
Method to calculate the number of overlap cell layers for a given level.
| level | The requested level. |
| higher_level | The highest refinement level. |
| overlap_layer_size_top_level | The number of layers for the highest refinement level. |
Formula: Let m be the highest refinement level (higher_level), Let C(m) be the number of layers at level m (overlap_layer_size_top_level), For any positive even integer C(m): C(m-1) = (int(C(m)/4)+1)*2
Definition at line 398 of file AMRPatchPosition.cc.
References ARCANE_FATAL, and level().
Referenced by computeOverlapLayerSize(), patchDown(), patchUp(), and Arcane::CartesianPatchGroup::updateLevelsAndAddGroundPatch().
| std::pair< AMRPatchPosition, AMRPatchPosition > Arcane::AMRPatchPosition::cut | ( | CartCoord | cut_point, |
| Integer | dim ) const |
Method to cut the patch into two patches according to a cut point.
| cut_point | The cut point. |
| dim | The dimension that must be cut. |
Definition at line 168 of file AMRPatchPosition.cc.
References AMRPatchPosition(), Arcane::MD_DirX, Arcane::MD_DirY, setMaxPoint(), and setMinPoint().
| bool Arcane::AMRPatchPosition::fusion | ( | AMRPatchPosition & | other_patch | ) |
Method to merge other_patch with ours.
A check for possible merging (via canBeFusion()) is performed before merging. If merging is impossible, false is returned. Otherwise, we merge and return true. If merged, other_patch becomes null.
| other_patch | The patch to merge with. |
Definition at line 221 of file AMRPatchPosition.cc.
References AMRPatchPosition(), canBeFusion(), maxPoint(), minPoint(), and setLevel().
Referenced by Arcane::AMRPatchPositionLevelGroup::fusionPatches().
| bool Arcane::AMRPatchPosition::haveIntersection | ( | const AMRPatchPosition & | other | ) | const |
Method to know if our patch is in contact with other.
| other | The patch to check. |
Definition at line 378 of file AMRPatchPosition.cc.
References AMRPatchPosition(), level(), maxPoint(), and minPoint().
Method to know if a cell at position x,y,z is included in this patch.
To include the overlap layer, use the isInWithOverlap() method.
| x | X position of the cell. |
| y | Y position of the cell. |
| z | Z position of the cell. |
Definition at line 316 of file AMRPatchPosition.cc.
| bool Arcane::AMRPatchPosition::isIn | ( | CartCoord3 | coord | ) | const |
Method to know if a cell is included in this patch.
To include the overlap layer, use the isInWithOverlap() method.
| coord | Position of the cell. |
Definition at line 325 of file AMRPatchPosition.cc.
Method to know if a cell at position x,y,z is included in this patch with overlap layer.
| x | X position of the cell. |
| y | Y position of the cell. |
| z | Z position of the cell. |
Definition at line 334 of file AMRPatchPosition.cc.
References maxPointWithOverlap(), and minPointWithOverlap().
Referenced by Arcane::CartesianPatchGroup::addPatch().
| bool Arcane::AMRPatchPosition::isInWithOverlap | ( | CartCoord | x, |
| CartCoord | y, | ||
| CartCoord | z, | ||
| Integer | overlap ) const |
Method to know if a cell at position x,y,z is included in this patch with a specified overlap layer.
| x | X position of the cell. |
| y | Y position of the cell. |
| z | Z position of the cell. |
| overlap | The number of overlap cells in the layer. |
Definition at line 356 of file AMRPatchPosition.cc.
| bool Arcane::AMRPatchPosition::isInWithOverlap | ( | CartCoord3 | coord | ) | const |
Method to know if a cell is included in this patch with overlap layer.
| coord | Position of the cell. |
Definition at line 345 of file AMRPatchPosition.cc.
References maxPointWithOverlap(), and minPointWithOverlap().
| bool Arcane::AMRPatchPosition::isInWithOverlap | ( | CartCoord3 | coord, |
| Integer | overlap ) const |
Method to know if a cell is included in this patch with a specified overlap layer.
| coord | Position of the cell. |
| overlap | The number of overlap cells in the layer. |
Definition at line 367 of file AMRPatchPosition.cc.
| bool Arcane::AMRPatchPosition::isNull | ( | ) | const |
Method to know if the patch is null.
Definition at line 260 of file AMRPatchPosition.cc.
Referenced by Arcane::AMRPatchPositionLevelGroup::fusionPatches().
| CartCoord3 Arcane::AMRPatchPosition::length | ( | ) | const |
Method to know the size of the patch (in number of cells per direction).
Definition at line 307 of file AMRPatchPosition.cc.
| Int32 Arcane::AMRPatchPosition::level | ( | ) | const |
Method to retrieve the patch level.
Definition at line 69 of file AMRPatchPosition.cc.
Referenced by Arcane::CartesianPatchGroup::addPatch(), AMRPatchPosition(), canBeFusion(), computeOverlapLayerSize(), haveIntersection(), Arcane::CartesianPatchGroup::removeCellsInZone(), and setLevel().
| CartCoord3 Arcane::AMRPatchPosition::maxPoint | ( | ) | const |
Method to retrieve the max position of the enclosing box.
Definition at line 105 of file AMRPatchPosition.cc.
Referenced by Arcane::CartesianPatchGroup::addPatch(), AMRPatchPosition(), canBeFusion(), fusion(), and haveIntersection().
| CartCoord3 Arcane::AMRPatchPosition::maxPointWithOverlap | ( | ) | const |
Method to retrieve the max position of the enclosing box including the overlap cell layer.
Definition at line 150 of file AMRPatchPosition.cc.
Referenced by isInWithOverlap(), and isInWithOverlap().
| CartCoord3 Arcane::AMRPatchPosition::minPoint | ( | ) | const |
Method to retrieve the min position of the enclosing box.
Definition at line 87 of file AMRPatchPosition.cc.
Referenced by Arcane::CartesianPatchGroup::addPatch(), AMRPatchPosition(), canBeFusion(), Arcane::AMRPatchPositionSignatureCut::cut(), fusion(), and haveIntersection().
| CartCoord3 Arcane::AMRPatchPosition::minPointWithOverlap | ( | ) | const |
Method to retrieve the min position of the enclosing box including the overlap cell layer.
Definition at line 141 of file AMRPatchPosition.cc.
Referenced by isInWithOverlap(), and isInWithOverlap().
| Int64 Arcane::AMRPatchPosition::nbCells | ( | ) | const |
Method to know the number of cells in the patch according to its position.
Definition at line 159 of file AMRPatchPosition.cc.
| Int32 Arcane::AMRPatchPosition::overlapLayerSize | ( | ) | const |
Method to retrieve the number of overlap cell layers of the patch.
Definition at line 123 of file AMRPatchPosition.cc.
Referenced by Arcane::CartesianPatchGroup::addPatch(), and AMRPatchPosition().
| AMRPatchPosition Arcane::AMRPatchPosition::patchDown | ( | Integer | dim, |
| Int32 | higher_level, | ||
| Int32 | overlap_layer_size_top_level ) const |
Method to create an AMRPatchPosition for the lower level.
If the min position is not divisible by two, it is rounded down to the lower integer. If the max position is not divisible by two, it is rounded up to the higher integer.
For the overlap layer, this method ensures that there will never be more than one level difference between two cells of different levels.
| dim | The dimension of the mesh. |
| higher_level | The highest refinement level of the mesh. |
| overlap_layer_size_top_level | The number of overlap cell layers for patches at the highest refinement level. |
Definition at line 288 of file AMRPatchPosition.cc.
References AMRPatchPosition(), computeOverlapLayerSize(), setLevel(), setMaxPoint(), and setMinPoint().
| AMRPatchPosition Arcane::AMRPatchPosition::patchUp | ( | Integer | dim, |
| Int32 | higher_level, | ||
| Int32 | overlap_layer_size_top_level ) const |
Method to create an AMRPatchPosition for the higher level.
| dim | The dimension of the mesh. |
| higher_level | The highest refinement level of the mesh. |
| overlap_layer_size_top_level | The number of overlap cell layers for patches at the highest refinement level. |
Definition at line 269 of file AMRPatchPosition.cc.
References AMRPatchPosition(), computeOverlapLayerSize(), setLevel(), setMaxPoint(), and setMinPoint().
Referenced by Arcane::CartesianPatchGroup::addPatch().
| void Arcane::AMRPatchPosition::setLevel | ( | Int32 | level | ) |
Method to set the patch level.
| level | The patch level. |
Definition at line 78 of file AMRPatchPosition.cc.
References level().
Referenced by fusion(), patchDown(), patchUp(), and Arcane::CartesianPatchGroup::updateLevelsAndAddGroundPatch().
| void Arcane::AMRPatchPosition::setMaxPoint | ( | CartCoord3 | max_point | ) |
Method to set the max position of the enclosing box.
| max_point | the max position. |
Definition at line 114 of file AMRPatchPosition.cc.
Referenced by cut(), patchDown(), patchUp(), and Arcane::CartesianPatchGroup::updateLevelsAndAddGroundPatch().
| void Arcane::AMRPatchPosition::setMinPoint | ( | CartCoord3 | min_point | ) |
Method to set the min position of the enclosing box.
| min_point | the min position. |
Definition at line 96 of file AMRPatchPosition.cc.
Referenced by cut(), patchDown(), patchUp(), and Arcane::CartesianPatchGroup::updateLevelsAndAddGroundPatch().
| void Arcane::AMRPatchPosition::setOverlapLayerSize | ( | Int32 | layer_size | ) |
Method to set the number of overlap cell layers of the patch.
| layer_size | the number of overlap cell layers |
Definition at line 132 of file AMRPatchPosition.cc.
Referenced by Arcane::CartesianPatchGroup::addPatch().
|
private |
Definition at line 318 of file AMRPatchPosition.h.
|
private |
Definition at line 320 of file AMRPatchPosition.h.
|
private |
Definition at line 319 of file AMRPatchPosition.h.
|
private |
Definition at line 321 of file AMRPatchPosition.h.