Public Member Functions | Private Member Functions | Private Attributes
meshOctreeModifier Class Reference
Collaboration diagram for meshOctreeModifier:
Collaboration graph
[legend]

Public Member Functions

 meshOctreeModifier (meshOctree &)
 Construct from octree. More...
 
 ~meshOctreeModifier ()
 
const meshOctreeoctree () const
 return octree More...
 
labelListneiProcsAccess ()
 return neighbour processors More...
 
boundBoxrootBoxAccess ()
 return rootBox More...
 
bool & isRootInitialisedAccess ()
 return isRootInitialised_ More...
 
scalar & searchRangeAccess ()
 return search range More...
 
List< Pair< meshOctreeCubeCoordinates > > & neiRangeAccess ()
 return the range of leaves at each processor More...
 
meshOctreeCubeinitialCubeAccess ()
 return initial cube More...
 
List< meshOctreeSlot > & dataSlotsAccess ()
 return octree slots More...
 
meshOctreeCubefindCubeForPosition (const meshOctreeCubeCoordinates &) const
 return the pointer to the meshOctreeCube at the given position More...
 
void findLeavesContainedInBox (const boundBox &, DynList< const meshOctreeCube *, 256 > &) const
 find leaves contained in a given boundBox More...
 
LongList< meshOctreeCube * > & leavesAccess ()
 return leaves More...
 
void createListOfLeaves ()
 create leaves More...
 
void markAdditionalLayers (labelList &refineBox, const label nLayers=1) const
 mark additional layers around the leaves selected for refinement More...
 
void markAdditionalLayersOfFaceNeighbours (labelList &refineBox, const label nLayers=1) const
 mark additional layers around the leaves selected for refinement More...
 
label markAdditionalLayers (labelList &refineBox, labelList &nLayers, List< direction > &targetRefLevel) const
 
void refineSelectedBoxes (labelList &refineBox, const bool hexRefinement=false)
 
void refineSelectedBoxesAndAdditionalLayers (labelList &refineBox, const scalarList &refThickness)
 refine selected boxes and the boxes within the given range More...
 
void distributeLeavesToProcessors ()
 
void loadDistribution (const direction usedType=0)
 move octree cubes from one processor to another More...
 
void refineTreeForCoordinates (const meshOctreeCubeCoordinates &, const short procNo=Pstream::myProcNo(), const direction cubeType=meshOctreeCubeBasic::UNKNOWN)
 refine the tree to add cubes transferred from other processors More...
 
void refineTreeForCoordinates (const meshOctreeCubeCoordinates &, const labelList &containedTriangles, const labelList &containedEdges, const short procNo=Pstream::myProcNo(), const direction cubeType=meshOctreeCubeBasic::UNKNOWN)
 
void updateCommunicationPattern ()
 
void addLayerFromNeighbouringProcessors ()
 
void reduceMemoryConsumption ()
 reduce memory consumption by deleting unnecessary data More...
 

Private Member Functions

void ensureCorrectRegularity (labelList &refineBox)
 correct refinement such that it produces 1-irregular octree More...
 
bool ensureCorrectRegularitySons (labelList &refineBox)
 
 meshOctreeModifier (const meshOctreeModifier &)
 Disallow default bitwise copy construct. More...
 
void operator= (const meshOctreeModifier &)
 Disallow default bitwise assignment. More...
 

Private Attributes

meshOctreeoctree_
 Reference to the octree. More...
 

Detailed Description

Definition at line 48 of file meshOctreeModifier.H.

Constructor & Destructor Documentation

◆ meshOctreeModifier() [1/2]

meshOctreeModifier ( const meshOctreeModifier )
private

Disallow default bitwise copy construct.

◆ meshOctreeModifier() [2/2]

Construct from octree.

Definition at line 43 of file meshOctreeModifier.C.

◆ ~meshOctreeModifier()

Definition at line 52 of file meshOctreeModifier.C.

Member Function Documentation

◆ ensureCorrectRegularity()

void ensureCorrectRegularity ( labelList refineBox)
private

◆ ensureCorrectRegularitySons()

bool ensureCorrectRegularitySons ( labelList refineBox)
private

add additional refinement with the following rule. If a son of a father box is refined, then refine all other sons

mark this leaf for refinement

propagate this information to other processors

mark this leaf for refinement

Definition at line 197 of file meshOctreeModifierEnsureCorrectRegularity.C.

References LongList< T, Offset >::append(), meshOctree::exchangeRequestsWithNeighbourProcessors(), meshOctree::findLeafLabelForPosition(), forAll, meshOctree::leaves_, meshOctree::neiProcs(), meshOctreeModifier::octree_, meshOctreeCubeBasic::OTHERPROC, Foam::reduce(), meshOctreeCubeCoordinates::refineForPosition(), and List::size().

Here is the call graph for this function:

◆ operator=()

void operator= ( const meshOctreeModifier )
private

Disallow default bitwise assignment.

◆ octree()

const meshOctree & octree ( ) const
inline

◆ neiProcsAccess()

labelList & neiProcsAccess ( )
inline

return neighbour processors

Definition at line 41 of file meshOctreeModifierI.H.

References meshOctree::neiProcs_, and meshOctreeModifier::octree_.

◆ rootBoxAccess()

boundBox & rootBoxAccess ( )
inline

return rootBox

Definition at line 46 of file meshOctreeModifierI.H.

References meshOctreeModifier::octree_, and meshOctree::rootBox_.

Referenced by meshOctreeCreator::setRootCubeSizeAndRefParameters().

Here is the caller graph for this function:

◆ isRootInitialisedAccess()

bool & isRootInitialisedAccess ( )
inline

return isRootInitialised_

Definition at line 51 of file meshOctreeModifierI.H.

References meshOctree::isRootInitialised_, and meshOctreeModifier::octree_.

Referenced by meshOctreeCreator::setRootCubeSizeAndRefParameters().

Here is the caller graph for this function:

◆ searchRangeAccess()

scalar & searchRangeAccess ( )
inline

return search range

Definition at line 56 of file meshOctreeModifierI.H.

References meshOctreeModifier::octree_, and meshOctree::searchRange_.

Referenced by meshOctreeCreator::setRootCubeSizeAndRefParameters().

Here is the caller graph for this function:

◆ neiRangeAccess()

List< Pair< meshOctreeCubeCoordinates > > & neiRangeAccess ( )
inline

return the range of leaves at each processor

Definition at line 62 of file meshOctreeModifierI.H.

References meshOctree::neiRange_, and meshOctreeModifier::octree_.

◆ initialCubeAccess()

meshOctreeCube & initialCubeAccess ( )
inline

return initial cube

Definition at line 67 of file meshOctreeModifierI.H.

References meshOctree::initialCubePtr_, and meshOctreeModifier::octree_.

◆ dataSlotsAccess()

List< meshOctreeSlot > & dataSlotsAccess ( )
inline

return octree slots

Definition at line 72 of file meshOctreeModifierI.H.

References meshOctree::dataSlots_, and meshOctreeModifier::octree_.

Referenced by meshOctreeCreator::createOctreeWithRefinedBoundary().

Here is the caller graph for this function:

◆ findCubeForPosition()

meshOctreeCube * findCubeForPosition ( const meshOctreeCubeCoordinates cc) const
inline

return the pointer to the meshOctreeCube at the given position

Definition at line 78 of file meshOctreeModifierI.H.

Referenced by meshOctreeAutomaticRefinement::refineSelectedBoxes().

Here is the caller graph for this function:

◆ findLeavesContainedInBox()

void findLeavesContainedInBox ( const boundBox bb,
DynList< const meshOctreeCube *, 256 > &  containedLeaves 
) const
inline

find leaves contained in a given boundBox

Definition at line 86 of file meshOctreeModifierI.H.

References DynList< T, staticSize >::clear().

Here is the call graph for this function:

◆ leavesAccess()

LongList< meshOctreeCube * > & leavesAccess ( )
inline

◆ createListOfLeaves()

void createListOfLeaves ( )
inline

◆ markAdditionalLayers() [1/2]

void markAdditionalLayers ( labelList refineBox,
const label  nLayers = 1 
) const

mark additional layers around the leaves selected for refinement

this is needed for parallel runs to reduce the communication messages

check consistency with received cube coordinates

Definition at line 53 of file meshOctreeModifierRefineSelectedBoxes.C.

References LongList< T, Offset >::append(), DynList< T, staticSize >::clear(), HashTable::clear(), forAll, HashTable::found(), HashSet< Key, Hash >::insert(), and meshOctreeCubeBasic::OTHERPROC.

Referenced by meshOctreeAutomaticRefinement::refineSelectedBoxes().

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

◆ markAdditionalLayersOfFaceNeighbours()

void markAdditionalLayersOfFaceNeighbours ( labelList refineBox,
const label  nLayers = 1 
) const

mark additional layers around the leaves selected for refinement

this is needed for parallel runs to reduce the communication messages

check consistency with received cube coordinates

Definition at line 148 of file meshOctreeModifierRefineSelectedBoxes.C.

References LongList< T, Offset >::append(), DynList< T, staticSize >::clear(), HashTable::clear(), forAll, HashTable::found(), HashSet< Key, Hash >::insert(), and meshOctreeCubeBasic::OTHERPROC.

Here is the call graph for this function:

◆ markAdditionalLayers() [2/2]

label markAdditionalLayers ( labelList refineBox,
labelList nLayers,
List< direction > &  targetRefLevel 
) const

mark additional layers around the leaves selected for refinement given on a box-by-box basis returns the number of boxes selected for refinement

sort leaves based on the number of additional layers

set refinement flag to additional boxes marked separately

find the max required refinement level

mark additional boxes for refinement

mark additional cells at this refinement level

update the main list

Definition at line 304 of file meshOctreeModifierRefineSelectedBoxes.C.

References List::append(), Foam::endl(), forAll, forAllReverse, Foam::Info, Foam::help::labelToText(), Foam::max(), Foam::reduce(), Foam::returnReduce(), and LongList< T, Offset >::size().

Here is the call graph for this function:

◆ refineSelectedBoxes()

void refineSelectedBoxes ( labelList refineBox,
const bool  hexRefinement = false 
)

refine leaves marked for refinement hexRefinement is activated when it is required to refine all sons of the same father, if a single son gets marked for refinement

ensure that refinement will produce 1-irregular octree

this is needed for thread safety such solutions make me a sad bunny :(

Definition at line 428 of file meshOctreeModifierRefineSelectedBoxes.C.

References Foam::endl(), forAll, Foam::Info, startTime, and surface::surface().

Referenced by meshOctreeCreator::refineBoundary(), meshOctreeCreator::refineBoxes(), meshOctreeCreator::refineBoxesContainedInObjects(), meshOctreeCreator::refineBoxesIntersectingEdgeMeshes(), meshOctreeCreator::refineBoxesIntersectingSurfaces(), meshOctreeCreator::refineBoxesNearDataBoxes(), and meshOctreeAutomaticRefinement::refineSelectedBoxes().

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

◆ refineSelectedBoxesAndAdditionalLayers()

void refineSelectedBoxesAndAdditionalLayers ( labelList refineBox,
const scalarList refThickness 
)

refine selected boxes and the boxes within the given range

find the maximum refinement level of leaves marked for refinement

sort leaves based on the current level

find leaves with the same number of additional layers

find the maximum number of layers

refine leaves

mark current leaves for refinement

get out of the do-while loop if there are no selected leaves

mark additional boxes for refinement

find the leaves in the additional layers

check if there exist leaves at lower refinement level

found a neighbour at a lower refinement level

do not allow refinement of leaves at higher refinement level

deselect leaves at the current level

refine selected octree boxes

Definition at line 500 of file meshOctreeModifierRefineSelectedBoxes.C.

References LongList< T, Offset >::append(), List::append(), LongList< T, Offset >::clear(), Foam::endl(), forAll, forAllConstIter(), forAllReverse, Foam::Info, Foam::max(), Foam::reduce(), Foam::returnReduce(), and LongList< T, Offset >::size().

Referenced by meshOctreeCreator::refineBoundary(), meshOctreeCreator::refineBoxesContainedInObjects(), meshOctreeCreator::refineBoxesIntersectingEdgeMeshes(), and meshOctreeCreator::refineBoxesIntersectingSurfaces().

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

◆ distributeLeavesToProcessors()

void distributeLeavesToProcessors ( )

distribute leaves of the initial octree to processors each processor creates a list of neighbouring processors

leaf boxes are sorted in Z-ordering initial distribution is performed by decomposing the list of leaves into the equal-size chunks and allocate them to processors

find neighbouring processors of the current processor

delete cubes which are not local to the processor

update the list of leaves

Definition at line 39 of file meshOctreeModifierDistributeLeavesToProcessors.C.

References DynList< T, staticSize >::appendIfNotIn(), meshOctreeModifier::createListOfLeaves(), Foam::endl(), forAll, Foam::Info, meshOctree::initialCubePtr_, meshOctree::leaves_, UPstream::myProcNo(), meshOctree::neiProcs(), meshOctree::neiProcs_, meshOctree::neiRange_, UPstream::nProcs(), meshOctreeModifier::octree_, meshOctreeCube::purgeProcessorCubes(), Foam::Serr, List::setSize(), List::size(), LongList< T, Offset >::size(), DynList< T, staticSize >::size(), and Foam::sort().

Referenced by meshOctreeCreator::refineBoundary(), meshOctreeCreator::refineBoxes(), meshOctreeCreator::refineBoxesContainedInObjects(), meshOctreeCreator::refineBoxesIntersectingEdgeMeshes(), meshOctreeCreator::refineBoxesIntersectingSurfaces(), and meshOctreeCreator::refineBoxesNearDataBoxes().

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

◆ loadDistribution()

void loadDistribution ( const direction  usedType = 0)

move octree cubes from one processor to another

check if balancing should be performed the tolerance is set to 5% difference in the number of boxes from the ideal one

start calculating new partitions find global labels of the leaf boxes

leaf boxes which are not in the range for the current processor shall be migrated to other processors

send the information to other processors all processors shall received a list containing the same information each processor informs which other processors shall receive data from that processor

receive coordinates from processors with lower labels

send the coordinates of the boxes to processors with greater label

receive data sent from processors with greater label

send the coordinates of the boxes to processors with lower label

delete cubes which have been moved to other processors

create boxes from the received coordinates

update the communication pattern

Definition at line 51 of file meshOctreeModifierLoadDistribution.C.

References UPstream::blocking, coordinates(), meshOctreeCubeBasic::coordinates(), meshOctreeModifier::createListOfLeaves(), meshOctreeCubeBasic::cubeType(), Foam::endl(), forAll, forAllConstIter(), Pstream::gatherList(), Foam::Info, meshOctree::initialCubePtr_, HashSet< Key, Hash >::insert(), meshOctree::leaves_, Foam::mag(), Foam::min(), UPstream::myProcNo(), meshOctree::neiProcs(), UPstream::nProcs(), meshOctreeModifier::octree_, meshOctreeCube::purgeProcessorCubes(), Foam::reduce(), meshOctreeModifier::refineTreeForCoordinates(), Foam::returnReduce(), Pstream::scatterList(), Foam::Serr, LongList< T, Offset >::setSize(), List::setSize(), List::size(), LongList< T, Offset >::size(), startTime, and meshOctreeModifier::updateCommunicationPattern().

Referenced by meshOctreeCreator::loadDistribution(), and meshOctreeAutomaticRefinement::refineSelectedBoxes().

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

◆ refineTreeForCoordinates() [1/2]

void refineTreeForCoordinates ( const meshOctreeCubeCoordinates cc,
const short  procNo = Pstream::myProcNo(),
const direction  cubeType = meshOctreeCubeBasic::UNKNOWN 
)

refine the tree to add cubes transferred from other processors

refine the missing cube

create the needed cube if it is not present

Definition at line 44 of file meshOctreeModifierParallelRefinement.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, meshOctreeCube::isLeaf(), meshOctreeCubeCoordinates::level(), meshOctreeCubeCoordinates::posX(), meshOctreeCubeCoordinates::posY(), meshOctreeCubeCoordinates::posZ(), meshOctreeCube::refineMissingCube(), meshOctreeCubeBasic::setCubeType(), meshOctreeCubeBasic::setProcNo(), and meshOctreeCube::subCube().

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

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

◆ refineTreeForCoordinates() [2/2]

void refineTreeForCoordinates ( const meshOctreeCubeCoordinates cc,
const labelList containedTriangles,
const labelList containedEdges,
const short  procNo = Pstream::myProcNo(),
const direction  cubeType = meshOctreeCubeBasic::UNKNOWN 
)

refine the missing cube

nei->refineMissingCube(scI, containedTrianglesI, containedEdgesI);

create the needed cube if it is not present

Definition at line 120 of file meshOctreeModifierParallelRefinement.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, meshOctreeCube::isLeaf(), meshOctreeCubeCoordinates::level(), meshOctreeCubeCoordinates::posX(), meshOctreeCubeCoordinates::posY(), meshOctreeCubeCoordinates::posZ(), meshOctreeCube::refineMissingCube(), meshOctreeCubeBasic::setCubeType(), meshOctreeCubeBasic::setProcNo(), and meshOctreeCube::subCube().

Here is the call graph for this function:

◆ updateCommunicationPattern()

void updateCommunicationPattern ( )

update the communication pattern between the processors this function is used for load balancing

create the list which contains ranges of addresses at a given processor

create the range for the current processor

communicate missing ranges

find missing child cubes in the tree. These coordinates are located on other processors, and they must fit in the range of cubes located on that processor.

create new neighbour procs and their range

Definition at line 45 of file meshOctreeModifierUpdateCommunicationPattern.C.

References Foam::endl(), meshOctreeCube::findCoordinatesOfMissingCubes(), forAll, Pstream::gatherList(), Foam::Info, meshOctree::initialCubePtr_, HashSet< Key, Hash >::insert(), meshOctree::leaves_, UPstream::myProcNo(), meshOctree::neiProcs_, meshOctree::neiRange_, UPstream::nProcs(), meshOctreeModifier::octree_, range, Pstream::scatterList(), List::size(), LongList< T, Offset >::size(), startTime, and HashTable::toc().

Referenced by meshOctreeModifier::loadDistribution().

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

◆ addLayerFromNeighbouringProcessors()

void addLayerFromNeighbouringProcessors ( )

add an additional layer of boxes which belongs to the neighbouring processors. This simplifies the process of extracting the mesh template from the octree in a parallel run

fill the data into into the map

exchange data with other processors

cubes which share a common, face, edge or vertex are added into the current processor's tree

recalculate leaves

Definition at line 200 of file meshOctreeModifierParallelRefinement.C.

References Foam::abort(), UPstream::blocking, coordinates(), meshOctreeModifier::createListOfLeaves(), Foam::endl(), Foam::help::exchangeMap(), Foam::FatalError, meshOctree::findAllLeafNeighbours(), forAll, found, Foam::Info, meshOctree::leaves_, UPstream::myProcNo(), meshOctree::neiProcs_, meshOctree::neiRange_, UPstream::nProcs(), meshOctree::numberOfLeaves(), meshOctreeModifier::octree_, UPstream::parRun(), Foam::Pout, meshOctreeCubeBasic::procNo(), meshOctreeModifier::refineTreeForCoordinates(), meshOctree::returnLeaf(), Foam::returnReduce(), and LongList< T, Offset >::size().

Referenced by meshOctreeAddressing::meshOctreeAddressing().

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

◆ reduceMemoryConsumption()

void reduceMemoryConsumption ( )

Field Documentation

◆ octree_

meshOctree& octree_
private

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