1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
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
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
29 Inversed weight central-differencing interpolation scheme class.
31 Useful for inverse weighted and harmonic interpolations.
36 \*---------------------------------------------------------------------------*/
38 #ifndef reverseLinear_H
39 #define reverseLinear_H
41 #include "surfaceInterpolationScheme.H"
42 #include "volFields.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class reverseLinear Declaration
51 \*---------------------------------------------------------------------------*/
56 public surfaceInterpolationScheme<Type>
58 // Private Member Functions
60 //- Disallow default bitwise assignment
61 void operator=(const reverseLinear&);
66 //- Runtime type information
67 TypeName("reverseLinear");
72 //- Construct from mesh
73 reverseLinear(const fvMesh& mesh)
75 surfaceInterpolationScheme<Type>(mesh)
78 //- Construct from Istream
79 reverseLinear(const fvMesh& mesh, Istream&)
81 surfaceInterpolationScheme<Type>(mesh)
84 //- Construct from faceFlux and Istream
88 const surfaceScalarField&,
92 surfaceInterpolationScheme<Type>(mesh)
98 //- Return the interpolation weighting factors
99 tmp<surfaceScalarField> weights
101 const GeometricField<Type, fvPatchField, volMesh>&
104 const fvMesh& mesh = this->mesh();
106 tmp<surfaceScalarField> tcdWeights
108 mesh.surfaceInterpolation::weights()
110 const surfaceScalarField& cdWeights = tcdWeights();
112 tmp<surfaceScalarField> treverseLinearWeights
114 new surfaceScalarField
118 "reverseLinearWeights",
119 mesh.time().timeName(),
126 surfaceScalarField& reverseLinearWeights = treverseLinearWeights();
128 reverseLinearWeights.internalField() =
129 1.0 - cdWeights.internalField();
131 forAll (mesh.boundary(), patchI)
133 if (mesh.boundary()[patchI].coupled())
135 reverseLinearWeights.boundaryField()[patchI] =
136 1.0 - cdWeights.boundaryField()[patchI];
140 reverseLinearWeights.boundaryField()[patchI] =
141 cdWeights.boundaryField()[patchI];
145 return treverseLinearWeights;
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 } // End namespace Foam
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 // ************************************************************************* //