FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

valuePointPatchField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "valuePointPatchField.H"
00027 #include <OpenFOAM/pointPatchFieldMapper.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
00035 
00036 template<class Type>
00037 void valuePointPatchField<Type>::checkFieldSize() const
00038 {
00039     if (size() != this->patch().size())
00040     {
00041         FatalErrorIn
00042         (
00043             "void valuePointPatchField<Type>::checkField() const"
00044         )   << "field does not correspond to patch. " << endl
00045             << "Field size: " << size() << " patch size: "
00046             << this->patch().size()
00047             << abort(FatalError);
00048     }
00049 }
00050 
00051 
00052 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
00053 
00054 template<class Type>
00055 valuePointPatchField<Type>::valuePointPatchField
00056 (
00057     const pointPatch& p,
00058     const DimensionedField<Type, pointMesh>& iF
00059 )
00060 :
00061     pointPatchField<Type>(p, iF),
00062     Field<Type>(p.size())
00063 {}
00064 
00065 
00066 template<class Type>
00067 valuePointPatchField<Type>::valuePointPatchField
00068 (
00069     const pointPatch& p,
00070     const DimensionedField<Type, pointMesh>& iF,
00071     const dictionary& dict,
00072     const bool valueRequired
00073 )
00074 :
00075     pointPatchField<Type>(p, iF, dict),
00076     Field<Type>(p.size())
00077 {
00078     if (dict.found("value"))
00079     {
00080         Field<Type>::operator=
00081         (
00082             Field<Type>("value", dict, p.size())
00083         );
00084     }
00085     else if (!valueRequired)
00086     {
00087         Field<Type>::operator=(pTraits<Type>::zero);
00088     }
00089     else
00090     {
00091         FatalIOErrorIn
00092         (
00093             "pointPatchField<Type>::pointPatchField"
00094             "("
00095             "const fvPatch& p,"
00096             "const DimensionedField<Type, pointMesh>& iF,"
00097             "const dictionary& dict,"
00098             "const bool valueRequired"
00099             ")",
00100             dict
00101         )   << "Essential entry 'value' missing"
00102             << exit(FatalIOError);
00103     }
00104 }
00105 
00106 
00107 template<class Type>
00108 valuePointPatchField<Type>::valuePointPatchField
00109 (
00110     const valuePointPatchField<Type>& ptf,
00111     const pointPatch& p,
00112     const DimensionedField<Type, pointMesh>& iF,
00113     const pointPatchFieldMapper& mapper
00114 )
00115 :
00116     pointPatchField<Type>(p, iF),
00117     Field<Type>(ptf, mapper)
00118 {}
00119 
00120 
00121 template<class Type>
00122 valuePointPatchField<Type>::valuePointPatchField
00123 (
00124     const valuePointPatchField<Type>& ptf,
00125     const DimensionedField<Type, pointMesh>& iF
00126 )
00127 :
00128     pointPatchField<Type>(ptf, iF),
00129     Field<Type>(ptf)
00130 {}
00131 
00132 
00133 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00134 
00135 template<class Type>
00136 void valuePointPatchField<Type>::autoMap
00137 (
00138     const pointPatchFieldMapper& m
00139 )
00140 {
00141     Field<Type>::autoMap(m);
00142 }
00143 
00144 
00145 template<class Type>
00146 void valuePointPatchField<Type>::rmap
00147 (
00148     const pointPatchField<Type>& ptf,
00149     const labelList& addr
00150 )
00151 {
00152     Field<Type>::rmap
00153     (
00154         refCast<const valuePointPatchField<Type> >
00155         (
00156             ptf
00157         ),
00158         addr
00159     );
00160 }
00161 
00162 
00163 template<class Type>
00164 void valuePointPatchField<Type>::updateCoeffs()
00165 {
00166     if (this->updated())
00167     {
00168         return;
00169     }
00170 
00171     // Get internal field to insert values into
00172     Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
00173 
00174     this->setInInternalField(iF, *this);
00175 
00176     pointPatchField<Type>::updateCoeffs();
00177 }
00178 
00179 
00180 template<class Type>
00181 void valuePointPatchField<Type>::evaluate(const Pstream::commsTypes)
00182 {
00183     // Get internal field to insert values into
00184     Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
00185 
00186     this->setInInternalField(iF, *this);
00187 
00188     pointPatchField<Type>::evaluate();
00189 }
00190 
00191 
00192 template<class Type>
00193 void valuePointPatchField<Type>::write(Ostream& os) const
00194 {
00195     pointPatchField<Type>::write(os);
00196     this->writeEntry("value", os);
00197 }
00198 
00199 
00200 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00201 
00202 template<class Type>
00203 void valuePointPatchField<Type>::operator=
00204 (
00205     const valuePointPatchField<Type>& ptf
00206 )
00207 {
00208     Field<Type>::operator=(ptf);
00209 }
00210 
00211 
00212 template<class Type>
00213 void valuePointPatchField<Type>::operator=
00214 (
00215     const pointPatchField<Type>& ptf
00216 )
00217 {
00218     Field<Type>::operator=(ptf.patchInternalField());
00219 }
00220 
00221 
00222 template<class Type>
00223 void valuePointPatchField<Type>::operator=
00224 (
00225     const Field<Type>& tf
00226 )
00227 {
00228     Field<Type>::operator=(tf);
00229 }
00230 
00231 
00232 template<class Type>
00233 void valuePointPatchField<Type>::operator=
00234 (
00235     const Type& t
00236 )
00237 {
00238     Field<Type>::operator=(t);
00239 }
00240 
00241 
00242 // Force an assignment
00243 template<class Type>
00244 void valuePointPatchField<Type>::operator==
00245 (
00246     const valuePointPatchField<Type>& ptf
00247 )
00248 {
00249     Field<Type>::operator=(ptf);
00250 }
00251 
00252 
00253 template<class Type>
00254 void valuePointPatchField<Type>::operator==
00255 (
00256     const pointPatchField<Type>& ptf
00257 )
00258 {
00259     Field<Type>::operator=(ptf.patchInternalField());
00260 }
00261 
00262 
00263 template<class Type>
00264 void valuePointPatchField<Type>::operator==
00265 (
00266     const Field<Type>& tf
00267 )
00268 {
00269     Field<Type>::operator=(tf);
00270 }
00271 
00272 
00273 template<class Type>
00274 void valuePointPatchField<Type>::operator==
00275 (
00276     const Type& t
00277 )
00278 {
00279     Field<Type>::operator=(t);
00280 }
00281 
00282 
00283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00284 
00285 } // End namespace Foam
00286 
00287 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines