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
64 
65  //- Name of result field
67 
68 
69  // Protected member functions
70 
71  virtual bool calc() = 0;
72 
73  void setResultName(const word& typeName, const word& defaultArg);
74 
75  template<class Type>
76  bool foundObject(const word& name);
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("fieldExpression");
83 
84 
85  // Constructors
86 
87  //- Construct from Time and dictionary
89  (
90  const word& name,
91  const Time& runTime,
92  const dictionary& dict,
93  const word& fieldName = word::null,
94  const word& resultName = word::null
95  );
96 
97  //- Disallow default bitwise copy construction
98  fieldExpression(const fieldExpression&) = delete;
99 
100 
101  //- Destructor
102  virtual ~fieldExpression();
103 
104 
105  // Member Functions
106 
107  //- Read the fieldExpression data
108  virtual bool read(const dictionary&);
109 
110  //- Calculate the result field
111  virtual bool execute();
112 
113  //- Write the result field
114  virtual bool write();
115 
116  //- Clear the result field from the objectRegistry
117  virtual bool clear();
118 
119 
120  // Member Operators
121 
122  //- Disallow default bitwise assignment
123  void operator=(const fieldExpression&) = delete;
124 };
125 
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace functionObjects
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #ifdef NoRepository
135  #include "fieldExpressionTemplates.C"
136 #endif
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &fieldName=word::null, const word &resultName=word::null)
Construct from Time and dictionary.
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
word fieldName_
Name of field to process.
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
void setResultName(const word &typeName, const word &defaultArg)
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.
virtual bool clear()
Clear the result field from the objectRegistry.
void operator=(const fieldExpression &)=delete
Disallow default bitwise assignment.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Namespace for OpenFOAM.