10#include <kernel/space/node_functional_base.hpp> 
   11#include <kernel/cubature/dynamic_factory.hpp> 
   12#include <kernel/space/bernstein2/scalar_basis.hpp> 
   13#include <kernel/util/tiny_algebra.hpp> 
   44        static constexpr int max_assigned_dofs = 1;
 
   46        template<
typename Function_>
 
   53        typedef typename Space_::TrafoType TrafoType;
 
   55        typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
 
   56        typedef typename TrafoEvalTraits::DataType 
DataType;
 
   57        typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
 
   60        typedef typename TrafoEvalType::template ConfigTraits<TrafoTags::img_point>::EvalDataType TrafoEvalData;
 
   62        TrafoEvalType _trafo_eval;
 
   67          _trafo_eval(space.get_trafo())
 
   74          _trafo_eval.prepare(cell_index);
 
   85          return max_assigned_dofs;
 
   88        template<
typename NodeData_, 
typename Function_>
 
   89        void operator()(NodeData_& node_data, 
const Function_& function)
 const 
   91          static_assert(std::is_base_of<Analytic::Function, Function_>::value, 
"invalid function object");
 
   92          static_assert(Function_::can_value, 
"function cannot compute values");
 
   95          typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
 
   98          typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
 
  102          TrafoEvalData trafo_data;
 
  106          node_data[0] = func_eval.value(trafo_data.img_point);
 
  118        static constexpr int max_assigned_dofs = 1;
 
  121        template<
typename Function_>
 
  128        typedef typename Space_::TrafoType TrafoType;
 
  131        typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
 
  132        typedef typename TrafoEvalTraits::DataType 
DataType;
 
  133        typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
 
  135        static constexpr int image_dim = TrafoEvalTraits::image_dim;
 
  143        typedef typename TrafoEvalType::template ConfigTraits<trafo_tags>::EvalDataType TrafoEvalData;
 
  147        TrafoEvalType _trafo_eval;
 
  153          _trafo_eval(space.get_trafo()),
 
  154          _cub_rule(Cubature::ctor_factory, Cubature::DynamicFactory(
"gauss-legendre:3"))
 
  165          _trafo_eval.prepare(cell_index);
 
  168          TrafoEvalData trafo_data;
 
  174          for (
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  177            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  183            for (
int j = 0; j < 3; ++j)
 
  185              temp(j, 0) = Intern::p(j, trafo_data.dom_point[0]);
 
  186              temp(j, 1) = Intern::q(j, trafo_data.dom_point[0]);
 
  189            DataType_ mult = _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  191            for (
int px = 0; px < 3; ++px)
 
  193              for (
int qx = 0; qx < 3; ++qx)
 
  196                  (mult * temp(px, 0) * temp(qx, 1));
 
  203          temp.set_inverse(coef);
 
  209          _trafo_eval.finish();
 
  215          return max_assigned_dofs;
 
  218        template<
typename NodeData_, 
typename Function_>
 
  219        void operator()(NodeData_& node_data, 
const Function_& function)
 const 
  221          static_assert(std::is_base_of<Analytic::Function, Function_>::value, 
"invalid function object");
 
  222          static_assert(Function_::can_value, 
"function cannot compute values");
 
  225          typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
 
  228          typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
 
  231          typename FuncEvalTraits::ValueType 
value(DataType_(0));
 
  232          DataType_ mean(DataType_(0));
 
  233          TrafoEvalData trafo_data;
 
  236          for (
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  238            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  239            value += (_cub_rule.get_weight(i) * trafo_data.jac_det) * func_eval.value(trafo_data.img_point)
 
  240              *Intern::base_q(trafo_data.dom_point[0], coef[2]);
 
  241            mean += _cub_rule.get_weight(i) *trafo_data.jac_det;
 
  245          node_data[0] = (DataType_(2) / mean)* 
value;
 
  257        static constexpr int max_assigned_dofs = 1;
 
  259        template<
typename Function_>
 
  266        typedef typename Space_::TrafoType TrafoType;
 
  269        typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
 
  270        typedef typename TrafoEvalTraits::DataType 
DataType;
 
  271        typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
 
  273        static constexpr int image_dim = TrafoEvalTraits::image_dim;
 
  283        typedef typename TrafoEvalType::template ConfigTraits<trafo_tags>::EvalDataType TrafoEvalData;
 
  287        TrafoEvalType _trafo_eval;
 
  293          _trafo_eval(space.get_trafo()),
 
  294          _cub_rule(Cubature::ctor_factory, Cubature::DynamicFactory(
"gauss-legendre:3"))
 
  305          _trafo_eval.prepare(cell_index);
 
  308          TrafoEvalData trafo_data;
 
  312          for (
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  315            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  322            for (
int j = 0; j < 3; ++j)
 
  324              temp(j, 0) = Intern::p(j, trafo_data.dom_point[0]);
 
  325              temp(j, 1) = Intern::p(j, trafo_data.dom_point[1]);
 
  326              temp(j, 2) = Intern::q(j, trafo_data.dom_point[0]);
 
  327              temp(j, 3) = Intern::q(j, trafo_data.dom_point[1]);
 
  330            DataType_ mult = _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  332            for (
int px = 0; px < 3; ++px)
 
  334              for (
int py = 0; py < 3; ++py)
 
  336                for (
int qx = 0; qx < 3; ++qx)
 
  338                  for (
int qy = 0; qy < 3; ++qy)
 
  340                    coef(px * 3 + py, qx * 3 + qy) +=
 
  341                      (mult * temp(px, 0) * temp(py, 1) * temp(qx, 2) * temp(qy, 3));
 
  350          temp.set_inverse(coef);
 
  356          _trafo_eval.finish();
 
  362          return max_assigned_dofs;
 
  365        template<
typename NodeData_, 
typename Function_>
 
  366        void operator()(NodeData_& node_data, 
const Function_& function)
 const 
  368          static_assert(std::is_base_of<Analytic::Function, Function_>::value, 
"invalid function object");
 
  369          static_assert(Function_::can_value, 
"function cannot compute values");
 
  372          typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
 
  375          typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
 
  378          typename FuncEvalTraits::ValueType 
value(DataType_(0));
 
  379          DataType_ mean(DataType_(0));
 
  380          TrafoEvalData trafo_data;
 
  384          for (
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  386            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  387            value += (_cub_rule.get_weight(i) * trafo_data.jac_det) * func_eval.value(trafo_data.img_point)
 
  388              * Intern::base_q(trafo_data.dom_point[0], trafo_data.dom_point[1], coef[8]);
 
  389            mean += _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  393          node_data[0] = (DataType_(4) / mean) * 
value;
 
  405        static constexpr int max_assigned_dofs = 1;
 
  407        template<
typename Function_>
 
  414        typedef typename Space_::TrafoType TrafoType;
 
  417        typedef typename TrafoEvalType::EvalTraits TrafoEvalTraits;
 
  418        typedef typename TrafoEvalTraits::DataType 
DataType;
 
  419        typedef typename TrafoEvalTraits::DomainPointType DomainPointType;
 
  421        static constexpr int image_dim = TrafoEvalTraits::image_dim;
 
  431        typedef typename TrafoEvalType::template ConfigTraits<trafo_tags>::EvalDataType TrafoEvalData;
 
  435        TrafoEvalType _trafo_eval;
 
  441          _trafo_eval(space.get_trafo()),
 
  442          _cub_rule(Cubature::ctor_factory, Cubature::DynamicFactory(
"gauss-legendre:3"))
 
  453          _trafo_eval.prepare(cell_index);
 
  456          TrafoEvalData trafo_data;
 
  460          for (
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  463            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  470            for (
int j = 0; j < 3; ++j)
 
  472              temp(j, 0) = Intern::p(j, trafo_data.dom_point[0]);
 
  473              temp(j, 1) = Intern::p(j, trafo_data.dom_point[1]);
 
  474              temp(j, 2) = Intern::p(j, trafo_data.dom_point[2]);
 
  475              temp(j, 3) = Intern::q(j, trafo_data.dom_point[0]);
 
  476              temp(j, 4) = Intern::q(j, trafo_data.dom_point[1]);
 
  477              temp(j, 5) = Intern::q(j, trafo_data.dom_point[2]);
 
  480            DataType_ mult = _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  482            for (
int pz = 0; pz < 3; ++pz)
 
  484              for (
int px = 0; px < 3; ++px)
 
  486                for (
int py = 0; py < 3; ++py)
 
  488                  for (
int qz = 0; qz < 3; ++qz)
 
  490                    for (
int qx = 0; qx < 3; ++qx)
 
  492                      for (
int qy = 0; qy < 3; ++qy)
 
  494                        coef(9*pz+px * 3 + py, 9*qz+qx * 3 + qy) +=
 
  495                          (mult * temp(px, 0) * temp(py, 1)*temp(pz,2) * temp(qx, 3) * temp(qy, 4)*temp(qz,5));
 
  506          temp.set_inverse(coef);
 
  512          _trafo_eval.finish();
 
  518          return max_assigned_dofs;
 
  521        template<
typename NodeData_, 
typename Function_>
 
  522        void operator()(NodeData_& node_data, 
const Function_& function)
 const 
  524          static_assert(std::is_base_of<Analytic::Function, Function_>::value, 
"invalid function object");
 
  525          static_assert(Function_::can_value, 
"function cannot compute values");
 
  528          typedef Analytic::EvalTraits<DataType_, Function_> FuncEvalTraits;
 
  531          typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
 
  534          typename FuncEvalTraits::ValueType 
value(DataType_(0));
 
  535          DataType_ mean(DataType_(0));
 
  536          TrafoEvalData trafo_data;
 
  540          for (
int i(0); i < _cub_rule.get_num_points(); ++i)
 
  542            _trafo_eval(trafo_data, _cub_rule.get_point(i));
 
  543            value += (_cub_rule.get_weight(i) * trafo_data.jac_det) * func_eval.value(trafo_data.img_point)
 
  544              * Intern::base_q(trafo_data.dom_point[0], trafo_data.dom_point[1], trafo_data.dom_point[2], coef[26]);
 
  545            mean += _cub_rule.get_weight(i) * trafo_data.jac_det;
 
  549          node_data[0] = (DataType_(8) / mean) * 
value;
 
Cubature Rule class template.
Bernstein-2 Element Evaluator class template declaration.
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.
Tiny Matrix class template.
CUDA_HOST_DEVICE Matrix & set_transpose(const Matrix< T_, n_, m_, sma_, sna_ > &a)
Sets this matrix to the transpose of another matrix.
CUDA_HOST_DEVICE void format(DataType alpha=DataType(0))
Formats the matrix.
@ value
specifies whether the space should supply basis function values
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
@ jac_det
specifies whether the trafo should supply jacobian determinants
Hypercube shape tag struct template.