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 -------------------------------------------------------------------------------
10 License
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 Class
27  Foam::Function1Types::Lookup
28 
29 Description
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 
48 SourceFiles
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 
61 namespace Foam
62 {
63 namespace Function1Types
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class Lookup Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class Type>
71 class Lookup
72 :
73  public lookupBase,
74  public Function1<Type>
75 {
76 public:
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);
100 
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 // ************************************************************************* //
virtual void writeData(Ostream &os) const
Write in dictionary format.
Definition: Lookup.C:71
Function1 to lookup UniformDimensionedField from an objectregistry.
Definition: Lookup.H:84
const word const dictionary & dict
Definition: Function1.H:140
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
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
const word & entryName
Definition: Function1.H:140
virtual Type integrate(const scalar x1, const scalar x2) const
Integrate between two (scalar) values.
Definition: Lookup.C:61
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual void writeEntries(Ostream &os) const
Write coefficient entries in dictionary format.
Definition: lookupBase.C:39
virtual tmp< Function1< Type > > clone() const
Construct and return a clone.
Definition: Lookup.H:123
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
const word const dictionary const objectRegistry * obrPtr
Definition: Function1.H:140
virtual Type value(const scalar t) const
Return value for time t.
Definition: Lookup.C:49
virtual ~Lookup()=default
Destructor.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Registry of regIOobjects.
Namespace for OpenFOAM.