15 const auto &reset_edge_attrs = [&](
const Tuple &e) {
16 edge_attr(e.eid(*
this)).op_attempts = 0;
17 edge_attr(e.eid(*
this)).op_depth = 0;
23 const bool split = args[
"split"][
"enabled"];
24 const bool collapse = args[
"collapse"][
"enabled"];
25 const bool swap = args[
"swap"][
"enabled"];
26 const bool smooth = args[
"smooth"][
"enabled"];
28 wmtk::logger().set_level(
logger().level());
38 executor.renew_neighbor_tuples = [&](
const WildRemesher &m, std::string op,
const std::vector<Tuple> &tris) ->
Operations {
42 static int aggregate_split_cnt_success = 0;
43 static int aggregate_split_cnt_fail = 0;
44 static int aggregate_collapse_cnt_success = 0;
45 static int aggregate_collapse_cnt_fail = 0;
46 static int aggregate_swap_cnt_success = 0;
47 static int aggregate_swap_cnt_fail = 0;
48 static int aggregate_smooth_cnt_success = 0;
49 static int aggregate_smooth_cnt_fail = 0;
52 static int frame_count = 0;
54 write_mesh(state.resolve_output_path(fmt::format(
"op{:d}.vtu", frame_count++)));
63 logger().info(
"Splitting");
65 cnt_success += executor.cnt_success();
66 aggregate_split_cnt_success += executor.cnt_success();
67 aggregate_split_cnt_fail += executor.cnt_fail();
69 write_mesh(state.resolve_output_path(fmt::format(
"op{:d}.vtu", frame_count++)));
74 WMTKMesh::for_each_edge(reset_edge_attrs);
76 bool projection_needed =
false;
80 logger().info(
"Collapsing");
81 executor.m_cnt_success = 0;
82 executor.m_cnt_fail = 0;
84 cnt_success += executor.cnt_success();
85 aggregate_collapse_cnt_success += executor.cnt_success();
86 aggregate_collapse_cnt_fail += executor.cnt_fail();
87 projection_needed |= executor.cnt_success() > 0;
89 write_mesh(state.resolve_output_path(fmt::format(
"op{:d}.vtu", frame_count++)));
94 WMTKMesh::for_each_edge(reset_edge_attrs);
100 executor.m_cnt_success = 0;
101 executor.m_cnt_fail = 0;
103 cnt_success += executor.cnt_success();
104 aggregate_swap_cnt_success += executor.cnt_success();
105 aggregate_swap_cnt_fail += executor.cnt_fail();
106 projection_needed |= executor.cnt_success() > 0;
108 write_mesh(state.resolve_output_path(fmt::format(
"op{:d}.vtu", frame_count++)));
115 logger().info(
"Smoothing");
116 executor.m_cnt_success = 0;
117 executor.m_cnt_fail = 0;
119 cnt_success += executor.cnt_success();
120 aggregate_smooth_cnt_success += executor.cnt_success();
121 aggregate_smooth_cnt_fail += executor.cnt_fail();
122 projection_needed |= executor.cnt_success() > 0;
124 write_mesh(state.resolve_output_path(fmt::format(
"op{:d}.vtu", frame_count++)));
128 logger().info(
"[split] aggregate_cnt_success {} aggregate_cnt_fail {}", aggregate_split_cnt_success, aggregate_split_cnt_fail);
129 logger().info(
"[collapse] aggregate_cnt_success {} aggregate_cnt_fail {}", aggregate_collapse_cnt_success, aggregate_collapse_cnt_fail);
130 logger().info(
"[swap] aggregate_cnt_success {} aggregate_cnt_fail {}", aggregate_swap_cnt_success, aggregate_swap_cnt_fail);
131 logger().info(
"[smooth] aggregate_cnt_success {} aggregate_cnt_fail {}", aggregate_smooth_cnt_success, aggregate_smooth_cnt_fail);
133 if (projection_needed)
134 project_quantities();
136 write_mesh(state.resolve_output_path(fmt::format(
"op{:d}.vtu", frame_count++)));
140 WMTKMesh::consolidate_mesh();
145 return cnt_success > 0;