10#include <kernel/lafem/dense_vector.hpp>
11#include <kernel/lafem/dense_vector_blocked.hpp>
12#include <kernel/space/lagrange1/element.hpp>
13#include <kernel/space/lagrange2/element.hpp>
14#include <kernel/util/math.hpp>
37 template<
typename ToSpace_,
typename FromSpace_>
57 template<
typename Trafo_,
int shape_dim_ = Trafo_::MeshType::shape_dim>
84 template<
typename DataType_,
typename ValueType_>
87 const auto& mesh = to_space.
get_trafo().get_mesh();
90 const auto& from_vertex_at_shape_idx = mesh.template get_index_set<shape_dim_, 0>();
93 typename ToSpace::template DofAssignment<shape_dim_, DataType_>::Type to_dof_assignment(to_space);
95 for(
Index k(0); k < mesh.get_num_entities(shape_dim_); ++k)
97 to_dof_assignment.prepare(k);
100 for(
int j(0); j < to_dof_assignment.get_num_assigned_dofs(); ++j)
104 for(
int i(0); i < from_vertex_at_shape_idx.get_num_indices(); ++i)
106 tmp += vfc(from_vertex_at_shape_idx(k,i));
110 tmp *= ( DataType_(1)/DataType_(from_vertex_at_shape_idx.get_num_indices()) );
113 vtc[to_dof_assignment.get_index(j)] = tmp;
129 template<
typename Trafo_>
156 template<
typename DataType_,
typename ValueType_>
159 const auto& mesh = to_space.
get_trafo().get_mesh();
160 for(
Index i(0); i < mesh.get_num_entities(0); ++i)
175 template<
typename Trafo_>
207 template<
typename DataType_,
typename IT_>
240 template<
typename DataType_,
typename IT_,
int blocksize_>
261 template<
typename Trafo_>
293 template<
typename DataType_,
typename IT_>
302 XASSERTM(to_coeffs.
size() < from_coeffs.
size(),
"Coefficient vectors do not match!\n To_coeffs size is ");
304 for(
Index i(0); i < to_coeffs.
size(); ++i)
333 template<
typename DataType_,
typename IT_,
int blocksize_>
342 XASSERTM(to_coeffs.
size() < from_coeffs.
size(),
"Coefficient vectors do not match!\n To_coeffs size is ");
344 for(
Index i(0); i < to_coeffs.
size(); ++i)
361 template<
typename Space_>
364 typedef Space_ ToSpace;
366 typedef Space_ FromSpace;
392 template<
typename Vector_>
394 const Vector_& from_coeffs,
395 const ToSpace& DOXY(to_space),
396 const FromSpace& DOXY(from_space))
398 to_coeffs.copy(from_coeffs,
true);
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Blocked Dense data vector class template.
Index size() const
Returns the size of this vector, i.e. its number of entries.
Dense data vector class template.
Index size() const
Returns the size of this vector, i.e. its number of entries.
TrafoType & get_trafo()
Returns a reference to the trafo.
Standard Lagrange-1 Finite-Element space class template.
Standard Lagrange-2 Finite-Element space class template.
Tiny Vector class template.
std::uint64_t Index
Index data type.
static void interpolate(LAFEM::DenseVectorBlocked< DataType_, IT_, blocksize_ > &to_coeffs, const LAFEM::DenseVectorBlocked< DataType_, IT_, blocksize_ > &from_coeffs, const ToSpace &to_space, const FromSpace &from_space)
Interpolates a vector Lagrange1 to Lagrange2 FE function.
static void interpolate(LAFEM::DenseVector< DataType_, IT_ > &to_coeffs, const LAFEM::DenseVector< DataType_, IT_ > &from_coeffs, const ToSpace &to_space, const FromSpace &from_space)
Interpolates a scalar Lagrange1 to Lagrange2 FE function.
Space::Lagrange2::Element< Trafo_ > FromSpace
We map from Lagrange2.
Space::Lagrange1::Element< Trafo_ > ToSpace
We map to Lagrange1.
Trafo_ TrafoType
Our trafo.
static void interpolate(LAFEM::DenseVector< DataType_, IT_ > &to_coeffs, const LAFEM::DenseVector< DataType_, IT_ > &from_coeffs, const ToSpace &to_space, const FromSpace &from_space)
Interpolates a scalar Lagrange1 to Lagrange2 FE function.
Space::Lagrange2::Element< Trafo_ > ToSpace
We map to Lagrange2.
static void interpolate(LAFEM::DenseVectorBlocked< DataType_, IT_, blocksize_ > &to_coeffs, const LAFEM::DenseVectorBlocked< DataType_, IT_, blocksize_ > &from_coeffs, const ToSpace &to_space, const FromSpace &from_space)
Interpolates a vector valued Lagrange1 to Lagrange2 FE function.
Trafo_ TrafoType
Our trafo.
Space::Lagrange1::Element< Trafo_ > FromSpace
We map from Lagrange1.
static void interpolate(Vector_ &to_coeffs, const Vector_ &from_coeffs, const ToSpace &to_space, const FromSpace &from_space)
Interpolates a scalar/vector FE function on the same space by just copying the vector.
Interpolation operator between two finite element spaces.
static void recurse(Memory::TypedView< ValueType_ > &vtc, const Memory::TypedView< ValueType_ > &vfc, const ToSpace &to_space)
Evaluates the node functionals for shape dimension 0.
Helper class that recurses through shape dimensions and evaluates Lagrange2 DoF based on Lagrange1 Do...
static void recurse(Memory::TypedView< ValueType_ > &vtc, const Memory::TypedView< ValueType_ > &vfc, const ToSpace &to_space)
Evaluates the node functionals from shape_dim_ on down to shape dimension 0.
Space::Lagrange2::Element< Trafo_ > ToSpace
We map to Lagrange2.
Space::Lagrange1::Element< Trafo_ > FromSpace
We map from Lagrange1.