OpenFOAM logo
Open Source CFD Toolkit

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-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     multivariateSurfaceInterpolationScheme
00027 
00028 Description
00029     Abstract base class for multi-variate surface interpolation schemes.
00030 
00031 SourceFiles
00032     multivariateSurfaceInterpolationScheme.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef multivariateSurfaceInterpolationScheme_H
00037 #define multivariateSurfaceInterpolationScheme_H
00038 
00039 #include "surfaceInterpolationScheme.H"
00040 #include "HashTable.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                  Class multivariateSurfaceInterpolationScheme Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<class Type>
00052 class multivariateSurfaceInterpolationScheme
00053 :
00054     public refCount
00055 {
00056 
00057 public:
00058 
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             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, tensor)                     \
00225 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor)
00226 
00227 
00228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00229 
00230 #ifdef NoRepository
00231 #   include "multivariateSurfaceInterpolationScheme.C"
00232 #endif
00233 
00234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00235 
00236 #endif
00237 
00238 // ************************************************************************* //
For further information go to www.openfoam.org