Zone: New templated replacement for zone

This allows more functionality from the cellZone, faceZone and pointZone derived
classes to be moved into the base class.
This commit is contained in:
Henry Weller
2024-03-26 12:25:42 +00:00
parent a833a81560
commit ca2cae8c38
22 changed files with 285 additions and 271 deletions

View File

@ -19,7 +19,7 @@ Notes for fluentMeshToFoam with zone preservation
- Zones are simple lists of label lists that can be accessed from polyMesh - Zones are simple lists of label lists that can be accessed from polyMesh
with the cellZones(), faceZones() and pointZones() member functions 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"]; const labelList& thisCellZone = mesh.cellZones()["thisZoneName"];
- Zone integrity is preserved during mesh modification and decompomposition. - Zone integrity is preserved during mesh modification and decompomposition.

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
@ -61,7 +61,7 @@ void printMesh(const Time& runTime, const polyMesh& mesh)
template<class ZoneType> template<class ZoneType>
void removeZone void removeZone
( (
MeshZones<ZoneType, polyMesh>& zones, Zones<ZoneType, polyMesh>& zones,
const word& setName const word& setName
) )
{ {

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
@ -366,7 +366,7 @@ class vtkPVFoam
template<class ZoneType> template<class ZoneType>
wordList getZoneNames wordList getZoneNames
( (
const MeshZones<ZoneType, polyMesh>& const Zones<ZoneType, polyMesh>&
) const; ) const;
//- Add objects of Type to paraview array selection //- Add objects of Type to paraview array selection

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
@ -77,12 +77,12 @@ void Foam::vtkPVFoam::convertSurfaceField
// For interior faces: average owner/neighbour // For interior faces: average owner/neighbour
// For boundary faces: owner // For boundary faces: owner
forAll(faceLabels, facei) forAll(faceLabels, i)
{ {
const label faceNo = faceLabels[facei]; const label facei = faceLabels[i];
if (faceNo < nInternalFaces) 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<nComp; ++d) for (direction d=0; d<nComp; ++d)
{ {
@ -91,7 +91,10 @@ void Foam::vtkPVFoam::convertSurfaceField
} }
else else
{ {
const Type& t = tf[faceOwner[faceNo]]; const label patchi = mesh.boundaryMesh().whichPatch(facei);
const label pFacei = mesh.boundaryMesh()[patchi].whichFace(facei);
const Type& t = tf.boundaryField()[patchi][pFacei];
for (direction d=0; d<nComp; ++d) for (direction d=0; d<nComp; ++d)
{ {
vec[d] = component(t, d); vec[d] = component(t, d);
@ -99,7 +102,7 @@ void Foam::vtkPVFoam::convertSurfaceField
} }
vtkOpenFOAMTupleRemap<Type>(vec); vtkOpenFOAMTupleRemap<Type>(vec);
cellData->InsertTuple(facei, vec); cellData->InsertTuple(i, vec);
} }
@ -157,21 +160,18 @@ void Foam::vtkPVFoam::convertSurfaceField
) = fvs; ) = fvs;
} }
forAll(faceLabels, i)
// For interior faces: average owner/neighbour
// For boundary faces: owner
forAll(faceLabels, facei)
{ {
const label faceNo = faceLabels[facei]; const label facei = faceLabels[i];
float vec[nComp]; float vec[nComp];
for (direction d=0; d<nComp; ++d) for (direction d=0; d<nComp; ++d)
{ {
vec[d] = component(flatFld[faceNo], d); vec[d] = component(flatFld[facei], d);
} }
vtkOpenFOAMTupleRemap<Type>(vec); vtkOpenFOAMTupleRemap<Type>(vec);
cellData->InsertTuple(facei, vec); cellData->InsertTuple(i, vec);
} }
vtkPolyData::SafeDownCast vtkPolyData::SafeDownCast

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
@ -84,7 +84,7 @@ public:
template<class ZoneType> template<class ZoneType>
Foam::wordList Foam::vtkPVFoam::getZoneNames Foam::wordList Foam::vtkPVFoam::getZoneNames
( (
const MeshZones<ZoneType, polyMesh>& zmesh const Zones<ZoneType, polyMesh>& zmesh
) const ) const
{ {
wordList names(zmesh.size()); wordList names(zmesh.size());

View File

@ -511,7 +511,6 @@ $(polyMesh)/polyMeshTetDecomposition/polyMeshTetDecomposition.C
$(polyMesh)/polyMeshTetDecomposition/tetIndices.C $(polyMesh)/polyMeshTetDecomposition/tetIndices.C
zone = $(polyMesh)/zones/zone zone = $(polyMesh)/zones/zone
$(zone)/zone.C
cellZone = $(polyMesh)/zones/cellZone cellZone = $(polyMesh)/zones/cellZone
$(cellZone)/cellZone.C $(cellZone)/cellZone.C

View File

@ -23,22 +23,15 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "zone.H" #include "Zone.H"
#include "IOstream.H" #include "IOstream.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "HashSet.H" #include "HashSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(zone, 0);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
const Foam::Map<Foam::label>& Foam::zone::lookupMap() const template<class ZoneType, class ZonesType>
const Foam::Map<Foam::label>& Foam::Zone<ZoneType, ZonesType>::lookupMap() const
{ {
if (!lookupMapPtr_) if (!lookupMapPtr_)
{ {
@ -49,13 +42,9 @@ const Foam::Map<Foam::label>& Foam::zone::lookupMap() const
} }
void Foam::zone::calcLookupMap() const template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::calcLookupMap() const
{ {
if (debug)
{
InfoInFunction << "Calculating lookup map" << endl;
}
if (lookupMapPtr_) if (lookupMapPtr_)
{ {
FatalErrorInFunction FatalErrorInFunction
@ -72,80 +61,91 @@ void Foam::zone::calcLookupMap() const
{ {
lm.insert(indices[i], i); lm.insert(indices[i], i);
} }
if (debug)
{
InfoInFunction << "Finished calculating lookup map" << endl;
}
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::zone::zone template<class ZoneType, class ZonesType>
Foam::Zone<ZoneType, ZonesType>::Zone
( (
const word& name, const word& name,
const labelUList& indices const labelUList& indices,
const ZonesType& zones
) )
: :
labelList(indices), labelList(indices),
name_(name), name_(name),
zones_(zones),
lookupMapPtr_(nullptr) lookupMapPtr_(nullptr)
{} {}
Foam::zone::zone template<class ZoneType, class ZonesType>
Foam::Zone<ZoneType, ZonesType>::Zone
( (
const word& name, const word& name,
labelList&& indices labelList&& indices,
const ZonesType& zones
) )
: :
labelList(move(indices)), labelList(move(indices)),
name_(name), name_(name),
zones_(zones),
lookupMapPtr_(nullptr) lookupMapPtr_(nullptr)
{} {}
Foam::zone::zone template<class ZoneType, class ZonesType>
Foam::Zone<ZoneType, ZonesType>::Zone
( (
const word& name, const word& name,
const dictionary& dict, const dictionary& dict,
const word& labelsName const word& labelsName,
const ZonesType& zones
) )
: :
labelList(dict.lookup(labelsName)), labelList(dict.lookup(labelsName)),
name_(name), name_(name),
zones_(zones),
lookupMapPtr_(nullptr) lookupMapPtr_(nullptr)
{} {}
Foam::zone::zone template<class ZoneType, class ZonesType>
Foam::Zone<ZoneType, ZonesType>::Zone
( (
const zone& z, const Zone& z,
const labelUList& indices const labelUList& indices,
const ZonesType& zones
) )
: :
labelList(indices), labelList(indices),
name_(z.name()), name_(z.name()),
zones_(zones),
lookupMapPtr_(nullptr) lookupMapPtr_(nullptr)
{} {}
Foam::zone::zone template<class ZoneType, class ZonesType>
Foam::Zone<ZoneType, ZonesType>::Zone
( (
const zone& z, const Zone& z,
labelList&& indices labelList&& indices,
const ZonesType& zones
) )
: :
labelList(move(indices)), labelList(move(indices)),
name_(z.name()), name_(z.name()),
zones_(zones),
lookupMapPtr_(nullptr) lookupMapPtr_(nullptr)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::zone::~zone() template<class ZoneType, class ZonesType>
Foam::Zone<ZoneType, ZonesType>::~Zone()
{ {
clearAddressing(); clearAddressing();
} }
@ -153,7 +153,18 @@ Foam::zone::~zone()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::zone::localIndex(const label globalIndex) const template<class ZoneType, class ZonesType>
const ZonesType& Foam::Zone<ZoneType, ZonesType>::meshZones() const
{
return zones_;
}
template<class ZoneType, class ZonesType>
Foam::label Foam::Zone<ZoneType, ZonesType>::localIndex
(
const label globalIndex
) const
{ {
const Map<label>& lm = lookupMap(); const Map<label>& lm = lookupMap();
@ -170,13 +181,19 @@ Foam::label Foam::zone::localIndex(const label globalIndex) const
} }
void Foam::zone::clearAddressing() template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::clearAddressing()
{ {
deleteDemandDrivenData(lookupMapPtr_); deleteDemandDrivenData(lookupMapPtr_);
} }
bool Foam::zone::checkDefinition(const label maxSize, const bool report) const template<class ZoneType, class ZonesType>
bool Foam::Zone<ZoneType, ZonesType>::checkDefinition
(
const label maxSize,
const bool report
) const
{ {
const labelList& indices = *this; const labelList& indices = *this;
@ -220,7 +237,8 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
} }
void Foam::zone::insert(const labelHashSet& newIndices) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::insert(const labelHashSet& newIndices)
{ {
labelHashSet indices(*this); labelHashSet indices(*this);
indices.insert(newIndices); indices.insert(newIndices);
@ -228,26 +246,30 @@ void Foam::zone::insert(const labelHashSet& newIndices)
} }
void Foam::zone::swap(zone& z) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::swap(Zone& z)
{ {
clearAddressing(); clearAddressing();
labelList::swap(z); labelList::swap(z);
} }
void Foam::zone::mapMesh(const polyMeshMap&) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::mapMesh(const polyMeshMap&)
{ {
clearAddressing(); clearAddressing();
} }
void Foam::zone::distribute(const polyDistributionMap&) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::distribute(const polyDistributionMap&)
{ {
clearAddressing(); clearAddressing();
} }
void Foam::zone::write(Ostream& os) const template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::write(Ostream& os) const
{ {
os << nl << name_ os << nl << name_
<< nl << static_cast<const labelList&>(*this); << nl << static_cast<const labelList&>(*this);
@ -256,28 +278,32 @@ void Foam::zone::write(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::zone::operator=(const zone& zn) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::operator=(const Zone& zn)
{ {
clearAddressing(); clearAddressing();
labelList::operator=(zn); labelList::operator=(zn);
} }
void Foam::zone::operator=(zone&& zn) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::operator=(Zone&& zn)
{ {
clearAddressing(); clearAddressing();
labelList::operator=(move(zn)); labelList::operator=(move(zn));
} }
void Foam::zone::operator=(const labelUList& indices) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::operator=(const labelUList& indices)
{ {
clearAddressing(); clearAddressing();
labelList::operator=(indices); labelList::operator=(indices);
} }
void Foam::zone::operator=(labelList&& indices) template<class ZoneType, class ZonesType>
void Foam::Zone<ZoneType, ZonesType>::operator=(labelList&& indices)
{ {
clearAddressing(); clearAddressing();
labelList::operator=(move(indices)); labelList::operator=(move(indices));
@ -286,10 +312,11 @@ void Foam::zone::operator=(labelList&& indices)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const zone& z) template<class ZoneType, class ZonesType>
Foam::Ostream& Foam::operator<<(Ostream& os, const Zone<ZoneType, ZonesType>& z)
{ {
z.write(os); z.write(os);
os.check("Ostream& operator<<(Ostream& f, const zone& z"); os.check("Ostream& operator<<(Ostream& f, const Zone& z");
return os; return os;
} }

View File

@ -22,18 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::zone Foam::Zone
Description Description
Base class for zones Base class for zones
SourceFiles SourceFiles
zone.C Zone.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef zone_H #ifndef Zone_H
#define zone_H #define Zone_H
#include "labelList.H" #include "labelList.H"
#include "typeInfo.H" #include "typeInfo.H"
@ -52,14 +52,17 @@ class polyTopoChangeMap;
class polyMeshMap; class polyMeshMap;
class polyDistributionMap; class polyDistributionMap;
class zone; template<class ZoneType, class ZonesType> class Zone;
Ostream& operator<<(Ostream&, const zone&);
template<class ZoneType, class ZonesType>
Ostream& operator<<(Ostream&, const Zone<ZoneType, ZonesType>&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class zone Declaration Class Zone Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class zone template<class ZoneType, class ZonesType>
class Zone
: :
public labelList public labelList
{ {
@ -71,6 +74,9 @@ protected:
//- Name of zone //- Name of zone
word name_; word name_;
//- Reference to zone list
const ZonesType& zones_;
// Demand-driven private data // Demand-driven private data
@ -86,56 +92,57 @@ protected:
public: public:
//- Runtime type information
TypeName("zone");
// Constructors // Constructors
//- Construct from components //- Construct from components
zone Zone
( (
const word& name, const word& name,
const labelUList& indices const labelUList& indices,
const ZonesType& zones
); );
//- Construct from components, moving contents //- Construct from components, moving contents
zone Zone
( (
const word& name, const word& name,
labelList&& indices labelList&& indices,
const ZonesType& zones
); );
//- Construct from dictionary //- Construct from dictionary
zone Zone
( (
const word& name, const word& name,
const dictionary&, const dictionary&,
const word& labelsName const word& labelsName,
const ZonesType& zones
); );
//- Construct given the original zone and resetting the //- Construct given the original zone and resetting the
// cell list and mesh zones information // cell list and mesh zones information
zone Zone
( (
const zone&, const Zone&,
const labelUList& indices const labelUList& indices,
const ZonesType& zones
); );
//- Construct given the original zone, resetting the //- Construct given the original zone, resetting the
// cell list and mesh zones information // cell list and mesh zones information
zone Zone
( (
const zone&, const Zone&,
labelList&& indices labelList&& indices,
const ZonesType& zones
); );
//- Disallow default bitwise copy construction //- Disallow default bitwise copy construction
zone(const zone&) = delete; Zone(const Zone&) = delete;
//- Destructor //- Destructor
virtual ~zone(); virtual ~Zone();
// Member Functions // Member Functions
@ -146,6 +153,9 @@ public:
return name_; return name_;
} }
//- Return ZonesType reference
const ZonesType& meshZones() const;
//- Map storing the local index for every global index. Used to find //- Map storing the local index for every global index. Used to find
// the index of the item in the zone from the known global index. If // the index of the item in the zone from the known global index. If
// the item is not in the zone, returns -1 // the item is not in the zone, returns -1
@ -171,7 +181,7 @@ public:
void insert(const labelHashSet& newIndices); void insert(const labelHashSet& newIndices);
//- Swap two zones //- Swap two zones
void swap(zone&); void swap(Zone&);
//- Correct patch after moving points //- Correct patch after moving points
virtual void movePoints(const pointField&) virtual void movePoints(const pointField&)
@ -196,10 +206,10 @@ public:
// Member Operators // Member Operators
//- Assignment operator //- Assignment operator
void operator=(const zone&); void operator=(const Zone&);
//- Move assignment operator //- Move assignment operator
void operator=(zone&&); void operator=(Zone&&);
//- Assignment operator to indices //- Assignment operator to indices
void operator=(const labelUList&); void operator=(const labelUList&);
@ -211,7 +221,11 @@ public:
// I-O // I-O
//- Ostream Operator //- Ostream Operator
friend Ostream& operator<<(Ostream&, const zone&); friend Ostream& operator<< <ZoneType, ZonesType>
(
Ostream&,
const Zone<ZoneType, ZonesType>&
);
}; };
@ -221,6 +235,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "Zone.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -23,14 +23,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "MeshZones.H" #include "Zones.H"
#include "Pstream.H" #include "Pstream.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
bool Foam::MeshZones<ZoneType, MeshType>::read() bool Foam::Zones<ZoneType, MeshType>::read()
{ {
if if
( (
@ -72,7 +72,7 @@ bool Foam::MeshZones<ZoneType, MeshType>::read()
// Check state of IOstream // Check state of IOstream
is.check is.check
( (
"MeshZones::MeshZones" "Zones::Zones"
"(const IOobject&, const MeshType&)" "(const IOobject&, const MeshType&)"
); );
@ -91,7 +91,7 @@ bool Foam::MeshZones<ZoneType, MeshType>::read()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::MeshZones<ZoneType, MeshType>::MeshZones Foam::Zones<ZoneType, MeshType>::Zones
( (
const IOobject& io, const IOobject& io,
const MeshType& mesh const MeshType& mesh
@ -106,7 +106,7 @@ Foam::MeshZones<ZoneType, MeshType>::MeshZones
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::MeshZones<ZoneType, MeshType>::MeshZones Foam::Zones<ZoneType, MeshType>::Zones
( (
const IOobject& io, const IOobject& io,
const MeshType& mesh, const MeshType& mesh,
@ -123,7 +123,7 @@ Foam::MeshZones<ZoneType, MeshType>::MeshZones
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::MeshZones<ZoneType, MeshType>::MeshZones Foam::Zones<ZoneType, MeshType>::Zones
( (
const IOobject& io, const IOobject& io,
const MeshType& mesh, const MeshType& mesh,
@ -150,7 +150,7 @@ Foam::MeshZones<ZoneType, MeshType>::MeshZones
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::MeshZones<ZoneType, MeshType>::~MeshZones() Foam::Zones<ZoneType, MeshType>::~Zones()
{ {
clearAddressing(); clearAddressing();
} }
@ -159,7 +159,7 @@ Foam::MeshZones<ZoneType, MeshType>::~MeshZones()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
bool Foam::MeshZones<ZoneType, MeshType>::found(const label objectIndex) const bool Foam::Zones<ZoneType, MeshType>::found(const label objectIndex) const
{ {
forAll(*this, zi) forAll(*this, zi)
{ {
@ -174,7 +174,7 @@ bool Foam::MeshZones<ZoneType, MeshType>::found(const label objectIndex) const
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::labelList Foam::MeshZones<ZoneType, MeshType>::whichZones Foam::labelList Foam::Zones<ZoneType, MeshType>::whichZones
( (
const label objectIndex const label objectIndex
) const ) const
@ -194,7 +194,7 @@ Foam::labelList Foam::MeshZones<ZoneType, MeshType>::whichZones
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::boolList Foam::MeshZones<ZoneType, MeshType>::zonesFlipFace Foam::boolList Foam::Zones<ZoneType, MeshType>::zonesFlipFace
( (
const label facei, const label facei,
const labelList& faceiZones const labelList& faceiZones
@ -214,7 +214,7 @@ Foam::boolList Foam::MeshZones<ZoneType, MeshType>::zonesFlipFace
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::wordList Foam::MeshZones<ZoneType, MeshType>::types() const Foam::wordList Foam::Zones<ZoneType, MeshType>::types() const
{ {
const PtrList<ZoneType>& zones = *this; const PtrList<ZoneType>& zones = *this;
@ -230,7 +230,7 @@ Foam::wordList Foam::MeshZones<ZoneType, MeshType>::types() const
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::wordList Foam::MeshZones<ZoneType, MeshType>::names() const Foam::wordList Foam::Zones<ZoneType, MeshType>::names() const
{ {
const PtrList<ZoneType>& zones = *this; const PtrList<ZoneType>& zones = *this;
@ -246,7 +246,7 @@ Foam::wordList Foam::MeshZones<ZoneType, MeshType>::names() const
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
bool Foam::MeshZones<ZoneType, MeshType>::found bool Foam::Zones<ZoneType, MeshType>::found
( (
const word& zoneName const word& zoneName
) const ) const
@ -268,7 +268,7 @@ bool Foam::MeshZones<ZoneType, MeshType>::found
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::label Foam::MeshZones<ZoneType, MeshType>::findIndex Foam::label Foam::Zones<ZoneType, MeshType>::findIndex
( (
const word& zoneName const word& zoneName
) const ) const
@ -297,7 +297,7 @@ Foam::label Foam::MeshZones<ZoneType, MeshType>::findIndex
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::labelList Foam::MeshZones<ZoneType, MeshType>::findIndices Foam::labelList Foam::Zones<ZoneType, MeshType>::findIndices
( (
const wordRe& key const wordRe& key
) const ) const
@ -330,7 +330,7 @@ Foam::labelList Foam::MeshZones<ZoneType, MeshType>::findIndices
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Foam::PackedBoolList Foam::MeshZones<ZoneType, MeshType>::findMatching Foam::PackedBoolList Foam::Zones<ZoneType, MeshType>::findMatching
( (
const wordRe& key const wordRe& key
) const ) const
@ -348,10 +348,10 @@ Foam::PackedBoolList Foam::MeshZones<ZoneType, MeshType>::findMatching
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::append(ZoneType* zonePtr) const void Foam::Zones<ZoneType, MeshType>::append(ZoneType* zonePtr) const
{ {
MeshZones<ZoneType, MeshType>& zones = Zones<ZoneType, MeshType>& zones =
const_cast<MeshZones<ZoneType, MeshType>&>(*this); const_cast<Zones<ZoneType, MeshType>&>(*this);
if (found(zonePtr->name())) if (found(zonePtr->name()))
{ {
@ -366,10 +366,10 @@ void Foam::MeshZones<ZoneType, MeshType>::append(ZoneType* zonePtr) const
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::append(const ZoneType& zone) const void Foam::Zones<ZoneType, MeshType>::append(const ZoneType& zone) const
{ {
MeshZones<ZoneType, MeshType>& zones = Zones<ZoneType, MeshType>& zones =
const_cast<MeshZones<ZoneType, MeshType>&>(*this); const_cast<Zones<ZoneType, MeshType>&>(*this);
if (found(zone.name())) if (found(zone.name()))
{ {
@ -383,7 +383,7 @@ void Foam::MeshZones<ZoneType, MeshType>::append(const ZoneType& zone) const
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::clearAddressing() void Foam::Zones<ZoneType, MeshType>::clearAddressing()
{ {
PtrList<ZoneType>& zones = *this; PtrList<ZoneType>& zones = *this;
@ -395,7 +395,7 @@ void Foam::MeshZones<ZoneType, MeshType>::clearAddressing()
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::clear() void Foam::Zones<ZoneType, MeshType>::clear()
{ {
clearAddressing(); clearAddressing();
PtrList<ZoneType>::clear(); PtrList<ZoneType>::clear();
@ -403,7 +403,7 @@ void Foam::MeshZones<ZoneType, MeshType>::clear()
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
bool Foam::MeshZones<ZoneType, MeshType>::checkDefinition bool Foam::Zones<ZoneType, MeshType>::checkDefinition
( (
const bool report const bool report
) const ) const
@ -421,7 +421,7 @@ bool Foam::MeshZones<ZoneType, MeshType>::checkDefinition
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
bool Foam::MeshZones<ZoneType, MeshType>::checkParallelSync bool Foam::Zones<ZoneType, MeshType>::checkParallelSync
( (
const bool report const bool report
) const ) const
@ -499,7 +499,7 @@ bool Foam::MeshZones<ZoneType, MeshType>::checkParallelSync
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::movePoints(const pointField& p) void Foam::Zones<ZoneType, MeshType>::movePoints(const pointField& p)
{ {
PtrList<ZoneType>& zones = *this; PtrList<ZoneType>& zones = *this;
@ -511,7 +511,7 @@ void Foam::MeshZones<ZoneType, MeshType>::movePoints(const pointField& p)
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::topoChange void Foam::Zones<ZoneType, MeshType>::topoChange
( (
const polyTopoChangeMap& map const polyTopoChangeMap& map
) )
@ -526,7 +526,7 @@ void Foam::MeshZones<ZoneType, MeshType>::topoChange
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::mapMesh(const polyMeshMap& map) void Foam::Zones<ZoneType, MeshType>::mapMesh(const polyMeshMap& map)
{ {
PtrList<ZoneType>& zones = *this; PtrList<ZoneType>& zones = *this;
@ -538,7 +538,7 @@ void Foam::MeshZones<ZoneType, MeshType>::mapMesh(const polyMeshMap& map)
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::distribute void Foam::Zones<ZoneType, MeshType>::distribute
( (
const polyDistributionMap& map const polyDistributionMap& map
) )
@ -553,7 +553,7 @@ void Foam::MeshZones<ZoneType, MeshType>::distribute
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
void Foam::MeshZones<ZoneType, MeshType>::swap(MeshZones& otherZones) void Foam::Zones<ZoneType, MeshType>::swap(Zones& otherZones)
{ {
clearAddressing(); clearAddressing();
otherZones.clearAddressing(); otherZones.clearAddressing();
@ -602,7 +602,7 @@ void Foam::MeshZones<ZoneType, MeshType>::swap(MeshZones& otherZones)
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
bool Foam::MeshZones<ZoneType, MeshType>::writeData(Ostream& os) const bool Foam::Zones<ZoneType, MeshType>::writeData(Ostream& os) const
{ {
os << *this; os << *this;
return os.good(); return os.good();
@ -612,7 +612,7 @@ bool Foam::MeshZones<ZoneType, MeshType>::writeData(Ostream& os) const
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
const ZoneType& Foam::MeshZones<ZoneType, MeshType>::operator[] const ZoneType& Foam::Zones<ZoneType, MeshType>::operator[]
( (
const word& zoneName const word& zoneName
) const ) const
@ -632,7 +632,7 @@ const ZoneType& Foam::MeshZones<ZoneType, MeshType>::operator[]
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
ZoneType& Foam::MeshZones<ZoneType, MeshType>::operator[] ZoneType& Foam::Zones<ZoneType, MeshType>::operator[]
( (
const word& zoneName const word& zoneName
) )
@ -657,7 +657,7 @@ template<class ZoneType, class MeshType>
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<
( (
Ostream& os, Ostream& os,
const MeshZones<ZoneType, MeshType>& zones const Zones<ZoneType, MeshType>& zones
) )
{ {
os << zones.size() << nl << token::BEGIN_LIST; os << zones.size() << nl << token::BEGIN_LIST;

View File

@ -22,18 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::MeshZones Foam::Zones
Description Description
A list of mesh zones. A list of mesh zones.
SourceFiles SourceFiles
MeshZones.C Zones.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef MeshZones_H #ifndef Zones_H
#define MeshZones_H #define Zones_H
#include "regIOobject.H" #include "regIOobject.H"
#include "pointField.H" #include "pointField.H"
@ -54,17 +54,17 @@ class polyTopoChangeMap;
class polyMeshMap; class polyMeshMap;
class polyDistributionMap; class polyDistributionMap;
template<class ZoneType, class MeshType> class MeshZones; template<class ZoneType, class MeshType> class Zones;
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
Ostream& operator<<(Ostream&, const MeshZones<ZoneType, MeshType>&); Ostream& operator<<(Ostream&, const Zones<ZoneType, MeshType>&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class MeshZones Declaration Class Zones Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ZoneType, class MeshType> template<class ZoneType, class MeshType>
class MeshZones class Zones
: :
public PtrList<ZoneType>, public PtrList<ZoneType>,
public regIOobject public regIOobject
@ -86,14 +86,14 @@ public:
// Constructors // Constructors
//- Read constructor given IOobject and a MeshType reference //- Read constructor given IOobject and a MeshType reference
MeshZones Zones
( (
const IOobject&, const IOobject&,
const MeshType& const MeshType&
); );
//- Construct given size //- Read constructor if file present otherwise from size
MeshZones Zones
( (
const IOobject&, const IOobject&,
const MeshType&, const MeshType&,
@ -101,7 +101,7 @@ public:
); );
//- Construct given a PtrList //- Construct given a PtrList
MeshZones Zones
( (
const IOobject&, const IOobject&,
const MeshType&, const MeshType&,
@ -109,14 +109,14 @@ public:
); );
//- Move constructor //- Move constructor
MeshZones(MeshZones&&) = default; Zones(Zones&&) = default;
//- Disallow default bitwise copy construction //- Disallow default bitwise copy construction
MeshZones(const MeshZones&) = delete; Zones(const Zones&) = delete;
//- Destructor //- Destructor
~MeshZones(); ~Zones();
// Member Functions // Member Functions
@ -192,7 +192,7 @@ public:
//- Swap zones //- Swap zones
// For run-time mesh replacement and mesh to mesh mapping // For run-time mesh replacement and mesh to mesh mapping
void swap(MeshZones&); void swap(Zones&);
//- writeData member function required by regIOobject //- writeData member function required by regIOobject
bool writeData(Ostream&) const; bool writeData(Ostream&) const;
@ -210,7 +210,7 @@ public:
ZoneType& operator[](const word&); ZoneType& operator[](const word&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const MeshZones<ZoneType, MeshType>&) = delete; void operator=(const Zones<ZoneType, MeshType>&) = delete;
// Ostream operator // Ostream operator
@ -218,7 +218,7 @@ public:
friend Ostream& operator<< <ZoneType, MeshType> friend Ostream& operator<< <ZoneType, MeshType>
( (
Ostream&, Ostream&,
const MeshZones<ZoneType, MeshType>& const Zones<ZoneType, MeshType>&
); );
}; };
@ -230,7 +230,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "MeshZones.C" #include "Zones.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ Description
#ifndef meshCellZones_H #ifndef meshCellZones_H
#define meshCellZones_H #define meshCellZones_H
#include "MeshZones.H" #include "Zones.H"
#include "cellZone.H" #include "cellZone.H"
#include "meshCellZonesFwd.H" #include "meshCellZonesFwd.H"

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-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Typedef
Foam::meshCellZones Foam::meshCellZones
Description Description
A MeshZones with the type cellZone A Zones with the type cellZone
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -36,11 +36,11 @@ Description
namespace Foam namespace Foam
{ {
template<class Zone, class MeshType> class MeshZones; template<class Zone, class MeshType> class Zones;
class cellZone; class cellZone;
class polyMesh; class polyMesh;
typedef MeshZones<cellZone, polyMesh> meshCellZones; typedef Zones<cellZone, polyMesh> meshCellZones;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ Description
#ifndef meshFaceZones_H #ifndef meshFaceZones_H
#define meshFaceZones_H #define meshFaceZones_H
#include "MeshZones.H" #include "Zones.H"
#include "faceZone.H" #include "faceZone.H"
#include "meshFaceZonesFwd.H" #include "meshFaceZonesFwd.H"

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-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,22 +25,33 @@ Typedef
Foam::meshFaceZones Foam::meshFaceZones
Description Description
A MeshZones with the type faceZone A Zones with the type faceZone
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef meshFaceZonesFwd_H #ifndef meshFaceZonesFwd_H
#define meshFaceZonesFwd_H #define meshFaceZonesFwd_H
#include "Zones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
template<class Zone, class MeshType> class MeshZones; template<class Zone, class MeshType> class Zones;
class faceZone; class faceZone;
class polyMesh; class polyMesh;
typedef MeshZones<faceZone, polyMesh> meshFaceZones; typedef Zones<faceZone, polyMesh> meshFaceZones;
// class meshFaceZones
// :
// public Zones<faceZone, polyMesh>
// {
// public:
// using Zones<faceZone, polyMesh>::Zones;
// };
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ Description
#ifndef meshPointZones_H #ifndef meshPointZones_H
#define meshPointZones_H #define meshPointZones_H
#include "MeshZones.H" #include "Zones.H"
#include "pointZone.H" #include "pointZone.H"
#include "meshPointZonesFwd.H" #include "meshPointZonesFwd.H"

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-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Typedef
Foam::meshPointZones Foam::meshPointZones
Description Description
A MeshZones with the type pointZone A Zones with the type pointZone
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -36,11 +36,11 @@ Description
namespace Foam namespace Foam
{ {
template<class Zone, class MeshType> class MeshZones; template<class Zone, class MeshType> class Zones;
class pointZone; class pointZone;
class polyMesh; class polyMesh;
typedef MeshZones<pointZone, polyMesh> meshPointZones; typedef Zones<pointZone, polyMesh> meshPointZones;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -49,8 +49,7 @@ Foam::cellZone::cellZone
const meshCellZones& mz const meshCellZones& mz
) )
: :
zone(name, addr), Zone<cellZone, meshCellZones>(name, addr, mz)
meshZones_(mz)
{} {}
@ -61,8 +60,7 @@ Foam::cellZone::cellZone
const meshCellZones& mz const meshCellZones& mz
) )
: :
zone(name, move(addr)), Zone<cellZone, meshCellZones>(name, move(addr), mz)
meshZones_(mz)
{} {}
@ -73,8 +71,7 @@ Foam::cellZone::cellZone
const meshCellZones& mz const meshCellZones& mz
) )
: :
zone(name, dict, this->labelsName), Zone<cellZone, meshCellZones>(name, dict, this->labelsName, mz)
meshZones_(mz)
{} {}
@ -85,8 +82,7 @@ Foam::cellZone::cellZone
const meshCellZones& mz const meshCellZones& mz
) )
: :
zone(cz, addr), Zone<cellZone, meshCellZones>(cz, addr, mz)
meshZones_(mz)
{} {}
@ -97,8 +93,7 @@ Foam::cellZone::cellZone
const meshCellZones& mz const meshCellZones& mz
) )
: :
zone(cz, move(addr)), Zone<cellZone, meshCellZones>(cz, move(addr), mz)
meshZones_(mz)
{} {}
@ -112,19 +107,17 @@ Foam::cellZone::~cellZone()
Foam::label Foam::cellZone::whichCell(const label globalCellID) const Foam::label Foam::cellZone::whichCell(const label globalCellID) const
{ {
return zone::localIndex(globalCellID); return Zone<cellZone, meshCellZones>::localIndex(globalCellID);
}
const Foam::meshCellZones& Foam::cellZone::meshZones() const
{
return meshZones_;
} }
bool Foam::cellZone::checkDefinition(const bool report) const bool Foam::cellZone::checkDefinition(const bool report) const
{ {
return zone::checkDefinition(meshZones_.mesh().nCells(), report); return Zone<cellZone, meshCellZones>::checkDefinition
(
zones_.mesh().nCells(),
report
);
} }
@ -171,13 +164,13 @@ void Foam::cellZone::writeDict(Ostream& os) const
void Foam::cellZone::operator=(const cellZone& zn) void Foam::cellZone::operator=(const cellZone& zn)
{ {
zone::operator=(zn); Zone<cellZone, meshCellZones>::operator=(zn);
} }
void Foam::cellZone::operator=(cellZone&& zn) void Foam::cellZone::operator=(cellZone&& zn)
{ {
zone::operator=(move(zn)); Zone<cellZone, meshCellZones>::operator=(move(zn));
} }

View File

@ -41,7 +41,7 @@ SourceFiles
#ifndef cellZone_H #ifndef cellZone_H
#define cellZone_H #define cellZone_H
#include "zone.H" #include "Zone.H"
#include "meshCellZonesFwd.H" #include "meshCellZonesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,19 +55,13 @@ namespace Foam
class cellZone class cellZone
: :
public zone public Zone<cellZone, meshCellZones>
{ {
protected:
// Protected data
//- Reference to zone list
const meshCellZones& meshZones_;
public: public:
typedef meshCellZones ZonesType;
// Static Data Members // Static Data Members
//- The name associated with the zone-labels dictionary entry //- The name associated with the zone-labels dictionary entry
@ -187,9 +181,6 @@ public:
//- Convenient renaming of zone::localIndex(globalIndex) //- Convenient renaming of zone::localIndex(globalIndex)
label whichCell(const label globalIndex) const; label whichCell(const label globalIndex) const;
//- Return meshZones reference
const meshCellZones& meshZones() 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;
@ -209,7 +200,7 @@ public:
// Member Operators // Member Operators
using zone::operator=; using Zone<cellZone, meshCellZones>::operator=;
//- Assignment to zone, clearing demand-driven data //- Assignment to zone, clearing demand-driven data
void operator=(const cellZone&); void operator=(const cellZone&);

View File

@ -205,9 +205,8 @@ Foam::faceZone::faceZone
const meshFaceZones& mz const meshFaceZones& mz
) )
: :
zone(name, addr), Zone<faceZone, meshFaceZones>(name, addr, mz),
flipMap_(fm), flipMap_(fm),
meshZones_(mz),
patchPtr_(nullptr), patchPtr_(nullptr),
masterCellsPtr_(nullptr), masterCellsPtr_(nullptr),
slaveCellsPtr_(nullptr), slaveCellsPtr_(nullptr),
@ -225,9 +224,8 @@ Foam::faceZone::faceZone
const meshFaceZones& mz const meshFaceZones& mz
) )
: :
zone(name, move(addr)), Zone<faceZone, meshFaceZones>(name, move(addr), mz),
flipMap_(move(fm)), flipMap_(move(fm)),
meshZones_(mz),
patchPtr_(nullptr), patchPtr_(nullptr),
masterCellsPtr_(nullptr), masterCellsPtr_(nullptr),
slaveCellsPtr_(nullptr), slaveCellsPtr_(nullptr),
@ -244,9 +242,8 @@ Foam::faceZone::faceZone
const meshFaceZones& mz const meshFaceZones& mz
) )
: :
zone(name, dict, this->labelsName), Zone<faceZone, meshFaceZones>(name, dict, this->labelsName, mz),
flipMap_(dict.lookup("flipMap")), flipMap_(dict.lookup("flipMap")),
meshZones_(mz),
patchPtr_(nullptr), patchPtr_(nullptr),
masterCellsPtr_(nullptr), masterCellsPtr_(nullptr),
slaveCellsPtr_(nullptr), slaveCellsPtr_(nullptr),
@ -264,9 +261,8 @@ Foam::faceZone::faceZone
const meshFaceZones& mz const meshFaceZones& mz
) )
: :
zone(fz, addr), Zone<faceZone, meshFaceZones>(fz, addr, mz),
flipMap_(fm), flipMap_(fm),
meshZones_(mz),
patchPtr_(nullptr), patchPtr_(nullptr),
masterCellsPtr_(nullptr), masterCellsPtr_(nullptr),
slaveCellsPtr_(nullptr), slaveCellsPtr_(nullptr),
@ -284,9 +280,8 @@ Foam::faceZone::faceZone
const meshFaceZones& mz const meshFaceZones& mz
) )
: :
zone(fz, move(addr)), Zone<faceZone, meshFaceZones>(fz, move(addr), mz),
flipMap_(move(fm)), flipMap_(move(fm)),
meshZones_(mz),
patchPtr_(nullptr), patchPtr_(nullptr),
masterCellsPtr_(nullptr), masterCellsPtr_(nullptr),
slaveCellsPtr_(nullptr), slaveCellsPtr_(nullptr),
@ -306,15 +301,9 @@ Foam::faceZone::~faceZone()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::meshFaceZones& Foam::faceZone::meshZones() const
{
return meshZones_;
}
Foam::label Foam::faceZone::whichFace(const label globalFaceID) const Foam::label Foam::faceZone::whichFace(const label globalFaceID) const
{ {
return zone::localIndex(globalFaceID); return Zone<faceZone, meshFaceZones>::localIndex(globalFaceID);
} }
@ -372,7 +361,7 @@ const Foam::labelList& Foam::faceZone::meshEdges() const
void Foam::faceZone::clearAddressing() void Foam::faceZone::clearAddressing()
{ {
zone::clearAddressing(); Zone<faceZone, meshFaceZones>::clearAddressing();
deleteDemandDrivenData(patchPtr_); deleteDemandDrivenData(patchPtr_);
@ -397,7 +386,11 @@ void Foam::faceZone::resetAddressing
bool Foam::faceZone::checkDefinition(const bool report) const bool Foam::faceZone::checkDefinition(const bool report) const
{ {
return zone::checkDefinition(meshZones().mesh().faces().size(), report); return Zone<faceZone, meshFaceZones>::checkDefinition
(
meshZones().mesh().faces().size(),
report
);
} }
@ -498,7 +491,7 @@ void Foam::faceZone::insert(const Map<bool>& newIndices)
void Foam::faceZone::swap(faceZone& fz) void Foam::faceZone::swap(faceZone& fz)
{ {
zone::swap(fz); Zone<faceZone, meshFaceZones>::swap(fz);
flipMap_.swap(fz.flipMap_); flipMap_.swap(fz.flipMap_);
} }
@ -577,14 +570,14 @@ void Foam::faceZone::writeDict(Ostream& os) const
void Foam::faceZone::operator=(const faceZone& zn) void Foam::faceZone::operator=(const faceZone& zn)
{ {
zone::operator=(zn); Zone<faceZone, meshFaceZones>::operator=(zn);
flipMap_ = zn.flipMap_; flipMap_ = zn.flipMap_;
} }
void Foam::faceZone::operator=(faceZone&& zn) void Foam::faceZone::operator=(faceZone&& zn)
{ {
zone::operator=(move(zn)); Zone<faceZone, meshFaceZones>::operator=(move(zn));
flipMap_ = move(zn.flipMap_); flipMap_ = move(zn.flipMap_);
} }

View File

@ -40,7 +40,7 @@ SourceFiles
#ifndef faceZone_H #ifndef faceZone_H
#define faceZone_H #define faceZone_H
#include "zone.H" #include "Zone.H"
#include "meshFaceZonesFwd.H" #include "meshFaceZonesFwd.H"
#include "boolList.H" #include "boolList.H"
#include "primitiveFacePatch.H" #include "primitiveFacePatch.H"
@ -62,7 +62,7 @@ Ostream& operator<<(Ostream&, const faceZone&);
class faceZone class faceZone
: :
public zone public Zone<faceZone, meshFaceZones>
{ {
// Private Data // Private Data
@ -78,9 +78,6 @@ protected:
// face needs to be flipped to achieve the correct orientation. // face needs to be flipped to achieve the correct orientation.
boolList flipMap_; boolList flipMap_;
//- Reference to zone list
const meshFaceZones& meshZones_;
// Demand-driven private data // Demand-driven private data
@ -117,6 +114,8 @@ protected:
public: public:
typedef meshFaceZones ZonesType;
// Static Data Members // Static Data Members
//- The name associated with the zone-labels dictionary entry //- The name associated with the zone-labels dictionary entry
@ -250,9 +249,6 @@ public:
//- Return reference to primitive patch //- Return reference to primitive patch
const primitiveFacePatch& operator()() const; const primitiveFacePatch& operator()() const;
//- Return meshZones reference
const meshFaceZones& meshZones() const;
// Addressing into mesh // Addressing into mesh

View File

@ -50,8 +50,7 @@ Foam::pointZone::pointZone
const meshPointZones& mz const meshPointZones& mz
) )
: :
zone(name, addr), Zone<pointZone, meshPointZones>(name, addr, mz)
meshZones_(mz)
{} {}
@ -62,8 +61,7 @@ Foam::pointZone::pointZone
const meshPointZones& mz const meshPointZones& mz
) )
: :
zone(name, move(addr)), Zone<pointZone, meshPointZones>(name, move(addr), mz)
meshZones_(mz)
{} {}
@ -74,8 +72,7 @@ Foam::pointZone::pointZone
const meshPointZones& mz const meshPointZones& mz
) )
: :
zone(name, dict, this->labelsName), Zone<pointZone, meshPointZones>(name, dict, this->labelsName, mz)
meshZones_(mz)
{} {}
@ -86,8 +83,7 @@ Foam::pointZone::pointZone
const meshPointZones& mz const meshPointZones& mz
) )
: :
zone(pz, addr), Zone<pointZone, meshPointZones>(pz, addr, mz)
meshZones_(mz)
{} {}
@ -98,8 +94,7 @@ Foam::pointZone::pointZone
const meshPointZones& mz const meshPointZones& mz
) )
: :
zone(pz, move(addr)), Zone<pointZone, meshPointZones>(pz, move(addr), mz)
meshZones_(mz)
{} {}
@ -111,21 +106,19 @@ Foam::pointZone::~pointZone()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::meshPointZones& Foam::pointZone::meshZones() const
{
return meshZones_;
}
Foam::label Foam::pointZone::whichPoint(const label globalPointID) const Foam::label Foam::pointZone::whichPoint(const label globalPointID) const
{ {
return zone::localIndex(globalPointID); return Zone<pointZone, meshPointZones>::localIndex(globalPointID);
} }
bool Foam::pointZone::checkDefinition(const bool report) const bool Foam::pointZone::checkDefinition(const bool report) const
{ {
return zone::checkDefinition(meshZones_.mesh().points().size(), report); return Zone<pointZone, meshPointZones>::checkDefinition
(
zones_.mesh().points().size(),
report
);
} }
@ -133,7 +126,7 @@ bool Foam::pointZone::checkParallelSync(const bool report) const
{ {
const polyMesh& mesh = meshZones().mesh(); const polyMesh& mesh = meshZones().mesh();
const label index = meshZones_.findIndex(name()); const label index = zones_.findIndex(name());
labelList maxZone(mesh.nPoints(), -1); labelList maxZone(mesh.nPoints(), -1);
labelList minZone(mesh.nPoints(), labelMax); labelList minZone(mesh.nPoints(), labelMax);
@ -224,13 +217,13 @@ void Foam::pointZone::writeDict(Ostream& os) const
void Foam::pointZone::operator=(const pointZone& zn) void Foam::pointZone::operator=(const pointZone& zn)
{ {
zone::operator=(zn); Zone<pointZone, meshPointZones>::operator=(zn);
} }
void Foam::pointZone::operator=(pointZone&& zn) void Foam::pointZone::operator=(pointZone&& zn)
{ {
zone::operator=(move(zn)); Zone<pointZone, meshPointZones>::operator=(move(zn));
} }

View File

@ -42,7 +42,7 @@ SourceFiles
#ifndef pointZone_H #ifndef pointZone_H
#define pointZone_H #define pointZone_H
#include "zone.H" #include "Zone.H"
#include "meshPointZonesFwd.H" #include "meshPointZonesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,19 +56,13 @@ namespace Foam
class pointZone class pointZone
: :
public zone public Zone<pointZone, meshPointZones>
{ {
protected:
// Protected data
//- Reference to zone list
const meshPointZones& meshZones_;
public: public:
typedef meshPointZones ZonesType;
// Static Data Members // Static Data Members
//- The name associated with the zone-labels dictionary entry //- The name associated with the zone-labels dictionary entry
@ -185,9 +179,6 @@ public:
// Member Functions // Member Functions
//- Return meshZones reference
const meshPointZones& meshZones() const;
//- Convenient renaming of zone::localIndex(globalIndex) //- Convenient renaming of zone::localIndex(globalIndex)
label whichPoint(const label globalIndex) const; label whichPoint(const label globalIndex) const;
@ -207,7 +198,7 @@ public:
// Member Operators // Member Operators
using zone::operator=; using Zone<pointZone, meshPointZones>::operator=;
//- Assignment to zone, clearing demand-driven data //- Assignment to zone, clearing demand-driven data
void operator=(const pointZone&); void operator=(const pointZone&);