Wildmeshing Toolkit
Loading...
Searching...
No Matches
Tuple.hxx
Go to the documentation of this file.
1#include "Tuple.hpp"
2
3#include <cassert>
4
5namespace wmtk {
6
7// v2
8// / \ .
9// e1 / \ e0
10// v0 - - - v1
11// e2
12
13inline Tuple::Tuple(int8_t local_vid, int8_t local_eid, int8_t local_fid, int64_t global_cid)
14 : m_global_cid(global_cid)
15 , m_local_vid(local_vid)
16 , m_local_eid(local_eid)
17 , m_local_fid(local_fid)
18{}
19
20inline bool Tuple::operator!=(const wmtk::Tuple& t) const
21{
22 return !(*this == t);
23}
24inline bool Tuple::operator==(const wmtk::Tuple& t) const
25{
26 return std::tie(m_local_vid, m_local_eid, m_local_fid, m_global_cid) ==
28}
29
30inline bool Tuple::operator<(const wmtk::Tuple& t) const
31{
34}
35inline bool Tuple::same_ids(const wmtk::Tuple& t) const
36{
37 return std::tie(m_local_vid, m_local_eid, m_local_fid, m_global_cid) ==
39}
40
41inline bool Tuple::is_null() const
42{
43 return m_global_cid == -1;
44}
45
46
47inline int64_t Tuple::global_cid() const
48{
49 return m_global_cid;
50}
51
52inline int8_t Tuple::local_vid() const
53{
54 return m_local_vid;
55}
56
57inline int8_t Tuple::local_eid() const
58{
59 return m_local_eid;
60}
61
62inline int8_t Tuple::local_fid() const
63{
64 return m_local_fid;
65}
66
67inline int8_t Tuple::local_id(const PrimitiveType pt) const
68{
69 switch (pt) {
70 case PrimitiveType::Vertex: return local_vid();
71 case PrimitiveType::Edge: return local_eid();
74 default: assert(false);
75 }
76 return -1;
77}
78
79} // namespace wmtk
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
bool is_null() const
Checks if a tuple is "null". This merely implies the global index is -1.
Definition Tuple.hxx:41
bool operator==(const Tuple &t) const
Definition Tuple.hxx:24
int8_t m_local_vid
Definition Tuple.hpp:24
bool same_ids(const Tuple &t) const
Checks whether two tuples are equal, but ignores the hash.
Definition Tuple.hxx:35
int8_t local_vid() const
Definition Tuple.hxx:52
bool operator<(const Tuple &t) const
Definition Tuple.hxx:30
int8_t m_local_eid
Definition Tuple.hpp:25
int64_t m_global_cid
Definition Tuple.hpp:23
int8_t m_local_fid
Definition Tuple.hpp:26
int8_t local_fid() const
Definition Tuple.hxx:62
bool operator!=(const Tuple &t) const
Definition Tuple.hxx:20
int8_t local_eid() const
Definition Tuple.hxx:57
int8_t local_id(const PrimitiveType pt) const
Definition Tuple.hxx:67
Tuple()=default
int64_t global_cid() const
Definition Tuple.hxx:47