Wildmeshing Toolkit
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
wmtk::components::triwild::TriWildMesh Class Reference
Inheritance diagram for wmtk::components::triwild::TriWildMesh:
wmtk::TriMesh

Classes

struct  CollapseInfoCache
 
struct  SplitInfoCache
 
struct  SwapInfoCache
 

Public Types

using VertAttCol = wmtk::AttributeCollection< VertexAttributes >
 
using EdgeAttCol = wmtk::AttributeCollection< EdgeAttributes >
 
using FaceAttCol = wmtk::AttributeCollection< FaceAttributes >
 
- Public Types inherited from wmtk::TriMesh
template<typename T >
using vector = tbb::concurrent_vector< T >
 

Public Member Functions

 TriWildMesh (Parameters &_m_params, double envelope_eps, int _num_threads=0)
 
void partition_mesh ()
 
void partition_mesh_morton ()
 
size_t get_partition_id (const Tuple &loc) const
 
double get_length2 (const Tuple &l) const
 
void init_mesh (const MatrixXd &V, const MatrixXi &F, const MatrixXi &E)
 Init mesh from IGL-style matrices.
 
void init_surfaces_and_boundaries ()
 
void init_envelope (const MatrixXd &V, const MatrixXi &F)
 
bool adjust_sizing_field_serial (double max_energy)
 
void write_msh_groups (std::string file, const bool write_envelope=true)
 
void write_vtu (const std::string &path) const
 
std::vector< std::array< size_t, 2 > > get_edges_by_condition (std::function< bool(const EdgeAttributes &)> cond) const
 
void split_all_edges ()
 
bool split_edge_before (const Tuple &t) override
 User specified preparations and desideratas for an edge split.
 
bool split_edge_after (const Tuple &loc) override
 User specified modifications and desideratas after an edge split.
 
void collapse_all_edges (bool is_limit_length=true)
 
bool collapse_edge_before (const Tuple &t) override
 User specified preparations and desideratas for an edge collapse including the link check as collapse prerequisite.
 
bool collapse_edge_after (const Tuple &t) override
 User specified modifications and desideratas after an edge collapse.
 
size_t swap_all_edges ()
 
double swap_weight (const Tuple &t) const
 The quality improvement of a swap.
 
bool swap_edge_before (const Tuple &t) override
 User specified preparations and desideratas for an edge swap including 1.can't swap on boundary edge. 2. when swap edge between v1, v2, there can't exist edges between the two opposite vertices v3, v4.
 
bool swap_edge_after (const Tuple &t) override
 User specified modifications and desideras after an edge swap.
 
void smooth_all_vertices (const size_t n_iters=1)
 
bool smooth_before (const Tuple &t) override
 User specified preparations and desideratas for an edge smooth.
 
bool smooth_after (const Tuple &t) override
 User specified modifications and desideras after an edge smooth.
 
std::vector< Vector2d > get_surface_assembles (const Tuple &t) const
 A vector containing the vertex position and all positions of the surface neighbors.
 
std::shared_ptr< polysolve::nonlinear::Problem > get_envelope_energy (const Tuple &t) const
 
std::vector< std::array< double, 6 > > get_amips_assembles (const Tuple &t) const
 
std::shared_ptr< polysolve::nonlinear::Problem > get_amips_energy (const Tuple &t) const
 
bool is_inverted_f (const Tuple &loc) const
 Inversion check using only floating point numbers.
 
bool is_inverted_f (const size_t fid) const
 
bool is_inverted (const std::array< size_t, 3 > &vs) const
 
bool is_inverted (const Tuple &loc) const
 
bool is_inverted (const size_t fid) const
 
double get_quality (const std::array< size_t, 3 > &vs) const
 
double get_quality (const Tuple &loc) const
 
double get_quality (const size_t fid) const
 
bool round (const Tuple &loc)
 
bool is_edge_on_surface (const Tuple &loc) const
 
bool is_edge_on_surface (const std::array< size_t, 2 > &vids) const
 
bool is_edge_on_bbox (const Tuple &loc) const
 
bool is_edge_on_bbox (const std::array< size_t, 2 > &vids) const
 
void mesh_improvement (int max_its=80)
 
std::tuple< double, double > local_operations (const std::array< int, 4 > &ops, bool collapse_limit_length=true)
 
std::tuple< double, double > get_max_avg_energy ()
 
void compute_winding_numbers (const std::vector< std::string > &input_paths)
 
int flood_fill ()
 
bool vertex_is_on_surface (const size_t vid) const override
 Is a vertex part of the substructure.
 
bool edge_is_on_surface (const std::array< size_t, 2 > &vids) const override
 Is an edge part of the substructure.
 
- Public Member Functions inherited from wmtk::TriMesh
void init (size_t n_vertices, const std::vector< std::array< size_t, 3 > > &tris)
 
void init (const MatrixXi &F)
 Generate the connectivity of the mesh from an IGL-style F matrix.
 
std::vector< Tupleget_vertices () const
 
std::vector< Tupleget_edges () const
 
std::vector< Tupleget_faces () const
 
Tuple tuple_from_edge (size_t vid1, size_t vid2, size_t fid) const
 
Tuple tuple_from_vids (size_t vid0, size_t vid1, size_t vid2) const
 
simplex::Vertex simplex_from_vertex (const Tuple &t) const
 
simplex::Edge simplex_from_edge (const Tuple &t) const
 
simplex::Face simplex_from_face (const Tuple &t) const
 
simplex::Face simplex_from_face (const size_t fid) const
 
Tuple tuple_from_simplex (const simplex::Face &s) const
 
simplex::SimplexCollection simplex_incident_triangles (const simplex::Vertex &v) const
 
simplex::SimplexCollection simplex_incident_triangles (const simplex::Edge &e) const
 
simplex::SimplexCollection simplex_link_vertices (const simplex::Vertex &v) const
 
simplex::SimplexCollection simplex_link_vertices (const simplex::Edge &e) const
 
simplex::SimplexCollection simplex_link_edges (const simplex::Vertex &v) const
 
virtual bool invariants (const std::vector< Tuple > &)
 User specified invariants that can't be violated.
 
virtual bool split_face_before (const Tuple &t)
 User specified preparations and desideratas for a face split.
 
virtual bool split_face_after (const Tuple &t)
 User specified modifications and desideratas after a face split.
 
size_t tri_capacity () const
 get the current largest global fid
 
size_t vert_capacity () const
 get the current largest global vid
 
void consolidate_mesh ()
 removing the elements that are removed
 
Tuple switch_vertex (const Tuple &t) const
 a duplicate of Tuple::switch_vertex funciton
 
Tuple switch_edge (const Tuple &t) const
 a duplicate of Tuple::switch_edge funciton
 
std::optional< Tupleswitch_face (const Tuple &t) const
 a duplicate of Tuple::switch_face funciton
 
bool check_link_condition (const Tuple &t) const
 prerequisite for collapse
 
bool check_mesh_connectivity_validity () const
 verify the connectivity validity of the mesh
 
bool check_edge_manifold () const
 verify the edge manifoldness of the mesh
 
bool is_boundary_edge (const TriMesh::Tuple &t) const
 check if edge that's represented by a Tuple is at the boundary of the mesh
 
bool is_boundary_vertex (const TriMesh::Tuple &t) const
 check if the vertex that's represented by a Tuple is at the boundary of the mesh
 
bool split_edge (const Tuple &t, std::vector< Tuple > &new_t)
 
virtual bool collapse_edge (const Tuple &t, std::vector< Tuple > &new_t)
 
void collapse_edge_conn (const Tuple &loc0, std::vector< Tuple > &new_tris, Tuple &return_t, size_t &new_vid, std::vector< std::pair< size_t, TriangleConnectivity > > &old_tris, std::vector< std::pair< size_t, VertexConnectivity > > &old_vertices, std::vector< std::pair< size_t, size_t > > &same_edge_vid_fid, std::vector< size_t > &n12_intersect_fids)
 
void collapse_edge_rollback (size_t &new_vid, std::vector< std::pair< size_t, TriangleConnectivity > > &old_tris, std::vector< std::pair< size_t, VertexConnectivity > > &old_vertices, std::vector< std::pair< size_t, size_t > > &same_edge_vid_fid, std::vector< size_t > &n12_intersect_fids)
 
bool swap_edge (const Tuple &t, std::vector< Tuple > &new_t)
 
bool smooth_vertex (const Tuple &t)
 
bool split_face (const Tuple &t, std::vector< Tuple > &new_t)
 Split a face in 3 faces.
 
size_t get_valence_for_vertex (const Tuple &t) const
 Count the number of the one ring tris for a vertex.
 
std::vector< Tupleget_one_ring_tris_for_vertex (const Tuple &t) const
 Get the one ring tris for a vertex.
 
const std::vector< size_t > & get_one_ring_fids_for_vertex (const Tuple &t) const
 
const std::vector< size_t > & get_one_ring_fids_for_vertex (const size_t vid) const
 
std::vector< size_t > get_one_ring_vids_for_vertex_duplicate (const size_t &t) const
 Get the vids of the incident one ring tris for a vertex.
 
void get_one_ring_vids_for_vertex_duplicate (const size_t &t, std::vector< size_t > &one_ring) const
 
std::vector< size_t > get_incident_fids_for_edge (const Tuple &t) const
 
std::vector< size_t > get_incident_fids_for_edge (const size_t vid0, const size_t vid1) const
 
std::vector< Tupleget_one_ring_edges_for_vertex (const Tuple &t) const
 Get all edges that are incident to the vertex of Tuple t.
 
std::vector< Tupleget_one_ring_edges_for_vertex (const size_t vid) const
 
std::array< Tuple, 3 > oriented_tri_vertices (const Tuple &t) const
 Get the incident vertices for a triangle.
 
std::array< size_t, 3 > oriented_tri_vids (const Tuple &t) const
 Get the incident vertices for a triangle.
 
std::array< size_t, 3 > oriented_tri_vids (const size_t i) const
 
std::array< Tuple, 2 > get_edge_vertices (const Tuple &t) const
 
std::array< size_t, 2 > get_edge_vids (const Tuple &t) const
 
Tuple tuple_from_tri (size_t fid) const
 
Tuple tuple_from_vertex (size_t vid) const
 
Tuple tuple_from_edge (size_t fid, size_t local_eid) const
 
std::tuple< Tuple, size_t > tuple_from_edge (const std::array< size_t, 2 > &vids) const
 
void start_protect_attributes ()
 Start the phase where the attributes that will be modified can be recorded.
 
void release_protect_attributes ()
 End the modification phase.
 
void rollback_protected_attributes ()
 rollback the attributes that are modified if any condition failed
 
int release_vertex_mutex_in_stack ()
 
bool try_set_vertex_mutex_two_ring (const Tuple &v, int threadid)
 try lock the two-ring neighboring triangles' incident vertices
 
bool try_set_edge_mutex_two_ring (const Tuple &e, int threadid)
 try lock the two-ring neighboring triangles' incident vertices for the two ends of an edge
 
bool try_set_vertex_mutex_one_ring (const Tuple &v, int threadid)
 get the lock for one ring neighboring triangles' incident vertices
 
bool try_set_face_mutex_one_ring (const Tuple &f, int threadid)
 try lock the one-ring neighboring triangles' incident vertices.
 
void for_each_face (const std::function< void(const Tuple &)> &)
 perform the given function for each face
 
void for_each_edge (const std::function< void(const Tuple &)> &)
 perform the given function for each edge
 
void for_each_vertex (const std::function< void(const Tuple &)> &)
 perform the given function for each vertex
 
simplex::SimplexCollection get_surface_edges_for_vertex (const size_t vid) const
 Get all edges on the surface that are incident to vid.
 
size_t get_order_of_edge (const std::array< size_t, 2 > &vids) const
 Compute the order of an edge.
 
size_t get_order_of_vertex (const size_t vid) const
 Get the order of a vertex.
 
bool substructure_link_condition (const Tuple &e_tuple) const
 Link condition that also considers substructures.
 

Public Attributes

int m_debug_print_counter = 0
 
size_t m_tags_count = 0
 
std::map< int64_t, std::string > m_tag_id_to_name
 
std::map< std::string, int64_t > m_tag_name_to_id
 
const double MAX_ENERGY = 1e50
 
Parametersm_params
 
std::vector< Vector2d > m_V_envelope
 
std::vector< Vector2i > m_E_envelope
 
std::shared_ptr< SampleEnvelopem_envelope
 
double m_envelope_eps = -1
 
VertAttCol m_vertex_attribute
 
EdgeAttCol m_edge_attribute
 
FaceAttCol m_face_attribute
 
tbb::enumerable_thread_specific< std::unique_ptr< polysolve::nonlinear::Solver > > m_solver
 
double m_s_amips = -1
 
double m_s_envelope = -1
 
- Public Attributes inherited from wmtk::TriMesh
AbstractAttributeContainerp_vertex_attrs = nullptr
 
AbstractAttributeContainerp_edge_attrs = nullptr
 
AbstractAttributeContainerp_face_attrs = nullptr
 
tbb::enumerable_thread_specific< std::vector< size_t > > mutex_release_stack
 
int NUM_THREADS = 0
 

Private Attributes

tbb::enumerable_thread_specific< SplitInfoCachesplit_cache
 
tbb::enumerable_thread_specific< CollapseInfoCachecollapse_cache
 
tbb::enumerable_thread_specific< SwapInfoCacheswap_cache
 

Additional Inherited Members

- Protected Member Functions inherited from wmtk::TriMesh
void resize_mutex (size_t v)
 

Constructor & Destructor Documentation

◆ TriWildMesh()

wmtk::components::triwild::TriWildMesh::TriWildMesh ( Parameters _m_params,
double  envelope_eps,
int  _num_threads = 0 
)
inline

eps makes it such that the energy is relative to the envelope thickness. As it's a squared energy, we need eps^2.

Member Function Documentation

◆ collapse_edge_after()

bool wmtk::components::triwild::TriWildMesh::collapse_edge_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas after an edge collapse.

Parameters
theedge Tuple to be collapsed
Returns
true if the modifications succeed

Reimplemented from wmtk::TriMesh.

◆ collapse_edge_before()

bool wmtk::components::triwild::TriWildMesh::collapse_edge_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an edge collapse including the link check as collapse prerequisite.

Parameters
theedge Tuple to be split
Returns
true if the preparation succeed

check if on bbox/surface/boundary

In general, we don't want to collapse away from feature vertices. It is always fine to collapse into a feature vertex, though. However, we allow to feature vertices to be collapsed.

Reimplemented from wmtk::TriMesh.

◆ edge_is_on_surface()

bool wmtk::components::triwild::TriWildMesh::edge_is_on_surface ( const std::array< size_t, 2 > &  vids) const
inlineoverridevirtual

Is an edge part of the substructure.

Parameters
vidsThe vertex IDs of the edge

Reimplemented from wmtk::TriMesh.

◆ get_surface_assembles()

std::vector< Vector2d > wmtk::components::triwild::TriWildMesh::get_surface_assembles ( const Tuple t) const

A vector containing the vertex position and all positions of the surface neighbors.

Returns an empty vector if vertex is not on the surface.

◆ init_mesh()

void wmtk::components::triwild::TriWildMesh::init_mesh ( const MatrixXd &  V,
const MatrixXi &  F,
const MatrixXi &  E 
)

Init mesh from IGL-style matrices.

Parameters
VVx3 vertices of the tet mesh
FFx3 vertex IDs for all faces
EEx2 vertex IDs for all constraint edges

◆ mesh_improvement()

void wmtk::components::triwild::TriWildMesh::mesh_improvement ( int  max_its = 80)

ops

energy check

sizing field

◆ smooth_after()

bool wmtk::components::triwild::TriWildMesh::smooth_after ( const Tuple t)
overridevirtual

User specified modifications and desideras after an edge smooth.

Parameters
theedge Tuple to be smoothed
Returns
true if the modifications succeed

Reimplemented from wmtk::TriMesh.

◆ smooth_before()

bool wmtk::components::triwild::TriWildMesh::smooth_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an edge smooth.

Parameters
theedge Tuple to be smoothed
Returns
true if the preparation succeed

Reimplemented from wmtk::TriMesh.

◆ split_edge_after()

bool wmtk::components::triwild::TriWildMesh::split_edge_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas after an edge split.

Parameters
theedge Tuple to be split
Returns
true if the modifications succeed

check inversion & rounding

update quality

update vertex attribute

update edge attribute

Reimplemented from wmtk::TriMesh.

◆ split_edge_before()

bool wmtk::components::triwild::TriWildMesh::split_edge_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an edge split.

Parameters
theedge Tuple to be split
Returns
true if the preparation succeed

Reimplemented from wmtk::TriMesh.

◆ swap_edge_after()

bool wmtk::components::triwild::TriWildMesh::swap_edge_after ( const Tuple t)
overridevirtual

User specified modifications and desideras after an edge swap.

Parameters
theedge Tuple to be swaped
Returns
true if the modifications succeed

Reimplemented from wmtk::TriMesh.

◆ swap_edge_before()

bool wmtk::components::triwild::TriWildMesh::swap_edge_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an edge swap including 1.can't swap on boundary edge. 2. when swap edge between v1, v2, there can't exist edges between the two opposite vertices v3, v4.

Parameters
theedge Tuple to be swaped
Returns
true if the preparation succeed

Reimplemented from wmtk::TriMesh.

◆ swap_weight()

double wmtk::components::triwild::TriWildMesh::swap_weight ( const Tuple t) const

The quality improvement of a swap.

Used to determine the priority and weight of a swap operation.

◆ vertex_is_on_surface()

bool wmtk::components::triwild::TriWildMesh::vertex_is_on_surface ( const size_t  vid) const
inlineoverridevirtual

Is a vertex part of the substructure.

Parameters
vidVertex ID

Reimplemented from wmtk::TriMesh.


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