9#include <kernel/geometry/vertex_set.hpp>
10#include <kernel/geometry/intern/standard_refinement_traits.hpp>
22 struct StandardVertexRefiner;
29 template<
typename VertexSet_>
30 struct StandardVertexRefiner<Shape::Vertex, VertexSet_>
32 typedef VertexSet_ VertexSetType;
36 VertexSetType& vertex_set_out,
37 const VertexSetType& vertex_set_in)
40 const Index num_verts = vertex_set_in.get_num_vertices();
41 XASSERT(vertex_set_out.get_num_vertices() >= offset+num_verts);
44 FEAT_PRAGMA_OMP(parallel
for)
45 for(Index i = 0; i < num_verts; ++i)
48 vertex_set_out[offset + i] = vertex_set_in[i];
64 struct StandardVertexRefiner<Shape::Hypercube<cell_dim_>, VertexSet_>
66 typedef Shape::Hypercube<cell_dim_> ShapeType;
67 typedef IndexSet<Shape::FaceTraits<ShapeType, 0>::count> IndexSetType;
68 typedef VertexSet_ VertexSetType;
72 VertexSetType& vertex_set_out,
73 const VertexSetType& vertex_set_in,
74 const IndexSetType& index_set_in)
76 typedef typename IndexSetType::IndexTupleType IndexTupleType;
77 typedef typename VertexSetType::VertexType VertexType;
78 typedef typename VertexSetType::CoordType CoordType;
81 static const CoordType scale = CoordType(1) / CoordType(IndexSetType::num_indices);
84 Index num_cells = index_set_in.get_num_entities();
85 XASSERT(vertex_set_out.get_num_vertices() >= offset+num_cells);
88 FEAT_PRAGMA_OMP(parallel
for)
89 for(Index i = 0; i < num_cells; ++i)
92 const IndexTupleType& idx_in = index_set_in[i];
95 VertexType& vtx_out = vertex_set_out[offset + i];
101 for(
int k(0); k < IndexSetType::num_indices; ++k)
103 vtx_out.axpy(scale, vertex_set_in[idx_in[k]]);
120 struct StandardVertexRefiner<Shape::Simplex<cell_dim_>, VertexSet_>
122 typedef Shape::Simplex<cell_dim_> ShapeType;
123 typedef IndexSet<Shape::FaceTraits<ShapeType, 0>::count> IndexSetType;
124 typedef VertexSet_ VertexSetType;
128 VertexSetType& vertex_set_out,
129 const VertexSetType& vertex_set_in,
130 const IndexSetType& index_set_in)
132 typedef typename IndexSetType::IndexTupleType IndexTupleType;
133 typedef typename VertexSetType::VertexType VertexType;
134 typedef typename VertexSetType::CoordType CoordType;
137 static const CoordType scale = CoordType(1) / CoordType(IndexSetType::num_indices);
140 Index num_cells = index_set_in.get_num_entities();
141 XASSERT(vertex_set_out.get_num_vertices() >= offset+num_cells);
144 FEAT_PRAGMA_OMP(parallel
for)
145 for(Index i = 0; i < num_cells; ++i)
148 const IndexTupleType& idx_in = index_set_in[i];
151 VertexType& vtx_out = vertex_set_out[offset + i];
157 for(
int k(0); k < IndexSetType::num_indices; ++k)
159 vtx_out.axpy(scale, vertex_set_in[idx_in[k]]);
175 struct StandardVertexRefiner<Shape::Simplex<2>, VertexSet_>
177 typedef Shape::Simplex<2> ShapeType;
178 typedef IndexSet<Shape::FaceTraits<ShapeType, 0>::count> IndexSetType;
179 typedef VertexSet_ VertexSetType;
184 const VertexSetType& ,
185 const IndexSetType& )
200 struct StandardVertexRefineWrapper
202 typedef VertexSet_ VertexSetType;
203 typedef IndexSetHolder<Shape_> IndexSetHolderType;
204 typedef IndexSet<Shape::FaceTraits<Shape_, 0>::count> IndexSetType;
207 VertexSetType& vertex_set_out,
208 const VertexSetType& vertex_set_in,
209 const IndexSetHolderType& index_set_holder_in)
211 typedef typename Shape::FaceTraits<Shape_, Shape_::dimension-1>::ShapeType FacetType;
214 Index offset = StandardVertexRefineWrapper<FacetType, VertexSet_>
215 ::refine(vertex_set_out, vertex_set_in, index_set_holder_in);
218 const IndexSetType& index_set_in = index_set_holder_in.
219 template get_index_set_wrapper<Shape_::dimension>().template get_index_set<0>();
222 Index num_verts = StandardVertexRefiner<Shape_, VertexSet_>
223 ::refine(offset, vertex_set_out, vertex_set_in, index_set_in);
226 XASSERTM(num_verts == (StandardRefinementTraits<Shape_, 0>::count * index_set_in.get_num_entities()),
227 "VertexRefiner output does not match StdRefTraits prediction");
230 return offset + num_verts;
234 template<
typename VertexSet_>
235 struct StandardVertexRefineWrapper<Shape::Vertex, VertexSet_>
237 typedef VertexSet_ VertexSetType;
238 typedef IndexSetHolder<Shape::Vertex> IndexSetHolderType;
241 VertexSetType& vertex_set_out,
242 const VertexSetType& vertex_set_in,
243 const IndexSetHolderType& )
246 Index num_verts = StandardVertexRefiner<Shape::Vertex,VertexSet_>
247 ::refine(0, vertex_set_out, vertex_set_in);
250 XASSERTM(num_verts == (StandardRefinementTraits<Shape::Vertex, 0>::count * vertex_set_in.get_num_vertices()),
251 "VertexRefiner output does not match StdRefTraits prediction");
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
std::uint64_t Index
Index data type.