OpenFOAM logo
Open Source CFD Toolkit

ValueStoredTetPointPatchField.H

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-2005 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     ValueStoredTetPointPatchField
00027 
00028 Description
00029 
00030 SourceFiles
00031     ValueStoredTetPointPatchField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef ValueStoredTetPointPatchField_H
00036 #define ValueStoredTetPointPatchField_H
00037 
00038 #include "TetPointPatchField.H"
00039 
00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00041 
00042 namespace Foam
00043 {
00044 
00045 /*---------------------------------------------------------------------------*\
00046                    Class ValueStoredTetPointPatchField Declaration
00047 \*---------------------------------------------------------------------------*/
00048 
00049 template<template<class> class PatchField, class PointPatch, class Type>
00050 class ValueStoredTetPointPatchField
00051 :
00052     public PatchField<Type>,
00053     public Field<Type>
00054 {
00055     // Private member functions
00056 
00057         void checkFieldSize() const;
00058 
00059 
00060 public:
00061 
00062     //- Runtime type information
00063     TypeName("valueStored");
00064 
00065 
00066     // Constructors
00067 
00068         //- Construct from patch and internal field
00069         ValueStoredTetPointPatchField
00070         (
00071             const PointPatch&,
00072             const Field<Type>&
00073         );
00074 
00075         //- Construct from patch and internal field and patch field
00076         ValueStoredTetPointPatchField
00077         (
00078             const PointPatch&,
00079             const Field<Type>&,
00080             const Field<Type>&
00081         );
00082 
00083         //- Construct from patch, internal field and dictionary
00084         ValueStoredTetPointPatchField
00085         (
00086             const PointPatch&,
00087             const Field<Type>&,
00088             const dictionary&
00089         );
00090 
00091         //- Construct by mapping given patchField<Type> onto a new patch
00092         ValueStoredTetPointPatchField
00093         (
00094             const ValueStoredTetPointPatchField<PatchField, PointPatch, Type>&,
00095             const PointPatch&,
00096             const Field<Type>&,
00097             const TetPointPatchFieldMapper&
00098         );
00099 
00100         //- Construct and return a clone
00101         virtual autoPtr<PatchField<Type> > clone() const
00102         {
00103             return autoPtr<PatchField<Type> >
00104             (
00105                 new ValueStoredTetPointPatchField<PatchField, PointPatch, Type>
00106                 (
00107                     *this
00108                 )
00109             );
00110         }
00111 
00112         //- Construct as copy setting internal field reference
00113         ValueStoredTetPointPatchField
00114         (
00115             const ValueStoredTetPointPatchField<PatchField, PointPatch, Type>&,
00116             const Field<Type>&
00117         );
00118 
00119         //- Construct and return a clone setting internal field reference
00120         virtual autoPtr<PatchField<Type> > clone(const Field<Type>& iF) const
00121         {
00122             return autoPtr<PatchField<Type> >
00123             (
00124                 new ValueStoredTetPointPatchField<PatchField, PointPatch, Type>
00125                 (
00126                     *this,
00127                     iF
00128                 )
00129             );
00130         }
00131 
00132 
00133     // Member functions
00134 
00135         // Access
00136 
00137             //- Return size
00138             label size() const
00139             {
00140                 return Field<Type>::size();
00141             }
00142 
00143         // Mapping functions
00144 
00145             //- Map (and resize as needed) from self given a mapping object
00146             virtual void autoMap
00147             (
00148                 const TetPointPatchFieldMapper&
00149             );
00150 
00151             //- Reverse map the given TetPointPatchField onto
00152             //  this TetPointPatchField
00153             virtual void rmap
00154             (
00155                 const TetPointPatchField<PatchField, PointPatch, Type>&,
00156                 const labelList&
00157             );
00158 
00159 
00160         // Evaluation functions
00161 
00162             //- Does it store field data
00163             virtual bool storesFieldData() const
00164             {
00165                 return true;
00166             }
00167 
00168             //- Insert boundary value into the internal field
00169             virtual void initEvaluate(const bool=false)
00170             {}
00171 
00172             virtual void evaluate();
00173 
00174             //- Update boundary value
00175             virtual void updateBoundaryField()
00176             {}
00177 
00178             //- Set boundary condition to matrix
00179             virtual void setBoundaryCondition
00180             (
00181                 Map<constraint<Type> > &
00182             ) const
00183             {}
00184 
00185         //- Write
00186         virtual void write(Ostream&) const;
00187 
00188 
00189     // Member operators
00190 
00191         //- Assignment operators
00192         virtual void operator=
00193         (
00194             const ValueStoredTetPointPatchField<PatchField, PointPatch, Type>&
00195         );
00196 
00197         virtual void operator=(const Field<Type>&);
00198         virtual void operator=(const Type&);
00199 
00200         // Force an assignment irrespective of form of patch
00201 
00202         virtual void operator==
00203         (
00204             const ValueStoredTetPointPatchField<PatchField, PointPatch, Type>&
00205         );
00206 
00207         virtual void operator==(const Field<Type>&);
00208         virtual void operator==(const Type&);
00209 
00210 };
00211 
00212 
00213 // This function is added to overide the hack in TetPointPatchField.H which enables
00214 // simple backward compatability with verions using referenceLevel
00215 // in GeometicField
00216 template<template<class> class PatchField, class PointPatch, class Type>
00217 tmp<Field<Type> > operator+
00218 (
00219     const ValueStoredTetPointPatchField<PatchField, PointPatch, Type>& vsppf,
00220     const Type& t
00221 )
00222 {
00223     return static_cast<const Field<Type>&>(vsppf) + t;
00224 }
00225 
00226 
00227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00228 
00229 } // End namespace Foam
00230 
00231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00232 
00233 #ifdef NoRepository
00234 #    include "ValueStoredTetPointPatchField.C"
00235 #endif
00236 
00237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00238 
00239 #endif
00240 
00241 // ************************************************************************* //
For further information go to www.openfoam.org