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