9#include <kernel/trafo/evaluator_base.hpp>
27 return T_(0.5) * x * (x - T_(1));
34 return T_(0.5) * x * (x + T_(1));
41 return (T_(1) - x) * (T_(1) + x);
94 typename Shape_ =
typename EvalPolicy_::ShapeType>
106 typename EvalPolicy_>
108 public EvaluatorBase<Trafo_, Evaluator<Trafo_, EvalPolicy_, Shape::Vertex >, EvalPolicy_>
141 static constexpr int domain_dim = EvalPolicy::domain_dim;
143 static constexpr int image_dim = EvalPolicy::image_dim;
173 BaseClass::prepare(cell_index);
176 _coeff = this->_trafo.get_mesh().get_vertex_set()[cell_index];
205 typename EvalPolicy_>
206 class Evaluator<Trafo_, EvalPolicy_, Shape::Simplex<1> > :
207 public EvaluatorBase<Trafo_, Evaluator<Trafo_, EvalPolicy_, Shape::Simplex<1> >, EvalPolicy_>
240 static constexpr int domain_dim = EvalPolicy::domain_dim;
242 static constexpr int image_dim = EvalPolicy::image_dim;
244 static_assert(domain_dim < image_dim,
"this trafo is for surfaces only");
277 BaseClass::prepare(cell_index);
280 const MeshType& mesh = this->_trafo.get_mesh();
283 typedef typename MeshType::VertexSetType VertexSetType;
284 const VertexSetType& vertex_set = mesh.get_vertex_set();
287 typedef typename MeshType::template IndexSet<domain_dim, 0>::Type IndexSetType;
288 const IndexSetType& index_set = mesh.template get_index_set<domain_dim, 0>();
291 _coeffs[0] = vertex_set[index_set(cell_index, 0)];
292 _coeffs[1] = vertex_set[index_set(cell_index, 1)];
295 _coeffs[2] = _coeffs[0] + _coeffs[1];
298 for(
int i(0); i < 3; ++i)
299 _coeffs[i].normalize();
315 for(
int i(0); i < image_dim; ++i)
337 for(
int i(0); i < image_dim; ++i)
340 _coeffs[0][i] * (x -
DataType(0.5)) +
341 _coeffs[1][i] * (x +
DataType(0.5)) -
357 for(
int i(0); i < image_dim; ++i)
359 hess_ten[i][0] = _coeffs[0][i] + _coeffs[1][i] -
DataType(2) *_coeffs[2][i];
373 typename EvalPolicy_>
374 class Evaluator<Trafo_, EvalPolicy_, Shape::Simplex<2> > :
375 public EvaluatorBase<Trafo_, Evaluator<Trafo_, EvalPolicy_, Shape::Simplex<2> >, EvalPolicy_>
408 static constexpr int domain_dim = EvalPolicy::domain_dim;
410 static constexpr int image_dim = EvalPolicy::image_dim;
412 static_assert(domain_dim < image_dim,
"this trafo is for surfaces only");
445 BaseClass::prepare(cell_index);
448 const MeshType& mesh = this->_trafo.get_mesh();
451 typedef typename MeshType::VertexSetType VertexSetType;
452 const VertexSetType& vertex_set = mesh.get_vertex_set();
455 typedef typename MeshType::template IndexSet<domain_dim, 0>::Type IndexSetType;
456 const IndexSetType& index_set = mesh.template get_index_set<domain_dim, 0>();
459 _coeffs[0] = vertex_set[index_set(cell_index, 0)];
460 _coeffs[1] = vertex_set[index_set(cell_index, 1)];
461 _coeffs[2] = vertex_set[index_set(cell_index, 2)];
464 _coeffs[3] = _coeffs[1] + _coeffs[2];
465 _coeffs[4] = _coeffs[0] + _coeffs[2];
466 _coeffs[5] = _coeffs[0] + _coeffs[1];
469 for(
int i(0); i < 6; ++i)
470 _coeffs[i].normalize();
487 for(
int i(0); i < image_dim; ++i)
493 _coeffs[3][i] * (
DataType(4) * x * y) +
513 for(
int i(0); i < image_dim; ++i)
543 for(
int i(0); i < image_dim; ++i)
548 hess_ten[i][1][0] =
DataType(4) * (_coeffs[0][i] + _coeffs[3][i] + _coeffs[4][i] + _coeffs[5][i]);
563 typename EvalPolicy_>
564 class Evaluator<Trafo_, EvalPolicy_, Shape::Hypercube<1> > :
565 public EvaluatorBase<Trafo_, Evaluator<Trafo_, EvalPolicy_, Shape::Hypercube<1> >, EvalPolicy_>
598 static constexpr int domain_dim = EvalPolicy::domain_dim;
600 static constexpr int image_dim = EvalPolicy::image_dim;
602 static_assert(domain_dim < image_dim,
"this trafo is for surfaces only");
635 BaseClass::prepare(cell_index);
638 const MeshType& mesh = this->_trafo.get_mesh();
641 typedef typename MeshType::VertexSetType VertexSetType;
642 const VertexSetType& vertex_set = mesh.get_vertex_set();
645 typedef typename MeshType::template IndexSet<domain_dim, 0>::Type IndexSetType;
646 const IndexSetType& index_set = mesh.template get_index_set<domain_dim, 0>();
649 _coeffs[0] = vertex_set[index_set(cell_index, 0)];
650 _coeffs[1] = vertex_set[index_set(cell_index, 1)];
653 _coeffs[2] = _coeffs[0] + _coeffs[1];
656 for(
int i(0); i < 3; ++i)
657 _coeffs[i].normalize();
671 for(
int i(0); i < image_dim; ++i)
674 _coeffs[0][i] * Intern::p0(
dom_point[0]) +
675 _coeffs[1][i] * Intern::p1(
dom_point[0]) +
676 _coeffs[2][i] * Intern::p2(
dom_point[0]);
691 for(
int i(0); i < image_dim; ++i)
694 _coeffs[0][i] * Intern::d1p0(
dom_point[0]) +
695 _coeffs[1][i] * Intern::d1p1(
dom_point[0]) +
696 _coeffs[2][i] * Intern::d1p2(
dom_point[0]);
711 for(
int i(0); i < image_dim; ++i)
714 _coeffs[0][i] * Intern::d2p0(
dom_point[0]) +
715 _coeffs[1][i] * Intern::d2p1(
dom_point[0]) +
716 _coeffs[2][i] * Intern::d2p2(
dom_point[0]);
730 typename EvalPolicy_>
731 class Evaluator<Trafo_, EvalPolicy_, Shape::Hypercube<2> > :
732 public EvaluatorBase<Trafo_, Evaluator<Trafo_, EvalPolicy_, Shape::Hypercube<2> >, EvalPolicy_>
765 static constexpr int domain_dim = EvalPolicy::domain_dim;
767 static constexpr int image_dim = EvalPolicy::image_dim;
769 static_assert(domain_dim < image_dim,
"this trafo is for surfaces only");
802 BaseClass::prepare(cell_index);
805 const MeshType& mesh = this->_trafo.get_mesh();
808 typedef typename MeshType::VertexSetType VertexSetType;
809 const VertexSetType& vertex_set = mesh.get_vertex_set();
812 typedef typename MeshType::template IndexSet<domain_dim, 0>::Type IndexSetType;
813 const IndexSetType& index_set = mesh.template get_index_set<domain_dim, 0>();
816 _coeffs[0] = vertex_set[index_set(cell_index, 0)];
817 _coeffs[1] = vertex_set[index_set(cell_index, 1)];
818 _coeffs[2] = vertex_set[index_set(cell_index, 2)];
819 _coeffs[3] = vertex_set[index_set(cell_index, 3)];
822 _coeffs[4] = _coeffs[0] + _coeffs[1];
823 _coeffs[5] = _coeffs[2] + _coeffs[3];
824 _coeffs[6] = _coeffs[0] + _coeffs[2];
825 _coeffs[7] = _coeffs[1] + _coeffs[3];
828 _coeffs[8] = _coeffs[0] + _coeffs[1] + _coeffs[2] + _coeffs[3];
831 for(
int i(0); i < 9; ++i)
832 _coeffs[i].normalize();
846 for(
int i(0); i < image_dim; ++i)
872 for(
int i(0); i < image_dim; ++i)
908 for(
int i(0); i < image_dim; ++i)
Tiny Matrix class template.
Tiny Vector class template.
CUDA_HOST_DEVICE Vector & normalize()
Normalizes this vector.
Trafo Evaluator CRTP base-class template.
void calc_jac_mat(JacobianMatrixType &jac_mat, const DomainPointType &dom_point) const
Calculates the jacobian matrix for a given point.
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
EvalPolicy::DomainPointType DomainPointType
domain point type
EvalPolicy_ EvalPolicy
trafo evaluation traits
EvalPolicy::HessianTensorType HessianTensorType
hessian tensor type
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
EvalPolicy::ImagePointType ImagePointType
image point type
void prepare(Index cell_index)
Prepares the evaluator for a given cell.
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a point from the reference cell to the selected cell.
Shape::Hypercube< 1 > ShapeType
shape type
Tiny::Matrix< DataType, 3, image_dim > _coeffs
the coefficients of the trafo
Evaluator(const TrafoType &trafo)
Constructor.
EvaluatorBase< Trafo_, Evaluator, EvalPolicy_ > BaseClass
base-class typedef
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
TrafoType::MeshType MeshType
type of the underlying mesh
Trafo_ TrafoType
trafo type using this evaluator
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
EvalPolicy::DataType DataType
evaluation data type
void calc_hess_ten(HessianTensorType &hess_ten, const DomainPointType &dom_point) const
Computes the hessian tensor for a given domain point.
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
Tiny::Matrix< DataType, 9, image_dim > _coeffs
the coefficients of the trafo
void calc_jac_mat(JacobianMatrixType &jac_mat, const DomainPointType &dom_point) const
Calculates the jacobian matrix for a given point.
Evaluator(const TrafoType &trafo)
Constructor.
EvalPolicy::DataType DataType
evaluation data type
Trafo_ TrafoType
trafo type using this evaluator
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a point from the reference cell to the selected cell.
Shape::Hypercube< 2 > ShapeType
shape type
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
TrafoType::MeshType MeshType
type of the underlying mesh
EvalPolicy_ EvalPolicy
trafo evaluation traits
EvalPolicy::DomainPointType DomainPointType
domain point type
void prepare(Index cell_index)
Prepares the evaluator for a given cell.
EvalPolicy::HessianTensorType HessianTensorType
hessian tensor type
void calc_hess_ten(HessianTensorType &hess_ten, const DomainPointType &dom_point) const
Computes the hessian tensor for a given domain point.
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
EvalPolicy::ImagePointType ImagePointType
image point type
EvaluatorBase< Trafo_, Evaluator, EvalPolicy_ > BaseClass
base-class typedef
void calc_hess_ten(HessianTensorType &hess_ten, const DomainPointType &dom_point) const
Computes the hessian tensor for a given domain point.
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a point from the reference cell to the selected cell.
EvalPolicy::ImagePointType ImagePointType
image point type
Evaluator(const TrafoType &trafo)
Constructor.
TrafoType::MeshType MeshType
type of the underlying mesh
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
Trafo_ TrafoType
trafo type using this evaluator
EvalPolicy::DomainPointType DomainPointType
domain point type
void calc_jac_mat(JacobianMatrixType &jac_mat, const DomainPointType &dom_point) const
Calculates the jacobian matrix for a given point.
EvalPolicy::HessianTensorType HessianTensorType
hessian tensor type
Tiny::Matrix< DataType, 3, image_dim > _coeffs
the coefficients of the trafo
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
EvaluatorBase< Trafo_, Evaluator, EvalPolicy_ > BaseClass
base-class typedef
EvalPolicy::DataType DataType
evaluation data type
Shape::Hypercube< 1 > ShapeType
shape type
EvalPolicy_ EvalPolicy
trafo evaluation traits
void prepare(Index cell_index)
Prepares the evaluator for a given cell.
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a point from the reference cell to the selected cell.
Shape::Simplex< 2 > ShapeType
shape type
EvaluatorBase< Trafo_, Evaluator, EvalPolicy_ > BaseClass
base-class typedef
void prepare(Index cell_index)
Prepares the evaluator for a given cell.
void calc_jac_mat(JacobianMatrixType &jac_mat, const DomainPointType &dom_point) const
Calculates the jacobian matrix for a given point.
void calc_hess_ten(HessianTensorType &hess_ten, const DomainPointType &dom_point) const
Computes the hessian tensor for a given domain point.
EvalPolicy::HessianTensorType HessianTensorType
hessian tensor type
TrafoType::MeshType MeshType
type of the underlying mesh
Tiny::Matrix< DataType, 6, image_dim > _coeffs
the coefficients of the trafo
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
Trafo_ TrafoType
trafo type using this evaluator
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
EvalPolicy::DataType DataType
evaluation data type
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
Evaluator(const TrafoType &trafo)
Constructor.
EvalPolicy_ EvalPolicy
trafo evaluation traits
EvalPolicy::DomainPointType DomainPointType
domain point type
EvalPolicy::ImagePointType ImagePointType
image point type
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
TrafoType::MeshType MeshType
type of the underlying mesh
EvalPolicy::ImagePointType ImagePointType
image point type
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a point from the reference cell to the selected cell.
void prepare(Index cell_index)
Prepares the evaluator for a given cell.
Tiny::Vector< DataType, image_dim > _coeff
the coefficients of the trafo
EvaluatorBase< Trafo_, Evaluator, EvalPolicy_ > BaseClass
base-class typedef
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
EvalPolicy_ EvalPolicy
trafo evaluation traits
Shape::Vertex ShapeType
shape type
EvalPolicy::DomainPointType DomainPointType
domain point type
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
EvalPolicy::DataType DataType
evaluation data type
Trafo_ TrafoType
trafo type using this evaluator
EvalPolicy::HessianTensorType HessianTensorType
hessian tensor type
Evaluator(const TrafoType &trafo)
Constructor.
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
Iso-Sphere trafo evaluator class template.
std::uint64_t Index
Index data type.
TrafoTags
Trafo configuration tags enum.
@ img_point
specifies whether the trafo should supply image point coordinates
@ dom_point
specifies whether the trafo should supply domain point coordinates
@ hess_ten
specifies whether the trafo should supply hessian tensors
@ jac_mat
specifies whether the trafo should supply jacobian matrices
@ jac_det
specifies whether the trafo should supply jacobian determinants
Hypercube shape tag struct template.
Simplex shape tag struct template.