initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / schemes / localMax / localMax.H
blobfa121e54da07ecfef20a679fb8ac497bb6dd2eb3
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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::localMax
28 Description
29     LocalMax-mean differencing scheme class.  This scheme interpolates 1/field
30     using a scheme specified at run-time and return the reciprocal of the
31     interpolate.
33 SourceFiles
34     localMax.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef localMax_H
39 #define localMax_H
41 #include "surfaceInterpolationScheme.H"
42 #include "volFields.H"
43 #include "surfaceFields.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                            Class localMax Declaration
52 \*---------------------------------------------------------------------------*/
54 template<class Type>
55 class localMax
57     public surfaceInterpolationScheme<Type>
59     // Private Member Functions
61         //- Disallow default bitwise assignment
62         void operator=(const localMax&);
65 public:
67     //- Runtime type information
68     TypeName("localMax");
71     // Constructors
73         //- Construct from mesh
74         localMax(const fvMesh& mesh)
75         :
76             surfaceInterpolationScheme<Type>(mesh)
77         {}
79         //- Construct from Istream. 
80         //  The name of the flux field is read from the Istream and looked-up
81         //  from the mesh objectRegistry
82         localMax
83         (
84             const fvMesh& mesh,
85             Istream& is
86         )
87         :
88             surfaceInterpolationScheme<Type>(mesh)
89         {}
91         //- Construct from faceFlux and Istream
92         localMax
93         (
94             const fvMesh& mesh,
95             const surfaceScalarField& faceFlux,
96             Istream& is
97         )
98         :
99             surfaceInterpolationScheme<Type>(mesh)
100         {}
103     // Member Functions
105         //- Return the interpolation weighting factors
106         virtual tmp<surfaceScalarField> weights
107         (
108             const GeometricField<Type, fvPatchField, volMesh>&
109         ) const
110         {
111             notImplemented
112             (
113                 "localMax::weights"
114                 "(const GeometricField<Type, fvPatchField, volMesh>&)"
115             );
117             return tmp<surfaceScalarField>(NULL);
118         }
120         //- Return the face-interpolate of the given cell field
121         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
122         interpolate
123         (
124             const GeometricField<Type, fvPatchField, volMesh>& vf
125         ) const
126         {
127             const fvMesh& mesh = vf.mesh();
129             tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tvff
130             (
131                 new GeometricField<Type, fvsPatchField, surfaceMesh>
132                 (
133                     IOobject
134                     (
135                         vf.name(),
136                         mesh.time().timeName(),
137                         mesh
138                     ),
139                     mesh,
140                     vf.dimensions()
141                 )
142             );
143             GeometricField<Type, fvsPatchField, surfaceMesh>& vff = tvff();
145             forAll(vff.boundaryField(), patchi)
146             {
147                 vff.boundaryField()[patchi] = vf.boundaryField()[patchi];
148             }
150             const unallocLabelList& own = mesh.owner();
151             const unallocLabelList& nei = mesh.neighbour();
153             forAll(vff, facei)
154             {
155                 vff[facei] = max(vf[own[facei]], vf[nei[facei]]);
156             }
158             return tvff;
159         }
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 } // End namespace Foam
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 #endif
171 // ************************************************************************* //