MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / TEST_F

Function TEST_F

tests/tools/MeshUtils/SubMeshTest.h:91–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91TEST_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
119TEST_F(SubMeshTest, NotFinalized) {
120 MeshPtr mesh = load_mesh("cube.msh");

Callers 2

SubMeshTest.hFile · 0.70

Calls 11

load_meshFunction · 0.85
get_selected_verticesMethod · 0.80
get_selected_facesMethod · 0.80
filterFunction · 0.50
get_dimMethod · 0.45
get_num_verticesMethod · 0.45
get_verticesMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected