58 void Foam::multiLevelDecomp::subsetGlobalCellCells
73 globalIndex globalCells(cellCells.size());
76 subCellCells = UIndirectList<labelList>(cellCells,
set);
79 List<Map<label>> compactMap;
80 distributionMap map(globalCells, subCellCells, compactMap);
81 map.distribute(oldToNew);
83 map.distribute(allDist);
92 globalIndex globalSubCells(
set.size());
97 cutConnections.setSize(nDomains);
100 forAll(subCellCells, subCelli)
102 labelList& cCells = subCellCells[subCelli];
109 label nbrCelli = oldToNew[cCells[i]];
112 cutConnections[allDist[cCells[i]]]++;
119 label celli =
set[subCelli];
120 label oldNbrCelli = cellCells[celli][i];
122 label proci = globalCells.whichProcID(oldNbrCelli);
124 cCells[newI++] = globalSubCells.toGlobal(proci, nbrCelli);
127 cCells.setSize(newI);
132 void Foam::multiLevelDecomp::decompose
145 methods_[levelI].decompose
155 label orig = pointMap[i];
156 finalDecomp[orig] += dist[i];
159 if (levelI != methods_.size()-1)
164 label n = methods_[levelI].nDomains();
168 finalDecomp *= methods_[levelI+1].nDomains();
173 Pout<<
"Decomposition at level " << levelI <<
" :" <<
endl;
176 for (
label domainI = 0; domainI <
n; domainI++)
183 scalarField subWeights(pointWeights, domainPoints);
184 labelList subPointMap(UIndirectList<label>(pointMap, domainPoints));
188 subsetGlobalCellCells
206 forAll(nOutsideConnections, i)
208 if (nOutsideConnections[i] > 0)
211 nFaces += nOutsideConnections[i];
218 Pout<<
" Domain " << domainI <<
nl 219 <<
" Number of cells = " << nPoints <<
nl 220 <<
" Number of inter-domain patches = " << nPatches
222 <<
" Number of inter-domain faces = " << nFaces <<
nl 248 label nNext = methods_[levelI+1].nDomains();
249 label nTotal = n*nNext;
253 decompositionDict_.optionalSubDict(typeName +
"Coeffs").begin();
254 dictionary myDict = iter().dict();
255 myDict.set(
"numberOfSubdomains", nTotal);
259 Pout<<
"Reference decomposition with " << myDict <<
" :" 263 autoPtr<decompositionMethod> method0 =
279 for (
label blockI = 0; blockI <
n; blockI++)
285 forAll(pointPoints, pointi)
287 if ((dist[pointi] / nNext) == blockI)
291 const labelList& pPoints = pointPoints[pointi];
295 label distBlockI = dist[pPoints[i]] / nNext;
296 if (distBlockI != blockI)
298 nOutsideConnections[distBlockI]++;
304 reduce(nPoints, plusOp<label>());
313 forAll(nOutsideConnections, i)
315 if (nOutsideConnections[i] > 0)
318 nFaces += nOutsideConnections[i];
324 Pout<<
" Domain " << blockI <<
nl 325 <<
" Number of cells = " << nPoints <<
nl 326 <<
" Number of inter-domain patches = " 328 <<
" Number of inter-domain faces = " << nFaces
342 methodsDict_(decompositionDict_.optionalSubDict(typeName +
"Coeffs"))
344 methods_.setSize(methodsDict_.size());
352 Info<<
"decompositionMethod " <<
type() <<
" :" <<
endl;
355 Info<<
" level " << i <<
" decomposing with " << methods_[i].type()
356 <<
" into " << methods_[i].nDomains() <<
" subdomains." <<
endl;
358 n *= methods_[i].nDomains();
364 <<
"Top level decomposition specifies " <<
nDomains()
365 <<
" domains which is not equal to the product of" 366 <<
" all sub domains " << n
398 return move(finalDecomp);
423 return move(finalDecomp);
List< labelList > labelListList
A List of labelList.
Field< label > labelField
Specialisation of Field<T> for label.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
multiLevelDecomp(const dictionary &decompositionDict)
Construct given the decomposition dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Macros for easy insertion into run-time selection tables.
static void calcCellCells(const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool global, CompactListList< label > &cellCells)
Helper: determine (local or global) cellCells from mesh.
const string & prefix() const
Return the prefix of the stream.
vectorField pointField
pointField is a vectorField.
List< Container > list() const
Convert to List<Container>
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static autoPtr< decompositionMethod > NewDecomposer(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
List< label > labelList
A List of labels.
Abstract base class for decomposition.
A packed storage unstructured matrix of objects of type <T> using an offset table for access...
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
prefixOSstream Pout(cout, "Pout")
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
friend class const_iterator