How to use the splipy.SplineObject.evaluate function in Splipy

To help you get started, we’ve selected a few Splipy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sintefmath / Splipy / splipy / Surface.py View on Github external
dH2dv= d0ud2v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdv
            G1   = dH1du*W - 2*H1*dWdu
            G2   = dH2dv*W - 2*H2*dWdv
            if derivs == (1,0):
                result[:,:,i] = H1 / W/W
            elif derivs == (0,1):
                result[:,:,i] = H2 / W/W
            elif derivs == (1,1):
                result[:,:,i] = (dH1dv*W - 2*H1*dWdv) /W/W/W
            elif derivs == (2,0):
                result[:,:,i] = G1 /W/W/W
            elif derivs == (0,2):
                result[:,:,i] = G2 /W/W/W
            if np.sum(derivs) > 2:
                d2ud1v = evaluate([dNus[2], dNvs[1]], self.controlpoints, tensor)
                d1ud2v = evaluate([dNus[1], dNvs[2]], self.controlpoints, tensor)
                d3ud0v = evaluate([dNus[3], dNvs[0]], self.controlpoints, tensor)
                d0ud3v = evaluate([dNus[0], dNvs[3]], self.controlpoints, tensor)
                d3Wdu   = d3ud0v[:,:,-1]
                d3Wdv   = d0ud3v[:,:,-1]
                d3Wduuv = d2ud1v[:,:,-1]
                d3Wduvv = d1ud2v[:,:,-1]
                d2H1du  = d3ud0v[:,:,i]*W + d2ud0v[:,:,i]*dWdu - d1ud0v[:,:,i]*d2Wdu - d0ud0v[:,:,i]*d3Wdu
                d2H1duv = d2ud1v[:,:,i]*W + d2ud0v[:,:,i]*dWdv - d0ud1v[:,:,i]*d2Wdu - d0ud0v[:,:,i]*d3Wduuv
                d2H2dv  = d0ud3v[:,:,i]*W + d0ud2v[:,:,i]*dWdv - d0ud1v[:,:,i]*d2Wdv - d0ud0v[:,:,i]*d3Wdv
                d2H2duv = d1ud2v[:,:,i]*W + d0ud2v[:,:,i]*dWdu - d1ud0v[:,:,i]*d2Wdv - d0ud0v[:,:,i]*d3Wduvv
                dG1du   = d2H1du *W + dH1du*dWdu - 2*dH1du*dWdu - 2*H1*d2Wdu
                dG1dv   = d2H1duv*W + dH1du*dWdv - 2*dH1dv*dWdu - 2*H1*d2Wduv
                dG2du   = d2H2duv*W + dH2dv*dWdu - 2*dH2du*dWdv - 2*H2*d2Wduv
                dG2dv   = d2H2dv *W + dH2dv*dWdv - 2*dH2dv*dWdv - 2*H2*d2Wdv

                if derivs == (3,0):
github sintefmath / Splipy / splipy / Surface.py View on Github external
"""

        squeeze = all(is_singleton(t) for t in [u,v])
        derivs = ensure_listlike(d, self.pardim)
        if not self.rational or np.sum(derivs) < 2 or np.sum(derivs) > 3:
            return super(Surface, self).derivative(u,v, d=derivs, above=above, tensor=tensor)

        u = ensure_listlike(u)
        v = ensure_listlike(v)
        result = np.zeros((len(u), len(v), self.dimension))
        # dNus = [self.bases[0].evaluate(u, d, above) for d in range(derivs[0]+1)]
        # dNvs = [self.bases[1].evaluate(v, d, above) for d in range(derivs[1]+1)]
        dNus = [self.bases[0].evaluate(u, d, above) for d in range(np.sum(derivs)+1)]
        dNvs = [self.bases[1].evaluate(v, d, above) for d in range(np.sum(derivs)+1)]

        d0ud0v = evaluate([dNus[0], dNvs[0]], self.controlpoints, tensor)
        d1ud0v = evaluate([dNus[1], dNvs[0]], self.controlpoints, tensor)
        d0ud1v = evaluate([dNus[0], dNvs[1]], self.controlpoints, tensor)
        d1ud1v = evaluate([dNus[1], dNvs[1]], self.controlpoints, tensor)
        d2ud0v = evaluate([dNus[2], dNvs[0]], self.controlpoints, tensor)
        d0ud2v = evaluate([dNus[0], dNvs[2]], self.controlpoints, tensor)
        W     = d0ud0v[:,:,-1]
        dWdu  = d1ud0v[:,:,-1]
        dWdv  = d0ud1v[:,:,-1]
        d2Wduv= d1ud1v[:,:,-1]
        d2Wdu = d2ud0v[:,:,-1]
        d2Wdv = d0ud2v[:,:,-1]

        for i in range(self.dimension):
            H1   = d1ud0v[:,:,i] * W - d0ud0v[:,:,i] * dWdu
            H2   = d0ud1v[:,:,i] * W - d0ud0v[:,:,i] * dWdv
            dH1du= d2ud0v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdu
github sintefmath / Splipy / splipy / Surface.py View on Github external
squeeze = all(is_singleton(t) for t in [u,v])
        derivs = ensure_listlike(d, self.pardim)
        if not self.rational or np.sum(derivs) < 2 or np.sum(derivs) > 3:
            return super(Surface, self).derivative(u,v, d=derivs, above=above, tensor=tensor)

        u = ensure_listlike(u)
        v = ensure_listlike(v)
        result = np.zeros((len(u), len(v), self.dimension))
        # dNus = [self.bases[0].evaluate(u, d, above) for d in range(derivs[0]+1)]
        # dNvs = [self.bases[1].evaluate(v, d, above) for d in range(derivs[1]+1)]
        dNus = [self.bases[0].evaluate(u, d, above) for d in range(np.sum(derivs)+1)]
        dNvs = [self.bases[1].evaluate(v, d, above) for d in range(np.sum(derivs)+1)]

        d0ud0v = evaluate([dNus[0], dNvs[0]], self.controlpoints, tensor)
        d1ud0v = evaluate([dNus[1], dNvs[0]], self.controlpoints, tensor)
        d0ud1v = evaluate([dNus[0], dNvs[1]], self.controlpoints, tensor)
        d1ud1v = evaluate([dNus[1], dNvs[1]], self.controlpoints, tensor)
        d2ud0v = evaluate([dNus[2], dNvs[0]], self.controlpoints, tensor)
        d0ud2v = evaluate([dNus[0], dNvs[2]], self.controlpoints, tensor)
        W     = d0ud0v[:,:,-1]
        dWdu  = d1ud0v[:,:,-1]
        dWdv  = d0ud1v[:,:,-1]
        d2Wduv= d1ud1v[:,:,-1]
        d2Wdu = d2ud0v[:,:,-1]
        d2Wdv = d0ud2v[:,:,-1]

        for i in range(self.dimension):
            H1   = d1ud0v[:,:,i] * W - d0ud0v[:,:,i] * dWdu
            H2   = d0ud1v[:,:,i] * W - d0ud0v[:,:,i] * dWdv
            dH1du= d2ud0v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdu
            dH1dv= d1ud1v[:,:,i] * W + d1ud0v[:,:,i] * dWdv - d0ud1v[:,:,i] * dWdu - d0ud0v[:,:,i] * d2Wduv
            dH2du= d1ud1v[:,:,i] * W + d0ud1v[:,:,i] * dWdu - d1ud0v[:,:,i] * dWdv - d0ud0v[:,:,i] * d2Wduv
github sintefmath / Splipy / splipy / Surface.py View on Github external
dH2du= d1ud1v[:,:,i] * W + d0ud1v[:,:,i] * dWdu - d1ud0v[:,:,i] * dWdv - d0ud0v[:,:,i] * d2Wduv
            dH2dv= d0ud2v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdv
            G1   = dH1du*W - 2*H1*dWdu
            G2   = dH2dv*W - 2*H2*dWdv
            if derivs == (1,0):
                result[:,:,i] = H1 / W/W
            elif derivs == (0,1):
                result[:,:,i] = H2 / W/W
            elif derivs == (1,1):
                result[:,:,i] = (dH1dv*W - 2*H1*dWdv) /W/W/W
            elif derivs == (2,0):
                result[:,:,i] = G1 /W/W/W
            elif derivs == (0,2):
                result[:,:,i] = G2 /W/W/W
            if np.sum(derivs) > 2:
                d2ud1v = evaluate([dNus[2], dNvs[1]], self.controlpoints, tensor)
                d1ud2v = evaluate([dNus[1], dNvs[2]], self.controlpoints, tensor)
                d3ud0v = evaluate([dNus[3], dNvs[0]], self.controlpoints, tensor)
                d0ud3v = evaluate([dNus[0], dNvs[3]], self.controlpoints, tensor)
                d3Wdu   = d3ud0v[:,:,-1]
                d3Wdv   = d0ud3v[:,:,-1]
                d3Wduuv = d2ud1v[:,:,-1]
                d3Wduvv = d1ud2v[:,:,-1]
                d2H1du  = d3ud0v[:,:,i]*W + d2ud0v[:,:,i]*dWdu - d1ud0v[:,:,i]*d2Wdu - d0ud0v[:,:,i]*d3Wdu
                d2H1duv = d2ud1v[:,:,i]*W + d2ud0v[:,:,i]*dWdv - d0ud1v[:,:,i]*d2Wdu - d0ud0v[:,:,i]*d3Wduuv
                d2H2dv  = d0ud3v[:,:,i]*W + d0ud2v[:,:,i]*dWdv - d0ud1v[:,:,i]*d2Wdv - d0ud0v[:,:,i]*d3Wdv
                d2H2duv = d1ud2v[:,:,i]*W + d0ud2v[:,:,i]*dWdu - d1ud0v[:,:,i]*d2Wdv - d0ud0v[:,:,i]*d3Wduvv
                dG1du   = d2H1du *W + dH1du*dWdu - 2*dH1du*dWdu - 2*H1*d2Wdu
                dG1dv   = d2H1duv*W + dH1du*dWdv - 2*dH1dv*dWdu - 2*H1*d2Wduv
                dG2du   = d2H2duv*W + dH2dv*dWdu - 2*dH2du*dWdv - 2*H2*d2Wduv
                dG2dv   = d2H2dv *W + dH2dv*dWdv - 2*dH2dv*dWdv - 2*H2*d2Wdv
github sintefmath / Splipy / splipy / Surface.py View on Github external
derivs = ensure_listlike(d, self.pardim)
        if not self.rational or np.sum(derivs) < 2 or np.sum(derivs) > 3:
            return super(Surface, self).derivative(u,v, d=derivs, above=above, tensor=tensor)

        u = ensure_listlike(u)
        v = ensure_listlike(v)
        result = np.zeros((len(u), len(v), self.dimension))
        # dNus = [self.bases[0].evaluate(u, d, above) for d in range(derivs[0]+1)]
        # dNvs = [self.bases[1].evaluate(v, d, above) for d in range(derivs[1]+1)]
        dNus = [self.bases[0].evaluate(u, d, above) for d in range(np.sum(derivs)+1)]
        dNvs = [self.bases[1].evaluate(v, d, above) for d in range(np.sum(derivs)+1)]

        d0ud0v = evaluate([dNus[0], dNvs[0]], self.controlpoints, tensor)
        d1ud0v = evaluate([dNus[1], dNvs[0]], self.controlpoints, tensor)
        d0ud1v = evaluate([dNus[0], dNvs[1]], self.controlpoints, tensor)
        d1ud1v = evaluate([dNus[1], dNvs[1]], self.controlpoints, tensor)
        d2ud0v = evaluate([dNus[2], dNvs[0]], self.controlpoints, tensor)
        d0ud2v = evaluate([dNus[0], dNvs[2]], self.controlpoints, tensor)
        W     = d0ud0v[:,:,-1]
        dWdu  = d1ud0v[:,:,-1]
        dWdv  = d0ud1v[:,:,-1]
        d2Wduv= d1ud1v[:,:,-1]
        d2Wdu = d2ud0v[:,:,-1]
        d2Wdv = d0ud2v[:,:,-1]

        for i in range(self.dimension):
            H1   = d1ud0v[:,:,i] * W - d0ud0v[:,:,i] * dWdu
            H2   = d0ud1v[:,:,i] * W - d0ud0v[:,:,i] * dWdv
            dH1du= d2ud0v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdu
            dH1dv= d1ud1v[:,:,i] * W + d1ud0v[:,:,i] * dWdv - d0ud1v[:,:,i] * dWdu - d0ud0v[:,:,i] * d2Wduv
            dH2du= d1ud1v[:,:,i] * W + d0ud1v[:,:,i] * dWdu - d1ud0v[:,:,i] * dWdv - d0ud0v[:,:,i] * d2Wduv
            dH2dv= d0ud2v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdv
github sintefmath / Splipy / splipy / Surface.py View on Github external
return super(Surface, self).derivative(u,v, d=derivs, above=above, tensor=tensor)

        u = ensure_listlike(u)
        v = ensure_listlike(v)
        result = np.zeros((len(u), len(v), self.dimension))
        # dNus = [self.bases[0].evaluate(u, d, above) for d in range(derivs[0]+1)]
        # dNvs = [self.bases[1].evaluate(v, d, above) for d in range(derivs[1]+1)]
        dNus = [self.bases[0].evaluate(u, d, above) for d in range(np.sum(derivs)+1)]
        dNvs = [self.bases[1].evaluate(v, d, above) for d in range(np.sum(derivs)+1)]

        d0ud0v = evaluate([dNus[0], dNvs[0]], self.controlpoints, tensor)
        d1ud0v = evaluate([dNus[1], dNvs[0]], self.controlpoints, tensor)
        d0ud1v = evaluate([dNus[0], dNvs[1]], self.controlpoints, tensor)
        d1ud1v = evaluate([dNus[1], dNvs[1]], self.controlpoints, tensor)
        d2ud0v = evaluate([dNus[2], dNvs[0]], self.controlpoints, tensor)
        d0ud2v = evaluate([dNus[0], dNvs[2]], self.controlpoints, tensor)
        W     = d0ud0v[:,:,-1]
        dWdu  = d1ud0v[:,:,-1]
        dWdv  = d0ud1v[:,:,-1]
        d2Wduv= d1ud1v[:,:,-1]
        d2Wdu = d2ud0v[:,:,-1]
        d2Wdv = d0ud2v[:,:,-1]

        for i in range(self.dimension):
            H1   = d1ud0v[:,:,i] * W - d0ud0v[:,:,i] * dWdu
            H2   = d0ud1v[:,:,i] * W - d0ud0v[:,:,i] * dWdv
            dH1du= d2ud0v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdu
            dH1dv= d1ud1v[:,:,i] * W + d1ud0v[:,:,i] * dWdv - d0ud1v[:,:,i] * dWdu - d0ud0v[:,:,i] * d2Wduv
            dH2du= d1ud1v[:,:,i] * W + d0ud1v[:,:,i] * dWdu - d1ud0v[:,:,i] * dWdv - d0ud0v[:,:,i] * d2Wduv
            dH2dv= d0ud2v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdv
            G1   = dH1du*W - 2*H1*dWdu
            G2   = dH2dv*W - 2*H2*dWdv
github sintefmath / Splipy / splipy / Surface.py View on Github external
squeeze = all(is_singleton(t) for t in [u,v])
        derivs = ensure_listlike(d, self.pardim)
        if not self.rational or np.sum(derivs) < 2 or np.sum(derivs) > 3:
            return super(Surface, self).derivative(u,v, d=derivs, above=above, tensor=tensor)

        u = ensure_listlike(u)
        v = ensure_listlike(v)
        result = np.zeros((len(u), len(v), self.dimension))
        # dNus = [self.bases[0].evaluate(u, d, above) for d in range(derivs[0]+1)]
        # dNvs = [self.bases[1].evaluate(v, d, above) for d in range(derivs[1]+1)]
        dNus = [self.bases[0].evaluate(u, d, above) for d in range(np.sum(derivs)+1)]
        dNvs = [self.bases[1].evaluate(v, d, above) for d in range(np.sum(derivs)+1)]

        d0ud0v = evaluate([dNus[0], dNvs[0]], self.controlpoints, tensor)
        d1ud0v = evaluate([dNus[1], dNvs[0]], self.controlpoints, tensor)
        d0ud1v = evaluate([dNus[0], dNvs[1]], self.controlpoints, tensor)
        d1ud1v = evaluate([dNus[1], dNvs[1]], self.controlpoints, tensor)
        d2ud0v = evaluate([dNus[2], dNvs[0]], self.controlpoints, tensor)
        d0ud2v = evaluate([dNus[0], dNvs[2]], self.controlpoints, tensor)
        W     = d0ud0v[:,:,-1]
        dWdu  = d1ud0v[:,:,-1]
        dWdv  = d0ud1v[:,:,-1]
        d2Wduv= d1ud1v[:,:,-1]
        d2Wdu = d2ud0v[:,:,-1]
        d2Wdv = d0ud2v[:,:,-1]

        for i in range(self.dimension):
            H1   = d1ud0v[:,:,i] * W - d0ud0v[:,:,i] * dWdu
            H2   = d0ud1v[:,:,i] * W - d0ud0v[:,:,i] * dWdv
            dH1du= d2ud0v[:,:,i] * W - d0ud0v[:,:,i] * d2Wdu
            dH1dv= d1ud1v[:,:,i] * W + d1ud0v[:,:,i] * dWdv - d0ud1v[:,:,i] * dWdu - d0ud0v[:,:,i] * d2Wduv