32 void Foam::singleCellFvMesh::agglomerateMesh
43 const polyBoundaryMesh& oldPatches = mesh.boundaryMesh();
50 const polyPatch& pp = oldPatches[
patchi];
57 if (agglom[patchi][i] < 0 || agglom[patchi][i] >= pp.size())
60 <<
"agglomeration on patch " << patchi
61 <<
" is out of range 0.." << pp.size()-1
71 labelList nbrAgglom(mesh.nFaces()-mesh.nInternalFaces());
74 const polyPatch& pp = oldPatches[
patchi];
78 label offset = pp.start()-mesh.nInternalFaces();
81 nbrAgglom[offset+i] = agglom[
patchi][i];
89 Map<label> localToNbr(nbrAgglom.size()/10);
93 const polyPatch& pp = oldPatches[
patchi];
97 label offset = pp.start()-mesh.nInternalFaces();
101 label bFacei = offset+i;
103 label nbrZone = nbrAgglom[bFacei];
107 if (iter == localToNbr.end())
111 localToNbr.insert(myZone, nbrZone);
116 if (iter() != nbrZone)
119 <<
"agglomeration is not synchronised across" 120 <<
" coupled patch " << pp.name()
122 <<
"Local agglomeration " << myZone
123 <<
". Remote agglomeration " << nbrZone
136 coarseI += nAgglom[
patchi];
141 labelList patchStarts(oldPatches.size());
145 patchFaceMap_.
setSize(oldPatches.size());
148 reverseFaceMap_.
setSize(mesh.nFaces());
149 reverseFaceMap_.labelList::operator=(-1);
155 forAll(oldPatches, patchi)
157 patchStarts[
patchi] = coarseI;
159 const polyPatch& pp = oldPatches[
patchi];
172 labelList agglomToFace(nAgglom[patchi], -1);
178 if (agglomToFace[myAgglom] == -1)
185 label coarsePatchFacei = coarseI - patchStarts[
patchi];
186 patchFaceMap_[
patchi][coarsePatchFacei] = myAgglom;
187 agglomToFace[myAgglom] = coarsePatchFacei;
189 const labelList& fineFaces = agglomToPatch[myAgglom];
194 reverseFaceMap_[pp.start()+fineFaces[fineI]] = coarseI;
200 UIndirectList<face>(pp, fineFaces),
204 if (upp.edgeLoops().size() != 1)
207 <<
"agglomeration does not create a" 208 <<
" single, non-manifold" 209 <<
" face for agglomeration " << myAgglom
210 <<
" on patch " << patchi
214 patchFaces[coarseI++] = face
233 reversePointMap_.
setSize(mesh.nPoints());
234 reversePointMap_.labelList::operator=(-1);
237 forAll(patchFaces, coarseI)
239 face& f = patchFaces[coarseI];
243 if (reversePointMap_[f[fp]] == -1)
245 reversePointMap_[f[fp]] = newI++;
248 f[fp] = reversePointMap_[f[fp]];
252 pointMap_ =
invert(newI, reversePointMap_);
255 pointField boundaryPoints(mesh.points(), pointMap_);
258 List<polyPatch*> newPatches(oldPatches.size());
259 forAll(oldPatches, patchi)
279 move(boundaryPoints),
293 forAll(mesh.cellZones(), zoneI)
295 const cellZone& oldFz = mesh.cellZones()[zoneI];
297 DynamicList<label> newAddressing;
323 forAll(mesh.faceZones(), zoneI)
325 const faceZone& oldFz = mesh.faceZones()[zoneI];
327 DynamicList<label> newAddressing(oldFz.size());
328 DynamicList<bool> newFlipMap(oldFz.size());
332 label newFacei = reverseFaceMap_[oldFz[i]];
336 newAddressing.
append(newFacei);
337 newFlipMap.append(oldFz.flipMap()[i]);
359 forAll(mesh.pointZones(), zoneI)
361 const pointZone& oldFz = mesh.pointZones()[zoneI];
363 DynamicList<label> newAddressing(oldFz.size());
367 label newPointi = reversePointMap_[oldFz[i]];
370 newAddressing.
append(newPointi);
406 patchFaceAgglomeration_
410 "patchFaceAgglomeration",
476 forAll(oldPatches, patchi)
481 agglomerateMesh(mesh, agglom);
501 patchFaceAgglomeration_
505 "patchFaceAgglomeration",
512 patchFaceAgglomeration
567 agglomerateMesh(mesh, patchFaceAgglomeration);
574 patchFaceAgglomeration_
578 "patchFaceAgglomeration",
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
List< labelList > labelListList
A List of labelList.
#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.
bool set(const label) const
Is element set.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const meshCellZones & cellZones() const
Return cell zones.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void addFvPatches(const List< polyPatch *> &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
void clear()
Clear the zones.
label size() const
Return number of elements in table.
const meshPointZones & pointZones() const
Return point zones.
const labelUList & neighbour() const
Internal face neighbour.
vectorField pointField
pointField is a vectorField.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
void append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
void resetPrimitives(pointField &&points, faceList &&faces, labelList &&owner, labelList &&neighbour, const labelList &patchSizes, const labelList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
const labelUList & owner() const
Internal face owner.
fvMesh(const IOobject &io)
Construct from IOobject.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
Foam::uindirectPrimitivePatch.
writeOption writeOpt() const
const fileName & instance() const
const meshFaceZones & faceZones() const
Return face zones.
Mesh data needed to do the Finite Volume discretisation.
singleCellFvMesh(const IOobject &io, const fvMesh &)
Construct from fvMesh and no agglomeration.
readOption readOpt() const
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...