def test_item_ranges( model, line_uuids, boundary_uuids ):
    boundary_item_count = 0
    for boundary_item in model.model_boundary_items( model.model_boundary( boundary_uuids[1] ) ):
        boundary_item_count += 1
        if boundary_item.id().string() != line_uuids[1].string() and boundary_item.id().string() != line_uuids[2].string():
            raise ValueError( "[Test] ItemLineRange iteration result is not correct" )
        if not model.is_model_boundary_item( boundary_item, model.model_boundary( boundary_uuids[1] ) ):
            raise ValueError( "[Test] Surface should be item of ModelBoundary" )
    if boundary_item_count != 2:
        raise ValueError( "[Test] IncidentLineRange should iterates on 2 Lines (Boundary 1)" )
def add_lines_in_model_boundaries( model, builder, line_uuids, boundary_uuids ):
    builder.add_line_in_model_boundary( model.line( line_uuids[0] ), model.model_boundary( boundary_uuids[0] ) )
    for i in range( 1, 3 ):
        builder.add_line_in_model_boundary( model.line( line_uuids[i] ), model.model_boundary( boundary_uuids[1] ) )

    for i in range( 3 ):
        if model.nb_collections( line_uuids[i] ) != 1:
            raise ValueError( "[Test] This Line should be in 1 collection (of type Boundary)" )
    if model.nb_collections( line_uuids[4] ) != 0:
        raise ValueError( "[Test] Last Line should be in no collection (of type Boundary)" )
def add_model_boundaries( model, builder ):
    nb = 2
    uuids = []
    for i in range( nb ):
        uuids.append( builder.add_model_boundary() )
        builder.set_model_boundary_name( uuids[-1], "boundary" + str(len( uuids )) )

    temp_boundary = model.model_boundary( builder.add_model_boundary() )
    builder.remove_model_boundary( temp_boundary )
    if model.nb_model_boundaries() != nb:
        raise ValueError( "[Test] Section should have 2 model boundaries" )
    if model.model_boundary( uuids[0] ).name() != "boundary1":
        raise ValueError( "[Test] Wrong ModelBoundary name" )
    return uuids
示例#4
0
def add_surfaces_in_model_boundaries(model, builder, surface_uuids,
                                     boundary_uuids):
    builder.add_surface_in_model_boundary(
        model.surface(surface_uuids[0]),
        model.model_boundary(boundary_uuids[0]))
    for i in range(1, 4):
        builder.add_surface_in_model_boundary(
            model.surface(surface_uuids[i]),
            model.model_boundary(boundary_uuids[1]))
    builder.add_surface_in_model_boundary(
        model.surface(surface_uuids[4]),
        model.model_boundary(boundary_uuids[2]))

    for surface_id in surface_uuids:
        if model.nb_collections(surface_id) != 1:
            raise ValueError(
                "[Test] All Surfaces should be in 1 collection (of type Boundary)"
            )