Wildmeshing Toolkit
EdgeCollapse.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Operation.hpp"
5 
6 namespace wmtk::operations {
7 class EdgeCollapse : public Operation
8 {
9 public:
10  // constructor for default factory pattern construction
11  EdgeCollapse(Mesh& m);
12 
13  PrimitiveType primitive_type() const override { return PrimitiveType::Edge; }
14 
15 
16  std::shared_ptr<const operations::BaseCollapseNewAttributeStrategy> get_new_attribute_strategy(
17  const attribute::MeshAttributeHandle& attribute) const;
18 
20  const attribute::MeshAttributeHandle& attribute,
21  const std::shared_ptr<const operations::BaseCollapseNewAttributeStrategy>& other);
22 
24 
26  const attribute::MeshAttributeHandle& attribute,
29 
30  std::vector<simplex::Simplex> execute(const simplex::Simplex& simplex) override;
31  std::vector<simplex::Simplex> unmodified_primitives(
32  const simplex::Simplex& simplex) const override;
33 
34  // for free meshes after is a no-op because the simplex is just gone
35  bool after(
36  const std::vector<simplex::Simplex>& unmods,
37  const std::vector<simplex::Simplex>& mods) const final override;
38 
39  // checks through attribute new for throws, prints to the logger if so
40  bool attribute_new_all_configured() const;
41 
42 private:
43  std::vector<std::shared_ptr<const operations::BaseCollapseNewAttributeStrategy>>
45 };
46 
47 } // namespace wmtk::operations
std::vector< simplex::Simplex > unmodified_primitives(const simplex::Simplex &simplex) const override
Returns all simplices that will be potentially affected by the operation.
PrimitiveType primitive_type() const override
std::shared_ptr< const operations::BaseCollapseNewAttributeStrategy > get_new_attribute_strategy(const attribute::MeshAttributeHandle &attribute) const
std::vector< simplex::Simplex > execute(const simplex::Simplex &simplex) override
returns an empty vector in case of failure
bool after(const std::vector< simplex::Simplex > &unmods, const std::vector< simplex::Simplex > &mods) const final override
bool attribute_new_all_configured() const
void set_new_attribute_strategy(const attribute::MeshAttributeHandle &attribute, const std::shared_ptr< const operations::BaseCollapseNewAttributeStrategy > &other)
std::vector< std::shared_ptr< const operations::BaseCollapseNewAttributeStrategy > > m_new_attr_strategies