diff --git a/src/fvOptions/fvOptions/fvOptionList.C b/src/fvOptions/fvOptions/fvOptionList.C index b3ccc28f870916fe7c6289875314b3b6d9be8b38..e9a022a32cf8938eb41e4fdef6732b1ea57ff79e 100644 --- a/src/fvOptions/fvOptions/fvOptionList.C +++ b/src/fvOptions/fvOptions/fvOptionList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,10 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "fvOptionList.H" -#include "addToRunTimeSelectionTable.H" -#include "fvMesh.H" #include "surfaceFields.H" -#include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -42,6 +39,37 @@ namespace fv // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +const Foam::dictionary& Foam::fv::optionList::optionsDict +( + const dictionary& dict +) const +{ + if (dict.found("options")) + { + return dict.subDict("options"); + } + else + { + return dict; + } +} + + +bool Foam::fv::optionList::readOptions(const dictionary& dict) +{ + checkTimeIndex_ = mesh_.time().timeIndex() + 2; + + bool allOk = true; + forAll(*this, i) + { + option& bs = this->operator[](i); + bool ok = bs.read(dict.subDict(bs.name())); + allOk = (allOk && ok); + } + return allOk; +} + + void Foam::fv::optionList::checkApplied() const { if (mesh_.time().timeIndex() == checkTimeIndex_) @@ -63,7 +91,7 @@ Foam::fv::optionList::optionList(const fvMesh& mesh, const dictionary& dict) mesh_(mesh), checkTimeIndex_(mesh_.time().startTimeIndex() + 2) { - reset(dict); + reset(optionsDict(dict)); } @@ -171,16 +199,7 @@ void Foam::fv::optionList::makeAbsolute bool Foam::fv::optionList::read(const dictionary& dict) { - checkTimeIndex_ = mesh_.time().timeIndex() + 2; - - bool allOk = true; - forAll(*this, i) - { - option& bs = this->operator[](i); - bool ok = bs.read(dict.subDict(bs.name())); - allOk = (allOk && ok); - } - return allOk; + return readOptions(optionsDict(dict)); } diff --git a/src/fvOptions/fvOptions/fvOptionList.H b/src/fvOptions/fvOptions/fvOptionList.H index 15e97331084d17558ccd9f21f4eb3ef4d25c1910..d4d99df36e0b1d6239fdacbc155978229f06f0ca 100644 --- a/src/fvOptions/fvOptions/fvOptionList.H +++ b/src/fvOptions/fvOptions/fvOptionList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,6 +68,12 @@ protected: // Protected Member Functions + //- Return the "options" sub-dictionary if present otherwise return dict + const dictionary& optionsDict(const dictionary& dict) const; + + //- Read options dictionary + bool readOptions(const dictionary& dict); + //- Check that all sources have been applied void checkApplied() const;