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-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::valuePointPatchField
29 
30 Description
31  Foam::valuePointPatchField
32 
33 SourceFiles
34  valuePointPatchField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_valuePointPatchField_H
39 #define Foam_valuePointPatchField_H
40 
41 #include "pointPatchField.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class valuePointPatchField Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class Type>
54 :
55  public pointPatchField<Type>,
56  public Field<Type>
57 {
58 protected:
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
65  bool readValueEntry
66  (
67  const dictionary& dict,
69  );
70 
71  //- Write \c *this field as a "value" entry
72  void writeValueEntry(Ostream& os) const
73  {
74  Field<Type>::writeEntry("value", os);
75  }
76 
77  //- Assign the patch field from the internal field
78  void extrapolateInternal();
79 
80 
81 public:
82 
83  //- Declare type-name, virtual type (with debug switch)
84  TypeName("value");
85 
86 
87  // Generated Methods
88 
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 valueReqd
127  )
128  :
130  (
131  p, iF, dict,
132  (valueReqd? IOobjectOption::MUST_READ : IOobjectOption::NO_READ)
133  )
134  {}
135 
136  //- Construct by mapping given patch field onto a new patch
138  (
140  const pointPatch&,
142  const pointPatchFieldMapper&
143  );
144 
145  //- Construct and return a clone
146  virtual autoPtr<pointPatchField<Type>> clone() const
147  {
149  (
151  (
152  *this
153  )
154  );
155  }
156 
157  //- Construct as copy setting internal field reference
159  (
162  );
163 
164  //- Construct and return a clone setting internal field reference
166  (
168  ) const
169  {
171  (
173  (
174  *this,
175  iF
176  )
177  );
178  }
179 
180 
181  // Member Functions
182 
183  // Access
184 
185  //- Return size
186  label size() const
187  {
189  }
190 
191 
192  // Mapping functions
193 
194  //- Map (and resize as needed) from self given a mapping object
195  virtual void autoMap
196  (
197  const pointPatchFieldMapper&
198  );
199 
200  //- Reverse map the given PointPatchField onto
201  // this PointPatchField
202  virtual void rmap
203  (
204  const pointPatchField<Type>&,
205  const labelList&
206  );
207 
208 
209  // Evaluation functions
211  //- Update the coefficients associated with the patch field
212  virtual void updateCoeffs();
213 
214  //- Evaluate the patch field
215  virtual void evaluate
216  (
217  const Pstream::commsTypes commsType =
219  );
220 
221 
222  //- Write
223  virtual void write(Ostream&) const;
224 
225 
226  // Member Operators
227 
228  // Assignment operators
229 
230  virtual void operator=(const valuePointPatchField<Type>&);
231  virtual void operator=(const pointPatchField<Type>&);
232  virtual void operator=(const Field<Type>&);
233  virtual void operator=(const Type&);
234 
235  // Force an assignment irrespective of form of patch
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  // Prevent automatic comparison rewriting (c++20)
243  bool operator!=(const valuePointPatchField<Type>&) const = delete;
244  bool operator!=(const pointPatchField<Type>&) const = delete;
245  bool operator!=(const Field<Type>&) const = delete;
246  bool operator!=(const Type&) const = delete;
247 };
248 
249 
250 // This function is added to override the hack in pointPatchField.H
251 // which enables simple backward compatibility with versions using
252 // referenceLevel in GeometricField
253 template<class Type>
254 tmp<Field<Type>> operator+
255 (
256  const valuePointPatchField<Type>& vsppf,
257  const Type& t
258 )
259 {
260  return static_cast<const Field<Type>&>(vsppf) + t;
261 }
262 
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 } // End namespace Foam
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 #ifdef NoRepository
271  #include "valuePointPatchField.C"
272 #endif
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #endif
277 
278 // ************************************************************************* //
void extrapolateInternal()
Assign the patch field from the internal field.
dictionary dict
virtual autoPtr< pointPatchField< Type > > clone() const
Construct and return a clone.
"blocking" : (MPI_Bsend, MPI_Recv)
Foam::valuePointPatchField.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
commsTypes
Communications types.
Definition: UPstream.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Foam::pointPatchFieldMapper.
virtual void operator=(const valuePointPatchField< Type > &)
void writeEntry(const word &keyword, Ostream &os) const
Write the field as a dictionary entry.
Definition: Field.C:720
label size() const
Return size.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void write(Ostream &) const
Write.
Abstract base class for point-mesh patch fields.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
bool operator!=(const valuePointPatchField< Type > &) const =delete
valuePointPatchField(const valuePointPatchField &)=default
Copy construct.
Generic templated field type.
Definition: Field.H:62
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
TypeName("value")
Declare type-name, virtual type (with debug switch)
label size() const noexcept
The number of elements in the container.
Definition: UList.H:671
OBJstream os(runTime.globalPath()/outputName)
virtual void operator==(const valuePointPatchField< Type > &)
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
A simple container of IOobject preferences. Can also be used for general handling of read/no-read/rea...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
Reading is optional [identical to READ_IF_PRESENT].
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
Namespace for OpenFOAM.
readOption
Enumeration defining read preferences.