12 int index_mapping(
const int p,
const int q,
const int i)
17 const int npe = (p - 1) * 3;
18 const int npf = std::max(0, (p - 1) * (p - 2) / 2);
19 const int nl = 3 + npe + npf;
20 const int nqe = q - 1;
23 if (i >= nl * q && i < nl * q + 3)
24 return i - nl * q + 3;
27 if (i >= 3 && i < 3 + npe)
31 if (i >= nl * q + 3 && i < nl * q + 3 + npe)
32 return i - nl * q - 3 + 6 + npe;
36 return 6 + 2 * npe + i / nl - 1;
40 return 6 + 2 * npe + i / nl - 1 + nqe;
44 return 6 + 2 * npe + i / nl - 1 + 2 * nqe;
47 if (i >= 3 + npe && i < 3 + npe + npf)
48 return 6 + 2 * npe + 3 * nqe + i - (3 + npe);
51 if (i >= nl * q + 3 + npe && i < nl * q + 3 + npe + npf)
52 return 6 + 2 * npe + 3 * nqe + i - (nl * q + 3 + npe) + npf;
55 const int div = i / nl - 1;
59 return 2 * nl + nqe * 3 + (mod % (npe / 3)) + (mod / (npe / 3)) * npe / 3 * nqe +
div * npe / 3;
63 return 2 * nl + nqe * 3 + npe * nqe + mod + npf *
div;
69 int inverse_index_mapping(
const int p,
const int q,
const int li)
71 Eigen::MatrixXd tmpp, tmpq;
78 for (
int i = 0; i < tmpq.rows(); ++i)
80 for (
int j = 0; j < tmpp.rows(); ++j)
82 if (index_mapping(p, q, index) == li)
94 Eigen::MatrixXd tmpp, tmpq;
99 val.resize(tmpp.rows() * tmpq.rows(), 3);
102 for (
int i = 0; i < tmpq.rows(); ++i)
104 for (
int j = 0; j < tmpp.rows(); ++j)
106 val.row(index_mapping(p, q, index)) << tmpp(j, 0), tmpp(j, 1), tmpq(i, 0);
114 assert(uv.cols() == 3);
116 Eigen::MatrixXd tmpp, tmpq;
120 const int n_p = nn.rows();
122 const int local_index = inverse_index_mapping(p, q, li);
127 val = tmpp.array() * tmpq.array();
132 assert(uv.cols() == 3);
136 const int n_p = nn.rows();
138 Eigen::MatrixXd tmpp, tmpq, tmpgp, tmpgq;
140 const int local_index = inverse_index_mapping(p, q, li);
148 val.resize(uv.rows(), 3);
149 val.col(0) = tmpgp.col(0).array() * tmpq.array();
150 val.col(1) = tmpgp.col(1).array() * tmpq.array();
151 val.col(2) = tmpp.array() * tmpgq.array();
void p_grad_basis_value_2d(const bool bernstein, const int p, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)
void prism_basis_value_3d(const int p, const int q, const int li, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)
void prism_grad_basis_value_3d(const int p, const int q, const int li, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)
void prism_nodes_3d(const int p, const int q, Eigen::MatrixXd &val)
void q_basis_value_1d(const int q, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)
void p_nodes_2d(const int p, Eigen::MatrixXd &val)
void q_grad_basis_value_1d(const int q, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)
void p_basis_value_2d(const bool bernstein, const int p, const int local_index, const Eigen::MatrixXd &uv, Eigen::MatrixXd &val)
void q_nodes_1d(const int q, Eigen::MatrixXd &val)