35 const word& polyFunctionName,
40 A_(polyFunc_->nTerms(), scalar(0),
Zero)
49 for (label i=0;i<A_.size();i++)
60 const scalarField& polyTerms,
64 const label size = A_.n();
68 for (label i=0; i<size; ++i)
70 A_.source()[i] += polyTerms[i]*value;
71 scalar* luMatrixi = A_[i];
72 const scalar tmpValue = polyTerms[i];
74 for (label j=0; j<size; ++j)
76 luMatrixi[j] += tmpValue*polyTerms[j];
85 const scalarField& polyTerms,
90 const label size = A_.n();
94 for (label i=0; i<size; ++i)
96 A_.source()[i] += polyTerms[i]*value*weight;
97 scalar* __restrict luMatrixi = A_[i];
98 const scalar tmpValue = polyTerms[i];
100 for (label j=0; j<size; j++)
102 luMatrixi[j] += tmpValue*polyTerms[j]*weight;
111 const scalarField& polyTerms,
112 scalarSymmetricSquareMatrix&
A
115 const label size =
A.n();
118 for (label i=0; i<size; ++i)
120 for (label j=0; j<size; ++j)
122 A[i][j] += polyTerms[i]*polyTerms[j];
131 const List<scalarField>& listPolyTerms,
132 const List<T>& listValue
137 if (listPolyTerms.size() == listValue.size())
153 <<
"size of listPolyTerms: " << listPolyTerms.size()
154 <<
"size of listValues is: " << listValue.size()
155 <<
" they must match!" <<
nl
165 const List<scalarField>& listPolyTerms,
166 const List<T>& listValue,
167 const List<scalar>& listWeight
172 if (listPolyTerms.size() == listValue.size())
190 <<
"size of listPolyTerms: " << listPolyTerms.size()
191 <<
"size of listValues is:" << listValue.size()
192 <<
"they have to match"
203 const List<scalarField>& listPolyTerms
207 scalarSymmetricSquareMatrix symMatrix(A_.n(), Zero);
217 return inv(symMatrix);
224 const List<scalarField>& listPolyTerms,
225 const List<T>& listValue
228 if (listPolyTerms.size() != listValue.size())
231 <<
"size of listPolyTerms: " << listPolyTerms.size()
232 <<
"size of listValues is:" << listValue.size()
233 <<
"they have to match"
237 Field<T> source(listPolyTerms.size(), Zero);
241 forAll(listPolyTerms[i], j)
243 source[i] += listPolyTerms[i][j]*listValue[i];
254 const List<vector>& positions,
255 const List<T>& listValue
259 if (positions.size() != listValue.size())
262 <<
"size of positions and listValues don't match" << nl
263 <<
"size of positions is: " << positions.size() << nl
264 <<
"size of listValues is: " << listValue.size() << nl
274 polyFunc_->termValues(positions[i]),
293 if (positions.
size() != listValue.
size())
296 <<
"size of positions and listValues don't match" <<
nl
297 <<
"size of positions is: " << positions.
size() <<
nl
298 <<
"size of listValues is: " << listValue.
size() <<
nl
308 polyFunc_->termValues(positions[i]),
331 polyFunc_->termValues(positions[i]),
336 return inv(symMatrix);
343 const List<vector>& positions,
344 const List<T>& listValue
347 if (positions.size() != listValue.size())
350 <<
"size of positions: " << positions.size()
351 <<
"size of listValues is:" << listValue.size()
352 <<
"they have to match"
356 Field<T> source(polyFunc_->nTerms(), Zero);
360 scalarField polyTerms = polyFunc_->termValues(positions[i]);
363 source[i] += polyTerms[j]*listValue[i];
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label n)
Older name for setAddressableSize.
Fit a polynominal function with the help of multiDimPolyFunction.
multiDimPolyFitter(const word &polyFunctionName, const labelVector &geomDirs)
Construct from components.
Field< T > computeMatrixSource(const List< scalarField > &listPolyTerms, const List< T > &listValue)
Compute source.
void fillMatrix(const scalarField &polyTerms, const T &value)
scalarSymmetricSquareMatrix computeInverse(const List< scalarField > &listPolyTerms)
Compute inverse.
Field< T > fitData(const List< scalarField > &listPolyTerms, const List< T > &listValue)
Fit data.
base class for polynomial functions
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Vector< label > labelVector
Vector of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
SymmetricSquareMatrix< scalar > scalarSymmetricSquareMatrix
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.