diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt b/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt index 7de0629fc0..e23a55c652 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/README.txt @@ -19,7 +19,7 @@ Notes for fluentMeshToFoam with zone preservation - Zones are simple lists of label lists that can be accessed from polyMesh with the cellZones(), faceZones() and pointZones() member functions - - Example (Members from polyMesh.H and MeshZones.H): + - Example (Members from polyMesh.H and Zones.H): const labelList& thisCellZone = mesh.cellZones()["thisZoneName"]; - Zone integrity is preserved during mesh modification and decompomposition. diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C index 6b97ba3d2e..9f8d63deef 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C +++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C @@ -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 @@ -61,7 +61,7 @@ void printMesh(const Time& runTime, const polyMesh& mesh) template void removeZone ( - MeshZones& zones, + Zones& zones, const word& setName ) { diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.H b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.H index 74e3d19ca1..474259884b 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.H +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.H @@ -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 @@ -366,7 +366,7 @@ class vtkPVFoam template wordList getZoneNames ( - const MeshZones& + const Zones& ) const; //- Add objects of Type to paraview array selection diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamSurfaceField.H b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamSurfaceField.H index ca5ec24a25..30c2d32a6c 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamSurfaceField.H +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamSurfaceField.H @@ -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 @@ -77,12 +77,12 @@ void Foam::vtkPVFoam::convertSurfaceField // For interior faces: average owner/neighbour // For boundary faces: owner - forAll(faceLabels, facei) + forAll(faceLabels, i) { - const label faceNo = faceLabels[facei]; - if (faceNo < nInternalFaces) + const label facei = faceLabels[i]; + if (facei < nInternalFaces) { - Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]); + const Type t = 0.5*(tf[faceOwner[facei]] + tf[faceNeigh[facei]]); for (direction d=0; d(vec); - cellData->InsertTuple(facei, vec); + cellData->InsertTuple(i, vec); } @@ -157,21 +160,18 @@ void Foam::vtkPVFoam::convertSurfaceField ) = fvs; } - - // For interior faces: average owner/neighbour - // For boundary faces: owner - forAll(faceLabels, facei) + forAll(faceLabels, i) { - const label faceNo = faceLabels[facei]; + const label facei = faceLabels[i]; float vec[nComp]; for (direction d=0; d(vec); - cellData->InsertTuple(facei, vec); + cellData->InsertTuple(i, vec); } vtkPolyData::SafeDownCast diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C index 7e08feb464..49e933c03f 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoamUpdateInfo.C @@ -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 @@ -84,7 +84,7 @@ public: template Foam::wordList Foam::vtkPVFoam::getZoneNames ( - const MeshZones& zmesh + const Zones& zmesh ) const { wordList names(zmesh.size()); diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 9acb88c724..6cb0dc655d 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -511,7 +511,6 @@ $(polyMesh)/polyMeshTetDecomposition/polyMeshTetDecomposition.C $(polyMesh)/polyMeshTetDecomposition/tetIndices.C zone = $(polyMesh)/zones/zone -$(zone)/zone.C cellZone = $(polyMesh)/zones/cellZone $(cellZone)/cellZone.C diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C b/src/OpenFOAM/meshes/polyMesh/zones/Zone/Zone.C similarity index 62% rename from src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C rename to src/OpenFOAM/meshes/polyMesh/zones/Zone/Zone.C index 710ab84b7b..a1ad80c7dc 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/Zone/Zone.C @@ -23,22 +23,15 @@ License \*---------------------------------------------------------------------------*/ -#include "zone.H" +#include "Zone.H" #include "IOstream.H" #include "demandDrivenData.H" #include "HashSet.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(zone, 0); -} - - // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -const Foam::Map& Foam::zone::lookupMap() const +template +const Foam::Map& Foam::Zone::lookupMap() const { if (!lookupMapPtr_) { @@ -49,13 +42,9 @@ const Foam::Map& Foam::zone::lookupMap() const } -void Foam::zone::calcLookupMap() const +template +void Foam::Zone::calcLookupMap() const { - if (debug) - { - InfoInFunction << "Calculating lookup map" << endl; - } - if (lookupMapPtr_) { FatalErrorInFunction @@ -72,80 +61,91 @@ void Foam::zone::calcLookupMap() const { lm.insert(indices[i], i); } - - if (debug) - { - InfoInFunction << "Finished calculating lookup map" << endl; - } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::zone::zone +template +Foam::Zone::Zone ( const word& name, - const labelUList& indices + const labelUList& indices, + const ZonesType& zones ) : labelList(indices), name_(name), + zones_(zones), lookupMapPtr_(nullptr) {} -Foam::zone::zone +template +Foam::Zone::Zone ( const word& name, - labelList&& indices + labelList&& indices, + const ZonesType& zones ) : labelList(move(indices)), name_(name), + zones_(zones), lookupMapPtr_(nullptr) {} -Foam::zone::zone +template +Foam::Zone::Zone ( const word& name, const dictionary& dict, - const word& labelsName + const word& labelsName, + const ZonesType& zones ) : labelList(dict.lookup(labelsName)), name_(name), + zones_(zones), lookupMapPtr_(nullptr) {} -Foam::zone::zone +template +Foam::Zone::Zone ( - const zone& z, - const labelUList& indices + const Zone& z, + const labelUList& indices, + const ZonesType& zones ) : labelList(indices), name_(z.name()), + zones_(zones), lookupMapPtr_(nullptr) {} -Foam::zone::zone +template +Foam::Zone::Zone ( - const zone& z, - labelList&& indices + const Zone& z, + labelList&& indices, + const ZonesType& zones ) : labelList(move(indices)), name_(z.name()), + zones_(zones), lookupMapPtr_(nullptr) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::zone::~zone() +template +Foam::Zone::~Zone() { clearAddressing(); } @@ -153,7 +153,18 @@ Foam::zone::~zone() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::label Foam::zone::localIndex(const label globalIndex) const +template +const ZonesType& Foam::Zone::meshZones() const +{ + return zones_; +} + + +template +Foam::label Foam::Zone::localIndex +( + const label globalIndex +) const { const Map