10#include <kernel/space/node_functional_base.hpp> 
   11#include <kernel/cubature/dynamic_factory.hpp> 
   48        static constexpr int max_assigned_dofs = 1;
 
   50        template<
typename Function_>
 
   57        typedef typename Space_::TrafoType TrafoType;
 
   58        typedef typename Space_::ShapeType ShapeType;
 
   59        typedef typename Shape::FaceTraits<ShapeType, ShapeType::dimension-1>::ShapeType FacetType;
 
   61        typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
 
   62        typedef typename TrafoEvalTraits::DataType 
DataType;
 
   63        typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
 
   65        static constexpr int image_dim = TrafoEvalTraits::image_dim;
 
   68        typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point | TrafoTags::jac_det>::EvalDataType TrafoEvalData;
 
   72        TrafoEvalType _trafo_eval;
 
   78          _trafo_eval(space.get_trafo()),
 
   79          _cub_rule(Cubature::ctor_factory, Cubature::DynamicFactory(
"gauss-legendre:2"))
 
   86          _trafo_eval.prepare(cell_index);
 
   97          return max_assigned_dofs;
 
  100        template<
typename NodeData_, 
typename Function_>
 
  101        void operator()(NodeData_& node_data, 
const Function_& function)
 const 
  103          static_assert(std::is_base_of<Analytic::Function, Function_>::value, 
"invalid function object");
 
  106          typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
 
  109          typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
 
  111          typename FuncEvalTraits::ValueType 
value(DataType_(0));
 
  112          DataType_ mean(DataType_(0));
 
  113          TrafoEvalData trafo_data;
 
  116          for(
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  118            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  119            value += (_cub_rule.get_weight(i) * trafo_data.jac_det) * func_eval.value(trafo_data.img_point);
 
  120            mean += _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  124          node_data[0] = (DataType_(1) / mean) * 
value;
 
  141        static constexpr int max_assigned_dofs = 1;
 
  143        template<
typename Function_>
 
  150        typedef typename Space_::TrafoType TrafoType;
 
  151        typedef typename Space_::ShapeType ShapeType;
 
  153        typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
 
  154        typedef typename TrafoEvalTraits::DataType 
DataType;
 
  155        typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
 
  156        typedef typename TrafoEvalTraits::ImagePointType ImagePointType;
 
  157        typedef typename TrafoEvalTraits::JacobianInverseType JacobianInverseType;
 
  159        static constexpr int image_dim = TrafoEvalTraits::image_dim;
 
  161        typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point | TrafoTags::jac_det>::EvalDataType TrafoEvalData;
 
  162        typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point | TrafoTags::jac_inv>::EvalDataType InvLinTrafoData;
 
  166        TrafoEvalType _trafo_eval;
 
  169        JacobianInverseType _inv_lin_mat;
 
  170        ImagePointType _inv_lin_vec;
 
  175          _trafo_eval(space.get_trafo()),
 
  176          _cub_rule(Cubature::ctor_factory, Cubature::DynamicFactory(
"gauss-legendre:2"))
 
  183          _trafo_eval.prepare(cell_index);
 
  186          InvLinTrafoData trafo_data;
 
  188          _inv_lin_mat = trafo_data.jac_inv;
 
  189          _inv_lin_vec = trafo_data.img_point;
 
  194          _trafo_eval.finish();
 
  200          return max_assigned_dofs;
 
  203        template<
typename NodeData_, 
typename Function_>
 
  204        void operator()(NodeData_& node_data, 
const Function_& function)
 const 
  206          static_assert(std::is_base_of<Analytic::Function, Function_>::value, 
"invalid function object");
 
  209          typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
 
  212          typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
 
  214          typename FuncEvalTraits::ValueType 
value(DataType_(0));
 
  215          DataType_ mean(DataType_(0));
 
  216          TrafoEvalData trafo_data;
 
  220          for(
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  222            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  223            dom_point.set_mat_vec_mult(_inv_lin_mat, trafo_data.img_point - _inv_lin_vec);
 
  224            value += (_cub_rule.get_weight(i) * trafo_data.jac_det) * func_eval.value(trafo_data.img_point) * 
dom_point[0] * 
dom_point[1];
 
  225            mean += _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  229          node_data[0] = (DataType_(1) / mean) * 
value;
 
  246        static constexpr int max_assigned_dofs = 3;
 
  248        template<
typename Function_>
 
  255        typedef typename Space_::TrafoType TrafoType;
 
  256        typedef typename Space_::ShapeType ShapeType;
 
  258        typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
 
  259        typedef typename TrafoEvalTraits::DataType 
DataType;
 
  260        typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
 
  261        typedef typename TrafoEvalTraits::ImagePointType ImagePointType;
 
  262        typedef typename TrafoEvalTraits::JacobianInverseType JacobianInverseType;
 
  264        static constexpr int image_dim = TrafoEvalTraits::image_dim;
 
  266        typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point | TrafoTags::jac_det>::EvalDataType TrafoEvalData;
 
  267        typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point | TrafoTags::jac_inv>::EvalDataType InvLinTrafoData;
 
  271        TrafoEvalType _trafo_eval;
 
  274        JacobianInverseType _inv_lin_mat;
 
  275        ImagePointType _inv_lin_vec;
 
  280          _trafo_eval(space.get_trafo()),
 
  281          _cub_rule(Cubature::ctor_factory, Cubature::DynamicFactory(
"gauss-legendre:2"))
 
  288          _trafo_eval.prepare(cell_index);
 
  291          InvLinTrafoData trafo_data;
 
  293          _inv_lin_mat = trafo_data.jac_inv;
 
  294          _inv_lin_vec = trafo_data.img_point;
 
  299          _trafo_eval.finish();
 
  305          return max_assigned_dofs;
 
  308        template<
typename NodeData_, 
typename Function_>
 
  309        void operator()(NodeData_& node_data, 
const Function_& function)
 const 
  311          static_assert(std::is_base_of<Analytic::Function, Function_>::value, 
"invalid function object");
 
  314          typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
 
  317          typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
 
  319          Tiny::Vector<typename FuncEvalTraits::ValueType, 3> vals;
 
  321          DataType_ mean(DataType_(0));
 
  322          TrafoEvalData trafo_data;
 
  326          for(
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  328            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  329            dom_point.set_mat_vec_mult(_inv_lin_mat, trafo_data.img_point - _inv_lin_vec);
 
  330            typename FuncEvalTraits::ValueType fv = (_cub_rule.get_weight(i) * trafo_data.jac_det) * func_eval.value(trafo_data.img_point);
 
  334            mean += _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  338          node_data[0] = (DataType_(1) / mean) * vals[0];
 
  339          node_data[1] = (DataType_(1) / mean) * vals[1];
 
  340          node_data[2] = (DataType_(1) / mean) * vals[2];
 
Cubature Rule class template.
Node-functional base class template.
void finish()
Releases the node-functional from the current cell.
DataType_ DataType
data type
void prepare(Index cell_index)
Prepares the node-functional for a given cell.
Null-Node-Functional class template.
int get_num_assigned_dofs() const
Returns the number of assigned dofs on the current cell.
NodeFunctionalBase< Space_, DataType_ > BaseClass
base-class typedef
void operator()(NodeData_ &node_data, const Function_ &function) const
Evaluation operator.
Q1TBNP Element Evaluator class template declaration.
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.
@ dom_point
specifies whether the trafo should supply domain point coordinates
Face traits tag struct template.