| 89 | } |
| 90 | |
| 91 | TEST_F(SubMeshTest, BoundaryFaces) { |
| 92 | MeshPtr mesh = load_mesh("cube.msh"); |
| 93 | const size_t dim = mesh->get_dim(); |
| 94 | const size_t num_vertices = mesh->get_num_vertices(); |
| 95 | |
| 96 | SubMesh::Ptr submesh = SubMesh::create(mesh); |
| 97 | |
| 98 | auto ori_vertices = MatrixUtils::reshape<MatrixFr>( |
| 99 | mesh->get_vertices(), num_vertices, dim); |
| 100 | VectorF bbox_min = ori_vertices.colwise().minCoeff(); |
| 101 | |
| 102 | std::function<bool(VectorF)> filter([&](const VectorF& v) { |
| 103 | return v[0] == bbox_min[0]; }); |
| 104 | submesh->filter_vertex_with_custom_function(filter); |
| 105 | submesh->finalize(); |
| 106 | |
| 107 | const MatrixFr& vertices = submesh->get_selected_vertices(); |
| 108 | const MatrixIr& faces = submesh->get_selected_faces(); |
| 109 | |
| 110 | const size_t num_filted_vertices = vertices.rows(); |
| 111 | for (size_t i=0; i<num_filted_vertices; i++) { |
| 112 | ASSERT_TRUE(filter(vertices.row(i))); |
| 113 | } |
| 114 | |
| 115 | ASSERT_EQ(4, vertices.rows()); |
| 116 | ASSERT_EQ(2, faces.rows()); |
| 117 | } |
| 118 | |
| 119 | TEST_F(SubMeshTest, NotFinalized) { |
| 120 | MeshPtr mesh = load_mesh("cube.msh"); |
no test coverage detected