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-2022 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 
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 member data
60 
61  //- Name of field to process
62  const word fieldName_;
63 
64  //- Name of result field
66 
67 
68  // Protected member functions
69 
70  virtual bool calc() = 0;
71 
72 
73 public:
74 
75  //- Runtime type information
76  TypeName("fieldExpression");
77 
78 
79  // Constructors
80 
81  //- Construct from Time and dictionary
83  (
84  const word& name,
85  const Time& runTime,
86  const dictionary& dict,
87  const word& functionName,
88  const word& defaultFieldName = word::null
89  );
90 
91  //- Disallow default bitwise copy construction
92  fieldExpression(const fieldExpression&) = delete;
93 
94 
95  //- Destructor
96  virtual ~fieldExpression();
97 
98 
99  // Member Functions
100 
101  //- Return the field required
102  virtual wordList fields() const;
103 
104  //- Calculate the result field
105  virtual bool execute();
106 
107  //- Write the result field
108  virtual bool write();
109 
110  //- Clear the result field from the objectRegistry
111  virtual bool clear();
112 
113 
114  // Member Operators
115 
116  //- Disallow default bitwise assignment
117  void operator=(const fieldExpression&) = delete;
118 };
119 
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 } // End namespace functionObjects
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
A functionName is a word starting with '#'.
Definition: functionName.H:60
const word & name() const
Return the name of this functionObject.
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &functionName, const word &defaultFieldName=word::null)
Construct from Time and dictionary.
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:62
static const word null
An empty word.
Definition: word.H:77
Namespace for OpenFOAM.
dictionary dict