Wildmeshing Toolkit
transport_tuple.cpp
Go to the documentation of this file.
1 #include "transport_tuple.hpp"
2 #include <spdlog/spdlog.h>
7 #include "local_switch_tuple.hpp"
8 
9 namespace wmtk::multimesh::utils {
10 
11 namespace internal {
13  const Tuple& base_source,
14  const Tuple& base_target,
15  PrimitiveType base_primitive_type,
16  const Tuple& source,
17  PrimitiveType primitive_type)
18 {
19  std::vector<PrimitiveType> operations =
20  find_local_switch_sequence(base_source, base_target, base_primitive_type);
21 
22  return local_switch_tuples(primitive_type, source, operations);
23 }
25  const Tuple& base_source,
26  const Tuple& base_target,
27  PrimitiveType base_primitive_type,
28  const Tuple& source,
29  PrimitiveType primitive_type)
30 {
31  wmtk::autogen::SimplexDart base_sd(base_primitive_type);
32  wmtk::autogen::SimplexDart sd(primitive_type);
33  return transport_tuple(base_sd, sd, base_source, base_target, source);
34 }
35 } // namespace internal
37  const Tuple& base_source,
38  const Tuple& base_target,
39  PrimitiveType base_primitive_type,
40  const Tuple& source,
41  PrimitiveType primitive_type)
42 {
44  base_source,
45  base_target,
46  base_primitive_type,
47  source,
48  primitive_type);
49 
50 
51  /*
52  auto seq = internal::transport_tuple_sequence(
53  base_source,
54  base_target,
55  base_primitive_type,
56  source,
57  primitive_type);
58  assert( dart == seq);
59  */
60  return dart;
61 }
62 
64  const wmtk::autogen::SimplexDart& base_sd,
66  const Tuple& base_source,
67  const Tuple& base_target,
68  const Tuple& source)
69 {
70  const int8_t base_action = find_local_dart_action(base_sd, base_source, base_target);
71  const int8_t action = base_sd.convert(base_action, sd);
72 
73 
74  int8_t src_dart = sd.valid_index_from_tuple(source);
75  const int8_t tgt_dart = sd.product(action, src_dart);
76  return sd.update_tuple_from_valid_index(source, tgt_dart);
77 }
78 } // namespace wmtk::multimesh::utils
int8_t valid_index_from_tuple(const wmtk::Tuple &t) const
wmtk::Tuple update_tuple_from_valid_index(const Tuple &t, int8_t valid_index) const
int8_t product(int8_t a, int8_t b) const
Definition: SimplexDart.cpp:93
int8_t convert(int8_t valid_index, const SimplexDart &target) const
Tuple transport_tuple_dart(const Tuple &base_source, const Tuple &base_target, PrimitiveType base_primitive_type, const Tuple &source, PrimitiveType primitive_type)
Tuple transport_tuple_sequence(const Tuple &base_source, const Tuple &base_target, PrimitiveType base_primitive_type, const Tuple &source, PrimitiveType primitive_type)
int8_t find_local_dart_action(PrimitiveType pt, const Tuple &source, const Tuple &target)
std::vector< PrimitiveType > find_local_switch_sequence(const Tuple &source, const Tuple &target, PrimitiveType primitive_type)
Tuple transport_tuple(const Tuple &base_source, const Tuple &base_target, PrimitiveType base_primitive_type, const Tuple &source, PrimitiveType primitive_type)
Tuple local_switch_tuples(PrimitiveType mesh_primitive_type, const Tuple &tuple, const std::initializer_list< PrimitiveType > &op_sequence)