functionObjects::add: Add list of fields

The operation can be applied to any volume or surface fields generating a
    volume or surface scalar field.

    Example of function object specification:
    \verbatim
    Ttot
    {
        type            add;
        libs            ("libfieldFunctionObjects.so");
        fields          (T Tdelta);
        result          Ttot;
        executeControl  writeTime;
        writeControl    writeTime;
    }
    \endverbatim

Also refactored functionObjects::fieldsExpression to avoid code
duplication between the 'add' and 'subtract' functionObjects.
This commit is contained in:
Henry Weller
2016-11-19 21:48:48 +00:00
parent 21fbad85fb
commit 56919a4442
10 changed files with 377 additions and 64 deletions

View File

@ -71,9 +71,27 @@ protected:
// Protected member functions
virtual bool calc() = 0;
void setResultName
(
const word& typeName,
const wordList& defaultArg = wordList::null()
);
void setResultName(const word& typeName, const wordList& defaultArg);
//- Call 'calcFieldType' for the given functionObject
// for 'volField' and 'surfaceField' field types
template<class Type, class FOType>
bool calcFieldTypes(FOType& fo);
//- Call 'calcFieldTypes' for the given 'Type' and functionObject
template<class Type, class FOType>
bool calcType(FOType& fo);
//- Call 'calcType' for the given functionObject
// for each primitive type
template<class FOType>
bool calcAllTypes(FOType& fo);
virtual bool calc() = 0;
private:
@ -133,6 +151,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "fieldsExpressionTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //