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-2026 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 fieldExpression_functionObject_H
38 #define fieldExpression_functionObject_H
39 
40 #include "fvMeshFunctionObject.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace functionObjects
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class fieldExpression Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class fieldExpression
54 :
56 {
57 protected:
58 
59  // Protected Data
60 
61  //- Word indicating that this fieldExpression has no field name
62  static const word noFieldName_;
63 
64  //- Word indicating that this fieldExpression has no default field
65  // name, so the user must provide one
66  static const word noDefaultFieldName_;
67 
68  //- Name of field to process
69  const word fieldName_;
70 
71  //- Name of result field
73 
74 
75  // Protected Member Functions
76 
77  virtual bool calc() = 0;
78 
79 
80 public:
81 
82  //- Runtime type information
83  TypeName("fieldExpression");
84 
85 
86  // Constructors
87 
88  //- Construct from Time and dictionary
90  (
91  const word& name,
92  const Time& runTime,
93  const dictionary& dict,
94  const word& functionName,
95  const word& defaultFieldName = noDefaultFieldName_
96  );
97 
98  //- Disallow default bitwise copy construction
99  fieldExpression(const fieldExpression&) = delete;
100 
101 
102  //- Destructor
103  virtual ~fieldExpression();
104 
105 
106  // Member Functions
107 
108  //- Return the field required
109  virtual wordList fields() const;
110 
111  //- Calculate the result field
112  virtual bool execute();
113 
114  //- Write the result field
115  virtual bool write();
116 
117  //- Clear the result field from the objectRegistry
118  virtual bool clear();
119 
120 
121  // Member Operators
122 
123  //- Disallow default bitwise assignment
124  void operator=(const fieldExpression&) = delete;
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace functionObjects
131 } // End namespace Foam
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #endif
136 
137 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A functionName is a word starting with '#'.
Definition: functionName.H:60
const word & name() const
Return the name of this functionObject.
static const word noFieldName_
Word indicating that this fieldExpression has no field name.
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &functionName, const word &defaultFieldName=noDefaultFieldName_)
Construct from Time and dictionary.
static const word noDefaultFieldName_
Word indicating that this fieldExpression has no default field.
virtual wordList fields() const
Return the field required.
word resultName_
Name of result field.
void operator=(const fieldExpression &)=delete
Disallow default bitwise assignment.
virtual bool clear()
Clear the result field from the objectRegistry.
const word fieldName_
Name of field to process.
TypeName("fieldExpression")
Runtime type information.
virtual bool execute()
Calculate the result field.
virtual bool write()
Write the result field.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
dictionary dict