Wildmeshing Toolkit
Loading...
Searching...
No Matches
ManExtractTetMesh.h
1#pragma once
2
3#include <wmtk/components/topological_offset/Parameters.h>
4#include <wmtk/components/topological_offset/TopoOffsetTetMesh.h>
5#include <wmtk/simplex/Simplex.hpp>
6#include "Parameters.h"
7
8using namespace wmtk::components;
9
10
11namespace wmtk::components::manifold_extraction {
12
13
15{
16public:
17 int m_vtu_counter = 0;
18 int m_surfvtu_counter = 0;
19
20 Parameters& m_man_params;
21
23 Parameters& _m_man_params,
24 topological_offset::Parameters& _m_top_params,
25 int _num_threads = 0)
26 : topological_offset::TopoOffsetTetMesh(_m_top_params, _num_threads)
27 , m_man_params(_m_man_params)
28 {}
29
31
32public:
37 std::pair<size_t, size_t> label_non_manifold(); // return # of non manifold edges, verts
38
43 bool edge_is_manifold(const Tuple& t) const;
44
48 void edge_dfs_helper(std::set<size_t>& visited_tids, const Tuple& t) const;
49
56 bool vertex_is_manifold(const Tuple& t) const;
57
62 std::set<size_t>& visited_tids,
63 const Tuple& t,
64 const bool include,
65 const std::vector<simplex::Face>& b_out_faces) const;
66
70 bool is_boundary_vertex(const Tuple& v) const;
71
75 std::vector<simplex::Face> get_boundary_faces_for_out_tets(size_t vid) const;
76
81 void extract_surface_mesh(MatrixXd& V, MatrixXi& F);
82
86 void write_surface(const std::string& path);
87
88private: // helpers
89 bool is_surface_vertex(const Tuple& v) const;
90 bool is_surface_edge(const Tuple& e) const;
91 bool is_surface_face(const Tuple& f) const;
92 bool is_interior_tet(const Tuple& t) const;
93 bool is_interior_tet(const size_t& t_id) const;
94};
95
96} // namespace wmtk::components::manifold_extraction
a Tuple refers to a global vid and a global tet id, and a local edge id and local face id
Definition TetMesh.h:48
bool is_boundary_vertex(const Tuple &v) const
determine if a vertex is on the boundary of the mesh
Definition ManExtractTetMesh.cpp:301
void vertex_dfs_helper(std::set< size_t > &visited_tids, const Tuple &t, const bool include, const std::vector< simplex::Face > &b_out_faces) const
dfs helper for vertex manifold check
Definition ManExtractTetMesh.cpp:252
void extract_surface_mesh(MatrixXd &V, MatrixXi &F)
extract tri mesh separating 'inside' tets from 'outside' tets. Resulting mesh is guaranteed to be man...
Definition ManExtractTetMesh.cpp:346
bool vertex_is_manifold(const Tuple &t) const
check if a vertex is manifold. A vertex is manifold if all 'inside' and all 'outside' tets adjacent t...
Definition ManExtractTetMesh.cpp:192
std::pair< size_t, size_t > label_non_manifold()
label nonmanifold simplices (edges and verts). Corresponding attributes have label set to 1
Definition ManExtractTetMesh.cpp:91
bool edge_is_manifold(const Tuple &t) const
check if an edge is manifold, ie if all 'inside' tets adjacent to the edge form single face-reachable...
Definition ManExtractTetMesh.cpp:129
void write_surface(const std::string &path)
write surface (boundary of in_tag)
Definition ManExtractTetMesh.cpp:440
std::vector< simplex::Face > get_boundary_faces_for_out_tets(size_t vid) const
collect faces on the boundary of the mesh that belong to an 'outside' tet.
Definition ManExtractTetMesh.cpp:323
void edge_dfs_helper(std::set< size_t > &visited_tids, const Tuple &t) const
dfs helper for edge manifold check
Definition ManExtractTetMesh.cpp:170