35 void Foam::singleCellFvMesh::agglomerateMesh
46 const polyBoundaryMesh& oldPatches =
mesh.boundaryMesh();
53 const polyPatch&
pp = oldPatches[patchi];
56 if (agglom[patchi].
size() !=
pp.size())
59 <<
"agglomeration on patch " << patchi
60 <<
" (size " <<
pp.size()
61 <<
") is of size " << agglom[patchi].size()
65 nAgglom[patchi] =
max(agglom[patchi])+1;
69 if (agglom[patchi][i] < 0 || agglom[patchi][i] >=
pp.size())
72 <<
"agglomeration on patch " << patchi
73 <<
" is out of range 0.." <<
pp.size()-1
86 const polyPatch&
pp = oldPatches[patchi];
90 label offset =
pp.start()-
mesh.nInternalFaces();
93 nbrAgglom[offset+i] = agglom[patchi][i];
101 Map<label> localToNbr(nbrAgglom.size()/10);
103 forAll(oldPatches, patchi)
105 const polyPatch&
pp = oldPatches[patchi];
109 label offset =
pp.start()-
mesh.nInternalFaces();
113 label bFacei = offset+i;
114 label myZone = agglom[patchi][i];
115 label nbrZone = nbrAgglom[bFacei];
117 const auto iter = localToNbr.cfind(myZone);
122 if (iter.val() != nbrZone)
125 <<
"agglomeration is not synchronised across" 126 <<
" coupled patch " <<
pp.name()
128 <<
"Local agglomeration " << myZone
129 <<
". Remote agglomeration " << nbrZone
137 localToNbr.insert(myZone, nbrZone);
148 coarseI += nAgglom[patchi];
153 labelList patchStarts(oldPatches.size());
157 patchFaceMap_.
setSize(oldPatches.size());
161 reverseFaceMap_.labelList::operator=(-1);
167 forAll(oldPatches, patchi)
169 patchStarts[patchi] = coarseI;
171 const polyPatch&
pp = oldPatches[patchi];
175 patchFaceMap_[patchi].
setSize(nAgglom[patchi]);
184 labelList agglomToFace(nAgglom[patchi], -1);
188 label myAgglom = agglom[patchi][i];
190 if (agglomToFace[myAgglom] == -1)
197 label coarsePatchFacei = coarseI - patchStarts[patchi];
198 patchFaceMap_[patchi][coarsePatchFacei] = myAgglom;
199 agglomToFace[myAgglom] = coarsePatchFacei;
201 const labelList& fineFaces = agglomToPatch[myAgglom];
206 reverseFaceMap_[
pp.start()+fineFaces[fineI]] = coarseI;
212 UIndirectList<face>(
pp, fineFaces),
216 if (upp.edgeLoops().size() != 1)
219 <<
"agglomeration does not create a" 220 <<
" single, non-manifold" 221 <<
" face for agglomeration " << myAgglom
222 <<
" on patch " << patchi
226 patchFaces[coarseI++] = face
238 patchSizes[patchi] = coarseI-patchStarts[patchi];
247 reversePointMap_.labelList::operator=(-1);
250 forAll(patchFaces, coarseI)
252 face&
f = patchFaces[coarseI];
256 if (reversePointMap_[
f[fp]] == -1)
258 reversePointMap_[
f[fp]] = newI++;
261 f[fp] = reversePointMap_[
f[fp]];
265 pointMap_ =
invert(newI, reversePointMap_);
272 forAll(oldPatches, patchi)
277 oldPatches[patchi].
clone 288 const label nFace = patchFaces.size();
308 const cellZone& oldFz =
mesh.cellZones()[zoneI];
310 DynamicList<label> newAddressing;
338 const faceZone& oldFz =
mesh.faceZones()[zoneI];
340 DynamicList<label> newAddressing(oldFz.size());
341 DynamicList<bool> newFlipMap(oldFz.size());
345 label newFacei = reverseFaceMap_[oldFz[i]];
349 newAddressing.
append(newFacei);
350 newFlipMap.append(oldFz.flipMap()[i]);
374 const pointZone& oldFz =
mesh.pointZones()[zoneI];
376 DynamicList<label> newAddressing(oldFz.size());
380 label
newPointi = reversePointMap_[oldFz[i]];
408 Foam::singleCellFvMesh::singleCellFvMesh
416 patchFaceAgglomeration_
420 "patchFaceAgglomeration",
486 forAll(oldPatches, patchi)
491 agglomerateMesh(
mesh, agglom);
501 Foam::singleCellFvMesh::singleCellFvMesh
510 patchFaceAgglomeration_
514 "patchFaceAgglomeration",
521 patchFaceAgglomeration
534 mesh.boundaryMesh().size()
585 Foam::singleCellFvMesh::singleCellFvMesh(
const IOobject&
io,
const bool doInit)
588 patchFaceAgglomeration_
592 "patchFaceAgglomeration",
autoPtr< IOobject > clone() const
Clone.
void clear()
Clear the zones.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
List< labelList > labelListList
List of labelList.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
label size() const noexcept
The number of elements in table.
vectorField pointField
pointField is a vectorField.
void setSize(const label n)
Alias for resize()
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
label size() const noexcept
The number of entries in the list.
const labelListList & patchFaceAgglomeration() const noexcept
Fine patch face to agglomeration index addressing.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
void setSize(const label newLen)
Same as resize()
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
Mesh data needed to do the Finite Volume discretisation.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Defines the attributes of an object for which implicit objectRegistry management is supported...
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)