zones: General code clean-up and rationalisation to reduce duplication

This commit is contained in:
Henry Weller
2024-03-27 13:29:44 +00:00
parent fa36bc75cc
commit 4ad52ea108
27 changed files with 147 additions and 157 deletions

View File

@ -493,10 +493,7 @@ void Foam::extrude2DMesh::setRefinement
void Foam::extrude2DMesh::updateZones() void Foam::extrude2DMesh::updateZones()
{ {
// Add the cellZones to the merged mesh // Add the cellZones to the merged mesh
forAll(cellZonesAddedCells_, zonei) mesh_.cellZones().insert(cellZonesAddedCells_);
{
mesh_.cellZones()[zonei].insert(cellZonesAddedCells_[zonei]);
}
} }

View File

@ -190,7 +190,7 @@ label createFaces
// Pass 1. Do selected side of zone // Pass 1. Do selected side of zone
for (label facei = 0; facei < mesh.nInternalFaces(); facei++) for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
{ {
const label zoneFacei = fZone.whichFace(facei); const label zoneFacei = fZone.localIndex(facei);
if (zoneFacei != -1) if (zoneFacei != -1)
{ {
@ -233,7 +233,7 @@ label createFaces
// Pass 2. Do other side of zone // Pass 2. Do other side of zone
for (label facei = 0; facei < mesh.nInternalFaces(); facei++) for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
{ {
label zoneFacei = fZone.whichFace(facei); label zoneFacei = fZone.localIndex(facei);
if (zoneFacei != -1) if (zoneFacei != -1)
{ {
@ -278,7 +278,7 @@ label createFaces
forAll(pp, i) forAll(pp, i)
{ {
const label facei = pp.start() + i; const label facei = pp.start() + i;
const label zoneFacei = fZone.whichFace(facei); const label zoneFacei = fZone.localIndex(facei);
if (zoneFacei != -1) if (zoneFacei != -1)
{ {

View File

@ -342,7 +342,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
forAll(zones, zonei) forAll(zones, zonei)
{ {
const faceZone& fzi = fz[zones[zonei]]; const faceZone& fzi = fz[zones[zonei]];
const bool flip = fzi.flipMap()[fzi.whichFace(facei)]; const bool flip = fzi.flipMap()[fzi.localIndex(facei)];
faceZonesAddedFaces_[faceZoneIndices[zonei]] faceZonesAddedFaces_[faceZoneIndices[zonei]]
.insert(renumberFaces[facei], flip); .insert(renumberFaces[facei], flip);
@ -499,22 +499,13 @@ void Foam::mergePolyMesh::merge()
autoPtr<polyTopoChangeMap> map(meshMod_.changeMesh(mesh_)); autoPtr<polyTopoChangeMap> map(meshMod_.changeMesh(mesh_));
// Add the new points to the pointZones in the merged mesh // Add the new points to the pointZones in the merged mesh
forAll(pointZonesAddedPoints_, zonei) mesh_.pointZones().insert(pointZonesAddedPoints_);
{
mesh_.pointZones()[zonei].insert(pointZonesAddedPoints_[zonei]);
}
// Add the new faces to the faceZones in the merged mesh // Add the new faces to the faceZones in the merged mesh
forAll(faceZonesAddedFaces_, zonei) mesh_.faceZones().insert(faceZonesAddedFaces_);
{
mesh_.faceZones()[zonei].insert(faceZonesAddedFaces_[zonei]);
}
// Add the new cells to the cellZones in the merged mesh // Add the new cells to the cellZones in the merged mesh
forAll(cellZonesAddedCells_, zonei) mesh_.cellZones().insert(cellZonesAddedCells_);
{
mesh_.cellZones()[zonei].insert(cellZonesAddedCells_[zonei]);
}
mesh_.topoChange(map); mesh_.topoChange(map);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -672,7 +672,7 @@ void ensightPointField
const faceZone& fz = mesh.faceZones()[zoneID]; const faceZone& fz = mesh.faceZones()[zoneID];
if (returnReduce(fz().nPoints(), sumOp<label>()) > 0) if (returnReduce(fz.patch().nPoints(), sumOp<label>()) > 0)
{ {
// Renumber the faceZone points/faces into unique points // Renumber the faceZone points/faces into unique points
labelList pointToGlobal; labelList pointToGlobal;
@ -680,8 +680,8 @@ void ensightPointField
autoPtr<globalIndex> globalPointsPtr = autoPtr<globalIndex> globalPointsPtr =
mesh.globalData().mergePoints mesh.globalData().mergePoints
( (
fz().meshPoints(), fz.patch().meshPoints(),
fz().meshPointMap(), fz.patch().meshPointMap(),
pointToGlobal, pointToGlobal,
uniqueMeshPointLabels uniqueMeshPointLabels
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -1267,8 +1267,8 @@ void Foam::ensightMesh::write
autoPtr<globalIndex> globalPointsPtr = autoPtr<globalIndex> globalPointsPtr =
mesh_.globalData().mergePoints mesh_.globalData().mergePoints
( (
fz().meshPoints(), fz.patch().meshPoints(),
fz().meshPointMap(), fz.patch().meshPointMap(),
pointToGlobal, pointToGlobal,
uniqueMeshPointLabels uniqueMeshPointLabels
); );
@ -1277,7 +1277,7 @@ void Foam::ensightMesh::write
// Find the list of master faces belonging to the faceZone, // Find the list of master faces belonging to the faceZone,
// in local numbering // in local numbering
faceList faceZoneFaces(fz().localFaces()); faceList faceZoneFaces(fz.patch().localFaces());
// Count how many master faces belong to the faceZone. Is there // Count how many master faces belong to the faceZone. Is there
// a better way of doing this? // a better way of doing this?

View File

@ -450,7 +450,7 @@ void Foam::vtkPVFoam::convertMeshFaceZones
<< zoneName << endl; << zoneName << endl;
} }
vtkPolyData* vtkmesh = patchVTKMesh(zoneName, zMesh[zoneId]()); vtkPolyData* vtkmesh = patchVTKMesh(zoneName, zMesh[zoneId].patch());
if (vtkmesh) if (vtkmesh)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -153,7 +153,7 @@ void Foam::vtkPVFoam::convertPointFields
Field<Type> fld Field<Type> fld
( (
ptf.primitiveField(), ptf.primitiveField(),
mesh.faceZones()[zoneId]().meshPoints() mesh.faceZones()[zoneId].patch().meshPoints()
); );
convertPatchPointField convertPatchPointField

View File

@ -30,18 +30,6 @@ License
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ZoneType, class ZonesType>
const Foam::Map<Foam::label>& Foam::Zone<ZoneType, ZonesType>::lookupMap() const
{
if (!lookupMapPtr_)
{
calcLookupMap();
}
return *lookupMapPtr_;
}
template<class ZoneType, class ZonesType> template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::calcLookupMap() const void Foam::Zone<ZoneType, ZonesType>::calcLookupMap() const
{ {
@ -64,6 +52,37 @@ void Foam::Zone<ZoneType, ZonesType>::calcLookupMap() const
} }
template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::topoChange
(
const labelList& map,
const labelList& reverseMap
)
{
clearAddressing();
labelHashSet indices;
forAll(map, celli)
{
if (map[celli] >= 0 && localIndex(map[celli]) != -1)
{
indices.insert(celli);
}
}
forAll(reverseMap, celli)
{
if (reverseMap[celli] >= 0 && localIndex(celli) != -1)
{
indices.insert(reverseMap[celli]);
}
}
labelList::operator=(indices.sortedToc());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ZoneType, class ZonesType> template<class ZoneType, class ZonesType>
@ -215,6 +234,18 @@ Foam::label Foam::Zone<ZoneType, ZonesType>::localIndex
} }
template<class ZoneType, class ZonesType>
const Foam::Map<Foam::label>& Foam::Zone<ZoneType, ZonesType>::lookupMap() const
{
if (!lookupMapPtr_)
{
calcLookupMap();
}
return *lookupMapPtr_;
}
template<class ZoneType, class ZonesType> template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::clearAddressing() void Foam::Zone<ZoneType, ZonesType>::clearAddressing()
{ {

View File

@ -89,6 +89,9 @@ protected:
//- Construct the look-up map //- Construct the look-up map
void calcLookupMap() const; void calcLookupMap() const;
//- Update the addressing using the maps provided
void topoChange(const labelList& map, const labelList& reverseMap);
public: public:

View File

@ -487,6 +487,29 @@ bool Foam::Zones<ZoneType, ZonesType, MeshType>::checkParallelSync
} }
template<class ZoneType, class ZonesType, class MeshType>
void Foam::Zones<ZoneType, ZonesType, MeshType>::insert
(
const List<labelHashSet>& zonesIndices
)
{
PtrList<ZoneType>& zones = *this;
if (zonesIndices.size() != zones.size())
{
FatalErrorInFunction
<< "zonesIndices.size() " << zonesIndices.size()
<< " != number of zones " << zones.size()
<< exit(FatalError);
}
forAll(zonesIndices, zonei)
{
zones[zonei].insert(zonesIndices[zonei]);
}
}
template<class ZoneType, class ZonesType, class MeshType> template<class ZoneType, class ZonesType, class MeshType>
void Foam::Zones<ZoneType, ZonesType, MeshType>::movePoints(const pointField& p) void Foam::Zones<ZoneType, ZonesType, MeshType>::movePoints(const pointField& p)
{ {

View File

@ -170,6 +170,9 @@ public:
// true if in error. // true if in error.
bool checkParallelSync(const bool report = false) const; bool checkParallelSync(const bool report = false) const;
//- Insert given indices into zones
void insert(const List<labelHashSet>& zonesIndices);
//- Correct zones after moving points //- Correct zones after moving points
virtual void movePoints(const pointField&); virtual void movePoints(const pointField&);

View File

@ -45,15 +45,9 @@ const char * const Foam::cellZone::labelsName = "cellLabels";
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::cellZone::whichCell(const label globalCellID) const
{
return Zone<cellZone, cellZones>::localIndex(globalCellID);
}
bool Foam::cellZone::checkDefinition(const bool report) const bool Foam::cellZone::checkDefinition(const bool report) const
{ {
return Zone<cellZone, cellZones>::checkDefinition return Zone::checkDefinition
( (
zones_.mesh().nCells(), zones_.mesh().nCells(),
report report
@ -63,29 +57,7 @@ bool Foam::cellZone::checkDefinition(const bool report) const
void Foam::cellZone::topoChange(const polyTopoChangeMap& map) void Foam::cellZone::topoChange(const polyTopoChangeMap& map)
{ {
clearAddressing(); Zone::topoChange(map.cellMap(), map.reverseCellMap());
labelHashSet indices;
const labelList& cellMap = map.cellMap();
const labelList& reverseCellMap = map.reverseCellMap();
forAll(cellMap, celli)
{
if (cellMap[celli] >= 0 && localIndex(cellMap[celli]) != -1)
{
indices.insert(celli);
}
}
forAll(reverseCellMap, celli)
{
if (reverseCellMap[celli] >= 0 && localIndex(celli) != -1)
{
indices.insert(reverseCellMap[celli]);
}
}
labelList::operator=(indices.sortedToc());
} }

View File

@ -71,7 +71,7 @@ public:
// Constructors // Constructors
using Zone<cellZone, cellZones>::Zone; using Zone::Zone;
//- Construct and return a clone, resetting the mesh zones //- Construct and return a clone, resetting the mesh zones
virtual autoPtr<cellZone> clone(const cellZones& mz) const virtual autoPtr<cellZone> clone(const cellZones& mz) const
@ -99,9 +99,6 @@ public:
// Member Functions // Member Functions
//- Convenient renaming of zone::localIndex(globalIndex)
label whichCell(const label globalIndex) const;
//- Check zone definition. Return true if in error. //- Check zone definition. Return true if in error.
virtual bool checkDefinition(const bool report = false) const; virtual bool checkDefinition(const bool report = false) const;
@ -121,7 +118,7 @@ public:
// Member Operators // Member Operators
using Zone<cellZone, cellZones>::operator=; using Zone::operator=;
}; };

View File

@ -303,13 +303,7 @@ Foam::faceZone::~faceZone()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::faceZone::whichFace(const label globalFaceID) const const Foam::primitiveFacePatch& Foam::faceZone::patch() const
{
return Zone<faceZone, faceZones>::localIndex(globalFaceID);
}
const Foam::primitiveFacePatch& Foam::faceZone::operator()() const
{ {
if (!patchPtr_) if (!patchPtr_)
{ {
@ -349,7 +343,7 @@ const Foam::labelList& Foam::faceZone::meshEdges() const
mePtr_ = mePtr_ =
new labelList new labelList
( (
operator()().meshEdges patch().meshEdges
( (
zones().mesh().edges(), zones().mesh().edges(),
zones().mesh().pointEdges() zones().mesh().pointEdges()
@ -363,7 +357,7 @@ const Foam::labelList& Foam::faceZone::meshEdges() const
void Foam::faceZone::clearAddressing() void Foam::faceZone::clearAddressing()
{ {
Zone<faceZone, faceZones>::clearAddressing(); Zone::clearAddressing();
deleteDemandDrivenData(patchPtr_); deleteDemandDrivenData(patchPtr_);
@ -388,7 +382,7 @@ void Foam::faceZone::resetAddressing
bool Foam::faceZone::checkDefinition(const bool report) const bool Foam::faceZone::checkDefinition(const bool report) const
{ {
return Zone<faceZone, faceZones>::checkDefinition return Zone::checkDefinition
( (
zones().mesh().faces().size(), zones().mesh().faces().size(),
report report
@ -493,7 +487,7 @@ void Foam::faceZone::insert(const Map<bool>& newIndices)
void Foam::faceZone::swap(faceZone& fz) void Foam::faceZone::swap(faceZone& fz)
{ {
Zone<faceZone, faceZones>::swap(fz); Zone::swap(fz);
flipMap_.swap(fz.flipMap_); flipMap_.swap(fz.flipMap_);
} }
@ -564,14 +558,14 @@ void Foam::faceZone::writeDict(Ostream& os) const
void Foam::faceZone::operator=(const faceZone& zn) void Foam::faceZone::operator=(const faceZone& zn)
{ {
Zone<faceZone, faceZones>::operator=(zn); Zone::operator=(zn);
flipMap_ = zn.flipMap_; flipMap_ = zn.flipMap_;
} }
void Foam::faceZone::operator=(faceZone&& zn) void Foam::faceZone::operator=(faceZone&& zn)
{ {
Zone<faceZone, faceZones>::operator=(move(zn)); Zone::operator=(move(zn));
flipMap_ = move(zn.flipMap_); flipMap_ = move(zn.flipMap_);
} }

View File

@ -207,11 +207,8 @@ public:
return flipMap_; return flipMap_;
} }
//- Convenient renaming of zone::localIndex(globalIndex)
label whichFace(const label globalIndex) const;
//- Return reference to primitive patch //- Return reference to primitive patch
const primitiveFacePatch& operator()() const; const primitiveFacePatch& patch() const;
// Addressing into mesh // Addressing into mesh

View File

@ -46,4 +46,23 @@ Foam::boolList Foam::faceZones::zonesFlipFace
} }
void Foam::faceZones::insert(const List<Map<bool>>& zonesIndices)
{
PtrList<faceZone>& zones = *this;
if (zonesIndices.size() != zones.size())
{
FatalErrorInFunction
<< "zonesIndices.size() " << zonesIndices.size()
<< " != number of zones " << zones.size()
<< exit(FatalError);
}
forAll(zonesIndices, zonei)
{
zones[zonei].insert(zonesIndices[zonei]);
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -61,6 +61,9 @@ public:
const label facei, const label facei,
const labelList& faceiZones const labelList& faceiZones
); );
//- Insert given indices and corresponding face flips into zones
void insert(const List<Map<bool>>& zonesIndices);
}; };

View File

@ -46,15 +46,9 @@ const char* const Foam::pointZone::labelsName = "pointLabels";
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::pointZone::whichPoint(const label globalPointID) const
{
return Zone<pointZone, pointZones>::localIndex(globalPointID);
}
bool Foam::pointZone::checkDefinition(const bool report) const bool Foam::pointZone::checkDefinition(const bool report) const
{ {
return Zone<pointZone, pointZones>::checkDefinition return Zone::checkDefinition
( (
zones_.mesh().points().size(), zones_.mesh().points().size(),
report report
@ -116,29 +110,7 @@ bool Foam::pointZone::checkParallelSync(const bool report) const
void Foam::pointZone::topoChange(const polyTopoChangeMap& map) void Foam::pointZone::topoChange(const polyTopoChangeMap& map)
{ {
clearAddressing(); Zone::topoChange(map.pointMap(), map.reversePointMap());
labelHashSet indices;
const labelList& pointMap = map.pointMap();
const labelList& reversePointMap = map.reversePointMap();
forAll(pointMap, pointi)
{
if (pointMap[pointi] >= 0 && localIndex(pointMap[pointi]) != -1)
{
indices.insert(pointi);
}
}
forAll(reversePointMap, pointi)
{
if (reversePointMap[pointi] >= 0 && localIndex(pointi) != -1)
{
indices.insert(reversePointMap[pointi]);
}
}
labelList::operator=(indices.sortedToc());
} }

View File

@ -73,7 +73,7 @@ public:
// Constructors // Constructors
using Zone<pointZone, pointZones>::Zone; using Zone::Zone;
//- Construct and return a clone, resetting the mesh zones //- Construct and return a clone, resetting the mesh zones
virtual autoPtr<pointZone> clone(const pointZones& mz) const virtual autoPtr<pointZone> clone(const pointZones& mz) const
@ -101,9 +101,6 @@ public:
// Member Functions // Member Functions
//- Convenient renaming of zone::localIndex(globalIndex)
label whichPoint(const label globalIndex) const;
//- Check zone definition. Return true if in error. //- Check zone definition. Return true if in error.
virtual bool checkDefinition(const bool report = false) const; virtual bool checkDefinition(const bool report = false) const;
@ -120,7 +117,7 @@ public:
// Member Operators // Member Operators
using Zone<pointZone, pointZones>::operator=; using Zone::operator=;
}; };

View File

@ -127,7 +127,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
forAll(nearest, i) forAll(nearest, i)
{ {
if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0)) if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
{ {
// Fixed point. Reset to point0 location. // Fixed point. Reset to point0 location.
displacement[i] = points0[meshPoints[i]] - localPoints[i]; displacement[i] = points0[meshPoints[i]] - localPoints[i];
@ -217,7 +217,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
// 3. Choose either -fixed, nearest, right, left. // 3. Choose either -fixed, nearest, right, left.
forAll(displacement, i) forAll(displacement, i)
{ {
if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0)) if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
{ {
// Fixed point. Reset to point0 location. // Fixed point. Reset to point0 location.
displacement[i] = points0[meshPoints[i]] - localPoints[i]; displacement[i] = points0[meshPoints[i]] - localPoints[i];

View File

@ -126,7 +126,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
forAll(nearest, i) forAll(nearest, i)
{ {
if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0)) if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
{ {
// Fixed point. Reset to point0 location. // Fixed point. Reset to point0 location.
displacement[i] = points0[meshPoints[i]] - localPoints[i]; displacement[i] = points0[meshPoints[i]] - localPoints[i];
@ -216,7 +216,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
// 3. Choose either -fixed, nearest, right, left. // 3. Choose either -fixed, nearest, right, left.
forAll(displacement, i) forAll(displacement, i)
{ {
if (zonePtr && (zonePtr->whichPoint(meshPoints[i]) >= 0)) if (zonePtr && (zonePtr->localIndex(meshPoints[i]) >= 0))
{ {
// Fixed point. Reset to point0 location. // Fixed point. Reset to point0 location.
displacement[i] = points0[meshPoints[i]] - localPoints[i]; displacement[i] = points0[meshPoints[i]] - localPoints[i];

View File

@ -155,8 +155,8 @@ void Foam::FacePostProcessing<CloudType>::write()
autoPtr<globalIndex> globalPointsPtr = autoPtr<globalIndex> globalPointsPtr =
mesh.globalData().mergePoints mesh.globalData().mergePoints
( (
fZone().meshPoints(), fZone.patch().meshPoints(),
fZone().meshPointMap(), fZone.patch().meshPointMap(),
pointToGlobal, pointToGlobal,
uniqueMeshPointLabels uniqueMeshPointLabels
); );
@ -166,7 +166,7 @@ void Foam::FacePostProcessing<CloudType>::write()
allProcPoints[proci] = uniquePoints; allProcPoints[proci] = uniquePoints;
Pstream::gatherList(allProcPoints); Pstream::gatherList(allProcPoints);
faceList faces(fZone().localFaces()); faceList faces(fZone.patch().localFaces());
forAll(faces, i) forAll(faces, i)
{ {
inplaceRenumber(pointToGlobal, faces[i]); inplaceRenumber(pointToGlobal, faces[i]);

View File

@ -3210,10 +3210,7 @@ Foam::autoPtr<Foam::polyTopoChangeMap> Foam::meshRefinement::zonify
autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, true); autoPtr<polyTopoChangeMap> map = meshMod.changeMesh(mesh_, true);
// Add the new faces to the faceZones in the merged mesh // Add the new faces to the faceZones in the merged mesh
forAll(faceZonesAddedFaces, zonei) mesh_.faceZones().insert(faceZonesAddedFaces);
{
mesh_.faceZones()[zonei].insert(faceZonesAddedFaces[zonei]);
}
// Update fields // Update fields
mesh_.topoChange(map); mesh_.topoChange(map);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -355,7 +355,7 @@ void Foam::displacementLayeredMotionMotionSolver::cellZoneSolve
// Determine the points of the faceZone within the cellZone // Determine the points of the faceZone within the cellZone
const faceZone& fz = mesh().faceZones()[faceZoneName]; const faceZone& fz = mesh().faceZones()[faceZoneName];
const labelList& fzMeshPoints = fz().meshPoints(); const labelList& fzMeshPoints = fz.patch().meshPoints();
DynamicList<label> meshPoints(fzMeshPoints.size()); DynamicList<label> meshPoints(fzMeshPoints.size());
forAll(fzMeshPoints, i) forAll(fzMeshPoints, i)
{ {

View File

@ -966,7 +966,7 @@ void Foam::domainDecomposition::decompose()
// Multiple zones. Lookup. // Multiple zones. Lookup.
forAll(pz, zoneI) forAll(pz, zoneI)
{ {
label index = pz[zoneI].whichPoint(curPoint); label index = pz[zoneI].localIndex(curPoint);
if (index != -1) if (index != -1)
{ {
@ -1032,7 +1032,7 @@ void Foam::domainDecomposition::decompose()
// Single zone. Add the face // Single zone. Add the face
zoneFaces[zoneI].append(facei); zoneFaces[zoneI].append(facei);
label index = fz[zoneI].whichFace(curF); label index = fz[zoneI].localIndex(curF);
bool flip = fz[zoneI].flipMap()[index]; bool flip = fz[zoneI].flipMap()[index];
@ -1048,7 +1048,7 @@ void Foam::domainDecomposition::decompose()
// Multiple zones. Lookup. // Multiple zones. Lookup.
forAll(fz, zoneI) forAll(fz, zoneI)
{ {
label index = fz[zoneI].whichFace(curF); label index = fz[zoneI].localIndex(curF);
if (index != -1) if (index != -1)
{ {
@ -1120,7 +1120,7 @@ void Foam::domainDecomposition::decompose()
// Multiple zones. Lookup. // Multiple zones. Lookup.
forAll(cz, zoneI) forAll(cz, zoneI)
{ {
label index = cz[zoneI].whichCell(curCelli); label index = cz[zoneI].localIndex(curCelli);
if (index != -1) if (index != -1)
{ {

View File

@ -1644,16 +1644,10 @@ void Foam::addPatchCellLayer::topoChange
void Foam::addPatchCellLayer::updateZones(polyMesh& mesh) void Foam::addPatchCellLayer::updateZones(polyMesh& mesh)
{ {
// Add the pointZones to the merged mesh // Add the pointZones to the merged mesh
forAll(pointZonesAddedPoints_, zonei) mesh.pointZones().insert(pointZonesAddedPoints_);
{
mesh.pointZones()[zonei].insert(pointZonesAddedPoints_[zonei]);
}
// Add the cellZones to the merged mesh // Add the cellZones to the merged mesh
forAll(cellZonesAddedCells_, zonei) mesh.cellZones().insert(cellZonesAddedCells_);
{
mesh.cellZones()[zonei].insert(cellZonesAddedCells_[zonei]);
}
} }

View File

@ -1994,7 +1994,7 @@ Foam::labelPair Foam::edgeCollapser::markFaceZoneEdges
forAll(faces, fI) forAll(faces, fI)
{ {
if (fZone.whichFace(fI) == -1) if (fZone.localIndex(fI) == -1)
{ {
continue; continue;
} }
@ -2080,7 +2080,7 @@ Foam::labelPair Foam::edgeCollapser::markFaceZoneEdges
// else // else
// { // {
// // Keep the edge if an attached face is not in the zone // // Keep the edge if an attached face is not in the zone
// if (fZone.whichFace(eFaceIndex) == -1) // if (fZone.localIndex(eFaceIndex) == -1)
// { // {
// nPatchFaces++; // nPatchFaces++;
// } // }