Loading...
Searching...
No Matches
fieldValue.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2016-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::fieldValue
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Intermediate class for handling field value-based function objects.
35
36Usage
37 Minimal example by using \c system/controlDict.functions:
38 \verbatim
39 FOname
40 {
41 // Mandatory and optional entries
42 ...
43
44 // Mandatory entries
45 fields (<wordList>); // (<field1> <field2> ... <fieldN>);
46
47 // Optional entries
48 writeFields <bool>;
49 scaleFactor <scalar>;
50 }
51 \endverbatim
52
53 where the entries mean:
54 \table
55 Property | Description | Type | Reqd | Deflt
56 fields | Names of operand fields | wordList | yes | -
57 writeFields | Flag to output field values | bool | no | false
58 scaleFactor | Scaling factor | scalar | no | 1.0
59 \endtable
60
61 The inherited entries are elaborated in:
62 - \link functionObject.H \endlink
63 - \link writeFile.H \endlink
64
65SourceFiles
66 fieldValue.C
67 fieldValueTemplates.C
68
69\*---------------------------------------------------------------------------*/
70
71#ifndef Foam_functionObjects_fieldValue_H
72#define Foam_functionObjects_fieldValue_H
73
75#include "writeFile.H"
76#include "Field.H"
77
78// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79
80namespace Foam
81{
82
83namespace functionObjects
84{
85
86/*---------------------------------------------------------------------------*\
87 Class fieldValue Declaration
88\*---------------------------------------------------------------------------*/
89
90class fieldValue
91:
93 public writeFile
94{
95protected:
96
97 // Protected Data
98
99 //- Flag to output field values
100 bool writeFields_;
101
102 //- Name of region (patch, zone, etc.)
103 word regionName_;
104
105 //- Scaling factor
106 scalar scaleFactor_;
107
108 //- Construction dictionary
110
111 //- Names of operand fields
113
114
115 // Protected Member Functions
116
117 //- Combine fields from all processor domains into single field
118 template<class Type>
120
121 //- Combine fields from all processor domains into single field
122 template<class Type>
124
125
126public:
127
128 //- Run-time type information
129 TypeName("fieldValue");
130
131 // Declare runtime constructor selection table
132
134 (
135 autoPtr,
137 runTime,
138 (
139 const word& name,
140 const Time& runTime,
142 ),
143 (name, runTime, dict)
144 );
145
146 // Constructors
147
148 //- Construct from name, Time and dictionary
150 (
151 const word& name,
152 const Time& runTime,
153 const dictionary& dict,
154 const word& valueType
155 );
156
157 //- Construct from objectRegistry and dictionary
159 (
160 const word& name,
161 const objectRegistry& obr,
162 const dictionary& dict,
163 const word& valueType
164 );
165
166 //- Return a reference to the selected fieldValue
169 const word& name,
170 const Time& runTime,
171 const dictionary& dict,
172 const bool output = true
173 );
174
175
176 //- Destructor
177 virtual ~fieldValue() = default;
178
179
180 // Member Functions
181
182 //- Return the reference to the construction dictionary
183 inline const dictionary& dict() const noexcept;
184
185 //- Return the region name
186 inline const word& regionName() const noexcept;
187
188 //- Return the list of field names
189 inline const wordList& fields() const noexcept;
190
191 //- Return the output field values flag
192 inline bool writeFields() const noexcept;
193
194 //- Read the function-object dictionary
195 virtual bool read(const dictionary& dict);
196
197 //- Execute the function-object operations
198 virtual bool execute();
199
200 //- Write the function-object results
201 virtual bool write();
202};
203
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207} // End namespace functionObjects
208} // End namespace Foam
209
210// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211
212#include "fieldValueI.H"
213
214// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215
216#ifdef NoRepository
217 #include "fieldValueTemplates.C"
218#endif
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222#endif
223
224// ************************************************************************* //
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
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 value-based function objects.
Definition fieldValue.H:113
const wordList & fields() const noexcept
Return the list of field names.
Definition fieldValueI.H:38
declareRunTimeSelectionTable(autoPtr, fieldValue, runTime,(const word &name, const Time &runTime, const dictionary &dict),(name, runTime, dict))
scalar scaleFactor_
Scaling factor.
Definition fieldValue.H:131
word regionName_
Name of region (patch, zone, etc.).
Definition fieldValue.H:126
bool writeFields() const noexcept
Return the output field values flag.
Definition fieldValueI.H:45
TypeName("fieldValue")
Run-time type information.
dictionary dict_
Construction dictionary.
Definition fieldValue.H:136
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition fieldValue.C:82
wordList fields_
Names of operand fields.
Definition fieldValue.H:141
virtual ~fieldValue()=default
Destructor.
fieldValue(const word &name, const Time &runTime, const dictionary &dict, const word &valueType)
Construct from name, Time and dictionary.
Definition fieldValue.C:41
const dictionary & dict() const noexcept
Return the reference to the construction dictionary.
Definition fieldValueI.H:24
const word & regionName() const noexcept
Return the region name.
Definition fieldValueI.H:31
bool writeFields_
Flag to output field values.
Definition fieldValue.H:121
virtual bool execute()
Execute the function-object operations.
Definition fieldValue.C:102
static autoPtr< fieldValue > New(const word &name, const Time &runTime, const dictionary &dict, const bool output=true)
Return a reference to the selected fieldValue.
virtual bool write()
Write the function-object results.
Definition fieldValue.C:108
void combineFields(Field< Type > &field)
Combine fields from all processor domains into single field.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
virtual const objectRegistry & obr() const
The region or sub-region registry being used.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
Registry of regIOobjects.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
const direction noexcept
Definition scalarImpl.H:265
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68