| 692 | } |
| 693 | |
| 694 | void add_internal_line_relations( const geode::BRep& model, |
| 695 | geode::BRepBuilder& builder, |
| 696 | absl::Span< const geode::uuid > line_uuids, |
| 697 | absl::Span< const geode::uuid > surface_uuids, |
| 698 | const geode::uuid& block_uuid ) |
| 699 | { |
| 700 | geode::index_t nb_boundaries{ 0 }; |
| 701 | for( const auto& line_id : line_uuids ) |
| 702 | { |
| 703 | if( !model.is_boundary( model.line( line_id ), |
| 704 | model.surface( surface_uuids.front() ) ) ) |
| 705 | { |
| 706 | builder.add_line_surface_internal_relationship( |
| 707 | model.line( line_id ), model.surface( surface_uuids.front() ) ); |
| 708 | } |
| 709 | else |
| 710 | { |
| 711 | nb_boundaries++; |
| 712 | } |
| 713 | builder.add_line_block_internal_relationship( |
| 714 | model.line( line_id ), model.block( block_uuid ) ); |
| 715 | } |
| 716 | |
| 717 | for( const auto& line_id : line_uuids ) |
| 718 | { |
| 719 | for( const auto& embedding : |
| 720 | model.embedding_surfaces( model.line( line_id ) ) ) |
| 721 | { |
| 722 | geode::OpenGeodeModelException::test( |
| 723 | surface_uuids.front() == embedding.id(), |
| 724 | "All Line embedded surfaces should be Surfaces" ); |
| 725 | geode::OpenGeodeModelException::test( |
| 726 | model.nb_internal_lines( embedding ) |
| 727 | == line_uuids.size() - nb_boundaries, |
| 728 | "Surface should embed all Lines that are not its " |
| 729 | "boundaries" ); |
| 730 | } |
| 731 | for( const auto& embedding : |
| 732 | model.embedding_blocks( model.line( line_id ) ) ) |
| 733 | { |
| 734 | geode::OpenGeodeModelException::test( block_uuid == embedding.id(), |
| 735 | "All Lines embedded blocks should be Blocks" ); |
| 736 | geode::OpenGeodeModelException::test( |
| 737 | model.nb_internal_lines( embedding ) == line_uuids.size(), |
| 738 | "Block should embed all Lines" ); |
| 739 | } |
| 740 | if( model.is_boundary( model.line( line_id ), |
| 741 | model.surface( surface_uuids.front() ) ) ) |
| 742 | { |
| 743 | geode::OpenGeodeModelException::test( |
| 744 | model.nb_embeddings( line_id ) == 1, |
| 745 | "Line should be embedded to 1 Block." ); |
| 746 | geode::OpenGeodeModelException::test( |
| 747 | model.nb_embedding_surfaces( model.line( line_id ) ) == 0, |
| 748 | "Line should not be embedded to 1 Surface." ); |
| 749 | } |
| 750 | else |
| 751 | { |
no test coverage detected