Wildmeshing Toolkit
Loading...
Searching...
No Matches
Tuple.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <iostream>
6#include <string>
7#include <tuple>
9
10namespace wmtk {
11
18class Tuple
19{
20private:
21 // if Tuple is in 2d mesh m_global_cid is the global triangle id, and local_fid is -1
22 // if Tuple is in 3d mesh m_global_cid is the global tetrahedron id
23 int64_t m_global_cid = -1;
24 int8_t m_local_vid = -1;
25 int8_t m_local_eid = -1;
26 int8_t m_local_fid = -1;
27#ifdef _WIN32
28 std::array<int8_t, 5> m_pad = {{0, 0, 0, 0, 0}}; // align Tuple with 2*int64_t
29#endif
30
31public:
32 Tuple(int8_t local_vid, int8_t local_eid, int8_t local_fid, int64_t global_cid);
33
34 // v2
35 // / \.
36 // e1 / \ e0
37 // v0 - - - v1
38 // e2
39
40 Tuple() = default;
41 Tuple(const Tuple& other) = default;
42 Tuple(Tuple&& other) = default;
43 Tuple& operator=(const Tuple& other) = default;
44 Tuple& operator=(Tuple&& other) = default;
45
46 bool operator==(const Tuple& t) const;
47 bool operator!=(const Tuple& t) const;
48 bool operator<(const Tuple& t) const;
50 bool same_ids(const Tuple& t) const;
51
53 bool is_null() const;
54
55 int64_t global_cid() const;
56 int8_t local_vid() const;
57 int8_t local_eid() const;
58 int8_t local_fid() const;
59
60 int8_t local_id(const PrimitiveType pt) const;
61
62 std::string as_string() const;
63 explicit operator std::string() const;
64
65 friend std::ostream& operator<<(std::ostream& os, const Tuple& t);
66};
67
68std::ostream& operator<<(std::ostream& os, const Tuple& t);
69
70} // namespace wmtk
71#include "Tuple.hxx"
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
std::string as_string() const
Definition Tuple.cpp:7
Tuple(const Tuple &other)=default
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
Tuple & operator=(const Tuple &other)=default
bool operator<(const Tuple &t) const
Definition Tuple.hxx:30
int8_t m_local_eid
Definition Tuple.hpp:25
friend std::ostream & operator<<(std::ostream &os, const Tuple &t)
Definition Tuple.cpp:22
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 & operator=(Tuple &&other)=default
Tuple(Tuple &&other)=default
Tuple()=default
int64_t global_cid() const
Definition Tuple.hxx:47
std::ostream & operator<<(std::ostream &os, const Tuple &t)
Definition Tuple.cpp:22