PolyFEM
Loading...
Searching...
No Matches
QuadraticBSpline2d.cpp
Go to the documentation of this file.
2
3namespace polyfem
4{
5 namespace basis
6 {
7 void QuadraticBSpline2d::init(const std::array<double, 4> &knots_u, const std::array<double, 4> &knots_v)
8 {
9 spline_u_.init(knots_u);
10 spline_v_.init(knots_v);
11 }
12
13 void QuadraticBSpline2d::interpolate(const Eigen::MatrixXd &ts, Eigen::MatrixXd &result) const
14 {
15 const int n_t = int(ts.rows());
16 assert(ts.cols() == 2);
17
18 result.resize(n_t, 1);
19
20 for (int i = 0; i < n_t; ++i)
21 result(i) = interpolate(ts(i, 0), ts(i, 1));
22 }
23
24 double QuadraticBSpline2d::interpolate(const double u, const double v) const
25 {
27 }
28
29 void QuadraticBSpline2d::derivative(const Eigen::MatrixXd &ts, Eigen::MatrixXd &result) const
30 {
31 const int n_t = int(ts.rows());
32 assert(ts.cols() == 2);
33
34 result.resize(n_t, 2);
35
36 for (int i = 0; i < n_t; ++i)
37 {
38 const double u = ts(i, 0);
39 const double v = ts(i, 1);
40
41 result(i, 0) = spline_u_.derivative(u) * spline_v_.interpolate(v);
42 result(i, 1) = spline_u_.interpolate(u) * spline_v_.derivative(v);
43 }
44 }
45 } // namespace basis
46} // namespace polyfem
void init(const std::array< double, 4 > &knots_u, const std::array< double, 4 > &knots_v)
void interpolate(const Eigen::MatrixXd &ts, Eigen::MatrixXd &result) const
void derivative(const Eigen::MatrixXd &ts, Eigen::MatrixXd &result) const
void init(const std::array< double, 4 > &knots)
void interpolate(const Eigen::MatrixXd &ts, Eigen::MatrixXd &result) const
void derivative(const Eigen::MatrixXd &ts, Eigen::MatrixXd &result) const