35void Foam::singleCellFvMesh::agglomerateMesh
38 const labelListList& agglom
53 const polyPatch& pp = oldPatches[patchi];
56 nAgglom[patchi] =
max(agglom[patchi])+1;
60 if (agglom[patchi][i] < 0 || agglom[patchi][i] >= pp.size())
63 <<
"agglomeration on patch " << patchi
64 <<
" is out of range 0.." << pp.size()-1
77 const polyPatch& pp = oldPatches[patchi];
84 nbrAgglom[offset+i] = agglom[patchi][i];
92 Map<label> localToNbr(nbrAgglom.size()/10);
96 const polyPatch& pp = oldPatches[patchi];
104 label bFacei = offset+i;
105 label myZone = agglom[patchi][i];
106 label nbrZone = nbrAgglom[bFacei];
108 const auto iter = localToNbr.cfind(myZone);
113 if (iter.val() != nbrZone)
116 <<
"agglomeration is not synchronised across"
117 <<
" coupled patch " << pp.name()
119 <<
"Local agglomeration " << myZone
120 <<
". Remote agglomeration " << nbrZone
128 localToNbr.insert(myZone, nbrZone);
139 coarseI += nAgglom[patchi];
144 labelList patchStarts(oldPatches.size());
148 patchFaceMap_.
setSize(oldPatches.size());
152 reverseFaceMap_.labelList::operator=(-1);
158 forAll(oldPatches, patchi)
160 patchStarts[patchi] = coarseI;
162 const polyPatch& pp = oldPatches[patchi];
166 patchFaceMap_[patchi].
setSize(nAgglom[patchi]);
175 labelList agglomToFace(nAgglom[patchi], -1);
179 label myAgglom = agglom[patchi][i];
181 if (agglomToFace[myAgglom] == -1)
188 label coarsePatchFacei = coarseI - patchStarts[patchi];
189 patchFaceMap_[patchi][coarsePatchFacei] = myAgglom;
190 agglomToFace[myAgglom] = coarsePatchFacei;
192 const labelList& fineFaces = agglomToPatch[myAgglom];
197 reverseFaceMap_[pp.start()+fineFaces[fineI]] = coarseI;
203 UIndirectList<face>(pp, fineFaces),
207 if (upp.edgeLoops().size() != 1)
210 <<
"agglomeration does not create a"
211 <<
" single, non-manifold"
212 <<
" face for agglomeration " << myAgglom
213 <<
" on patch " << patchi
217 patchFaces[coarseI++] = face
229 patchSizes[patchi] = coarseI-patchStarts[patchi];
237 reversePointMap_.labelList::operator=(-1);
240 forAll(patchFaces, coarseI)
242 face&
f = patchFaces[coarseI];
246 if (reversePointMap_[
f[fp]] == -1)
248 reversePointMap_[
f[fp]] = newI++;
251 f[fp] = reversePointMap_[
f[fp]];
255 pointMap_ =
invert(newI, reversePointMap_);
261 List<polyPatch*> newPatches(oldPatches.size());
262 forAll(oldPatches, patchi)
264 newPatches[patchi] = oldPatches[patchi].clone
274 const label nFace = patchFaces.size();
296 DynamicList<label> newAddressing;
326 DynamicList<label> newAddressing(oldFz.size());
327 DynamicList<bool> newFlipMap(oldFz.size());
331 label newFacei = reverseFaceMap_[oldFz[i]];
335 newAddressing.
append(newFacei);
336 newFlipMap.append(oldFz.flipMap()[i]);
362 DynamicList<label> newAddressing(oldFz.size());
366 label
newPointi = reversePointMap_[oldFz[i]];
401 patchFaceAgglomeration_
405 "patchFaceAgglomeration",
471 forAll(oldPatches, patchi)
476 agglomerateMesh(
mesh, agglom);
488 patchFaceAgglomeration_
492 "patchFaceAgglomeration",
499 patchFaceAgglomeration
554 agglomerateMesh(
mesh, patchFaceAgglomeration);
561 patchFaceAgglomeration_
565 "patchFaceAgglomeration",
label size() const noexcept
The number of elements in table.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void setSize(const label n)
Alias for resize()
void append(const T &val)
Append an element at the end of the list.
const T * set(const label i) const
void setSize(const label newLen)
Same as resize()
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
label size() const noexcept
The number of elements in the list.
void clear()
Clear the zones.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Mesh data needed to do the Finite Volume discretisation.
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
const Time & time() const
Return the top-level database.
constant condensation/saturation model.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
virtual const pointField & points() const
Return raw points.
void resetPrimitives(autoPtr< pointField > &&points, autoPtr< faceList > &&faces, autoPtr< labelList > &&owner, autoPtr< labelList > &&neighbour, const labelUList &patchSizes, const labelUList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
label nInternalFaces() const noexcept
Number of internal faces.
label nPoints() const noexcept
Number of mesh points.
label nFaces() const noexcept
Number of mesh faces.
fvMesh as subset of other mesh. Consists of one cell and all original bounday faces....
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
List< label > labelList
A List of labels.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
vectorField pointField
pointField is a vectorField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
List< labelList > labelListList
A List of labelList.
static constexpr const zero Zero
Global zero (0)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
List< face > faceList
A List of faces.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.