ENH: add surfField support to various field function objects

- fieldAverage
  - mag
  - magSqr
  - readFields
  - fieldsExpression (add, subtract)
This commit is contained in:
Mark Olesen
2016-12-15 09:32:53 +01:00
parent b0433d93f8
commit 001a2e4a37
9 changed files with 144 additions and 62 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,6 +25,7 @@ License
#include "volFields.H"
#include "surfaceFields.H"
#include "surfFields.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -33,6 +34,7 @@ bool Foam::functionObjects::fieldsExpression::calcFieldTypes(FOType& fo)
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
typedef DimensionedField<Type, surfGeoMesh> SurfFieldType;
if (foundObject<VolFieldType>(fieldNames_[0]))
{
@ -50,6 +52,14 @@ bool Foam::functionObjects::fieldsExpression::calcFieldTypes(FOType& fo)
fo.template calcFieldType<SurfaceFieldType>()
);
}
else if (foundObject<SurfFieldType>(fieldNames_[0]))
{
return store
(
resultName_,
fo.template calcFieldType<SurfFieldType>()
);
}
else
{
return false;