OpenFOAM logo
Open Source CFD Toolkit

ComponentMixedTetPointPatchVectorField.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     ComponentMixedTetPointPatchVectorField. The boundary condition is a mix
00027     of a fixedValue and a zeroGradient boundary condition, where a
00028     fixedValue/zeroGradient mix may be different for each direction.
00029 
00030     I am still not sure how to do the fixedValue-fixedGradient
00031     combination. 
00032 
00033 Description
00034 
00035 SourceFiles
00036     ComponentMixedTetPointPatchVectorField.C
00037 
00038 \*---------------------------------------------------------------------------*/
00039 
00040 #ifndef ComponentMixedTetPointPatchVectorField_H
00041 #define ComponentMixedTetPointPatchVectorField_H
00042 
00043 #include "tetPolyPatchFields.H"
00044 #include "Map.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 /*---------------------------------------------------------------------------*\
00052             Class ComponentMixedTetPointPatchVectorField Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 template
00056 <
00057     template<class> class PatchField,
00058     class PointPatch
00059 >
00060 class ComponentMixedTetPointPatchVectorField
00061 :
00062     public PatchField<vector>
00063 {
00064     // Private data
00065 
00066         //- Fraction vector of value used for boundary condition
00067         vectorField refValue_;
00068 
00069         //- Fraction vector of value used for boundary condition
00070         vectorField valueFraction_;
00071 
00072 
00073     // Private member functions
00074 
00075         void checkFieldSize() const;
00076 
00077 
00078 public:
00079 
00080     //- Runtime type information
00081     TypeName("componentMixed");
00082 
00083 
00084     // Constructors
00085 
00086         //- Construct from patch and internal field
00087         ComponentMixedTetPointPatchVectorField
00088         (
00089             const PointPatch&,
00090             const vectorField&
00091         );
00092 
00093         //- Construct from patch and internal field, value
00094         // and value fraction
00095         ComponentMixedTetPointPatchVectorField
00096         (
00097             const PointPatch&,
00098             const vectorField&,
00099             const vectorField&,
00100             const vectorField&
00101         );
00102 
00103         //- Construct from patch, internal field and dictionary
00104         ComponentMixedTetPointPatchVectorField
00105         (
00106             const PointPatch&,
00107             const vectorField&,
00108             const dictionary&
00109         );
00110 
00111         //- Construct by mapping given patchVectorField onto a new patch
00112         ComponentMixedTetPointPatchVectorField
00113         (
00114             const ComponentMixedTetPointPatchVectorField<PatchField, PointPatch>&,
00115             const PointPatch&,
00116             const vectorField&,
00117             const TetPointPatchFieldMapper&
00118         );
00119 
00120         //- Construct and return a clone
00121         virtual autoPtr<PatchField<vector> > clone() const
00122         {
00123             return autoPtr<PatchField<vector> >
00124             (
00125                 new ComponentMixedTetPointPatchVectorField
00126                 <PatchField, PointPatch>
00127                 (
00128                     *this
00129                 )
00130             );
00131         }
00132 
00133         //- Construct as copy setting internal field reference
00134         ComponentMixedTetPointPatchVectorField
00135         (
00136             const ComponentMixedTetPointPatchVectorField<PatchField, PointPatch>&,
00137             const vectorField&
00138         );
00139 
00140         //- Construct and return a clone setting internal field reference
00141         virtual autoPtr<PatchField<vector> > clone(const vectorField& iF) const
00142         {
00143             return autoPtr<PatchField<vector> >
00144             (
00145                 new ComponentMixedTetPointPatchVectorField
00146                 <PatchField, PointPatch>
00147                 (
00148                     *this,
00149                     iF
00150                 )
00151             );
00152         }
00153 
00154 
00155     // Member functions
00156 
00157         // Return defining fields
00158 
00159             virtual vectorField& refValue()
00160             {
00161                 return refValue_;
00162             }
00163 
00164             virtual const vectorField& refValue() const
00165             {
00166                 return refValue_;
00167             }
00168 
00169 
00170             virtual vectorField& valueFraction()
00171             {
00172                 return valueFraction_;
00173             }
00174 
00175             virtual const vectorField& valueFraction() const
00176             {
00177                 return valueFraction_;
00178             }
00179 
00180 
00181         // Mapping functions
00182 
00183             //- Map (and resize as needed) from self given a mapping object
00184             virtual void autoMap
00185             (
00186                 const TetPointPatchFieldMapper&
00187             );
00188 
00189             //- Reverse map the given TetPointPatchVectorField onto
00190             //  this TetPointPatchVectorField
00191             virtual void rmap
00192             (
00193                 const TetPointPatchField<PatchField, PointPatch, vector>&,
00194                 const labelList&
00195             );
00196 
00197 
00198         // Evaluation functions
00199 
00200             //- Insert boundary value into the internal field
00201             virtual void evaluate();
00202 
00203             //- Set boundary condition to matrix
00204             virtual void setBoundaryCondition
00205             (
00206                 Map<constraint<vector> > &
00207             ) const;
00208 
00209 
00210         //- Write
00211         virtual void write(Ostream&) const;
00212 
00213 };
00214 
00215 
00216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00217 
00218 } // End namespace Foam
00219 
00220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00221 
00222 #ifdef NoRepository
00223 #    include "ComponentMixedTetPointPatchVectorField.C"
00224 #endif
00225 
00226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00227 
00228 #endif
00229 
00230 // ************************************************************************* //
For further information go to www.openfoam.org