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 | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "valuePointPatchField.H"
27 #include "pointPatchFieldMapper.H"
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 template<class Type>
33 {
34  if (this->size() != this->patch().size())
35  {
37  (
38  "void valuePointPatchField<Type>::checkField() const"
39  ) << "field does not correspond to patch. " << endl
40  << "Field size: " << size() << " patch size: "
41  << this->patch().size()
42  << abort(FatalError);
43  }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
48 
49 template<class Type>
51 (
52  const pointPatch& p,
54 )
55 :
57  Field<Type>(p.size())
58 {}
59 
60 
61 template<class Type>
63 (
64  const pointPatch& p,
66  const dictionary& dict,
67  const bool valueRequired
68 )
69 :
71  Field<Type>(p.size())
72 {
73  if (dict.found("value"))
74  {
76  (
77  Field<Type>("value", dict, p.size())
78  );
79  }
80  else if (!valueRequired)
81  {
83  }
84  else
85  {
87  (
88  "pointPatchField<Type>::pointPatchField"
89  "("
90  "const fvPatch& p,"
91  "const DimensionedField<Type, pointMesh>& iF,"
92  "const dictionary& dict,"
93  "const bool valueRequired"
94  ")",
95  dict
96  ) << "Essential entry 'value' missing"
97  << exit(FatalIOError);
98  }
99 }
100 
101 
102 template<class Type>
104 (
105  const valuePointPatchField<Type>& ptf,
106  const pointPatch& p,
108  const pointPatchFieldMapper& mapper
109 )
110 :
111  pointPatchField<Type>(ptf, p, iF, mapper),
112  Field<Type>(ptf, mapper)
113 {}
114 
115 
116 template<class Type>
118 (
119  const valuePointPatchField<Type>& ptf,
121 )
122 :
123  pointPatchField<Type>(ptf, iF),
124  Field<Type>(ptf)
125 {}
126 
127 
128 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
129 
130 template<class Type>
132 (
133  const pointPatchFieldMapper& m
134 )
135 {
137 }
138 
139 
140 template<class Type>
142 (
143  const pointPatchField<Type>& ptf,
144  const labelList& addr
145 )
146 {
148  (
150  (
151  ptf
152  ),
153  addr
154  );
155 }
156 
157 
158 template<class Type>
160 {
161  if (this->updated())
162  {
163  return;
164  }
165 
166  // Get internal field to insert values into
167  Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
168 
169  this->setInInternalField(iF, *this);
170 
172 }
173 
174 
175 template<class Type>
177 {
178  // Get internal field to insert values into
179  Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
180 
181  this->setInInternalField(iF, *this);
182 
184 }
185 
186 
187 template<class Type>
189 {
191  this->writeEntry("value", os);
192 }
193 
194 
195 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
196 
197 template<class Type>
198 void Foam::valuePointPatchField<Type>::operator=
199 (
200  const valuePointPatchField<Type>& ptf
201 )
202 {
204 }
205 
206 
207 template<class Type>
208 void Foam::valuePointPatchField<Type>::operator=
209 (
210  const pointPatchField<Type>& ptf
211 )
212 {
214 }
215 
216 
217 template<class Type>
218 void Foam::valuePointPatchField<Type>::operator=
219 (
220  const Field<Type>& tf
221 )
222 {
224 }
225 
226 
227 template<class Type>
228 void Foam::valuePointPatchField<Type>::operator=
229 (
230  const Type& t
231 )
232 {
234 }
235 
236 
237 // Force an assignment
238 template<class Type>
239 void Foam::valuePointPatchField<Type>::operator==
240 (
241  const valuePointPatchField<Type>& ptf
242 )
243 {
245 }
246 
247 
248 template<class Type>
249 void Foam::valuePointPatchField<Type>::operator==
250 (
251  const pointPatchField<Type>& ptf
252 )
253 {
255 }
256 
257 
258 template<class Type>
259 void Foam::valuePointPatchField<Type>::operator==
260 (
261  const Field<Type>& tf
262 )
263 {
265 }
266 
267 
268 template<class Type>
269 void Foam::valuePointPatchField<Type>::operator==
270 (
271  const Type& t
272 )
273 {
275 }
276 
277 
278 // ************************************************************************* //
valuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:306
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:56
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
runTime write()
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
dictionary dict
Abstract base class for point-mesh patch fields.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
IOerror FatalIOError
volScalarField & p
Definition: createFields.H:51
commsTypes
Types of communications.
Definition: UPstream.H:64
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
Pre-declare SubField and related Field type.
Definition: Field.H:57
errorManip< error > abort(error &err)
Definition: errorManip.H:131
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Foam::pointPatchFieldMapper.
const tensorField & tf
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
virtual void write(Ostream &) const
Write.
Traits class for primitives.
Definition: pTraits.H:50
tmp< Field< Type > > patchInternalField() const
Return field created from appropriate internal field values.
error FatalError
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Foam::valuePointPatchField.
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:106
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:325
conserve internalField()+
label size() const
Return size.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::blocking)
Evaluate the patch field.