1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "valuePointPatchField.H"
28 #include <OpenFOAM/pointPatchFieldMapper.H>
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38 void valuePointPatchField<Type>::checkFieldSize() const
40 if (size() != this->patch().size())
44 "void valuePointPatchField<Type>::checkField() const"
45 ) << "field does not correspond to patch. " << endl
46 << "Field size: " << size() << " patch size: "
47 << this->patch().size()
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
56 valuePointPatchField<Type>::valuePointPatchField
59 const DimensionedField<Type, pointMesh>& iF
62 pointPatchField<Type>(p, iF),
68 valuePointPatchField<Type>::valuePointPatchField
71 const DimensionedField<Type, pointMesh>& iF,
72 const dictionary& dict,
73 const bool valueRequired
76 pointPatchField<Type>(p, iF, dict),
79 if (dict.found("value"))
81 Field<Type>::operator=
83 Field<Type>("value", dict, p.size())
86 else if (!valueRequired)
88 Field<Type>::operator=(pTraits<Type>::zero);
94 "pointPatchField<Type>::pointPatchField"
97 "const DimensionedField<Type, pointMesh>& iF,"
98 "const dictionary& dict,"
99 "const bool valueRequired"
102 ) << "Essential entry 'value' missing"
103 << exit(FatalIOError);
109 valuePointPatchField<Type>::valuePointPatchField
111 const valuePointPatchField<Type>& ptf,
113 const DimensionedField<Type, pointMesh>& iF,
114 const pointPatchFieldMapper& mapper
117 pointPatchField<Type>(p, iF),
118 Field<Type>(ptf, mapper)
123 valuePointPatchField<Type>::valuePointPatchField
125 const valuePointPatchField<Type>& ptf,
126 const DimensionedField<Type, pointMesh>& iF
129 pointPatchField<Type>(ptf, iF),
134 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
137 void valuePointPatchField<Type>::autoMap
139 const pointPatchFieldMapper& m
142 Field<Type>::autoMap(m);
147 void valuePointPatchField<Type>::rmap
149 const pointPatchField<Type>& ptf,
150 const labelList& addr
155 refCast<const valuePointPatchField<Type> >
165 void valuePointPatchField<Type>::updateCoeffs()
172 // Get internal field to insert values into
173 Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
175 setInInternalField(iF, *this);
177 pointPatchField<Type>::updateCoeffs();
182 void valuePointPatchField<Type>::evaluate(const Pstream::commsTypes)
184 // Get internal field to insert values into
185 Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
187 setInInternalField(iF, *this);
189 pointPatchField<Type>::evaluate();
194 void valuePointPatchField<Type>::write(Ostream& os) const
196 pointPatchField<Type>::write(os);
197 this->writeEntry("value", os);
201 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
204 void valuePointPatchField<Type>::operator=
206 const valuePointPatchField<Type>& ptf
209 Field<Type>::operator=(ptf);
214 void valuePointPatchField<Type>::operator=
216 const pointPatchField<Type>& ptf
219 Field<Type>::operator=(ptf.patchInternalField());
224 void valuePointPatchField<Type>::operator=
226 const Field<Type>& tf
229 Field<Type>::operator=(tf);
234 void valuePointPatchField<Type>::operator=
239 Field<Type>::operator=(t);
243 // Force an assignment
245 void valuePointPatchField<Type>::operator==
247 const valuePointPatchField<Type>& ptf
250 Field<Type>::operator=(ptf);
255 void valuePointPatchField<Type>::operator==
257 const pointPatchField<Type>& ptf
260 Field<Type>::operator=(ptf.patchInternalField());
265 void valuePointPatchField<Type>::operator==
267 const Field<Type>& tf
270 Field<Type>::operator=(tf);
275 void valuePointPatchField<Type>::operator==
280 Field<Type>::operator=(t);
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 } // End namespace Foam
288 // ************************ vim: set sw=4 sts=4 et: ************************ //