Loading...
Searching...
No Matches
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) 2024 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::substitutionModels::functionObjectValue
28
29Description
30 functionObjectValue substitution model.
31
32Usage
33 The \c functionObjectValue substitution model.
34
35 The example below shows how the keywords \c cont_error_* are set by
36 retrieving the values \c local, \c global, \c cumulative from the function
37 object \c functionObjectValue.
38
39 \verbatim
40 functionObjectValue1
41 {
42 // Mandatory entries
43 type functionObjectValue;
44 functionObject continuityError1;
45
46 entries
47 {
48 cont_error_local local;
49 cont_error_global global;
50 cont_error_cumulative cumulative;
51 }
52
53 // Optional entries
54 debugValues <bool>;
55
56 // Inherited entries
57 ...
58 }
59 \endverbatim
60
61 The entries mean:
62 \table
63 Property | Description | Type | Reqd | Deflt
64 type | Type name: functionObjectValue | word | yes | -
65 functionObject | Name of function object to query | word | yes | -
66 entries | Keyword-lookup pairs | dictionary | yes | -
67 debugValues | Flag to show available function values | bool | no | false
68 \endtable
69
70 The inherited entries are elaborated in:
71 - \link substitutionModel.H \endlink
72
73SourceFiles
74 functionObjectValue.C
75
76---------------------------------------------------------------------------*/
77
78#ifndef Foam_substitutionModels_functionObjectValue_H
79#define Foam_substitutionModels_functionObjectValue_H
80
81#include "substitutionModel.H"
82
83// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84
85namespace Foam
86{
87
88namespace substitutionModels
89{
90
91/*---------------------------------------------------------------------------*\
92 Class functionObjectValue Declaration
93\*---------------------------------------------------------------------------*/
94
96:
97 public substitutionModel
98{
99 // Private Data
100
101 //- Name of function object
102 const word functionObject_;
103
104 //- Hash table for key and entry-lookup pairs
105 HashTable<word> entries_;
106
107 //- Debug - shows available function values
108 bool debugValues_;
109
110
111 // Private Functions
112
113 //- Get the result value from the function object
114 template<class Type>
115 bool getValue(OStringStream& oss, const word& lookup) const;
116
117 //- No copy construct
118 functionObjectValue(const functionObjectValue&) = delete;
119
120 //- No copy assignment
121 void operator=(const functionObjectValue&) = delete;
122
123
124public:
125
126 //- Runtime type information
127 TypeName("functionObjectValue");
128
129
130 //- Constructor
131 functionObjectValue
132 (
133 const dictionary& dict,
134 const Time& time
135 );
136
137
138 //- Destructor
139 virtual ~functionObjectValue() = default;
140
141
142 // Member Functions
143
144 //- Update model local data
145 virtual bool update();
146
147 //- Return true of model applies to this keyName
148 virtual bool valid(const word& keyName) const;
149
150 //- Apply substitutions to this string buffer
151 virtual bool apply(const word& key, string& buffer) const;
152
153 //- Return a word list of the keys
154 virtual wordList keys() const;
155};
156
157
158// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159
160} // End namespace substitutionModels
161} // End namespace Foam
162
163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164
165#endif
167// ************************************************************************* //
A HashTable similar to std::unordered_map.
Definition HashTable.H:124
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Lookup type of boundary radiation properties.
Definition lookup.H:60
functionObjectValue substitution model.
TypeName("functionObjectValue")
Runtime type information.
virtual bool apply(const word &key, string &buffer) const
Apply substitutions to this string buffer.
virtual ~functionObjectValue()=default
Destructor.
virtual bool valid(const word &keyName) const
Return true of model applies to this keyName.
virtual bool update()
Update model local data.
virtual wordList keys() const
Return a word list of the keys.
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68