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>
13#include <kernel/util/memory_arbiter.hpp>
41 template<
typename VectorOut_,
typename Function_,
typename Trafo_>
42 static void project(VectorOut_& vector,
const Function_& function,
const Trafo_& trafo)
45 typedef Trafo_ TrafoType;
46 typedef typename TrafoType::MeshType MeshType;
49 typedef typename VectorOut_::DataType DataType;
50 typedef typename VectorOut_::ValueType ValueType;
53 const MeshType& mesh(trafo.get_mesh());
56 typedef typename MeshType::VertexSetType VertexSetType;
57 const VertexSetType& vtx(mesh.get_vertex_set());
60 const Index num_verts(mesh.get_num_entities(0));
63 vector = VectorOut_(num_verts, DataType(0));
69 typename Function_::template Evaluator<EvalTraits> func_eval(function);
75 for(
Index i(0); i < num_verts; ++i)
78 vec_view[i] = func_eval.value(vtx[i]);
119 const Function_& function,
123 project(vector, function, trafo, cubature_factory);
145 typename CubatureFactory_>
148 const Function_& function,
150 const CubatureFactory_& cubature_factory)
153 typedef Trafo_ TrafoType;
154 typedef typename TrafoType::MeshType MeshType;
155 typedef typename MeshType::ShapeType ShapeType;
158 static constexpr int shape_dim = ShapeType::dimension;
161 typedef typename VectorOut_::DataType DataType;
165 cubature_rule(Cubature::ctor_factory, cubature_factory);
168 const MeshType& mesh(trafo.get_mesh());
171 const Index num_cells(mesh.get_num_entities(shape_dim));
174 vector = VectorOut_(num_cells, DataType(0));
177 typedef typename TrafoType::template Evaluator<ShapeType, DataType>::Type TrafoEvaluator;
178 typedef typename TrafoEvaluator::template ConfigTraits<trafo_config> TrafoConfigTraits;
179 typename TrafoConfigTraits::EvalDataType trafo_data;
182 TrafoEvaluator trafo_eval(trafo);
186 typedef typename FuncEvalTraits::ValueType ValueType;
189 typename Function_::template Evaluator<FuncEvalTraits> func_eval(function);
195 for(
Index cell(0); cell < num_cells; ++cell)
198 trafo_eval.prepare(cell);
200 ValueType
value(DataType(0));
201 DataType area(DataType(0));
204 for(
int k(0); k < cubature_rule.get_num_points(); ++k)
207 trafo_eval(trafo_data, cubature_rule.get_point(k));
210 ValueType val = func_eval.value(trafo_data.img_point);
213 DataType weight(trafo_data.jac_det * cubature_rule.get_weight(k));
219 value += weight * val;
225 vec_view[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