48Foam::label Foam::mergePolyMesh::patchIndex(
const polyPatch&
p)
52 const word& pType =
p.type();
53 const word& pName =
p.name();
55 bool nameFound =
false;
57 forAll(patchNames_, patchi)
59 if (patchNames_[patchi] == pName)
61 if (patchDicts_[patchi].get<word>(
"type") == pType)
78 ISpanStream is(
os.view());
87 const word&
caseName =
p.boundaryMesh().mesh().time().caseName();
89 patchNames_.append(pName +
"_" +
caseName);
91 Info<<
"label patchIndex(const polyPatch& p) : "
92 <<
"Patch " <<
p.index() <<
" named "
94 <<
" already exists, but patch types "
95 <<
" do not match.\nCreating a composite name as "
96 << patchNames_.last() <<
endl;
100 patchNames_.append(pName);
103 return patchNames_.size() - 1;
107Foam::label Foam::mergePolyMesh::zoneIndex
115 if (
names[zonei] == curName)
122 names.append(curName);
124 return names.size() - 1;
128void Foam::mergePolyMesh::sortProcessorPatches()
130 Info<<
"Reordering processor patches last" <<
endl;
143 labelList oldToSorted(oldPatches.size());
147 forAll(oldPatches, patchi)
170 forAll(oldPatches, patchi)
195 addPatches(newPatches);
217Foam::mergePolyMesh::mergePolyMesh(
const IOobject&
io)
228 wordList curPatchNames = boundaryMesh().names();
231 forAll(boundaryMesh(), patchi)
234 boundaryMesh()[patchi].write(
os);
235 ISpanStream is(
os.view());
237 patchNames_.push_back(boundaryMesh()[patchi].
name());
244 wordList curPointZoneNames = pointZones().names();
245 if (curPointZoneNames.size())
247 pointZoneNames_.setCapacity(2*curPointZoneNames.size());
248 pointZoneNames_.append(curPointZoneNames);
252 wordList curFaceZoneNames = faceZones().names();
253 if (curFaceZoneNames.size())
255 faceZoneNames_.setCapacity(2*curFaceZoneNames.size());
256 faceZoneNames_.append(curFaceZoneNames);
260 wordList curCellZoneNames = cellZones().names();
261 if (curCellZoneNames.size())
263 cellZoneNames_.setCapacity(2*curCellZoneNames.size());
264 cellZoneNames_.append(curCellZoneNames);
287 pointZoneIndices[zoneI] = zoneIndex(pointZoneNames_, pz[zoneI].
name());
293 zoneID = pz.whichZone(pointi);
298 zoneID = pointZoneIndices[zoneID];
301 renumberPoints[pointi] =
324 cellZoneIndices[zoneI] = zoneIndex(cellZoneNames_, cz[zoneI].
name());
330 zoneID = cz.whichZone(celli);
335 zoneID = cellZoneIndices[zoneID];
338 renumberCells[celli] =
353 const polyBoundaryMesh& bm = m.boundaryMesh();
358 forAll(patchIndices, patchi)
360 patchIndices[patchi] = patchIndex(bm[patchi]);
365 meshMod_.setNumPatches(patchNames_.size());
374 faceZoneIndices[zoneI] = zoneIndex(faceZoneNames_, fz[zoneI].
name());
381 const labelList& nei = m.faceNeighbour();
383 label newOwn, newNei, newPatch, newZone;
388 const face& curFace =
f[facei];
390 face newFace(curFace.size());
394 newFace[pointi] = renumberPoints[curFace[pointi]];
400 if (
min(newFace) < 0)
403 <<
"Error in point mapping for face " << facei
404 <<
". Old face: " << curFace <<
" New face: " << newFace
409 if (facei < m.nInternalFaces() || facei >= m.nFaces())
415 newPatch = patchIndices[bm.whichPatch(facei)];
419 if (newOwn > -1) newOwn = renumberCells[newOwn];
428 newNei = renumberCells[newNei];
432 newZone = fz.whichZone(facei);
437 newZoneFlip = fz[newZone].flipMap()[fz[newZone].whichFace(facei)];
440 newZone = faceZoneIndices[newZone];
443 renumberFaces[facei] =
466 Info<<
"patch names: " << patchNames_ <<
nl
467 <<
"patch dicts: " << patchDicts_ <<
nl
468 <<
"point zone names: " << pointZoneNames_ <<
nl
469 <<
"face zone names: " << faceZoneNames_ <<
nl
470 <<
"cell zone names: " << cellZoneNames_ <<
endl;
475 Info<<
"Copying old patches" <<
endl;
484 for (patchi = 0; patchi < oldPatches.size(); patchi++)
489 oldPatches[patchi].clone(oldPatches)
493 Info<<
"Adding new patches. " <<
endl;
495 label endOfLastPatch =
498 : oldPatches[patchi - 1].start() + oldPatches[patchi - 1].size();
500 for (; patchi < patchNames_.size(); patchi++)
505 dict.
set(
"startFace", endOfLastPatch);
523 addPatches(newPatches);
527 if (pointZoneNames_.size() > pointZones().size())
529 Info<<
"Adding new pointZones." <<
endl;
531 label zonei = pointZones().size();
533 const label nZones = pointZoneNames_.size();
535 pointZones().setSize(nZones);
537 for (; zonei < nZones; ++zonei)
542 new pointZone(pointZoneNames_[zonei], zonei, pointZones())
546 if (cellZoneNames_.size() > cellZones().size())
548 Info<<
"Adding new cellZones." <<
endl;
550 label zonei = cellZones().size();
552 const label nZones = cellZoneNames_.size();
554 cellZones().setSize(cellZoneNames_.size());
556 for (; zonei < nZones; ++zonei)
561 new cellZone(cellZoneNames_[zonei], zonei, cellZones())
565 if (faceZoneNames_.size() > faceZones().size())
567 Info<<
"Adding new faceZones." <<
endl;
569 label zonei = faceZones().size();
571 const label nZones = faceZoneNames_.size();
573 faceZones().setSize(nZones);
575 for (; zonei < nZones; ++zonei)
580 new faceZone(faceZoneNames_[zonei], zonei, faceZones())
587 sortProcessorPatches();
590 meshMod_.changeMesh(*
this,
false);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const fileName & caseName() const noexcept
Return the Time::caseName().
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A subset of mesh faces organised as a primitive patch.
Add a given mesh to the original mesh to create a single new mesh.
void addMesh(const polyMesh &m)
Add a mesh.
void merge()
Merge meshes.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const dimensionedScalar c
Speed of light in a vacuum.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
List< word > wordList
List of word.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with pointZone content on a polyMesh.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with cellZone content on a polyMesh.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.