59 decompositionDict_(decompositionDict),
62 decompositionDict.
lookup<
label>(
"numberOfSubdomains")
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 const word methodType(decompositionDict.
lookup(
"method"));
184 Pout<<
"Selecting decompositionMethod " << methodType <<
endl;
186 dictionaryConstructorTable::iterator cstrIter =
187 dictionaryConstructorTablePtr_->find(methodType);
189 if (cstrIter == dictionaryConstructorTablePtr_->end())
192 <<
"Unknown decompositionMethod " 193 << methodType <<
nl <<
nl 194 <<
"Valid decompositionMethods are : " << endl
195 << dictionaryConstructorTablePtr_->sortedToc()
211 return decompose(mesh, points, weights);
247 forAll(fineDistribution, i)
249 fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
252 return fineDistribution;
283 return decompose(globalCellCells, cc, cWeights);
291 const label nLocalCoarse,
322 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
329 globalNeighbour[bFacei] = globalAgglom.
toGlobal 331 agglom[faceOwner[facei]]
348 labelList nFacesPerCell(nLocalCoarse, 0);
352 label own = agglom[faceOwner[facei]];
353 label nei = agglom[faceNeighbour[facei]];
355 nFacesPerCell[own]++;
356 nFacesPerCell[nei]++;
363 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
370 label own = agglom[faceOwner[facei]];
372 label globalNei = globalNeighbour[bFacei];
375 !globalAgglom.
isLocal(globalNei)
376 || globalAgglom.
toLocal(globalNei) != own
379 nFacesPerCell[own]++;
392 cellCells.
setSize(nFacesPerCell);
402 label own = agglom[faceOwner[facei]];
403 label nei = agglom[faceNeighbour[facei]];
405 m[offsets[own] + nFacesPerCell[own]++] = globalAgglom.
toGlobal(nei);
406 m[offsets[nei] + nFacesPerCell[nei]++] = globalAgglom.
toGlobal(own);
414 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
421 label own = agglom[faceOwner[facei]];
423 label globalNei = globalNeighbour[bFacei];
427 !globalAgglom.
isLocal(globalNei)
428 || globalAgglom.
toLocal(globalNei) != own
431 m[offsets[own] + nFacesPerCell[own]++] = globalNei;
448 if (cellCells.
size() == 0)
462 for (
label i = startIndex; i < endIndex; i++)
464 if (nbrCells.
insert(cellCells.
m()[i]))
466 cellCells.
m()[newIndex++] = cellCells.
m()[i];
469 startIndex = endIndex;
470 cellCells.
offsets()[celli+1] = newIndex;
481 const label nLocalCoarse,
513 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
520 globalNeighbour[bFaceI] = globalAgglom.
toGlobal 522 agglom[faceOwner[faceI]]
539 labelList nFacesPerCell(nLocalCoarse, 0);
543 label own = agglom[faceOwner[faceI]];
544 label nei = agglom[faceNeighbour[faceI]];
546 nFacesPerCell[own]++;
547 nFacesPerCell[nei]++;
554 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
561 label own = agglom[faceOwner[faceI]];
563 label globalNei = globalNeighbour[bFaceI];
566 !globalAgglom.
isLocal(globalNei)
567 || globalAgglom.
toLocal(globalNei) != own
570 nFacesPerCell[own]++;
583 cellCells.
setSize(nFacesPerCell);
584 cellCellWeights.
setSize(nFacesPerCell);
595 label own = agglom[faceOwner[faceI]];
596 label nei = agglom[faceNeighbour[faceI]];
598 label ownIndex = offsets[own] + nFacesPerCell[own]++;
599 label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
601 m[ownIndex] = globalAgglom.
toGlobal(nei);
603 m[neiIndex] = globalAgglom.
toGlobal(own);
612 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
619 label own = agglom[faceOwner[faceI]];
621 label globalNei = globalNeighbour[bFaceI];
625 !globalAgglom.
isLocal(globalNei)
626 || globalAgglom.
toLocal(globalNei) != own
629 label ownIndex = offsets[own] + nFacesPerCell[own]++;
630 m[ownIndex] = globalNei;
648 if (cellCells.
size() == 0)
662 for (
label i = startIndex; i < endIndex; i++)
664 if (nbrCells.
insert(cellCells.
m()[i]))
666 cellCells.
m()[newIndex] = cellCells.
m()[i];
667 cellCellWeights.
m()[newIndex] = cellCellWeights.
m()[i];
671 startIndex = endIndex;
672 cellCells.
offsets()[cellI+1] = newIndex;
673 cellCellWeights.
offsets()[cellI+1] = newIndex;
677 cellCellWeights.
m().
setSize(newIndex);
702 if (nWeights > 0 && cellWeights.
size() != mesh.
nCells())
705 <<
"Number of weights " << cellWeights.
size()
706 <<
" differs from number of cells " << mesh.
nCells()
713 forAll(specifiedProcessorFaces, setI)
715 nProcSets += specifiedProcessorFaces[setI].
size();
722 explicitConnections.
size(),
727 label nUnblocked = 0;
728 forAll(blockedFace, facei)
730 if (!blockedFace[facei])
744 if (nProcSets+nConnections+nUnblocked == 0)
750 finalDecomp = decompose
766 Info<<
"Constrained decomposition:" <<
endl 767 <<
" faces with same owner and neighbour processor : " 768 << nUnblocked <<
endl 769 <<
" baffle faces with same owner processor : " 770 << nConnections <<
endl 771 <<
" faces all on same processor : " 776 regionSplit localRegion(mesh, blockedFace, explicitConnections,
false);
781 Info<<
"Constrained decomposition:" <<
endl 797 forAll(localRegion, celli)
799 label regionI = localRegion[celli];
803 regionCentres[regionI] = mesh.
cellCentres()[celli];
814 forAll(localRegion, celli)
816 label regionI = localRegion[celli];
818 regionWeights[regionI] += cellWeights[celli];
823 forAll(localRegion, celli)
825 label regionI = localRegion[celli];
827 regionWeights[regionI] += 1.0;
831 finalDecomp = decompose
843 forAll(explicitConnections, i)
845 const labelPair& baffle = explicitConnections[i];
849 if (!blockedFace[f0] && !blockedFace[f1])
863 else if (blockedFace[f0] != blockedFace[f1])
866 <<
"On explicit connection between faces " << f0
868 <<
" the two blockedFace status are not equal : " 869 << blockedFace[f0] <<
" and " << blockedFace[
f1]
889 label nUnblocked = 0;
890 forAll(blockedFace, facei)
892 if (blockedFace[facei])
894 faceData[facei] =
minData(-123);
907 forAll(blockedFace, facei)
909 if (!blockedFace[facei])
912 seedFaces[nUnblocked] = facei;
913 seedData[nUnblocked] =
minData(finalDecomp[own]);
931 forAll(finalDecomp, celli)
933 if (cellData[celli].valid(deltaCalc.data()))
935 finalDecomp[celli] = cellData[celli].
data();
954 forAll(specifiedProcessorFaces, setI)
956 const labelList&
set = specifiedProcessorFaces[setI];
958 label proci = specifiedProcessor[setI];
963 proci = finalDecomp[mesh.
faceOwner()[
set[0]]];
974 label facei = pFaces[i];
976 finalDecomp[mesh.
faceOwner()[facei]] = proci;
1004 if (!blockedFace[facei])
1006 label ownProc = finalDecomp[own];
1007 label nbrProc = nbrDecomp[bFacei];
1008 if (ownProc != nbrProc)
1011 <<
"patch:" << pp.
name()
1012 <<
" face:" << facei
1014 <<
" ownProc:" << ownProc
1015 <<
" nbrProc:" << nbrProc
1041 specifiedProcessorFaces.
clear();
1042 explicitConnections.
clear();
1044 forAll(constraints_, constraintI)
1046 constraints_[constraintI].add
1050 specifiedProcessorFaces,
1068 forAll(constraints_, constraintI)
1070 constraints_[constraintI].apply
1074 specifiedProcessorFaces,
1076 explicitConnections,
1099 specifiedProcessorFaces,
1113 specifiedProcessorFaces,
1125 specifiedProcessorFaces,
1127 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.
const scalarField & magFaceAreas() const
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)
decompositionMethod(const dictionary &decompositionDict)
Construct given the decomposition dictionary.
static autoPtr< decompositionMethod > New(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
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, &mergedCyclicPolyPatch::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]
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")
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
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.
const Type & first() const
Return first.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.