Loading...
Searching...
No Matches
LookupField.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::PatchFunction1Types::LookupField
28
29Description
30 PatchFunction1 to lookup volField/surfaceField or pointField from an
31 objectregistry and return its value on the patch.
32
33 The dictionary specification would typically resemble this:
34 \verbatim
35 entry
36 {
37 type lookup;
38 name myField;
39 }
40 \endverbatim
41
42 where the entries mean:
43 \table
44 Property | Description | Type | Reqd | Default
45 type | Function type: lookup | word | yes |
46 name | name of volField/pointField | word | yes |
47 \endtable
48
49SourceFiles
50 LookupField.C
51
52\*---------------------------------------------------------------------------*/
53
54#ifndef PatchFunction1Types_LookupField_H
55#define PatchFunction1Types_LookupField_H
56
57#include "PatchFunction1.H"
58#include "lookupBase.H"
59
60// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62namespace Foam
63{
64namespace PatchFunction1Types
65{
66
67/*---------------------------------------------------------------------------*\
68 Class LookupField Declaration
69\*---------------------------------------------------------------------------*/
70
71template<class Type>
72class LookupField
73:
74 public PatchFunction1<Type>,
75 protected lookupBase
76{
78
79public:
80
81 // Runtime type information
82 TypeName("lookup");
83
84
85 // Generated Methods
86
87 //- No copy assignment
88 void operator=(const LookupField<Type>&) = delete;
89
90
91 // Constructors
92
93 //- Construct from entry name, dictionary and optional registry
95 (
96 const polyPatch& pp,
97 const word& redirectType,
98 const word& entryName,
99 const dictionary& dict,
100 const bool faceValues = true
101 );
102
103 //- Copy construct, setting patch
104 explicit LookupField
105 (
106 const LookupField<Type>& rhs,
107 const polyPatch& pp
108 );
109
110 //- Copy construct
111 explicit LookupField(const LookupField<Type>& rhs);
112
113 //- Construct and return a clone
114 virtual tmp<PatchFunction1<Type>> clone() const
115 {
117 }
118
119 //- Return a clone, setting the patch
120 virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const
121 {
122 return PatchFunction1<Type>::Clone(*this, pp);
123 }
124
125
126 //- Destructor
127 virtual ~LookupField() = default;
128
129
130 // Member Functions
131
132 //- Is value uniform (i.e. independent of coordinate)
133 virtual inline bool uniform() const { return false; }
134
135
136 // Evaluation
138 //- Return Lookup value
139 virtual tmp<Field<Type>> value(const scalar x) const;
140
141 //- Integrate between two values
143 (
144 const scalar x1,
145 const scalar x2
146 ) const;
147
148
149 // I-O
150
151 //- Write in dictionary format
152 virtual void writeData(Ostream& os) const;
153};
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158} // End namespace PatchFunction1Types
159} // End namespace Foam
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163#ifdef NoRepository
164 #include "LookupField.C"
165#endif
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169#endif
170
171// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
PatchFunction1 to lookup volField/surfaceField or pointField from an objectregistry and return its va...
Definition LookupField.H:89
virtual tmp< Field< Type > > integrate(const scalar x1, const scalar x2) const
Integrate between two values.
void operator=(const LookupField< Type > &)=delete
No copy assignment.
virtual bool uniform() const
Is value uniform (i.e. independent of coordinate).
virtual void writeData(Ostream &os) const
Write in dictionary format.
virtual tmp< PatchFunction1< Type > > clone(const polyPatch &pp) const
Return a clone, setting the patch.
virtual tmp< Field< Type > > value(const scalar x) const
Return Lookup value.
Definition LookupField.C:72
virtual tmp< PatchFunction1< Type > > clone() const
Construct and return a clone.
LookupField(const polyPatch &pp, const word &redirectType, const word &entryName, const dictionary &dict, const bool faceValues=true)
Construct from entry name, dictionary and optional registry.
Definition LookupField.C:33
virtual ~LookupField()=default
Destructor.
const polyPatch const word const word & entryName
const polyPatch const word const word const dictionary & dict
static tmp< PatchFunction1< Type > > Clone(const Derived &fun)
Clone a PatchFunction1.
const polyPatch & pp
const polyPatch const word const word const dictionary const bool faceValues
lookupBase(const dictionary &dict)
Construct from dictionary.
Definition lookupBase.C:25
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
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)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68