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