| 15 | }; |
| 16 | |
| 17 | TEST_F(BoundaryFacesTest, CubeBoundary) { |
| 18 | MeshPtr mesh = load_mesh("cube.msh"); |
| 19 | const size_t vertex_per_face = mesh->get_vertex_per_face(); |
| 20 | BoundaryFaces bd(*mesh.get()); |
| 21 | ASSERT_EQ(12, bd.get_num_boundaries()); |
| 22 | |
| 23 | // Check each boudnary vertex lies on the boundary. |
| 24 | // A vertex is on the boundary of cube if it has a coordinate |
| 25 | // equals 1 or -1 |
| 26 | for (size_t i=0; i<12; i++) { |
| 27 | VectorI face = bd.get_boundary(i); |
| 28 | for (size_t j=0; j<vertex_per_face; j++) { |
| 29 | VectorF vertex = mesh->get_vertex(face[j]); |
| 30 | Float max_coordinate = *std::max_element(vertex.data(), vertex.data() + vertex.size()); |
| 31 | Float min_coordinate = *std::min_element(vertex.data(), vertex.data() + vertex.size()); |
| 32 | ASSERT_FLOAT_EQ(1.0, std::max(fabs(min_coordinate), fabs(max_coordinate))); |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | TEST_F(BoundaryFacesTest, BoundaryElementsContainsBoundary) { |
| 38 | MeshPtr mesh = load_mesh("cube.msh"); |
nothing calls this directly
no test coverage detected