Wildmeshing Toolkit
TupleInspector.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <cassert>
3 #include <string>
4 #include <wmtk/PrimitiveType.hpp>
5 #include <wmtk/Tuple.hpp>
6 
7 
8 namespace wmtk::utils {
9 // NOTE: this is just for helping with autogen accessing tuple intenrals. DO NOT USE ELSEWHERE
11 {
12 public:
13  static int8_t local_vid(const Tuple& t) { return t.m_local_vid; }
14  static int8_t local_eid(const Tuple& t) { return t.m_local_eid; }
15  static int8_t local_fid(const Tuple& t) { return t.m_local_fid; }
16  static int8_t local_id(const Tuple& t, const PrimitiveType pt)
17  {
18  switch (pt) {
19  case PrimitiveType::Vertex: return local_vid(t);
20  case PrimitiveType::Edge: return local_eid(t);
21  case PrimitiveType::Triangle: return local_fid(t);
23  default: assert(false);
24  }
25  return -1;
26  }
27 
28  static int8_t local_id(const PrimitiveType pt, const Tuple& t)
29  {
30  switch (pt) {
31  case PrimitiveType::Triangle: return local_fid(t);
32  case PrimitiveType::Edge: return local_eid(t);
33  case PrimitiveType::Vertex: return local_vid(t);
34  case PrimitiveType::Tetrahedron: assert(false);
35  default: return -1;
36  }
37  }
38 
39  static int64_t global_cid(const Tuple& t) { return t.m_global_cid; }
40  static std::string as_string(const Tuple& t);
41 };
42 } // namespace wmtk::utils
int8_t m_local_vid
Definition: Tuple.hpp:47
int8_t m_local_eid
Definition: Tuple.hpp:48
int64_t m_global_cid
Definition: Tuple.hpp:46
int8_t m_local_fid
Definition: Tuple.hpp:49
static int8_t local_id(const Tuple &t, const PrimitiveType pt)
static int8_t local_eid(const Tuple &t)
static int64_t global_cid(const Tuple &t)
static std::string as_string(const Tuple &t)
static int8_t local_id(const PrimitiveType pt, const Tuple &t)
static int8_t local_vid(const Tuple &t)
static int8_t local_fid(const Tuple &t)