Wildmeshing Toolkit
Primitive.cpp
Go to the documentation of this file.
2 #include "Cell.hpp"
3 #include "Primitive.hpp"
4 #include <tuple>
5 
6 
7 namespace wmtk {
8 
9 Primitive::Primitive(const PrimitiveType& primitive_type, const Tuple& t)
10  : m_primitive_type{primitive_type}
11  , m_tuple{t}
12 {}
14  : m_primitive_type{simplex.primitive_type()}
15  , m_tuple{simplex.tuple()}
16 {}
18  : m_primitive_type{get_primitive_type_from_id(cell.dimension())}
19  , m_tuple{cell.tuple()}
20 {}
21 
23 {
24  return m_primitive_type;
25 }
26 const Tuple& Primitive::tuple() const
27 {
28  return m_tuple;
29 }
30 
32 {
34 }
36 {
37  return Primitive(PrimitiveType::Edge, t);
38 }
40 {
42 }
44 {
46 }
47 
48 bool Primitive::operator==(const Primitive& o) const
49 {
51 }
52 
53 bool Primitive::operator<(const Primitive& o) const
54 {
55  return std::tie(m_primitive_type, m_tuple) < std::tie(o.m_primitive_type, o.m_tuple);
56 }
57 } // namespace wmtk
bool operator<(const Primitive &o) const
Definition: Primitive.cpp:53
PrimitiveType m_primitive_type
Definition: Primitive.hpp:14
Primitive(const PrimitiveType &primitive_type, const Tuple &t)
Definition: Primitive.cpp:9
static Primitive edge(const Tuple &t)
Definition: Primitive.cpp:35
static Primitive face(const Tuple &t)
Definition: Primitive.cpp:39
bool operator==(const Primitive &o) const
Definition: Primitive.cpp:48
static Primitive vertex(const Tuple &t)
Definition: Primitive.cpp:31
const Tuple & tuple() const
Definition: Primitive.cpp:26
static Primitive tetrahedron(const Tuple &t)
Definition: Primitive.cpp:43
PrimitiveType primitive_type() const
Definition: Primitive.cpp:22
Definition: Accessor.hpp:6
constexpr PrimitiveType get_primitive_type_from_id(int8_t id)
Get the primitive type corresponding to its unique integer id.