valuePointPatchField.C
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-2016 OpenFOAM Foundation
9  Copyright (C) 2019 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 \*---------------------------------------------------------------------------*/
28 
29 #include "valuePointPatchField.H"
30 #include "pointPatchFieldMapper.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
33 
34 template<class Type>
36 (
37  const pointPatch& p,
39 )
40 :
42  Field<Type>(p.size())
43 {}
44 
45 
46 template<class Type>
48 (
49  const pointPatch& p,
51  const dictionary& dict,
52  const bool valueRequired
53 )
54 :
56  Field<Type>(p.size())
57 {
58  if (dict.found("value"))
59  {
61  (
62  Field<Type>("value", dict, p.size())
63  );
64  }
65  else if (!valueRequired)
66  {
68  }
69  else
70  {
72  << "Essential entry 'value' missing on patch " << p.name()
73  << exit(FatalIOError);
74  }
75 }
76 
77 
78 template<class Type>
80 (
81  const valuePointPatchField<Type>& ptf,
82  const pointPatch& p,
84  const pointPatchFieldMapper& mapper
85 )
86 :
87  pointPatchField<Type>(ptf, p, iF, mapper),
88  Field<Type>(ptf, mapper)
89 {}
90 
91 
92 template<class Type>
94 (
95  const valuePointPatchField<Type>& ptf,
97 )
98 :
99  pointPatchField<Type>(ptf, iF),
100  Field<Type>(ptf)
101 {}
102 
103 
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 
106 template<class Type>
108 (
109  const pointPatchFieldMapper& m
110 )
111 {
113 }
114 
115 
116 template<class Type>
118 (
119  const pointPatchField<Type>& ptf,
120  const labelList& addr
121 )
122 {
124  (
126  (
127  ptf
128  ),
129  addr
130  );
131 }
132 
133 
134 template<class Type>
136 {
137  if (this->updated())
138  {
139  return;
140  }
141 
142  // Get internal field to insert values into
143  Field<Type>& iF = const_cast<Field<Type>&>(this->primitiveField());
144 
145  this->setInInternalField(iF, *this);
146 
148 }
149 
150 
151 template<class Type>
153 {
154  // Get internal field to insert values into
155  Field<Type>& iF = const_cast<Field<Type>&>(this->primitiveField());
156 
157  this->setInInternalField(iF, *this);
158 
160 }
161 
162 
163 template<class Type>
165 {
167  this->writeEntry("value", os);
168 }
169 
170 
171 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
172 
173 template<class Type>
175 (
176  const valuePointPatchField<Type>& ptf
177 )
178 {
180 }
181 
182 
183 template<class Type>
185 (
186  const pointPatchField<Type>& ptf
187 )
188 {
189  Field<Type>::operator=(this->patchInternalField());
190 }
191 
192 
193 template<class Type>
195 (
196  const Field<Type>& tf
197 )
198 {
200 }
201 
202 
203 template<class Type>
205 (
206  const Type& t
207 )
208 {
210 }
211 
212 
213 template<class Type>
215 (
216  const valuePointPatchField<Type>& ptf
217 )
218 {
220 }
221 
222 
223 template<class Type>
225 (
226  const pointPatchField<Type>& ptf
227 )
228 {
229  Field<Type>::operator=(this->patchInternalField());
230 }
231 
232 
233 template<class Type>
235 (
236  const Field<Type>& tf
237 )
238 {
240 }
241 
242 
243 template<class Type>
245 (
246  const Type& t
247 )
248 {
250 }
251 
252 
253 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
pointPatchFieldMapper.H
Foam::FatalIOError
IOerror FatalIOError
Foam::pointPatch
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:58
Foam::pointPatchField
Abstract base class for point-mesh patch fields.
Definition: pointMVCWeight.H:60
Foam::pointPatchFieldMapper
Foam::pointPatchFieldMapper.
Definition: pointPatchFieldMapper.H:48
valuePointPatchField.H
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::valuePointPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: valuePointPatchField.C:135
Foam::valuePointPatchField::write
virtual void write(Ostream &) const
Write.
Definition: valuePointPatchField.C:164
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::valuePointPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
Definition: valuePointPatchField.C:152
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::valuePointPatchField::autoMap
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: valuePointPatchField.C:108
Foam::valuePointPatchField::valuePointPatchField
valuePointPatchField(const valuePointPatchField &)=default
Copy construct.
Foam::refCast
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:131
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::valuePointPatchField
Foam::valuePointPatchField.
Definition: valuePointPatchField.H:52
Foam::List< label >
Foam::valuePointPatchField::rmap
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
Definition: valuePointPatchField.C:118
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:36
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::stringOps::evaluate
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.
Definition: stringOpsEvaluate.C:37