Removed pointZones directory layer, cosmetics changes to ZoneMesh.

This commit is contained in:
Mark Olesen
2008-05-13 14:14:36 +02:00
parent a3bab325da
commit 8bf1774be0
14 changed files with 83 additions and 97 deletions

View File

@ -348,8 +348,7 @@ faceZone = $(zones)/faceZone
$(faceZone)/faceZone.C
$(faceZone)/newFaceZone.C
pointZones = $(zones)/pointZones
pointZone = $(pointZones)/pointZone
pointZone = $(zones)/pointZone
$(pointZone)/pointZone.C
$(pointZone)/newPointZone.C

View File

@ -27,8 +27,9 @@ Class
Description
A class holds the data needed to identify a zone in a dynamic mesh.
The zone is identified by name. Its index in the zoneMesh is updated
if the mesh has changed.
The zone is identified by name.
Its index in the zoneMesh is updated if the mesh has changed.
\*---------------------------------------------------------------------------*/
@ -44,7 +45,7 @@ Description
namespace Foam
{
template<class ZoneType> class ZoneMesh;
template<class ZoneType, class MeshType> class ZoneMesh;
// Forward declaration of friend functions and operators
@ -74,14 +75,14 @@ public:
// Constructors
//- Construct from name
ZoneID(const word& name, const ZoneMesh<ZoneType>& zm)
ZoneID(const word& name, const ZoneMesh<ZoneType, polyMesh>& zm)
:
name_(name),
index_(zm.findZoneID(name))
{}
//- Construct from Istream
ZoneID(Istream& is, const ZoneMesh<ZoneType>& zm)
ZoneID(Istream& is, const ZoneMesh<ZoneType, polyMesh>& zm)
:
name_(is),
index_(zm.findZoneID(name_))
@ -116,11 +117,11 @@ public:
// Edit
//- Update
void update(const ZoneMesh<ZoneType>& zm)
void update(const ZoneMesh<ZoneType, polyMesh>& zm)
{
index_ = zm.findZoneID(name_);
}
// IOstream Operators

View File

@ -26,9 +26,10 @@ Class
Foam::polyPatchID
Description
A class holds the data needed to identify a patch in a dynamic
mesh. The patch is identified by name and its index in the
boundary mesh is updated if the mesh has changed.
A class holds the data needed to identify a patch in a dynamic mesh.
The patch is identified by name and its index in the boundary mesh
is updated if the mesh has changed.
\*---------------------------------------------------------------------------*/
@ -112,7 +113,7 @@ public:
{
index_ = bm.findPatchID(name_);
}
// Ostream Operator

View File

@ -35,8 +35,8 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ZoneType>
void ZoneMesh<ZoneType>::calcZoneMap() const
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
{
// It is an error to attempt to recalculate cellEdges
// if the pointer is already set
@ -77,8 +77,8 @@ void ZoneMesh<ZoneType>::calcZoneMap() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Read constructor given IOobject and a MeshType reference
template<class ZoneType>
ZoneMesh<ZoneType>::ZoneMesh
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::ZoneMesh
(
const IOobject& io,
const MeshType& mesh
@ -136,8 +136,8 @@ ZoneMesh<ZoneType>::ZoneMesh
// Construct given size. Zones will be set later
template<class ZoneType>
ZoneMesh<ZoneType>::ZoneMesh
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::ZoneMesh
(
const IOobject& io,
const MeshType& mesh,
@ -153,8 +153,8 @@ ZoneMesh<ZoneType>::ZoneMesh
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ZoneType>
ZoneMesh<ZoneType>::~ZoneMesh()
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
{
clearAddressing();
}
@ -163,8 +163,8 @@ ZoneMesh<ZoneType>::~ZoneMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Map of zones for quick zone lookup
template<class ZoneType>
const Map<label>& ZoneMesh<ZoneType>::zoneMap() const
template<class ZoneType, class MeshType>
const Map<label>& ZoneMesh<ZoneType, MeshType>::zoneMap() const
{
if (!zoneMapPtr_)
{
@ -177,8 +177,8 @@ const Map<label>& ZoneMesh<ZoneType>::zoneMap() const
// Given a global object index, return the zone it is in.
// If object does not belong to any zones, return -1
template<class ZoneType>
label ZoneMesh<ZoneType>::whichZone(const label objectIndex) const
template<class ZoneType, class MeshType>
label ZoneMesh<ZoneType, MeshType>::whichZone(const label objectIndex) const
{
const Map<label>& zm = zoneMap();
Map<label>::const_iterator zmIter = zm.find(objectIndex);
@ -195,8 +195,8 @@ label ZoneMesh<ZoneType>::whichZone(const label objectIndex) const
// Return a list of zone names
template<class ZoneType>
wordList ZoneMesh<ZoneType>::types() const
template<class ZoneType, class MeshType>
wordList ZoneMesh<ZoneType, MeshType>::types() const
{
const PtrList<ZoneType>& zones = *this;
@ -212,8 +212,8 @@ wordList ZoneMesh<ZoneType>::types() const
// Return a list of zone names
template<class ZoneType>
wordList ZoneMesh<ZoneType>::names() const
template<class ZoneType, class MeshType>
wordList ZoneMesh<ZoneType, MeshType>::names() const
{
const PtrList<ZoneType>& zones = *this;
@ -228,8 +228,8 @@ wordList ZoneMesh<ZoneType>::names() const
}
template<class ZoneType>
label ZoneMesh<ZoneType>::findZoneID(const word& zoneName) const
template<class ZoneType, class MeshType>
label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const
{
const PtrList<ZoneType>& zones = *this;
@ -255,8 +255,8 @@ label ZoneMesh<ZoneType>::findZoneID(const word& zoneName) const
}
template<class ZoneType>
void ZoneMesh<ZoneType>::clearAddressing()
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::clearAddressing()
{
deleteDemandDrivenData(zoneMapPtr_);
@ -269,8 +269,8 @@ void ZoneMesh<ZoneType>::clearAddressing()
}
template<class ZoneType>
void ZoneMesh<ZoneType>::clear()
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::clear()
{
clearAddressing();
PtrList<ZoneType>::clear();
@ -278,8 +278,8 @@ void ZoneMesh<ZoneType>::clear()
// Check zone definition
template<class ZoneType>
bool ZoneMesh<ZoneType>::checkDefinition(const bool report) const
template<class ZoneType, class MeshType>
bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const
{
bool inError = false;
@ -294,8 +294,8 @@ bool ZoneMesh<ZoneType>::checkDefinition(const bool report) const
// Correct zone mesh after moving points
template<class ZoneType>
void ZoneMesh<ZoneType>::movePoints(const pointField& p)
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
{
PtrList<ZoneType>& zones = *this;
@ -307,8 +307,8 @@ void ZoneMesh<ZoneType>::movePoints(const pointField& p)
// writeData member function required by regIOobject
template<class ZoneType>
bool ZoneMesh<ZoneType>::writeData(Ostream& os) const
template<class ZoneType, class MeshType>
bool ZoneMesh<ZoneType, MeshType>::writeData(Ostream& os) const
{
os << *this;
return os.good();
@ -317,8 +317,8 @@ bool ZoneMesh<ZoneType>::writeData(Ostream& os) const
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ZoneType>
Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType>& zones)
template<class ZoneType, class MeshType>
Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones)
{
os << zones.size() << nl << token::BEGIN_LIST;

View File

@ -27,6 +27,7 @@ Class
Description
List of mesh zones
SourceFiles
ZoneMesh.C
@ -52,16 +53,16 @@ class polyMesh;
// Forward declaration of friend functions and operators
template<class ZoneType> class ZoneMesh;
template<class ZoneType, class MeshType> class ZoneMesh;
template<class ZoneType>
Ostream& operator<<(Ostream&, const ZoneMesh<ZoneType>&);
template<class ZoneType, class MeshType>
Ostream& operator<<(Ostream&, const ZoneMesh<ZoneType, MeshType>&);
/*---------------------------------------------------------------------------*\
Class ZoneMesh Declaration
\*---------------------------------------------------------------------------*/
template<class ZoneType>
template<class ZoneType, class MeshType>
class ZoneMesh
:
public PtrList<ZoneType>,
@ -69,9 +70,6 @@ class ZoneMesh
{
// Private data
//- Typedef in preparation of a second template parameter
typedef polyMesh MeshType;
//- Reference to mesh
const MeshType& mesh_;
@ -85,7 +83,7 @@ class ZoneMesh
ZoneMesh(const ZoneMesh&);
//- Disallow assignment
void operator=(const ZoneMesh<ZoneType>&);
void operator=(const ZoneMesh<ZoneType, MeshType>&);
//- Create zone map
@ -96,7 +94,7 @@ public:
// Constructors
//- Read constructor given IOobject and a MeshType reference
//- Read constructor given IOobject and a mesh reference
ZoneMesh
(
const IOobject&,
@ -159,10 +157,10 @@ public:
// Ostream operator
friend Ostream& operator<< <ZoneType>
friend Ostream& operator<< <ZoneType, MeshType>
(
Ostream&,
const ZoneMesh<ZoneType>&
const ZoneMesh<ZoneType, MeshType>&
);
};

View File

@ -37,10 +37,11 @@ Description
namespace Foam
{
template<class Zone> class ZoneMesh;
template<class Zone, class MeshType> class ZoneMesh;
class cellZone;
class polyMesh;
typedef ZoneMesh<cellZone> cellZoneMesh;
typedef ZoneMesh<cellZone, polyMesh> cellZoneMesh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -37,10 +37,11 @@ Description
namespace Foam
{
template<class Zone> class ZoneMesh;
template<class Zone, class MeshType> class ZoneMesh;
class faceZone;
class polyMesh;
typedef ZoneMesh<faceZone> faceZoneMesh;
typedef ZoneMesh<faceZone, polyMesh> faceZoneMesh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -37,10 +37,11 @@ Description
namespace Foam
{
template<class Zone> class ZoneMesh;
template<class Zone, class MeshType> class ZoneMesh;
class pointZone;
class polyMesh;
typedef ZoneMesh<pointZone> pointZoneMesh;
typedef ZoneMesh<pointZone, polyMesh> pointZoneMesh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,30 +31,27 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
autoPtr<cellZone> cellZone::New
Foam::autoPtr<Foam::cellZone> Foam::cellZone::New
(
const word& name,
const dictionary& dict,
const label index,
const cellZoneMesh& bm
const cellZoneMesh& zm
)
{
if (debug)
{
Info<< "cellZone::New(const word&, const dictionary&, const label, "
"const cellZoneMesh&) : constructing cellZone"
"const cellZoneMesh&) : constructing cellZone " << name
<< endl;
}
word patchType(dict.lookup("type"));
word zoneType(dict.lookup("type"));
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(patchType);
dictionaryConstructorTablePtr_->find(zoneType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
@ -63,18 +60,16 @@ autoPtr<cellZone> cellZone::New
"cellZone::New(const word&, const dictionary&, "
"const label, const cellZoneMesh&)",
dict
) << "Unknown cellZone type " << patchType << endl << endl
) << "Unknown cellZone type " << zoneType << endl << endl
<< "Valid cellZone types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalIOError);
}
return autoPtr<cellZone>(cstrIter()(name, dict, index, bm));
return autoPtr<cellZone>(cstrIter()(name, dict, index, zm));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,30 +31,27 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
autoPtr<faceZone> faceZone::New
Foam::autoPtr<Foam::faceZone> Foam::faceZone::New
(
const word& name,
const dictionary& dict,
const label index,
const faceZoneMesh& bm
const faceZoneMesh& zm
)
{
if (debug)
{
Info<< "faceZone::New(const word&, const dictionary&, const label, "
"const faceZoneMesh&) : constructing faceZone"
"const faceZoneMesh&) : constructing faceZone " << name
<< endl;
}
word patchType(dict.lookup("type"));
word zoneType(dict.lookup("type"));
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(patchType);
dictionaryConstructorTablePtr_->find(zoneType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
@ -63,18 +60,16 @@ autoPtr<faceZone> faceZone::New
"faceZone::New(const word&, const dictionary&, "
"const label, const faceZoneMesh&)",
dict
) << "Unknown faceZone type " << patchType << endl << endl
) << "Unknown faceZone type " << zoneType << endl << endl
<< "Valid faceZone types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalIOError);
}
return autoPtr<faceZone>(cstrIter()(name, dict, index, bm));
return autoPtr<faceZone>(cstrIter()(name, dict, index, zm));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,30 +31,27 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
autoPtr<pointZone> pointZone::New
Foam::autoPtr<Foam::pointZone> Foam::pointZone::New
(
const word& name,
const dictionary& dict,
const label index,
const pointZoneMesh& bm
const pointZoneMesh& zm
)
{
if (debug)
{
Info<< "pointZone::New(const word&, const dictionary&, const label, "
"const pointZoneMesh&) : constructing pointZone"
"const pointZoneMesh&) : constructing pointZone " << name
<< endl;
}
word patchType(dict.lookup("type"));
word zoneType(dict.lookup("type"));
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(patchType);
dictionaryConstructorTablePtr_->find(zoneType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
@ -63,18 +60,15 @@ autoPtr<pointZone> pointZone::New
"pointZone::New(const word&, const dictionary&, "
"const label, const pointZoneMesh&)",
dict
) << "Unknown pointZone type " << patchType << endl << endl
) << "Unknown pointZone type " << zoneType << endl << endl
<< "Valid pointZone types are :" << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalIOError);
}
return autoPtr<pointZone>(cstrIter()(name, dict, index, bm));
return autoPtr<pointZone>(cstrIter()(name, dict, index, zm));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //