def create_sim_step():
    from oricreate.api import CreasePatternState, CustomCPFactory

    cp = CreasePatternState(X=[[0, 0, 0],
                               [1, 0, 0],
                               [0.5, 1, 0],
                               [1.5, 1, 0],
                               [2.0, 0.0, 0]
                               ],
                            L=[[0, 1],
                               [1, 2],
                               [2, 0],
                               [1, 3],
                               [2, 3],
                               [3, 4],
                               ],
                            F=[[0, 1, 2],
                               [1, 2, 3],
                               [1, 3, 4]]
                            )

    cp_factory = CustomCPFactory(formed_object=cp)

    # begin
    from oricreate.fu import FuTF
    from oricreate.api import r_, s_, t_
    target_face = FuTF([r_, s_, - 0.5 * (r_ - 1) * (r_ - 1) * t_ + 1.0],
                       [0, 1, 2, 3, 4])
    # fix all nodes in x and y direction - let the z direction free
    dof_constraints = \
        [([(i, 0, 1.0)], 0.0) for i in range(0, 5)] +\
        [([(i, 1, 1.0)], 0.0) for i in range(0, 5)]
    sim_step = MapToSurface(previous_task=cp_factory,
                            target_faces=[target_face],
                            dof_constraints=dof_constraints
                            )
    print('initial position\n', cp_factory.formed_object.x)
    print('target position:\n', sim_step.x_1)
    # end
    return sim_step
Example #2
0
 def _get_init_displ_task(self):
     cp = self.factory_task.formed_object
     return MapToSurface(previous_task=self.factory_task,
                         target_faces=[(self.ctf, cp.N)])
Example #3
0
if __name__ == '__main__':
    from oricreate.api import \
        CreasePattern, CustomCPFactory, MapToSurface

    from oricreate.fu import \
        FuNodeDist

    import numpy as np

    cp = CreasePattern(X=[[0, 0, 0], [0.5, 0, 0], [10.0, 0, 0]],
                       L=[[0, 1], [1, 2], [2, 0]])
    cpf = CustomCPFactory(formed_object=cp)
    init = MapToSurface(previous_task=cpf)
    oc = FuNodeDist(forming_task=init, L=[[0, 1], [1, 2]])

    u = np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]], dtype='f')
    print('f', oc.get_f(u))
    print('f_du', oc.get_f_du(u))