23 std::vector<Vector2r> v_final;
24 std::vector<std::array<int64_t, 3>> FV_new;
25 std::vector<std::array<int, 3>> local_e_on_input;
29 edge_insertion(bg_mesh, input_mesh, v_final, FV_new, local_e_on_input);
38 V.resize(v_final.size(), 2);
39 FV.resize(FV_new.size(), 3);
41 for (int64_t i = 0; i < v_final.size(); ++i) {
42 V.row(i) = v_final[i];
45 for (int64_t i = 0; i < FV_new.size(); ++i) {
46 FV(i, 0) = FV_new[i][0];
47 FV(i, 1) = FV_new[i][1];
48 FV(i, 2) = FV_new[i][2];
52 std::vector<bool> v_is_used(V.rows(),
false);
53 for (int64_t i = 0; i < FV.rows(); ++i) {
54 for (int64_t j = 0; j < 3; ++j) {
55 v_is_used[FV(i, j)] =
true;
59 std::map<int64_t, int64_t> v_map;
61 for (
auto b : v_is_used) {
70 V_valid.resize(used_cnt, 2);
71 int64_t valid_row = 0;
72 for (int64_t i = 0; i < V.rows(); ++i) {
74 V_valid.row(valid_row) = V.row(i);
80 FV_valid.resize(FV.rows(), 3);
81 for (int64_t i = 0; i < FV.rows(); ++i) {
82 for (int64_t j = 0; j < 3; ++j) {
83 FV_valid(i, j) = v_map[FV(i, j)];
87 std::shared_ptr<wmtk::TriMesh> m = std::make_shared<wmtk::TriMesh>();
88 m->initialize(FV_valid);
93 auto input_accessor = m->create_accessor<int64_t>(input_handle);
97 for (int64_t i = 0; i < triangles.size(); ++i) {
98 const auto& e01 = triangles[i];
102 input_accessor.scalar_attribute(e01) = local_e_on_input[i][2];
103 input_accessor.scalar_attribute(e02) = local_e_on_input[i][1];
104 input_accessor.scalar_attribute(e12) = local_e_on_input[i][0];
107 std::shared_ptr<Mesh> inserted_input_mesh;
112 inserted_input_mesh = m->get_child_meshes().back();
118 auto bbox_accessor = m->create_accessor<int64_t>(bbox_handle);
122 bbox_accessor.scalar_attribute(e) = 1;
126 std::shared_ptr<Mesh> bbox_mesh;
131 bbox_mesh = m->get_child_meshes().back();
137 for (
auto child : m->get_child_meshes()) {
138 auto child_position_handle = child->register_attribute<
Rational>(
141 m->get_attribute_dimension(pt_attribute.as<
Rational>()));
143 auto propagate_to_child_position =
144 [](
const Eigen::MatrixX<Rational>& P) -> Eigen::VectorX<Rational> {
return P; };
145 auto update_child_positon =
146 std::make_shared<wmtk::operations::SingleAttributeTransferStrategy<Rational, Rational>>(
147 child_position_handle,
149 propagate_to_child_position);
150 update_child_positon->run_on_all();
This class generates a multi-mesh from a mesh where the substructure is represented by a tag.
void remove_soup()
Remove the substructure soup from the multimesh.
void compute_substructure_mesh()
Create a manifold mesh from the substructure.
void edge_insertion(TriMesh &_trimesh, EdgeMesh &edgemesh, std::vector< Vector2r > &v_final, std::vector< std::array< int64_t, 3 >> &FV_new, std::vector< std::array< int, 3 >> &local_e_on_input)
attribute::MeshAttributeHandle set_matrix_attribute(const Mat &data, const std::string &name, const PrimitiveType &type, Mesh &mesh)
spdlog::logger & logger()
Retrieves the current logger.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > MatrixX
std::shared_ptr< wmtk::Mesh > tri_mesh
std::shared_ptr< wmtk::Mesh > bbox_mesh
std::shared_ptr< wmtk::Mesh > inserted_edge_mesh