Wildmeshing Toolkit
Marching.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <wmtk/Mesh.hpp>
4 
5 namespace wmtk::components {
6 
10 class Marching
11 {
12 public:
20  Marching(
22  std::map<PrimitiveType, attribute::MeshAttributeHandle>& label_handles,
23  const std::vector<int64_t>& input_values,
24  const int64_t output_value);
25 
31  void process();
32 
41  void add_filter(const attribute::MeshAttributeHandle& label, const int64_t value);
42 
46  void add_pass_through(const attribute::MeshAttributeHandle& pass_through);
47 
51  void add_pass_through(const std::vector<attribute::MeshAttributeHandle>& pass_through);
52 
64  void add_isovalue(const attribute::MeshAttributeHandle& scalar_field, const double isovalue);
65 
72  void set_isovalue_linesearch_iterations(const int64_t linesearch_iterations);
73 
77  void invert_filter();
78 
79 private:
81 
84  std::optional<attribute::MeshAttributeHandle> m_edge_tag_handle;
85  std::optional<attribute::MeshAttributeHandle> m_face_tag_handle;
86  std::vector<int64_t> m_input_values;
87  int64_t m_output_value;
88 
89  std::vector<attribute::MeshAttributeHandle> m_filter_labels;
90  std::vector<int64_t> m_filter_values;
91 
92  std::vector<attribute::MeshAttributeHandle> m_pass_through_attributes;
93 
94  std::optional<attribute::MeshAttributeHandle> m_scalar_field;
95  double m_isovalue = std::numeric_limits<double>::lowest();
96 
98 
99  bool m_invert_filter = false;
100 };
101 
102 } // namespace wmtk::components
This component implements a marching triangle/tetrahedra.
Definition: Marching.hpp:11
std::vector< attribute::MeshAttributeHandle > m_pass_through_attributes
Definition: Marching.hpp:92
void add_filter(const attribute::MeshAttributeHandle &label, const int64_t value)
Add an edge filter to marching.
Definition: Marching.cpp:361
std::vector< int64_t > m_input_values
Definition: Marching.hpp:86
Marching(attribute::MeshAttributeHandle &pos_handle, std::map< PrimitiveType, attribute::MeshAttributeHandle > &label_handles, const std::vector< int64_t > &input_values, const int64_t output_value)
Initialize the marching method.
Definition: Marching.cpp:37
std::optional< attribute::MeshAttributeHandle > m_face_tag_handle
Definition: Marching.hpp:85
std::vector< attribute::MeshAttributeHandle > m_filter_labels
Definition: Marching.hpp:89
attribute::MeshAttributeHandle m_vertex_tag_handle
Definition: Marching.hpp:83
void set_isovalue_linesearch_iterations(const int64_t linesearch_iterations)
Set the number of iterations for the linesearch when trying to match the isovalue.
Definition: Marching.cpp:389
attribute::MeshAttributeHandle m_pos_handle
Definition: Marching.hpp:82
void invert_filter()
Invert the filter such that everything covered by the filter is ignored.
Definition: Marching.cpp:394
void add_isovalue(const attribute::MeshAttributeHandle &scalar_field, const double isovalue)
Position the new vertices along an edge according to an isovalue in a scalar field.
Definition: Marching.cpp:381
void process()
Perform the actual marching.
Definition: Marching.cpp:60
void add_pass_through(const attribute::MeshAttributeHandle &pass_through)
Add pass through attributes.
Definition: Marching.cpp:368
std::optional< attribute::MeshAttributeHandle > m_edge_tag_handle
Definition: Marching.hpp:84
std::optional< attribute::MeshAttributeHandle > m_scalar_field
Definition: Marching.hpp:94
std::vector< int64_t > m_filter_values
Definition: Marching.hpp:90