Skip to content
Snippets Groups Projects
Commit d2e9a0d1 authored by Henry's avatar Henry Committed by Andrew Heather
Browse files

fvOptions: Support the "options" sub-dictionary

to allow the file to contain dictionaries of general information
parent 1878a019
Branches
Tags
No related merge requests found
......@@ -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));
}
......
......@@ -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;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment