35 void Foam::singleCellFvMesh::agglomerateMesh
46 const polyBoundaryMesh& oldPatches =
mesh.boundaryMesh();
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];
81 label offset = pp.start()-
mesh.nInternalFaces();
84 nbrAgglom[offset+i] = agglom[patchi][i];
92 Map<label> localToNbr(nbrAgglom.size()/10);
96 const polyPatch& pp = oldPatches[patchi];
100 label offset = pp.start()-
mesh.nInternalFaces();
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();
294 const cellZone& oldFz =
mesh.cellZones()[zoneI];
296 DynamicList<label> newAddressing;
324 const faceZone& oldFz =
mesh.faceZones()[zoneI];
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]);
360 const pointZone& oldFz =
mesh.pointZones()[zoneI];
362 DynamicList<label> newAddressing(oldFz.size());
366 label
newPointi = reversePointMap_[oldFz[i]];
394 Foam::singleCellFvMesh::singleCellFvMesh
401 patchFaceAgglomeration_
405 "patchFaceAgglomeration",
471 forAll(oldPatches, patchi)
473 agglom[patchi] =
identity(oldPatches[patchi].size());
476 agglomerateMesh(
mesh, agglom);
480 Foam::singleCellFvMesh::singleCellFvMesh
488 patchFaceAgglomeration_
492 "patchFaceAgglomeration",
499 patchFaceAgglomeration
554 agglomerateMesh(
mesh, patchFaceAgglomeration);
558 Foam::singleCellFvMesh::singleCellFvMesh(
const IOobject& io)
561 patchFaceAgglomeration_
565 "patchFaceAgglomeration",