Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / schemes / weighted / weighted.H
bloba20b605e14211df1d352839b37396ed9a0f5adeb
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::weighted
27 Description
28     Interpolation scheme class using weights looked-up from the objectRegistry.
30 SourceFiles
31     weighted.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef weighted_H
36 #define weighted_H
38 #include "surfaceInterpolationScheme.H"
39 #include "volFields.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                            Class weighted Declaration
48 \*---------------------------------------------------------------------------*/
50 template<class Type>
51 class weighted
53     public surfaceInterpolationScheme<Type>
55     // Private member data
57         const surfaceScalarField& weights_;
60     // Private Member Functions
62         //- Disallow default bitwise assignment
63         void operator=(const weighted&);
66 public:
68     //- Runtime type information
69     TypeName("weighted");
72     // Constructors
74         //- Construct from weights
75         weighted(const surfaceScalarField& weights)
76         :
77             surfaceInterpolationScheme<Type>(weights.mesh()),
78             weights_(weights)
79         {}
81         //- Construct from Istream
82         weighted(const fvMesh& mesh, Istream& is)
83         :
84             surfaceInterpolationScheme<Type>(mesh),
85             weights_
86             (
87                 this->mesh().objectRegistry::template
88                 lookupObject<const surfaceScalarField>
89                 (
90                     word(is)
91                 )
92             )
93         {}
95         //- Construct from faceFlux and Istream
96         weighted
97         (
98             const fvMesh& mesh,
99             const surfaceScalarField&,
100             Istream& is
101         )
102         :
103             surfaceInterpolationScheme<Type>(mesh),
104             weights_
105             (
106                 this->mesh().objectRegistry::template
107                 lookupObject<const surfaceScalarField>
108                 (
109                     word(is)
110                 )
111             )
112         {}
115     // Member Functions
117         //- Return the interpolation weighting factors
118         tmp<surfaceScalarField> weights
119         (
120             const GeometricField<Type, fvPatchField, volMesh>&
121         ) const
122         {
123             return weights_;
124         }
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 } // End namespace Foam
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 #endif
136 // ************************************************************************* //