9#include <kernel/assembly/base.hpp> 
   10#include <kernel/lafem/dense_vector.hpp> 
   11#include <kernel/lafem/dense_vector_blocked.hpp> 
   25        int max_dofs_ = Space_::template NodeFunctional<shape_dim_, typename Vector_::DataType>::Type::max_assigned_dofs>
 
   26      struct InterpolatorCore
 
   29        static void project(Vector_& vector, 
const Function_& function, 
const Space_& space)
 
   31          typedef typename Vector_::DataType DataType;
 
   34          typedef typename Space_::template NodeFunctional<shape_dim_, DataType>::Type NodeFunc;
 
   36          typedef typename NodeFunc::template Value<Function_>::Type ValueType;
 
   38          const Index num_entities = space.get_mesh().get_num_entities(shape_dim_);
 
   40          FEAT_PRAGMA_OMP(parallel)
 
   43            NodeFunc node_func(space);
 
   46            Tiny::Vector<ValueType, max_dofs_> node_data;
 
   49            typedef typename Space_::template DofAssignment<shape_dim_, DataType>::Type DofAssignType;
 
   50            DofAssignType dof_assign(space);
 
   53            auto* vals = vector.elements();
 
   58            for(Index i = 0; i < num_entities; ++i)
 
   62              node_func(node_data, function);
 
   66              dof_assign.prepare(i);
 
   69              const int num_dofs = dof_assign.get_num_assigned_dofs();
 
   70              for(
int j(0); j < num_dofs; ++j)
 
   72                vals[dof_assign.get_index(j)] += node_data[j];
 
   82      template<
typename Vector_, 
typename Function_, 
typename Space_, 
int shape_dim_>
 
   83      struct InterpolatorCore<Vector_, Function_, Space_, shape_dim_, 0>
 
   85        static void project(Vector_&, 
const Function_&, 
const Space_&)
 
   91      template<
typename Space_, 
int shape_dim_ = Space_::shape_dim>
 
   92      class InterpolatorWrapper
 
   95        template<
typename Vector_, 
typename Function_>
 
   96        static void project(Vector_& vector, 
const Function_& function, 
const Space_& space)
 
   99          InterpolatorWrapper<Space_, shape_dim_ - 1>::project(vector, function, space);
 
  102          InterpolatorCore<Vector_, Function_, Space_, shape_dim_>::project(vector, function, space);
 
  106      template<
typename Space_>
 
  107      class InterpolatorWrapper<Space_, 0>
 
  110        template<
typename Vector_, 
typename Function_>
 
  111        static void project(Vector_& vector, 
const Function_& function, 
const Space_& space)
 
  114          InterpolatorCore<Vector_, Function_, Space_, 0>::project(vector, function, space);
 
  152        const Function_& function,
 
  155        typedef typename Space_::TrafoType TrafoType;
 
  156        typedef typename Function_::ImageType ImageType;
 
  159        static_assert(Function_::domain_dim == TrafoType::world_dim, 
"invalid function domain dimension");
 
  160        static_assert(ImageType::is_scalar, 
"only scalar functions can be interpolated to scalar vectors");
 
  164        Intern::InterpolatorWrapper<Space_>::project(vector, function, space);
 
  189        const Function_& function,
 
  192        typedef typename Space_::TrafoType TrafoType;
 
  193        typedef typename Function_::ImageType ImageType;
 
  196        static_assert(Function_::domain_dim == TrafoType::world_dim, 
"invalid function domain dimension");
 
  197        static_assert(ImageType::is_vector, 
"only vector fields can be interpolated to blocked vectors");
 
  198        static_assert(ImageType::image_dim == block_size_, 
"invalid vector field size");
 
  202        Intern::InterpolatorWrapper<Space_>::project(vector, function, space);
 
#define XASSERT(expr)
Assertion macro definition.
Interpolator class template.
static void project(LAFEM::DenseVector< DT_, IT_ > &vector, const Function_ &function, const Space_ &space)
Interpolates a scalar function.
static void project(LAFEM::DenseVectorBlocked< DT_, IT_, block_size_ > &vector, const Function_ &function, const Space_ &space)
Interpolates a vector field.
Blocked Dense data vector class template.
Dense data vector class template.
std::uint64_t Index
Index data type.