Wildmeshing Toolkit
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | List of all members
wmtk::components::manifold_extraction::ManExtractTetMesh Class Reference
Inheritance diagram for wmtk::components::manifold_extraction::ManExtractTetMesh:
wmtk::components::topological_offset::TopoOffsetTetMesh wmtk::TetOptimizerMesh wmtk::TetMesh wmtk::RationalPositions

Public Member Functions

 ManExtractTetMesh (Parameters &_m_man_params, topological_offset::Parameters &_m_top_params, int _num_threads=0)
 
std::pair< size_t, size_t > label_non_manifold ()
 label nonmanifold simplices (edges and verts). Corresponding attributes have label set to 1
 
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 connected component
 
void edge_dfs_helper (std::set< size_t > &visited_tids, const Tuple &t) const
 dfs helper for edge manifold check
 
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 to the vertex form single face-reachable connected components, respectively. For vertices on the boundary of the mesh, external space is considered an 'outside' polyhedra that is face connected to all tets on the mesh boundary.
 
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
 
bool is_boundary_vertex (const Tuple &v) const
 determine if a vertex is on the boundary of the mesh
 
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.
 
void extract_surface_mesh (MatrixXd &V, MatrixXi &F)
 extract tri mesh separating 'inside' tets from 'outside' tets. Resulting mesh is guaranteed to be manifold.
 
void write_surface (const std::string &path)
 write surface (boundary of in_tag)
 
- Public Member Functions inherited from wmtk::components::topological_offset::TopoOffsetTetMesh
void classify_sheet_faces ()
 Mark the mesh faces that lie on the input's envelope surface group (FaceExtra::on_sheet).
 
void init_region_potentials (double delta, double effective_factor)
 
void assign_band_regions (bool log=true)
 
void log_front_profile (size_t vid)
 Diagnostic: the front objective of one vertex along its normal, offset term vs total.
 
int vertex_region (const size_t vid) const
 
int edge_region (const size_t va, const size_t vb) const
 
const OffsetPotential3D & potential_for_region (const int region) const
 
const OffsetPotential3D & potential_for (const size_t vid) const
 
std::shared_ptr< const OffsetPotential3D > potential_ptr_for (const size_t vid) const
 
const OffsetPotential3D & potential_for_edge (const size_t va, const size_t vb) const
 
const OffsetPotential3D & potential_for_face (const Tuple &f) const
 The field of the band cell a live offset face belongs to.
 
std::shared_ptr< SampleEnvelope > containment_for (uint64_t region_mask, bool on_offset) const
 The containment a simplex with this region mask, on/off the offset surface, must satisfy – the intersection of everything that holds it, or null if nothing does.
 
bool project_into_containment (size_t vid, Vector3d &x) const
 Move x back inside every region tube this vertex lies on. True if it ended up inside all of them. Alternating projection onto the worst-violated real member; never asks a composite (see TagEnvelopes.hpp).
 
bool phase_places_front () const
 
EnvelopeSetup envelope_setup () const
 
std::string envelope_key_name (int64_t tag) const
 The name a tag or pseudo-tag prints under.
 
bool face_is_complex_boundary (const Tuple &f) const
 
void build_boundary_envelopes (const char *when, EnvelopeSetup setup)
 
void rebuild_offset_envelope ()
 
void check_no_vertex_on_both_surfaces (const char *when) const
 
void optimize_offset_single_phase ()
 TetWild's loop, the front placed inside its smoothing passes.
 
double phase_b_front_gradient_linf ()
 
 TopoOffsetTetMesh (Parameters &_m_offset_params, int _num_threads=0)
 
double cell_quality (const size_t tid) const override
 The quality of cell tid, and how to write it.
 
void set_cell_quality (const size_t tid, const double q) override
 
void set_vertex_position (const size_t vid, const Vector3d &p)
 Place a vertex, keeping its exact and rounded coordinates in step.
 
bool face_is_offset (const size_t fid) const
 
bool face_is_region (const size_t fid) const
 
FaceSnapshot face_snapshot (const size_t fid) const
 
void restore_face (const size_t fid, const FaceSnapshot &s)
 
void label_offset_boundary ()
 Tag the two tracked surfaces for the optimization phase.
 
bool cell_in_region (const size_t tid) const
 
bool cell_is_input_complex (const size_t tid) const
 Whether tet tid is part of the INPUT complex the band wraps.
 
bool cell_is_offset_band (const size_t tid) const
 Whether tet tid is part of the offset BAND (as opposed to the input complex).
 
void optimize_offset (const std::filesystem::path &output_file)
 The 3D optimization phase: split / collapse / swap / smooth on the shared driver.
 
std::pair< double, double > compute_distance_deviation () const
 How far the offset surface is from where it should be: {max, avg} over vertices.
 
void log_worst_dist_vertex () const
 
bool face_is_offset_surface_live (const Tuple &f) const
 The band's outer surface, recomputed live rather than read from the cached class.
 
bool edge_is_offset_surface_live (size_t a, size_t b) const
 Whether edge (a, b) lies on the band's outer surface: some incident face does.
 
std::vector< std::array< size_t, 2 > > offset_surface_edges () const
 
std::vector< std::array< size_t, 3 > > offset_surface_faces () const
 Every live offset-surface face as a sorted vertex triple.
 
std::vector< Tuple > offset_surface_faces_live_at (size_t vid) const
 The live offset-surface faces incident to vid.
 
bool vertex_has_live_offset_face (size_t vid) const
 
void refresh_offset_membership (size_t vid)
 Re-derive m_is_on_offset for one vertex from the cell labels, exactly.
 
std::pair< size_t, size_t > offset_membership_mismatches () const
 
void check_offset_membership (const char *when) const
 
void report_offset_face_lookup_misses (const char *when) const
 
std::vector< char > offset_surface_foldover_labels () const
 Per-vertex 0/1: is this vertex an endpoint of a COLLAPSED (folded-over) offset surface edge? Debug-frame diagnostic; see write_vtu(). Costs one pass over the live offset faces, no field evaluation.
 
void write_debug_pvd () const
 
void flip_trace_record (double before, double after)
 
std::string flip_funnel_report () const
 
void flip_funnel_reset ()
 
bool marching_split_edge_before (const Tuple &t)
 
bool marching_split_edge_after (const Tuple &t)
 
bool edge_split_sphere_trace (const Vector3d &p_in, const Vector3d &p_out, Vector3d &p_new, size_t &steps) const
 Construction placement under sphere_trace_initialization: sphere tracing along the edge from p_in (the endpoint in the input complex, label != 0) towards p_out (the background endpoint) for the point where d(x) = target_distance, d(x) the distance to the input complex through m_input_complex_bvh. From t = 0 the trace evaluates d at the current point and steps forward by target_distance - d, the largest step that cannot cross the level set (d is 1-Lipschitz); it stops when |d - target_distance| <= sphere_trace_target_rel_tol x target_distance and returns true with p_new there. It returns false, p_new untouched, as soon as the current point reaches or passes p_out (t >= L: the level set is not on the edge) or would move behind p_in (d(p_in) already beyond the target); the caller then places the plain midpoint. Every step taken is longer than the tolerance, so the trace ends within L / (tol x target_distance) steps; steps returns how many it took. No snapping away from the endpoints: a point found arbitrarily close to p_out is used as is.
 
bool collapse_edge_before (const Tuple &t) override
 Reject any collapse that violates the substructure link condition, and remember the survivor's sizing for sizing_collapse_min = false.
 
bool collapse_edge_after (const Tuple &t) override
 The coarsening bar, the sizing restore and the rest re-stamp, after the base accepted.
 
bool collapse_before_vertex (size_t v1, size_t v2, double edge_length) override
 
bool collapse_after_connectivity (size_t v1, size_t v2, const std::vector< std::array< size_t, 2 > > &boundary_edges) override
 
bool collapse_is_order_2_edge (const std::array< size_t, 2 > &e) override
 
void collapse_after_vertex (size_t v1, size_t v2) override
 
bool swap_before_interior (const std::vector< size_t > &tids) override
 Which tag the tets a swap creates should carry, and the topology half of the surface-flip refusal (class match, mask match). The geometric half is the shared swap's containment check. See Optimize3d.cpp.
 
bool swap_before_surface (const std::vector< size_t > &tids, size_t a, size_t b, size_t c, size_t d) override
 
bool swap_after_cells (const std::vector< size_t > &tids, bool is_surface_flip) override
 Propagate application data to the cells made by a successful topological swap.
 
bool split_before_cells (const Tuple &edge, const std::vector< Tuple > &parents) override
 Split policy that is the offset's own: which region tag the two child tets inherit, and which of the two tracked surfaces the new vertex joined. See EdgeSplittingTet.cpp.
 
bool split_after_cells (size_t v1, size_t v2, size_t v_new, const std::vector< Tuple > &children) override
 Restore application cell data on the children made by a split.
 
bool split_adjust_position (size_t v_new, const std::vector< Tuple > &children) override
 
void split_after_vertex (size_t v_new, bool is_edge_open_boundary) override
 Application metadata not represented by the shared vertex attributes.
 
bool is_open_boundary_edge (const Tuple &e) override
 
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.
 
bool vertex_is_on_domain_boundary (const size_t vid) const
 Identification only – no operation refuses the domain wall through these.
 
bool face_is_on_domain_boundary (const size_t fid) const
 
void init_surfaces_and_boundaries ()
 Classify every region boundary, build the per-tag containment envelopes, and tag the domain wall – once, from the input mesh, before offset construction runs.
 
bool is_edge_on_region (const Tuple &loc)
 
bool is_edge_on_offset (const Tuple &loc)
 
void mark_input_complex_vertices ()
 
void warn_if_offset_reaches_domain_boundary () const
 Warn if the offset band has grown into the domain boundary.
 
double ring_max_quality (size_t vid) const
 
double tet_amips (const size_t tid) const
 AMIPS of one tet, the cube root of cell_quality(); the number every log line reports.
 
double tet_flatness (size_t tid) const
 Scale-invariant flatness: 6 * volume / longest_edge^3.
 
void needle_forensics () const
 The full post-mortem on why nothing removes the flat cells; see the 2D twin.
 
void record_flatness (const char *op, double parent_flat, size_t child_tid) const
 Genesis: flatness transitions recorded at the operation hooks. {op, parent, child}.
 
double face_resolution_or_inf (size_t a, size_t b, size_t c) const
 
bool ops_guard_refuses_collapse (size_t v1, size_t v2) const
 
std::array< size_t, 3 > face_vids (const Tuple &f) const
 The three corner ids of a face tuple.
 
void log_smooth_trace () const
 
void log_region_face_mask_health (const std::string &when) const
 
void audit_surface_containment (const std::string &when) const
 
bool vertex_is_on_region (const size_t vid) const
 
uint64_t tag_bits (const CellTag &tags) const
 The three helpers of the per-tag envelope dispatch.
 
uint64_t vertex_boundary_mask (const size_t vid) const
 
uint64_t face_mask (const std::array< size_t, 3 > &vids) const
 
uint64_t face_boundary_bits (const Tuple &f) const
 
std::shared_ptr< SampleEnvelope > envelope_for_mask (uint64_t mask) const
 
std::shared_ptr< SampleEnvelope > surface_envelope_for_face (const std::array< size_t, 3 > &vids) const override
 Class-0 faces – every region boundary, the input complex and the domain wall included – carry a containment requirement; the offset surface does not, except in Phase A where m_offset_envelope holds it where the last smoothing pass left it.
 
bool allow_surface_swap () const override
 
bool swap_quality_allowed (const double after, const double before, const bool is_surface_flip) const override
 
double swap_edge_44_energy (const std::vector< std::array< size_t, 4 > > &tets, const int op_case) override
 The absolute-bar rule again, one stage EARLIER, where the 4-4 and 5-6 swaps decide.
 
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_surface_flip_absolute_bar () const
 
bool check_surface_topology () const override
 
std::shared_ptr< SampleEnvelope > smoothing_energy_envelope (const size_t vid) const override
 The offset surface is the one tracked surface with no envelope, in either role.
 
std::shared_ptr< SampleEnvelope > smoothing_containment_envelope (const size_t vid) const override
 
bool smooth_front_vertex_phase_b (const Tuple &t)
 Phase B placement of a front vertex: the shared smoother with the offset's options, or the 1-D solve along the vertex's move direction under front_normal_projection. See FrontSmooth3d.cpp.
 
double front_vertex_normal_gradient (size_t vid) const
 
Vector3d front_vertex_move_direction (size_t vid) const
 
double front_move_alignment (size_t vid) const
 
bool front_vertex_alignment_traps_1d_solve (size_t vid) const
 
double front_vertex_conv_ratio (size_t vid) const
 
bool front_vertex_placed (size_t vid) const
 THE definition of "placed" for a vertex on the offset surface.
 
bool front_placed_by_ratio (const double ratio) const
 
double edge_conv_ratio (size_t a, size_t b) const
 
double face_conv_ratio (size_t a, size_t b, size_t c) const
 
Vector3d front_vertex_normal (size_t vid) const
 The field's unit direction at front vertex vid (zero where grad Phi vanishes).
 
std::shared_ptr< polysolve::nonlinear::Problem > phase_b_front_objective (size_t vid, const Vector3d &x) const
 
std::shared_ptr< polysolve::nonlinear::Problem > smoothing_extra_energy (const size_t vid) const override
 
std::shared_ptr< SampleEnvelope > released_envelope () const
 
bool face_borders_released_boundary (const Tuple &f) const
 
bool cell_is_deformable (size_t tid) const
 Under deform_others the same set as cell_is_plastic(): every cell outside the band.
 
bool cell_is_plastic (size_t tid) const
 
void stamp_plastic_rests ()
 Stamp rest := current for every plastic cell; called before every operation group.
 
bool smooth_plastic_vertex (const Tuple &t)
 The plastic vertex's smoothing: rest-shape AMIPS over its ring, nothing else.
 
bool cell_is_released_band (size_t tid) const
 
void stamp_rest_cell (size_t tid)
 
void release_deformable_regions ()
 
std::shared_ptr< polysolve::nonlinear::Problem > rest_energy_for_vertex (size_t vid) const
 
std::shared_ptr< polysolve::nonlinear::Problem > phase_b_front_energy (size_t vid, const std::shared_ptr< const OffsetPotential3D > &pot) const
 
std::tuple< double, double > optimization_quality_stats () override
 The loop's quality metric: TetWild's own outside Phase B, the max of AMIPS and the Phi residual (each over its own target) in Phase B. See the 2D twin.
 
double optimization_stop_metric () const override
 stop_energy outside Phase B, 1.0 in it – in the same units as the line above.
 
int stencil_order () const
 Samples per offset face; see offset_face_samples().
 
int stencil_points_per_face () const
 
double offset_residual_tolerance () const
 
double offset_gradient_tolerance () const
 
double gradient_reference () const
 The scale offset_gradient_tolerance() is a fraction of; 0 on the single-phase path.
 
void check_offset_within_support (const char *when) const
 
DistanceSplit distance_deviation_split () const
 
DistanceSplit residual_split () const
 The same split over the quantity the loop converges on: the Phi residual, as a length.
 
std::vector< bool > band_vertex_mask () const
 Which vertices lie on the band's outer surface. Shared by every measurement.
 
double max_band_vertex_distance () const
 
double band_vertex_distance_error (const size_t vid) const
 |dist(vid, input complex) - target_distance|. Diagnostic: the Euclidean offset.
 
double band_vertex_residual (const size_t vid) const
 How far vid is from the level set Phi = c, as a length.
 
template<typename Visit >
void for_each_face_sample (const Vector3d &p0, const Vector3d &p1, const Vector3d &p2, Visit &&visit) const
 The interior lattice a triangle is sampled on, handed to visit one point at a time as (point, wa, wb, wc) with the barycentric weights that built it: every (i, j, l) with i + j + l = k + 2 and each >= 1, so k = 1 is the centroid alone and the counts are 1, 3, 6, 10 for k = 1..4. Strictly interior – no sample ever lands on an edge or a corner, where the interpolant is exact by construction and the sag is identically zero.
 
template<typename Visit >
void for_each_offset_face_sample (const Tuple &f, Visit &&visit) const
 The same lattice over a face the mesh carries. Visitor signature as above.
 
FaceSamples offset_face_samples (const Tuple &f) const
 
GradientSplit gradient_split (bool include_face_samples=true) const
 
EnergyCriterion energy_criterion ()
 
double front_chord_target (size_t va, size_t vb, double len, double sag, double tube) const
 
size_t refine_front_by_halving (const std::vector< EnergyCriterion::Refinable > &faces)
 
void grade_sizing (double grade, const std::vector< size_t > &seeds)
 
size_t grade_sizing_by_distance (const std::vector< size_t > &seeds)
 
SmoothingProgress smoothing_progress (const std::vector< Vector3d > &before)
 Measure a pass: before holds every live vertex's position before it, indexed by vid.
 
void smooth_group_to_convergence (const char *group_name)
 
double edge_interpolation_residual (size_t a, size_t b) const
 The interpolation residual of front edge (a, b), see EnergyCriterion. -1 unmeasurable.
 
Vector3d offset_vertex_normal (const size_t vid) const
 
void report_outside_support (const char *when, const DistanceSplit &s) const
 Turn a residual_split()'s outside-support tally into the hard error.
 
bool band_vertex_is_reachable (const size_t vid) const
 
size_t refine_sizing_around_worst (double max_metric) override
 TetWild's stall-driven sizing refinement, verbatim; Phase A only. See the 2D twin.
 
void log_stuck_refine_census (double max_metric, double filter_energy)
 
void log_refine_block_census (const std::string &when, double filter_energy) const
 
bool collapse_quality_allowed (size_t v1, double q, double ring_max) const override
 Instrumentation only: which operation manufactures the MAX_ENERGY needles.
 
void report_needle (const char *op, size_t tid, double parent_q) const
 Where the first needles come from – a tripwire, capped at kNeedleReports.
 
void needle_scan (const char *when) const
 Population scan at a named moment. Reports the count and the worst few.
 
bool optimization_bare_coarsen_passes () const override
 
double face_criterion_rel (const Tuple &f) const
 
double cell_quality_rel (const size_t tid) const
 AMIPS of a cell over stop_energy – the 3D twin of TriOptimizerMesh::quality_rel().
 
double amips_rel_at_face (const Tuple &f) const
 ... and the worst of the (up to two) cells a face separates.
 
void write_optimization_debug_output (const std::string &path) override
 Put the optimization's frames on the run's single debug timeline (see write_debug_frame()), labelled "r<round><phase><pass>_<op>" / "r<round><phase>_end". Same scheme as 2D.
 
void append_frame_label (size_t idx, const std::string &label) const
 One line of <output>_frames.txt; truncates the file on the first frame.
 
void write_debug_frame (const std::string &label)
 One frame of the run's single debug timeline: <output>_NNNNN.vtu with the next sequence number, and one "NNNNN<tab>label" line in <output>_frames.txt. Every debug frame the run writes – the input as loaded, the construction stages, and the optimization's own frames through write_optimization_debug_output() – goes through this sequence, so the numbers are consecutive and the .txt says what each one is. The only debug files outside it are the ones that are not this mesh: <output>_input_complex.vtu and the phi grid.
 
void init_from_image (const MatrixXd &V, const MatrixXi &T, const MatrixSi &T_tags, const MatrixXd &V_env, const MatrixXi F_env, const std::vector< std::string > &tag_names, const std::string &sheet_name="")
 initialize TetMesh from vertex, tet, and tag data
 
bool ambient_assert ()
 check that the ambient tag does not overlap with any other tags
 
void label_input_complex ()
 label input simplicial complex simplices, as defined in m_offset_params.offset_selection
 
bool empty_input_complex ()
 check if the input complex is empty. Only valid after calling init_from_image(...).
 
void init_input_complex_bvh ()
 Build the input complex's BVH and keep the extraction the potential needs, and number the complex's connected pieces. Must be called after init_from_image(...) and label_input_complex().
 
void init_offset_potential ()
 Build the smooth offset potential from the extraction init_input_complex_bvh() kept.
 
size_t flood_fill ()
 label connected simplicial complex components (simplices labelled 1 or 2)
 
std::vector< std::array< size_t, 3 > > get_faces_by_condition (std::function< bool(const FaceAttributes &)> cond) const
 
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 &t) override
 This function computes the attributes for the added simplices. User specified modifications and desideratas for after an edge split.
 
bool split_face_before (const Tuple &t) override
 User specified preparations and desideratas for a face split before changing the connectivity.
 
bool split_face_after (const Tuple &t) override
 Compute the attributes for the added simplices.
 
bool split_tet_before (const Tuple &t) override
 User specified preparations and desideratas for a tet split before changing the connectivity.
 
bool split_tet_after (const Tuple &t) override
 Compute the attributes for the added simplices.
 
bool invariants (const std::vector< Tuple > &tets) override
 
void execute_offset (const std::filesystem::path &output_file)
 
void marching_tets ()
 
bool is_simplicially_embedded () const
 
bool tet_is_simp_emb (const Tuple &t) const
 
void simplicial_embedding ()
 
void set_offset_tet_tags ()
 update 'tags' data for tets in the offset region (tets labelled 2)
 
bool offset_is_manifold ()
 verify that the closed offset region (simplices labelled 1 or 2) form a manifold region.
 
void write_phi_grid (const std::string &path, int n) const
 
void write_input_complex (const std::string &path)
 
void write_vtu (const std::string &path)
 
void write_msh_groups (const std::string &file)
 
bool is_order_2_edge (const Tuple &e) const
 
bool is_order_2_edge (const std::array< size_t, 2 > &e) 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.
 
void compute_vertex_partition ()
 assign each vertex a partition id (by spatial Morton order). A no-op if NUM_THREADS == 0.
 
size_t get_partition_id (const Tuple &loc) const
 
std::vector< size_t > connected_components_helper (const size_t &v_id)
 all one-ring vertices through input simplices (labelled 1 or 2)
 
void reset_connected_components ()
 reset connected component assignments.
 
- Public Member Functions inherited from wmtk::TetOptimizerMesh
bool is_force_split_edge (const size_t v1, const size_t v2) const
 
 TetOptimizerMesh (OptimizerParameters &params, std::shared_ptr< SampleEnvelope > env)
 
virtual double quality_rel (const size_t tid) const
 A cell's quality relative to the quality it is required to reach; <= 1 means it meets it.
 
void compute_vertex_partition ()
 
void compute_vertex_partition_morton ()
 
size_t get_partition_id (const Tuple &loc) const
 
double get_length2 (const Tuple &l) const
 
bool is_inverted (const std::array< size_t, 4 > &vs) const
 
bool is_inverted (const Tuple &loc) const
 
bool is_inverted_f (const Tuple &loc) const
 Inversion check using only the double positions.
 
double get_quality (const std::array< size_t, 4 > &vs) const
 
double get_quality (const Tuple &loc) const
 
std::tuple< double, double > get_max_avg_energy ()
 
virtual void update_attributes ()
 Update the attributes of the mesh after an iteration of operations.
 
void mesh_improvement (int max_its=80)
 
std::tuple< double, double > local_operations (const std::array< int, 4 > &ops, bool collapse_limit_length=true)
 
bool round (const Tuple &v)
 Round a vertex position to floating point, if that inverts no incident tet.
 
bool is_edge_on_surface (const Tuple &loc)
 
bool is_edge_on_bbox (const Tuple &loc)
 
int edge_incident_surface_face_count (const Tuple &e)
 How many of the faces incident to edge e are on the tracked surface.
 
bool surface_triangle_is_outside (const size_t a, const size_t b, const size_t c) const
 
std::vector< std::array< size_t, 3 > > get_faces_by_condition (std::function< bool(const FaceAttributes &)> cond) const
 
void output_faces (std::string file, std::function< bool(const FaceAttributes &)> cond)
 
void gradation_smooth_sizing (double grade, const std::vector< size_t > &seeds)
 Grade the refined sizing region into its surroundings (monotone, only lowers).
 
double active_quality_threshold () const
 Cell-quality threshold above which a tet is "active" (worth operating on) for the skip-good-regions filter.
 
virtual std::vector< size_t > active_vertices () const
 
void split_all_edges ()
 
void collapse_all_edges (bool is_limit_length=true)
 
size_t coarsen_mesh ()
 Coarsen the mesh without letting the max energy rise.
 
bool coarsen_collapse_edge (const Tuple &e, std::vector< Tuple > &new_tets)
 One collapse under the coarsening rules, outside a coarsening pass.
 
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_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.
 
bool swap_edge_44_accept_case (const std::array< size_t, 2 > &new_edge) override
 Filter which of the 4-4 orientations may 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.
 
bool swap_edge_56_accept_case (const std::array< size_t, 3 > &new_face) override
 Filter which of the 5-6 orientations may 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_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 prepare_surface_flip (const Tuple &t, const std::vector< size_t > &incident_tets)
 
SurfaceTopoSignature surface_topology_signature () const
 
void warn_if_surface_topology_changed (const SurfaceTopoSignature &before, const char *where) const
 
void smooth_all_vertices (const size_t n_iters=1)
 
- 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, 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< Tuple > get_edges () const
 
std::vector< Tuple > get_faces () const
 
std::vector< Tuple > get_vertices () const
 
std::vector< Tuple > get_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
 
void set_preallocation_factor (double factor)
 Preallocation factor: init/consolidate reserve capacity = max(floor, ceil(factor * live_count)) so operations can grab fresh slots without resizing the storage. When a pass exhausts the reserved capacity the affected operations fail (and are retried later after a consolidate). Tune per application (e.g. from JSON); values < 1 are clamped to 1.
 
double preallocation_factor () const
 
bool slots_exhausted () const
 
void clear_slots_exhausted ()
 
size_t request_tet_slots (size_t n)
 
size_t request_vert_slots (size_t n)
 
void ensure_free_tet_capacity (size_t extra)
 
void ensure_free_vert_capacity (size_t extra)
 
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::optional< std::tuple< Tuple, size_t > > try_tuple_from_face (const std::array< size_t, 3 > &vids) const
 tuple_from_face for callers where a missing face is an answer, not a bug.
 
size_t lowest_common_tet (size_t v0_id, size_t v1_id, size_t v2_id) const
 Lowest tet id incident to all three vertices, or size_t(-1) if there is none.
 
size_t vertex_valence (const size_t vid) const
 Number of tets incident to a vertex, in O(1).
 
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::Face simplex_from_face (const Tuple &t) 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< Tuple > switch_tetrahedron (const Tuple &t) const
 wrapper function from Tuple::switch_tetrahedron
 
std::vector< Tuple > get_one_ring_tets_for_vertex (const Tuple &t) const
 Get the one ring tets for a vertex.
 
const std::vector< size_t > & get_one_ring_tids_for_vertex (const Tuple &t) const
 Get the one ring tids for vertex.
 
const std::vector< size_t > & get_one_ring_tids_for_vertex (const size_t vid) const
 
std::vector< Tuple > get_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< Tuple > get_incident_tets_for_edge (const Tuple &t) const
 Get the incident tets for edge.
 
std::vector< Tuple > get_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< Tuple > get_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 ()
 
int release_vertex_mutex_to (size_t mark)
 Release the mutexes taken since the release stack held mark entries.
 
bool try_set_vertex_mutex_n_ring (const Tuple &v, int threadid, int n)
 Lock every vertex within graph distance n of v, the seed included.
 
bool try_set_vertex_mutex_n_ring (size_t vid, int threadid, int n)
 
bool try_set_edge_mutex_n_ring (const Tuple &e, int threadid, int n)
 try_set_vertex_mutex_n_ring seeded from both ends of an edge.
 
bool try_set_face_mutex_n_ring (size_t v1, size_t v2, size_t v3, int threadid, int n)
 try_set_vertex_mutex_n_ring seeded from the three vertices of a face.
 
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.
 
size_t tet_storage_capacity () const
 
size_t vert_storage_capacity () const
 
bool try_set_vertex_mutex_two_ring (const Tuple &v, int threadid)
 Lock v's one-ring and, partially, its two-ring. See the note above.
 
bool try_set_vertex_mutex_two_ring_vid (const Tuple &v, int threadid)
 try_set_vertex_mutex_two_ring reached through vids rather than Tuples.
 
bool try_set_vertex_mutex_two_ring_vid (size_t v, int threadid)
 try_set_vertex_mutex_two_ring reached through vids rather than Tuples.
 
bool try_set_edge_mutex_two_ring (const Tuple &e, int threadid=0)
 Lock the edge's one-ring and, partially, its two-ring. See the note above.
 
bool try_set_face_mutex_two_ring (const Tuple &f, int threadid=0)
 Lock the face's one-ring and, partially, its two-ring. See the note above.
 
bool try_set_face_mutex_two_ring (const Tuple &v1, const Tuple &v2, const Tuple &v3, int threadid=0)
 Lock the face's one-ring and, partially, its two-ring. See the note above.
 
bool try_set_face_mutex_two_ring (size_t v1, size_t v2, size_t v3, int threadid=0)
 Lock the face's one-ring and, partially, its two-ring. See the note above.
 
bool try_set_vertex_mutex_one_ring (const Tuple &v, int threadid=0)
 Lock v and its one-ring. Complete, unlike the two-ring family.
 
size_t cell_capacity () const
 
Tuple tuple_from_cell (size_t cid) const
 
- Public Member Functions inherited from wmtk::RationalPositions
size_t round_all_vertices ()
 Try to round every un-rounded vertex; returns the number reclaimed.
 
bool round_and_check_all_rounded ()
 Run the sweep, then report whether the mesh is now fully rounded.
 

Public Attributes

int m_vtu_counter = 0
 
int m_surfvtu_counter = 0
 
Parameters & m_man_params
 
- Public Attributes inherited from wmtk::components::topological_offset::TopoOffsetTetMesh
std::array< size_t, 4 > m_init_counts = {{0, 0, 0, 0}}
 
size_t m_tags_count
 
int64_t m_sheet_tag = -1
 
MatrixXd m_sheet_V
 The surface group as loaded, kept because the classification below is redone on demand.
 
MatrixXi m_sheet_F
 
std::shared_ptr< SimplicialComplexBVH > m_input_complex_bvh
 The input complex as loaded. Built once, never rebuilt.
 
std::shared_ptr< OffsetPotential3D > m_offset_potential
 The smooth offset potential, and with it the definition of the offset itself.
 
std::shared_ptr< SampleEnvelope > m_input_complex_envelope
 The exact-kind envelope of the input complex, built only for offset_field "euclidean". Null otherwise.
 
int m_n_regions = 0
 One field per connected piece of the input complex, and which one each band vertex is placed on. See TopoOffsetTriMesh::m_region_potentials for the full argument.
 
std::vector< std::shared_ptr< OffsetPotential3D > > m_region_potentials
 
std::vector< std::shared_ptr< SimplicialComplexBVH > > m_region_bvhs
 
std::vector< int64_t > m_phi_vert_region
 per m_phi_V row: region index
 
std::vector< int64_t > m_phi_seg_region
 per m_phi_E row: region index, -1 unknown
 
std::vector< int64_t > m_phi_face_region
 per m_phi_F row: region index, -1 unknown
 
std::vector< int64_t > m_phi_point_region
 per m_phi_P entry: region index, -1 unknown
 
std::vector< int > m_cell_region
 per tet: band's region, -1 none, -2 reached from two
 
std::vector< int > m_vertex_region
 per vertex: region of its band cells, -1 / -2 as above
 
std::map< int64_t, std::shared_ptr< SampleEnvelope > > m_tag_envelopes
 One containment envelope per input tag, ambient included. Both phases.
 
std::map< int64_t, int > m_tag_bit
 
std::map< uint64_t, std::shared_ptr< SampleEnvelope > > m_isect_cache
 
std::mutex m_isect_mutex
 
std::map< uint64_t, std::shared_ptr< SampleEnvelope > > m_offset_isect_cache
 Memoized "region tubes AND the offset envelope", keyed by the region mask.
 
OptPhase m_phase = OptPhase::A
 Which phase is running. Read by every hook that differs between them; see OptPhase.
 
bool m_freeze_front = false
 The final Phase A: front vertices are not smoothed (see smooth_before()).
 
std::shared_ptr< SampleEnvelope > m_offset_envelope
 The tube the offset surface may not leave during the operation passes, of half-width offset_envelope. Rebuilt after every smoothing pass from the surface as that pass left it, which is what lets the surface travel across turns. Non-null once the offset exists; whether it constrains is containment_for()'s phase test. Unlike m_tag_envelopes, which must never be rebuilt.
 
double m_front_gradient_reference = 0.
 
EdgeSplitMode m_edge_split_mode = EdgeSplitMode::Midpoint
 
std::map< std::string, int64_t > m_tag_name_to_id
 
std::map< int64_t, std::string > m_tag_id_to_name
 
CellTag m_offset_output_tag_ids
 
bool m_singlebody = false
 
int64_t m_single_tag
 
bool m_has_envelope = false
 
MatrixXd m_V_envelope
 
MatrixXi m_F_envelope
 
double m_envelope_eps = -1
 
Parameters & m_offset_params
 The base holds only wmtk::OptimizerParameters; this is the same object, typed.
 
VertexExtraCol m_vertex_extra
 
FaceExtraCol m_face_extra
 
EdgeAttCol m_edge_attribute
 
TetAttCol m_tet_attribute
 
size_t m_worst_dist_vid = static_cast<size_t>(-1)
 
std::atomic< long long > m_offset_face_lookup_misses {0}
 Faces that vertex_has_live_offset_face() / offset_surface_faces_live_at() asked for and the connectivity did not have.
 
std::atomic< long long > m_offset_face_invalid_tuple {0}
 
std::vector< std::array< double, 8 > > optimization_metrics
 
std::vector< std::array< int, 3 > > churn_counts
 
std::vector< std::array< int, 3 > > op_counts
 {splits, collapses, swaps} per turn, as deltas rather than running totals.
 
int m_ab_round = 0
 
size_t m_debug_seq = 0
 Monotonic frame counter for the debug timeline.
 
std::vector< std::string > m_debug_frame_labels
 
std::map< std::string, std::vector< size_t > > m_debug_pvd_series
 
int m_debug_pass = 0
 
int m_debug_last_round = -1
 
char m_debug_last_phase = '?'
 
double m_gradient_reference = 0.
 See offset_gradient_tolerance(). Nothing sets it on the single-phase path; it stays 0.
 
bool m_converged = false
 
bool m_quality_converged = true
 
double m_quality_max_amips = 0.
 
std::atomic< int > iter_cnt_split_born {0}
 
std::atomic< int > iter_cnt_recollapsed {0}
 
std::atomic< int > iter_cnt_recollapsed_same_pass {0}
 
std::atomic< int > iter_cnt_split = 0
 
std::atomic< int > iter_cnt_collapse = 0
 
std::atomic< int > iter_cnt_swap = 0
 
std::atomic< int > iter_cnt_collapse_offset_removed {0}
 
std::atomic< int > iter_cnt_collapse_offset_reject {0}
 Operations refused because they would have left an offset-surface face over tolerance.
 
std::atomic< int > iter_cnt_swap_offset_reject {0}
 
std::atomic< int > iter_cnt_collapse_guard_reject {0}
 
std::atomic< int > iter_cnt_swap_guard_reject {0}
 
std::atomic< long long > flip_trace_n {0}
 accepted offset-surface flips
 
std::atomic< long long > flip_trace_nonmono
 fall not > 0: MUST stay 0, the rule forbids it
 
std::atomic< long long > flip_trace_bar {0}
 
std::array< std::atomic< long long >, 8 > flip_trace_dec {}
 
std::atomic< long long > funnel_offered {0}
 [flip funnel]: of the surface flips the guard judged worth doing, how many survive each later stage. Reset per turn and reported next to [swap reject].
 
std::array< std::atomic< long long >, 3 > funnel_kind {}
 offered, split by swap kind: [0] = 3-2, [1] = 4-4, [2] = 5-6.
 
std::atomic< long long > funnel_cases {0}
 
std::atomic< long long > funnel_case_inf {0}
 
std::atomic< long long > funnel_case_over {0}
 
std::atomic< long long > funnel_case_ok {0}
 
std::atomic< long long > funnel_quality {0}
 
std::atomic< long long > funnel_quality_ok {0}
 
std::atomic< long long > funnel_committed {0}
 
std::atomic< long long > funnel_under_margin {0}
 
std::atomic< int > iter_cnt_split_offset_before {0}
 Splits of an offset-surface edge: offered, accepted.
 
std::atomic< int > iter_cnt_split_offset {0}
 
wmtk::threading::enumerable_thread_specific< OptSplitCache > m_opt_split_cache
 
size_t m_marching_root_splits = 0
 
size_t m_marching_midpoint_splits = 0
 
size_t m_marching_trace_steps = 0
 
size_t m_marching_trace_steps_max = 0
 
SmoothTrace m_smooth_trace
 
wmtk::threading::enumerable_thread_specific< std::pair< double, Vector3d > > m_needle_pre
 Why smoothing does not repair a sliver in its one-ring. Same counters as 2D: offered / reached / fixed / stationary. See TopoOffsetTriMesh::m_needle_pre.
 
std::atomic< size_t > m_needle_smooth_offered {0}
 
std::atomic< size_t > m_needle_smooth_reached {0}
 
std::atomic< size_t > m_needle_smooth_fixed {0}
 
std::atomic< size_t > m_needle_smooth_stationary {0}
 
std::atomic< size_t > m_needle_smooth_reports {0}
 
std::atomic< size_t > m_flat_created_split {0}
 
std::atomic< size_t > m_flat_created_collapse {0}
 
std::atomic< size_t > m_flat_worsened_split {0}
 
std::atomic< size_t > m_flat_genesis_reports {0}
 
wmtk::threading::enumerable_thread_specific< double > m_collapse_parent_flatness
 The flattest tet in the collapse's ring before it ran, for record_flatness().
 
wmtk::threading::enumerable_thread_specific< double > m_collapse_survivor_sizing
 
wmtk::threading::enumerable_thread_specific< std::vector< size_t > > m_collapse_edge_link
 The link of the collapsed edge, captured in collapse_before_vertex().
 
std::atomic< int > m_placement_env_entry_outside {0}
 
std::atomic< int > m_placement_projected {0}
 
std::atomic< int > m_placement_tangential {0}
 
size_t m_front_gradient_worst_vid
 
std::set< int64_t > m_deform_tags
 The released tags. Filled by release_deformable_regions(); empty = feature inactive.
 
std::set< int64_t > m_source_tags
 
std::shared_ptr< SampleEnvelope > m_released_envelope
 
std::atomic< bool > m_released_tube_dirty {false}
 
std::mutex m_released_mutex
 
bool m_plastic_active = false
 set in optimize_offset() when deform_others
 
std::optional< EnergyCriterion > m_energy_verdict
 
std::atomic< size_t > m_deg_split_created {0}
 
std::atomic< size_t > m_deg_collapse_offered {0}
 
std::atomic< size_t > m_deg_collapse_allowed {0}
 
std::atomic< size_t > m_deg_collapse_by_ringmax {0}
 
std::atomic< size_t > m_deg_collapse_by_stop {0}
 
std::atomic< size_t > m_deg_collapse_by_unrounded {0}
 
std::array< size_t, 6 > m_deg_prev_counts {{0, 0, 0, 0, 0, 0}}
 
std::atomic< size_t > m_needle_reports {0}
 
std::set< std::tuple< long, long, long > > m_stuck_prev_cells
 
size_t m_stuck_calls = 0
 
MatrixXd m_phi_V
 
MatrixXi m_phi_E
 
MatrixXi m_phi_F
 
std::vector< int > m_phi_P
 
- Public Attributes inherited from wmtk::TetOptimizerMesh
VertAttCol m_vertex_attribute
 
FaceAttCol m_face_attribute
 
AttributeContainerGroup m_vertex_attr_group
 What p_vertex_attrs points at, so a derived class can register more.
 
AttributeContainerGroup m_face_attr_group
 What p_face_attrs points at, so a derived class can register more.
 
OptimizerParameters & m_params
 
std::shared_ptr< SampleEnvelope > m_envelope
 Surface envelope: what a surface vertex is pulled toward and checked against.
 
double m_s_amips = 1.
 
double m_s_envelope = -1.
 
double time_env = 0.0
 
igl::Timer isout_timer
 
wmtk::threading::enumerable_thread_specific< std::unique_ptr< polysolve::nonlinear::Solver > > m_solver
 Per-thread Newton solver for smoothing; created on first use.
 
optimization::SmoothRejectCounters m_smooth_rejects
 Why smoothing attempts were refused, reported once per pass.
 
bool m_collapse_limit_length = true
 
std::set< simplex::Edge > m_force_split_edges
 
size_t m_force_split_count = 0
 Force-splits taken in the current split pass. Diagnostic only.
 
std::unique_ptr< std::atomic< int >[]> m_high_valence_claim
 Per-pass claims for the shared high-valence split gate.
 
size_t m_high_valence_claim_size = 0
 
std::atomic< size_t > m_high_valence_rejects = 0
 
int m_iterations_used = 0
 Shared TetWild/SimWild outer optimization schedule.
 
int m_debug_print_counter = 0
 
std::string m_debug_pass_name
 
CoarsenStats m_coarsen_stats
 
std::atomic< int > cnt_swap = 0
 
std::atomic< int > cnt_surface_swap = 0
 
std::atomic< int > cnt_surface_swap_32 = 0
 
std::atomic< int > cnt_surface_swap_44 = 0
 
std::atomic< int > cnt_surface_swap_56 = 0
 
- Public Attributes inherited from wmtk::TetMesh
AbstractAttributeContainer * p_vertex_attrs = nullptr
 
AbstractAttributeContainer * p_edge_attrs = nullptr
 
AbstractAttributeContainer * p_face_attrs = nullptr
 
AbstractAttributeContainer * p_tet_attrs = nullptr
 
bool m_collapse_check_link_condition = true
 
bool m_collapse_check_topology = false
 
bool m_collapse_check_manifold = true
 
wmtk::threading::enumerable_thread_specific< std::vector< size_t > > mutex_release_stack
 
wmtk::threading::enumerable_thread_specific< std::vector< size_t > > get_one_ring_cache
 
int NUM_THREADS = 0
 

Private Member Functions

bool is_surface_vertex (const Tuple &v) const
 
bool is_surface_edge (const Tuple &e) const
 
bool is_surface_face (const Tuple &f) const
 
bool is_interior_tet (const Tuple &t) const
 
bool is_interior_tet (const size_t &t_id) const
 

Additional Inherited Members

- Public Types inherited from wmtk::components::topological_offset::TopoOffsetTetMesh
enum class  EdgeSplitMode { Midpoint = 0 , SphereTrace = 1 , Optimization = 5 }
 
enum class  OptPhase { A , B , Single }
 Which mode the hooks are running in. The 3D copy of TopoOffsetTriMesh::OptPhase. More...
 
enum class  EnvelopeSetup { PerTag , WallComplex }
 Which boundaries the region-class envelopes hold, and how they are built. More...
 
using VertexExtraCol = wmtk::AttributeCollection< VertexExtra >
 
using EdgeAttCol = wmtk::AttributeCollection< EdgeAttributes >
 
using FaceExtraCol = wmtk::AttributeCollection< FaceExtra >
 
using TetAttCol = wmtk::AttributeCollection< TetAttributes >
 
- Public Types inherited from wmtk::TetOptimizerMesh
using FaceAttributes = wmtk::SurfaceTagAttributes
 
using VertAttCol = AttributeCollection< VertexAttributes >
 
using FaceAttCol = AttributeCollection< FaceAttributes >
 
using SurfaceTopoSignature = wmtk::utils::SurfaceTopoSignature
 
- Public Types inherited from wmtk::TetMesh
template<typename T >
using vector = std::vector< T >
 
using VertexMutex = wmtk::threading::VertexMutex
 
- Static Public Attributes inherited from wmtk::components::topological_offset::TopoOffsetTetMesh
static constexpr int64_t m_wall_tag = -2
 pseudo-tag: the domain wall's tube
 
static constexpr int64_t m_complex_tag = -3
 
static constexpr int INPUT_SURFACE_CLASS = 0
 SurfaceTagAttributes::m_surface_class: which of the two tracked surfaces a face belongs to. Same scheme as 2D.
 
static constexpr int OFFSET_SURFACE_CLASS = 1
 
static constexpr long long kFlipTraceEvery = 20000
 
static constexpr double kFlatThreshold = 1e-3
 
static constexpr size_t kNeedleReports = 12
 
static constexpr double kNeedleQuality = 1e6
 What counts as a needle for the tripwire, in AMIPS – deliberately far below MAX_ENERGY.
 
- Static Public Attributes inherited from wmtk::TetOptimizerMesh
static constexpr double MAX_ENERGY = 1e50
 The sentinel get_quality returns for an element AMIPS cannot score.
 
- Static Public Attributes inherited from wmtk::TetMesh
static constexpr int EDGES_PER_CELL = 6
 
static constexpr int FACES_PER_CELL = 4
 
- Protected Types inherited from wmtk::TetOptimizerMesh
enum class  SwapReject : int {
  base_before , valence , bbox , surface_not_allowed ,
  prepare_flip , interior_hook , flip_open_boundary , flip_not_two_surf ,
  flip_nonmanifold_edge , flip_cd_nonmanifold , flip_new_face_surface , flip_app_refused ,
  flip_wrong_case , app_capture_label , app_capture_tag , app_fid_missing ,
  app_class_mismatch , app_mask_mismatch , app_sag_raised , after_inverted ,
  after_quality , after_cells , after_envelope , COUNT
}
 
enum class  SwapStage : int {
  attempt , surface_attempt , before_pass , after_enter ,
  accepted , COUNT
}
 
- Protected Member Functions inherited from wmtk::TetOptimizerMesh
std::vector< size_t > all_vertex_ids () const override
 Every live vertex, in the mesh's own iteration order.
 
bool vertex_is_rounded (const size_t vid) const override
 Whether this vertex's double position is currently trusted.
 
bool round_vertex (const size_t vid) override
 
virtual void optimization_sanity_checks_extra ()
 
virtual bool optimization_stop_at_float () const
 
virtual bool optimization_stalled (double prev, double cur)
 Whether an iteration that moved the metric from prev to cur is stalled, and the sizing refinement should therefore fire.
 
bool swap_reject (SwapReject r) const
 
void swap_stage (SwapStage s) const
 
void swap_counters_reset ()
 
std::string swap_reject_report () const
 One line per nonzero counter, for a per-turn log. Does not reset.
 
- 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 > > &)
 
void resize_vertex_mutex (size_t v)
 
- Static Protected Member Functions inherited from wmtk::TetOptimizerMesh
static const char * swap_reject_name (SwapReject r)
 
static const char * swap_stage_name (SwapStage s)
 
- Protected Attributes inherited from wmtk::TetOptimizerMesh
uint32_t m_op_epoch = 0
 
std::array< std::atomic< long >, size_t(SwapReject::COUNT)> m_swap_reject {}
 
std::array< std::atomic< long >, size_t(SwapStage::COUNT)> m_swap_stage {}
 
wmtk::threading::enumerable_thread_specific< SwapInfoCache > swap_cache
 
wmtk::threading::enumerable_thread_specific< SplitInfoCache > split_cache
 
wmtk::threading::enumerable_thread_specific< CollapseInfoCache > collapse_cache
 
bool m_coarsen_mode = false
 Set for the duration of coarsen_mesh(); read-only while a pass is running.
 
- Protected Attributes inherited from wmtk::RationalPositions
std::atomic< bool > m_all_rounded = false
 True when every vertex is known to be rounded.
 

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