コード例 #1
0
                    [(n_h[0, 0], 1, 1.0), (n_h[3, 0], 1, -1)], # 1
                    [(n_h[0, 0], 1, 1.0), (n_h[4, 0], 1, -1)], # 1
                    [(n_h[0, -1], 1, 1.0), (n_h[1, -1], 1, -1)], # 0
                    [(n_h[0, -1], 1, 1.0), (n_h[2, -1], 1, -1)], # 1
                    [(n_h[0, -1], 1, 1.0), (n_h[3, -1], 1, -1)], # 1
                    [(n_h[0, -1], 1, 1.0), (n_h[4, -1], 1, -1)], # 1
#                    [(n_h[1, -1], 1, 1.0), (n_h[1, 0], 1, 1.0)],
                    ]

    cp.cnstr_rhs = np.zeros((len(cp.cnstr_lhs),), dtype=float)

    #del cp.eqcons['cl']

    # @todo - renaming of methods
    # @todo - projection on the caf - to get the initial vector
    # @todo - gemetry transformator
    # @todo - derivatives of caf for the current position.
    # @todo - rthombus generator with cut-away elements
    # @todo - time step counting - save the initial step separately from the time history

    X0 = cp.generate_X0()

    X_fc = cp.solve(X0 - 1e-8)

    my_model = CreasePatternView(data=cp,
                                 ff_resolution=100,
                                 show_cnstr=True)
    my_model.configure_traits()


コード例 #2
0
    cp.create_rcp_tex(name = 'rcp_x3_y3.tex')

    X0 *= 0.1
    #np.set_printoptions(threshold='nan')
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(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


if __name__ == '__main__':

#    cp = rhombus_3x1_crane(n_steps = 80)
#    cp = rhombus_3x2_crane(n_steps = 80)
    cp = rhombus_3x3_crane(n_steps = 80)
#    cp.create_3D_tex(name = '3x3_crane.tex')
#    cp.create_3D_tex('cp3x1K33D.tex')
    # initialise View

    cpv = CreasePatternView(data = cp, show_cnstr = True)

    cpv.configure_traits()