Tests Performed on Ktirio Geometry Library

1. Overview

This document outlines the tests conducted using the Ktirio Geometry Library to validate various functionalities related to mesh operations. Each test case focuses on specific aspects such as markers and conversion in cgal polyhedron.

2. Test Cases

2.1. Marker Tests

These tests verify the handling of markers within meshes.

2.1.1. Marker Presence and Common Markers

This test checks whether markers are correctly assigned to mesh elements and if common markers can be identified.

Example Code
    auto triangle1 = mesh->addTriangle( std::make_unique<MeshTriangle>( pt0, pt1, pt2 ) );
    triangle1->addMarkerId(M1);
    triangle1->addMarkerId(M3);

    REQUIRE(triangle1->hasMarkerId({M1, M3}));
    REQUIRE((triangle1->commonMarkerIds({M1, M3}).size() == 2));
Description
  • Objective: To verify that a triangle in the mesh correctly identifies its assigned markers.

2.1.2. Marked Triangles

This test ensures that triangles marked with specific markers can be correctly identified and grouped based on their markers.

Example Code
    auto triangle1 = mesh->addTriangle( std::make_unique<MeshTriangle>( pt0, pt1, pt2 ) );
    triangle1->addMarkerId(M1);
    triangle1->addMarkerId(M3);
    triangle1->addMarkerId(M4);


    auto triangle2=mesh->addTriangle( std::make_unique<MeshTriangle>( pt0, pt1, pt2 ) );
    triangle2->addMarkerId(M2);
    triangle2->addMarkerId(M3);
    auto RangeUnion = markedtriangles(*mesh, {"Marker1", "Marker2"}, false);
    REQUIRE(RangeUnion.size() == 2);

    auto RangeIntersect1=markedtriangles(*mesh,{"Marker1","Marker2"},true);
    REQUIRE(RangeIntersect1.size()==0);

    auto RangeIntersect2=markedtriangles(*mesh,{"Marker1","Marker3"},true);
    REQUIRE(RangeIntersect2.size()==1);
Description
  • Objective: To validate the correct identification and grouping of triangles based on their markers.

2.1.3. Marked Edges

This test verifies the proper assignment and identification of markers on mesh edges.

Example Code
    auto edge1 = mesh->addEdge(std::make_unique<MeshEdge>(pt0, pt1));
    edge1->addMarkerId(M1);
    edge1->addMarkerId(M3);
    REQUIRE(edge1->hasMarkerId({M1}));
    REQUIRE(edge1->hasMarkerId({M3}));

    auto edge2 = mesh->addEdge(std::make_unique<MeshEdge>(pt1, pt2));
    edge2->addMarkerId(M2);
    edge2->addMarkerId(M3);
    REQUIRE(edge2->hasMarkerId({M2}));
    REQUIRE(edge2->hasMarkerId({M3}));

    auto RangeUnion = markededges(*mesh, {"Marker1", "Marker2"}, false);
    REQUIRE(RangeUnion.size() == 2);

    auto RangeIntersect1 = markededges(*mesh, {"Marker1", "Marker2"}, true);
    REQUIRE(RangeIntersect1.size() == 0);

    auto RangeIntersect2 = markededges(*mesh, {"Marker1", "Marker3"}, true);
    REQUIRE(RangeIntersect2.size() == 1);
Description
  • Objective: To validate the correct identification and grouping of triangles based on their markers.

2.2. Polyhedron Tests

These tests ensure the correctness of mesh operations and their compatibility with CGAL’s Polyhedron_3 data structure.

2.2.1. Valid Polyhedron

This test verifies the creation of a valid polyhedron from a mesh and its operations.

Example Code
    Polyhedron polyhedron = meshToPolyhedron<K>(mesh);
    REQUIRE(polyhedron.size_of_vertices()==mesh.nPoints());
    REQUIRE(polyhedron.size_of_facets()==mesh.nTriangles());
    REQUIRE(CGAL::is_triangle_mesh(polyhedron));
    polyhedronTo3DMesh<K>(polyhedron,"cube.vtu");
Description
  • Objective: To ensure that a mesh can be correctly converted to a polyhedron, checked for validity, and operated upon (e.g., extruding walls).

3. Conclusion

These tests cover the key functionalities of the Ktirio Geometry Library, ensuring the robustness and correctness of marker handlinga and CGAL compatibility for polyhedron. Future tests can expand on these foundations to cover additional scenarios.