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-2018 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& typeName,
74  const wordList& defaultArg = 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 private:
95 
96  // Private Member Functions
97 
98  //- Disallow default bitwise copy construct
100 
101  //- Disallow default bitwise assignment
102  void operator=(const fieldsExpression&);
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("fieldsExpression");
109 
110 
111  // Constructors
112 
113  //- Construct from Time and dictionary
115  (
116  const word& name,
117  const Time& runTime,
118  const dictionary& dict,
120  const word& resultName = word::null
121  );
122 
123 
124  //- Destructor
125  virtual ~fieldsExpression();
126 
127 
128  // Member Functions
129 
130  //- Read the fieldsExpression data
131  virtual bool read(const dictionary&);
132 
133  //- Calculate the result fields
134  virtual bool execute();
135 
136  //- Write the result fields
137  virtual bool write();
138 
139  //- Clear the result fields from the objectRegistry
140  virtual bool clear();
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace functionObjects
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #ifdef NoRepository
152  #include "fieldsExpressionTemplates.C"
153 #endif
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
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:137
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:117
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
virtual bool execute()
Calculate the result fields.
void setResultName(const word &typeName, const wordList &defaultArg=wordList::null())
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.
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.