def rhombus_nxm_crane(n_steps=10, dx=0.7, L_x=3, L_y=3, n_x=3, n_y=6):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cp = CraneCreasePattern(n_steps=n_steps, dx=dx, L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, MAX_ITER=500, H_crane=2.0)
    lhs = cp.generate_lhs()

    cp.cnstr_lhs = lhs

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx
    X0 = cp.X0

    X0 *= 1.0
    # np.set_printoptions(threshold='nan')
    cp.add_fold_step(X0)

    print "n_dofs", cp.n_dofs
    print "n_c", cp.n_c
    print "n_g", cp.n_g
    print "necessary constraints", cp.n_dofs - cp.n_c - cp.n_g * 3 - cp.n_l * 2
    print "cnstr", len(cp.cnstr_lhs)

    # cp.show_iter = True
    X = cp.solve(X0)
    return cp
Beispiel #2
0
def rhombus_nx3_crane(n_steps = 10, dx = 0.7):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cp = CraneCreasePattern(n_steps = n_steps,
                            dx = dx,
                            L_x = 5,
                              L_y = 3,
                              n_x = 3,
                              n_y = 6,
                              MAX_ITER = 500,
                              y_deformation = True)

    lhs = [[(53, 2, 1.0)],
           [(22, 1, 1.0), (24, 1, 1.0)],
           [(25, 1, 1.0), (27, 1, 1.0)],
           [(28, 1, 1.0), (30, 1, 1.0)],
#           [(56, 1, 1.0), (55, 1, -1.0)],
#           [(55, 1, 1.0), (57, 1, -1.0)],
           [(58, 2, 1.0), (56, 2, -1.0)],
           [(59, 2, 1.0), (56, 2, -1.0)],
           [(60, 2, 1.0), (55, 2, -1.0)],
           [(61, 2, 1.0), (55, 2, -1.0)],
           [(62, 2, 1.0), (57, 2, -1.0)],
           [(63, 2, 1.0), (57, 2, -1.0)],
           [(58, 0, 1.0), (56, 0, -1.0)],
           [(59, 0, 1.0), (56, 0, -1.0)],
           [(60, 0, 1.0), (55, 0, -1.0)],
           [(61, 0, 1.0), (55, 0, -1.0)],
           [(62, 0, 1.0), (57, 0, -1.0)],
           [(63, 0, 1.0), (57, 0, -1.0)],
           [(65, 1, 1.0), (64, 1, -1.0)],
           [(64, 1, 1.0), (66, 1, -1.0)],
           [(67, 2, 1.0), (65, 2, -1.0)],
           [(68, 2, 1.0), (65, 2, -1.0)],
           [(69, 2, 1.0), (64, 2, -1.0)],
           [(70, 2, 1.0), (64, 2, -1.0)],
           [(71, 2, 1.0), (66, 2, -1.0)],
           [(72, 2, 1.0), (66, 2, -1.0)],
           [(67, 0, 1.0), (65, 0, -1.0)],
           [(68, 0, 1.0), (65, 0, -1.0)],
           [(69, 0, 1.0), (64, 0, -1.0)],
           [(70, 0, 1.0), (64, 0, -1.0)],
           [(71, 0, 1.0), (66, 0, -1.0)],
           [(72, 0, 1.0), (66, 0, -1.0)],
#           [(74, 1, 1.0), (73, 1, -1.0)],
#           [(73, 1, 1.0), (75, 1, -1.0)],
           [(76, 2, 1.0), (74, 2, -1.0)],
           [(77, 2, 1.0), (74, 2, -1.0)],
           [(78, 2, 1.0), (73, 2, -1.0)],
           [(79, 2, 1.0), (73, 2, -1.0)],
           [(80, 2, 1.0), (75, 2, -1.0)],
           [(81, 2, 1.0), (75, 2, -1.0)],
           [(76, 0, 1.0), (74, 0, -1.0)],
           [(77, 0, 1.0), (74, 0, -1.0)],
           [(78, 0, 1.0), (73, 0, -1.0)],
           [(79, 0, 1.0), (73, 0, -1.0)],
           [(80, 0, 1.0), (75, 0, -1.0)],
           [(81, 0, 1.0), (75, 0, -1.0)],
           [(49, 2, 1.0)],
           [(49, 1, 1.0)],
           [(49, 0, 1.0)],
           [(52, 0, 1.0)],
           [(52, 2, 1.0)],
           [(50, 2, 1.0)],
           [(50, 1, 1.0)],
           [(50, 0, 1.0)],
           [(51, 0, 1.0)],
           [(51, 2, 1.0)],
           [(53, 0, 1.0)],
           [(54, 0, 1.0)],
           [(53, 1, 1.0)],
           [(53, 2, 1.0), (54, 2, -1.0)],
#           [(25, 1, 1.0), (55, 1, -1.0)],
           [(64, 1, 1.0)],
#           [(27, 1, 1.0), (73, 1, -1.0)],
           [(28, 0, 1.0)],
           [(30, 0, 1.0)],
           [(17, 1, 1.0)],
           [(1, 2, 1.0), (2, 2, -1.0)],
           [(20, 1, 1.0)],
           [(13, 2, 1.0), (14, 2, -1)],
           [(58, 1, 1.0), (31, 1, -1.0)],
           [(60, 1, 1.0), (33, 1, -1.0)],
           [(62, 1, 1.0), (35, 1, -1.0)],
           [(77, 1, 1.0), (44, 1, -1.0)],
           [(79, 1, 1.0), (46, 1, -1.0)],
           [(81, 1, 1.0), (48, 1, -1.0)],
           [(8, 2, 1.0), (11, 2, -1.0)],
           [(4, 2, 1.0), (7, 2, -1.0)],
           [(37, 2, 1.0), (38, 2, -1.0)],
           [(37, 1, 1.0), (38, 1, 1.0)],
           [(41, 2, 1.0), (42, 2, -1.0)],
           [(41, 1, 1.0), (42, 1, 1.0)]



           ]


    cp.cnstr_lhs = lhs

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx
    X0 = cp.X0


    X0[169] = dx / n_steps
    X0[223] = -dx / n_steps
    X0[165] = dx / n_steps / 2.
    X0[220] = -dx / n_steps / 2.

    X0 *= 1.0
    #np.set_printoptions(threshold='nan')
    print 'dR', cp.get_dR(X0)
    print 'R', cp.get_R(X0)
    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * 3 - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)

    cp.show_iter = True
    X = cp.solve(X0)
    return cp