Go to the documentation of this file.
49 octreeModifier_(octree),
55 communicationCubes_(),
68 label nInternal(0), nUnknown(0), nData(0), nOutside(0);
71 for(
label leafI=0;leafI<nLeaves;++leafI)
101 Info <<
"Number of internal boxes is " << nInternal <<
endl;
102 Info <<
"Number of outside boxes is " << nOutside <<
endl;
103 Info <<
"Number of data boxes is " << nData <<
endl;
104 Info <<
"Number of unknown boxes is " << nUnknown <<
endl;
120 # pragma omp parallel for if( leaves.size() > 1000 )
124 if( leaves[leafI]->hasContainedElements() )
143 label nGroup(0), nThreads(1);
151 if( leaves.
size() > 1000 )
152 nThreads = 3 * omp_get_num_procs();
154 # pragma omp parallel num_threads(nThreads) \
155 private(frontCubes, neighbours)
161 const label threadI = omp_get_thread_num();
163 const label threadI(0);
166 const label chunkSize = leaves.
size() / nThreads + 1;
168 const label minLeaf = threadI * chunkSize;
172 for(
label leafI=minLeaf;leafI<maxLeaf;++leafI)
174 if( leaves[leafI]->hasContainedElements() )
181 # pragma omp critical
192 while( frontCubes.
size() )
199 const label nei = neighbours[neiI];
200 if( (nei >= minLeaf) && (nei < maxLeaf) )
205 if( leaves[nei]->hasContainedElements() )
221 commCubes[fLabel] =
true;
225 if( leaves[nei]->hasContainedElements() )
233 std::make_pair(fLabel, nei)
241 # pragma omp critical
258 forAll(threadCommPairs, cfI)
260 const std::pair<label, label>& lp = threadCommPairs[cfI];
264 if( (neiGroup >= nGroup) || (groupI >= nGroup) )
266 <<
" groupI " << groupI <<
" are >= than "
271 localNeiGroups[groupI].appendIfNotIn(neiGroup);
272 localNeiGroups[neiGroup].appendIfNotIn(groupI);
277 # pragma omp critical
282 forAll(localNeiGroups, groupI)
321 if( commCubes[leafI] )
334 Info <<
"Total number of leaves " << totalLeaves <<
endl;
335 Info <<
"Number of marked leaves " << nMarked <<
endl;
350 keepUpdating =
false;
377 }
while( nChanged != 0 );
409 # pragma omp parallel for if( receivedCoords.size() > 100 ) \
410 private(neighbours) schedule(dynamic, 20)
418 const label nei = neighbours[neiI];
423 if( leaves[nei]->hasContainedElements() )
440 }
while( nChanged != 0 );
444 }
while( keepUpdating );
449 std::map<label, direction>::const_iterator it=
groupType_.begin();
459 const label groupI = it->first;
497 # pragma omp parallel for if( leaves.size() > 1000 ) \
498 private(neighbours) schedule(dynamic, 20) reduction(+ : nMarked)
508 # pragma omp critical
511 if( !transferCoordinates.
found(leafI) )
517 transferCoordinates.
insert(leafI);
532 Info <<
"Box " << leafI <<
" may not be a DATA box" <<
endl;
545 checkedPatches[leafI] =
true;
552 const label nei = neighbours[neiI];
579 # pragma omp parallel for if( receivedCoords.size() > 100 ) \
580 private(neighbours) schedule(dynamic, 20) reduction(+ : nMarked)
588 const label nei = neighbours[neiI];
608 }
while( nMarked != 0 );
611 label nOutside(0), nData(0), hasOutNei(0);
614 const direction cType = leaves[leafI]->cubeType();
627 Info <<
"Number of outside boxes " << nOutside <<
endl;
628 Info <<
"Number of data boxes " << nData <<
" real data "
629 << hasOutNei <<
endl;
646 std::map<label, direction>::iterator it=
groupType_.begin();
651 const label groupI = it->first;
677 keepUpdating =
false;
704 }
while( nChanged != 0 );
739 # pragma omp parallel for if( receivedCoords.size() > 100 ) \
740 private(neighbours) schedule(dynamic, 20)
748 const label nei = neighbours[neiI];
782 receivedCoords.
clear();
794 # pragma omp parallel for if( receivedCoords.size() > 100 ) \
795 private(neighbours) schedule(dynamic, 20) reduction(+ : nChanged)
803 const label nei = neighbours[neiI];
826 }
while( nChanged != 0 );
830 }
while( keepUpdating );
835 std::map<label, direction>::const_iterator it=
groupType_.begin();
845 const label groupI = it->first;
VRWGraph boundaryDATACubes_
boundary DATA boxes for a given group
void append(const T &e)
Append an element at the end of the list.
void findAllLeafNeighbours(const meshOctreeCubeCoordinates &, DynList< label > &neighbourLeaves) const
find neighbour leaves over nodes, edges and faces
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void setRow(const label rowI, const ListType &l)
Set row with the list.
#define forAll(list, i)
Loop across all elements in list.
void clear()
Clear the list, i.e. set next free to zero.
static bool & parRun()
Is this a parallel run?
void findNeighboursForLeaf(const meshOctreeCubeCoordinates &, DynList< label > &neighbourLeaves) const
find neighbour leaf cubes over all faces
void initialiseBoxes()
initialise octree boxes
void setCubeType(const direction)
set cube type
const labelList & neiProcs() const
neighbour processors of the current one
Ostream & endl(Ostream &os)
Add newline and flush stream.
boolList hasOutsideNeighbour_
flag for DATA boxes next to the OUTSIDE boxes
direction cubeType() const
return type
std::map< label, direction > groupType_
type for a group
label size() const
Size of the active part of the list.
labelLongList communicationCubes_
label of cubes at processor boundaries
void appendIfNotIn(const label rowI, const label)
Append an element to the given row if it does not exist there.
label numberOfLeaves() const
return leaves of the octree
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const typedef graphRow< const VRWGraph > constRow
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void frontalMarking()
frontal marking algorithm
void reviseDataBoxes()
revise DATA boxes
void exchangeRequestsWithNeighbourProcessors(const LongList< meshOctreeCubeCoordinates > &dataToSend, LongList< meshOctreeCubeCoordinates > &dataToReceive) const
exchange requests with other processors generating the octree
label size() const
Returns the number of rows.
void setSize(const label)
Reset the number of rows.
void frontalMarking(labelListType &result, const label startingIndex, const neiOp &neighbourCalculator, const filterOp &selector)
#define forAllRow(graph, rowI, index)
~meshOctreeInsideOutside()
PtrList< coordinateSystem > coordinates(solidRegions.size())
const meshOctreeSlot * slotPtr() const
return the pointer to the slot containing the cube
#define forAllReverse(list, i)
Reverse loop across all elements in list.
bool found(const Key &) const
Return true if hashedEntry is found in table.
errorManip< error > abort(error &err)
VRWGraph containedTriangles_
surface triangles contained in an octree cube
const meshOctree & octree() const
return octree
VRWGraph cubesInGroup_
cubes belonging to each group of octree boxes
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
meshOctreeModifier octreeModifier_
meshOctreeAddressing
bool insert(const Key &key)
Insert a new entry.
void clear()
Clear the graph.
void append(const label rowI, const label)
Append an element to the given row.
void markInsideCubes()
mark INSIDE octree boxes
label containedElements() const
meshOctreeInsideOutside(meshOctree &octree)
Construct from octree.
void size(const label)
Override size to be inconsistent with allocated storage.
const triSurf & surface() const
return a reference to the surface
VRWGraph neighbouringGroups_
labels of cubes marked by different threads
labelLongList cubeGroup_
group for a given leaf
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const meshOctreeCubeBasic & returnLeaf(const label) const
void setSizeAndRowSize(const ListType &)
Set the number of rows and the size of each row.
void markOutsideCubes()
mark OUTSIDE octree boxes
LongList< meshOctreeCube * > & leavesAccess()
return leaves