59 decompositionDict_(decompositionDict),
67 if (decompositionDict_.found(
"constraints"))
91 constraintTypes_.
last()
100 decompositionDict_.found(
"preserveBaffles")
104 decompositionConstraints::preserveBafflesConstraint::typeName
116 decompositionDict_.found(
"preservePatches")
120 decompositionConstraints::preservePatchesConstraint::typeName
124 const wordReList pNames(decompositionDict_.lookup(
"preservePatches"));
134 decompositionDict_.found(
"preserveFaceZones")
138 decompositionConstraints::preserveFaceZonesConstraint::typeName
142 const wordReList zNames(decompositionDict_.lookup(
"preserveFaceZones"));
152 decompositionDict_.found(
"singleProcessorFaceSets")
156 decompositionConstraints::preserveFaceZonesConstraint::typeName
162 decompositionDict_.lookup(
"singleProcessorFaceSets")
182 Pout <<
" Foam::decompositionMethod::New " << decompositionDict <<
endl;
184 const word methodType(decompositionDict.
lookup(
"method"));
186 Pout<<
"Selecting decompositionMethod " << methodType <<
endl;
188 dictionaryConstructorTable::iterator cstrIter =
189 dictionaryConstructorTablePtr_->find(methodType);
191 if (cstrIter == dictionaryConstructorTablePtr_->end())
194 <<
"Unknown decompositionMethod " 195 << methodType <<
nl <<
nl 196 <<
"Valid decompositionMethods are : " << endl
197 << dictionaryConstructorTablePtr_->sortedToc()
213 return decompose(mesh, points, weights);
249 forAll(fineDistribution, i)
251 fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
254 return fineDistribution;
285 return decompose(globalCellCells, cc, cWeights);
293 const label nLocalCoarse,
324 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
331 globalNeighbour[bFacei] = globalAgglom.
toGlobal 333 agglom[faceOwner[facei]]
350 labelList nFacesPerCell(nLocalCoarse, 0);
354 label own = agglom[faceOwner[facei]];
355 label nei = agglom[faceNeighbour[facei]];
357 nFacesPerCell[own]++;
358 nFacesPerCell[nei]++;
365 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
372 label own = agglom[faceOwner[facei]];
374 label globalNei = globalNeighbour[bFacei];
377 !globalAgglom.
isLocal(globalNei)
378 || globalAgglom.
toLocal(globalNei) != own
381 nFacesPerCell[own]++;
394 cellCells.
setSize(nFacesPerCell);
404 label own = agglom[faceOwner[facei]];
405 label nei = agglom[faceNeighbour[facei]];
407 m[offsets[own] + nFacesPerCell[own]++] = globalAgglom.
toGlobal(nei);
408 m[offsets[nei] + nFacesPerCell[nei]++] = globalAgglom.
toGlobal(own);
416 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
423 label own = agglom[faceOwner[facei]];
425 label globalNei = globalNeighbour[bFacei];
429 !globalAgglom.
isLocal(globalNei)
430 || globalAgglom.
toLocal(globalNei) != own
433 m[offsets[own] + nFacesPerCell[own]++] = globalNei;
450 if (cellCells.
size() == 0)
464 for (
label i = startIndex; i < endIndex; i++)
466 if (nbrCells.
insert(cellCells.
m()[i]))
468 cellCells.
m()[newIndex++] = cellCells.
m()[i];
471 startIndex = endIndex;
472 cellCells.
offsets()[celli+1] = newIndex;
498 const label nLocalCoarse,
530 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
537 globalNeighbour[bFaceI] = globalAgglom.
toGlobal 539 agglom[faceOwner[faceI]]
556 labelList nFacesPerCell(nLocalCoarse, 0);
560 label own = agglom[faceOwner[faceI]];
561 label nei = agglom[faceNeighbour[faceI]];
563 nFacesPerCell[own]++;
564 nFacesPerCell[nei]++;
571 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
578 label own = agglom[faceOwner[faceI]];
580 label globalNei = globalNeighbour[bFaceI];
583 !globalAgglom.
isLocal(globalNei)
584 || globalAgglom.
toLocal(globalNei) != own
587 nFacesPerCell[own]++;
600 cellCells.
setSize(nFacesPerCell);
601 cellCellWeights.
setSize(nFacesPerCell);
612 label own = agglom[faceOwner[faceI]];
613 label nei = agglom[faceNeighbour[faceI]];
615 label ownIndex = offsets[own] + nFacesPerCell[own]++;
616 label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
618 m[ownIndex] = globalAgglom.
toGlobal(nei);
620 m[neiIndex] = globalAgglom.
toGlobal(own);
629 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
636 label own = agglom[faceOwner[faceI]];
638 label globalNei = globalNeighbour[bFaceI];
642 !globalAgglom.
isLocal(globalNei)
643 || globalAgglom.
toLocal(globalNei) != own
646 label ownIndex = offsets[own] + nFacesPerCell[own]++;
647 m[ownIndex] = globalNei;
665 if (cellCells.
size() == 0)
679 for (
label i = startIndex; i < endIndex; i++)
681 if (nbrCells.
insert(cellCells.
m()[i]))
683 cellCells.
m()[newIndex] = cellCells.
m()[i];
684 cellCellWeights.
m()[newIndex] = cellCellWeights.
m()[i];
688 startIndex = endIndex;
689 cellCells.
offsets()[cellI+1] = newIndex;
690 cellCellWeights.
offsets()[cellI+1] = newIndex;
694 cellCellWeights.
m().
setSize(newIndex);
1094 if (nWeights > 0 && cellWeights.
size() != mesh.
nCells())
1097 <<
"Number of weights " << cellWeights.
size()
1098 <<
" differs from number of cells " << mesh.
nCells()
1104 label nProcSets = 0;
1105 forAll(specifiedProcessorFaces, setI)
1107 nProcSets += specifiedProcessorFaces[setI].
size();
1114 explicitConnections.
size(),
1119 label nUnblocked = 0;
1120 forAll(blockedFace, facei)
1122 if (!blockedFace[facei])
1136 if (nProcSets+nConnections+nUnblocked == 0)
1142 finalDecomp = decompose
1151 finalDecomp = decompose(mesh, mesh.
cellCentres());
1158 Info<<
"Constrained decomposition:" <<
endl 1159 <<
" faces with same owner and neighbour processor : " 1160 << nUnblocked <<
endl 1161 <<
" baffle faces with same owner processor : " 1162 << nConnections <<
endl 1163 <<
" faces all on same processor : " 1168 regionSplit localRegion(mesh, blockedFace, explicitConnections,
false);
1173 Info<<
"Constrained decomposition:" <<
endl 1189 forAll(localRegion, celli)
1191 label regionI = localRegion[celli];
1195 regionCentres[regionI] = mesh.
cellCentres()[celli];
1206 forAll(localRegion, celli)
1208 label regionI = localRegion[celli];
1210 regionWeights[regionI] += cellWeights[celli];
1215 forAll(localRegion, celli)
1217 label regionI = localRegion[celli];
1219 regionWeights[regionI] += 1.0;
1223 finalDecomp = decompose
1235 forAll(explicitConnections, i)
1237 const labelPair& baffle = explicitConnections[i];
1241 if (!blockedFace[f0] && !blockedFace[f1])
1255 else if (blockedFace[f0] != blockedFace[f1])
1258 <<
"On explicit connection between faces " << f0
1260 <<
" the two blockedFace status are not equal : " 1261 << blockedFace[f0] <<
" and " << blockedFace[
f1]
1281 label nUnblocked = 0;
1282 forAll(blockedFace, facei)
1284 if (blockedFace[facei])
1286 faceData[facei] =
minData(-123);
1299 forAll(blockedFace, facei)
1301 if (!blockedFace[facei])
1304 seedFaces[nUnblocked] = facei;
1305 seedData[nUnblocked] =
minData(finalDecomp[own]);
1323 forAll(finalDecomp, celli)
1325 if (cellData[celli].valid(deltaCalc.data()))
1327 finalDecomp[celli] = cellData[celli].
data();
1346 forAll(specifiedProcessorFaces, setI)
1348 const labelList&
set = specifiedProcessorFaces[setI];
1350 label proci = specifiedProcessor[setI];
1355 proci = finalDecomp[mesh.
faceOwner()[
set[0]]];
1366 label facei = pFaces[i];
1368 finalDecomp[mesh.
faceOwner()[facei]] = proci;
1396 if (!blockedFace[facei])
1398 label ownProc = finalDecomp[own];
1399 label nbrProc = nbrDecomp[bFacei];
1400 if (ownProc != nbrProc)
1403 <<
"patch:" << pp.
name()
1404 <<
" face:" << facei
1406 <<
" ownProc:" << ownProc
1407 <<
" nbrProc:" << nbrProc
1433 specifiedProcessorFaces.
clear();
1434 explicitConnections.
clear();
1436 forAll(constraints_, constraintI)
1438 constraints_[constraintI].add
1442 specifiedProcessorFaces,
1460 forAll(constraints_, constraintI)
1462 constraints_[constraintI].apply
1466 specifiedProcessorFaces,
1468 explicitConnections,
1491 specifiedProcessorFaces,
1505 specifiedProcessorFaces,
1517 specifiedProcessorFaces,
1519 explicitConnections,
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool isLocal(const label i) const
Is on local processor.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
#define forAll(list, i)
Loop across all elements in list.
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 word & name() const
Return name.
label nLocalRegions() const
Return local number of regions.
static const Vector< scalar > max
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
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.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
void size(const label)
Override size to be inconsistent with allocated storage.
const List< T > & m() const
Return the packed matrix of data.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
label nTotalCells() const
Return total number of cells in decomposed mesh.
static int & msgType()
Message tag of standard messages.
Constraint to keep/move owner and neighbour of faceZone onto same processor.
static label worldComm
Default communicator (all processors)
bool insert(const Key &key)
Insert a new entry.
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 dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Detects baffles and keeps owner and neighbour on same processor.
An ordered pair of two objects of type <T> with first() and second() elements.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
void clear()
Clear all entries from table.
void append(const T &)
Append an element at the end of the list.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections)
Helper: extract constraints:
virtual const labelList & faceOwner() const
Return face owner.
label size() const
Return the primary size, i.e. the number of rows.
const globalMeshData & globalData() const
Return parallel info.
label toLocal(const label i) const
From global to local on current processor.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label readLabel(Istream &is)
decompositionMethod(const dictionary &decompositionDict)
Construct given the decomposition dictionary.
static autoPtr< decompositionMethod > New(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
A packed storage unstructured matrix of objects of type <T> using an offset table for access...
void setSize(const label mRows)
Reset size of CompactListList.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
static autoPtr< decompositionConstraint > New(const dictionary &constraintsDict, const word &type)
Return a reference to the selected decompositionConstraint.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const Type & second() const
Return second.
Constraint to keep owner and neighbour of (cyclic) patch on same processor.
label size() const
Return the number of elements in the UPtrList.
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
label toGlobal(const label i) const
From local to global.
T * data()
Return a pointer to the first data element,.
static bool & parRun()
Is this a parallel run?
void applyConstraints(const polyMesh &mesh, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections, labelList &finalDecomp)
Helper: apply constraints to a decomposition. This gives.
const List< label > & offsets() const
Return the offset table (= size()+1)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
prefixOSstream Pout(cout, "Pout")
const vectorField & faceAreas() const
label start() const
Return start label of this patch in the polyMesh face list.
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
const labelListList & pointFaces() const
dimensioned< scalar > mag(const dimensioned< Type > &)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Constraint to keep all cells connected to face or point of faceSet on a single processor.
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
T & last()
Return the last element of the list.
For use with FaceCellWave. Transports minimum passive data.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< small) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
const Type & first() const
Return first.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.