9#include <kernel/util/dist.hpp>
10#include <kernel/util/math.hpp>
11#include <kernel/util/tiny_algebra.hpp>
27 template<
typename DataType_>
66 const DataType_ fac_frobenius_,
67 const DataType_ fac_det_,
68 const DataType_ fac_rec_det_,
69 const DataType_ fac_cof_,
70 const DataType_ fac_reg_) :
96 return "RumpfFunctionalBase";
102 const Index pad_width(30);
179 template<
typename DataType_,
typename TrafoType_>
180 class RumpfFunctional;
185 template<
typename DataType_,
typename TrafoType_>
203 typedef typename Intern::TrafoFE<TrafoType>::Space
TrafoSpace;
214 typedef typename TrafoType::template Evaluator<ShapeType, DataType>::Type
TrafoEvaluator;
216 typedef typename TrafoSpace::template Evaluator<TrafoEvaluator>::Type
SpaceEvaluator;
224 typedef typename TrafoEvaluator::template ConfigTraits<trafo_config>::EvalDataType
TrafoEvalData;
226 typedef typename SpaceEvaluator::template ConfigTraits<space_config>::EvalDataType
SpaceEvalData;
259 const DataType_ fac_frobenius_,
260 const DataType_ fac_det_,
261 const DataType_ fac_cof_,
262 const DataType_ fac_reg_,
263 const int exponent_det_);
396 template<
typename DataType_,
typename TrafoType_>
397 class RumpfFunctionalUnrolled;
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Base class template for Rumpf functionals.
String info() const
Print basic information.
DataType _fac_det
Factor for the det part in the mesh quality functional.
DataType _fac_cof
Factor for the cof part in the mesh quality functional.
DataType_ DataType
Our data type.
RumpfFunctionalBase(const DataType_ fac_frobenius_, const DataType_ fac_det_, const DataType_ fac_rec_det_, const DataType_ fac_cof_, const DataType_ fac_reg_)
Constructor.
DataType _fac_frobenius
Factor for the Frobenius norm part in the mesh quality functional.
static String name()
The class name.
DataType _fac_rec_det
Factor for the 1/det part in the mesh quality functional.
DataType _fac_reg
Regularization parameter for the 1/det part in the mesh quality functional.
virtual ~RumpfFunctionalBase()
Virtual destructor.
Functionals for measuring and optimising mesh quality.
SpaceEvaluator::template ConfigTraits< space_config >::EvalDataType SpaceEvalData
Data from evaluating FE spaces.
void eval_fval_cellwise(DataType &fval, const TgradR &mat_tensor, const TrafoEvaluator &trafo_eval, const SpaceEvaluator &space_eval, const Tx &x, const DataType &h, DataType &fval_frobenius, DataType &fval_cof, DataType &fval_det)
Computes the different contributions to the functional's value on one cell.
TrafoType::template Evaluator< ShapeType, DataType >::Type TrafoEvaluator
Type for evaluating the transformation.
Tiny::Matrix< DataType_, shape_dim, world_dim > TgradR
Type for the gradient of the local reference mapping.
void eval_fval_grad(DataType &fval, Tx &grad, const TgradR &mat_tensor, const TrafoEvaluator &trafo_eval, const SpaceEvaluator &space_eval, const Tx &x, const DataType &h)
Computes the functional's value and gradient on one cell.
DataType_ DataType
Our data type.
static constexpr int world_dim
Our world dimension - only world_dim == shape_dim is supported.
RumpfFunctional(const DataType_ fac_frobenius_, const DataType_ fac_det_, const DataType_ fac_cof_, const DataType_ fac_reg_, const int exponent_det_)
Constructor.
Tiny::Matrix< DataType_, Shape::FaceTraits< ShapeType, 0 >::count, world_dim > Tx
Type for a pack of local vertex coordinates.
static constexpr int shape_dim
Our shape dimension.
static constexpr SpaceTags space_config
For the FE space, we only need the gradients on the reference cell.
Trafo::Standard::Mapping< Geometry::ConformalMesh< ShapeType, world_dim, DataType_ > > TrafoType
The transformation this functional works on.
Tiny::Vector< DataType_, Shape::FaceTraits< ShapeType, 0 >::count *world_dim > Tgradh
Type for the gradient of the local cell sizes.
Shape::Hypercube< shape_dim_ > ShapeType
Shape type of the underlying transformation.
TrafoSpace::template Evaluator< TrafoEvaluator >::Type SpaceEvaluator
Type for evaluating the FE functions.
void add_grad_h_part(Tx &grad, const TgradR &mat_tensor, const TrafoEvaluator &trafo_eval, const SpaceEvaluator &space_eval, const Tx &x, const DataType &h, const Tgradh &grad_h)
Adds the gradient h part to the local gradient.
RumpfFunctionalBase< DataType_ > BaseClass
Our baseclass.
static constexpr TrafoTags trafo_config
We need the Trafo to evaluate the image point, the Jacobian and its determinant.
TrafoEvaluator::template ConfigTraits< trafo_config >::EvalDataType TrafoEvalData
Data from evaluating the transformation.
Intern::TrafoFE< TrafoType >::Space TrafoSpace
The FE space associated with the transformation.
String class implementation.
String pad_back(size_type len, char c=' ') const
Pads the back of the string up to a desired length.
Tiny Matrix class template.
Tiny Vector class template.
Standard transformation mapping class template.
String stringify_fp_sci(DataType_ value, int precision=0, int width=0, bool sign=false)
Prints a floating point value to a string in scientific notation.
SpaceTags
Space configuration tags enum.
@ ref_grad
specifies whether the space should supply reference basis function gradients
@ grad
specifies whether the space should supply basis function gradients
std::uint64_t Index
Index data type.
TrafoTags
Trafo configuration tags enum.
@ img_point
specifies whether the trafo should supply image point coordinates
@ 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.