BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / schemes / CentredFitScheme / CentredFitData.C
blob7aefde8875b9c392d352739b59734b395d9c4f83
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
26 #include "CentredFitData.H"
27 #include "surfaceFields.H"
28 #include "volFields.H"
29 #include "SVD.H"
30 #include "syncTools.H"
31 #include "extendedCentredCellToFaceStencil.H"
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35 template<class Polynomial>
36 Foam::CentredFitData<Polynomial>::CentredFitData
38     const fvMesh& mesh,
39     const extendedCentredCellToFaceStencil& stencil,
40     const scalar linearLimitFactor,
41     const scalar centralWeight
44     FitData
45     <
46         CentredFitData<Polynomial>,
47         extendedCentredCellToFaceStencil,
48         Polynomial
49     >
50     (
51         mesh, stencil, true, linearLimitFactor, centralWeight
52     ),
53     coeffs_(mesh.nFaces())
55     if (debug)
56     {
57         Info<< "Contructing CentredFitData<Polynomial>" << endl;
58     }
60     calcFit();
62     if (debug)
63     {
64         Info<< "CentredFitData<Polynomial>::CentredFitData() :"
65             << "Finished constructing polynomialFit data"
66             << endl;
67     }
71 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
73 template<class Polynomial>
74 void Foam::CentredFitData<Polynomial>::calcFit()
76     const fvMesh& mesh = this->mesh();
78     // Get the cell/face centres in stencil order.
79     // Centred face stencils no good for triangles or tets.
80     // Need bigger stencils
81     List<List<point> > stencilPoints(mesh.nFaces());
82     this->stencil().collectData(mesh.C(), stencilPoints);
84     // find the fit coefficients for every face in the mesh
86     const surfaceScalarField& w = mesh.surfaceInterpolation::weights();
88     for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
89     {
90         FitData
91         <
92             CentredFitData<Polynomial>,
93             extendedCentredCellToFaceStencil,
94             Polynomial
95         >::calcFit(coeffs_[facei], stencilPoints[facei], w[facei], facei);
96     }
98     const surfaceScalarField::GeometricBoundaryField& bw = w.boundaryField();
100     forAll(bw, patchi)
101     {
102         const fvsPatchScalarField& pw = bw[patchi];
104         if (pw.coupled())
105         {
106             label facei = pw.patch().start();
108             forAll(pw, i)
109             {
110                 FitData
111                 <
112                     CentredFitData<Polynomial>,
113                     extendedCentredCellToFaceStencil,
114                     Polynomial
115                 >::calcFit(coeffs_[facei], stencilPoints[facei], pw[i], facei);
116                 facei++;
117             }
118         }
119     }
123 // ************************************************************************* //