当前位置: 首页>>代码示例>>Python>>正文


Python YoshimuraCreasePattern.generate_X0方法代码示例

本文整理汇总了Python中oricrete.folding.YoshimuraCreasePattern.generate_X0方法的典型用法代码示例。如果您正苦于以下问题:Python YoshimuraCreasePattern.generate_X0方法的具体用法?Python YoshimuraCreasePattern.generate_X0怎么用?Python YoshimuraCreasePattern.generate_X0使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oricrete.folding.YoshimuraCreasePattern的用法示例。


在下文中一共展示了YoshimuraCreasePattern.generate_X0方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CreasePatternView

# 需要导入模块: from oricrete.folding import YoshimuraCreasePattern [as 别名]
# 或者: from oricrete.folding.YoshimuraCreasePattern import generate_X0 [as 别名]
                    [(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()


开发者ID:simvisage,项目名称:oricrete,代码行数:30,代码来源:ex09_rhombus_with_target_face.py

示例2: rhombus_3x3_crane

# 需要导入模块: from oricrete.folding import YoshimuraCreasePattern [as 别名]
# 或者: from oricrete.folding.YoshimuraCreasePattern import generate_X0 [as 别名]
def rhombus_3x3_crane(n_steps = 10, dx = 0.7):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 3,
                              n_x = 3,
                              n_y = 6,
                              MAX_ITER = 5000)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += -0.1559

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0], #31
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [0.5, 2.333, 0], #35
                  [0.5, 2.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [1.5, 2.333, 0],
                  [1.5, 2.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.667, 0],
                  [2.5, 1.333, 0], #45
                  [2.5, 1.667, 0],
                  [2.5, 2.333, 0],
                  [2.5, 2.667, 0]]#48

    crane_nodes = [[1.5, 0.5, 1.0], #49
                   [0.5, 0.5, 1],
                   [2.5, 0.5, 1],
                   [0.5, 0.333, 1.0],
                   [0.5, 0.667, 1.0],
                   [2.5, 0.333, 1.0],
                   [2.5, 0.667, 1.0], #55
                   [1.5, 0.333, 1.0],
                   [1.5, 0.667, 1.0],

                   [1.5, 1.5, 1.0],
                   [0.5, 1.5, 1],
                   [2.5, 1.5, 1], #60
                   [0.5, 1.333, 1.0],
                   [0.5, 1.667, 1.0],
                   [2.5, 1.333, 1.0],
                   [2.5, 1.667, 1.0],
                   [1.5, 1.333, 1.0], #65
                   [1.5, 1.667, 1.0],

                   [1.5, 2.5, 1.0],
                   [0.5, 2.5, 1],
                   [2.5, 2.5, 1],
                   [0.5, 2.333, 1.0], #70
                   [0.5, 2.667, 1.0],
                   [2.5, 2.333, 1.0],
                   [2.5, 2.667, 1.0],
                   [1.5, 2.333, 1.0],
                   [1.5, 2.667, 1.0], #75
                   ]

    cp.nodes = np.vstack([cp.nodes, grab_nodes])
    cp.nodes = np.vstack([cp.nodes, crane_nodes])


    crane_cl = [#crane 1
                [49, 50], #72
                [49, 51],
                [50, 52],
                [50, 53],
                [51, 54],
                [51, 55],
                [49, 56],
                [49, 57],

                [52, 31],
                [53, 32],
                [54, 43],
                [55, 44],
                [56, 37],
                [57, 38],
                #crane 2
                [58, 59],
                [58, 60],
                [59, 61],
                [59, 62],
                [60, 63],
#.........这里部分代码省略.........
开发者ID:simvisage,项目名称:oricrete,代码行数:103,代码来源:ex08_crane_model_3.py

示例3: rhombus_3x2_grab_points_for_crane

# 需要导入模块: from oricrete.folding import YoshimuraCreasePattern [as 别名]
# 或者: from oricrete.folding.YoshimuraCreasePattern import generate_X0 [as 别名]
def rhombus_3x2_grab_points_for_crane(n_steps = 10, dx = 1.5):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 2,
                              n_x = 3,
                              n_y = 4,
                              MAX_ITER = 500)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += 0.15
    print 'X_rcp', X_rcp

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0], #22
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.666, 0],
                  [2.5, 1.333, 0],
                  [2.5, 1.667, 0]]

    cp.nodes = np.vstack([cp.nodes, grab_nodes])

    cp.grab_pts = [
                   [22, 0],
                   [23, 14],
                   [26, 2],
                   [27, 16],
                   [30, 4],
                   [31, 18],
                   [24, 1],
                   [25, 15],
                   [28, 3],
                   [29, 17],
                   [32, 5],
                   [33, 19]
                   ]

    cp.cnstr_lhs = [[(12, 2, 1.0)],
                    [(13, 2, 1.0)],
                    [(14, 2, 1.0)],
                    [(15, 2, 1.0)],
                    [(1, 1, 1.0)],
                    [(18, 0, 1.0)],

                    [(26, 2, 1.0)],
                    [(22, 1, 1.0), (26, 1, -1.0)],
                    [(26, 1, 1.0), (30, 1, -1.0)],
                    [(23, 1, 1.0), (27, 1, -1.0)],
                    [(5, 2, 1.0), (8, 2, -1.0)],
                    [(24, 1, 1.0), (28, 1, -1.0)],
                    [(28, 1, 1.0), (32, 1, -1.0)],
                    [(25, 1, 1.0), (29, 1, -1.0)],
                    [(3, 2, 1.0), (6, 2, -1.0)],
                    [(22, 2, 1.0), (30, 2, -1.0)],
                    [(29, 1, 1.0), (33, 1, -1.0)]

                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, dx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]


    X_ext = np.zeros((cp.n_g * cp.n_d,), dtype = float)
    X0 = np.hstack([X_rcp.reshape((-1,)), X_ext])

    X0[68] = 0.3059
    X0[71] = 0.3059
    X0[74] = 0.3059
    X0[77] = 0.3059
    X0[80] = 0.4389
    X0[83] = 0.4389
    X0[86] = 0.4389
    X0[89] = 0.4389
    X0[92] = 0.3059
    X0[95] = 0.3059
    X0[98] = 0.3059
    X0[101] = 0.3059

    X0 *= 0.01
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'n_dofs', cp.n_dofs
#.........这里部分代码省略.........
开发者ID:kelidas,项目名称:oricrete,代码行数:103,代码来源:ex05_triangle.py

示例4: rhombus_3x2_crane

# 需要导入模块: from oricrete.folding import YoshimuraCreasePattern [as 别名]
# 或者: from oricrete.folding.YoshimuraCreasePattern import generate_X0 [as 别名]
def rhombus_3x2_crane(n_steps = 10, dx = 1):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 2,
                              n_x = 3,
                              n_y = 4,
                              MAX_ITER = 5000)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += -0.1559

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0],
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.667, 0],
                  [2.5, 1.333, 0],
                  [2.5, 1.667, 0]]#33

    crane_nodes = [[1.5, 0.5, 1.0], #34
                   [0.5, 0.5, 1],
                   [2.5, 0.5, 1],
                   [0.5, 0.333, 1.0],
                   [0.5, 0.667, 1.0], #38
                   [2.5, 0.333, 1.0],
                   [2.5, 0.667, 1.0],
                   [1.5, 0.333, 1.0],
                   [1.5, 0.667, 1.0],

                   [1.5, 1.5, 1.0], #43
                   [0.5, 1.5, 1],
                   [2.5, 1.5, 1],
                   [0.5, 1.333, 1.0], #46
                   [0.5, 1.667, 1.0],
                   [2.5, 1.333, 1.0],
                   [2.5, 1.667, 1.0],
                   [1.5, 1.333, 1.0],
                   [1.5, 1.667, 1.0], #51
                   ]

    cp.nodes = np.vstack([cp.nodes, grab_nodes])
    cp.nodes = np.vstack([cp.nodes, crane_nodes])


    crane_cl = [#crane 1
                [34, 35], #49
                [34, 36],
                [35, 37],
                [35, 38],
                [36, 39],
                [36, 40],
                [34, 41], #55
                [34, 42],

                [37, 22],
                [38, 23], #60
                [39, 30],
                [40, 31],
                [41, 26],
                [42, 27],
                #crane 2
                [43, 44], #65
                [43, 45],
                [44, 46],
                [44, 47],
                [45, 48],
                [45, 49],
                [43, 50],
                [43, 51],
                [46, 24],
                [47, 25],
                [48, 32],
                [49, 33],
                [50, 28],
                [51, 29],

                ]

    cp.crease_lines = np.vstack([cp.crease_lines, crane_cl])

    cp.grab_pts = [[22, 0],
                   [23, 14],
#.........这里部分代码省略.........
开发者ID:simvisage,项目名称:oricrete,代码行数:103,代码来源:ex08_crane_model_3.py

示例5: rhombus_3x3_crane

# 需要导入模块: from oricrete.folding import YoshimuraCreasePattern [as 别名]
# 或者: from oricrete.folding.YoshimuraCreasePattern import generate_X0 [as 别名]
def rhombus_3x3_crane(n_steps = 10, dx = 0.7):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 3,
                              n_x = 3,
                              n_y = 6,
                              MAX_ITER = 5000)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += -0.1559

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0], #31
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [0.5, 2.333, 0], #35
                  [0.5, 2.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [1.5, 2.333, 0],
                  [1.5, 2.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.667, 0],
                  [2.5, 1.333, 0], #45
                  [2.5, 1.667, 0],
                  [2.5, 2.333, 0],
                  [2.5, 2.667, 0]]#48



    cp.nodes = np.vstack([cp.nodes, grab_nodes])





    cp.grab_pts = [[31, 0],
                   [32, 21],
                   [33, 1],
                   [34, 22],
                   [35, 2],
                   [36, 23],
                   [37, 3],
                   [38, 24],
                   [39, 4],
                   [40, 25],
                   [41, 5],
                   [42, 26],
                   [43, 6],
                   [44, 27],
                   [45, 7],
                   [46, 28],
                   [47, 8],
                   [48, 29]
                   ]




    cnstr_lhs_3 = [[(31, 1, 1.0)],
                   [(31, 1, 1.0), (36, 1, 1.0)],
                   [(16, 2, 1.0)],
                   [(17, 2, 1.0)],
                   [(18, 2, 1.0)],
                   [(19, 2, 1.0)],
                   [(20, 2, 1.0)],
                   [(21, 2, 1.0)],
                   [(17, 1, 1.0)],
                   [(20, 1, 1.0)],
                   [(20, 0, 1.0)],
                   [(37, 1, 1.0), (42, 1, 1.0)],
                   [(31, 2, 1.0), (36, 2, -1.0)],
                   [(37, 2, 1.0), (42, 2, -1.0)],
                   [(43, 1, 1.0), (48, 1, 1.0)],
                   [(43, 2, 1.0), (48, 2, 1.0)],
                   [(33, 1, 1.0), (34, 1, 1.0)],
                   [(39, 1, 1.0), (40, 1, 1.0)],
                   [(45, 1, 1.0), (46, 1, 1.0)],
                   [(19, 0, 1.0), (21, 0, -1.0)],
                   [(1, 2, 1.0), (2, 0, -1.0)]

                    ]
    cp.cnstr_lhs = cnstr_lhs_3

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
#.........这里部分代码省略.........
开发者ID:kelidas,项目名称:oricrete,代码行数:103,代码来源:ex10_y-deformation.py


注:本文中的oricrete.folding.YoshimuraCreasePattern.generate_X0方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。