28 mapped = Eigen::MatrixXd::Zero(samples.rows(), samples.cols());
29 std::vector<AssemblyValues> tmp_val;
32 const int n_local_bases = int(
bases.size());
33 for (
int j = 0; j < n_local_bases; ++j)
36 const auto &tmp = tmp_val[j].val;
38 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
40 for (
long k = 0; k < tmp.size(); ++k)
42 mapped.row(k) += tmp(k) * b.
global()[ii].node * b.
global()[ii].val;
84 grads.resize(samples.rows());
89 std::fill(grads.begin(), grads.end(), Eigen::MatrixXd::Identity(samples.cols(), samples.cols()));
93 Eigen::MatrixXd local_grad;
95 const int n_local_bases = int(
bases.size());
96 const bool is_volume = samples.cols() == 3;
97 Eigen::MatrixXd dxmv = Eigen::MatrixXd::Zero(samples.rows(), samples.cols());
98 Eigen::MatrixXd dymv = Eigen::MatrixXd::Zero(samples.rows(), samples.cols());
99 Eigen::MatrixXd dzmv = Eigen::MatrixXd::Zero(samples.rows(), samples.cols());
101 std::vector<AssemblyValues> tmp_val;
104 for (
int j = 0; j < n_local_bases; ++j)
107 const auto &grad = tmp_val[j].grad;
109 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
111 for (
long k = 0; k < samples.rows(); ++k)
113 dxmv.row(k) += grad(k, 0) * b.
global()[ii].node * b.
global()[ii].val;
114 dymv.row(k) += grad(k, 1) * b.
global()[ii].node * b.
global()[ii].val;
116 dzmv.row(k) += grad(k, 2) * b.
global()[ii].node * b.
global()[ii].val;
121 Eigen::MatrixXd tmp(samples.cols(), samples.cols());
123 for (
long k = 0; k < samples.rows(); ++k)
125 tmp.row(0) = dxmv.row(k);
126 tmp.row(1) = dymv.row(k);
128 tmp.row(2) = dzmv.row(k);