53void Foam::decompositionConstraints::singleProcessorFaceSets::printInfo()
const
55 for (
const auto& nameAndProc : setNameAndProcs_)
57 Info<<
" all cells connected to faceSet "
58 << nameAndProc.first()
59 <<
" on processor " << nameAndProc.second() <<
endl;
75 coeffDict_.lookupCompat(
"sets", {{
"singleProcessorFaceSets", 1806}})
78 if (decompositionConstraint::debug)
81 <<
" : adding constraints to keep" <<
endl;
95 setNameAndProcs_(setNameAndProcs)
97 if (decompositionConstraint::debug)
100 <<
" : adding constraints to keep" <<
endl;
116 if (decompositionConstraint::debug)
119 <<
" : adding constraints to keep" <<
endl;
141 forAll(specifiedProcessorFaces, setI)
146 if (faceToSet[facei] == -1)
148 faceToSet[facei] = setI;
150 else if (faceToSet[facei] != setI)
153 <<
" at " <<
mesh.faceCentres()[facei]
154 <<
" is already in existing constraint "
161 forAll(setNameAndProcs_, setI)
167 const label destProcI = setNameAndProcs_[setI].second();
170 const faceSet fz(
mesh, setNameAndProcs_[setI].first());
174 for (
const label facei : fz)
176 const label seti = faceToSet[facei];
190 if (nMatch[setI] == fz.size())
196 else if (nMatch[setI] > 0)
207 specifiedProcessor.
append(destProcI);
215 forAll(specifiedProcessorFaces, setI)
220 const face&
f =
mesh.faces()[facei];
222 for (
const label pointi :
f)
224 procFacePoint[pointi] =
true;
232 label nUnblocked = 0;
234 forAll(procFacePoint, pointi)
236 if (procFacePoint[pointi])
241 if (blockedFace[
pFaces[i]])
243 blockedFace[
pFaces[i]] =
false;
250 if (decompositionConstraint::debug & 2)
285 forAll(specifiedProcessorFaces, setI)
287 const labelList& set = specifiedProcessorFaces[setI];
290 label procI = specifiedProcessor[setI];
297 procI = decomposition[
mesh.faceOwner()[set[0]]];
299 reduce(procI, maxOp<label>());
306 const face&
f =
mesh.faces()[
set[fI]];
309 procFacePoint[
f[fp]] =
true;
315 forAll(procFacePoint, pointi)
317 if (procFacePoint[pointi])
320 for (
const label faceI :
pFaces)
322 const label own =
mesh.faceOwner()[faceI];
324 if (decomposition[own] != procI)
326 decomposition[own] = procI;
330 if (
mesh.isInternalFace(faceI))
332 const label nei =
mesh.faceNeighbour()[faceI];
333 if (decomposition[nei] != procI)
335 decomposition[nei] = procI;
344 if (decompositionConstraint::debug & 2)
346 Info<<
type() <<
" : changed decomposition on "
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
labelList faceLabels(nFaceLabels)
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
label size() const noexcept
The number of elements in table.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &val)
Append an element at the end of the list.
void resize(const label len)
Adjust allocated size of list.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
label size() const noexcept
The number of entries in the list.
Abstract class for handling decomposition constraints.
dictionary coeffDict_
Constraint coefficients dictionary.
decompositionConstraint(const decompositionConstraint &)=delete
No copy construct.
Constraint to keep all cells connected to face or point of faceSet on a single processor.
virtual void apply(const polyMesh &mesh, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections, labelList &decomposition) const
Add this constraint post-decomposition.
virtual void add(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
Add this constraint to list of constraints.
singleProcessorFaceSets(const dictionary &dict)
Construct with constraint dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A face is a list of labels corresponding to mesh vertices.
Mesh consisting of general polyhedral cells.
#define defineTypeName(Type)
Define the typeName.
#define WarningInFunction
Report a warning using Foam::Warning.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::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].reset(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];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } 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};constexpr 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< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.