polyTopoChange: Removed restrictive pointZone functionality

Now pointZones are handled directly by the applications and the new
pointZone::topoChange function so that any point can now be in any number of
zones, significantly increasing the flexibility and usefulness of pointZones.

The same rationalisation and generalisation will be applied to cellZones and
faceZones in the future.
This commit is contained in:
Henry Weller
2024-03-13 20:36:00 +00:00
parent 9e3d5fd521
commit 9239b3bfa9
30 changed files with 218 additions and 408 deletions

View File

@ -153,6 +153,8 @@ Foam::mergePolyMesh::mergePolyMesh(polyMesh& mesh)
pointZoneNames_.append(curPointZoneNames[zoneI]);
}
pointZonesAddedPoints_.setSize(pointZoneNames_.size());
// Face zones
wordList curFaceZoneNames = mesh_.faceZones().names();
@ -201,26 +203,26 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
forAll(pz, zoneI)
{
pointZoneIndices[zoneI] = zoneIndex(pointZoneNames_, pz[zoneI].name());
pointZonesAddedPoints_.setSize(pointZoneNames_.size());
}
forAll(p, pointi)
{
renumberPoints[pointi] = meshMod_.addPoint
(
p[pointi], // Point to add
-1, // Master point (straight addition)
pointi < m.nPoints() // Is in cell?
);
// Grab zone ID. If a point is not in a zone, it will return -1
zoneID = pz.whichZone(pointi);
if (zoneID >= 0)
{
// Translate zone ID into the new index
zoneID = pointZoneIndices[zoneID];
pointZonesAddedPoints_[pointZoneIndices[zoneID]]
.insert(renumberPoints[pointi]);
}
renumberPoints[pointi] = meshMod_.addPoint
(
p[pointi], // Point to add
-1, // Master point (straight addition)
zoneID, // Zone for point
pointi < m.nPoints() // Is in cell?
);
}
// Add cells
@ -509,6 +511,12 @@ void Foam::mergePolyMesh::merge()
// Clear topo change for the next operation
meshMod_.clear();
// Add the new points to the pointZones in the merged mesh
forAll(pointZonesAddedPoints_, zonei)
{
mesh_.pointZones()[zonei].insert(pointZonesAddedPoints_[zonei]);
}
}

View File

@ -66,6 +66,9 @@ class mergePolyMesh
//- Point zone names
DynamicList<word> pointZoneNames_;
//- Zones of the added points
List<labelHashSet> pointZonesAddedPoints_;
//- Face zone names
DynamicList<word> faceZoneNames_;