surf04.degree_u = 2
surf04.degree_v = 3

# Get the control points from the generated grid
surf04.ctrlpts2d = sg04.grid

# Set knot vectors
surf04.knotvector_u = utilities.generate_knot_vector(surf04.degree_u,
                                                     surf04.ctrlpts_size_u)
surf04.knotvector_v = utilities.generate_knot_vector(surf04.degree_v,
                                                     surf04.ctrlpts_size_v)

# Construct the parametric volume with a uniform knot vector
pvolume = construct.construct_volume('w',
                                     surf01,
                                     surf02,
                                     surf03,
                                     surf04,
                                     degree=2)

# Visualize volume
pvolume.vis = vis.VisVolume(vis.VisConfig(ctrlpts=True, evalpts=False))
pvolume.render()

# Knot vector refinement
operations.refine_knotvector(pvolume, [1, 1, 1])

# Visualize volume after knot insertions
pvolume.render()

# Good to have something here to put a breakpoint
pass
    # Set degrees
    surf03.degree_u = 1
    surf03.degree_v = 1

    # Get the control points from the generated grid
    surf03.ctrlpts2d = sg03.grid

    # Set knot vectors
    surf03.knotvector_u = utilities.generate_knot_vector(
        surf03.degree_u, surf03.ctrlpts_size_u)
    surf03.knotvector_v = utilities.generate_knot_vector(
        surf03.degree_v, surf03.ctrlpts_size_v)

    # Construct the parametric volume
    pvolume = construct.construct_volume(surf01, surf02, surf03, degree=1)
    pvolume.vis = vis.VisVoxel(vis.VisConfig(ctrlpts=False))
    pvolume.delta_u = pvolume.delta_v = 0.025
    pvolume.delta_w = 0.05
    pvolume.render(evalcolor="firebrick", use_mp=True, num_procs=16)

    # Extract surfaces from the parametric volume
    surfvol = construct.extract_surfaces(pvolume)

    # Construct the isosurface
    msurf = multi.SurfaceContainer(surfvol['uv'][0], surfvol['uv'][-1],
                                   surfvol['uw'][0], surfvol['uw'][-1],
                                   surfvol['vw'][0], surfvol['vw'][-1])
    msurf.vis = vis.VisSurface(vis.VisConfig(ctrlpts=False))
    msurf.delta = 0.05
    msurf.render(evalcolor=[
示例#3
0
def scordelis_lo(radius=25, thickness=0.25, length=50, angle=40, **kwargs):
    """ Generates a Scordelis-Lo Roof.

    The Scordelis-Lo roof is a classical test case for linear static analysis. Please refer to the
    following articles for details:

    * https://doi.org/10.14359/7796
    * https://doi.org/10.1016/0045-7825(85)90035-0
    * https://doi.org/10.1016/j.cma.2010.03.029

    Keyword Arguments:
        * ``jump_angle``: iteration step for `angle` value. *Default: 2*
        * ``jump_length``: iteration step for `length` value. *Default: 2*
        * ``degree_u``: degree of the volume (u-dir). *Default: 2*
        * ``degree_v``: degree of the volume (v-dir). *Default: 2*
        * ``size_u``: number of control points (u-dir). *Default: degree_u + 2*
        * ``size_v``: number of control points (v-dir). *Default: degree_v + 2*

    :param radius: radius (R)
    :type radius: int, float
    :param thickness: thickness (t)
    :type thickness: int, float
    :param length: length (L)
    :type length: int, float
    :param angle: angle in degrees (Theta)
    :type angle: int, float
    :return: Scordelis-Lo Roof as a shell/volume
    :rtype: BSpline.Volume
    """
    # Iteration parameters
    jump_angle = kwargs.get('jump_angle', 2)
    jump_length = kwargs.get('jump_length', 2)

    # Spline parameters
    degree_u = kwargs.get('degree_u', 2)
    degree_v = kwargs.get('degree_v', 2)
    size_u = kwargs.get('size_u', degree_u + 2)
    size_v = kwargs.get('size_v', degree_v + 2)

    # Generate data points
    points_bottom = []  # data points for the bottom surface
    points_top = []  # data points for the top surface
    size_u = 0
    size_v = 0
    for l in range(0, length, jump_length):  # y-direction
        size_v = 0
        for a in range(0, angle, jump_angle):  # x-z plane
            arad = math.radians(a)
            pt_bottom = [radius * math.sin(arad), l, radius * math.cos(arad)]
            points_bottom.append(pt_bottom)
            pt_top = [(radius + thickness) * math.sin(arad), l,
                      (radius + thickness) * math.cos(arad)]
            points_top.append(pt_top)
            size_v += 1
        size_u += 1

    # Approximate bottom surface
    surf_bottom = fitting.approximate_surface(points_bottom,
                                              size_u,
                                              size_v,
                                              degree_u,
                                              degree_v,
                                              ctrlpts_size_u=degree_u + 2,
                                              ctrlpts_size_v=degree_v + 2)

    # Approximate top surface
    surf_top = fitting.approximate_surface(points_top,
                                           size_u,
                                           size_v,
                                           degree_u,
                                           degree_v,
                                           ctrlpts_size_u=degree_u + 2,
                                           ctrlpts_size_v=degree_v + 2)

    # Generate Scordelis-Lo Roof as a spline volume
    slroof = construct.construct_volume("w", surf_bottom, surf_top)

    # Return the generated volume
    return slroof