multiDimPolyFitter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2019-2020 DLR
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::multiDimPolyFitter
28 
29 Description
30  Fit a polynominal function with the help of multiDimPolyFunction
31 
32  Original code supplied by Henning Scheufler, DLR (2019)
33 
34 SourceFiles
35  multiDimPolyFitter.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef multiDimPolyFitter_H
40 #define multiDimPolyFitter_H
41 
42 #include "simpleMatrix.H"
43 #include "multiDimPolyFunctions.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class multiDimPolyFitter Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class T>
56 {
57  // Private Data
58 
60 
61  simpleMatrix<T> A_;
62 
63 
64 public:
65 
66  // Constructors
67 
68  //- Construct from components
70  (
71  const word& polyFunctionName,
72  const labelVector& geomDirs
73  );
74 
75 
76  // Member Functions
77 
78  void resetMatrix();
79 
80  label nCoeffs() const
81  {
82  return A_.n();
83  }
84 
85  void fillMatrix
86  (
87  const scalarField& polyTerms,
88  const T& value
89  );
90 
91  void fillMatrix
92  (
93  const scalarField& polyTerms,
94  const T& value,
95  const scalar weight
96  );
97 
98  void fillMatrix
99  (
100  const scalarField& polyTerms,
102  );
103 
104  //- Fit data
106  (
107  const List<scalarField>& listPolyTerms,
108  const List<T>& listValue
109  );
110 
111  //- Fit data
113  (
114  const List<scalarField>& listPolyTerms,
115  const List<T>& listValue,
116  const List<scalar>& listWeight
117  );
118 
119  //- Compute inverse
121  (
122  const List<scalarField>& listPolyTerms
123  );
124 
125  //- Compute source
127  (
128  const List<scalarField>& listPolyTerms,
129  const List<T>& listValue
130  );
131 
132  //- Fit data
134  (
135  const List<vector>& positions,
136  const List<T>& listValue
137  );
138 
139  //- Fit data
141  (
142  const List<vector>& positions,
143  const List<T>& listValue,
144  const List<scalar>& listWeight
145  );
146 
147  //- Compute inverse
149  (
150  const List<vector>& positions
151  );
152 
153  //- Compute source
155  (
156  const List<vector>& positions,
157  const List<T>& listValue
158  );
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
Foam::multiDimPolyFitter
Fit a polynominal function with the help of multiDimPolyFunction.
Definition: multiDimPolyFitter.H:54
Foam::simpleMatrix< T >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::multiDimPolyFitter::computeMatrixSource
Field< T > computeMatrixSource(const List< scalarField > &listPolyTerms, const List< T > &listValue)
Compute source.
Definition: multiDimPolyFitter.C:223
A
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Foam::multiDimPolyFitter::resetMatrix
void resetMatrix()
Definition: multiDimPolyFitter.C:47
Foam::multiDimPolyFitter::fitData
Field< T > fitData(const List< scalarField > &listPolyTerms, const List< T > &listValue)
Fit data.
Definition: multiDimPolyFitter.C:130
Foam::Field< scalar >
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::multiDimPolyFitter::computeInverse
scalarSymmetricSquareMatrix computeInverse(const List< scalarField > &listPolyTerms)
Compute inverse.
Definition: multiDimPolyFitter.C:202
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::multiDimPolyFitter::nCoeffs
label nCoeffs() const
Definition: multiDimPolyFitter.H:79
Foam::SymmetricSquareMatrix
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Definition: SymmetricSquareMatrix.H:57
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::multiDimPolyFitter::fillMatrix
void fillMatrix(const scalarField &polyTerms, const T &value)
Definition: multiDimPolyFitter.C:59
Foam::Vector< label >
Foam::List< scalarField >
simpleMatrix.H
Foam::multiDimPolyFitter::multiDimPolyFitter
multiDimPolyFitter(const word &polyFunctionName, const labelVector &geomDirs)
Construct from components.
Definition: multiDimPolyFitter.C:34
multiDimPolyFunctions.H