Loading...
Searching...
No Matches
Lookup.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::Function1Types::Lookup
28
29Description
30 Function1 to lookup UniformDimensionedField from an objectregistry.
31
32 The dictionary specification would typically resemble this:
33 \verbatim
34 entry
35 {
36 type lookup;
37 name myScalar;
38 }
39 \endverbatim
40
41 where the entries mean:
42 \table
43 Property | Description | Type | Reqd | Default
44 type | Function type: lookup | word | yes |
45 name | name of variable | word | yes |
46 \endtable
47
48SourceFiles
49 Lookup.C
50
51\*---------------------------------------------------------------------------*/
52
53#ifndef Function1Types_Lookup_H
54#define Function1Types_Lookup_H
55
56#include "Function1.H"
57#include "lookupBase.H"
58
59// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60
61namespace Foam
62{
63namespace Function1Types
64{
65
66/*---------------------------------------------------------------------------*\
67 Class Lookup Declaration
68\*---------------------------------------------------------------------------*/
69
70template<class Type>
71class Lookup
72:
73 public lookupBase,
74 public Function1<Type>
75{
76public:
77
78 // Runtime type information
79 TypeName("lookup");
80
81
82 // Generated Methods
83
84 //- No copy assignment
85 void operator=(const Lookup<Type>&) = delete;
86
87
88 // Constructors
89
90 //- Construct from entry name, dictionary and optional registry
91 Lookup
92 (
93 const word& entryName,
94 const dictionary& dict,
95 const objectRegistry* obrPtr = nullptr
96 );
97
98 //- Copy construct
99 explicit Lookup(const Lookup<Type>& rhs);
101 //- Construct and return a clone
102 virtual tmp<Function1<Type>> clone() const
103 {
104 return tmp<Function1<Type>>(new Lookup<Type>(*this));
105 }
106
107
108 //- Destructor
109 virtual ~Lookup() = default;
110
111
112 // Member Functions
113
114 //- Return value for time t
115 virtual Type value(const scalar t) const;
116
117 //- Integrate between two (scalar) values
118 virtual Type integrate(const scalar x1, const scalar x2) const;
119
120 //- Write in dictionary format
121 virtual void writeData(Ostream& os) const;
122
124};
125
126
127// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128
129} // End namespace Function1Types
130} // End namespace Foam
131
132// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133
134#ifdef NoRepository
135 #include "Lookup.C"
136#endif
137
138// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139
140#endif
141
142// ************************************************************************* //
Function1 to lookup UniformDimensionedField from an objectregistry.
Definition Lookup.H:88
virtual tmp< Function1< Type > > clone() const
Construct and return a clone.
Definition Lookup.H:123
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition Lookup.C:71
void operator=(const Lookup< Type > &)=delete
No copy assignment.
Lookup(const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr)
Construct from entry name, dictionary and optional registry.
Definition Lookup.C:27
virtual Type value(const scalar t) const
Return value for time t.
Definition Lookup.C:49
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
Definition Lookup.C:61
virtual ~Lookup()=default
Destructor.
Function1(const word &entryName, const objectRegistry *obrPtr=nullptr)
Construct from entry name.
Definition Function1.C:31
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
virtual void writeEntries(Ostream &os) const
Write coefficient entries in dictionary format.
Definition lookupBase.C:39
lookupBase(const dictionary &dict)
Construct from dictionary.
Definition lookupBase.C:25
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
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68