59 decompositionDict_(decompositionDict),
62 decompositionDict.lookup<
label>(
"numberOfSubdomains")
85 constraintTypes_.
last()
101 const word methodType
105 {
"decomposer",
"method"}
109 Info<<
"Selecting decomposer " << methodType <<
endl;
115 decomposerConstructorTablePtr_
118 decomposerConstructorTable::iterator cstrIter =
119 decomposerConstructorTablePtr_->find(methodType);
121 if (cstrIter == decomposerConstructorTablePtr_->end())
124 <<
"Unknown decomposer "
125 << methodType <<
nl <<
nl
126 <<
"Valid decomposers are : " <<
endl
127 << decomposerConstructorTablePtr_->sortedToc()
141 const word methodType
145 {
"distributor",
"method"}
149 Info<<
"Selecting distributor " << methodType <<
endl;
155 distributorConstructorTablePtr_
158 distributorConstructorTable::iterator cstrIter =
159 distributorConstructorTablePtr_->find(methodType);
161 if (cstrIter == distributorConstructorTablePtr_->end())
164 <<
"Unknown distributor "
166 <<
"Valid distributors are : " <<
endl
167 << distributorConstructorTablePtr_->sortedToc()
200 return decompose(mesh,
points, weights);
227 coarseCellCells.
list(),
236 forAll(fineDistribution, i)
238 fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
241 return fineDistribution;
272 return decompose(globalCellCells, cc, cWeights);
280 const label nLocalCoarse,
311 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
318 globalNeighbour[bFacei] = globalAgglom.
toGlobal
320 agglom[faceOwner[facei]]
337 labelList nFacesPerCell(nLocalCoarse, 0);
341 label own = agglom[faceOwner[facei]];
342 label nei = agglom[faceNeighbour[facei]];
344 nFacesPerCell[own]++;
345 nFacesPerCell[nei]++;
352 if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
354 label facei = pp.start();
359 label own = agglom[faceOwner[facei]];
361 label globalNei = globalNeighbour[bFacei];
364 !globalAgglom.
isLocal(globalNei)
365 || globalAgglom.
toLocal(globalNei) != own
368 nFacesPerCell[own]++;
381 cellCells.setSize(nFacesPerCell);
386 const labelList& offsets = cellCells.offsets();
391 label own = agglom[faceOwner[facei]];
392 label nei = agglom[faceNeighbour[facei]];
394 m[offsets[own] + nFacesPerCell[own]++] = globalAgglom.
toGlobal(nei);
395 m[offsets[nei] + nFacesPerCell[nei]++] = globalAgglom.
toGlobal(own);
403 if (pp.coupled() && (parallel || !isA<processorPolyPatch>(pp)))
405 label facei = pp.start();
410 label own = agglom[faceOwner[facei]];
412 label globalNei = globalNeighbour[bFacei];
416 !globalAgglom.
isLocal(globalNei)
417 || globalAgglom.
toLocal(globalNei) != own
420 m[offsets[own] + nFacesPerCell[own]++] = globalNei;
437 if (cellCells.size() == 0)
442 label startIndex = cellCells.offsets()[0];
447 nbrCells.insert(globalAgglom.
toGlobal(celli));
449 label endIndex = cellCells.offsets()[celli+1];
451 for (
label i = startIndex; i < endIndex; i++)
453 if (nbrCells.insert(cellCells.m()[i]))
455 cellCells.m()[newIndex++] = cellCells.m()[i];
458 startIndex = endIndex;
459 cellCells.offsets()[celli+1] = newIndex;
462 cellCells.setSize(cellCells.size(), newIndex);
470 const label nLocalCoarse,
502 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
509 globalNeighbour[bFaceI] = globalAgglom.
toGlobal
511 agglom[faceOwner[faceI]]
528 labelList nFacesPerCell(nLocalCoarse, 0);
532 label own = agglom[faceOwner[faceI]];
533 label nei = agglom[faceNeighbour[faceI]];
535 nFacesPerCell[own]++;
536 nFacesPerCell[nei]++;
543 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
550 label own = agglom[faceOwner[faceI]];
552 label globalNei = globalNeighbour[bFaceI];
555 !globalAgglom.
isLocal(globalNei)
556 || globalAgglom.
toLocal(globalNei) != own
559 nFacesPerCell[own]++;
572 cellCells.
setSize(nFacesPerCell);
573 cellCellWeights.
setSize(nFacesPerCell);
584 label own = agglom[faceOwner[faceI]];
585 label nei = agglom[faceNeighbour[faceI]];
587 label ownIndex = offsets[own] + nFacesPerCell[own]++;
588 label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
590 m[ownIndex] = globalAgglom.
toGlobal(nei);
592 m[neiIndex] = globalAgglom.
toGlobal(own);
601 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
608 label own = agglom[faceOwner[faceI]];
610 label globalNei = globalNeighbour[bFaceI];
614 !globalAgglom.
isLocal(globalNei)
615 || globalAgglom.
toLocal(globalNei) != own
618 label ownIndex = offsets[own] + nFacesPerCell[own]++;
619 m[ownIndex] = globalNei;
637 if (cellCells.
size() == 0)
651 for (
label i = startIndex; i < endIndex; i++)
653 if (nbrCells.
insert(cellCells.
m()[i]))
655 cellCells.
m()[newIndex] = cellCells.
m()[i];
656 cellCellWeights.
m()[newIndex] = cellCellWeights.
m()[i];
660 startIndex = endIndex;
661 cellCells.
offsets()[cellI+1] = newIndex;
662 cellCellWeights.
offsets()[cellI+1] = newIndex;
666 cellCellWeights.
setSize(cellCells.
size(), newIndex);
693 forAll(specifiedProcessorFaces, setI)
695 nProcSets += specifiedProcessorFaces[setI].
size();
702 explicitConnections.
size(),
707 label nUnblocked = 0;
708 forAll(blockedFace, facei)
710 if (!blockedFace[facei])
723 if (nProcSets+nConnections+nUnblocked == 0)
729 finalDecomp = decompose
745 Info<<
"Constrained decomposition:" <<
endl
746 <<
" faces with same owner and neighbour processor : "
747 << nUnblocked <<
endl
748 <<
" baffle faces with same owner processor : "
749 << nConnections <<
endl
750 <<
" faces all on same processor : "
755 regionSplit localRegion(mesh, blockedFace, explicitConnections,
false);
760 Info<<
"Constrained decomposition:" <<
endl
776 forAll(localRegion, celli)
778 label regionI = localRegion[celli];
782 regionCentres[regionI] = mesh.
cellCentres()[celli];
793 forAll(localRegion, celli)
795 label regionI = localRegion[celli];
797 regionWeights[regionI] += cellWeights[celli];
802 forAll(localRegion, celli)
804 label regionI = localRegion[celli];
806 regionWeights[regionI] += 1.0;
810 finalDecomp = decompose
822 forAll(explicitConnections, i)
824 const labelPair& baffle = explicitConnections[i];
828 if (!blockedFace[f0] && !blockedFace[f1])
836 finalDecomp[mesh.
faceOwner()[f1]] = proci;
842 else if (blockedFace[f0] != blockedFace[f1])
845 <<
"On explicit connection between faces " << f0
847 <<
" the two blockedFace status are not equal : "
848 << blockedFace[f0] <<
" and " << blockedFace[f1]
868 label nUnblocked = 0;
869 forAll(blockedFace, facei)
871 if (blockedFace[facei])
873 faceData[facei] =
minData(-123);
886 forAll(blockedFace, facei)
888 if (!blockedFace[facei])
891 seedFaces[nUnblocked] = facei;
892 seedData[nUnblocked] =
minData(finalDecomp[own]);
910 forAll(finalDecomp, celli)
912 if (cellData[celli].
valid(deltaCalc.
data()))
914 finalDecomp[celli] = cellData[celli].
data();
933 forAll(specifiedProcessorFaces, setI)
935 const labelList& set = specifiedProcessorFaces[setI];
937 label proci = specifiedProcessor[setI];
942 proci = finalDecomp[mesh.
faceOwner()[set[0]]];
955 finalDecomp[mesh.
faceOwner()[facei]] = proci;
983 if (!blockedFace[facei])
985 label ownProc = finalDecomp[own];
986 label nbrProc = nbrDecomp[bFacei];
987 if (ownProc != nbrProc)
990 <<
"patch:" << pp.
name()
993 <<
" ownProc:" << ownProc
994 <<
" nbrProc:" << nbrProc
1020 specifiedProcessorFaces.
clear();
1021 explicitConnections.
clear();
1023 forAll(constraints_, constraintI)
1025 constraints_[constraintI].add
1029 specifiedProcessorFaces,
1047 forAll(constraints_, constraintI)
1049 constraints_[constraintI].apply
1053 specifiedProcessorFaces,
1055 explicitConnections,
1078 specifiedProcessorFaces,
1092 specifiedProcessorFaces,
1104 specifiedProcessorFaces,
1106 explicitConnections,
#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.
void setSize(const label mRows)
Reset size of CompactListList.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
const TrackingData & data() const
Additional data to be passed into container.
bool insert(const Key &key)
Insert a new entry.
void clear()
Clear all entries from table.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
const Type & second() const
Return second.
const Type & first() const
Return first.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
static const word & system()
Return system name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
List< Container > list() const
Convert to List<Container>
const UList< label > & offsets() const
Return the offset table (= size()+1)
const UList< T > & m() const
Return the packed matrix of data.
label size() const
Return the primary size, i.e. the number of rows.
T * data()
Return a pointer to the first data element,.
T & last()
Return the last element of the list.
static label worldComm
Default communicator (all processors)
static bool & parRun()
Is this a parallel run?
static int & msgType()
Message tag of standard messages.
label size() const
Return the number of elements in the UPtrList.
static autoPtr< decompositionConstraint > New(const dictionary &constraintsDict, const word &type)
Return a reference to the selected decompositionConstraint.
Abstract base class for decomposition.
decompositionMethod(const dictionary &decompositionDict)
Construct given the decomposition dictionary.
PtrList< decompositionConstraint > constraints_
Optional constraints.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections)
Helper: extract constraints:
dictionary decompositionDict_
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.
static autoPtr< decompositionMethod > NewDistributor(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
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.
static autoPtr< decompositionMethod > NewDecomposer(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
static dictionary decomposeParDict(const Time &time)
Read and return the decomposeParDict.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
A face is a list of labels corresponding to mesh vertices.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label toGlobal(const label i) const
From local to global.
label toLocal(const label i) const
From global to local on current processor.
bool isLocal(const label i) const
Is on local processor.
label nTotalCells() const
Return total number of cells in decomposed mesh.
For use with FaceCellWave. Transports minimum passive data.
const word & name() const
Return name.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const globalMeshData & globalData() const
Return parallel info.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
A patch is a list of labels that address the faces in the global face list.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label start() const
Return start label of this patch in the polyMesh face list.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
label nInternalFaces() const
const scalarField & magFaceAreas() const
const labelListList & pointFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
label nLocalRegions() const
Return local number of regions.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
bool valid(const PtrList< ModelType > &l)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dlLibraryTable libs
Table of loaded dynamic libraries.
List< label > labelList
A List of labels.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
UList< label > labelUList
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]