def gen_nodes_new(self,nodes,lineold,linenew): ptsold = nodes.get_points_from_line(lineold) ptsshifted = linenew.shift_points(ptsold) nold = ptsshifted.shape[0] nnew = (nold + 1 + 2)//2 if Mmath.is_odd(nnew): # collapse ptsshifted = ptsshifted[1::2,:] # every other node ptsnew = linenew.stack_endpoints(ptsshifted) return nodes.gen_fe_nodes_from_points(ptsnew)
def gen_nodes_new(self,nodes,lineold,linenew): ptsold = nodes.get_points_from_line(lineold) ptsshifted = linenew.shift_points(ptsold) nold = ptsshifted.shape[0] if Mmath.is_odd(nold): ptsshifted = ptsshifted[1::2,:] # every other node ptsnew = linenew.stack_endpoints(ptsshifted) return nodes.gen_fe_nodes_from_points(ptsnew) else: raise ValueError('Cannot apply collapse with even number of nodes')