36 namespace decompositionMethods
59 void Foam::decompositionMethods::multiLevel::subsetGlobalCellCells
74 globalIndex globalCells(cellCells.size());
77 subCellCells = UIndirectList<labelList>(cellCells, set);
80 List<Map<label>> compactMap;
81 distributionMap map(globalCells, subCellCells, compactMap);
82 map.distribute(oldToNew);
84 map.distribute(allDist);
93 globalIndex globalSubCells(set.size());
101 forAll(subCellCells, subCelli)
103 labelList& cCells = subCellCells[subCelli];
110 label nbrCelli = oldToNew[cCells[i]];
113 cutConnections[allDist[cCells[i]]]++;
120 label celli = set[subCelli];
121 label oldNbrCelli = cellCells[celli][i];
123 label proci = globalCells.whichProcID(oldNbrCelli);
125 cCells[newI++] = globalSubCells.toGlobal(proci, nbrCelli);
128 cCells.setSize(newI);
145 methods_[levelI].decompose
155 label orig = pointMap[i];
156 decomp[orig] += dist[i];
159 if (levelI != methods_.size()-1)
164 label n = methods_[levelI].nDomains();
168 decomp *= 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();
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]++;
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
345 methodsDict_(decompositionDict_.optionalSubDict(typeName +
"Coeffs"))
347 methods_.setSize(methodsDict_.size());
355 Info<<
"decompositionMethod " <<
type() <<
" :" <<
endl;
358 Info<<
" level " << i <<
" decomposing with " << methods_[i].type()
359 <<
" into " << methods_[i].nDomains() <<
" subdomains." <<
endl;
361 n *= methods_[i].nDomains();
367 <<
"Top level decomposition specifies " <<
nDomains()
368 <<
" domains which is not equal to the product of"
369 <<
" all sub domains " <<
n
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
void size(const label)
Override size to be inconsistent with allocated storage.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
List< Container > list() const
Convert to List<Container>
friend class const_iterator
static bool master(const label communicator=0)
Am I the master process.
Abstract base class for decomposition.
static autoPtr< decompositionMethod > NewDecomposer(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
Decomposition given using consecutive application of decomposers.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Inherit decompose from decompositionMethod.
multiLevel(const dictionary &decompositionDict)
Construct given the decomposition dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Mesh consisting of general polyhedral cells.
const string & prefix() const
Return the prefix of the stream.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
defineTypeNameAndDebug(metis, 0)
addToRunTimeSelectionTable(decompositionMethod, metis, decomposer)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
vectorField pointField
pointField is a vectorField.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Field< label > labelField
Specialisation of Field<T> for label.
prefixOSstream Pout(cout, "Pout")
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.