fieldsExpression.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2012-2016 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 Group
28  grpFieldFunctionObjects
29 
30 Description
31 
32 See also
33  Foam::functionObjects::fvMeshFunctionObject
34 
35 SourceFiles
36  fieldsExpression.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef functionObjects_fieldsExpression_H
41 #define functionObjects_fieldsExpression_H
42 
43 #include "fvMeshFunctionObject.H"
44 #include "volFieldsFwd.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace functionObjects
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class fieldsExpression Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class fieldsExpression
58 :
60 {
61 protected:
62 
63  // Protected member data
64 
65  //- Names of fields to process
67 
68  //- Name of result fields
70 
71 
72  // Protected member functions
73 
74  void setResultName
75  (
76  const word& typeName,
77  const wordList& defaultArg = wordList::null()
78  );
79 
80  //- Call 'calcFieldType' for the given functionObject
81  // for 'volField' and 'surfaceField' field types
82  template<class Type, class FOType>
83  bool calcFieldTypes(FOType& fo);
84 
85  //- Call 'calcFieldTypes' for the given 'Type' and functionObject
86  template<class Type, class FOType>
87  bool calcType(FOType& fo);
88 
89  //- Call 'calcType' for the given functionObject
90  // for each primitive type
91  template<class FOType>
92  bool calcAllTypes(FOType& fo);
93 
94  virtual bool calc() = 0;
95 
96 
97 private:
98 
99  // Private Member Functions
100 
101  //- Disallow default bitwise copy construct
103 
104  //- Disallow default bitwise assignment
105  void operator=(const fieldsExpression&);
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("fieldsExpression");
112 
113 
114  // Constructors
115 
116  //- Construct from Time and dictionary
118  (
119  const word& name,
120  const Time& runTime,
121  const dictionary& dict,
123  const word& resultName = word::null
124  );
125 
126 
127  //- Destructor
128  virtual ~fieldsExpression();
129 
130 
131  // Member Functions
132 
133  //- Read the fieldsExpression data
134  virtual bool read(const dictionary&);
135 
136  //- Calculate the result fields
137  virtual bool execute();
138 
139  //- Write the result fields
140  virtual bool write();
141 
142  //- Clear the result fields from the objectRegistry
143  virtual bool clear();
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace functionObjects
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #ifdef NoRepository
155  #include "fieldsExpressionTemplates.C"
156 #endif
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #endif
161 
162 // ************************************************************************* //
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.
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.