Public Member Functions | |
meshOctreeModifier (meshOctree &) | |
Construct from octree. More... | |
~meshOctreeModifier () | |
const meshOctree & | octree () const |
return octree More... | |
labelList & | neiProcsAccess () |
return neighbour processors More... | |
boundBox & | rootBoxAccess () |
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... | |
meshOctreeCube & | initialCubeAccess () |
return initial cube More... | |
List< meshOctreeSlot > & | dataSlotsAccess () |
return octree slots More... | |
meshOctreeCube * | findCubeForPosition (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 | |
meshOctree & | octree_ |
Reference to the octree. More... | |
Definition at line 48 of file meshOctreeModifier.H.
|
private |
Disallow default bitwise copy construct.
meshOctreeModifier | ( | meshOctree & | octree | ) |
Construct from octree.
Definition at line 43 of file meshOctreeModifier.C.
~meshOctreeModifier | ( | ) |
Definition at line 52 of file meshOctreeModifier.C.
|
private |
correct refinement such that it produces 1-irregular octree
this is needed for parallel runs to reduce the bandwidth
check consistency with received cube coordinates
calculate the number of selected boxes over all processors
Definition at line 44 of file meshOctreeModifierEnsureCorrectRegularity.C.
References LongList< T, Offset >::append(), LongList< T, Offset >::clear(), DynList< T, staticSize >::clear(), HashTable::clear(), meshOctreeCubeBasic::coordinates(), meshOctree::exchangeRequestsWithNeighbourProcessors(), meshOctree::findAllLeafNeighbours(), forAll, HashTable::found(), HashSet< Key, Hash >::insert(), meshOctree::leaves_, meshOctreeCubeCoordinates::level(), meshOctree::neiProcs(), meshOctreeModifier::octree_, meshOctreeCubeBasic::OTHERPROC, Foam::reduce(), LongList< T, Offset >::setSize(), List::size(), LongList< T, Offset >::size(), and LongList< T, Offset >::transfer().
|
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().
|
private |
Disallow default bitwise assignment.
|
inline |
return octree
Definition at line 36 of file meshOctreeModifierI.H.
References meshOctreeModifier::octree_.
Referenced by meshOctreeInsideOutside::frontalMarking(), meshOctreeInsideOutside::markInsideCubes(), meshOctreeInsideOutside::markOutsideCubes(), and meshOctreeInsideOutside::reviseDataBoxes().
|
inline |
return neighbour processors
Definition at line 41 of file meshOctreeModifierI.H.
References meshOctree::neiProcs_, and meshOctreeModifier::octree_.
|
inline |
return rootBox
Definition at line 46 of file meshOctreeModifierI.H.
References meshOctreeModifier::octree_, and meshOctree::rootBox_.
Referenced by meshOctreeCreator::setRootCubeSizeAndRefParameters().
|
inline |
return isRootInitialised_
Definition at line 51 of file meshOctreeModifierI.H.
References meshOctree::isRootInitialised_, and meshOctreeModifier::octree_.
Referenced by meshOctreeCreator::setRootCubeSizeAndRefParameters().
|
inline |
return search range
Definition at line 56 of file meshOctreeModifierI.H.
References meshOctreeModifier::octree_, and meshOctree::searchRange_.
Referenced by meshOctreeCreator::setRootCubeSizeAndRefParameters().
|
inline |
return the range of leaves at each processor
Definition at line 62 of file meshOctreeModifierI.H.
References meshOctree::neiRange_, and meshOctreeModifier::octree_.
|
inline |
return initial cube
Definition at line 67 of file meshOctreeModifierI.H.
References meshOctree::initialCubePtr_, and meshOctreeModifier::octree_.
|
inline |
return octree slots
Definition at line 72 of file meshOctreeModifierI.H.
References meshOctree::dataSlots_, and meshOctreeModifier::octree_.
Referenced by meshOctreeCreator::createOctreeWithRefinedBoundary().
|
inline |
return the pointer to the meshOctreeCube at the given position
Definition at line 78 of file meshOctreeModifierI.H.
Referenced by meshOctreeAutomaticRefinement::refineSelectedBoxes().
|
inline |
find leaves contained in a given boundBox
Definition at line 86 of file meshOctreeModifierI.H.
References DynList< T, staticSize >::clear().
|
inline |
return leaves
Definition at line 95 of file meshOctreeModifierI.H.
References meshOctree::leaves_, and meshOctreeModifier::octree_.
Referenced by meshOctreeCreator::createOctreeWithRefinedBoundary(), findCellsIntersectingSurface::findIntersectedCells(), meshOctreeInsideOutside::frontalMarking(), meshOctreeInsideOutside::initialiseBoxes(), meshOctreeInsideOutside::markInsideCubes(), meshOctreeInsideOutside::markOutsideCubes(), meshOctreeAutomaticRefinement::refineBasedOnContainedCorners(), meshOctreeAutomaticRefinement::refineBasedOnContainedPartitions(), meshOctreeCreator::refineBoundary(), meshOctreeCreator::refineBoxes(), meshOctreeCreator::refineBoxesContainedInObjects(), meshOctreeCreator::refineBoxesIntersectingEdgeMeshes(), meshOctreeCreator::refineBoxesIntersectingSurfaces(), meshOctreeCreator::refineBoxesNearDataBoxes(), meshOctreeAutomaticRefinement::refineSelectedBoxes(), and meshOctreeInsideOutside::reviseDataBoxes().
|
inline |
create leaves
Definition at line 100 of file meshOctreeModifierI.H.
References meshOctreeCube::findLeaves(), meshOctree::initialCubePtr_, meshOctree::leaves_, and meshOctreeModifier::octree_.
Referenced by meshOctreeModifier::addLayerFromNeighbouringProcessors(), meshOctreeCreator::createOctreeWithRefinedBoundary(), meshOctreeModifier::distributeLeavesToProcessors(), and meshOctreeModifier::loadDistribution().
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().
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.
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().
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().
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().
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().
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().
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().
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().
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().
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().
void reduceMemoryConsumption | ( | ) |
reduce memory consumption by deleting unnecessary data
deleting triangles
deleting edges
Definition at line 41 of file meshOctreeModifierReduceMemoryConsumption.C.
References meshOctreeCube::containedEdges(), meshOctreeCube::containedElements(), meshOctree::dataSlots_, forAll, meshOctreeCube::hasContainedEdges(), meshOctreeCube::hasContainedElements(), meshOctree::leaves_, meshOctreeModifier::octree_, VRWGraph::optimizeMemoryUsage(), VRWGraph::setRowSize(), List::setSize(), VRWGraph::size(), and meshOctreeCube::slotPtr().
|
private |
Reference to the octree.
Definition at line 52 of file meshOctreeModifier.H.
Referenced by meshOctreeModifier::addLayerFromNeighbouringProcessors(), meshOctreeModifier::createListOfLeaves(), meshOctreeModifier::dataSlotsAccess(), meshOctreeModifier::distributeLeavesToProcessors(), meshOctreeModifier::ensureCorrectRegularity(), meshOctreeModifier::ensureCorrectRegularitySons(), meshOctreeModifier::initialCubeAccess(), meshOctreeModifier::isRootInitialisedAccess(), meshOctreeModifier::leavesAccess(), meshOctreeModifier::loadDistribution(), meshOctreeModifier::neiProcsAccess(), meshOctreeModifier::neiRangeAccess(), meshOctreeModifier::octree(), meshOctreeModifier::reduceMemoryConsumption(), meshOctreeModifier::rootBoxAccess(), meshOctreeModifier::searchRangeAccess(), and meshOctreeModifier::updateCommunicationPattern().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.