fieldsExpression.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::fieldsExpression
26 
27 Description
28 
29 See also
30  Foam::functionObjects::fvMeshFunctionObject
31 
32 SourceFiles
33  fieldsExpression.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef functionObjects_fieldsExpression_H
38 #define functionObjects_fieldsExpression_H
39 
40 #include "fvMeshFunctionObject.H"
41 #include "volFieldsFwd.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace functionObjects
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class fieldsExpression Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class fieldsExpression
55 :
57 {
58 protected:
59 
60  // Protected member data
61 
62  //- Names of fields to process
64 
65  //- Name of result fields
67 
68 
69  // Protected member functions
70 
71  void setResultName
72  (
73  const word& functionName,
74  const wordList& defaultFieldNames = wordList::null()
75  );
76 
77  //- Call 'calcFieldType' for the given functionObject
78  // for 'volField' and 'surfaceField' field types
79  template<class Type, class FOType>
80  bool calcFieldTypes(FOType& fo);
81 
82  //- Call 'calcFieldTypes' for the given 'Type' and functionObject
83  template<class Type, class FOType>
84  bool calcType(FOType& fo);
85 
86  //- Call 'calcType' for the given functionObject
87  // for each primitive type
88  template<class FOType>
89  bool calcAllTypes(FOType& fo);
90 
91  virtual bool calc() = 0;
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("fieldsExpression");
98 
99 
100  // Constructors
101 
102  //- Construct from Time and dictionary
104  (
105  const word& name,
106  const Time& runTime,
107  const dictionary& dict,
109  const word& resultName = word::null
110  );
111 
112  //- Disallow default bitwise copy construction
113  fieldsExpression(const fieldsExpression&) = delete;
114 
115 
116  //- Destructor
117  virtual ~fieldsExpression();
118 
119 
120  // Member Functions
121 
122  //- Read the fieldsExpression data
123  virtual bool read(const dictionary&);
124 
125  //- Calculate the result fields
126  virtual bool execute();
127 
128  //- Write the result fields
129  virtual bool write();
130 
131  //- Clear the result fields from the objectRegistry
132  virtual bool clear();
133 
134 
135  // Member Operators
136 
137  //- Disallow default bitwise assignment
138  void operator=(const fieldsExpression&) = delete;
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace functionObjects
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #ifdef NoRepository
150  #include "fieldsExpressionTemplates.C"
151 #endif
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
dictionary dict
virtual bool write()
Write the result fields.
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
void setResultName(const word &functionName, const wordList &defaultFieldNames=wordList::null())
bool calcAllTypes(FOType &fo)
Call &#39;calcType&#39; for the given functionObject.
virtual bool read(const dictionary &)
Read the fieldsExpression data.
engineTime & runTime
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
wordList fieldNames_
Names of fields to process.
static List< word > fieldNames
Definition: globalFoam.H:46
fieldsExpression(const word &name, const Time &runTime, const dictionary &dict, const wordList &fieldNames=wordList::null(), const word &resultName=word::null)
Construct from Time and dictionary.
A functionName is a word starting with &#39;#&#39;.
Definition: functionName.H:57
virtual bool execute()
Calculate the result fields.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool clear()
Clear the result fields from the objectRegistry.
static const word null
An empty word.
Definition: word.H:77
bool calcFieldTypes(FOType &fo)
Call &#39;calcFieldType&#39; for the given functionObject.
word resultName_
Name of result fields.
void operator=(const fieldsExpression &)=delete
Disallow default bitwise assignment.
bool calcType(FOType &fo)
Call &#39;calcFieldTypes&#39; for the given &#39;Type&#39; and functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
TypeName("fieldsExpression")
Runtime type information.
Namespace for OpenFOAM.