Wildmeshing Toolkit
CollapseNewAttributeStrategy.hpp
Go to the documentation of this file.
1 #pragma once
5 #include "Enums.hpp"
7 
8 namespace wmtk::operations {
9 
10 // This is necessary because subclass is templated
12 {
13 public:
16 
17 
18  virtual void update(Mesh& m, const ReturnData& ret_data, const OperationInOutData& tuples)
19  const = 0;
20 };
21 
22 template <typename T>
24 {
25 public:
28  using ReturnVariant = ReturnData::ReturnVariant;
29 
31 
32  // given two k-simplices that were merged into one, provide new values for that new simplex.
33  // first argument is the one that "shares" a vertex with the op's "input tuple
35  std::function<VecType(const VecType&, const VecType&, const std::bitset<2>&)>;
36 
38 
39  void update(Mesh& m, const ReturnData& ret_data, const OperationInOutData& tuples)
40  const override;
41 
42 
45 
46  Mesh& mesh() override;
48  PrimitiveType primitive_type() const override;
49  void update_handle_mesh(Mesh& m) override;
50  bool matches_attribute(const attribute::MeshAttributeHandle&) const override;
51 
52  std::vector<wmtk::attribute::MeshAttributeHandle> targets() const final override
53  {
54  return {m_handle};
55  }
56 
57  bool invalid_state() const final override;
58  std::string name() const final override;
59 
60 private:
61  wmtk::attribute::MeshAttributeHandle m_handle;
63  bool m_will_throw = false;
65 
66  void assign_collapsed(
67  wmtk::attribute::Accessor<T>& acc,
68  const std::array<Tuple, 2>& input_simplices,
69  const Tuple& final_simplex) const;
70 
72 };
73 } // namespace wmtk::operations
wmtk::multimesh::operations::OperationInOutData OperationInOutData
virtual void update(Mesh &m, const ReturnData &ret_data, const OperationInOutData &tuples) const =0
wmtk::multimesh::operations::CollapseReturnData ReturnData
CollapseNewAttributeStrategy(const wmtk::attribute::MeshAttributeHandle &h)
std::vector< wmtk::attribute::MeshAttributeHandle > targets() const final override
void update(Mesh &m, const ReturnData &ret_data, const OperationInOutData &tuples) const override
bool matches_attribute(const attribute::MeshAttributeHandle &) const override
std::unique_ptr< CollapseNewAttributeTopoInfo > m_topo_info
static CollapseFuncType standard_collapse_strategy(CollapseBasicStrategy optype)
std::function< VecType(const VecType &, const VecType &, const std::bitset< 2 > &)> CollapseFuncType
void assign_collapsed(wmtk::attribute::Accessor< T > &acc, const std::array< Tuple, 2 > &input_simplices, const Tuple &final_simplex) const
Definition: autodiff.h:995
std::map< const Mesh *, std::vector< std::tuple< simplex::NavigatableSimplex, wmtk::Tuple > >> OperationInOutData
wmtk::utils::metaprogramming::ReferenceWrappedFunctorReturnCacheCustomComparator< wmtk::operations::utils::MultiMeshEdgeCollapseFunctor, wmtk::utils::metaprogramming::MeshVariantTraits, wmtk::simplex::utils::MeshSimplexComparator, simplex::NavigatableSimplex > CollapseReturnData
Definition: Accessor.hpp:6
Vector< T, Eigen::Dynamic > VectorX
Definition: Types.hpp:19