fieldExpression.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::fieldExpression
26 
27 Description
28 
29 See also
30  Foam::functionObjects::fvMeshFunctionObject
31 
32 SourceFiles
33  fieldExpression.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef functionObjects_fieldExpression_H
38 #define functionObjects_fieldExpression_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 fieldExpression Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class fieldExpression
55 :
57 {
58 protected:
59 
60  // Protected member data
61 
62  //- Name of field to process
63  const word fieldName_;
64 
65  //- Name of result field
67 
68 
69  // Protected member functions
70 
71  virtual bool calc() = 0;
72 
73  template<class Type>
74  bool foundObject(const word& name);
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("fieldExpression");
81 
82 
83  // Constructors
84 
85  //- Construct from Time and dictionary
87  (
88  const word& name,
89  const Time& runTime,
90  const dictionary& dict,
91  const word& functionName,
92  const word& defaultFieldName = word::null
93  );
94 
95  //- Disallow default bitwise copy construction
96  fieldExpression(const fieldExpression&) = delete;
97 
98 
99  //- Destructor
100  virtual ~fieldExpression();
101 
102 
103  // Member Functions
104 
105  //- Read the fieldExpression data
106  virtual bool read(const dictionary&);
107 
108  //- Calculate the result field
109  virtual bool execute();
110 
111  //- Write the result field
112  virtual bool write();
113 
114  //- Clear the result field from the objectRegistry
115  virtual bool clear();
116 
117 
118  // Member Operators
119 
120  //- Disallow default bitwise assignment
121  void operator=(const fieldExpression&) = delete;
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace functionObjects
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #ifdef NoRepository
133  #include "fieldExpressionTemplates.C"
134 #endif
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
dictionary dict
word resultName_
Name of result field.
TypeName("fieldExpression")
Runtime type information.
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
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
A functionName is a word starting with &#39;#&#39;.
Definition: functionName.H:57
A class for handling words, derived from string.
Definition: word.H:59
static const word null
An empty word.
Definition: word.H:77
virtual bool write()
Write the result field.
virtual bool read(const dictionary &)
Read the fieldExpression data.
virtual bool execute()
Calculate the result field.
const word fieldName_
Name of field to process.
virtual bool clear()
Clear the result field from the objectRegistry.
void operator=(const fieldExpression &)=delete
Disallow default bitwise assignment.
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &functionName, const word &defaultFieldName=word::null)
Construct from Time and dictionary.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Namespace for OpenFOAM.