inspired by MeshObject - added coordinateSystems::New selector

This commit is contained in:
Mark Olesen
2008-10-29 15:00:50 +01:00
parent 59821d6094
commit 0a8286b8ed
23 changed files with 242 additions and 299 deletions

View File

@ -72,7 +72,7 @@ Foam::porousZone::porousZone
mesh_(mesh),
dict_(dict),
cellZoneID_(mesh_.cellZones().findZoneID(name)),
coordSys_(dict),
coordSys_(dict, mesh),
porosity_(1),
C0_(0),
C1_(0),
@ -372,25 +372,21 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (dict_.found("porosity"))
{
os.writeKeyword("porosity")
<< porosity()
<< token::END_STATEMENT << nl;
os.writeKeyword("porosity") << porosity() << token::END_STATEMENT << nl;
}
if (dict_.found("powerLaw"))
// powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{
const dictionary& subDict = dict_.subDict("powerLaw");
os << indent << "powerLaw";
subDict.write(os);
dictPtr->write(os);
}
if (dict_.found("Darcy"))
// Darcy-Forchheimer coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
{
const dictionary& subDict = dict_.subDict("Darcy");
os << indent << "Darcy";
subDict.write(os);
dictPtr->write(os);
}
os << decrIndent << indent << token::END_BLOCK << endl;

View File

@ -104,7 +104,7 @@ class porousZone
//- Cell zone ID
label cellZoneID_;
//- Coordinate system (Cartesian)
//- Coordinate system used for the zone (Cartesian)
coordinateSystem coordSys_;
//- porosity of the zone (0 < porosity <= 1)
@ -189,7 +189,7 @@ public:
// Constructors
//- Construct from components
porousZone(const word&, const fvMesh&, const dictionary&);
porousZone(const word& name, const fvMesh&, const dictionary&);
//- Return clone
autoPtr<porousZone> clone() const
@ -199,12 +199,8 @@ public:
}
//- Return a pointer to a new porousZone created on freestore
// from Istream
// Has the ability to rewrite coordinate systems as required
//- Return pointer to new porousZone created on freestore from Istream
class iNew
:
public coordinateSystems
{
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
@ -213,13 +209,6 @@ public:
iNew(const fvMesh& mesh)
:
coordinateSystems(),
mesh_(mesh)
{}
iNew(const fvMesh& mesh, const coordinateSystems& cs)
:
coordinateSystems(cs),
mesh_(mesh)
{}
@ -227,7 +216,6 @@ public:
{
word name(is);
dictionary dict(is);
rewriteDict(dict, true);
return autoPtr<porousZone>(new porousZone(name, mesh_, dict));
}

View File

@ -35,35 +35,8 @@ namespace Foam
defineTemplateTypeNameAndDebug(IOPtrList<porousZone>, 0);
}
//! @cond localscope
const Foam::word typeName("porousZones");
//! @endcond localscope
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousZones::porousZones
(
const fvMesh& mesh,
const coordinateSystems& cs
)
:
IOPtrList<porousZone>
(
IOobject
(
typeName,
mesh.time().constant(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
porousZone::iNew(mesh)
),
mesh_(mesh),
csList_(cs)
{}
Foam::porousZones::porousZones
(
const fvMesh& mesh
@ -73,35 +46,17 @@ Foam::porousZones::porousZones
(
IOobject
(
typeName,
"porousZones",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
porousZone::iNew(mesh)
),
mesh_(mesh),
csList_(mesh)
{
clear();
mesh_(mesh)
{}
IOPtrList<porousZone> newList
(
IOobject
(
"porousZones",
mesh_.time().constant(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false // Don't register new zones with objectRegistry
),
porousZone::iNew(mesh_, csList_)
);
transfer(newList);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -138,21 +93,21 @@ bool Foam::porousZones::readData(Istream& is)
{
clear();
IOPtrList<porousZone> newList
IOPtrList<porousZone> newLst
(
IOobject
(
typeName,
"porousZones",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Don't register new zones with objectRegistry
false // Don't re-register new zones with objectRegistry
),
porousZone::iNew(mesh_, csList_)
porousZone::iNew(mesh_)
);
transfer(newList);
transfer(newLst);
return is.good();
}

View File

@ -40,7 +40,7 @@ Description
cat1
{
coordinateSystem system_10;
porosity 0.781;
porosity 0.781;
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
@ -84,9 +84,6 @@ class porousZones
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
//- Reference to constant coordinate systems
coordinateSystems csList_;
// Private Member Functions
//- Disallow default bitwise copy construct
@ -104,12 +101,9 @@ public:
// Constructors
//- Construct from fvMesh and coordinate systems list
porousZones(const fvMesh& mesh, const coordinateSystems& cs);
//- Construct from fvMesh
// with automatically constructed coordinate systems list
porousZones(const fvMesh& mesh);
porousZones(const fvMesh&);
// Member Functions

View File

@ -78,11 +78,11 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
cartesianCS(const word& name, const dictionary& dict);
cartesianCS(const word& name, const dictionary&);
};

View File

@ -120,7 +120,7 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation
:
coordinateRotation()
{
calcTransform( phiAngle, thetaAngle, psiAngle, inDegrees );
calcTransform(phiAngle, thetaAngle, psiAngle, inDegrees);
}

View File

@ -74,7 +74,7 @@ class EulerCoordinateRotation
const scalar phiAngle,
const scalar thetaAngle,
const scalar psiAngle,
const bool inDegrees = true
const bool inDegrees=true
);
@ -93,7 +93,7 @@ public:
EulerCoordinateRotation
(
const vector& phiThetaPsi,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from components of rotation vector
@ -102,7 +102,7 @@ public:
const scalar phiAngle,
const scalar thetaAngle,
const scalar psiAngle,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from dictionary

View File

@ -121,7 +121,7 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
:
coordinateRotation()
{
calcTransform( rotZ, rotX, rotY, inDegrees );
calcTransform(rotZ, rotX, rotY, inDegrees);
}

View File

@ -71,7 +71,7 @@ class STARCDCoordinateRotation
const scalar rotZ,
const scalar rotX,
const scalar rotY,
const bool inDegrees = true
const bool inDegrees=true
);
@ -90,7 +90,7 @@ public:
STARCDCoordinateRotation
(
const vector& rotZrotXrotY,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from components of rotation vector
@ -99,7 +99,7 @@ public:
const scalar rotZ,
const scalar rotX,
const scalar rotY,
const bool inDegrees = true
const bool inDegrees=true
);
//- Construct from dictionary

View File

@ -26,6 +26,7 @@ License
#include "IOstream.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -81,6 +82,22 @@ Foam::coordinateSystem::coordinateSystem
{}
Foam::coordinateSystem::coordinateSystem
(
const word& name,
const dictionary& dict
)
:
name_(name),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
{
operator=(dict);
}
Foam::coordinateSystem::coordinateSystem
(
const dictionary& dict
@ -98,17 +115,55 @@ Foam::coordinateSystem::coordinateSystem
Foam::coordinateSystem::coordinateSystem
(
const word& name,
const dictionary& dict
const dictionary& dict,
const objectRegistry& obr
)
:
name_(name),
name_(type()),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
{
operator=(dict);
const entry* entryPtr = dict.lookupEntryPtr(typeName_(), false, false);
// a simple entry is a lookup into global coordinateSystems
if (entryPtr && !entryPtr->isDict())
{
word csName;
entryPtr->stream() >> csName;
const coordinateSystems& csLst = coordinateSystems::New(obr);
label csId = csLst.find(csName);
if (debug)
{
Info<< "coordinateSystem::coordinateSystem"
"(const dictionary&, const objectRegistry&):"
<< nl << "using global coordinate system: "
<< csName << "=" << csId << endl;
}
if (csId < 0)
{
FatalErrorIn
(
"coordinateSystem::coordinateSystem"
"(const dictionary&, const objectRegistry&)"
) << "could not find coordinate system: " << csName << nl
<< "available coordinate systems: " << csLst.toc() << nl << nl
<< exit(FatalError);
}
// copy coordinateSystem, but assign the name as the typeName
// to avoid strange things in writeDict()
operator=(csLst[csId]);
name_ = typeName_();
}
else
{
operator=(dict);
}
}
@ -125,7 +180,6 @@ Foam::coordinateSystem::coordinateSystem(Istream& is)
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coordinateSystem::~coordinateSystem()
@ -231,8 +285,7 @@ Foam::tmp<Foam::vectorField> Foam::coordinateSystem::globalToLocal
void Foam::coordinateSystem::write(Ostream& os) const
{
os << type()
<< " origin: " << origin()
<< " e1: " << e1() << " e3: " << e3();
<< " origin: " << origin() << " e1: " << e1() << " e3: " << e3();
}
@ -247,7 +300,7 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
// only write type for derived types
if (type() != typeName_())
{
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
}
// The note entry is optional
@ -292,7 +345,7 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
note_.clear();
rhs.readIfPresent("note", note_);
// specify via coordinateRotation
// specify via coordinateRotation sub-dictionary
if (dict.found("coordinateRotation"))
{
autoPtr<coordinateRotation> cr =
@ -302,7 +355,7 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
}
else
{
// no sub-dictionary - specify via axes
// let coordinateRotation constructor extract the axes specification
R_ = coordinateRotation(dict);
}
@ -314,18 +367,11 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
bool Foam::operator!=(const coordinateSystem& a, const coordinateSystem& b)
{
if (a.origin() != b.origin() || a.R() != b.R() || a.type() != b.type())
{
return true;
}
else
{
return false;
}
return (a.origin() != b.origin() || a.R() != b.R() || a.type() != b.type());
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const coordinateSystem& cs)
{

View File

@ -26,8 +26,8 @@ Class
Foam::coordinateSystem
Description
A cartesian coordinate system and the base class for
other coordinate system specifications
A cartesian coordinate system and the base class for other coordinate
system specifications
All systems are defined by an origin point and a coordinateRotation.
For convenience, the dictionary constructor forms allow a few shortcuts:
@ -99,6 +99,29 @@ Description
)
@endverbatim
- additionally, if the coordinateSystem points to a plain entry,
it can be used to reference one of the global coordinateSystems
@verbatim
1
(
cat1
{
coordinateSystem system_10;
porosity 0.781;
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
f f [0 -1 0 0 0] (-1000 -1000 12.83);
}
}
)
@endverbatim
For this to work correctly, the coordinateSystem constructor must be
supplied with both a dictionary and an objectRegistry.
See Also
coordinateSystems and coordinateSystems::New
SourceFiles
coordinateSystem.C
newCoordinateSystem.C
@ -180,7 +203,7 @@ public:
// Constructors
//- Construct null
//- Construct null. This is equivalent to an identity coordinateSystem
coordinateSystem();
//- Construct from origin and 2 axes
@ -200,11 +223,15 @@ public:
const coordinateRotation&
);
//- Construct from dictionary with a given name
coordinateSystem(const word& name, const dictionary&);
//- Construct from dictionary with default name
coordinateSystem(const dictionary&);
//- Construct from dictionary
coordinateSystem(const word& name, const dictionary&);
//- Construct from dictionary (default name)
// With the ability to reference global coordinateSystems
coordinateSystem(const dictionary&, const objectRegistry&);
//- Construct from Istream
// The Istream contains a word followed by a dictionary
@ -284,14 +311,14 @@ public:
const word& coordType,
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Select constructed from dictionary
static autoPtr<coordinateSystem> New
(
const word& name,
const dictionary& dict
const dictionary&
);
//- Select constructed from Istream
@ -324,7 +351,6 @@ public:
return note_;
}
//- Return origin
const point& origin() const
{
@ -378,7 +404,7 @@ public:
//- Return as dictionary of entries
// @param [in] ignoreType drop type (cartesian, cylindrical, etc)
// when generating the dictionary
virtual dictionary dict(bool ignoreType = false) const;
virtual dictionary dict(bool ignoreType=false) const;
// Edit
@ -401,7 +427,7 @@ public:
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
virtual void writeDict(Ostream&, bool subDict=true) const;
// Transformations
@ -462,7 +488,11 @@ public:
// friend Operators
friend bool operator!=(const coordinateSystem&, const coordinateSystem&);
friend bool operator!=
(
const coordinateSystem&,
const coordinateSystem&
);
// IOstream Operators

View File

@ -26,61 +26,78 @@ License
#include "coordinateSystems.H"
#include "IOPtrList.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(coordinateSystems, 0);
defineTemplateTypeNameAndDebug(IOPtrList<coordinateSystem>, 0);
}
//! @cond localscope
const Foam::word typeName("coordinateSystems");
const Foam::word dataType("coordinateSystem");
//! @endcond localscope
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coordinateSystems::coordinateSystems()
Foam::coordinateSystems::coordinateSystems(const IOobject& io)
:
IOPtrList<coordinateSystem>(io)
{}
Foam::coordinateSystems::coordinateSystems
(
const IOobject& io
const IOobject& io,
const PtrList<coordinateSystem>& lst
)
{
IOPtrList<coordinateSystem> newList(io);
transfer(newList);
}
:
IOPtrList<coordinateSystem>(io, lst)
{}
Foam::coordinateSystems::coordinateSystems
(
const objectRegistry& registry
const IOobject& io,
const xfer<PtrList<coordinateSystem> >& lst
)
:
IOPtrList<coordinateSystem>(io, lst)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
// Read construct from registry, or return previously registered
const Foam::coordinateSystems& Foam::coordinateSystems::New
(
const objectRegistry& obr
)
{
IOPtrList<coordinateSystem> newList
(
IOobject
if (obr.foundObject<coordinateSystems>(typeName))
{
return obr.lookupObject<coordinateSystems>(typeName);
}
else
{
return obr.store
(
typeName,
"constant",
registry,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false // don't register
)
);
transfer(newList);
new coordinateSystems
(
IOobject
(
typeName,
"constant",
obr,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
)
);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::coordinateSystems::find(const word& keyword) const
{
forAll(*this, i)
@ -114,55 +131,19 @@ Foam::wordList Foam::coordinateSystems::toc() const
}
bool Foam::coordinateSystems::rewriteDict(dictionary& dict, bool noType) const
{
if (dict.found(dataType) && !dict.isDict(dataType))
{
word name(dict.lookup(dataType));
label i = find(name);
if (i >= 0)
{
dict.remove(dataType);
dict.add(dataType, operator[](i).dict(noType));
return true;
}
FatalErrorIn
(
"Foam::coordinateSystems::rewriteDict(dictionary&, bool) const"
) << "could not rewrite " << dataType << " " << name << nl
<< "available coordinate systems: " << toc() << nl << nl
<< "context: " << nl
<< dict << nl
<< exit(FatalError);
}
return false;
}
bool Foam::coordinateSystems::writeData(Ostream& os, bool subDict) const
{
// Write size of list
os << nl << size();
os << nl << size() << nl << token::BEGIN_LIST;
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
operator[](i).writeDict(os, subDict);
}
// Write end of contents
os << token::END_LIST << nl;
// Check state of IOstream
return os.good();
}
// ************************************************************************* //

View File

@ -28,6 +28,10 @@ Class
Description
Provides a centralized coordinateSystem collection.
Note
Mixing normal constructors and the coordinateSystems::New constructor
may yield unexpected results.
SourceFiles
coordinateSystems.C
@ -36,7 +40,7 @@ SourceFiles
#define coordinateSystems_H
#include "coordinateSystem.H"
#include "PtrList.H"
#include "IOPtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,34 +53,49 @@ namespace Foam
class coordinateSystems
:
public PtrList<coordinateSystem>
public IOPtrList<coordinateSystem>
{
// Private Member Functions
//- Disallow default bitwise copy construct
coordinateSystems(const coordinateSystems&);
//- Disallow default bitwise assignment
void operator=(const coordinateSystems&);
public:
// Public Member Functions
//- Runtime type information
TypeName("coordinateSystems");
// Constructors
//- Construct null
coordinateSystems();
//- Read construct from IOobject
explicit coordinateSystems(const IOobject&);
//- Read construct from registry from "constant" instance
coordinateSystems(const objectRegistry&);
//- Construct from IOobject and a PtrList
coordinateSystems
(
const IOobject&,
const PtrList<coordinateSystem>&
);
//- Construct from IOobject and transferring the PtrList contents
coordinateSystems
(
const IOobject&,
const xfer<PtrList<coordinateSystem> >&
);
// Selectors
//- Return previously registered or read construct from "constant"
static const coordinateSystems& New(const objectRegistry&);
// Member Functions
//- Find and return index for a given keyword, returns -1 if not found
//- Find and return index for a given keyword, returns -1 if not found
label find(const word& key) const;
//- Search for given keyword
@ -85,45 +104,6 @@ public:
//- Return the table of contents (list of all keywords)
wordList toc() const;
//- Rewrite coordinateSystem entry with appropriate dictionary entry
//
// This replaces coordinateSystems entries with their contents.
// For example,
// @verbatim
// cat1
// {
// coordinateSystem system_10;
// porosity 0.781;
// Darcy
// {
// d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
// f f [0 -1 0 0 0] (-1000 -1000 12.83);
// }
// }
// @endverbatim
// might get re-written as the following (depending on the value of
// @c system_10 in the @c constant/coordinateSystems file):
// @verbatim
// cat1
// {
// coordinateSystem
// {
// origin (0 0 0);
// e3 (1 0 0);
// e1 (0 0 -1);
// }
// porosity 0.781;
// Darcy
// {
// d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
// f f [0 -1 0 0 0] (-1000 -1000 12.83);
// }
// }
// @endverbatim
// When this form of re-writing is used, the coordinateRotation is
// reduced to the axes specification.
bool rewriteDict(dictionary&, bool noType=false) const;
//- write data
bool writeData(Ostream&, bool subDict=true) const;
};

View File

@ -106,14 +106,11 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
cylindricalCS(const word& name, const dictionary& dict);
// Member Functions
cylindricalCS(const word& name, const dictionary&);
};

View File

@ -40,7 +40,6 @@ namespace Foam
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::parabolicCylindricalCS::parabolicCylindricalCS()
@ -113,6 +112,7 @@ Foam::vector Foam::parabolicCylindricalCS::localToGlobal
);
}
Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
(
const vectorField& local,
@ -123,7 +123,8 @@ Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
{
FatalErrorIn
(
"parabolicCylindricalCS::localToGlobal(const vectorField&, bool) const"
"parabolicCylindricalCS::localToGlobal"
"(const vectorField&, bool) const"
) << "parabolic cylindrical coordinates v < 0"
<< abort(FatalError);
}

View File

@ -107,18 +107,11 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
parabolicCylindricalCS
(
const word& name,
const dictionary& dict
);
// Member Functions
parabolicCylindricalCS(const word&, const dictionary&);
};

View File

@ -45,6 +45,7 @@ Foam::sphericalCS::sphericalCS()
coordinateSystem()
{}
Foam::sphericalCS::sphericalCS
(
const word& name,
@ -96,6 +97,7 @@ Foam::vector Foam::sphericalCS::localToGlobal
);
}
Foam::tmp<Foam::vectorField> Foam::sphericalCS::localToGlobal
(
const vectorField& local,
@ -174,5 +176,4 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal
return tresult;
}
// ************************************************************************* //

View File

@ -105,19 +105,16 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr
const coordinateRotation&
);
//- Construct from dictionary
sphericalCS(const word& name, const dictionary& dict);
sphericalCS(const word& name, const dictionary&);
// Member Functions
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -36,7 +36,6 @@ namespace Foam
addToRunTimeSelectionTable(coordinateSystem, toroidalCS, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::toroidalCS::toroidalCS
@ -105,6 +104,7 @@ Foam::vector Foam::toroidalCS::localToGlobal
);
}
Foam::tmp<Foam::vectorField> Foam::toroidalCS::localToGlobal
(
const vectorField& local,
@ -129,6 +129,7 @@ Foam::tmp<Foam::vectorField> Foam::toroidalCS::localToGlobal
return coordinateSystem::localToGlobal(lc, translate);
}
Foam::vector Foam::toroidalCS::globalToLocal
(
const vector& global,
@ -143,6 +144,7 @@ Foam::vector Foam::toroidalCS::globalToLocal
return vector::zero;
}
Foam::tmp<Foam::vectorField> Foam::toroidalCS::globalToLocal
(
const vectorField& global,
@ -182,5 +184,4 @@ void Foam::toroidalCS::writeDict(Ostream& os, bool subDict) const
}
}
// ************************************************************************* //

View File

@ -106,12 +106,12 @@ public:
(
const word& name,
const point& origin,
const coordinateRotation& cr,
const coordinateRotation&,
const scalar radius
);
//- Construct from dictionary
toroidalCS(const word& name, const dictionary& dict);
toroidalCS(const word& name, const dictionary&);
// Member Functions
@ -126,7 +126,7 @@ public:
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&, bool subDict = true) const;
virtual void writeDict(Ostream&, bool subDict=true) const;
};

View File

@ -143,9 +143,10 @@ Foam::sampledPlane::sampledPlane
{
// make plane relative to the coordinateSystem (Cartesian)
// allow lookup from global coordinate systems
if (dict.found("coordinateSystem"))
{
coordinateSystem cs(dict.subDict("coordinateSystem"));
coordinateSystem cs(dict, mesh);
point base = cs.globalPosition(planeDesc().refPoint());
vector norm = cs.globalVector(planeDesc().normal());

View File

@ -136,8 +136,8 @@ Foam::sampledSurface::New
{
FatalErrorIn
(
"sampledSurface::New(const word&, "
"const polyMesh&, const dictionary&)"
"sampledSurface::New"
"(const word&, const polyMesh&, const dictionary&)"
) << "Unknown sample type " << sampleType
<< endl << endl
<< "Valid sample types : " << endl
@ -145,10 +145,7 @@ Foam::sampledSurface::New
<< exit(FatalError);
}
return autoPtr<sampledSurface>
(
cstrIter()(name, mesh, dict)
);
return autoPtr<sampledSurface>(cstrIter()(name, mesh, dict));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -161,10 +161,7 @@ public:
//- Class used for the PtrLists read-construction
// Has the ability to rewrite coordinate systems as required
class iNew
:
public coordinateSystems
{
//- Reference to the volume mesh
const polyMesh& mesh_;
@ -173,17 +170,6 @@ public:
iNew(const polyMesh& mesh)
:
coordinateSystems(mesh),
mesh_(mesh)
{}
iNew
(
const polyMesh& mesh,
const coordinateSystems& cs
)
:
coordinateSystems(cs),
mesh_(mesh)
{}
@ -191,7 +177,6 @@ public:
{
word name(is);
dictionary dict(is);
rewriteDict(dict, true);
return sampledSurface::New(name, mesh_, dict);
}
@ -204,16 +189,16 @@ public:
sampledSurface
(
const word& name,
const polyMesh& mesh,
const bool triangulate = true
const polyMesh&,
const bool triangulate=true
);
//- Construct from dictionary
sampledSurface
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
const polyMesh&,
const dictionary&
);
//- Clone
@ -229,9 +214,9 @@ public:
//- Return a reference to the selected surface
static autoPtr<sampledSurface> New
(
const word& sampleType,
const polyMesh& mesh,
const dictionary& dict
const word& name,
const polyMesh&,
const dictionary&
);