Wildmeshing Toolkit
SplitNewAttributeStrategy.hpp
Go to the documentation of this file.
1 #pragma once
4 #include "Enums.hpp"
7 
8 
9 namespace wmtk::operations {
10 
11 
12 // This is necessary because subclass is templated
14 {
15 public:
18 
19 
20  virtual void update(Mesh& m, const ReturnData& ret_data, const OperationInOutData& op_data)
21  const = 0;
22 };
23 
24 template <typename T>
26 {
27 public:
31  using ReturnVariant = ReturnData::ReturnVariant;
32 
33  // given two ear $k$-simplices, define a value for the single new $k$-simplex between them
35  std::function<VecType(const VecType&, const VecType&, const std::bitset<2>&)>;
36 
37  // given a k-simplex that was split in two, provide new values for thw two simplices created
38  // from it first one is the one that "shares" a vertex with the op's "input tuple
39  using SplitFuncType =
40  std::function<std::array<VecType, 2>(const VecType&, const std::bitset<2>&)>;
41 
42 
44 
45  void update(Mesh& m, const ReturnData& ret_data, const OperationInOutData& op_data)
46  const final override;
47 
49  void set_strategy(SplitFuncType&& f);
50 
53 
54 
55  Mesh& mesh() override;
57  PrimitiveType primitive_type() const override;
58  void update_handle_mesh(Mesh& m) override;
59  bool matches_attribute(const attribute::MeshAttributeHandle&) const override;
60 
61  std::vector<wmtk::attribute::MeshAttributeHandle> targets() const final override
62  {
63  return {m_handle};
64  }
65 
66  bool invalid_state() const final override;
67  std::string name() const final override;
68 
69 private:
70  wmtk::attribute::MeshAttributeHandle m_handle;
73  bool m_will_throw = false;
74  bool m_will_throw_rib = false;
76 
77  void assign_split(
78  wmtk::attribute::Accessor<T>& accessor,
79  const Tuple& input_simplex,
80  const std::array<Tuple, 2>& split_simplices) const;
81 
82  void assign_split_ribs(
83  wmtk::attribute::Accessor<T>& accessor,
84  const std::array<Tuple, 2>& input_ears,
85  const Tuple& final_simplex) const;
86 
88  SplitBasicStrategy optype,
89  const std::string_view& = {});
91  SplitRibBasicStrategy optype,
92  const std::string_view& = {});
93 };
94 
95 
96 } // namespace wmtk::operations
virtual void update(Mesh &m, const ReturnData &ret_data, const OperationInOutData &op_data) const =0
wmtk::multimesh::operations::SplitReturnData ReturnData
wmtk::multimesh::operations::OperationInOutData OperationInOutData
wmtk::attribute::MeshAttributeHandle m_handle
void update(Mesh &m, const ReturnData &ret_data, const OperationInOutData &op_data) const final override
std::vector< wmtk::attribute::MeshAttributeHandle > targets() const final override
std::function< VecType(const VecType &, const VecType &, const std::bitset< 2 > &)> SplitRibFuncType
std::unique_ptr< SplitNewAttributeTopoInfo > m_topo_info
void assign_split_ribs(wmtk::attribute::Accessor< T > &accessor, const std::array< Tuple, 2 > &input_ears, const Tuple &final_simplex) const
static SplitFuncType standard_split_strategy(SplitBasicStrategy optype, const std::string_view &={})
SplitNewAttributeStrategy(const wmtk::attribute::MeshAttributeHandle &h)
void assign_split(wmtk::attribute::Accessor< T > &accessor, const Tuple &input_simplex, const std::array< Tuple, 2 > &split_simplices) const
bool matches_attribute(const attribute::MeshAttributeHandle &) const override
static SplitRibFuncType standard_split_rib_strategy(SplitRibBasicStrategy optype, const std::string_view &={})
std::function< std::array< VecType, 2 >(const VecType &, const std::bitset< 2 > &)> SplitFuncType
Definition: autodiff.h:995
wmtk::utils::metaprogramming::ReferenceWrappedFunctorReturnCacheCustomComparator< wmtk::operations::utils::MultiMeshEdgeSplitFunctor, wmtk::utils::metaprogramming::MeshVariantTraits, wmtk::simplex::utils::MeshSimplexComparator, simplex::NavigatableSimplex > SplitReturnData
std::map< const Mesh *, std::vector< std::tuple< simplex::NavigatableSimplex, wmtk::Tuple > >> OperationInOutData
Definition: Accessor.hpp:6
Vector< T, Eigen::Dynamic > VectorX
Definition: Types.hpp:19