36 #define GET_OP(NAME, RETTYPE) \
37 auto get_##NAME(PrimitiveType pt)->SimplexDart::RETTYPE \
40 case PrimitiveType::Edge: return &edge_mesh::SimplexDart::NAME; \
41 case PrimitiveType::Triangle: return &tri_mesh::SimplexDart::NAME; \
42 case PrimitiveType::Tetrahedron: return &tet_mesh::SimplexDart::NAME; \
43 case PrimitiveType::Vertex: return &point_mesh::SimplexDart::NAME; \
44 default: assert(false); \
48 GET_OP(product, binary_op_type)
49 GET_OP(inverse, unary_op_type)
50 GET_OP(primitive_to_index, primitive_to_index_type)
51 GET_OP(identity, nullary_op_type)
52 GET_OP(opposite, nullary_op_type)
55 #define FORWARD_OP(NAME, OP, RETTYPE, DEFAULT) \
56 auto SimplexDart::NAME() const -> RETTYPE \
58 switch (m_simplex_type) { \
59 case PrimitiveType::Edge: return edge_mesh::SimplexDart::OP(); \
60 case PrimitiveType::Triangle: return tri_mesh::SimplexDart::OP(); \
61 case PrimitiveType::Tetrahedron: return tet_mesh::SimplexDart::OP(); \
62 case PrimitiveType::Vertex: return point_mesh::SimplexDart::OP(); \
63 default: assert(false); \
76 : m_simplex_type(simplex_type)
77 , m_product(get_product(simplex_type))
78 , m_inverse(get_inverse(simplex_type))
79 , m_primitive_to_index(get_primitive_to_index(simplex_type))
80 , m_identity(get_identity(simplex_type))
81 , m_opposite(get_opposite(simplex_type))
85 const static std::array<SimplexDart, 4> singletons = {
#define GET_OP(NAME, RETTYPE)
#define FORWARD_OP(NAME, OP, RETTYPE, DEFAULT)
int8_t & local_orientation()
const nullary_op_type m_identity
wmtk::Tuple tuple_from_dart(const Dart &dart) const
int8_t simplex_index(const int8_t valid_index, PrimitiveType simplex_type) const
int8_t valid_index_from_tuple(const wmtk::Tuple &t) const
const wmtk::PrimitiveType m_simplex_type
static const SimplexDart & get_singleton(wmtk::PrimitiveType simplex_type)
const unary_op_type m_inverse
SimplexDart(wmtk::PrimitiveType simplex_type)
wmtk::Tuple update_tuple_from_valid_index(const Tuple &t, int8_t valid_index) const
wmtk::PrimitiveType simplex_type() const
const primitive_to_index_type m_primitive_to_index
const binary_op_type m_product
int8_t primitive_as_index(wmtk::PrimitiveType pt) const
int8_t inverse(int8_t a) const
int8_t product(int8_t a, int8_t b) const
const nullary_op_type m_opposite
Dart act(const Dart &d, int8_t action) const
Dart dart_from_tuple(const wmtk::Tuple &t) const
int8_t convert(int8_t valid_index, const SimplexDart &target) const
wmtk::Tuple tuple_from_valid_index(int64_t gid, int8_t valid_index) const
static int64_t global_cid(const Tuple &t)
int8_t convert(PrimitiveType from, PrimitiveType to, int8_t source)
int8_t simplex_index_from_valid_index(PrimitiveType mesh_type, int8_t valid_tuple_index, PrimitiveType simplex_type)
int8_t valid_index_from_tuple(PrimitiveType mesh_type, const Tuple &t)
Tuple tuple_from_valid_index(PrimitiveType mesh_type, const int64_t global_cid, int8_t valid_tuple_index)
VectorX< int8_t >::ConstMapType DynamicIntMap
constexpr int8_t get_primitive_type_id(PrimitiveType t)
Get a unique integer id corresponding to each primitive type.
Vector< T, Eigen::Dynamic > VectorX