9#include <kernel/geometry/conformal_mesh.hpp>
10#include <kernel/geometry/mesh_part.hpp>
11#include <kernel/geometry/intern/macro_index_mapping.hpp>
18 template<
typename Mesh_>
27 public Factory<ConformalMesh<Shape_, num_coords_, Coord_> >
33 typedef typename MeshType::VertexSetType VertexSetType;
35 typedef typename MeshType::IndexSetHolderType IndexSetHolderType;
38 const MeshType& _base_mesh;
39 const Index _cell_idx;
43 _base_mesh(base_mesh),
46 XASSERTM(cell_idx < base_mesh.get_num_entities(Shape_::dimension),
"cell index out-of-bounds");
49 virtual Index get_num_entities(
int dim)
override
51 return Index(Intern::DynamicNumFaces<Shape_>::value(dim));
54 virtual void fill_vertex_set(VertexSetType& vertex_set)
override
57 typedef typename MeshType::template IndexSet<Shape_::dimension, 0>::Type IndexSetType;
58 const IndexSetType& idx(_base_mesh.template get_index_set<Shape_::dimension, 0>());
61 const VertexSetType& vertex_set_in(_base_mesh.get_vertex_set());
64 for(
Index i(0); i <
Index(IndexSetType::num_indices); ++i)
66 vertex_set[i] = vertex_set_in[idx(_cell_idx, i)];
70 virtual void fill_index_sets(IndexSetHolderType& index_set_holder)
override
72 Intern::MacroIndexWrapper<Shape_>::build(index_set_holder);
76 template<
typename BaseMesh_>
77 class MacroFactory<MeshPart<BaseMesh_> > :
78 public Factory<MeshPart<BaseMesh_> >
82 typedef MeshPart<BaseMesh_> MeshType;
83 typedef typename MeshType::ShapeType ShapeType;
85 typedef typename MeshType::TargetSetHolderType TargetSetHolderType;
86 typedef typename MeshType::IndexSetHolderType IndexSetHolderType;
87 typedef typename MeshType::AttributeSetContainer AttributeSetContainer;
90 const BaseMesh_& _base_mesh;
91 const Index _cell_idx;
94 explicit MacroFactory(
const BaseMesh_& base_mesh,
Index cell_idx) :
95 _base_mesh(base_mesh),
98 XASSERTM(cell_idx < base_mesh.get_num_entities(ShapeType::dimension),
"cell index out-of-bounds");
101 virtual Index get_num_entities(
int dim)
override
103 return Index(Intern::DynamicNumFaces<ShapeType>::value(dim));
106 virtual void fill_attribute_sets(AttributeSetContainer&)
override
111 virtual void fill_index_sets(std::unique_ptr<IndexSetHolderType>&)
override
116 virtual void fill_target_sets(TargetSetHolderType& target_set_holder)
override
119 target_set_holder.template get_target_set<ShapeType::dimension>()[0] = _cell_idx;
121 Intern::MacroTargetWrapper<ShapeType>::build(target_set_holder, _base_mesh.get_index_set_holder(), _cell_idx);
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Mesh Factory class template.
std::uint64_t Index
Index data type.