Loading...
Searching...
No Matches
valuePointPatchField.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) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2020-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::valuePointPatchField
29
30Description
31 Foam::valuePointPatchField
32
33SourceFiles
34 valuePointPatchField.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_valuePointPatchField_H
39#define Foam_valuePointPatchField_H
40
41#include "pointPatchField.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class valuePointPatchField Declaration
50\*---------------------------------------------------------------------------*/
51
52template<class Type>
54:
55 public pointPatchField<Type>,
56 public Field<Type>
57{
58protected:
59
60 // Protected Member Functions
61
62 //- Read the "value" entry into \c *this.
63 // The reading can be optional (default), mandatory etc.
64 // \returns True on success
66 (
67 const dictionary& dict,
69 );
70
71 //- Write \c *this field as a "value" entry
73 {
75 }
76
77 //- Assign the patch field from the internal field
79
80
81public:
82
83 //- Declare type-name, virtual type (with debug switch)
84 TypeName("value");
85
86
87 // Generated Methods
89 //- Copy construct
91
92
93 // Constructors
94
95 //- Construct from patch and internal field
97 (
98 const pointPatch&,
100 );
101
102 //- Construct from patch, internal field and value
104 (
105 const pointPatch&,
107 const Type& value
108 );
109
110 //- Construct from patch, internal field and dictionary
112 (
113 const pointPatch&,
115 const dictionary& dict,
118 );
119
120 //- Construct, forwarding to readOption variant
122 (
123 const pointPatch& p,
125 const dictionary& dict,
126 const bool needValue
127 )
128 :
130 (
131 p, iF, dict,
132 (needValue? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
133 )
134 {}
136 //- Construct by mapping given patch field onto a new patch
138 (
140 const pointPatch&,
143 );
144
145 //- Copy construct onto patch with internal field reference
146 //- and specified value
148 (
149 const valuePointPatchField<Type>& pfld,
150 const pointPatch& p,
152 const Type& value
153 );
154
155 //- Copy construct with internal field reference
157 (
158 const valuePointPatchField<Type>& pfld,
160 );
161
162
163 //- Return a clone
164 virtual autoPtr<pointPatchField<Type>> clone() const
165 {
166 return pointPatchField<Type>::Clone(*this);
167 }
168
169 //- Construct and return a clone setting internal field reference
171 (
173 ) const
174 {
175 return pointPatchField<Type>::Clone(*this, iF);
176 }
177
178
179 // Member Functions
180
181 // Attributes
182
183 //- True: this patch field is altered by assignment by default.
184 virtual bool assignable() const
185 {
186 return true;
187 }
188
189
190 // Access
191
192 //- Return the field size
193 label size() const noexcept
195 return Field<Type>::size();
196 }
197
198
199 // Mapping functions
200
201 //- Map (and resize as needed) from self given a mapping object
202 virtual void autoMap
203 (
205 );
206
207 //- Reverse map the given PointPatchField onto
208 // this PointPatchField
209 virtual void rmap
212 const labelList&
213 );
214
215
216 // Evaluation functions
217
218 //- Update the coefficients associated with the patch field
219 virtual void updateCoeffs();
220
221 //- Evaluate the patch field
222 virtual void evaluate
223 (
224 const Pstream::commsTypes commsType =
226 );
227
228
229 //- Write
230 virtual void write(Ostream&) const;
231
232
233 // Member Operators
234
235 // Assignment operators
236
237 virtual void operator=(const valuePointPatchField<Type>&);
238 virtual void operator=(const pointPatchField<Type>&);
239 virtual void operator=(const Field<Type>&);
240 virtual void operator=(const Type&);
241
242 // Force an assignment irrespective of form of patch
243
244 virtual void operator==(const valuePointPatchField<Type>&);
245 virtual void operator==(const pointPatchField<Type>&);
246 virtual void operator==(const Field<Type>&);
247 virtual void operator==(const Type&);
248
249 // Prevent automatic comparison rewriting (c++20)
250 bool operator!=(const valuePointPatchField<Type>&) const = delete;
251 bool operator!=(const pointPatchField<Type>&) const = delete;
252 bool operator!=(const Field<Type>&) const = delete;
253 bool operator!=(const Type&) const = delete;
254};
255
256
257// This function is added to override the hack in pointPatchField.H
258// which enables simple backward compatibility with versions using
259// referenceLevel in GeometricField
260template<class Type>
261tmp<Field<Type>> operator+
262(
263 const valuePointPatchField<Type>& vsppf,
264 const Type& t
265)
266{
267 return static_cast<const Field<Type>&>(vsppf) + t;
268}
269
270
271// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272
273} // End namespace Foam
274
275// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276
277#ifdef NoRepository
278 #include "valuePointPatchField.C"
279#endif
280
281// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282
283#endif
284
285// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
Definition Field.C:754
constexpr Field() noexcept
Default construct.
Definition FieldI.H:24
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
readOption
Enumeration defining read preferences.
@ MUST_READ
Reading required.
@ LAZY_READ
Reading is optional [identical to READ_IF_PRESENT].
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
void size(const label n)
Definition UList.H:118
commsTypes
Communications types.
Definition UPstream.H:81
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
Definition UPstream.H:82
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Foam::pointPatchFieldMapper.
Abstract base class for point-mesh patch fields.
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
pointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
A class for managing temporary objects.
Definition tmp.H:75
Foam::valuePointPatchField.
valuePointPatchField(const pointPatch &p, const DimensionedField< Type, pointMesh > &iF, const dictionary &dict, const bool needValue)
Construct, forwarding to readOption variant.
virtual void operator==(const valuePointPatchField< Type > &)
valuePointPatchField(const valuePointPatchField &)=default
Copy construct.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
TypeName("value")
Declare type-name, virtual type (with debug switch).
bool operator!=(const valuePointPatchField< Type > &) const =delete
virtual autoPtr< pointPatchField< Type > > clone(const DimensionedField< Type, pointMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void operator=(const valuePointPatchField< Type > &)
bool operator!=(const Field< Type > &) const =delete
bool operator!=(const Type &) const =delete
label size() const noexcept
Return the field size.
virtual bool assignable() const
True: this patch field is altered by assignment by default.
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
virtual autoPtr< pointPatchField< Type > > clone() const
Return a clone.
void extrapolateInternal()
Assign the patch field from the internal field.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::buffered)
Evaluate the patch field.
bool operator!=(const pointPatchField< Type > &) const =delete
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
const direction noexcept
Definition scalarImpl.H:265
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68