ITHACA-FV
2026.04
Loading...
Searching...
No Matches
src
ITHACA_INTERPOLATOR
mtbRBF
mtbRBF.H
1
/*---------------------------------------------------------------------------*\
2
██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3
██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4
██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5
██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6
██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7
╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9
* In real Time Highly Advanced Computational Applications for Finite Volumes
10
* Copyright (C) 2017 by the ITHACA-FV authors
11
-------------------------------------------------------------------------------
12
13
License
14
This file is part of ITHACA-FV
15
16
ITHACA-FV is free software: you can redistribute it and/or modify
17
it under the terms of the GNU Lesser General Public License as published by
18
the Free Software Foundation, either version 3 of the License, or
19
(at your option) any later version.
20
21
ITHACA-FV is distributed in the hope that it will be useful,
22
but WITHOUT ANY WARRANTY; without even the implied warranty of
23
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
GNU Lesser General Public License for more details.
25
26
You should have received a copy of the GNU Lesser General Public License
27
along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
28
29
Class
30
mtbRBF
31
Description
32
RBF interpolation class using the Mathtoolbox library.
33
SourceFiles
34
mtbRBF.C
35
\*---------------------------------------------------------------------------*/
36
37
#ifndef mtbRBF_H
38
#define mtbRBF_H
39
40
#include <Eigen/Core>
41
#include <memory>
42
#include <string>
43
#include <mathtoolbox/rbf-interpolation.hpp>
44
#include "dictionary.H"
45
#include "Ostream.H"
46
#include <cmath>
47
48
class
mtbRBF
49
{
50
public
:
51
// Constructor
52
// kernelType can be "gaussian", "linear", "thin_plate_spline", "cubic"
53
mtbRBF(
const
Foam::word& kernelType =
"gaussian"
,
54
bool
usePolynomialTerm =
true
,
55
bool
useRegularization =
true
,
56
Foam::scalar lambda = 0.001,
57
bool
normalize =
true
);
58
59
// Constructor from OpenFOAM dictionary
60
mtbRBF(
const
Foam::dictionary& dict);
61
62
// Destructor
63
~mtbRBF();
64
65
// Fit function
66
void
fit(
const
Eigen::MatrixXd& X,
const
Eigen::VectorXd& y);
67
68
// Predict function
69
Foam::scalar predict(
const
Eigen::VectorXd& x);
70
71
// Predict for multiple points
72
Eigen::VectorXd predict(
const
Eigen::MatrixXd& X);
73
74
// Print model info
75
void
printInfo();
76
77
private
:
78
std::unique_ptr<mathtoolbox::RbfInterpolator> impl_;
79
Foam::word kernelType_;
80
bool
useRegularization_;
81
bool
usePolynomialTerm_;
82
Foam::scalar lambda_;
83
bool
normalize_;
84
Foam::scalar epsilon_;
85
86
Eigen::VectorXd xMean_;
87
Eigen::VectorXd xStd_;
88
Foam::scalar yMean_;
89
Foam::scalar yStd_;
90
};
91
92
#endif
Generated by
1.16.1