FunctionObjectValue.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) 2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::Function1Types::FunctionObjectValue
28
29Description
30 Returns a value retrieved from a function object result.
31
32 Usage:
33 \verbatim
34 <entryName> functionObjectValue;
35 <entryName>Coeffs
36 {
37 functionObject <name>;
38 functionObjectResult <function object result field>;
39 defaultValue <value>; // optional
40 }
41 \endverbatim
42
43Note
44- does not implement integrate()
45
46SourceFiles
47 FunctionObjectValue.C
48 FunctionObjectValueI.H
49
50\*---------------------------------------------------------------------------*/
51
52#ifndef Function1Types_FunctionObjectValue_H
53#define Function1Types_FunctionObjectValue_H
54
55#include "Function1.H"
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59namespace Foam
60{
61namespace Function1Types
62{
63
64/*---------------------------------------------------------------------------*\
65 Class FunctionObjectValue Declaration
66\*---------------------------------------------------------------------------*/
67
68template<class Type>
70:
71 public Function1<Type>
72{
73 // Private Data
74
75 //- Function object name
76 word foName_;
77
78 //- Function object result name
79 word foResultName_;
80
81 //- Default value when function object result is unavailable
82 Type defaultValue_;
83
84 //- Flag to indicate that default value is available
85 bool haveDefaultValue_;
86
87
88 // Private Member Functions
89
90 //- Read the coefficients from the given dictionary
91 void read(const dictionary& coeffs);
92
93
94public:
95
96 //- Runtime type information
97 TypeName("functionObjectValue");
98
99
100 // Generated Methods
101
102 //- No copy assignment
103 void operator=(const FunctionObjectValue<Type>&) = delete;
104
105
106 // Constructors
107
108 //- Construct from entry name, dictionary and optional registry
110 (
111 const word& entryName,
112 const dictionary& dict,
113 const objectRegistry* obrPtr = nullptr
114 );
115
116 //- Copy construct
118
119 //- Construct and return a clone
120 virtual tmp<Function1<Type>> clone() const
121 {
123 }
124
125
126 //- Destructor
127 virtual ~FunctionObjectValue() = default;
128
129
130 // Member Functions
131
132 //- Return value at current time
133 virtual inline Type value(const scalar /*unused*/) const;
134
135 //- Integrate between two (scalar) values. Not implemented!
136 virtual Type integrate(const scalar x1, const scalar x2) const;
137
138 //- Write in dictionary format
139 virtual void writeData(Ostream& os) const;
140
141 //- Write coefficient entries in dictionary format
142 virtual void writeEntries(Ostream& os) const;
143};
144
145
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148} // End namespace Function1Types
149} // End namespace Foam
150
151// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153#include "FunctionObjectValueI.H"
154
155#ifdef NoRepository
156 #include "FunctionObjectValue.C"
157#endif
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161#endif
162
163// ************************************************************************* //
Returns a value retrieved from a function object result.
TypeName("functionObjectValue")
Runtime type information.
virtual tmp< Function1< Type > > clone() const
Construct and return a clone.
virtual void writeData(Ostream &os) const
Write in dictionary format.
virtual void writeEntries(Ostream &os) const
Write coefficient entries in dictionary format.
virtual Type value(const scalar) const
Return value at current time.
void operator=(const FunctionObjectValue< Type > &)=delete
No copy assignment.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values. Not implemented!
virtual ~FunctionObjectValue()=default
Destructor.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Definition: Function1.H:96
const word const dictionary & dict
Definition: Function1.H:134
const word const dictionary const objectRegistry * obrPtr
Definition: Function1.H:136
const word & entryName
Definition: Function1.H:133
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Registry of regIOobjects.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73