initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / limitedSchemes / limitWith / limitWith.H
blob6ebeabcd7f8bc73197a19bb24b27a6ebb65c868c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::limitWith
28 Description
29     limitWith differencing scheme limits the specified scheme with the
30     specified limiter.
32 SourceFiles
33     limitWith.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef limitWith_H
38 #define limitWith_H
40 #include "surfaceInterpolationScheme.H"
41 #include "limitedSurfaceInterpolationScheme.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                            Class limitWith Declaration
50 \*---------------------------------------------------------------------------*/
52 template<class Type>
53 class limitWith
55     public surfaceInterpolationScheme<Type>
57     // Private Member Functions
59         //- Interpolation scheme
60         tmp<surfaceInterpolationScheme<Type> > tInterp_;
62         //- Limiter
63         tmp<limitedSurfaceInterpolationScheme<Type> > tLimiter_;
66         //- Disallow default bitwise copy construct
67         limitWith(const limitWith&);
69         //- Disallow default bitwise assignment
70         void operator=(const limitWith&);
73 public:
75     //- Runtime type information
76     TypeName("limitWith");
79     // Constructors
81         //- Construct from mesh and Istream.
82         //  The name of the flux field is read from the Istream and looked-up
83         //  from the mesh objectRegistry
84         limitWith
85         (
86             const fvMesh& mesh,
87             Istream& is
88         )
89         :
90             surfaceInterpolationScheme<Type>(mesh),
91             tInterp_
92             (
93                 surfaceInterpolationScheme<Type>::New(mesh, is)
94             ),
95             tLimiter_
96             (
97                 limitedSurfaceInterpolationScheme<Type>::New(mesh, is)
98             )
99         {}
101         //- Construct from mesh, faceFlux and Istream
102         limitWith
103         (
104             const fvMesh& mesh,
105             const surfaceScalarField& faceFlux,
106             Istream& is
107         )
108         :
109             surfaceInterpolationScheme<Type>(mesh),
110             tInterp_
111             (
112                 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
113             ),
114             tLimiter_
115             (
116                 limitedSurfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
117             )
118         {}
121     // Member Functions
123         //- Return the interpolation weighting factors
124         virtual tmp<surfaceScalarField> weights
125         (
126             const GeometricField<Type, fvPatchField, volMesh>& vf
127         ) const
128         {
129             return tLimiter_().weights
130             (
131                 vf,
132                 tInterp_().weights(vf),
133                 tLimiter_().limiter(vf)
134             );
135         }
137         //- Return true if this scheme uses an explicit correction
138         virtual bool corrected() const
139         {
140             return tInterp_().corrected();
141         }
143         //- Return the explicit correction to the face-interpolate
144         //  for the given field
145         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
146         correction(const GeometricField<Type, fvPatchField, volMesh>& vf) const
147         {
148             return tLimiter_().limiter(vf)*tInterp_().correction(vf);
149         }
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 #endif
161 // ************************************************************************* //