diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C index a27a48286a3756599b0aeda6dad964b27480e0ea..b6a07da226531f93efe6f69b4ec9a0e54fd5cd84 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C @@ -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), diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H index e4be5899a264ec36aec567831ef01641ec534ea9..2355f69e7416f5c9d05ff41500bd14ab7f1679eb 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H @@ -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)); } }; diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C index f7c4ef5f92e9a739c3bc13a31eba96e84a46070d..84cc827916eae678bc0a0a223b6685c39fde6500 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C @@ -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, diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index a89a507b8e8be677d7cbdc6a3e8ae60c8e304055..d852b59cf884ad3754ebee28a77af4a0cbc3e0a0 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -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")) { diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index f61c6412d2afcda5cd3fefb3372996067ebd590c..f96a4f673078cb40ad5ac8b39f43b34c261ad3d0 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -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 { diff --git a/src/meshTools/coordinateSystems/coordinateSystems.C b/src/meshTools/coordinateSystems/coordinateSystems.C index e8dce6bcf4c8a8bf2f12f50b5b916282a4a13873..b656d11f85f48d26eb9db88a58dee52bc680b609 100644 --- a/src/meshTools/coordinateSystems/coordinateSystems.C +++ b/src/meshTools/coordinateSystems/coordinateSystems.C @@ -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 * * * * * * * * * * * * * // diff --git a/src/meshTools/coordinateSystems/coordinateSystems.H b/src/meshTools/coordinateSystems/coordinateSystems.H index cc738af99916d6e220546eee05ed12ae32d5227d..e60eed2739f190bf9e581a262dfcd64892dccdc0 100644 --- a/src/meshTools/coordinateSystems/coordinateSystems.H +++ b/src/meshTools/coordinateSystems/coordinateSystems.H @@ -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; };