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

Classes

struct  CollapseInfoCache
 
struct  SplitInfoCache
 
struct  SwapInfoCache
 

Public Types

using ExprPtr = expression_parser::ExpressionPtr
 
using VertAttCol = wmtk::AttributeCollection< VertexAttributes >
 
using FaceAttCol = wmtk::AttributeCollection< FaceAttributes >
 
using TetAttCol = wmtk::AttributeCollection< TetAttributes >
 
- Public Types inherited from wmtk::TetMesh
template<typename T >
using vector = tbb::concurrent_vector< T >
 

Public Member Functions

 ImageSimulationMesh (Parameters &_m_params, double envelope_eps, int _num_threads=0)
 
void create_mesh_attributes (const std::vector< VertexAttributes > &_vertex_attribute, const std::vector< TetAttributes > &_tet_attribute)
 
void compute_vertex_partition ()
 
void compute_vertex_partition_morton ()
 
size_t get_partition_id (const Tuple &loc) const
 
void init_envelope (const MatrixXd &V, const MatrixXi &F, const bool use_exact)
 
CellTag string_set_to_cell_tag (const std::set< std::string > &str_set)
 
void set_length_regions (const nlohmann::json &length_region_json)
 
double get_length2 (const Tuple &l) const
 
void write_msh (std::string file, const bool write_envelope=true)
 
void output_faces (std::string file, std::function< bool(const FaceAttributes &)> cond)
 
void split_all_edges ()
 
bool split_edge_before (const Tuple &t) override
 User specified preparations and desideratas for an edge split before changing the connectivity.
 
bool split_edge_after (const Tuple &loc) override
 This function computes the attributes for the added simplices. User specified modifications and desideratas for after an edge split.
 
void smooth_all_vertices (const size_t n_iters)
 
bool smooth_before (const Tuple &t) override
 User specified preparations and desideratas for smoothing a vertex.
 
bool smooth_after (const Tuple &t) override
 User specified modifications and desideratas for after smoothing a vertex.
 
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 before changing the connectivity.
 
bool collapse_edge_after (const Tuple &t) override
 User specified modifications and desideratas for after an edge collapse.
 
void simplify ()
 
size_t swap_all_edges_44 ()
 
bool swap_edge_44_before (const Tuple &t) override
 User specified preparations and desideratas for an 4-4 edge swap before changing the connectivity.
 
double swap_edge_44_energy (const std::vector< std::array< size_t, 4 > > &tets, const int op_case) override
 User specified energy to decide which of the 4 possible orientations should be chosen.
 
bool swap_edge_44_after (const Tuple &t) override
 User specified modifications and desideratas for after a 4-4 edge swap.
 
size_t swap_all_edges_56 ()
 
bool swap_edge_56_before (const Tuple &t) override
 User specified preparations and desideratas for a 5-6 edge swap before changing the connectivity.
 
double swap_edge_56_energy (const std::vector< std::array< size_t, 4 > > &tets, const int op_case) override
 User specified energy to decide which of the 5 possible orientations should be chosen.
 
bool swap_edge_56_after (const Tuple &t) override
 User specified modifications and desideratas for after a 5-6 edge swap.
 
size_t swap_all_edges_32 ()
 
bool swap_edge_before (const Tuple &t) override
 User specified preparations and desideratas for an 3-2 edge swap before changing the conenctivity.
 
bool swap_edge_after (const Tuple &t) override
 User specified modifications and desideratas for after a 3-2 edge swap.
 
size_t swap_all_faces ()
 
bool swap_face_before (const Tuple &t) override
 User specified preparations and desideratas for an 2-3 face swap befroe changing the geometry.
 
bool swap_face_after (const Tuple &t) override
 User specified modifications and desideratas for after a 2-3 face swap.
 
size_t swap_all_edges_all ()
 
bool is_inverted_f (const Tuple &loc) const
 Inversion check using only floating point numbers.
 
bool is_inverted (const std::array< size_t, 4 > &vs) const
 
bool is_inverted (const Tuple &loc) const
 
double get_quality (const std::array< size_t, 4 > &vs) const
 
double get_quality (const Tuple &loc) const
 
std::vector< std::array< double, 12 > > get_amips_assembles (const Tuple &t) const
 
std::shared_ptr< polysolve::nonlinear::Problem > get_amips_energy (const Tuple &t) const
 
std::shared_ptr< polysolve::nonlinear::Problem > get_envelope_energy (const Tuple &t) const
 
bool round (const Tuple &loc)
 Round a vertex position to floating point.
 
bool all_rounded () const
 Check if all vertices of the mesh are rounded.
 
bool is_edge_on_surface (const Tuple &loc)
 
bool is_edge_on_bbox (const Tuple &loc)
 
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 ()
 
bool check_attributes ()
 
std::vector< std::array< size_t, 3 > > get_faces_by_condition (std::function< bool(const FaceAttributes &)> cond) const
 
bool invariants (const std::vector< Tuple > &t) override
 
void init_from_image (const MatrixXr &V, const MatrixXi &T, const MatrixSi &T_tags, const std::vector< std::string > &tag_names)
 Init from meshes image.
 
void init_from_image (const MatrixXd &V, const MatrixXi &T, const MatrixSi &T_tags, const std::vector< std::string > &tag_names)
 
void init_surfaces_and_boundaries ()
 
std::vector< std::array< size_t, 3 > > triangulate_polygon_face (std::vector< Vector3r > points)
 
bool adjust_sizing_field_serial (double max_energy)
 
void find_order_2_edges ()
 Find open boundary edges of the embedded surface and initialize a BVH for the open boundary.
 
bool is_order_2_edge (const Tuple &e) const
 Checks if an edge COULD be an open boundary edge.
 
bool is_order_2_edge (const std::array< size_t, 2 > &e) const
 
void write_vtu (const std::string &path)
 
void write_surface (const std::string &path) const
 
bool vertex_is_on_surface (const size_t vid) const override
 Is a vertex part of the substructure.
 
bool face_is_on_surface (const size_t fid) const override
 Is a face part of the substructure.
 
size_t get_order_of_vertex (const size_t vid) const override
 Get the order of a vertex.
 
void init_vertex_order ()
 Compute the vertex order for every vertex.
 
double tet_volume (const size_t tid) const
 
std::vector< ConnectedComponentcompute_connected_components (const CellTag &tag_in) const
 Find all connected components that contain the tag_in tags.
 
std::vector< ConnectedComponentfind_holes (const std::vector< CellTag > &tag_in) const
 Find all regions that do not contain the tags from tag_in.
 
void compute_tag_boundary (const CellTag &tag, MatrixXd &V, MatrixXi &F) const
 Compute the boundary of a tag.
 
void keep_largest_connected_component (const std::vector< CellTag > &lcc_tags, const size_t n_lcc=1)
 Keep only the largest connected component for each of the distinct tag_0 values, and engulf all other components.
 
void fill_holes_topo (const std::vector< CellTag > &fill_holes_tags, double threshold=std::numeric_limits< double >::infinity())
 
void seal_connected_components (const std::vector< CellTag > &tag_sets, const std::vector< ConnectedComponent > &components)
 
void tight_seal_topo (const std::vector< std::vector< CellTag > > &tight_seal_tag_sets, double threshold=std::numeric_limits< double >::infinity())
 
void resolve_intersections (const std::vector< CellTag > &intersecting_tags)
 
void replace_tags (const std::vector< CellTag > &tags_in, const std::vector< CellTag > &tags_out)
 
void tag_priority (const std::vector< int64_t > &tags)
 Gives tags priority over others.
 
- Public Member Functions inherited from wmtk::TetMesh
size_t vert_capacity () const
 get the current largest global vid
 
size_t tet_capacity () const
 get the current largest global tid
 
size_t vertex_size () const
 get the number of unremoved verticies
 
size_t tet_size () const
 get the number of unremoved tets
 
void init (size_t n_vertices, const std::vector< std::array< size_t, 4 > > &tets)
 
void init_with_isolated_vertices (size_t n_vertices, const std::vector< std::array< size_t, 4 > > &tets)
 
void init (const MatrixXi &T)
 Generate the connectivity of the mesh from an IGL-style T matrix.
 
bool split_edge (const Tuple &t, std::vector< Tuple > &new_tets)
 
virtual bool collapse_edge (const Tuple &t, std::vector< Tuple > &new_tets)
 
bool link_condition (const Tuple &t)
 
bool collapse_edge_conn (const Tuple &loc0, std::vector< Tuple > &new_edges, size_t &v1_id, Tuple &new_loc, std::map< size_t, wmtk::TetMesh::VertexConnectivity > &rollback_vert_conn, std::vector< size_t > &n1_t_ids_copy, std::vector< size_t > &new_tet_id, std::vector< TetrahedronConnectivity > &old_tets)
 
bool collapse_edge_check_topology (const std::vector< size_t > &new_tet_id)
 Check topology after collapse connectivity change. This is a sanity check and should not be necessary.
 
void collapse_edge_rollback (size_t &v1_id, std::map< size_t, wmtk::TetMesh::VertexConnectivity > &rollback_vert_conn, std::vector< size_t > &n1_t_ids, std::vector< size_t > &new_tet_id, std::vector< TetrahedronConnectivity > &old_tets)
 
bool swap_edge_56 (const Tuple &t, std::vector< Tuple > &new_tets)
 
bool swap_edge_44 (const Tuple &t, std::vector< Tuple > &new_tets)
 
bool swap_edge (const Tuple &t, std::vector< Tuple > &new_tets)
 3-2 edge swap
 
bool swap_face (const Tuple &t, std::vector< Tuple > &new_tets)
 2-3 face swap
 
bool smooth_vertex (const Tuple &t)
 
bool split_tet (const Tuple &t, std::vector< Tuple > &new_tets)
 Split a tet in 4 tets.
 
bool split_face (const Tuple &t, std::vector< Tuple > &new_tets)
 Split a face in 3 faces.
 
void triangle_insertion (const std::vector< Tuple > &intersected_tets, const std::vector< Tuple > &intersected_edges, std::vector< size_t > &new_edge_vids, std::vector< size_t > &new_center_vids, std::vector< std::array< size_t, 4 > > &center_split_tets)
 Insert a triangle into a tetmesh, with known intersection information.
 
bool insert_point (const Tuple &t, std::vector< Tuple > &new_tets)
 Insert a point into a tetmesh inside a tet. In general position, this split a tet into 4. In face position, split two tets. In edge position, In point position, do nothing.
 
virtual bool insert_point_before (const Tuple &t)
 
virtual bool insert_point_after (std::vector< Tuple > &new_tets)
 
void consolidate_mesh ()
 cleans up the deleted vertices or tetrahedra, fixes the corresponding indices, and reset the version number. WARNING: it invalidates all tuples!
 
std::vector< Tupleget_edges () const
 
std::vector< Tupleget_faces () const
 
std::vector< Tupleget_vertices () const
 
std::vector< Tupleget_tets () const
 
virtual void for_each_face (const std::function< void(const TetMesh::Tuple &)> &)
 looping through all the unique edges and perform the given function
 
Tuple tuple_from_edge (size_t tid, int local_eid) const
 get a Tuple from global tetra index and local edge index (from 0-5).
 
Tuple tuple_from_edge (const std::array< size_t, 2 > &vids) const
 get a Tuple from global vids of the 2 end of an edge
 
Tuple tuple_from_face (size_t tid, int local_fid) const
 get a Tuple from global tetra index and local face index (from 0-3).
 
std::tuple< Tuple, size_t > tuple_from_face (const std::array< size_t, 3 > &vids) const
 get a Tuple and the global face index from global vertex index of the face.
 
std::tuple< Tuple, size_t > tuple_from_face (const simplex::Face &f) const
 
Tuple tuple_from_vertex (size_t vid) const
 get a Tuple from global vertex index
 
Tuple tuple_from_tet (size_t tid) const
 get a Tuple from global tetra index
 
Tuple tuple_from_vids (size_t vid0, size_t vid1, size_t vid2, size_t vid3) const
 Get a Tuple from global vertex IDs.
 
simplex::Tet simplex_from_tet (const Tuple &t) const
 
simplex::Tet simplex_from_tet (const size_t tid) const
 
simplex::Edge simplex_from_edge (const Tuple &t) const
 
Tuple switch_vertex (const Tuple &t) const
 wrapper function from Tuple::switch_vertex
 
Tuple switch_edge (const Tuple &t) const
 wrapper function from Tuple::switch_edge
 
Tuple switch_face (const Tuple &t) const
 wrapper function from Tuple::switch_face
 
std::optional< Tupleswitch_tetrahedron (const Tuple &t) const
 wrapper function from Tuple::switch_tetrahedron
 
std::vector< Tupleget_one_ring_tets_for_vertex (const Tuple &t) const
 Get the one ring tets for a vertex.
 
std::vector< size_t > get_one_ring_tids_for_vertex (const Tuple &t) const
 Get the one ring tids for vertex.
 
std::vector< size_t > get_one_ring_tids_for_vertex (const size_t vid) const
 
std::vector< Tupleget_one_ring_vertices_for_vertex (const Tuple &t) const
 Get the one ring vertices for a vertex.
 
std::vector< size_t > get_one_ring_vids_for_vertex (size_t vid, std::vector< size_t > &cache)
 Get the one ring vids for vertex.
 
std::vector< size_t > get_one_ring_vids_for_vertex (size_t vid) const
 Get the one ring vids for vertex.
 
std::vector< size_t > get_one_ring_vids_for_vertex_adj (size_t vid) const
 Duplicate of the function TetMesh::get_one_ring_vids_for_vertex.
 
std::vector< size_t > get_one_ring_vids_for_vertex_adj (size_t vid, std::vector< size_t > &cache)
 Duplicate of the function TetMesh::get_one_ring_vids_for_vertex.
 
std::vector< Tupleget_incident_tets_for_edge (const Tuple &t) const
 Get the incident tets for edge.
 
std::vector< Tupleget_incident_tets_for_edge (const size_t vid0, const size_t vid1) const
 
std::vector< size_t > get_incident_tids_for_edge (const Tuple &t) const
 
std::vector< size_t > get_incident_tids_for_edge (const size_t vid0, const size_t vid1) const
 
std::vector< Tupleget_one_ring_tets_for_edge (const Tuple &t) const
 Get the one ring tets for edge.
 
std::vector< std::array< size_t, 3 > > vertex_adjacent_boundary_faces (const Tuple &t) const
 
std::array< Tuple, 4 > oriented_tet_vertices (const Tuple &t) const
 
std::array< size_t, 4 > oriented_tet_vids (const Tuple &t) const
 
std::array< size_t, 4 > oriented_tet_vids (const size_t tid) const
 
std::array< Tuple, 3 > get_face_vertices (const Tuple &t) const
 Get the 3 vertices of a face represented by Tuple.
 
std::array< size_t, 3 > get_face_vids (const Tuple &t) const
 
std::array< Tuple, 6 > tet_edges (const Tuple &t) const
 get the 6 edges of a tet represented by Tuples
 
void check_tuple_validity (const Tuple &t) const
 
bool check_mesh_connectivity_validity () const
 checks the validity of the connectivity of the mesh. Including the validity of each Tuple
 
void remove_tets_by_ids (const std::vector< size_t > &tids)
 remove the tetrahedrons in the mesh that have given tet ids
 
void start_protect_attributes ()
 
void release_protect_attributes ()
 
void rollback_protected_attributes ()
 
int release_vertex_mutex_in_stack ()
 
bool try_set_vertex_mutex_two_ring (const Tuple &v, int threadid)
 try lock the two-ring neighboring traingles' incident vertices
 
bool try_set_vertex_mutex_two_ring_vid (const Tuple &v, int threadid)
 try lock the two-ring neighboring traingles' incident vertices using vids
 
bool try_set_vertex_mutex_two_ring_vid (size_t v, int threadid)
 a duplicate of ConcurrentTetMesh::try_set_vertex_mutex_two_ring_vid that gets vids using the vid of the input Tuple
 
bool try_set_edge_mutex_two_ring (const Tuple &e, int threadid=0)
 try lock the two-ring neighboring triangles' incident vertices for the two ends of an edge
 
bool try_set_face_mutex_two_ring (const Tuple &f, int threadid=0)
 try lock the two-ring neighboring triangles' incident vertices for the 3 vertices of a face
 
bool try_set_face_mutex_two_ring (const Tuple &v1, const Tuple &v2, const Tuple &v3, int threadid=0)
 locking the two-ring neighboring triangles' incident vertices given the 3 vertex Tuples of the face
 
bool try_set_face_mutex_two_ring (size_t v1, size_t v2, size_t v3, int threadid=0)
 a duplicate of ConcurrentTetMesh::try_set_face_mutex_two_ring usign the vids of the 3 vertices of a face
 
bool try_set_vertex_mutex_one_ring (const Tuple &v, int threadid=0)
 try lock the one-ring neighboring traingles' incident vertices
 
void for_each_edge (const std::function< void(const TetMesh::Tuple &)> &)
 perform the given function for each edge
 
void for_each_vertex (const std::function< void(const TetMesh::Tuple &)> &)
 perform the given function for each vertex
 
void for_each_tetra (const std::function< void(const TetMesh::Tuple &)> &)
 perform the given function for each tet
 
simplex::SimplexCollection get_surface_faces_for_vertex (const size_t vid) const
 Get all faces on the surface that are incident to vid.
 
simplex::SimplexCollection get_surface_faces_for_edge (const std::array< size_t, 2 > &vids) const
 Get all faces on the surface that are incident to the edge.
 
size_t get_num_surface_faces_for_edge (const std::array< size_t, 2 > &vids) const
 Get the number of surface faces incident to the edge.
 
size_t compute_vertex_order (const size_t vid) const
 Compute the vertex order for a single vertex.
 
size_t get_order_of_edge (const std::array< size_t, 2 > &vids) const
 Compute the order of an edge.
 
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
 
double time_env = 0.0
 
igl::Timer isout_timer
 
const double MAX_ENERGY = std::numeric_limits<double>::max()
 
Parametersm_params
 
std::vector< Vector3d > m_V_envelope
 
std::vector< Vector3i > m_F_envelope
 
std::shared_ptr< SampleEnvelopem_envelope
 
std::shared_ptr< SampleEnvelopem_envelope_orig
 
double m_envelope_eps = -1
 
std::vector< std::tuple< ExprPtr, double > > m_length_regions
 
bool m_collapse_check_quality = true
 
std::shared_ptr< SampleEnvelopem_order_2_edge_envelope
 
tbb::enumerable_thread_specific< std::unique_ptr< polysolve::nonlinear::Solver > > m_solver
 
double m_s_amips = -1
 
double m_s_envelope = -1
 
std::function< double(const Vector3d &)> m_voronoi_split_fn = nullptr
 
VertAttCol m_vertex_attribute
 
FaceAttCol m_face_attribute
 
TetAttCol m_tet_attribute
 
std::atomic< int > cnt_split = 0
 
std::atomic< int > cnt_collapse = 0
 
std::atomic< int > cnt_swap = 0
 
- Public Attributes inherited from wmtk::TetMesh
AbstractAttributeContainerp_vertex_attrs = nullptr
 
AbstractAttributeContainerp_edge_attrs = nullptr
 
AbstractAttributeContainerp_face_attrs = nullptr
 
AbstractAttributeContainerp_tet_attrs = nullptr
 
bool m_collapse_check_link_condition = true
 
bool m_collapse_check_topology = false
 
bool m_collapse_check_manifold = true
 
tbb::enumerable_thread_specific< std::vector< size_t > > mutex_release_stack
 
tbb::enumerable_thread_specific< std::vector< size_t > > get_one_ring_cache
 
int NUM_THREADS = 0
 

Private Attributes

tbb::concurrent_map< std::array< size_t, 3 >, std::vector< int > > tet_face_tags
 
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::TetMesh
virtual bool triangle_insertion_before (const std::vector< Tuple > &faces)
 
virtual bool triangle_insertion_after (const std::vector< std::vector< Tuple > > &)
 
virtual bool split_face_before (const Tuple &t)
 User specified preparations and desideratas for a face split before changing the connectivity.
 
virtual bool split_face_after (const Tuple &t)
 Compute the attributes for the added simplices.
 
virtual bool split_tet_before (const Tuple &t)
 User specified preparations and desideratas for a tet split before changing the connectivity.
 
virtual bool split_tet_after (const Tuple &t)
 Compute the attributes for the added simplices.
 
void resize_vertex_mutex (size_t v)
 

Member Function Documentation

◆ adjust_sizing_field_serial()

bool wmtk::components::image_simulation::ImageSimulationMesh::adjust_sizing_field_serial ( double  max_energy)

Iterate through all vertices. For each vertex, find all pts in the R-ball neighborhood. Compute scalar based on the distance to the point. Take smallest of all computed values.

If no neighbor, multiply by recover_scalar.

◆ collapse_edge_after()

bool wmtk::components::image_simulation::ImageSimulationMesh::collapse_edge_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas for after an edge collapse.

Parameters
tedge Tuple that's collapsed
Returns
true if the modification succeed

Reimplemented from wmtk::TetMesh.

◆ collapse_edge_before()

bool wmtk::components::image_simulation::ImageSimulationMesh::collapse_edge_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an edge collapse before changing the connectivity.

Parameters
tedge Tuple to be collapsed
Returns
true is the preparation succeed

check if on bbox/surface/boundary

Reimplemented from wmtk::TetMesh.

◆ compute_tag_boundary()

void wmtk::components::image_simulation::ImageSimulationMesh::compute_tag_boundary ( const CellTag &  tag,
MatrixXd &  V,
MatrixXi &  F 
) const

Compute the boundary of a tag.

Parameters
tagA set of tags that must be present in a tet for being considered as tagged.
VVertices of the tag boundary.
FFaces of the tag boundary.

◆ face_is_on_surface()

bool wmtk::components::image_simulation::ImageSimulationMesh::face_is_on_surface ( const size_t  fid) const
overridevirtual

Is a face part of the substructure.

Parameters
fidFace ID

Reimplemented from wmtk::TetMesh.

◆ find_holes()

std::vector< ConnectedComponent > wmtk::components::image_simulation::ImageSimulationMesh::find_holes ( const std::vector< CellTag > &  tag_in) const

Find all regions that do not contain the tags from tag_in.

The tag_in vector represents a list of tag intersections. Example: tag_in = {{1,2},{3}} A face will be considered as a hole if its tags neither include {1,2} or {3}. The following would be holes: {} {1,4} The following would be NOT holes: {1,2,4} <- contains 1 and 2 {3} <- contains 3 {1,3} <- contains 3

The returned vector also contains "holes" that touch the boundary. They should be ommitted in hole filling.

◆ find_order_2_edges()

void wmtk::components::image_simulation::ImageSimulationMesh::find_order_2_edges ( )

Find open boundary edges of the embedded surface and initialize a BVH for the open boundary.

The envelope for the open boundary uses a hack: A boundary edge is represented as a degenerate triangle, e.g., (v0,v1,v0). That way, the standard triangle envelope code can be used.

◆ get_order_of_vertex()

size_t wmtk::components::image_simulation::ImageSimulationMesh::get_order_of_vertex ( const size_t  vid) const
overridevirtual

Get the order of a vertex.

The order of a vertex in a TetMesh is as follows: 0: vertex is not on the surface 1: vertex is on the surface 2: vertex is on the surface boundary or a non-manifold edge 3: vertex is at the boundary of a non-manifold edge or a non-manifold vertex

Computing the vertex order is expensive. It is recommended to store the vertex order as a vertex attribute and override this method.

Parameters
vidVertex ID

Reimplemented from wmtk::TetMesh.

◆ init_from_image()

void wmtk::components::image_simulation::ImageSimulationMesh::init_from_image ( const MatrixXr &  V,
const MatrixXi &  T,
const MatrixSi &  T_tags,
const std::vector< std::string > &  tag_names 
)

Init from meshes image.

Parameters
VVx3 vertices of the tet mesh
TTx4 vertex IDs for all tets
T_tagsTx1 image data represented by the individual tets

◆ invariants()

bool wmtk::components::image_simulation::ImageSimulationMesh::invariants ( const std::vector< Tuple > &  t)
overridevirtual

Reimplemented from wmtk::TetMesh.

◆ is_order_2_edge()

bool wmtk::components::image_simulation::ImageSimulationMesh::is_order_2_edge ( const Tuple e) const

Checks if an edge COULD be an open boundary edge.

The method performs two checks. First, it checks if the two vertices are marked as on the open boundary. Second, it checks if the edge is within the open boundary envelope. Note that these checks are not sufficient to guarantee that an edge is actually on the open boundary! For example, an almost degenerate triangle with two edges on the open boundary could cause a false positive result.

◆ keep_largest_connected_component()

void wmtk::components::image_simulation::ImageSimulationMesh::keep_largest_connected_component ( const std::vector< CellTag > &  lcc_tags,
const size_t  n_lcc = 1 
)

Keep only the largest connected component for each of the distinct tag_0 values, and engulf all other components.

Parameters
lcc_tags
n_lccThe number of largest components that should be kept.

◆ mesh_improvement()

void wmtk::components::image_simulation::ImageSimulationMesh::mesh_improvement ( int  max_its = 80)

ops

energy check

sizing field

Update pre energies only if they are smaller than current energies. This helps to adjust the sizing field in case the energy alternates between two states.

◆ round()

bool wmtk::components::image_simulation::ImageSimulationMesh::round ( const Tuple loc)

Round a vertex position to floating point.

Only rounds the vertex position, if it does not cause inverted elements.

Returns
True if successful or already rounded, false otherwise.

◆ smooth_after()

bool wmtk::components::image_simulation::ImageSimulationMesh::smooth_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas for after smoothing a vertex.

Parameters
tTuple refering to a vertex
Returns
true if the preparation succeed

Reimplemented from wmtk::TetMesh.

◆ smooth_before()

bool wmtk::components::image_simulation::ImageSimulationMesh::smooth_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for smoothing a vertex.

Parameters
tTuple refering to a vertex Tuple
Returns
true if the preparation succeed

Reimplemented from wmtk::TetMesh.

◆ split_edge_after()

bool wmtk::components::image_simulation::ImageSimulationMesh::split_edge_after ( const Tuple t)
overridevirtual

This function computes the attributes for the added simplices. User specified modifications and desideratas for after an edge split.

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

check inversion & rounding

update quality

update vertex attribute

update face attribute

Reimplemented from wmtk::TetMesh.

◆ split_edge_before()

bool wmtk::components::image_simulation::ImageSimulationMesh::split_edge_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an edge split before changing the connectivity.

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

save face track info

Reimplemented from wmtk::TetMesh.

◆ swap_edge_44_after()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_44_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas for after a 4-4 edge swap.

Parameters
tedge Tuple that's swaped
Returns
true if the modification succeed

Reimplemented from wmtk::TetMesh.

◆ swap_edge_44_before()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_44_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an 4-4 edge swap before changing the connectivity.

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

Reimplemented from wmtk::TetMesh.

◆ swap_edge_44_energy()

double wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_44_energy ( const std::vector< std::array< size_t, 4 > > &  tets,
const int  op_case 
)
overridevirtual

User specified energy to decide which of the 4 possible orientations should be chosen.

Accepts the last shown orientation if not overridden.

Parameters
tetsNew tets after performing a 4-4 swap.
op_caseThe operation case, where 0 are the tets before swap.
Returns
energy The swap giving the tets with the lowest energy are chosen.

Reimplemented from wmtk::TetMesh.

◆ swap_edge_56_after()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_56_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas for after a 5-6 edge swap.

Parameters
tedge Tuple that's swaped
Returns
true if the modification succeed

There is no need to check for inversion or energy here. The operation would have been rejected already due to swap_edge_56_energy().

Reimplemented from wmtk::TetMesh.

◆ swap_edge_56_before()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_56_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for a 5-6 edge swap before changing the connectivity.

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

Reimplemented from wmtk::TetMesh.

◆ swap_edge_56_energy()

double wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_56_energy ( const std::vector< std::array< size_t, 4 > > &  tets,
const int  op_case 
)
overridevirtual

User specified energy to decide which of the 5 possible orientations should be chosen.

Accepts the last shown orientation if not overridden.

Parameters
tetsNew tets after performing a 5-6 swap.
op_caseThe operation case, where 0 are the tets before swap.
Returns
energy The swap giving the tets with the lowest energy are chosen.

Reimplemented from wmtk::TetMesh.

◆ swap_edge_after()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas for after a 3-2 edge swap.

Parameters
tedge Tuple that's swaped
Returns
true if the modification succeed

Reimplemented from wmtk::TetMesh.

◆ swap_edge_before()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_edge_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an 3-2 edge swap before changing the conenctivity.

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

Reimplemented from wmtk::TetMesh.

◆ swap_face_after()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_face_after ( const Tuple t)
overridevirtual

User specified modifications and desideratas for after a 2-3 face swap.

Parameters
tedge Tuple that's swaped
Returns
true if the modification succeed

Reimplemented from wmtk::TetMesh.

◆ swap_face_before()

bool wmtk::components::image_simulation::ImageSimulationMesh::swap_face_before ( const Tuple t)
overridevirtual

User specified preparations and desideratas for an 2-3 face swap befroe changing the geometry.

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

Reimplemented from wmtk::TetMesh.

◆ tag_priority()

void wmtk::components::image_simulation::ImageSimulationMesh::tag_priority ( const std::vector< int64_t > &  tags)

Gives tags priority over others.

If a tet has multiple tags, only the one with the highest priority will be kept. The priority is determined by the order of the tags in the input vector, e.g., if tag A is before tag B in the vector, then A has higher priority than B.

Parameters
tagsA vector of tags, where the order determines the priority.

◆ vertex_is_on_surface()

bool wmtk::components::image_simulation::ImageSimulationMesh::vertex_is_on_surface ( const size_t  vid) const
overridevirtual

Is a vertex part of the substructure.

Parameters
vidVertex ID

Reimplemented from wmtk::TetMesh.


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