OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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