FunctionObjectValueI.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
26\*---------------------------------------------------------------------------*/
27
28#include "FunctionObjectValue.H"
29
30// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
31
32template<class Type>
34(
35 const scalar /*unused*/
36) const
37{
38 const auto& props = this->time().functionObjects().propsDict();
39
40 if (!props.hasResultObject(foName_))
41 {
42 if (haveDefaultValue_)
43 {
45 << " Function object " << foName_
46 << " not found; using default value " << defaultValue_
47 << endl;
48
49 return defaultValue_;
50 }
51
53 << "Function object " << foName_
54 << " results not found. Valid objects with results include: "
55 << props.objectResultNames()
56 << exit(FatalError);
57 }
58
59 if (!props.hasResultObjectEntry(foName_, foResultName_))
60 {
61 if (haveDefaultValue_)
62 {
64 << " Function object " << foName_
65 << " result " << foResultName_
66 << " not found; using default value " << defaultValue_
67 << endl;
68
69 return defaultValue_;
70 }
71
73 << "Function object " << foName_
74 << " does not have a result field " << foResultName_ << nl
75 << " Available result fields include: "
76 << props.objectResultEntries(foName_)
77 << exit(FatalError);
78 }
79
80 Type value = props.template getObjectResult<Type>(foName_, foResultName_);
81
83 << " Using " << foName_ << " function object value: " << value
84 << endl;
85
86 return value;
87}
88
89
90template<class Type>
92(
93 const scalar x1,
94 const scalar x2
95) const
96{
99}
100
101
102// ************************************************************************* //
Returns a value retrieved from a function object result.
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values. Not implemented!
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
#define DebugInfo
Report an information message using Foam::Info.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
A non-counting (dummy) refCount.
Definition: refCount.H:59