29 template<
unsigned int dim,
unsigned int spacedim>
47 template<
unsigned int dim,
unsigned int spacedim>
51 for (
unsigned int i=0; i<dim+1; i++)
52 coords.col(i) = *elm.node(i);
57 template<
unsigned int dim,
unsigned int spacedim>
60 arma::mat::fixed<spacedim,dim> jac;
61 for (
unsigned int i=0; i<spacedim; i++)
62 for (
unsigned int j=0; j<dim; j++)
63 jac(i,j) = coords(i,j+1) - coords(i,0);
68 template<
unsigned int dim,
unsigned int spacedim>
71 arma::mat::fixed<3, dim> A =
map.cols(1,dim);
72 for(
unsigned int i=0; i < dim; i++ ) {
73 A.col(i) -=
map.col(0);
76 arma::mat::fixed<dim, dim> AtA = A.t()*A;
77 arma::vec::fixed<dim> Atb = A.t()*(point -
map.col(0));
78 arma::vec::fixed<dim+1> bary_coord;
79 bary_coord.rows(1, dim) = arma::solve(AtA, Atb);
80 bary_coord( 0 ) = 1.0 - arma::sum( bary_coord.rows(1,dim) );
84 template<
unsigned int dim,
unsigned int spacedim>
90 template<
unsigned int dim,
unsigned int spacedim>
95 template <
unsigned int dim,
unsigned int spacedim>
98 arma::vec projection = project_real_to_unit(point, element_map(elm));
static const double epsilon
stabilization parameter
Affine mapping between reference and actual cell.
arma::vec::fixed< dim+1 > BaryPoint
arma::vec::fixed< spacedim > RealPoint
static BaryPoint clip_to_element(BaryPoint &barycentric)
static arma::mat::fixed< spacedim, dim > jacobian(const ElementMap &coords)
static bool contains_point(arma::vec point, ElementAccessor< 3 > elm)
Test if element contains given point.
static RealPoint project_unit_to_real(const BaryPoint &point, const ElementMap &map)
arma::mat::fixed< spacedim, dim+1 > ElementMap
static BaryPoint project_real_to_unit(const RealPoint &point, const ElementMap &map)
static ElementMap element_map(ElementAccessor< 3 > elm)
static UpdateFlags update_each(UpdateFlags flags)
Determines which additional quantities have to be computed.
static BaryPoint clip(const BaryPoint &barycentric)
Class MappingP1 implements the affine transformation of the unit cell onto the actual cell.
Basic definitions of numerical quadrature rules.
UpdateFlags
Enum type UpdateFlags indicates which quantities are to be recomputed on each finite element cell.
@ update_volume_elements
Determinant of the Jacobian.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_jacobians
Volume element.
@ update_inverse_jacobians
Volume element.