Wildmeshing Toolkit
Loading...
Searching...
No Matches
tuple_map_attribute_io.hpp
Go to the documentation of this file.
1#include <wmtk/Types.hpp>
3
4// #define WMTK_DISABLE_COMPRESSED_MULTIMESH_TUPLE
6#if defined WMTK_DISABLE_COMPRESSED_MULTIMESH_TUPLE
7constexpr static int64_t TUPLE_SIZE = 4; // in terms of int64_t
8constexpr static int64_t GLOBAL_ID_INDEX = 3;
9#else
10constexpr static int64_t TUPLE_SIZE = 2; // in terms of int64_t
11constexpr static int64_t GLOBAL_ID_INDEX = 0;
12#endif
13constexpr static int64_t DEFAULT_TUPLES_VALUES = -1;
14constexpr static int64_t TWO_TUPLE_SIZE = TUPLE_SIZE * 2; // in terms of int64_t
17
18
20Tuple vector_to_tuple(const Eigen::Ref<const TupleVector>& v);
21
22std::tuple<Tuple, Tuple> vectors_to_tuples(const Eigen::Ref<const TwoTupleVector>& v);
24
25// utility functions to simplify how we encode 2-Tuple attributes as 10-int64_t attribute
26template <typename MeshType>
29 const Tuple& source_tuple,
30 const Tuple& target_tuple);
31
32template <typename MeshType>
33std::tuple<Tuple, Tuple> read_tuple_map_attribute(
35 const Tuple& source_tuple);
36
37
38template <typename MeshA, typename MeshB>
42 const Tuple& a_tuple,
43 const Tuple& b_tuple)
44{
45 write_tuple_map_attribute(a_to_b, a_tuple, b_tuple);
46 write_tuple_map_attribute(b_to_a, b_tuple, a_tuple);
47}
49 Mesh& source_mesh,
51 const Tuple& source_tuple,
52 const Tuple& target_tuple);
53
54
55std::tuple<Tuple, Tuple> read_tuple_map_attribute_slow(
56 const Mesh& source_mesh,
58 const Tuple& source_tuple);
59} // namespace wmtk::multimesh::utils
The Tuple is the basic navigation tool in our mesh data structure.
Definition Tuple.hpp:19
A CachingAccessor that uses tuples for accessing attributes instead of indices.
Definition Accessor.hpp:28
Handle that represents attributes for some mesh.
Vector< int64_t, TUPLE_SIZE > tuple_to_vector(const Tuple &t)
std::tuple< Tuple, Tuple > read_tuple_map_attribute_slow(const Mesh &source_mesh, TypedAttributeHandle< int64_t > map_handle, const Tuple &source_tuple)
std::tuple< Tuple, Tuple > vectors_to_tuples(const Eigen::Ref< const TwoTupleVector > &v)
std::tuple< Tuple, Tuple > read_tuple_map_attribute(const wmtk::attribute::Accessor< int64_t, MeshType > &accessor, const Tuple &source_tuple)
TwoTupleVector tuples_to_vectors(const Tuple &a, const Tuple &b)
void write_tuple_map_attribute(wmtk::attribute::Accessor< int64_t, MeshType > &map_accessor, const Tuple &source_tuple, const Tuple &target_tuple)
void symmetric_write_tuple_map_attributes(wmtk::attribute::Accessor< int64_t, MeshA > &a_to_b, wmtk::attribute::Accessor< int64_t, MeshB > &b_to_a, const Tuple &a_tuple, const Tuple &b_tuple)
void write_tuple_map_attribute_slow(Mesh &source_mesh, TypedAttributeHandle< int64_t > map_handle, const Tuple &source_tuple, const Tuple &target_tuple)
Vector< int64_t, TUPLE_SIZE > TupleVector
Vector< int64_t, TWO_TUPLE_SIZE > TwoTupleVector
Tuple vector_to_tuple(const Eigen::Ref< const TupleVector > &v)
Eigen::Matrix< T, R, 1 > Vector
Definition Types.hpp:17