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

fvsPatchField.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 <OpenFOAM/IOobject.H>
00027 #include <OpenFOAM/dictionary.H>
00028 #include <finiteVolume/fvMesh.H>
00029 #include <finiteVolume/fvPatchFieldMapper.H>
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00037 
00038 template<class Type>
00039 fvsPatchField<Type>::fvsPatchField
00040 (
00041     const fvPatch& p,
00042     const DimensionedField<Type, surfaceMesh>& iF
00043 )
00044 :
00045     Field<Type>(p.size()),
00046     patch_(p),
00047     internalField_(iF)
00048 {}
00049 
00050 
00051 template<class Type>
00052 fvsPatchField<Type>::fvsPatchField
00053 (
00054     const fvPatch& p,
00055     const DimensionedField<Type, surfaceMesh>& iF,
00056     const Field<Type>& f
00057 )
00058 :
00059     Field<Type>(f),
00060     patch_(p),
00061     internalField_(iF)
00062 {}
00063 
00064 
00065 template<class Type>
00066 fvsPatchField<Type>::fvsPatchField
00067 (
00068     const fvsPatchField<Type>& ptf,
00069     const fvPatch& p,
00070     const DimensionedField<Type, surfaceMesh>& iF,
00071     const fvPatchFieldMapper& mapper
00072 )
00073 :
00074     Field<Type>(ptf, mapper),
00075     patch_(p),
00076     internalField_(iF)
00077 {}
00078 
00079 
00080 template<class Type>
00081 fvsPatchField<Type>::fvsPatchField
00082 (
00083     const fvPatch& p,
00084     const DimensionedField<Type, surfaceMesh>& iF,
00085     const dictionary& dict
00086 )
00087 :
00088     Field<Type>(p.size()),
00089     patch_(p),
00090     internalField_(iF)
00091 {
00092     if (dict.found("value"))
00093     {
00094         fvsPatchField<Type>::operator=
00095         (
00096             Field<Type>("value", dict, p.size())
00097         );
00098     }
00099     else
00100     {
00101         fvsPatchField<Type>::operator=(pTraits<Type>::zero);
00102     }
00103 }
00104 
00105 
00106 template<class Type>
00107 fvsPatchField<Type>::fvsPatchField
00108 (
00109     const fvsPatchField<Type>& ptf
00110 )
00111 :
00112     Field<Type>(ptf),
00113     patch_(ptf.patch_),
00114     internalField_(ptf.internalField_)
00115 {}
00116 
00117 
00118 template<class Type>
00119 fvsPatchField<Type>::fvsPatchField
00120 (
00121     const fvsPatchField<Type>& ptf,
00122     const DimensionedField<Type, surfaceMesh>& iF
00123 )
00124 :
00125     Field<Type>(ptf),
00126     patch_(ptf.patch_),
00127     internalField_(iF)
00128 {}
00129 
00130 
00131 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00132 
00133 template<class Type>
00134 const objectRegistry& fvsPatchField<Type>::db() const
00135 {
00136     return patch_.boundaryMesh().mesh();
00137 }
00138 
00139 
00140 template<class Type>
00141 void fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
00142 {
00143     if (&patch_ != &(ptf.patch_))
00144     {
00145         FatalErrorIn("PatchField<Type>::check(const fvsPatchField<Type>&)")
00146             << "different patches for fvsPatchField<Type>s"
00147             << abort(FatalError);
00148     }
00149 }
00150 
00151 
00152 // Map from self
00153 template<class Type>
00154 void fvsPatchField<Type>::autoMap
00155 (
00156     const fvPatchFieldMapper& m
00157 )
00158 {
00159     Field<Type>::autoMap(m);
00160 }
00161 
00162 
00163 // Reverse-map the given fvsPatchField onto this fvsPatchField
00164 template<class Type>
00165 void fvsPatchField<Type>::rmap
00166 (
00167     const fvsPatchField<Type>& ptf,
00168     const labelList& addr
00169 )
00170 {
00171     Field<Type>::rmap(ptf, addr);
00172 }
00173 
00174 
00175 // Write
00176 template<class Type>
00177 void fvsPatchField<Type>::write(Ostream& os) const
00178 {
00179     os.writeKeyword("type") << type() << token::END_STATEMENT << nl;
00180 }
00181 
00182 
00183 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00184 
00185 template<class Type>
00186 void fvsPatchField<Type>::operator=
00187 (
00188     const UList<Type>& ul
00189 )
00190 {
00191     Field<Type>::operator=(ul);
00192 }
00193 
00194 
00195 template<class Type>
00196 void fvsPatchField<Type>::operator=
00197 (
00198     const fvsPatchField<Type>& ptf
00199 )
00200 {
00201     check(ptf);
00202     Field<Type>::operator=(ptf);
00203 }
00204 
00205 
00206 template<class Type>
00207 void fvsPatchField<Type>::operator+=
00208 (
00209     const fvsPatchField<Type>& ptf
00210 )
00211 {
00212     check(ptf);
00213     Field<Type>::operator+=(ptf);
00214 }
00215 
00216 
00217 template<class Type>
00218 void fvsPatchField<Type>::operator-=
00219 (
00220     const fvsPatchField<Type>& ptf
00221 )
00222 {
00223     check(ptf);
00224     Field<Type>::operator-=(ptf);
00225 }
00226 
00227 
00228 template<class Type>
00229 void fvsPatchField<Type>::operator*=
00230 (
00231     const fvsPatchField<scalar>& ptf
00232 )
00233 {
00234     if (&patch_ != &ptf.patch())
00235     {
00236         FatalErrorIn
00237         (
00238             "PatchField<Type>::operator*=(const fvsPatchField<scalar>& ptf)"
00239         )   << "incompatible patches for patch fields"
00240             << abort(FatalError);
00241     }
00242 
00243     Field<Type>::operator*=(ptf);
00244 }
00245 
00246 
00247 template<class Type>
00248 void fvsPatchField<Type>::operator/=
00249 (
00250     const fvsPatchField<scalar>& ptf
00251 )
00252 {
00253     if (&patch_ != &ptf.patch())
00254     {
00255         FatalErrorIn
00256         (
00257             "PatchField<Type>::operator/=(const fvsPatchField<scalar>& ptf)"
00258         )   << "    incompatible patches for patch fields"
00259             << abort(FatalError);
00260     }
00261 
00262     Field<Type>::operator/=(ptf);
00263 }
00264 
00265 
00266 template<class Type>
00267 void fvsPatchField<Type>::operator+=
00268 (
00269     const Field<Type>& tf
00270 )
00271 {
00272     Field<Type>::operator+=(tf);
00273 }
00274 
00275 
00276 template<class Type>
00277 void fvsPatchField<Type>::operator-=
00278 (
00279     const Field<Type>& tf
00280 )
00281 {
00282     Field<Type>::operator-=(tf);
00283 }
00284 
00285 
00286 template<class Type>
00287 void fvsPatchField<Type>::operator*=
00288 (
00289     const scalarField& tf
00290 )
00291 {
00292     Field<Type>::operator*=(tf);
00293 }
00294 
00295 
00296 template<class Type>
00297 void fvsPatchField<Type>::operator/=
00298 (
00299     const scalarField& tf
00300 )
00301 {
00302     Field<Type>::operator/=(tf);
00303 }
00304 
00305 
00306 template<class Type>
00307 void fvsPatchField<Type>::operator=
00308 (
00309     const Type& t
00310 )
00311 {
00312     Field<Type>::operator=(t);
00313 }
00314 
00315 
00316 template<class Type>
00317 void fvsPatchField<Type>::operator+=
00318 (
00319     const Type& t
00320 )
00321 {
00322     Field<Type>::operator+=(t);
00323 }
00324 
00325 
00326 template<class Type>
00327 void fvsPatchField<Type>::operator-=
00328 (
00329     const Type& t
00330 )
00331 {
00332     Field<Type>::operator-=(t);
00333 }
00334 
00335 
00336 template<class Type>
00337 void fvsPatchField<Type>::operator*=
00338 (
00339     const scalar s
00340 )
00341 {
00342     Field<Type>::operator*=(s);
00343 }
00344 
00345 
00346 template<class Type>
00347 void fvsPatchField<Type>::operator/=
00348 (
00349     const scalar s
00350 )
00351 {
00352     Field<Type>::operator/=(s);
00353 }
00354 
00355 
00356 // Force an assignment, overriding fixedValue status
00357 template<class Type>
00358 void fvsPatchField<Type>::operator==
00359 (
00360     const fvsPatchField<Type>& ptf
00361 )
00362 {
00363     Field<Type>::operator=(ptf);
00364 }
00365 
00366 
00367 template<class Type>
00368 void fvsPatchField<Type>::operator==
00369 (
00370     const Field<Type>& tf
00371 )
00372 {
00373     Field<Type>::operator=(tf);
00374 }
00375 
00376 
00377 template<class Type>
00378 void fvsPatchField<Type>::operator==
00379 (
00380     const Type& t
00381 )
00382 {
00383     Field<Type>::operator=(t);
00384 }
00385 
00386 
00387 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
00388 
00389 template<class Type>
00390 Ostream& operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
00391 {
00392     ptf.write(os);
00393 
00394     os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
00395 
00396     return os;
00397 }
00398 
00399 
00400 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00401 
00402 } // End namespace Foam
00403 
00404 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00405 
00406 #   include <finiteVolume/newFvsPatchField.C>
00407 
00408 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines