Loading...
Searching...
No Matches
fieldExpression.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2016 OpenFOAM Foundation
9 Copyright (C) 2019-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionObjects::fieldExpression
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Intermediate class for handling field expression function objects
35 (e.g. \c blendingFactor etc.) whereinto a single field is input.
36
37Usage
38 Minimal example by using \c system/controlDict.functions:
39 \verbatim
40 FOname
41 {
42 // Mandatory and optional entries
43 ...
44
45 // Mandatory entries
46 field <word>;
47
48 // Optional entries
49 result <word>;
50 cellZones (<word> <word> ... <word>);
51 }
52 \endverbatim
53
54 where the entries mean:
55 \table
56 Property | Description | Type | Reqd | Deflt
57 field | Name of the operand field | word | yes | -
58 result | Name of the output field | word | no | <FO>(<field>)
59 cellZones | Names of cellZones | wordRes | no | -
60 \endtable
61
62SourceFiles
63 fieldExpression.C
64 fieldExpressionTemplates.C
65
66\*---------------------------------------------------------------------------*/
67
68#ifndef Foam_functionObjects_fieldExpression_H
69#define Foam_functionObjects_fieldExpression_H
70
72#include "volFieldsFwd.H"
73#include "zoneSubSet.H"
74
75// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76
77namespace Foam
78{
79namespace functionObjects
80{
81
82/*---------------------------------------------------------------------------*\
83 Class fieldExpression Declaration
84\*---------------------------------------------------------------------------*/
85
87:
89{
90protected:
91
92 // Protected Data
93
94 //- Name of field to process
95 word fieldName_;
96
97 //- Name of result field
98 word resultName_;
99
100 //- Sub-set mesh
101 autoPtr<Detail::zoneSubSet> zoneSubSetPtr_;
102
103
104 // Protected Member Functions
106 //- Calculate the components of the field and return true if successful
107 virtual bool calc() = 0;
108
109 //- Set the name of result field
110 void setResultName(const word& typeName, const word& defaultArg);
111
112 //- Return true if required objects are found
113 template<class Type>
114 bool foundObject(const word& name, const bool verbose = true) const;
115
117public:
118
119 //- Runtime type information
120 TypeName("fieldExpression");
122
123 // Constructors
124
125 //- Construct from name, Time and dictionary
127 (
128 const word& name,
129 const Time& runTime,
130 const dictionary& dict,
131 const word& fieldName = word::null,
132 const word& resultName = word::null
133 );
135 //- No copy construct
136 fieldExpression(const fieldExpression&) = delete;
137
138 //- No copy assignment
139 void operator=(const fieldExpression&) = delete;
140
141
142 //- Destructor
143 virtual ~fieldExpression() = default;
144
145
146 // Member Functions
147
148 //- Read the function-object dictionary
149 virtual bool read(const dictionary& dict);
150
151 //- Execute the function-object operations
152 virtual bool execute();
154 //- Write the function-object results
155 virtual bool write();
156
157 //- Clear the result field from the objectRegistry
158 virtual bool clear();
159};
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164} // End namespace functionObjects
165} // End namespace Foam
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169#ifdef NoRepository
171#endif
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175#endif
176
177// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
bool foundObject(const word &name, const bool verbose=true) const
Return true if required objects are found.
fieldExpression(const fieldExpression &)=delete
No copy construct.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
word resultName_
Name of result field.
void operator=(const fieldExpression &)=delete
No copy assignment.
word fieldName_
Name of field to process.
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &fieldName=word::null, const word &resultName=word::null)
Construct from name, Time and dictionary.
virtual bool clear()
Clear the result field from the objectRegistry.
TypeName("fieldExpression")
Runtime type information.
virtual ~fieldExpression()=default
Destructor.
virtual bool execute()
Execute the function-object operations.
autoPtr< Detail::zoneSubSet > zoneSubSetPtr_
Sub-set mesh.
virtual bool write()
Write the function-object results.
virtual bool calc()=0
Calculate the components of the field and return true if successful.
void setResultName(const word &typeName, const word &defaultArg)
Set the name of result field.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
A class for handling words, derived from Foam::string.
Definition word.H:66
static const word null
An empty word.
Definition word.H:84
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
Forwards and collection of common volume field types.