diff --git a/src/fieldSources/basicSource/IObasicSourceList.C b/src/fieldSources/fvOptions/fvIOoptionList.C similarity index 84% rename from src/fieldSources/basicSource/IObasicSourceList.C rename to src/fieldSources/fvOptions/fvIOoptionList.C index d69bffa1eceb3f96b4db3957695aea49304f4510..1ea4be17d260ebbe4131e7393b52069dd9c82d2f 100644 --- a/src/fieldSources/basicSource/IObasicSourceList.C +++ b/src/fieldSources/fvOptions/fvIOoptionList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,21 +23,21 @@ License \*---------------------------------------------------------------------------*/ -#include "IObasicSourceList.H" +#include "fvIOoptionList.H" #include "fvMesh.H" #include "Time.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -Foam::IOobject Foam::IObasicSourceList::createIOobject +Foam::IOobject Foam::fv::IOoptionList::createIOobject ( const fvMesh& mesh ) const { IOobject io ( - "sourcesProperties", - mesh.time().constant(), + "fvOptions", + mesh.time().system(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE @@ -62,21 +62,21 @@ Foam::IOobject Foam::IObasicSourceList::createIOobject // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::IObasicSourceList::IObasicSourceList +Foam::fv::IOoptionList::IOoptionList ( const fvMesh& mesh ) : IOdictionary(createIOobject(mesh)), - basicSourceList(mesh, *this) + optionList(mesh, *this) {} -bool Foam::IObasicSourceList::read() +bool Foam::fv::IOoptionList::read() { if (regIOobject::read()) { - basicSourceList::read(*this); + optionList::read(*this); return true; } else @@ -87,4 +87,3 @@ bool Foam::IObasicSourceList::read() // ************************************************************************* // - diff --git a/src/fieldSources/basicSource/IObasicSourceList.H b/src/fieldSources/fvOptions/fvIOoptionList.H similarity index 81% rename from src/fieldSources/basicSource/IObasicSourceList.H rename to src/fieldSources/fvOptions/fvIOoptionList.H index 69070b18db33a865361fa022a2fb4bf57a94b58e..0c3c973cd2aadedc76f5c4ddd502787aec16837e 100644 --- a/src/fieldSources/basicSource/IObasicSourceList.H +++ b/src/fieldSources/fvOptions/fvIOoptionList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,20 +22,20 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::IObasicSourceList + Foam::fv::IOoptionList Description - IObasicSourceList + IOoptionList SourceFiles - IObasicSourceList.C + IOoptionList.C \*---------------------------------------------------------------------------*/ -#ifndef IObasicSourceList_H -#define IObasicSourceList_H +#ifndef IOoptionList_H +#define IOoptionList_H -#include "basicSourceList.H" +#include "fvOptionList.H" #include "IOdictionary.H" #include "autoPtr.H" @@ -43,15 +43,17 @@ SourceFiles namespace Foam { +namespace fv +{ /*---------------------------------------------------------------------------*\ - Class IObasicSourceList Declaration + Class IOoptionList Declaration \*---------------------------------------------------------------------------*/ -class IObasicSourceList +class IOoptionList : public IOdictionary, - public basicSourceList + public optionList { private: @@ -61,10 +63,10 @@ private: IOobject createIOobject(const fvMesh& mesh) const; //- Disallow default bitwise copy construct - IObasicSourceList(const IObasicSourceList&); + IOoptionList(const IOoptionList&); //- Disallow default bitwise assignment - void operator=(const IObasicSourceList&); + void operator=(const IOoptionList&); public: @@ -72,11 +74,11 @@ public: // Constructors //- Construct from components with list of field names - IObasicSourceList(const fvMesh& mesh); + IOoptionList(const fvMesh& mesh); //- Destructor - virtual ~IObasicSourceList() + virtual ~IOoptionList() {} @@ -89,6 +91,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fv } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fieldSources/basicSource/basicSource.C b/src/fieldSources/fvOptions/fvOption.C similarity index 78% rename from src/fieldSources/basicSource/basicSource.C rename to src/fieldSources/fvOptions/fvOption.C index 7732f89f9a973c705e8d351c29de8e8187fe6baa..067e0403b5df3d492696b8a510a269fab1f9cca0 100644 --- a/src/fieldSources/basicSource/basicSource.C +++ b/src/fieldSources/fvOptions/fvOption.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "basicSource.H" +#include "fvOption.H" #include "fvMesh.H" #include "fvMatrices.H" #include "volFields.H" @@ -33,12 +33,15 @@ License namespace Foam { - defineTypeNameAndDebug(basicSource, 0); - defineRunTimeSelectionTable(basicSource, dictionary); + namespace fv + { + defineTypeNameAndDebug(option, 0); + defineRunTimeSelectionTable(option, dictionary); + } template<> const char* NamedEnum < - basicSource::selectionModeType, + fv::option::selectionModeType, 5 >::names[] = { @@ -49,20 +52,20 @@ namespace Foam "all" }; - const NamedEnum<basicSource::selectionModeType, 5> - basicSource::selectionModeTypeNames_; + const NamedEnum<fv::option::selectionModeType, 5> + fv::option::selectionModeTypeNames_; } // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -bool Foam::basicSource::alwaysApply() const +bool Foam::fv::option::alwaysApply() const { return false; } -void Foam::basicSource::setSelection(const dictionary& dict) +void Foam::fv::option::setSelection(const dictionary& dict) { switch (selectionMode_) { @@ -94,10 +97,8 @@ void Foam::basicSource::setSelection(const dictionary& dict) } default: { - FatalErrorIn - ( - "basicSource::setSelection(const dictionary&)" - ) << "Unknown selectionMode " + FatalErrorIn("option::setSelection(const dictionary&)") + << "Unknown selectionMode " << selectionModeTypeNames_[selectionMode_] << ". Valid selectionMode types are" << selectionModeTypeNames_ << exit(FatalError); @@ -106,7 +107,7 @@ void Foam::basicSource::setSelection(const dictionary& dict) } -void Foam::basicSource::setCellSet() +void Foam::fv::option::setCellSet() { switch (selectionMode_) { @@ -127,7 +128,7 @@ void Foam::basicSource::setCellSet() label globalCellI = returnReduce(cellI, maxOp<label>()); if (globalCellI < 0) { - WarningIn("basicSource::setCellIds()") + WarningIn("option::setCellIds()") << "Unable to find owner cell for point " << points_[i] << endl; @@ -156,7 +157,7 @@ void Foam::basicSource::setCellSet() label zoneID = mesh_.cellZones().findZoneID(cellSetName_); if (zoneID == -1) { - FatalErrorIn("basicSource::setCellIds()") + FatalErrorIn("option::setCellIds()") << "Cannot find cellZone " << cellSetName_ << endl << "Valid cellZones are " << mesh_.cellZones().names() << exit(FatalError); @@ -195,10 +196,8 @@ void Foam::basicSource::setCellSet() } else { - FatalErrorIn - ( - "Foam::basicSource::setCellSet()" - ) << "regions dont overlap " + FatalErrorIn("option::setCellSet()") + << "regions dont overlap " << secondaryMesh.name() << " in region " << mesh_.name() << nl @@ -216,7 +215,7 @@ void Foam::basicSource::setCellSet() } default: { - FatalErrorIn("basicSource::setCellIds()") + FatalErrorIn("option::setCellIds()") << "Unknown selectionMode " << selectionModeTypeNames_[selectionMode_] << ". Valid selectionMode types are" << selectionModeTypeNames_ @@ -243,7 +242,7 @@ void Foam::basicSource::setCellSet() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::basicSource::basicSource +Foam::fv::option::option ( const word& name, const word& modelType, @@ -282,7 +281,7 @@ Foam::basicSource::basicSource } else { - Info<< indent<< "-applying source for all time" << endl; + Info<< indent<< "- applying source for all time" << endl; } setSelection(dict_); @@ -295,7 +294,7 @@ Foam::basicSource::basicSource // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // -Foam::autoPtr<Foam::basicSource> Foam::basicSource::New +Foam::autoPtr<Foam::fv::option> Foam::fv::option::New ( const word& name, const dictionary& coeffs, @@ -313,8 +312,7 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New { FatalErrorIn ( - "basicSource::New" - "(const name&, const dictionary&, const fvMesh&)" + "option::New(const name&, const dictionary&, const fvMesh&)" ) << "Unknown Model type " << modelType << nl << nl << "Valid model types are:" << nl @@ -322,11 +320,11 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New << exit(FatalError); } - return autoPtr<basicSource>(cstrIter()(name, modelType, coeffs, mesh)); + return autoPtr<option>(cstrIter()(name, modelType, coeffs, mesh)); } -Foam::basicSource::~basicSource() +Foam::fv::option::~option() { if (!secondaryToPrimaryInterpPtr_.empty()) { @@ -337,7 +335,7 @@ Foam::basicSource::~basicSource() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::basicSource::isActive() +bool Foam::fv::option::isActive() { if (active_ && inTimeLimits(mesh_.time().value())) { @@ -355,7 +353,7 @@ bool Foam::basicSource::isActive() } -Foam::label Foam::basicSource::applyToField(const word& fieldName) const +Foam::label Foam::fv::option::applyToField(const word& fieldName) const { if (alwaysApply()) { @@ -374,13 +372,13 @@ Foam::label Foam::basicSource::applyToField(const word& fieldName) const } -void Foam::basicSource::checkApplied() const +void Foam::fv::option::checkApplied() const { forAll(applied_, i) { if (!applied_[i]) { - WarningIn("void Foam::basicSource::checkApplied() const") + WarningIn("void option::checkApplied() const") << "Source " << name_ << " defined for field " << fieldNames_[i] << " but never used" << endl; } @@ -388,49 +386,49 @@ void Foam::basicSource::checkApplied() const } -void Foam::basicSource::correct(volScalarField& fld) +void Foam::fv::option::correct(volScalarField& fld) { // do nothing } -void Foam::basicSource::correct(volVectorField& fld) +void Foam::fv::option::correct(volVectorField& fld) { // do nothing } -void Foam::basicSource::correct(volSphericalTensorField& fld) +void Foam::fv::option::correct(volSphericalTensorField& fld) { // do nothing } -void Foam::basicSource::correct(volSymmTensorField& fld) +void Foam::fv::option::correct(volSymmTensorField& fld) { // do nothing } -void Foam::basicSource::correct(volTensorField& fld) +void Foam::fv::option::correct(volTensorField& fld) { // do nothing } -void Foam::basicSource::addSup(fvMatrix<scalar>& eqn, const label fieldI) +void Foam::fv::option::addSup(fvMatrix<scalar>& eqn, const label fieldI) { // do nothing } -void Foam::basicSource::addSup(fvMatrix<vector>& eqn, const label fieldI) +void Foam::fv::option::addSup(fvMatrix<vector>& eqn, const label fieldI) { // do nothing } -void Foam::basicSource::addSup +void Foam::fv::option::addSup ( fvMatrix<sphericalTensor>& eqn, const label fieldI @@ -440,31 +438,31 @@ void Foam::basicSource::addSup } -void Foam::basicSource::addSup(fvMatrix<symmTensor>& eqn, const label fieldI) +void Foam::fv::option::addSup(fvMatrix<symmTensor>& eqn, const label fieldI) { // do nothing } -void Foam::basicSource::addSup(fvMatrix<tensor>& eqn, const label fieldI) +void Foam::fv::option::addSup(fvMatrix<tensor>& eqn, const label fieldI) { // do nothing } -void Foam::basicSource::setValue(fvMatrix<scalar>& eqn, const label fieldI) +void Foam::fv::option::setValue(fvMatrix<scalar>& eqn, const label fieldI) { // do nothing } -void Foam::basicSource::setValue(fvMatrix<vector>& eqn, const label fieldI) +void Foam::fv::option::setValue(fvMatrix<vector>& eqn, const label fieldI) { // do nothing } -void Foam::basicSource::setValue +void Foam::fv::option::setValue ( fvMatrix<sphericalTensor>& eqn, const label fieldI @@ -474,7 +472,7 @@ void Foam::basicSource::setValue } -void Foam::basicSource::setValue +void Foam::fv::option::setValue ( fvMatrix<symmTensor>& eqn, const label fieldI @@ -484,19 +482,19 @@ void Foam::basicSource::setValue } -void Foam::basicSource::setValue(fvMatrix<tensor>& eqn, const label fieldI) +void Foam::fv::option::setValue(fvMatrix<tensor>& eqn, const label fieldI) { // do nothing } -void Foam::basicSource::relativeFlux(surfaceScalarField& phi) const +void Foam::fv::option::relativeFlux(surfaceScalarField& phi) const { // do nothing } -void Foam::basicSource::relativeFlux +void Foam::fv::option::relativeFlux ( const surfaceScalarField& rho, surfaceScalarField& phi @@ -506,13 +504,13 @@ void Foam::basicSource::relativeFlux } -void Foam::basicSource::absoluteFlux(surfaceScalarField& phi) const +void Foam::fv::option::absoluteFlux(surfaceScalarField& phi) const { // do nothing } -void Foam::basicSource::absoluteFlux +void Foam::fv::option::absoluteFlux ( const surfaceScalarField& rho, surfaceScalarField& phi diff --git a/src/fieldSources/basicSource/basicSource.H b/src/fieldSources/fvOptions/fvOption.H similarity index 92% rename from src/fieldSources/basicSource/basicSource.H rename to src/fieldSources/fvOptions/fvOption.H index 8c5543c48ab5e3f1d48786573372b81b5e39146f..b6f2cd968979b0723d08e57da58300628eb49c6d 100644 --- a/src/fieldSources/basicSource/basicSource.H +++ b/src/fieldSources/fvOptions/fvOption.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,10 +22,11 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::basicSource + Foam::fv::option Description - Field source abtract base class. Provides a base set of controls, e.g. + Finite volume options abtract base class. Provides a base set of controls, + e.g. type scalarExplicitSource // source type active on; // on/off switch @@ -33,18 +34,17 @@ Description duration 1000.0; // duration selectionMode cellSet; // cellSet // points //cellZone // mapRegion - +Note: On evaluation, source expects to be added to the rhs of the equation - SourceFiles - basicSource.C - basicSourceIO.C + fvOption.C + fvOptionIO.C \*---------------------------------------------------------------------------*/ -#ifndef basicSource_H -#define basicSource_H +#ifndef fvOption_H +#define fvOption_H #include "fvMatricesFwd.H" #include "volFieldsFwd.H" @@ -61,11 +61,14 @@ namespace Foam class fvMesh; +namespace fv +{ + /*---------------------------------------------------------------------------*\ - Class basicSource Declaration + Class option Declaration \*---------------------------------------------------------------------------*/ -class basicSource +class option { public: @@ -163,7 +166,7 @@ protected: public: //- Runtime type information - TypeName("basicSource"); + TypeName("option"); // Declare run-time constructor selection table @@ -171,7 +174,7 @@ public: declareRunTimeSelectionTable ( autoPtr, - basicSource, + option, dictionary, ( const word& name, @@ -186,7 +189,7 @@ public: // Constructors //- Construct from components - basicSource + option ( const word& name, const word& modelType, @@ -195,13 +198,13 @@ public: ); //- Return clone - autoPtr<basicSource> clone() const + autoPtr<option> clone() const { - notImplemented("autoPtr<basicSource> clone() const"); - return autoPtr<basicSource>(NULL); + notImplemented("autoPtr<option> clone() const"); + return autoPtr<option>(NULL); } - //- Return pointer to new basicSource object created + //- Return pointer to new fvOption object created // on the freestore from an Istream class iNew { @@ -221,19 +224,14 @@ public: name_(name) {} - autoPtr<basicSource> operator()(Istream& is) const + autoPtr<option> operator()(Istream& is) const { //const word name(is); const dictionary dict(is); - return autoPtr<basicSource> + return autoPtr<option> ( - basicSource::New - ( - name_, - dict, - mesh_ - ) + option::New(name_, dict, mesh_) ); } }; @@ -241,8 +239,8 @@ public: // Selectors - //- Return a reference to the selected basicSource model - static autoPtr<basicSource> New + //- Return a reference to the selected fvOption model + static autoPtr<option> New ( const word& name, const dictionary& dict, @@ -251,7 +249,7 @@ public: //- Destructor - virtual ~basicSource(); + virtual ~option(); @@ -468,11 +466,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fv } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "basicSourceI.H" +#include "fvOptionI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fieldSources/basicSource/basicSourceI.H b/src/fieldSources/fvOptions/fvOptionI.H similarity index 61% rename from src/fieldSources/basicSource/basicSourceI.H rename to src/fieldSources/fvOptions/fvOptionI.H index e77d808e3dec7b900f48c17f9849e05fe7a1e298..1ec819173da103918f93c61ec2eaca67a015c4e2 100644 --- a/src/fieldSources/basicSource/basicSourceI.H +++ b/src/fieldSources/fvOptions/fvOptionI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,47 +23,47 @@ License \*---------------------------------------------------------------------------*/ -#include "basicSource.H" +#include "fvMesh.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline const Foam::word& Foam::basicSource::name() const +inline const Foam::word& Foam::fv::option::name() const { return name_; } -inline const Foam::fvMesh& Foam::basicSource::mesh() const +inline const Foam::fvMesh& Foam::fv::option::mesh() const { return mesh_; } -inline const Foam::dictionary& Foam::basicSource::coeffs() const +inline const Foam::dictionary& Foam::fv::option::coeffs() const { return coeffs_; } -inline bool Foam::basicSource::active() const +inline bool Foam::fv::option::active() const { return active_; } -inline Foam::scalar Foam::basicSource::timeStart() const +inline Foam::scalar Foam::fv::option::timeStart() const { return timeStart_; } -inline Foam::scalar Foam::basicSource::duration() const +inline Foam::scalar Foam::fv::option::duration() const { return duration_; } -inline bool Foam::basicSource::inTimeLimits(const scalar time) const +inline bool Foam::fv::option::inTimeLimits(const scalar time) const { return ( @@ -77,68 +77,69 @@ inline bool Foam::basicSource::inTimeLimits(const scalar time) const } -inline const Foam::basicSource::selectionModeType& -Foam::basicSource::selectionMode() const +inline const Foam::fv::option::selectionModeType& +Foam::fv::option::selectionMode() const { return selectionMode_; } -inline const Foam::word& Foam::basicSource::cellSetName() const +inline const Foam::word& Foam::fv::option::cellSetName() const { return cellSetName_; } -inline Foam::scalar Foam::basicSource::V() const +inline Foam::scalar Foam::fv::option::V() const { return V_; } -inline const Foam::labelList& Foam::basicSource::cells() const +inline const Foam::labelList& Foam::fv::option::cells() const { return cells_; } -inline void Foam::basicSource::setApplied(const label fieldI) +inline void Foam::fv::option::setApplied(const label fieldI) { applied_[fieldI] = true; } -inline bool& Foam::basicSource::active() +inline bool& Foam::fv::option::active() { return active_; } -inline Foam::scalar& Foam::basicSource::timeStart() +inline Foam::scalar& Foam::fv::option::timeStart() { return timeStart_; } -inline Foam::scalar& Foam::basicSource::duration() +inline Foam::scalar& Foam::fv::option::duration() { return duration_; } -inline const Foam::word Foam::basicSource::secondarySourceName() const +inline const Foam::word Foam::fv::option::secondarySourceName() const { return secondarySourceName_; } -inline const Foam::autoPtr<Foam::meshToMesh> Foam::basicSource:: -secondaryToPrimaryInterpPtr() const +inline const Foam::autoPtr<Foam::meshToMesh> +Foam::fv::option::secondaryToPrimaryInterpPtr() const { return secondaryToPrimaryInterpPtr_; } -inline const Foam::word Foam::basicSource::mapRegionName() const + +inline const Foam::word Foam::fv::option::mapRegionName() const { return mapRegionName_; } diff --git a/src/fieldSources/basicSource/basicSourceIO.C b/src/fieldSources/fvOptions/fvOptionIO.C similarity index 88% rename from src/fieldSources/basicSource/basicSourceIO.C rename to src/fieldSources/fvOptions/fvOptionIO.C index ce0c88cace525798efe9cb203116214171ed128c..c89c97b864706ebe892e81a76083fa5797e56163 100644 --- a/src/fieldSources/basicSource/basicSourceIO.C +++ b/src/fieldSources/fvOptions/fvOptionIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,24 +23,24 @@ License \*---------------------------------------------------------------------------*/ -#include "basicSource.H" +#include "fvOption.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::basicSource::writeHeader(Ostream& os) const +void Foam::fv::option::writeHeader(Ostream& os) const { os << indent << name_ << nl << indent << token::BEGIN_BLOCK << incrIndent << nl; } -void Foam::basicSource::writeFooter(Ostream& os) const +void Foam::fv::option::writeFooter(Ostream& os) const { os << decrIndent << indent << token::END_BLOCK << endl; } -void Foam::basicSource::writeData(Ostream& os) const +void Foam::fv::option::writeData(Ostream& os) const { os.writeKeyword("active") << active_ << token::END_STATEMENT << nl; os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl; @@ -78,7 +78,7 @@ void Foam::basicSource::writeData(Ostream& os) const } default: { - FatalErrorIn("basicSource::writeData(Ostream&) const") + FatalErrorIn("option::writeData(Ostream&) const") << "Unknown selectionMode " << selectionMode_ << abort(FatalError); @@ -87,7 +87,7 @@ void Foam::basicSource::writeData(Ostream& os) const } -bool Foam::basicSource::read(const dictionary& dict) +bool Foam::fv::option::read(const dictionary& dict) { active_ = readBool(dict.lookup("active")); timeStart_ = readScalar(dict.lookup("timeStart")); diff --git a/src/fieldSources/basicSource/basicSourceList.C b/src/fieldSources/fvOptions/fvOptionList.C similarity index 75% rename from src/fieldSources/basicSource/basicSourceList.C rename to src/fieldSources/fvOptions/fvOptionList.C index 51396de122409bb94fe09dbd7e48cea0ac22a297..e5736a2935987fcb4badff609ac9990ff20492c4 100644 --- a/src/fieldSources/basicSource/basicSourceList.C +++ b/src/fieldSources/fvOptions/fvOptionList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "basicSourceList.H" +#include "fvOptionList.H" #include "addToRunTimeSelectionTable.H" #include "fvMesh.H" #include "Time.H" @@ -32,19 +32,22 @@ License namespace Foam { - defineTypeNameAndDebug(basicSourceList, 0); +namespace fv +{ + defineTypeNameAndDebug(optionList, 0); +} } // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::basicSourceList::checkApplied() const +void Foam::fv::optionList::checkApplied() const { if (mesh_.time().timeIndex() == checkTimeIndex_) { forAll(*this, i) { - const basicSource& bs = this->operator[](i); + const option& bs = this->operator[](i); bs.checkApplied(); } } @@ -53,13 +56,9 @@ void Foam::basicSourceList::checkApplied() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::basicSourceList::basicSourceList -( - const fvMesh& mesh, - const dictionary& dict -) +Foam::fv::optionList::optionList(const fvMesh& mesh, const dictionary& dict) : - PtrList<basicSource>(), + PtrList<option>(), mesh_(mesh), checkTimeIndex_(mesh_.time().startTimeIndex() + 2) { @@ -67,9 +66,9 @@ Foam::basicSourceList::basicSourceList } -Foam::basicSourceList::basicSourceList(const fvMesh& mesh) +Foam::fv::optionList::optionList(const fvMesh& mesh) : - PtrList<basicSource>(), + PtrList<option>(), mesh_(mesh), checkTimeIndex_(mesh_.time().startTimeIndex() + 2) {} @@ -77,7 +76,7 @@ Foam::basicSourceList::basicSourceList(const fvMesh& mesh) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::basicSourceList::reset(const dictionary& dict) +void Foam::fv::optionList::reset(const dictionary& dict) { label count = 0; forAllConstIter(dictionary, dict, iter) @@ -101,14 +100,14 @@ void Foam::basicSourceList::reset(const dictionary& dict) this->set ( i++, - basicSource::New(name, sourceDict, mesh_) + option::New(name, sourceDict, mesh_) ); } } } -void Foam::basicSourceList::relativeFlux(surfaceScalarField& phi) const +void Foam::fv::optionList::relativeFlux(surfaceScalarField& phi) const { forAll(*this, i) { @@ -117,7 +116,7 @@ void Foam::basicSourceList::relativeFlux(surfaceScalarField& phi) const } -void Foam::basicSourceList::relativeFlux +void Foam::fv::optionList::relativeFlux ( const surfaceScalarField& rho, surfaceScalarField& phi @@ -130,7 +129,7 @@ void Foam::basicSourceList::relativeFlux } -void Foam::basicSourceList::absoluteFlux(surfaceScalarField& phi) const +void Foam::fv::optionList::absoluteFlux(surfaceScalarField& phi) const { forAll(*this, i) { @@ -139,7 +138,7 @@ void Foam::basicSourceList::absoluteFlux(surfaceScalarField& phi) const } -void Foam::basicSourceList::absoluteFlux +void Foam::fv::optionList::absoluteFlux ( const surfaceScalarField& rho, surfaceScalarField& phi @@ -152,14 +151,14 @@ void Foam::basicSourceList::absoluteFlux } -bool Foam::basicSourceList::read(const dictionary& dict) +bool Foam::fv::optionList::read(const dictionary& dict) { checkTimeIndex_ = mesh_.time().timeIndex() + 2; bool allOk = true; forAll(*this, i) { - basicSource& bs = this->operator[](i); + option& bs = this->operator[](i); bool ok = bs.read(dict.subDict(bs.name())); allOk = (allOk && ok); } @@ -167,7 +166,7 @@ bool Foam::basicSourceList::read(const dictionary& dict) } -bool Foam::basicSourceList::writeData(Ostream& os) const +bool Foam::fv::optionList::writeData(Ostream& os) const { // Write list contents forAll(*this, i) @@ -183,14 +182,17 @@ bool Foam::basicSourceList::writeData(Ostream& os) const // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const basicSourceList& sources -) +namespace Foam { - sources.writeData(os); - return os; + Ostream& operator<< + ( + Ostream& os, + const fv::optionList& options + ) + { + options.writeData(os); + return os; + } } diff --git a/src/fieldSources/basicSource/basicSourceList.H b/src/fieldSources/fvOptions/fvOptionList.H similarity index 88% rename from src/fieldSources/basicSource/basicSourceList.H rename to src/fieldSources/fvOptions/fvOptionList.H index 002d23b1fb37ee0ae3dfa981465a48fb82295bdf..6ee2b32cc9460fc82057e79139f0066ad9e74940 100644 --- a/src/fieldSources/basicSource/basicSourceList.H +++ b/src/fieldSources/fvOptions/fvOptionList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,36 +22,38 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::basicSourceList + Foam::fv::optionList Description - List of explict sources + List of finite volume options SourceFile - basicSourceList.C + optionList.C \*---------------------------------------------------------------------------*/ -#ifndef basicSourceList_H -#define basicSourceList_H +#ifndef optionList_H +#define optionList_H #include "PtrList.H" #include "GeometricField.H" #include "fvPatchField.H" -#include "basicSource.H" +#include "fvOption.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace fv +{ /*---------------------------------------------------------------------------*\ - Class basicSourceList Declaration + Class optionList Declaration \*---------------------------------------------------------------------------*/ -class basicSourceList +class optionList : - public PtrList<basicSource> + public PtrList<option> { protected: @@ -70,29 +72,29 @@ protected: void checkApplied() const; //- Disallow default bitwise copy construct - basicSourceList(const basicSourceList&); + optionList(const optionList&); //- Disallow default bitwise assignment - void operator=(const basicSourceList&); + void operator=(const optionList&); public: //- Runtime type information - TypeName("basicSourceList"); + TypeName("optionList"); // Constructors //- Construct null - basicSourceList(const fvMesh& mesh); + optionList(const fvMesh& mesh); //- Construct from mesh and dictionary - basicSourceList(const fvMesh& mesh, const dictionary& dict); + optionList(const fvMesh& mesh, const dictionary& dict); //- Destructor - virtual ~basicSourceList() + virtual ~optionList() {} @@ -187,18 +189,19 @@ public: friend Ostream& operator<< ( Ostream& os, - const basicSourceList& sources + const optionList& options ); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fv } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "basicSourceListTemplates.C" + #include "fvOptionListTemplates.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fieldSources/basicSource/basicSourceListTemplates.C b/src/fieldSources/fvOptions/fvOptionListTemplates.C similarity index 86% rename from src/fieldSources/basicSource/basicSourceListTemplates.C rename to src/fieldSources/fvOptions/fvOptionListTemplates.C index 7c83f7f5224906b5bcca627ec70cf3360095689c..24462ce59d924563a8a379428148f7f4a5791eff 100644 --- a/src/fieldSources/basicSource/basicSourceListTemplates.C +++ b/src/fieldSources/fvOptions/fvOptionListTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void Foam::basicSourceList::correct +void Foam::fv::optionList::correct ( GeometricField<Type, fvPatchField, volMesh>& fld ) @@ -35,7 +35,7 @@ void Foam::basicSourceList::correct forAll(*this, i) { - basicSource& source = this->operator[](i); + option& source = this->operator[](i); label fieldI = source.applyToField(fieldName); @@ -59,7 +59,7 @@ void Foam::basicSourceList::correct template<class Type> -Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() +Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator() ( GeometricField<Type, fvPatchField, volMesh>& fld ) @@ -69,7 +69,7 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() template<class Type> -Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() +Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator() ( GeometricField<Type, fvPatchField, volMesh>& fld, const word& fieldName @@ -86,7 +86,7 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() forAll(*this, i) { - basicSource& source = this->operator[](i); + option& source = this->operator[](i); label fieldI = source.applyToField(fieldName); @@ -112,7 +112,7 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() template<class Type, class RhoType> -Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() +Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator() ( const RhoType& rho, GeometricField<Type, fvPatchField, volMesh>& fld @@ -123,7 +123,7 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() template<class Type, class RhoType> -Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() +Foam::tmp<Foam::fvMatrix<Type> > Foam::fv::optionList::operator() ( const RhoType& rho, GeometricField<Type, fvPatchField, volMesh>& fld, @@ -141,7 +141,7 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() forAll(*this, i) { - basicSource& source = this->operator[](i); + option& source = this->operator[](i); label fieldI = source.applyToField(fieldName); @@ -167,14 +167,14 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::basicSourceList::operator() template<class Type> -void Foam::basicSourceList::constrain(fvMatrix<Type>& eqn) +void Foam::fv::optionList::constrain(fvMatrix<Type>& eqn) { constrain(eqn, eqn.psi().name()); } template<class Type> -void Foam::basicSourceList::constrain +void Foam::fv::optionList::constrain ( fvMatrix<Type>& eqn, const word& fieldName @@ -184,7 +184,7 @@ void Foam::basicSourceList::constrain forAll(*this, i) { - basicSource& source = this->operator[](i); + option& source = this->operator[](i); label fieldI = source.applyToField(fieldName); diff --git a/src/fieldSources/basicSource/makeBasicSource.H b/src/fieldSources/fvOptions/makeFvOption.H similarity index 78% rename from src/fieldSources/basicSource/makeBasicSource.H rename to src/fieldSources/fvOptions/makeFvOption.H index 4d8c787487d503d54cd5c09082cf19d96f1af05e..8900f4d3460d55f83ce572b9888805013a5ed9c4 100644 --- a/src/fieldSources/basicSource/makeBasicSource.H +++ b/src/fieldSources/fvOptions/makeFvOption.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,25 +23,25 @@ License \*---------------------------------------------------------------------------*/ -#ifndef makeBasicSource_H -#define makeBasicSource_H +#ifndef makeFvOption_H +#define makeFvOption_H -#include "basicSource.H" +#include "fvOption.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define makeBasicSource(Source, Type) \ +#define makeFvOption(Option, Type) \ \ defineTemplateTypeNameAndDebugWithName \ ( \ - Source<Type>, \ - #Type#Source, \ + Option<Type>, \ + #Type#Option, \ 0 \ ); \ \ - basicSource::adddictionaryConstructorToTable<Source<Type> > \ - add##Source##Type##dictionary##ConstructorTobasicSourceTable_ + option::adddictionaryConstructorToTable<Option<Type> > \ + add##Option##Type##dictionary##ConstructorTooptionTable_ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fieldSources/include/createSources.H b/src/fieldSources/include/createFvOptions.H similarity index 100% rename from src/fieldSources/include/createSources.H rename to src/fieldSources/include/createFvOptions.H