Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
meshOctreeCube Class Reference
Inheritance diagram for meshOctreeCube:
Inheritance graph
[legend]
Collaboration diagram for meshOctreeCube:
Collaboration graph
[legend]

Public Member Functions

 meshOctreeCube ()
 Default constructor. More...
 
 meshOctreeCube (const meshOctreeCube &)
 Copy construct. More...
 
 meshOctreeCube (const meshOctreeCubeCoordinates &)
 Construct from coordinates. More...
 
 meshOctreeCube (const meshOctreeCubeCoordinates &cc, const label nElmts, meshOctreeSlot *slotPtr)
 
 ~meshOctreeCube ()
 
void refineCube2D (const triSurf &, const boundBox &, meshOctreeSlot *slotPtr=NULL)
 refine cube in two directions, it is used for generating quadtrees More...
 
void refineCube (const triSurf &, const boundBox &, meshOctreeSlot *slotPtr=NULL)
 subdivide the octree cube More...
 
void refineMissingCube (const triSurf &, const boundBox &, const label scI, meshOctreeSlot *slotPtr=NULL)
 
void refineMissingCube (const label scI, const label elementsRowI=-1, const label edgesRowI=-1, meshOctreeSlot *slotPtr=NULL)
 
const meshOctreeSlotslotPtr () const
 return the pointer to the slot containing the cube More...
 
label cubeLabel () const
 position of the cube in the list of leaves More...
 
bool isLeaf () const
 check if the cube is a leaf More...
 
meshOctreeCubesubCube (const label) const
 return a pointer to a child cubes at given position More...
 
FixedList< meshOctreeCube *, 8 > subCubes () const
 return the pointers to the sons More...
 
bool hasContainedTriangles (const triSurf &, const boundBox &, const VRWGraph &containedElements) const
 check if this box has some contained triangles More...
 
bool hasContainedElements () const
 return true if the box contains some triangles More...
 
label containedElements () const
 
bool hasContainedEdges () const
 returns true if the box contains some edges More...
 
label containedEdges () const
 
void leavesInBox (const boundBox &rootBox, const boundBox &searchingBox, DynList< const meshOctreeCube *, 256 > &) const
 leaves contained in the given box More...
 
void leavesInSphere (const boundBox &rootBox, const point &, const scalar, DynList< label > &) const
 find leaves within a sphere More...
 
void markLeavesInSphere (const boundBox &rootBox, const point &, const scalar, labelList &, bool &) const
 mark leaves within a sphere More...
 
void findLeaves (LongList< meshOctreeCube * > &leaves) const
 find leaves for a given cube More...
 
void findCoordinatesOfMissingCubes (LongList< meshOctreeCubeCoordinates > &coordinates) const
 find coordinates of cubes which are located on other processors More...
 
void countChildCubes (label &nCubes) const
 count number of originating from this cube More...
 
bool purgeProcessorCubes (const short procNo)
 delete boxes which are not local to the given processor More...
 
void operator= (const meshOctreeCube &)
 assignment More...
 
- Public Member Functions inherited from meshOctreeCubeBasic
 meshOctreeCubeBasic ()
 Null constructor. More...
 
 meshOctreeCubeBasic (const meshOctreeCubeCoordinates &)
 Construct from coordinates. More...
 
 meshOctreeCubeBasic (const meshOctreeCubeCoordinates &cc, const direction cubeType, const short procNo=ALLPROCS)
 Construct from coordinates and cube type. More...
 
 ~meshOctreeCubeBasic ()
 
direction cubeType () const
 return type More...
 
void setCubeType (const direction)
 set cube type More...
 
short procNo () const
 return processor number More...
 
void setProcNo (const short)
 set processor number More...
 
const meshOctreeCubeCoordinatescoordinates () const
 return coordinates in the octree More...
 
void operator= (const meshOctreeCubeBasic &)
 
- Public Member Functions inherited from meshOctreeCubeCoordinates
 meshOctreeCubeCoordinates ()
 Null constructor. More...
 
 meshOctreeCubeCoordinates (const label posX, const label posY, const label posZ, const direction level)
 Construct from coordinates and level. More...
 
 meshOctreeCubeCoordinates (const meshOctreeCubeCoordinates &)
 copy constructor More...
 
 ~meshOctreeCubeCoordinates ()
 
direction level () const
 return level More...
 
label posX () const
 return x, y, z coordinates More...
 
label posY () const
 
label posZ () const
 
meshOctreeCubeCoordinates refineForPosition (const label) const
 return the coordinates of child cube at the given position More...
 
meshOctreeCubeCoordinates reduceLevelBy (const direction diff) const
 
meshOctreeCubeCoordinates reduceToLevel (const direction) const
 return the coordinates of the parent at the given level More...
 
meshOctreeCubeCoordinates increaseToLevelMin (const direction l) const
 return the minimal coordinates of the child at the given level More...
 
meshOctreeCubeCoordinates increaseToLevelMax (const direction l) const
 return the maximal coordinates of the child at the given level More...
 
void cubeBox (const boundBox &, point &, point &) const
 return min and max points More...
 
void vertices (const boundBox &, FixedList< point, 8 > &) const
 calculate vertices More...
 
point centre (const boundBox &) const
 return centre More...
 
scalar size (const boundBox &) const
 return size More...
 
void edgeVertices (const boundBox &, FixedList< FixedList< point, 2 >, 12 > &) const
 edges of the cube More...
 
bool intersectsTriangle (const triSurf &, const boundBox &, const label) const
 check if the surface triangle intersects the cube More...
 
bool intersectsTriangleExact (const triSurf &, const boundBox &, const label) const
 
bool isVertexInside (const boundBox &, const point &) const
 is a vertex inside the cube More...
 
bool isPositionInside (const meshOctreeCubeCoordinates &) const
 
void neighbourRange (meshOctreeCubeCoordinates &minCoord, meshOctreeCubeCoordinates &maxCoord) const
 
bool intersectsLine (const boundBox &, const point &, const point &) const
 check if the cube intersects a line More...
 
meshOctreeCubeCoordinates operator+ (const meshOctreeCubeCoordinates &) const
 
void operator= (const meshOctreeCubeCoordinates &)
 
bool operator== (const meshOctreeCubeCoordinates &) const
 
bool operator!= (const meshOctreeCubeCoordinates &) const
 
bool operator<= (const meshOctreeCubeCoordinates &) const
 comparison of Morton codes More...
 
bool operator>= (const meshOctreeCubeCoordinates &) const
 
bool operator< (const meshOctreeCubeCoordinates &) const
 
bool operator> (const meshOctreeCubeCoordinates &) const
 

Private Member Functions

void findContainedEdges (const triSurf &, const boundBox &)
 find edges contained in the cube More...
 
 meshOctreeCube (const meshOctreeCubeBasic &)
 Disallow copy construct from meshOctreeCubeBasic. More...
 

Private Attributes

meshOctreeSlotactiveSlotPtr_
 pointer the slot containing this cube More...
 
meshOctreeCube ** subCubesPtr_
 pointer to the first child element More...
 
label cubeLabel_
 position of the cube in the list of leaves More...
 
label containedElementsLabel_
 label of the row which contains elements contained in the cube More...
 
label containedEdgesLabel_
 labels of contained surface edges More...
 

Static Private Attributes

static const label hOrder_ [24][8]
 
static const label hOrient_ [24][8]
 

Friends

Ostreamoperator<< (Ostream &, const meshOctreeCube &)
 

Additional Inherited Members

- Public Types inherited from meshOctreeCubeBasic
enum  typesOfCubes {
  UNKNOWN = 1, OUTSIDE = 2, DATA = 4, INSIDE = 8,
  ALLPROCS = -2, OTHERPROC = -3
}
 
- Static Public Attributes inherited from meshOctreeCubeCoordinates
static const label edgeNodes_ [12][2]
 edge nodes for an octree cube More...
 
static const label faceNodes_ [6][4]
 cube nodes making each face More...
 
static const label nodeFaces_ [8][3]
 node-faces addressing for the cube More...
 
static const label faceEdges_ [6][4]
 face-edges addressing for the octree cube More...
 
static const label edgeFaces_ [12][2]
 edge-faces addressing for the octree cube More...
 
static const label oppositeFace_ [6] = {1, 0, 3, 2, 5, 4}
 return the opposite face of each cube face More...
 

Detailed Description

Definition at line 56 of file meshOctreeCube.H.

Constructor & Destructor Documentation

◆ meshOctreeCube() [1/5]

meshOctreeCube ( const meshOctreeCubeBasic )
private

Disallow copy construct from meshOctreeCubeBasic.

store data which is contained in the child cube this is needed for parallel coarsening of the octree

inline void reclaimDataFromChild(const label scI);

◆ meshOctreeCube() [2/5]

meshOctreeCube ( )
inline

Default constructor.

Definition at line 38 of file meshOctreeCubeI.H.

◆ meshOctreeCube() [3/5]

meshOctreeCube ( const meshOctreeCube moc)
inline

Copy construct.

Definition at line 48 of file meshOctreeCubeI.H.

◆ meshOctreeCube() [4/5]

Construct from coordinates.

Definition at line 105 of file meshOctreeCube.C.

◆ meshOctreeCube() [5/5]

meshOctreeCube ( const meshOctreeCubeCoordinates cc,
const label  nElmts,
meshOctreeSlot slotPtr 
)

Construct from coordinates and the number of surface triangles this constructor is used for the initial cube, only

Definition at line 116 of file meshOctreeCube.C.

References meshOctreeSlot::containedEdges_, meshOctreeSlot::containedTriangles_, VRWGraph::setRowSize(), and VRWGraph::setSize().

Here is the call graph for this function:

◆ ~meshOctreeCube()

Definition at line 139 of file meshOctreeCube.C.

Member Function Documentation

◆ findContainedEdges()

void findContainedEdges ( const triSurf surface,
const boundBox rootBox 
)
private

◆ refineCube2D()

void refineCube2D ( const triSurf surface,
const boundBox rootBox,
meshOctreeSlot slotPtr = NULL 
)

refine cube in two directions, it is used for generating quadtrees

set the cube label to -1

create subCubes

create new cubes in the Z-order fashion

check if the subCube contain the element

find surface edges within the cube

Definition at line 102 of file meshOctreeCubeRefine.C.

References VRWGraph::appendList(), meshOctreeSlot::childCubes_, meshOctreeSlot::containedTriangles_, meshOctreeSlot::cubes_, Foam::endl(), forAll, forAllRow, Foam::Info, DynList< T, staticSize >::size(), VRWGraph::size(), and Foam::Warning.

Here is the call graph for this function:

◆ refineCube()

void refineCube ( const triSurf surface,
const boundBox rootBox,
meshOctreeSlot slotPtr = NULL 
)

subdivide the octree cube

set the cube label to -1

create subCubes

create new cubes in the Z-order fashion

check if the subCube contain the element

find surface edges within the cube

Definition at line 223 of file meshOctreeCubeRefine.C.

References VRWGraph::appendList(), meshOctreeSlot::childCubes_, meshOctreeSlot::containedTriangles_, meshOctreeSlot::cubes_, Foam::endl(), forAll, forAllRow, Foam::Info, DynList< T, staticSize >::size(), VRWGraph::size(), and Foam::Warning.

Referenced by meshOctreeCreator::createOctreeWithRefinedBoundary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refineMissingCube() [1/2]

void refineMissingCube ( const triSurf ts,
const boundBox rootBox,
const label  scI,
meshOctreeSlot slotPtr = NULL 
)

create missing child cubes and refine them until the required cube is reached (this function is used for parallel octree creation)

set the cube label to -1

refine the cube for the selected position

Definition at line 340 of file meshOctreeCubeRefine.C.

References DynList< T, staticSize >::append(), VRWGraph::appendList(), meshOctreeSlot::childCubes_, meshOctreeSlot::containedTriangles_, meshOctreeSlot::cubes_, forAll, forAllRow, DynList< T, staticSize >::size(), and VRWGraph::size().

Referenced by meshOctreeModifier::refineTreeForCoordinates().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refineMissingCube() [2/2]

void refineMissingCube ( const label  scI,
const label  elementsRowI = -1,
const label  edgesRowI = -1,
meshOctreeSlot slotPtr = NULL 
)

create missing child cubes and refine them until the required cube is reached (this function is used for parallel octree creation) contained elements and edges are provided as argument

set the cube label to -1

refine the cube for the selected position

set the contained elements and edges

Definition at line 412 of file meshOctreeCubeRefine.C.

References meshOctreeSlot::childCubes_, meshOctreeSlot::cubes_, and forAll.

◆ slotPtr()

const meshOctreeSlot * slotPtr ( ) const
inline

◆ cubeLabel()

label cubeLabel ( ) const
inline

◆ isLeaf()

bool isLeaf ( ) const
inline

◆ subCube()

meshOctreeCube * subCube ( const label  scI) const
inline

◆ subCubes()

FixedList< meshOctreeCube *, 8 > subCubes ( ) const

return the pointers to the sons

Definition at line 144 of file meshOctreeCube.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, meshOctreeCube::subCube(), and meshOctreeCube::subCubesPtr_.

Here is the call graph for this function:

◆ hasContainedTriangles()

bool hasContainedTriangles ( const triSurf surface,
const boundBox rootBox,
const VRWGraph containedElements 
) const

check if this box has some contained triangles

Definition at line 43 of file meshOctreeCubeIntersections.C.

References forAllRow.

◆ hasContainedElements()

bool hasContainedElements ( ) const
inline

return true if the box contains some triangles

Definition at line 81 of file meshOctreeCubeI.H.

References meshOctreeCube::containedElementsLabel_.

Referenced by findCellsIntersectingSurface::findIntersectedCells(), meshOctree::findTrianglesInBox(), meshOctreeModifier::reduceMemoryConsumption(), and meshOctreeCreator::refineBoundary().

Here is the caller graph for this function:

◆ containedElements()

label containedElements ( ) const
inline

returns the list of contained surface elements this list is only allocated for cubes containing elements

Definition at line 89 of file meshOctreeCubeI.H.

References meshOctreeCube::containedElementsLabel_.

Referenced by findCellsIntersectingSurface::findIntersectedCells(), meshOctree::findTrianglesInBox(), meshOctreeModifier::reduceMemoryConsumption(), meshOctreeCreator::refineBoundary(), and meshOctreeInsideOutside::reviseDataBoxes().

Here is the caller graph for this function:

◆ hasContainedEdges()

bool hasContainedEdges ( ) const
inline

returns true if the box contains some edges

Definition at line 94 of file meshOctreeCubeI.H.

References meshOctreeCube::containedEdgesLabel_.

Referenced by meshOctree::findEdgesInBox(), and meshOctreeModifier::reduceMemoryConsumption().

Here is the caller graph for this function:

◆ containedEdges()

label containedEdges ( ) const
inline

returns the list of contained surface edges this list is only allocated for cubes containing edges

Definition at line 102 of file meshOctreeCubeI.H.

References meshOctreeCube::containedEdgesLabel_.

Referenced by meshOctree::findEdgesInBox(), and meshOctreeModifier::reduceMemoryConsumption().

Here is the caller graph for this function:

◆ leavesInBox()

void leavesInBox ( const boundBox rootBox,
const boundBox searchingBox,
DynList< const meshOctreeCube *, 256 > &  leaves 
) const

leaves contained in the given box

Definition at line 43 of file meshOctreeCubeRecursiveFunctions.C.

References DynList< T, staticSize >::append(), meshOctreeCubeCoordinates::cubeBox(), meshOctreeCube::leavesInBox(), boundBox::max(), boundBox::min(), boundBox::overlaps(), and UPstream::parRun().

Referenced by meshOctreeCube::leavesInBox().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ leavesInSphere()

void leavesInSphere ( const boundBox rootBox,
const point c,
const scalar  r,
DynList< label > &  containedLeaves 
) const

find leaves within a sphere

Definition at line 89 of file meshOctreeCubeRecursiveFunctions.C.

References DynList< T, staticSize >::append(), Foam::constant::universal::c, meshOctreeCubeCoordinates::centre(), meshOctreeCube::leavesInSphere(), Foam::magSqr(), meshOctreeCubeBasic::OTHERPROC, UPstream::parRun(), and Foam::sqr().

Referenced by meshOctreeCube::leavesInSphere().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ markLeavesInSphere()

void markLeavesInSphere ( const boundBox rootBox,
const point c,
const scalar  r,
labelList markedLeaves,
bool &  atProcessorBnd 
) const

mark leaves within a sphere

Definition at line 135 of file meshOctreeCubeRecursiveFunctions.C.

References Foam::constant::universal::c, meshOctreeCubeCoordinates::centre(), Foam::magSqr(), meshOctreeCube::markLeavesInSphere(), UPstream::parRun(), and Foam::sqr().

Referenced by meshOctreeCube::markLeavesInSphere().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findLeaves()

void findLeaves ( LongList< meshOctreeCube * > &  leaves) const

find leaves for a given cube

Definition at line 184 of file meshOctreeCubeRecursiveFunctions.C.

References LongList< T, Offset >::append(), meshOctreeCube::cubeLabel_, meshOctreeCube::findLeaves(), meshOctreeCube::isLeaf(), LongList< T, Offset >::size(), and meshOctreeCube::subCubesPtr_.

Referenced by meshOctreeModifier::createListOfLeaves(), and meshOctreeCube::findLeaves().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findCoordinatesOfMissingCubes()

void findCoordinatesOfMissingCubes ( LongList< meshOctreeCubeCoordinates > &  coordinates) const

find coordinates of cubes which are located on other processors

Definition at line 207 of file meshOctreeCubeRecursiveFunctions.C.

References PtrList::append(), coordinates(), and meshOctreeCube::findCoordinatesOfMissingCubes().

Referenced by meshOctreeCube::findCoordinatesOfMissingCubes(), and meshOctreeModifier::updateCommunicationPattern().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ countChildCubes()

void countChildCubes ( label nCubes) const

count number of originating from this cube

Definition at line 229 of file meshOctreeCubeRecursiveFunctions.C.

References meshOctreeCube::countChildCubes(), meshOctreeCube::isLeaf(), and meshOctreeCube::subCubesPtr_.

Referenced by meshOctreeCube::countChildCubes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ purgeProcessorCubes()

bool purgeProcessorCubes ( const short  procNo)

delete boxes which are not local to the given processor

Definition at line 247 of file meshOctreeCubeRecursiveFunctions.C.

References meshOctreeCubeBasic::ALLPROCS, meshOctreeCube::isLeaf(), meshOctreeCubeBasic::procNo(), meshOctreeCubeBasic::setProcNo(), and meshOctreeCube::subCubesPtr_.

Referenced by meshOctreeModifier::distributeLeavesToProcessors(), and meshOctreeModifier::loadDistribution().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

void operator= ( const meshOctreeCube moc)
inline

Friends And Related Function Documentation

◆ operator<<

Ostream& operator<< ( Ostream os,
const meshOctreeCube oc 
)
friend

Definition at line 161 of file meshOctreeCube.C.

Field Documentation

◆ activeSlotPtr_

meshOctreeSlot* activeSlotPtr_
private

pointer the slot containing this cube

Definition at line 61 of file meshOctreeCube.H.

Referenced by meshOctreeCube::operator=(), and meshOctreeCube::slotPtr().

◆ subCubesPtr_

meshOctreeCube** subCubesPtr_
private

◆ cubeLabel_

label cubeLabel_
mutableprivate

position of the cube in the list of leaves

Definition at line 67 of file meshOctreeCube.H.

Referenced by meshOctreeCube::cubeLabel(), meshOctreeCube::findLeaves(), and meshOctreeCube::operator=().

◆ containedElementsLabel_

label containedElementsLabel_
private

label of the row which contains elements contained in the cube

Definition at line 70 of file meshOctreeCube.H.

Referenced by meshOctreeCube::containedElements(), meshOctreeCube::hasContainedElements(), and meshOctreeCube::operator=().

◆ containedEdgesLabel_

label containedEdgesLabel_
private

labels of contained surface edges

Definition at line 73 of file meshOctreeCube.H.

Referenced by meshOctreeCube::containedEdges(), meshOctreeCube::hasContainedEdges(), and meshOctreeCube::operator=().

◆ hOrder_

const label hOrder_
staticprivate
Initial value:
=
{
{0, 1, 3, 2, 4, 5, 7, 6},
{6, 2, 1, 5, 4, 0, 3, 7},
{6, 7, 3, 2, 1, 0, 4, 5},
{3, 7, 6, 2, 1, 5, 4, 0},
{4, 0, 1, 5, 6, 2, 3, 7},
{1, 0, 4, 5, 6, 7, 3, 2},
{3, 7, 4, 0, 1, 5, 6, 2},
{6, 2, 3, 7, 4, 0, 1, 5},
{3, 2, 6, 7, 4, 5, 1, 0},
{3, 2, 1, 0, 4, 5, 6, 7},
{6, 5, 4, 7, 3, 0, 1, 2},
{1, 2, 6, 5, 4, 7, 3, 0},
{3, 0, 4, 7, 6, 5, 1, 2},
{4, 0, 3, 7, 6, 2, 1, 5},
{1, 2, 3, 0, 4, 7, 6, 5},
{6, 5, 1, 2, 3, 0, 4, 7},
{1, 5, 6, 2, 3, 7, 4, 0},
{1, 5, 4, 0, 3, 7, 6, 2},
{4, 5, 6, 7, 3, 2, 1, 0},
{1, 0, 3, 2, 6, 7, 4, 5},
{3, 0, 1, 2, 6, 5, 4, 7},
{4, 5, 1, 0, 3, 2, 6, 7},
{4, 7, 6, 5, 1, 2, 3, 0},
{4, 7, 3, 0, 1, 2, 6, 5}
}

this data is needed to map the the current refinement pattern to the Hilbert space-filling curve in order to reduce the bandwidth in the list of leaves. The procedure is performed using the table published in (Campbell etal: Dynamic Octree Load Balancing Using Space-Filling Curves) which is adjusted to the current ref pattern

Definition at line 81 of file meshOctreeCube.H.

◆ hOrient_

const label hOrient_
staticprivate
Initial value:
=
{
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 7, 1, 8, 5, 1, 4, 9},
{15, 0, 2, 22, 20, 2, 19, 23},
{20, 6, 3, 23, 15, 3, 16, 22},
{22, 13, 4, 12, 11, 4, 1, 20},
{11, 19, 5, 20, 22, 5, 0, 12},
{9, 3, 6, 2, 21, 6, 17, 0},
{10, 1, 7, 11, 12, 7, 13, 14},
{12, 9, 8, 14, 10, 8, 18, 11},
{6, 8, 9, 7, 17, 9, 21, 1},
{7, 15, 10, 16, 13, 10, 12, 17},
{5, 14, 11, 9, 0, 11, 22, 8},
{8, 20, 12, 19, 18, 12, 10, 5},
{18, 4, 13, 5, 8, 13, 7, 19},
{17, 11, 14, 1, 6, 14, 23, 7},
{2, 10, 15, 18, 19, 15, 20, 21},
{19, 17, 16, 21, 2, 16, 3, 18},
{14, 16, 17, 15, 23, 17, 6, 10},
{13, 21, 18, 17, 7, 18, 8, 16},
{16, 5, 19, 4, 3, 19, 2, 13},
{3, 12, 20, 13, 16, 20, 15, 4},
{23, 18, 21, 10, 14, 21, 9, 15},
{4, 23, 22, 6, 1, 22, 11, 3},
{21, 22, 23, 0, 9, 23, 14, 2}
}

orientation of the Hilbert curve in the refined cubes of a cube with the ordering in the above table

Definition at line 85 of file meshOctreeCube.H.


The documentation for this class was generated from the following files: