minor adjustments to zone and {cell,face,point}Zones classes

- added static data member with the name associated with the zone-labels
     eg, cellLabels, etc.
  This will be useful when reading the files directly.
This commit is contained in:
Mark Olesen
2009-09-17 15:44:43 +02:00
parent 7c9b7192b4
commit c69fe0e28f
8 changed files with 52 additions and 30 deletions

View File

@ -37,11 +37,11 @@ License
namespace Foam
{
defineTypeNameAndDebug(cellZone, 0);
defineRunTimeSelectionTable(cellZone, dictionary);
addToRunTimeSelectionTable(cellZone, cellZone, dictionary);
}
const char * const Foam::cellZone::labelsName = "cellLabels";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -79,7 +79,7 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm
)
:
zone("cell", name, dict, index),
zone(name, dict, this->labelsName, index),
zoneMesh_(zm)
{}
@ -140,7 +140,7 @@ void Foam::cellZone::writeDict(Ostream& os) const
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("cellLabels", os);
writeEntry(this->labelsName, os);
os << token::END_BLOCK << endl;
}
@ -148,10 +148,10 @@ void Foam::cellZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::cellZone::operator=(const cellZone& cz)
void Foam::cellZone::operator=(const cellZone& zn)
{
clearAddressing();
labelList::operator=(cz);
labelList::operator=(zn);
}
@ -164,10 +164,10 @@ void Foam::cellZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& cz)
Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& zn)
{
cz.write(os);
os.check("Ostream& operator<<(Ostream& os, const cellZone& cz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const cellZone&");
return os;
}

View File

@ -81,6 +81,12 @@ protected:
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("cellZone");

View File

@ -42,6 +42,8 @@ namespace Foam
addToRunTimeSelectionTable(faceZone, faceZone, dictionary);
}
const char* const Foam::faceZone::labelsName = "faceLabels";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faceZone::calcFaceZonePatch() const
@ -218,7 +220,7 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm
)
:
zone("face", name, dict, index),
zone(name, dict, this->labelsName, index),
flipMap_(dict.lookup("flipMap")),
zoneMesh_(zm),
patchPtr_(NULL),
@ -531,7 +533,7 @@ void Foam::faceZone::writeDict(Ostream& os) const
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("faceLabels", os);
writeEntry(this->labelsName, os);
flipMap().writeEntry("flipMap", os);
os << token::END_BLOCK << endl;
@ -540,10 +542,10 @@ void Foam::faceZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& fz)
Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& zn)
{
fz.write(os);
os.check("Ostream& operator<<(Ostream& os, const faceZone& fz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const faceZone&");
return os;
}

View File

@ -60,13 +60,17 @@ Ostream& operator<<(Ostream&, const faceZone&);
/*---------------------------------------------------------------------------*\
Class faceZone Declaration
Class faceZone Declaration
\*---------------------------------------------------------------------------*/
class faceZone
:
public zone
{
// Private data
//- The name associated with the zone-labels dictionary entry
static const word labelsName_;
protected:
@ -118,6 +122,12 @@ protected:
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("faceZone");
@ -283,7 +293,7 @@ public:
virtual void movePoints(const pointField&);
//- Update for changes in topology
virtual void updateMesh(const mapPolyMesh& mpm);
virtual void updateMesh(const mapPolyMesh&);
//- Write
virtual void write(Ostream&) const;
@ -291,7 +301,6 @@ public:
//- Write dictionary
virtual void writeDict(Ostream&) const;
// I-O
//- Ostream Operator

View File

@ -40,6 +40,7 @@ namespace Foam
addToRunTimeSelectionTable(pointZone, pointZone, dictionary);
}
const char* const Foam::pointZone::labelsName = "pointLabels";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -77,7 +78,7 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm
)
:
zone("point", name, dict, index),
zone(name, dict, this->labelsName, index),
zoneMesh_(zm)
{}
@ -139,7 +140,7 @@ void Foam::pointZone::writeDict(Ostream& os) const
os << nl << name_ << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("pointLabels", os);
writeEntry(this->labelsName, os);
os << token::END_BLOCK << endl;
}
@ -147,10 +148,10 @@ void Foam::pointZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointZone::operator=(const pointZone& pz)
void Foam::pointZone::operator=(const pointZone& zn)
{
clearAddressing();
labelList::operator=(pz);
labelList::operator=(zn);
}
@ -163,10 +164,10 @@ void Foam::pointZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& pz)
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& zn)
{
pz.write(os);
os.check("Ostream& operator<<(Ostream& os, const pointZone& pz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const pointZone&");
return os;
}

View File

@ -58,7 +58,7 @@ Ostream& operator<<(Ostream&, const pointZone&);
/*---------------------------------------------------------------------------*\
Class pointZone Declaration
Class pointZone Declaration
\*---------------------------------------------------------------------------*/
class pointZone
@ -68,20 +68,24 @@ class pointZone
protected:
// Private data
// Protected data
//- Reference to zone list
const pointZoneMesh& zoneMesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
pointZone(const pointZone&);
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("pointZone");

View File

@ -115,13 +115,13 @@ Foam::zone::zone
Foam::zone::zone
(
const word& zoneType,
const word& name,
const dictionary& dict,
const word& labelsName,
const label index
)
:
labelList(dict.lookup(zoneType + "Labels")),
labelList(dict.lookup(labelsName)),
name_(name),
index_(index),
lookupMapPtr_(NULL)

View File

@ -117,9 +117,9 @@ public:
//- Construct from dictionary
zone
(
const word& zoneType,
const word& name,
const dictionary&,
const word& labelsName,
const label index
);