9#include <kernel/trafo/eval_data.hpp>
18 template<
bool _enable>
19 struct TrafoEvalHelper;
56 typedef typename EvalPolicy::DataType
DataType;
73 static constexpr int domain_dim = EvalPolicy::domain_dim;
75 static constexpr int image_dim = EvalPolicy::image_dim;
84 static constexpr TrafoTags eval_caps = ...;
93 template<TrafoTags cfg_>
130 return static_cast<Evaluator_&
>(*this);
133 const Evaluator_& cast()
const
135 return static_cast<const Evaluator_&
>(*this);
228 template<TrafoTags cfg_>
240 Intern::TrafoEvalHelper<want_dom_point>::set_dom_point(trafo_data,
dom_point);
243 Intern::TrafoEvalHelper<want_img_point>::map_img_point(trafo_data, cast());
246 Intern::TrafoEvalHelper<want_jac_mat>::calc_jac_mat(trafo_data, cast());
249 Intern::TrafoEvalHelper<want_jac_inv>::calc_jac_inv(trafo_data, cast());
252 Intern::TrafoEvalHelper<want_jac_det>::calc_jac_det(trafo_data, cast());
255 Intern::TrafoEvalHelper<want_hess_ten>::calc_hess_ten(trafo_data, cast());
258 Intern::TrafoEvalHelper<want_hess_inv>::calc_hess_inv(trafo_data, cast());
336 template<
bool _enable>
337 struct TrafoEvalHelper
339 template<
typename TrafoData_,
typename DomPo
int_>
340 static void set_dom_point(TrafoData_&,
const DomPoint_&) {}
342 template<
typename TrafoData_,
typename Evaluator_>
343 static void map_img_point(TrafoData_&,
const Evaluator_&) {}
345 template<
typename TrafoData_,
typename Evaluator_>
346 static void calc_jac_mat(TrafoData_&,
const Evaluator_&) {}
348 template<
typename TrafoData_,
typename Evaluator_>
349 static void calc_jac_inv(TrafoData_&,
const Evaluator_&) {}
351 template<
typename TrafoData_,
typename Evaluator_>
352 static void calc_jac_det(TrafoData_&,
const Evaluator_&) {}
354 template<
typename TrafoData_,
typename Evaluator_>
355 static void calc_hess_ten(TrafoData_&,
const Evaluator_&) {}
357 template<
typename TrafoData_,
typename Evaluator_>
358 static void calc_hess_inv(TrafoData_&,
const Evaluator_&) {}
365 struct TrafoEvalHelper<true>
367 template<
typename TrafoData_,
typename DomPo
int_>
368 static void set_dom_point(TrafoData_& trafo_data,
const DomPoint_& dom_point)
373 template<
typename TrafoData_,
typename Evaluator_>
374 static void map_img_point(TrafoData_& trafo_data,
const Evaluator_& evaluator)
376 if(!*(Evaluator_::eval_caps & TrafoTags::img_point))
377 XABORTM(
"trafo evaluator can't compute image point coordinates");
378 evaluator.map_point(trafo_data.img_point, trafo_data.dom_point);
381 template<
typename TrafoData_,
typename Evaluator_>
382 static void calc_jac_mat(TrafoData_& trafo_data,
const Evaluator_& evaluator)
384 if(!*(Evaluator_::eval_caps & TrafoTags::jac_mat))
385 XABORTM(
"trafo evaluator can't compute jacobian matrices");
387 evaluator.calc_jac_mat(trafo_data.jac_mat, trafo_data.dom_point);
390 template<
typename TrafoData_,
typename Evaluator_>
391 static void calc_jac_inv(TrafoData_& trafo_data,
const Evaluator_&)
393 if(!*(Evaluator_::eval_caps & TrafoTags::jac_inv))
394 XABORTM(
"trafo evaluator can't compute jacobian inverse matrices");
396 trafo_data.jac_inv.set_inverse(trafo_data.jac_mat);
399 template<
typename TrafoData_,
typename Evaluator_>
400 static void calc_jac_det(TrafoData_& trafo_data,
const Evaluator_&)
402 if(!*(Evaluator_::eval_caps & TrafoTags::jac_det))
403 XABORTM(
"trafo evaluator can't compute jacobian determinants");
405 trafo_data.jac_det = trafo_data.jac_mat.vol();
408 template<
typename TrafoData_,
typename Evaluator_>
409 static void calc_hess_ten(TrafoData_& trafo_data,
const Evaluator_& evaluator)
411 if(!*(Evaluator_::eval_caps & TrafoTags::hess_ten))
412 XABORTM(
"trafo evaluator can't compute hessian tensors");
414 evaluator.calc_hess_ten(trafo_data.hess_ten, trafo_data.dom_point);
417 template<
typename TrafoData_,
typename Evaluator_>
418 static void calc_hess_inv(TrafoData_& trafo_data,
const Evaluator_&)
420 if(!*(Evaluator_::eval_caps & TrafoTags::hess_inv))
421 XABORTM(
"trafo evaluator can't compute inverse hessian tensors");
423 typedef typename TrafoData_::EvalTraits EvalTraits;
424 typedef typename EvalTraits::DataType DataType;
425 typename EvalTraits::HessianTensorType hess_jac;
429 hess_jac.add_double_mat_mult(trafo_data.hess_ten, trafo_data.jac_inv, trafo_data.jac_inv);
430 trafo_data.hess_inv.format();
431 trafo_data.hess_inv.add_mat_tensor_mult(trafo_data.jac_inv, hess_jac, -DataType(1));
#define XABORTM(msg)
Abortion macro definition with custom message.
Trafo evaluation data structure.
Trafo Evaluator CRTP base-class template.
EvalPolicy_ EvalTraits
evaluation traits; identical to eval policy
CellIterator end() const
Returns a CellIterator representing the first index past the last cell.
EvalPolicy_ EvalPolicy
evaluation policy
static constexpr int domain_dim
domain dimension
const TrafoType & get_trafo() const
Returns a reference to the trafo object.
EvaluatorBase(const TrafoType &trafo)
constructor
Index get_num_cells() const
Returns the number of cells in the mesh.
void finish()
Finishes the evaluator for the currently active cell.
void calc_jac_mat(JacobianMatrixType &jac_mat, const DomainPointType &dom_point) const
Computes the jacobian matrix for a given domain point.
EvalPolicy::DomainPointType DomainPointType
domain point type
void operator()(Trafo::EvalData< EvalTraits, cfg_ > &trafo_data, const DomainPointType &dom_point) const
Trafo evaluation operator.
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
void prepare(const CellIterator &cell)
Prepares the evaluator for a given cell.
EvalPolicy::JacobianMatrixType JacobianMatrixType
jacobian matrix type
static constexpr int image_dim
image dimension
EvalPolicy::JacobianInverseType JacobianInverseType
jacobian inverse matrix type
EvalPolicy::DataType DataType
evaluation data type
TrafoType::ShapeType ShapeType
shape type
DataType width_directed(const ImagePointType &ray) const
Computes and returns the directed mesh width.
const TrafoType & _trafo
trafo reference
Index CellIterator
CellIterator typedef.
EvalPolicy::HessianInverseType HessianInverseType
hessian inverse tensor type
DataType volume() const
Computes and returns the volume of the current cell.
void map_point(ImagePointType &img_point, const DomainPointType &dom_point) const
Maps a domain point from the reference cell to the currently active cell.
EvalPolicy::JacobianDeterminantType JacobianDeterminantType
jacobian determinant type
Index _cell_index
currently active cell index
Index get_cell_index() const
Returns the index of the currently active cell.
CellIterator begin() const
Returns a CellIterator representing the index of the first cell.
EvalPolicy::ImagePointType ImagePointType
image point type
Trafo_ TrafoType
trafo type
std::uint64_t Index
Index data type.
TrafoTags
Trafo configuration tags enum.
@ img_point
specifies whether the trafo should supply image point coordinates
@ hess_inv
specifies whether the trafo should supply inverse hessian tensors
@ dom_point
specifies whether the trafo should supply domain point coordinates
@ hess_ten
specifies whether the trafo should supply hessian tensors
@ jac_inv
specifies whether the trafo should supply inverse jacobian matrices
@ jac_mat
specifies whether the trafo should supply jacobian matrices
@ jac_det
specifies whether the trafo should supply jacobian determinants
Trafo configuration traits class template.
Trafo::EvalData< EvalTraits, config > EvalDataType
evaluation data typedef