Go to the documentation of this file.
51 FatalErrorIn(
"void meshOctreeAddressing::calcGlobalPointLabels() const")
78 for(
label nlI=0;nlI<8;++nlI)
84 validLeaf[nlI] =
false;
88 for(
label i=0;i<nlI;++i)
91 validLeaf[nlI] =
false;
101 for(
label nlI=0;nlI<8;++nlI)
103 if( !validLeaf[nlI] )
114 if( procs.
size() > 1 )
115 pointProcs.
setRow(pointI, procs);
129 startPoint += nLocalPoints[procI];
157 above.
append(neiProcs[i]);
161 below.
append(neiProcs[i]);
175 fromOtherProc >> receivedLabels;
178 while( counter < receivedLabels.size() )
180 const label leafI = globalToLocalLeaf[receivedLabels[counter++]];
185 "void meshOctreeAddressing::"
186 "calcGlobalPointLabels() const"
187 ) <<
"1. Leaf " << leafI <<
" is not used in the mesh!"
190 for(
label i=0;i<8;++i)
194 const label globalLabel = receivedLabels[counter++];
196 const label nProcs = receivedLabels[counter++];
197 for(
label ppI=0;ppI<nProcs;++ppI)
200 if( globalLabel < 0 )
205 if( (gpl != -1) && (gpl != globalLabel) )
208 "void meshOctreeAddressing::"
209 "calcGlobalPointLabels() const"
210 ) <<
"Wrong global label for point " << nI
214 globalToLocal.insert(globalLabel, nI);
222 const label neiProc = below[belowI];
227 const label leafI = procLeaves(neiProc, i);
233 for(
label nI=0;nI<8;++nI)
243 dts.
append(pointProcs(nodeI, ppI));
259 fromOtherProc >> receivedLabels;
262 while( counter < receivedLabels.size() )
264 const label leafI = globalToLocalLeaf[receivedLabels[counter++]];
269 "void meshOctreeAddressing::"
270 "calcGlobalPointLabels() const"
271 ) <<
"2. Leaf " << leafI <<
" is not used in the mesh!"
274 for(
label i=0;i<8;++i)
278 const label globalLabel = receivedLabels[counter++];
280 const label nProcs = receivedLabels[counter++];
281 for(
label ppI=0;ppI<nProcs;++ppI)
284 if( globalLabel < 0 )
289 if( (gpl != -1) && (gpl != globalLabel) )
292 "void meshOctreeAddressing::"
293 "calcGlobalPointLabels() const"
294 ) <<
"Wrong global label for point " << nI
298 globalToLocal.insert(globalLabel, nI);
306 const label neiProc = above[aboveI];
311 const label leafI = procLeaves(neiProc, i);
317 for(
label nI=0;nI<8;++nI)
327 dts.
append(pointProcs(nodeI, ppI));
340 FatalErrorIn(
"void meshOctreeAddressing::calcGlobalFaceLabels() const")
341 <<
"Cannot calculate global labels! Exitting" <<
exit(
FatalError);
349 FatalErrorIn(
"void meshOctreeAddressing::calcGlobalLeafLabels() const")
350 <<
"Cannot calculate global labels! Exitting" <<
exit(
FatalError);
368 # pragma omp parallel for schedule(static) reduction(+:nLeaves)
387 nLeaves += nLeavesAtProc[procI];
401 otherProcLeaves.
append(leafI);
412 std::map<label, LongList<meshOctreeCubeBasic> > exchangeData;
416 const std::pair<label, LongList<meshOctreeCubeBasic> > pp
422 exchangeData.insert(pp);
430 forAll(otherProcLeaves, i)
435 exchangeData[oc.
procNo()].append(coc);
454 std::map<label, labelLongList> exchangeLabels;
455 std::map<label, LongList<meshOctreeCubeBasic> >::iterator it;
456 for(it=exchangeData.begin();it!=exchangeData.end();++it)
459 exchangeLabels.insert(std::make_pair(it->first,
labelLongList()));
486 if( rLeaves.
size() != rLabels.
size() )
487 FatalErrorIn(
"void meshOctreeAddressing::calcGlobalLeafLabels() const")
496 globalToLocal.insert(rLabels[i], cLabel);
500 exchangeLabels.clear();
502 exchangeLabels.insert(std::make_pair(neiProcs[procI],
labelLongList()));
506 const label leafI = iter();
533 while( counter < rLabels.
size() )
535 const label gLabel = rLabels[counter++];
537 if( !globalToLocal.found(gLabel) )
538 FatalError <<
"Cannot find global label " << gLabel
541 const label leafI = globalToLocal[gLabel];
543 const label numberOfProcs = rLabels[counter++];
544 for(
label i=0;i<numberOfProcs;++i)
548 # ifdef DEBUGAddressing
575 exchangeData.clear();
593 std::map<label, List<meshOctreeCubeBasic> > rMap;
609 <<
" does not contain processor " << it->first
labelLongList * globalPointLabelPtr_
global octree point label
void append(const T &e)
Append an element at the end of the list.
Map< label > * globalPointToLocalPtr_
global point to local label addressing
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.
Output inter-processor communications stream.
Template functions to aid in the implementation of demand driven data.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
void clear()
Clear the list, i.e. set next free to zero.
const VRWGraph & nodeLabels() const
return nodeLabels
static bool & parRun()
Is this a parallel run?
void calcGlobalLeafLabels() const
const labelList & neiProcs() const
neighbour processors of the current one
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
Size of the active part of the list.
label size() const
Returns the number of rows.
labelLongList * globalLeafLabelPtr_
global leaf label
void appendIfNotIn(const label rowI, const label)
Append an element to the given row if it does not exist there.
const Map< label > & globalToLocalLeafAddressing() const
return global leaf label to local label addressing
bool contains(const label rowI, const label e) const
check if the element is in the given row (takes linear time)
void calcGlobalPointLabels() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label numberOfLeaves() const
return leaves of the octree
label findLeafLabelForPosition(const meshOctreeCubeCoordinates &) const
return leaf cube for the given position
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const VRWGraph & leafAtProcs() const
return processors which contain each octree leaf
void appendIfNotIn(const T &e)
#define forAllRow(graph, rowI, index)
void setProcNo(const short)
set processor number
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
const labelLongList & globalPointLabel() const
return global point labels
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
VRWGraph * pointProcsPtr_
point-processors addressing
const List< direction > & boxType() const
return which octree boxes are used for mesh creation
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
void reverseAddressing(const label nRows, const GraphType &origGraph)
label byteSize() const
Return the binary size in number of characters of the UList.
prefixOSstream Pout(cout, "Pout")
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T> with a fixed size <Size>.
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
const labelLongList & globalLeafLabel() const
return global labels of octree leaves
void append(const label rowI, const label)
Append an element to the given row.
short procNo() const
return processor number
Map< label > * globalLeafToLocalPtr_
global leaf label to local label addressing for octree leaves
Input inter-processor communications stream.
const FRWGraph< label, 8 > & nodeLeaves() const
return nodeLeaves
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
const meshOctree & octree_
reference to the octree
LongList< label > labelLongList
void calcGlobalFaceLabels() const
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
VRWGraph * leafAtProcsPtr_
leaf at procs
const meshOctreeCubeBasic & returnLeaf(const label) const
Database for solution data, solver performance and other reduced data.
void append(const T &e)
Append an element at the end of the list.