fvOptions: Added method for querying application to a field

This commit is contained in:
Will Bainbridge
2018-03-22 10:45:09 +00:00
parent b6b146058d
commit 9cf51b0363
2 changed files with 23 additions and 2 deletions

View File

@ -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));

View File

@ -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