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

multivariateSurfaceInterpolationScheme.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-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 Class
00025     Foam::multivariateSurfaceInterpolationScheme
00026 
00027 Description
00028     Abstract base class for multi-variate surface interpolation schemes.
00029 
00030 SourceFiles
00031     multivariateSurfaceInterpolationScheme.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef multivariateSurfaceInterpolationScheme_H
00036 #define multivariateSurfaceInterpolationScheme_H
00037 
00038 #include <finiteVolume/surfaceInterpolationScheme.H>
00039 #include <OpenFOAM/HashTable.H>
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                  Class multivariateSurfaceInterpolationScheme Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 template<class Type>
00051 class multivariateSurfaceInterpolationScheme
00052 :
00053     public refCount
00054 {
00055 
00056 public:
00057 
00058     //- fieldTable
00059     class fieldTable
00060     :
00061         public HashTable<const GeometricField<Type, fvPatchField, volMesh>*>
00062     {
00063     public:
00064 
00065         fieldTable()
00066         {}
00067 
00068         void add(const GeometricField<Type, fvPatchField, volMesh>& f)
00069         {
00070             this->insert(f.name(), &f);
00071         }
00072     };
00073 
00074 
00075 private:
00076 
00077     // Private data
00078 
00079         //- Hold reference to mesh
00080         const fvMesh& mesh_;
00081 
00082         //- HashTable of pointers to the field set
00083         const fieldTable& fields_;
00084 
00085 
00086     // Private Member Functions
00087 
00088         //- Disallow default bitwise copy construct
00089         multivariateSurfaceInterpolationScheme
00090         (
00091             const multivariateSurfaceInterpolationScheme&
00092         );
00093 
00094         //- Disallow default bitwise assignment
00095         void operator=(const multivariateSurfaceInterpolationScheme&);
00096 
00097 
00098 public:
00099 
00100     //- Runtime type information
00101     virtual const word& type() const = 0;
00102 
00103 
00104     // Declare run-time constructor selection tables
00105 
00106         declareRunTimeSelectionTable
00107         (
00108             tmp,
00109             multivariateSurfaceInterpolationScheme,
00110             Istream,
00111             (
00112                 const fvMesh& mesh,
00113                 const fieldTable& fields,
00114                 const surfaceScalarField& faceFlux,
00115                 Istream& is
00116             ),
00117             (mesh, fields, faceFlux, is)
00118         );
00119 
00120 
00121     // Constructors
00122 
00123         //- Construct for interpolating given field
00124         multivariateSurfaceInterpolationScheme
00125         (
00126             const fvMesh& mesh,
00127             const fieldTable& fields,
00128             const surfaceScalarField& faceFlux,
00129             Istream& schemeData
00130         );
00131 
00132 
00133     // Selectors
00134 
00135         //- Return a pointer to a new gradScheme created on freestore
00136         static tmp<multivariateSurfaceInterpolationScheme<Type> > New
00137         (
00138             const fvMesh& mesh,
00139             const fieldTable& fields,
00140             const surfaceScalarField& faceFlux,
00141             Istream& schemeData
00142         );
00143 
00144 
00145     // Destructor
00146 
00147         virtual ~multivariateSurfaceInterpolationScheme();
00148 
00149 
00150     // Member Functions
00151 
00152         //- Return mesh reference
00153         const fvMesh& mesh() const
00154         {
00155             return mesh_;
00156         }
00157 
00158         //- Return fields to be interpolated
00159         const fieldTable& fields() const
00160         {
00161             return fields_;
00162         }
00163 
00164 
00165     // Member Operators
00166 
00167         //- surfaceInterpolationScheme sub-class returned by operator(field)
00168         //  which is used as the interpolation scheme for the field
00169         class fieldScheme
00170         :
00171             public surfaceInterpolationScheme<Type>
00172         {
00173 
00174         public:
00175 
00176             // Constructors
00177 
00178                 fieldScheme
00179                 (
00180                     const GeometricField<Type, fvPatchField, volMesh>& field
00181                 )
00182                 :
00183                     surfaceInterpolationScheme<Type>(field.mesh())
00184                 {}
00185 
00186 
00187             // Member Functions
00188 
00189                 //- Return the interpolation weighting factors
00190                 virtual tmp<surfaceScalarField> weights
00191                 (
00192                     const GeometricField<Type, fvPatchField, volMesh>& field
00193                 ) const = 0;
00194         };
00195 
00196         virtual tmp<surfaceInterpolationScheme<Type> > operator()
00197         (
00198             const GeometricField<Type, fvPatchField, volMesh>& field
00199         ) const = 0;
00200 };
00201 
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 } // End namespace Foam
00206 
00207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00208 
00209 // Add the patch constructor functions to the hash tables
00210 
00211 #define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type)               \
00212                                                                                \
00213 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00214                                                                                \
00215 multivariateSurfaceInterpolationScheme<Type>::                                 \
00216 addIstreamConstructorToTable<SS<Type> >                                        \
00217     add##SS##Type##ConstructorToTable_;
00218 
00219 
00220 #define makeMultivariateSurfaceInterpolationScheme(SS)                         \
00221                                                                                \
00222 makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar)                     \
00223 makeMultivariateSurfaceInterpolationTypeScheme(SS, vector)                     \
00224 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor)            \
00225 makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor)                 \
00226 makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
00227 
00228 
00229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00230 
00231 #ifdef NoRepository
00232 #   include <finiteVolume/multivariateSurfaceInterpolationScheme.C>
00233 #endif
00234 
00235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00236 
00237 #endif
00238 
00239 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines