15 det.resize(v.rows(), 1);
18 for (
long i = 0; i < v.rows(); ++i)
19 jac_it[i] = Eigen::MatrixXd::Identity(v.cols(), v.cols());
29 for (
long i = 0; i < dx.rows(); ++i)
31 tmp.row(0) = dx.row(i);
32 tmp.row(1) = dy.row(i);
33 tmp.row(2) = dz.row(i);
35 if (tmp.determinant() <= 0)
48 for (
long i = 0; i < dx.rows(); ++i)
50 tmp.row(0) = dx.row(i);
51 tmp.row(1) = dy.row(i);
53 if (tmp.determinant() <= 0)
76 for (
long k = 0; k <
val.rows(); ++k)
79 for (
int j = 0; j < gbasis_values.size(); ++j)
83 assert(gbasis_values[j].grad.rows() ==
val.rows());
84 assert(gbasis_values[j].grad.cols() == 3);
86 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
88 tmp.row(0) += gbasis_values[j].grad(k, 0) * b.
global()[ii].node * b.
global()[ii].val;
89 tmp.row(1) += gbasis_values[j].grad(k, 1) * b.
global()[ii].node * b.
global()[ii].val;
90 tmp.row(2) += gbasis_values[j].grad(k, 2) * b.
global()[ii].node * b.
global()[ii].val;
94 det(k) = tmp.determinant();
98 jac_it[k] = tmp.inverse().transpose();
106 det.resize(
val.rows(), 1);
115 for (
long k = 0; k <
val.rows(); ++k)
118 for (
int j = 0; j < gbasis_values.size(); ++j)
122 assert(gbasis_values[j].grad.rows() ==
val.rows());
123 assert(gbasis_values[j].grad.cols() == 2);
125 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
128 tmp.row(0) += gbasis_values[j].grad(k, 0) * b.
global()[ii].node * b.
global()[ii].val;
129 tmp.row(1) += gbasis_values[j].grad(k, 1) * b.
global()[ii].node * b.
global()[ii].val;
134 det(k) = tmp.determinant();
139 jac_it[k] = tmp.inverse().transpose();
158 if (&basis != &gbasis)
161 const int n_local_bases = int(basis.
bases.size());
162 const int n_local_g_bases = int(gbasis.
bases.size());
168 if (&basis != &gbasis)
174 for (
int j = 0; j < n_local_bases; ++j)
178 assert(ass_val.
val.cols() == 1);
179 assert(ass_val.
grad.cols() == pts.cols());
191 assert(gbasis_values.size() == n_local_g_bases);
192 val.resize(pts.rows(), pts.cols());
196 for (
int j = 0; j < n_local_g_bases; ++j)
199 const auto &tmp = gbasis_values[j].val;
202 assert(tmp.size() ==
val.rows());
205 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
207 for (
long k = 0; k <
val.rows(); ++k)
227 const int n_local_bases = int(gbasis.
bases.size());
229 if (n_local_bases <= 0)
235 std::vector<AssemblyValues> tmp;
237 Eigen::MatrixXd dxmv = Eigen::MatrixXd::Zero(quad.
points.rows(), quad.
points.cols());
238 Eigen::MatrixXd dymv = Eigen::MatrixXd::Zero(quad.
points.rows(), quad.
points.cols());
239 Eigen::MatrixXd dzmv;
241 dzmv = Eigen::MatrixXd::Zero(quad.
points.rows(), quad.
points.cols());
245 for (
int j = 0; j < n_local_bases; ++j)
252 for (std::size_t ii = 0; ii < b.
global().size(); ++ii)
254 for (
long k = 0; k < quad.
points.rows(); ++k)
256 dxmv.row(k) += tmp[j].grad(k, 0) * b.
global()[ii].node * b.
global()[ii].val;
257 dymv.row(k) += tmp[j].grad(k, 1) * b.
global()[ii].node * b.
global()[ii].val;
259 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
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
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
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