9#include <kernel/assembly/symbolic_assembler.hpp>
12#include <kernel/lafem/matrix_mirror.hpp>
13#include <kernel/lafem/vector_mirror.hpp>
14#include <kernel/lafem/power_mirror.hpp>
15#include <kernel/lafem/dense_vector.hpp>
16#include <kernel/lafem/sparse_matrix_csr.hpp>
17#include <kernel/lafem/sparse_matrix_banded.hpp>
30 struct DofMirrorHelper
32 static Index count(
const Space_& space,
const MeshPart_& mesh_part)
35 const typename MeshPart_::template TargetSet<shape_dim_>::Type&
36 target_set(mesh_part.template get_target_set<shape_dim_>());
37 if(target_set.get_num_entities() <= 0)
41 typename Space_::template DofAssignment<shape_dim_>::Type dof_assign(space);
42 if(dof_assign.get_max_assigned_dofs() <= 0)
46 Index num_entities = target_set.get_num_entities();
48 for(Index i(0); i < num_entities; ++i)
50 dof_assign.prepare(target_set[i]);
51 count +=
Index(dof_assign.get_num_assigned_dofs());
58 template<
typename IT_>
59 static Index fill(IT_ idx[], Index offset,
const Space_& space,
const MeshPart_& mesh_part)
62 const typename MeshPart_::template TargetSet<shape_dim_>::Type&
63 target_set(mesh_part.template get_target_set<shape_dim_>());
64 if(target_set.get_num_entities() <= 0)
68 typename Space_::template DofAssignment<shape_dim_>::Type dof_assign(space);
69 if(dof_assign.get_max_assigned_dofs() <= 0)
73 Index num_entities = target_set.get_num_entities();
74 for(Index i(0); i < num_entities; ++i)
76 dof_assign.prepare(target_set[i]);
77 int num_assign(dof_assign.get_num_assigned_dofs());
78 for(
int j(0); j < num_assign; ++j, ++offset)
80 idx[offset] = IT_(dof_assign.get_index(j));
92 int shape_dim_ = Space_::shape_dim>
93 struct DofMirrorHelpWrapper
95 static Index count(
const Space_& space,
const MeshPart_& mesh_part)
98 return DofMirrorHelpWrapper<Space_, MeshPart_, shape_dim_ - 1>::count(space, mesh_part) +
99 DofMirrorHelper<Space_, MeshPart_, shape_dim_>::count(space, mesh_part);
102 template<
typename IT_>
103 static Index fill(IT_ idx[],
const Space_& space,
const MeshPart_& mesh_part)
105 Index offset = DofMirrorHelpWrapper<Space_, MeshPart_, shape_dim_ - 1>::fill(idx, space, mesh_part);
106 return DofMirrorHelper<Space_, MeshPart_, shape_dim_>::fill(idx, offset, space, mesh_part);
113 struct DofMirrorHelpWrapper<Space_, MeshPart_, 0>
115 static Index count(
const Space_& space,
const MeshPart_& mesh_part)
117 return DofMirrorHelper<Space_, MeshPart_, 0>::count(space, mesh_part);
120 template<
typename IT_>
121 static Index fill(IT_ idx[],
const Space_& space,
const MeshPart_& mesh_part)
123 return DofMirrorHelper<Space_, MeshPart_, 0>::fill(idx, 0, space, mesh_part);
156 const Space_& space,
const MeshPart_& mesh_part)
159 const Index count = Intern::DofMirrorHelpWrapper<Space_, MeshPart_>::count(space, mesh_part);
167 Intern::DofMirrorHelpWrapper<Space_, MeshPart_>::fill(vec_mirror.
indices(), space, mesh_part);
179 const Space_& space,
const MeshPart_& mesh_part)
Dof-Mirror assembler class template.
static void assemble_mirror(LAFEM::VectorMirror< DataType_, IndexType_ > &vec_mirror, const Space_ &space, const MeshPart_ &mesh_part)
Assembles a VectorMirror from a space and a mesh-part.
PowerVector meta-mirror class template.
Handles vector prolongation, restriction and serialization.
IT_ * indices()
Get a pointer to the non zero indices array.
std::uint64_t Index
Index data type.