initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / schemes / FitData / FitData.H
blobcb7bd9ceae5197bfc15cf7cbf7b6c49d03701755
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::FitData
28 Description
29     Data for the upwinded and centred polynomial fit interpolation schemes.
30     The linearCorrection_ determines whether the fit is for a corrected
31     linear scheme (first two coefficients are corrections for owner and
32     neighbour) or a pure upwind scheme (first coefficient is correction for
33     owner ; weight on face taken as 1).
35 SourceFiles
36     FitData.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef FitData_H
41 #define FitData_H
43 #include "MeshObject.H"
44 #include "fvMesh.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 /*---------------------------------------------------------------------------*\
52                     Class FitData Declaration
53 \*---------------------------------------------------------------------------*/
55 template<class FitDataType, class ExtendedStencil, class Polynomial>
56 class FitData
58     public MeshObject<fvMesh, FitDataType>
60     // Private data
62         //- The stencil the fit is based on
63         const ExtendedStencil& stencil_;
65         //- Is scheme correction on linear (true) or on upwind (false)
66         const bool linearCorrection_;
68         //- Factor the fit is allowed to deviate from the base scheme
69         //  (linear or pure upwind)
70         //  This limits the amount of high-order correction and increases
71         //  stability on bad meshes
72         const scalar linearLimitFactor_;
74         //- Weights for central stencil
75         const scalar centralWeight_;
77         //- Dimensionality of the geometry
78         const label dim_;
80         //- Minimum stencil size
81         const label minSize_;
84     // Private member functions
86         //- Find the normal direction (i) and j and k directions for face faci
87         void findFaceDirs
88         (
89             vector& idir,        // value changed in return
90             vector& jdir,        // value changed in return
91             vector& kdir,        // value changed in return
92             const label faci
93         );
95 public:
97     //TypeName("FitData");
100     // Constructors
102         //- Construct from components
103         FitData
104         (
105             const fvMesh& mesh,
106             const ExtendedStencil& stencil,
107             const bool linearCorrection,
108             const scalar linearLimitFactor,
109             const scalar centralWeight
110         );
113     //- Destructor
114     virtual ~FitData()
115     {}
118     // Member functions
120         //- Return reference to the stencil
121         const ExtendedStencil& stencil() const
122         {
123             return stencil_;
124         }
126         bool linearCorrection() const
127         {
128             return linearCorrection_;
129         }
131         //- Calculate the fit for the specified face and set the coefficients
132         void calcFit
133         (
134             scalarList& coeffsi, // coefficients to be set
135             const List<point>&,  // Stencil points
136             const scalar wLin,   // Weight for linear approximation (weights
137                                  // nearest neighbours)
138             const label faci     // Current face index
139         );
141         //- Calculate the fit for all the faces
142         virtual void calcFit() = 0;
145         //- Recalculate weights (but not stencil) when the mesh moves
146         bool movePoints();
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 } // End namespace Foam
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 #ifdef NoRepository
157 #   include "FitData.C"
158 #endif
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 #endif
164 // ************************************************************************* //