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

Function add_internal_line_relations

tests/model/test-brep.cpp:694–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692}
693
694void 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 {

Callers 1

testFunction · 0.70

Calls 11

embedding_blocksMethod · 0.80
nb_embeddingsMethod · 0.80
nb_embedding_blocksMethod · 0.80
testFunction · 0.70
is_boundaryMethod · 0.45
embedding_surfacesMethod · 0.45
nb_internal_linesMethod · 0.45
sizeMethod · 0.45
nb_embedding_surfacesMethod · 0.45

Tested by

no test coverage detected