Wildmeshing Toolkit
|
This component implements a marching triangle/tetrahedra. More...
#include <Marching.hpp>
Public Member Functions | |
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. More... | |
void | process () |
Perform the actual marching. More... | |
void | add_filter (const attribute::MeshAttributeHandle &label, const int64_t value) |
Add an edge filter to marching. More... | |
void | add_pass_through (const attribute::MeshAttributeHandle &pass_through) |
Add pass through attributes. More... | |
void | add_pass_through (const std::vector< attribute::MeshAttributeHandle > &pass_through) |
Add pass through attributes. More... | |
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. More... | |
void | set_isovalue_linesearch_iterations (const int64_t linesearch_iterations) |
Set the number of iterations for the linesearch when trying to match the isovalue. More... | |
void | invert_filter () |
Invert the filter such that everything covered by the filter is ignored. More... | |
Private Attributes | |
Mesh & | m_mesh |
attribute::MeshAttributeHandle | m_pos_handle |
attribute::MeshAttributeHandle | m_vertex_tag_handle |
std::optional< attribute::MeshAttributeHandle > | m_edge_tag_handle |
std::optional< attribute::MeshAttributeHandle > | m_face_tag_handle |
std::vector< int64_t > | m_input_values |
int64_t | m_output_value |
std::vector< attribute::MeshAttributeHandle > | m_filter_labels |
std::vector< int64_t > | m_filter_values |
std::vector< attribute::MeshAttributeHandle > | m_pass_through_attributes |
std::optional< attribute::MeshAttributeHandle > | m_scalar_field |
double | m_isovalue = std::numeric_limits<double>::lowest() |
int64_t | m_linesearch_iterations = 10 |
bool | m_invert_filter = false |
This component implements a marching triangle/tetrahedra.
The method solely relies on edge splits.
Definition at line 10 of file Marching.hpp.
wmtk::components::Marching::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.
pos_handle | The position attribute handle. |
label_handles | A map from PrimitiveType to the according label attribute. An attribute must be given for at least the vertices. |
Definition at line 37 of file Marching.cpp.
References wmtk::Edge, m_edge_tag_handle, m_face_tag_handle, m_vertex_tag_handle, wmtk::Triangle, and wmtk::Vertex.
void wmtk::components::Marching::add_filter | ( | const attribute::MeshAttributeHandle & | label, |
const int64_t | value | ||
) |
Add an edge filter to marching.
Only edges that contain all filters may be split. If no filter exists, all edges are considered for splitting.
This filter criterium can be inverted.
Definition at line 361 of file Marching.cpp.
References wmtk::Edge, m_filter_labels, m_filter_values, and wmtk::attribute::MeshAttributeHandle::primitive_type().
Referenced by wmtk::components::marching().
void wmtk::components::Marching::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.
Marching will try to match the isovalue for each new vertex. However, flipped triangles or vertices are prohibited. A binary search is applied to find a good position if the isovalue cannot be interpolated directly. If the binary search fails, the midpoint of the edge is chosen as position.
scalar_field | Vertex attribute of type double. |
isovalue | The isovalue which is interpolated for the new vertices. |
Definition at line 381 of file Marching.cpp.
References m_isovalue, and m_scalar_field.
void wmtk::components::Marching::add_pass_through | ( | const attribute::MeshAttributeHandle & | pass_through | ) |
Add pass through attributes.
Definition at line 368 of file Marching.cpp.
References m_pass_through_attributes.
Referenced by wmtk::components::marching().
void wmtk::components::Marching::add_pass_through | ( | const std::vector< attribute::MeshAttributeHandle > & | pass_through | ) |
Add pass through attributes.
Definition at line 373 of file Marching.cpp.
References m_pass_through_attributes.
void wmtk::components::Marching::invert_filter | ( | ) |
Invert the filter such that everything covered by the filter is ignored.
Definition at line 394 of file Marching.cpp.
References m_invert_filter.
void wmtk::components::Marching::process | ( | ) |
Perform the actual marching.
This method registers new attributes that are not automatically cleaned up!
Definition at line 60 of file Marching.cpp.
References wmtk::operations::Operation::add_invariant(), wmtk::operations::Operation::add_transfer_strategy(), wmtk::attribute::MeshAttributeHandle::as(), wmtk::simplex::cofaces_single_dimension_tuples(), wmtk::attribute::Accessor< T, MeshType, Dim >::const_scalar_attribute(), wmtk::Mesh::create_accessor(), wmtk::Mesh::create_const_accessor(), wmtk::Edge, wmtk::Mesh::get_all(), wmtk::Mesh::is_valid(), wmtk::log_and_throw_error(), wmtk::logger(), m_edge_tag_handle, m_face_tag_handle, m_filter_labels, m_filter_values, m_input_values, m_invert_filter, m_isovalue, m_linesearch_iterations, m_mesh, m_output_value, m_pass_through_attributes, m_pos_handle, m_scalar_field, m_vertex_tag_handle, wmtk::Mesh::register_attribute_typed(), wmtk::Scheduler::run_operation_on_all(), wmtk::attribute::Accessor< T, MeshType, Dim >::scalar_attribute(), wmtk::operations::EdgeSplit::set_new_attribute_strategy(), wmtk::Mesh::switch_tuple(), wmtk::simplex::top_dimension_cofaces_tuples(), and wmtk::Vertex.
Referenced by wmtk::components::marching().
void wmtk::components::Marching::set_isovalue_linesearch_iterations | ( | const int64_t | linesearch_iterations | ) |
Set the number of iterations for the linesearch when trying to match the isovalue.
This only has an effect if an isovalue was added. The default for linesearch is 10.
Definition at line 389 of file Marching.cpp.
References m_linesearch_iterations.
|
private |
Definition at line 84 of file Marching.hpp.
Referenced by Marching(), and process().
|
private |
Definition at line 85 of file Marching.hpp.
Referenced by Marching(), and process().
|
private |
Definition at line 89 of file Marching.hpp.
Referenced by add_filter(), and process().
|
private |
Definition at line 90 of file Marching.hpp.
Referenced by add_filter(), and process().
|
private |
Definition at line 86 of file Marching.hpp.
Referenced by process().
|
private |
Definition at line 99 of file Marching.hpp.
Referenced by invert_filter(), and process().
|
private |
Definition at line 95 of file Marching.hpp.
Referenced by add_isovalue(), and process().
|
private |
Definition at line 97 of file Marching.hpp.
Referenced by process(), and set_isovalue_linesearch_iterations().
|
private |
Definition at line 80 of file Marching.hpp.
Referenced by process().
|
private |
Definition at line 87 of file Marching.hpp.
Referenced by process().
|
private |
Definition at line 92 of file Marching.hpp.
Referenced by add_pass_through(), and process().
|
private |
Definition at line 82 of file Marching.hpp.
Referenced by process().
|
private |
Definition at line 94 of file Marching.hpp.
Referenced by add_isovalue(), and process().
|
private |
Definition at line 83 of file Marching.hpp.
Referenced by Marching(), and process().