ENH: function objects - enabled 'fields' entry to use patterns for some objects

This commit is contained in:
Andrew Heather
2017-11-07 17:33:09 +00:00
parent c1b7854cf7
commit ec9a7cc016
24 changed files with 1043 additions and 69 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,7 +55,7 @@ fieldCoordinateSystemTransform
)
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_(),
fieldSet_(mesh_),
coordSys_(mesh_, dict.subDict("coordinateSystem"))
{
read(dict);
@ -90,23 +90,27 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::read
const dictionary& dict
)
{
fvMeshFunctionObject::read(dict);
if (fvMeshFunctionObject::read(dict))
{
fieldSet_.read(dict);
return true;
}
dict.lookup("fields") >> fieldSet_;
return true;
return false;
}
bool Foam::functionObjects::fieldCoordinateSystemTransform::execute()
{
forAll(fieldSet_, fieldi)
fieldSet_.updateSelection();
for (const word& fieldName : fieldSet_.selection())
{
transform<scalar>(fieldSet_[fieldi]);
transform<vector>(fieldSet_[fieldi]);
transform<sphericalTensor>(fieldSet_[fieldi]);
transform<symmTensor>(fieldSet_[fieldi]);
transform<tensor>(fieldSet_[fieldi]);
transform<scalar>(fieldName);
transform<vector>(fieldName);
transform<sphericalTensor>(fieldName);
transform<symmTensor>(fieldName);
transform<tensor>(fieldName);
}
return true;
@ -115,9 +119,9 @@ bool Foam::functionObjects::fieldCoordinateSystemTransform::execute()
bool Foam::functionObjects::fieldCoordinateSystemTransform::write()
{
forAll(fieldSet_, fieldi)
forAllConstIters(fieldSet_, iter)
{
writeObject(transformFieldName(fieldSet_[fieldi]));
writeObject(transformFieldName(iter()));
}
return true;

View File

@ -83,6 +83,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "coordinateSystem.H"
#include "volFieldSelection.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -104,7 +105,7 @@ protected:
// Protected data
//- Fields to transform
wordList fieldSet_;
volFieldSelection fieldSet_;
//- Co-ordinate system to transform to
coordinateSystem coordSys_;