Wildmeshing Toolkit
Loading...
Searching...
No Matches
MeshSimplexComparator.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace wmtk::simplex::utils {
5
7{
8public:
9 using KeyType = std::tuple<const Mesh*, simplex::Simplex>;
10 using KeyType2 = std::tuple<const Mesh*, simplex::Simplex, int64_t>;
11 using KeyType3 = std::tuple<const Mesh*, simplex::NavigatableSimplex>;
12
13 class Less
14 {
15 public:
16 bool operator()(const KeyType& a, const KeyType& b) const
17 {
18 const auto& [a_mesh_ptr, a_simplex] = a;
19 const auto& [b_mesh_ptr, b_simplex] = b;
20
21 if (a_mesh_ptr == b_mesh_ptr) {
22 return SimplexComparisons::less(*a_mesh_ptr, a_simplex, b_simplex);
23 } else {
24 return a_mesh_ptr < b_mesh_ptr;
25 }
26 }
27 bool operator()(const KeyType2& a, const KeyType2& b) const
28 {
29 const auto& [a_mesh_ptr, a_simplex, a_id] = a;
30 const auto& [b_mesh_ptr, b_simplex, b_id] = b;
31
32 if (a_mesh_ptr == b_mesh_ptr) {
33 return a_id == b_id;
34 } else {
35 return a_mesh_ptr < b_mesh_ptr;
36 }
37 }
38 bool operator()(const KeyType3& a, const KeyType3& b) const
39 {
40 const auto& [a_mesh_ptr, a_simplex] = a;
41 const auto& [b_mesh_ptr, b_simplex] = b;
42
43 if (a_mesh_ptr == b_mesh_ptr) {
44 return SimplexComparisons::less(*a_mesh_ptr, a_simplex, b_simplex);
45 } else {
46 return a_mesh_ptr < b_mesh_ptr;
47 }
48 }
49 };
50
51 class Equal
52 {
53 public:
54 bool operator()(const KeyType& a, const KeyType& b) const
55 {
56 const auto& [a_mesh_ptr, a_simplex] = a;
57 const auto& [b_mesh_ptr, b_simplex] = b;
58
59 if (a_mesh_ptr == b_mesh_ptr) {
60 return SimplexComparisons::equal(*a_mesh_ptr, a_simplex, b_simplex);
61 } else {
62 return false;
63 }
64 }
65 bool operator()(const KeyType2& a, const KeyType2& b) const
66 {
67 const auto& [a_mesh_ptr, a_simplex, a_id] = a;
68 const auto& [b_mesh_ptr, b_simplex, b_id] = b;
69
70 if (a_mesh_ptr == b_mesh_ptr) {
71 return a_id == b_id;
72 } else {
73 return false;
74 }
75 }
76 bool operator()(const KeyType3& a, const KeyType3& b) const
77 {
78 const auto& [a_mesh_ptr, a_simplex] = a;
79 const auto& [b_mesh_ptr, b_simplex] = b;
80
81 if (a_mesh_ptr == b_mesh_ptr) {
82 return SimplexComparisons::equal(*a_mesh_ptr, a_simplex, b_simplex);
83 } else {
84 return false;
85 }
86 }
87 };
88};
89} // namespace wmtk::simplex::utils
bool operator()(const KeyType &a, const KeyType &b) const
bool operator()(const KeyType2 &a, const KeyType2 &b) const
bool operator()(const KeyType3 &a, const KeyType3 &b) const
bool operator()(const KeyType2 &a, const KeyType2 &b) const
bool operator()(const KeyType &a, const KeyType &b) const
bool operator()(const KeyType3 &a, const KeyType3 &b) const
std::tuple< const Mesh *, simplex::NavigatableSimplex > KeyType3
std::tuple< const Mesh *, simplex::Simplex > KeyType
std::tuple< const Mesh *, simplex::Simplex, int64_t > KeyType2
static bool equal(const Mesh &m, const Simplex &s0, const Simplex &s1)
static bool less(const Mesh &m, const Simplex &s0, const Simplex &s1)