Wildmeshing Toolkit
SimplexDart.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <wmtk/PrimitiveType.hpp>
3 #include <wmtk/Tuple.hpp>
4 #include <wmtk/Types.hpp>
5 
6 #include "Dart.hpp"
7 namespace wmtk::autogen {
8 // TODO: valid_index here currently stands for the range [0,N] rfather than the set of discontiguous
9 // valid indices stored in each mesh. This nomenclature needs to be cleaned up.
11 {
12 public:
14 
15  // to avoid potential construction costs we have some singletons available
17 
18  // takes two valid indices and returns their dart-product as a valid index
19  int8_t product(int8_t a, int8_t b) const;
20  int8_t inverse(int8_t a) const;
21 
22  // returns the action equivalent to switching by a particular primitive
23  int8_t primitive_as_index(wmtk::PrimitiveType pt) const;
24 
25  // returns the two-sided identity action - product(identity(),x) = x
26  int8_t identity() const;
27  // returns the dart O such that for each simplex I[i] in the identity I,
28  // O[i] = S - I[i], where S is the facet simplex
29  int8_t opposite() const;
30 
31  Dart act(const Dart& d, int8_t action) const;
32 
33  wmtk::Tuple tuple_from_valid_index(int64_t gid, int8_t valid_index) const;
34  wmtk::Tuple update_tuple_from_valid_index(const Tuple& t, int8_t valid_index) const;
35 
36  wmtk::Tuple tuple_from_dart(const Dart& dart) const;
37  Dart dart_from_tuple(const wmtk::Tuple& t) const;
38 
39  int8_t valid_index_from_tuple(const wmtk::Tuple& t) const;
40 
41 
42  int8_t simplex_index(const int8_t valid_index, PrimitiveType simplex_type) const;
43  int8_t simplex_index(const Dart& dart, PrimitiveType simplex_type) const;
44 
45  using binary_op_type = int8_t (*)(int8_t, int8_t);
46  using unary_op_type = int8_t (*)(int8_t);
48  using nullary_op_type = int8_t (*)();
49 
50  size_t size() const;
52 
53 
54  // converts input valid_indx to the target mesh
55  int8_t convert(int8_t valid_index, const SimplexDart& target) const;
56 
57 
59 
60 private:
67 };
68 } // namespace wmtk::autogen
const nullary_op_type m_identity
Definition: SimplexDart.hpp:65
wmtk::Tuple tuple_from_dart(const Dart &dart) const
int8_t simplex_index(const int8_t valid_index, PrimitiveType simplex_type) const
int8_t valid_index_from_tuple(const wmtk::Tuple &t) const
const wmtk::PrimitiveType m_simplex_type
Definition: SimplexDart.hpp:61
static const SimplexDart & get_singleton(wmtk::PrimitiveType simplex_type)
Definition: SimplexDart.cpp:83
VectorX< int8_t >::ConstMapType valid_indices() const
const unary_op_type m_inverse
Definition: SimplexDart.hpp:63
SimplexDart(wmtk::PrimitiveType simplex_type)
Definition: SimplexDart.cpp:75
wmtk::Tuple update_tuple_from_valid_index(const Tuple &t, int8_t valid_index) const
wmtk::PrimitiveType simplex_type() const
Definition: SimplexDart.hpp:58
const primitive_to_index_type m_primitive_to_index
Definition: SimplexDart.hpp:64
const binary_op_type m_product
Definition: SimplexDart.hpp:62
int8_t primitive_as_index(wmtk::PrimitiveType pt) const
int8_t inverse(int8_t a) const
Definition: SimplexDart.cpp:97
int8_t product(int8_t a, int8_t b) const
Definition: SimplexDart.cpp:93
int8_t(*)(PrimitiveType) primitive_to_index_type
Definition: SimplexDart.hpp:47
const nullary_op_type m_opposite
Definition: SimplexDart.hpp:66
int8_t(*)(int8_t) unary_op_type
Definition: SimplexDart.hpp:46
Dart act(const Dart &d, int8_t action) const
Dart dart_from_tuple(const wmtk::Tuple &t) const
int8_t convert(int8_t valid_index, const SimplexDart &target) const
wmtk::Tuple tuple_from_valid_index(int64_t gid, int8_t valid_index) const
int8_t(*)(int8_t, int8_t) binary_op_type
Definition: SimplexDart.hpp:45
Vector< T, Eigen::Dynamic > VectorX
Definition: Types.hpp:19