diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.C index 33720d426..91fd1e355 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.C +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -136,6 +136,24 @@ void Foam::fv::optionList::reset(const dictionary& dict) } +bool Foam::fv::optionList::appliesToField(const word& fieldName) const +{ + forAll(*this, i) + { + const option& source = this->operator[](i); + + label fieldi = source.applyToField(fieldName); + + if (fieldi != -1) + { + return true; + } + } + + return false; +} + + bool Foam::fv::optionList::read(const dictionary& dict) { return readOptions(optionsDict(dict)); diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.H b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.H index 3e6847c56..6054456b4 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.H +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -129,6 +129,9 @@ public: //- Reset the source list void reset(const dictionary& dict); + //- Return whether there is something to apply to the field + bool appliesToField(const word& fieldName) const; + // Sources