Wildmeshing Toolkit
wmtk::components::Marching Class Reference

This component implements a marching triangle/tetrahedra. More...

#include <Marching.hpp>

Collaboration diagram for wmtk::components::Marching:
[legend]

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

Meshm_mesh
 
attribute::MeshAttributeHandle m_pos_handle
 
attribute::MeshAttributeHandle m_vertex_tag_handle
 
std::optional< attribute::MeshAttributeHandlem_edge_tag_handle
 
std::optional< attribute::MeshAttributeHandlem_face_tag_handle
 
std::vector< int64_t > m_input_values
 
int64_t m_output_value
 
std::vector< attribute::MeshAttributeHandlem_filter_labels
 
std::vector< int64_t > m_filter_values
 
std::vector< attribute::MeshAttributeHandlem_pass_through_attributes
 
std::optional< attribute::MeshAttributeHandlem_scalar_field
 
double m_isovalue = std::numeric_limits<double>::lowest()
 
int64_t m_linesearch_iterations = 10
 
bool m_invert_filter = false
 

Detailed Description

This component implements a marching triangle/tetrahedra.

The method solely relies on edge splits.

Definition at line 10 of file Marching.hpp.

Constructor & Destructor Documentation

◆ Marching()

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.

Parameters
pos_handleThe position attribute handle.
label_handlesA 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.

Member Function Documentation

◆ add_filter()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_isovalue()

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.

Parameters
scalar_fieldVertex attribute of type double.
isovalueThe isovalue which is interpolated for the new vertices.

Definition at line 381 of file Marching.cpp.

References m_isovalue, and m_scalar_field.

◆ add_pass_through() [1/2]

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().

Here is the caller graph for this function:

◆ add_pass_through() [2/2]

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.

◆ invert_filter()

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.

◆ process()

void wmtk::components::Marching::process ( )

◆ set_isovalue_linesearch_iterations()

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.

Member Data Documentation

◆ m_edge_tag_handle

std::optional<attribute::MeshAttributeHandle> wmtk::components::Marching::m_edge_tag_handle
private

Definition at line 84 of file Marching.hpp.

Referenced by Marching(), and process().

◆ m_face_tag_handle

std::optional<attribute::MeshAttributeHandle> wmtk::components::Marching::m_face_tag_handle
private

Definition at line 85 of file Marching.hpp.

Referenced by Marching(), and process().

◆ m_filter_labels

std::vector<attribute::MeshAttributeHandle> wmtk::components::Marching::m_filter_labels
private

Definition at line 89 of file Marching.hpp.

Referenced by add_filter(), and process().

◆ m_filter_values

std::vector<int64_t> wmtk::components::Marching::m_filter_values
private

Definition at line 90 of file Marching.hpp.

Referenced by add_filter(), and process().

◆ m_input_values

std::vector<int64_t> wmtk::components::Marching::m_input_values
private

Definition at line 86 of file Marching.hpp.

Referenced by process().

◆ m_invert_filter

bool wmtk::components::Marching::m_invert_filter = false
private

Definition at line 99 of file Marching.hpp.

Referenced by invert_filter(), and process().

◆ m_isovalue

double wmtk::components::Marching::m_isovalue = std::numeric_limits<double>::lowest()
private

Definition at line 95 of file Marching.hpp.

Referenced by add_isovalue(), and process().

◆ m_linesearch_iterations

int64_t wmtk::components::Marching::m_linesearch_iterations = 10
private

Definition at line 97 of file Marching.hpp.

Referenced by process(), and set_isovalue_linesearch_iterations().

◆ m_mesh

Mesh& wmtk::components::Marching::m_mesh
private

Definition at line 80 of file Marching.hpp.

Referenced by process().

◆ m_output_value

int64_t wmtk::components::Marching::m_output_value
private

Definition at line 87 of file Marching.hpp.

Referenced by process().

◆ m_pass_through_attributes

std::vector<attribute::MeshAttributeHandle> wmtk::components::Marching::m_pass_through_attributes
private

Definition at line 92 of file Marching.hpp.

Referenced by add_pass_through(), and process().

◆ m_pos_handle

attribute::MeshAttributeHandle wmtk::components::Marching::m_pos_handle
private

Definition at line 82 of file Marching.hpp.

Referenced by process().

◆ m_scalar_field

std::optional<attribute::MeshAttributeHandle> wmtk::components::Marching::m_scalar_field
private

Definition at line 94 of file Marching.hpp.

Referenced by add_isovalue(), and process().

◆ m_vertex_tag_handle

attribute::MeshAttributeHandle wmtk::components::Marching::m_vertex_tag_handle
private

Definition at line 83 of file Marching.hpp.

Referenced by Marching(), and process().


The documentation for this class was generated from the following files: