9#include <kernel/assembly/base.hpp>
10#include <kernel/analytic/function.hpp>
11#include <kernel/cubature/dynamic_factory.hpp>
12#include <kernel/trafo/base.hpp>
40 template<
typename VectorOut_,
typename Function_,
typename Trafo_>
41 static void project(VectorOut_& vector,
const Function_& function,
const Trafo_& trafo)
44 typedef Trafo_ TrafoType;
45 typedef typename TrafoType::MeshType MeshType;
48 typedef typename VectorOut_::DataType DataType;
51 const MeshType& mesh(trafo.get_mesh());
54 typedef typename MeshType::VertexSetType VertexSetType;
55 const VertexSetType& vtx(mesh.get_vertex_set());
58 const Index num_verts(mesh.get_num_entities(0));
61 vector = VectorOut_(num_verts, DataType(0));
67 typename Function_::template Evaluator<EvalTraits> func_eval(function);
70 for(
Index i(0); i < num_verts; ++i)
73 vector(i, func_eval.value(vtx[i]));
114 const Function_& function,
118 project(vector, function, trafo, cubature_factory);
140 typename CubatureFactory_>
143 const Function_& function,
145 const CubatureFactory_& cubature_factory)
148 typedef Trafo_ TrafoType;
149 typedef typename TrafoType::MeshType MeshType;
150 typedef typename MeshType::ShapeType ShapeType;
153 static constexpr int shape_dim = ShapeType::dimension;
156 typedef typename VectorOut_::DataType DataType;
160 cubature_rule(Cubature::ctor_factory, cubature_factory);
163 const MeshType& mesh(trafo.get_mesh());
166 const Index num_cells(mesh.get_num_entities(shape_dim));
169 vector = VectorOut_(num_cells, DataType(0));
172 typedef typename TrafoType::template Evaluator<ShapeType, DataType>::Type TrafoEvaluator;
173 typedef typename TrafoEvaluator::template ConfigTraits<trafo_config> TrafoConfigTraits;
174 typename TrafoConfigTraits::EvalDataType trafo_data;
177 TrafoEvaluator trafo_eval(trafo);
181 typedef typename FuncEvalTraits::ValueType ValueType;
184 typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
187 for(
Index cell(0); cell < num_cells; ++cell)
190 trafo_eval.prepare(cell);
192 ValueType
value(DataType(0));
193 DataType area(DataType(0));
196 for(
int k(0); k < cubature_rule.get_num_points(); ++k)
199 trafo_eval(trafo_data, cubature_rule.get_point(k));
202 ValueType val = func_eval.value(trafo_data.img_point);
205 DataType weight(trafo_data.jac_det * cubature_rule.get_weight(k));
211 value += weight * val;
217 vector(cell, (DataType(1) / area) *
value);
Analytic cell projector class.
static void project(VectorOut_ &vector, const Function_ &function, const Trafo_ &trafo, const CubatureFactory_ &cubature_factory)
Projects an analytic function into the cells.
static void project(VectorOut_ &vector, const Function_ &function, const Trafo_ &trafo)
Projects an analytic function into the cells using the barycentre cubature rule.
Analytic vertex projector class.
static void project(VectorOut_ &vector, const Function_ &function, const Trafo_ &trafo)
Projects an analytic function into the vertices.
Cubature Rule class template.
@ 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
@ jac_det
specifies whether the trafo should supply jacobian determinants