added optional notes to coordinate systems

porousZone constructor in the same order as sampling
This commit is contained in:
Mark Olesen
2008-10-28 17:25:59 +01:00
parent 9c204f9eed
commit 59821d6094
7 changed files with 77 additions and 43 deletions

View File

@ -63,13 +63,13 @@ void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist)
Foam::porousZone::porousZone
(
const fvMesh& mesh,
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
:
mesh_(mesh),
name_(name),
mesh_(mesh),
dict_(dict),
cellZoneID_(mesh_.cellZones().findZoneID(name)),
coordSys_(dict),

View File

@ -92,12 +92,12 @@ class porousZone
{
// Private data
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
//- Name of this zone
word name_;
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
//- Dictionary containing the parameters
dictionary dict_;
@ -189,7 +189,7 @@ public:
// Constructors
//- Construct from components
porousZone(const fvMesh&, const word& name, const dictionary&);
porousZone(const word&, const fvMesh&, const dictionary&);
//- Return clone
autoPtr<porousZone> clone() const
@ -229,7 +229,7 @@ public:
dictionary dict(is);
rewriteDict(dict, true);
return autoPtr<porousZone>(new porousZone(mesh_, name, dict));
return autoPtr<porousZone>(new porousZone(name, mesh_, dict));
}
};

View File

@ -35,6 +35,10 @@ namespace Foam
defineTemplateTypeNameAndDebug(IOPtrList<porousZone>, 0);
}
//! @cond localscope
const Foam::word typeName("porousZones");
//! @endcond localscope
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousZones::porousZones
@ -47,7 +51,7 @@ Foam::porousZones::porousZones
(
IOobject
(
"porousZones",
typeName,
mesh.time().constant(),
mesh,
IOobject::READ_IF_PRESENT,
@ -69,7 +73,7 @@ Foam::porousZones::porousZones
(
IOobject
(
"porousZones",
typeName,
mesh.time().constant(),
mesh,
IOobject::NO_READ,
@ -138,7 +142,7 @@ bool Foam::porousZones::readData(Istream& is)
(
IOobject
(
"porousZones",
typeName,
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,

View File

@ -43,6 +43,7 @@ namespace Foam
Foam::coordinateSystem::coordinateSystem()
:
name_(type()),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
@ -58,6 +59,7 @@ Foam::coordinateSystem::coordinateSystem
)
:
name_(name),
note_(),
origin_(origin),
R_(axis, dir),
Rtr_(R_.T())
@ -72,6 +74,7 @@ Foam::coordinateSystem::coordinateSystem
)
:
name_(name),
note_(),
origin_(origin),
R_(cr),
Rtr_(R_.T())
@ -84,6 +87,7 @@ Foam::coordinateSystem::coordinateSystem
)
:
name_(type()),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
@ -99,6 +103,7 @@ Foam::coordinateSystem::coordinateSystem
)
:
name_(name),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
@ -110,6 +115,7 @@ Foam::coordinateSystem::coordinateSystem
Foam::coordinateSystem::coordinateSystem(Istream& is)
:
name_(is),
note_(),
origin_(point::zero),
R_(),
Rtr_(sphericalTensor::I)
@ -140,6 +146,12 @@ Foam::dictionary Foam::coordinateSystem::dict(bool ignoreType) const
dict.add("type", type());
}
// The note entry is optional
if (note_.size())
{
dict.add("note", note_);
}
dict.add("origin", origin_);
dict.add("e1", e1());
dict.add("e3", e3());
@ -238,6 +250,12 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
}
// The note entry is optional
if (note_.size())
{
os.writeKeyword("note") << note_ << token::END_STATEMENT << nl;
}
os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl;
os.writeKeyword("e1") << e1() << token::END_STATEMENT << nl;
os.writeKeyword("e3") << e3() << token::END_STATEMENT << nl;
@ -267,9 +285,13 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
);
// unspecified origin is (0 0 0)
origin_ = vector::zero;
origin_ = point::zero;
dict.readIfPresent("origin", origin_);
// The note entry is optional
note_.clear();
rhs.readIfPresent("note", note_);
// specify via coordinateRotation
if (dict.found("coordinateRotation"))
{

View File

@ -132,6 +132,9 @@ class coordinateSystem
//- Name of coordinate system
mutable word name_;
//- Optional note
mutable string note_;
//- Origin
mutable point origin_;
@ -309,6 +312,19 @@ public:
return name_;
}
//- Return non-constant access to the optional note
string& note()
{
return note_;
}
//- Return the optional note
const string& note() const
{
return note_;
}
//- Return origin
const point& origin() const
{

View File

@ -34,7 +34,11 @@ namespace Foam
defineTemplateTypeNameAndDebug(IOPtrList<coordinateSystem>, 0);
}
const Foam::word Foam::coordinateSystems::dataType("coordinateSystem");
//! @cond localscope
const Foam::word typeName("coordinateSystems");
const Foam::word dataType("coordinateSystem");
//! @endcond localscope
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -44,17 +48,25 @@ Foam::coordinateSystems::coordinateSystems()
Foam::coordinateSystems::coordinateSystems
(
const objectRegistry& registry,
const word& name,
const fileName& instance
const IOobject& io
)
{
IOPtrList<coordinateSystem> newList(io);
transfer(newList);
}
Foam::coordinateSystems::coordinateSystems
(
const objectRegistry& registry
)
{
IOPtrList<coordinateSystem> newList
(
IOobject
(
name,
instance,
typeName,
"constant",
registry,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
@ -66,16 +78,6 @@ Foam::coordinateSystems::coordinateSystems
}
Foam::coordinateSystems::coordinateSystems
(
const IOobject& io
)
{
IOPtrList<coordinateSystem> newList(io);
transfer(newList);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -59,11 +59,6 @@ class coordinateSystems
public:
// Static data members
//- Type name of list contents
static const word dataType;
// Public Member Functions
@ -72,16 +67,11 @@ public:
//- Construct null
coordinateSystems();
//- Read construct from registry, name. instance
coordinateSystems
(
const objectRegistry& registry,
const word& name = "coordinateSystems",
const fileName& instance = "constant"
);
//- Read construct from IOobject
coordinateSystems(const IOobject&);
explicit coordinateSystems(const IOobject&);
//- Read construct from registry from "constant" instance
coordinateSystems(const objectRegistry&);
// Member Functions
@ -132,10 +122,10 @@ public:
// @endverbatim
// When this form of re-writing is used, the coordinateRotation is
// reduced to the axes specification.
bool rewriteDict(dictionary& dict, bool noType = false) const;
bool rewriteDict(dictionary&, bool noType=false) const;
//- write data
bool writeData(Ostream&, bool subDict = true) const;
bool writeData(Ostream&, bool subDict=true) const;
};