17 det.resize(v.rows(), 1);
20 for (
long i = 0; i < v.rows(); ++i)
21 jac_it[i] = Eigen::MatrixXd::Identity(v.cols(), v.cols());
31 for (
long i = 0; i < dx.rows(); ++i)
33 tmp.row(0) = dx.row(i);
34 tmp.row(1) = dy.row(i);
35 tmp.row(2) = dz.row(i);
37 if (tmp.determinant() <= 0)
50 for (
long i = 0; i < dx.rows(); ++i)
52 tmp.row(0) = dx.row(i);
53 tmp.row(1) = dy.row(i);
55 if (tmp.determinant() <= 0)
78 for (
long k = 0; k <
val.rows(); ++k)
81 for (
int j = 0; j < gbasis_values.size(); ++j)
85 assert(gbasis_values[j].grad.rows() ==
val.rows());
86 assert(gbasis_values[j].grad.cols() == 3);
88 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
90 tmp.row(0) += gbasis_values[j].grad(k, 0) * b.
global()[ii].node * b.
global()[ii].val;
91 tmp.row(1) += gbasis_values[j].grad(k, 1) * b.
global()[ii].node * b.
global()[ii].val;
92 tmp.row(2) += gbasis_values[j].grad(k, 2) * b.
global()[ii].node * b.
global()[ii].val;
96 det(k) = tmp.determinant();
100 jac_it[k] = tmp.inverse().transpose();
108 det.resize(
val.rows(), 1);
117 for (
long k = 0; k <
val.rows(); ++k)
120 for (
int j = 0; j < gbasis_values.size(); ++j)
124 assert(gbasis_values[j].grad.rows() ==
val.rows());
125 assert(gbasis_values[j].grad.cols() == 2);
127 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
130 tmp.row(0) += gbasis_values[j].grad(k, 0) * b.
global()[ii].node * b.
global()[ii].val;
131 tmp.row(1) += gbasis_values[j].grad(k, 1) * b.
global()[ii].node * b.
global()[ii].val;
136 det(k) = tmp.determinant();
141 jac_it[k] = tmp.inverse().transpose();
153 order = std::max(order, b.order());
175 if (&basis != &gbasis)
178 const int n_local_bases = int(basis.
bases.size());
179 const int n_local_g_bases = int(gbasis.
bases.size());
185 if (&basis != &gbasis)
191 for (
int j = 0; j < n_local_bases; ++j)
195 assert(ass_val.
val.cols() == 1);
196 assert(ass_val.
grad.cols() == pts.cols());
208 assert(gbasis_values.size() == n_local_g_bases);
209 val.resize(pts.rows(), pts.cols());
213 for (
int j = 0; j < n_local_g_bases; ++j)
216 const auto &tmp = gbasis_values[j].val;
219 assert(tmp.size() ==
val.rows());
222 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
224 for (
long k = 0; k <
val.rows(); ++k)
244 const int n_local_bases = int(gbasis.
bases.size());
246 if (n_local_bases <= 0)
252 std::vector<AssemblyValues> tmp;
254 Eigen::MatrixXd dxmv = Eigen::MatrixXd::Zero(quad.
points.rows(), quad.
points.cols());
255 Eigen::MatrixXd dymv = Eigen::MatrixXd::Zero(quad.
points.rows(), quad.
points.cols());
256 Eigen::MatrixXd dzmv;
258 dzmv = Eigen::MatrixXd::Zero(quad.
points.rows(), quad.
points.cols());
262 for (
int j = 0; j < n_local_bases; ++j)
269 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
271 for (
long k = 0; k < quad.
points.rows(); ++k)
273 dxmv.row(k) += tmp[j].grad(k, 0) * b.
global()[ii].node * b.
global()[ii].val;
274 dymv.row(k) += tmp[j].grad(k, 1) * b.
global()[ii].node * b.
global()[ii].val;
276 dzmv.row(k) += tmp[j].grad(k, 2) * b.
global()[ii].node * b.
global()[ii].val;
stores per local bases evaluations
std::vector< basis::Local2Global > global
const basis::ElementBases * gbasis_
bool is_geom_mapping_positive(const bool is_volume, const basis::ElementBases &gbasis) const
check if the element is flipped
std::vector< AssemblyValues > basis_values
const basis::ElementBases * basis_
std::vector< AssemblyValues > g_basis_values_cache_
bool has_parameterization
void compute(const int el_index, const bool is_volume, const Eigen::MatrixXd &pts, const basis::ElementBases &basis, const basis::ElementBases &gbasis)
computes the per element values at the local (ref el) points (pts) sets basis_values,...
void finalize2d(const basis::ElementBases &gbasis, const std::vector< AssemblyValues > &gbasis_values)
void finalize(const Eigen::MatrixXd &v, const Eigen::MatrixXd &dx, const Eigen::MatrixXd &dy); void f...
std::vector< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > > jac_it
Eigen::VectorXd eval_deformed_jacobian_determinant(const Eigen::VectorXd &disp) const
void finalize_global_element(const Eigen::MatrixXd &v)
quadrature::Quadrature quadrature
void finalize3d(const basis::ElementBases &gbasis, const std::vector< AssemblyValues > &gbasis_values)
Represents one basis function and its gradient.
const std::vector< Local2Global > & global() const
Stores the basis functions for a given element in a mesh (facet in 2d, cell in 3d).
void compute_quadrature(quadrature::Quadrature &quadrature) const
quadrature points to evaluate the basis functions inside the element
void evaluate_bases(const Eigen::MatrixXd &uv, std::vector< assembler::AssemblyValues > &basis_values) const
evaluate stored bases at given points on the reference element saves results to basis_values
void evaluate_grads(const Eigen::MatrixXd &uv, std::vector< assembler::AssemblyValues > &basis_values) const
evaluate gradient of stored bases at given points on the reference element saves results to basis_val...
std::vector< Basis > bases
one basis function per node in the element
bool has_parameterization
Eigen::VectorXd robust_evaluate_jacobian(const int order, const Eigen::MatrixXd &cp, const Eigen::MatrixXd &uv)
Eigen::MatrixXd extract_nodes(const int dim, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXd &u, int order, int n_elem)