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()
{
// Add the cellZones to the merged mesh
forAll(cellZonesAddedCells_, zonei)
{
mesh_.cellZones()[zonei].insert(cellZonesAddedCells_[zonei]);
}
mesh_.cellZones().insert(cellZonesAddedCells_);
}

View File

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

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -672,7 +672,7 @@ void ensightPointField
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
labelList pointToGlobal;
@ -680,8 +680,8 @@ void ensightPointField
autoPtr<globalIndex> globalPointsPtr =
mesh.globalData().mergePoints
(
fz().meshPoints(),
fz().meshPointMap(),
fz.patch().meshPoints(),
fz.patch().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels
);

View File

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

View File

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

View File

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