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];
89 Map<label> localToNbr(nbrAgglom.size()/10);
93 const polyPatch& pp = oldPatches[
patchi];
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);
157 patchStarts[
patchi] = coarseI;
159 const polyPatch& pp = oldPatches[
patchi];
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
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());
279 std::move(boundaryPoints),
280 std::move(patchFaces),
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());
406 patchFaceAgglomeration_
410 "patchFaceAgglomeration",
430 mesh.boundaryMesh().size()
481 agglomerateMesh(mesh, agglom);
501 patchFaceAgglomeration_
505 "patchFaceAgglomeration",
512 patchFaceAgglomeration
525 mesh.boundaryMesh().size()
567 agglomerateMesh(mesh, patchFaceAgglomeration);
574 patchFaceAgglomeration_
578 "patchFaceAgglomeration",
#define forAll(list, i)
Loop across all elements in list.
label size() const
Return number of elements in table.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
HashTable< label, label, Hash< label > >::const_iterator const_iterator
void clear()
Clear the zones.
bool set(const label) const
Is element set.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
label size() const
Return the number of elements in the UPtrList.
Mesh data needed to do the Finite Volume discretisation.
const labelUList & owner() const
Internal face owner.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
const labelUList & neighbour() const
Internal face neighbour.
const meshFaceZones & faceZones() const
Return face zones.
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 meshPointZones & pointZones() const
Return point zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const meshCellZones & cellZones() const
Return cell zones.
singleCellFvMesh(const IOobject &io, const fvMesh &)
Construct from fvMesh and no agglomeration.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
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.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
vectorField pointField
pointField is a vectorField.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
Foam::uindirectPrimitivePatch.
List< labelList > labelListList
A List of labelList.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
void offset(label &lst, const label o)