36 void Foam::singleCellFvMesh::agglomerateMesh
42 const polyBoundaryMesh& oldPatches = mesh.boundaryMesh();
49 const polyPatch& pp = oldPatches[patchI];
52 nAgglom[patchI] =
max(agglom[patchI])+1;
56 if (agglom[patchI][i] < 0 || agglom[patchI][i] >= pp.size())
60 "singleCellFvMesh::agglomerateMesh(..)" 61 ) <<
"agglomeration on patch " << patchI
62 <<
" is out of range 0.." << pp.size()-1
72 labelList nbrAgglom(mesh.nFaces()-mesh.nInternalFaces());
75 const polyPatch& pp = oldPatches[patchI];
79 label offset = pp.start()-mesh.nInternalFaces();
82 nbrAgglom[offset+i] = agglom[patchI][i];
90 Map<label> localToNbr(nbrAgglom.size()/10);
94 const polyPatch& pp = oldPatches[patchI];
98 label offset = pp.start()-mesh.nInternalFaces();
102 label bFaceI = offset+i;
103 label myZone = agglom[patchI][i];
104 label nbrZone = nbrAgglom[bFaceI];
108 if (iter == localToNbr.end())
112 localToNbr.insert(myZone, nbrZone);
117 if (iter() != nbrZone)
121 "singleCellFvMesh::agglomerateMesh(..)" 122 ) <<
"agglomeration is not synchronised across" 123 <<
" coupled patch " << pp.name()
125 <<
"Local agglomeration " << myZone
126 <<
". Remote agglomeration " << nbrZone
139 coarseI += nAgglom[patchI];
144 labelList patchStarts(oldPatches.size());
148 patchFaceMap_.
setSize(oldPatches.size());
151 reverseFaceMap_.
setSize(mesh.nFaces());
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)
211 "singleCellFvMesh::agglomerateMesh(..)" 212 ) <<
"agglomeration does not create a" 213 <<
" single, non-manifold" 214 <<
" face for agglomeration " << myAgglom
215 <<
" on patch " << patchI
219 patchFaces[coarseI++] = face
231 patchSizes[patchI] = coarseI-patchStarts[patchI];
238 reversePointMap_.
setSize(mesh.nPoints());
239 reversePointMap_.labelList::operator=(-1);
242 forAll(patchFaces, coarseI)
244 face& f = patchFaces[coarseI];
248 if (reversePointMap_[f[fp]] == -1)
250 reversePointMap_[f[fp]] = newI++;
253 f[fp] = reversePointMap_[f[fp]];
257 pointMap_ =
invert(newI, reversePointMap_);
260 pointField boundaryPoints(mesh.points(), pointMap_);
263 List<polyPatch*> newPatches(oldPatches.size());
264 forAll(oldPatches, patchI)
266 newPatches[patchI] = oldPatches[patchI].clone
298 forAll(mesh.cellZones(), zoneI)
300 const cellZone& oldFz = mesh.cellZones()[zoneI];
302 DynamicList<label> newAddressing;
328 forAll(mesh.faceZones(), zoneI)
330 const faceZone& oldFz = mesh.faceZones()[zoneI];
332 DynamicList<label> newAddressing(oldFz.size());
333 DynamicList<bool> newFlipMap(oldFz.size());
337 label newFaceI = reverseFaceMap_[oldFz[i]];
341 newAddressing.
append(newFaceI);
342 newFlipMap.append(oldFz.flipMap()[i]);
364 forAll(mesh.pointZones(), zoneI)
366 const pointZone& oldFz = mesh.pointZones()[zoneI];
368 DynamicList<label> newAddressing(oldFz.size());
372 label newPointI = reversePointMap_[oldFz[i]];
375 newAddressing.
append(newPointI);
396 Foam::singleCellFvMesh::singleCellFvMesh
411 patchFaceAgglomeration_
415 "patchFaceAgglomeration",
481 forAll(oldPatches, patchI)
486 agglomerateMesh(mesh, agglom);
490 Foam::singleCellFvMesh::singleCellFvMesh
506 patchFaceAgglomeration_
510 "patchFaceAgglomeration",
517 patchFaceAgglomeration
572 agglomerateMesh(mesh, patchFaceAgglomeration);
576 Foam::singleCellFvMesh::singleCellFvMesh(
const IOobject& io)
579 patchFaceAgglomeration_
583 "patchFaceAgglomeration",
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
const cellZoneMesh & cellZones() const
Return cell zone mesh.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
const faceZoneMesh & faceZones() const
Return face zone mesh.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Mesh data needed to do the Finite Volume discretisation.
readOption readOpt() const
label size() const
Return the number of elements in the PtrList.
bool set(const label) const
Is element set.
Xfer< T > xferCopy(const T &)
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & instance() const
const labelUList & owner() const
Internal face owner.
const pointZoneMesh & pointZones() const
Return point zone mesh.
vectorField pointField
pointField is a vectorField.
void resetPrimitives(const Xfer< pointField > &points, const Xfer< faceList > &faces, const Xfer< labelList > &owner, const Xfer< labelList > &neighbour, const labelList &patchSizes, const labelList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
writeOption writeOpt() const
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
static void swapBoundaryFaceList(const polyMesh &mesh, UList< T > &l)
Swap coupled boundary face values.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label size() const
Return number of elements in table.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
PrimitivePatch< face, UIndirectList, const pointField & > uindirectPrimitivePatch
Foam::uindirectPrimitivePatch.
List< label > labelList
A List of labels.
void append(const T &)
Append an element at the end of the list.
const labelUList & neighbour() const
Internal face neighbour.
List< labelList > labelListList
A List of labelList.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
void clear()
Clear the zones.