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-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::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 private:
80 
81  // Private Member Functions
82 
83  //- Disallow default bitwise copy construct
85 
86  //- Disallow default bitwise assignment
87  void operator=(const fieldExpression&);
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("fieldExpression");
94 
95 
96  // Constructors
97 
98  //- Construct from Time and dictionary
100  (
101  const word& name,
102  const Time& runTime,
103  const dictionary& dict,
104  const word& fieldName = word::null,
105  const word& resultName = word::null
106  );
107 
108 
109  //- Destructor
110  virtual ~fieldExpression();
111 
112 
113  // Member Functions
114 
115  //- Read the fieldExpression data
116  virtual bool read(const dictionary&);
117 
118  //- Calculate the result field
119  virtual bool execute();
120 
121  //- Write the result field
122  virtual bool write();
123 
124  //- Clear the result field from the objectRegistry
125  virtual bool clear();
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace functionObjects
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #ifdef NoRepository
137  #include "fieldExpressionTemplates.C"
138 #endif
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
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:137
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.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Namespace for OpenFOAM.