mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fvOptions: Support the "options" sub-dictionary
to allow the file to contain dictionaries of general information
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,10 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fvOptionList.H"
|
#include "fvOptionList.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "Time.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,6 +39,37 @@ namespace fv
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * 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
|
void Foam::fv::optionList::checkApplied() const
|
||||||
{
|
{
|
||||||
if (mesh_.time().timeIndex() == checkTimeIndex_)
|
if (mesh_.time().timeIndex() == checkTimeIndex_)
|
||||||
@ -63,7 +91,7 @@ Foam::fv::optionList::optionList(const fvMesh& mesh, const dictionary& dict)
|
|||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
checkTimeIndex_(mesh_.time().startTimeIndex() + 2)
|
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)
|
bool Foam::fv::optionList::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
checkTimeIndex_ = mesh_.time().timeIndex() + 2;
|
return readOptions(optionsDict(dict));
|
||||||
|
|
||||||
bool allOk = true;
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
option& bs = this->operator[](i);
|
|
||||||
bool ok = bs.read(dict.subDict(bs.name()));
|
|
||||||
allOk = (allOk && ok);
|
|
||||||
}
|
|
||||||
return allOk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -68,6 +68,12 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// 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
|
//- Check that all sources have been applied
|
||||||
void checkApplied() const;
|
void checkApplied() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user