MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_delete_polyhedra

Function test_delete_polyhedra

tests/mesh/test-polyhedral-solid.cpp:337–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void test_delete_polyhedra( const geode::PolyhedralSolid3D& polyhedral_solid,
338 geode::PolyhedralSolidBuilder3D& builder )
339{
340 std::vector< bool > to_delete( polyhedral_solid.nb_polyhedra(), false );
341 to_delete.front() = true;
342 builder.delete_polyhedra( to_delete );
343 geode::OpenGeodeMeshException::test( polyhedral_solid.nb_polyhedra() == 2,
344 "PolyhedralSolid should have polyhedra" );
345 geode::OpenGeodeMeshException::test(
346 polyhedral_solid.polyhedron_vertex( { 0, 0 } ) == 5,
347 "PolyhedralSolid vertex index is not correct" );
348 geode::OpenGeodeMeshException::test(
349 polyhedral_solid.polyhedron_vertex( { 0, 1 } ) == 3,
350 "PolyhedralSolid vertex index is not correct" );
351 geode::OpenGeodeMeshException::test(
352 polyhedral_solid.polyhedron_vertex( { 0, 2 } ) == 1,
353 "PolyhedralSolid vertex index is not correct" );
354 geode::OpenGeodeMeshException::test(
355 polyhedral_solid.polyhedron_vertex( { 0, 3 } ) == 7,
356 "PolyhedralSolid vertex index is not correct" );
357 geode::OpenGeodeMeshException::test(
358 polyhedral_solid.facets().nb_facets() == 11,
359 "PolyhedralSolid should have 11 facets" );
360 geode::OpenGeodeMeshException::test(
361 polyhedral_solid.edges().nb_edges() == 15,
362 "PolyhedralSolid should have 15 edges" );
363 builder.edges_builder().delete_isolated_edges();
364 builder.facets_builder().delete_isolated_facets();
365 geode::OpenGeodeMeshException::test(
366 polyhedral_solid.facets().nb_facets() == 8,
367 "PolyhedralSolid should have 8 facets" );
368 geode::OpenGeodeMeshException::test(
369 polyhedral_solid.edges().nb_edges() == 12,
370 "PolyhedralSolid should have 12 edges" );
371 auto attribute = polyhedral_solid.edges()
372 .edge_attribute_manager()
373 .find_attribute< geode::index_t >( "test" );
374 geode::OpenGeodeMeshException::test( attribute->value( 0 ) == 1,
375 "Wrong value for attribute on edge 0 after vertex deletion" );
376 geode::OpenGeodeMeshException::test( attribute->value( 1 ) == 3,
377 "Wrong value for attribute on edge 1 after vertex deletion" );
378}
379
380void test_io( const geode::PolyhedralSolid3D& polyhedral_solid,
381 const std::string& filename )

Callers 1

testFunction · 0.70

Calls 11

nb_polyhedraMethod · 0.80
delete_polyhedraMethod · 0.80
polyhedron_vertexMethod · 0.80
facets_builderMethod · 0.80
testFunction · 0.70
nb_facetsMethod · 0.45
nb_edgesMethod · 0.45
delete_isolated_edgesMethod · 0.45
edges_builderMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected