How to use the compas.hpc.dot_vectors_numba function in COMPAS

To help you get started, we’ve selected a few COMPAS 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 compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
Vertex v x-direction.
     yv : array
         Vertex v y-direction.
     zv : array
         Vertex v z-direction.

     Returns
     -------
     array
         Thetas

     """

    theta_xu = arcsin(0.5 * (vdotv(ze, yu) - vdotv(zu, ye)))
    theta_xv = arcsin(0.5 * (vdotv(ze, yv) - vdotv(zv, ye)))
    theta_yu = arcsin(0.5 * (vdotv(ze, xu) - vdotv(zu, xe)))
    theta_yv = arcsin(0.5 * (vdotv(ze, xv) - vdotv(zv, xe)))
    theta_zu = arcsin(0.5 * (vdotv(ye, xu) - vdotv(yu, xe)))
    theta_zv = arcsin(0.5 * (vdotv(ye, xv) - vdotv(yv, xe)))

    return array([theta_xu, theta_xv, theta_yu, theta_yv, theta_zu, theta_zv])
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_geomstiff.py View on Github external
x_v : array
        Vertex v x-direction.
    y_v : array
        Vertex v y-direction.
    z_v : array
        Vertex v z-direction.

    Returns
    -------
    array
        T matrix
    """

    theta_xu = arcsin((dot_vectors_numba(z_e, y_u) - dot_vectors_numba(z_u, y_e)) / 2)
    theta_xv = arcsin((dot_vectors_numba(z_e, y_v) - dot_vectors_numba(z_v, y_e)) / 2)
    theta_yu = arcsin((dot_vectors_numba(z_e, x_u) - dot_vectors_numba(z_u, x_e)) / 2)
    theta_yv = arcsin((dot_vectors_numba(z_e, x_v) - dot_vectors_numba(z_v, x_e)) / 2)
    theta_zu = arcsin((dot_vectors_numba(y_e, x_u) - dot_vectors_numba(y_u, x_e)) / 2)
    theta_zv = arcsin((dot_vectors_numba(y_e, x_v) - dot_vectors_numba(y_v, x_e)) / 2)

    return array([theta_xu, theta_xv, theta_yu, theta_yv, theta_zu, theta_zv])
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
dLambda *= 0.

    for i in range(len(fdof_rot_)):

        for jj in range(3):
            j = ind[i, jj]
            index = fdof_axis[IDXrot[j]]
            Lambdaold[index - 3] = xold[IDXrot[j]][0]
            dLambda[index - 3] = dx[IDXrot[j]][0]

        qO = _quaternion(Lambdaold)
        qQ = _quaternion(dLambda)
        qold, q0old = qO[:3], qO[3]
        dq, dq0 = qQ[:3], qQ[3]
        qnew = q0old * dq + dq0 * qold - cross_vectors_numba(qold, dq)
        q0new = q0old * dq0 - vdotv(qold, dq)
        lambdanew = 2 * arctan(norm_vector_numba(qnew) / q0new)

        if norm(qnew) == 0.:
            Lnew = qnew
        else:
            Lnew = qnew / norm_vector_numba(qnew)
        Lambdanew = lambdanew * Lnew

        value = fdof_rot_[i]
        for j in range(len(fdof_rot)):
            if fdof_rot[j] == value:
                x[IDXrot[j]] = Lambdanew[fdof_axis[IDXrot[j]] - 3]

    return x
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
yv : array
         Vertex v y-direction.
     zv : array
         Vertex v z-direction.

     Returns
     -------
     array
         Thetas

     """

    theta_xu = arcsin(0.5 * (vdotv(ze, yu) - vdotv(zu, ye)))
    theta_xv = arcsin(0.5 * (vdotv(ze, yv) - vdotv(zv, ye)))
    theta_yu = arcsin(0.5 * (vdotv(ze, xu) - vdotv(zu, xe)))
    theta_yv = arcsin(0.5 * (vdotv(ze, xv) - vdotv(zv, xe)))
    theta_zu = arcsin(0.5 * (vdotv(ye, xu) - vdotv(yu, xe)))
    theta_zv = arcsin(0.5 * (vdotv(ye, xv) - vdotv(yv, xe)))

    return array([theta_xu, theta_xv, theta_yu, theta_yv, theta_zu, theta_zv])
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
Sx, Szuzv, Syvyu):

    for i in range(m):

        xe = (X[kiv_[i], :] - X[kiu_[i], :])
        l[i] = length_vector_numba(xe)

        t0t = T0[(i * 3):((i + 1) * 3), 0:3]
        Tu = _beam_triad(u_[i], x_, IDXalpha, IDXbeta, IDXgamma, t0t, Sbt)
        Tv = _beam_triad(v_[i], x_, IDXalpha, IDXbeta, IDXgamma, t0t, Sbt)
        Re = _element_rotmat(Tu, Tv)

        xu, yu, zu = Tu[:, 0], Tu[:, 1], Tu[:, 2]
        xv, yv, zv = Tv[:, 0], Tv[:, 1], Tv[:, 2]
        xe /= norm(xe)
        ye = Re[:, 1] - vdotv(Re[:, 1], xe) / 2 * (xe + Re[:, 0])
        ze = Re[:, 2] - vdotv(Re[:, 2], xe) / 2 * (xe + Re[:, 0])

        theta = _deformations(xe, ye, ze, xu, yu, zu, xv, yv, zv)

        T, L2, L3, B = _create_T(eye3, zero3, zero6, zero9, xe, ye, ze, Re, Sr0, Sr1, Sr2, Sxu, Syu, Szu, Sxv, Syv,
                                 Szv, theta, xu, yu, zu, xv, yv, zv, l[i])

        K_ = 1. / l0[i][0] * Kall[:, :, i]

        f, f_ = _element_forces(l[i][0], l0[i][0], theta, T, f, I[i], J[i], i, K_)

        data, count = _data(I[i], J[i], data, count, l0, T, geomstiff, i, K_, zero33, zero123, Sr0, Sr1, Sr2, Sxu, Syu, Szu, Sxv, Syv, Szv, Sx, Szuzv, Syvyu, L2, L3, Tu, Tv, theta, xe, Re, B, l, f_)

    return data, f
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_updated.py View on Github external
zv : array
        Vertex v z-direction.

    Returns
    -------
    array
        Thetas.

    """

    theta_xu = arcsin(0.5 * (vdotv(ze, yu) - vdotv(zu, ye)))
    theta_xv = arcsin(0.5 * (vdotv(ze, yv) - vdotv(zv, ye)))
    theta_yu = arcsin(0.5 * (vdotv(ze, xu) - vdotv(zu, xe)))
    theta_yv = arcsin(0.5 * (vdotv(ze, xv) - vdotv(zv, xe)))
    theta_zu = arcsin(0.5 * (vdotv(ye, xu) - vdotv(yu, xe)))
    theta_zv = arcsin(0.5 * (vdotv(ye, xv) - vdotv(yv, xe)))

    return array([theta_xu, theta_xv, theta_yu, theta_yv, theta_zu, theta_zv])
github compas-dev / compas / src / compas / hpc / algorithms / drx_numba.py View on Github external
ey = cross_vectors_numba(ez, ex)
                K = k * Qn / LQn
                Kx = dot_vectors_numba(K, ex) * ex
                Ky = dot_vectors_numba(K, ey) * ey
                Mc = EIx[i] * Kx + EIy[i] * Ky
                cma = cross_vectors_numba(Mc, Qa)
                cmb = cross_vectors_numba(Mc, Qb)
                ua = cma / length_vector_numba(cma)
                ub = cmb / length_vector_numba(cmb)
                c1 = cross_vectors_numba(Qa, ua)
                c2 = cross_vectors_numba(Qb, ub)
                Lc1 = length_vector_numba(c1)
                Lc2 = length_vector_numba(c2)
                Ms = Mc[0]**2 + Mc[1]**2 + Mc[2]**2
                Sa = ua * Ms * Lc1 / (La * dot_vectors_numba(Mc, c1))
                Sb = ub * Ms * Lc2 / (Lb * dot_vectors_numba(Mc, c2))
                S[inds[i], :] += Sa
                S[indi[i], :] -= Sa + Sb
                S[indf[i], :] += Sb

        frx *= 0
        fry *= 0
        frz *= 0
        for i in range(nv):
            frx[rows[i]] += vals[i] * fx[cols[i]]
            fry[rows[i]] += vals[i] * fy[cols[i]]
            frz[rows[i]] += vals[i] * fz[cols[i]]
        Un = 0.
        for i in range(n):
            Rx = (P[i, 0] - S[i, 0] - frx[i]) * B[i, 0]
            Ry = (P[i, 1] - S[i, 1] - fry[i]) * B[i, 1]
            Rz = (P[i, 2] - S[i, 2] - frz[i]) * B[i, 2]
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_updated.py View on Github external
yv : array
        Vertex v y-direction.
    zv : array
        Vertex v z-direction.

    Returns
    -------
    array
        Thetas.

    """

    theta_xu = arcsin(0.5 * (vdotv(ze, yu) - vdotv(zu, ye)))
    theta_xv = arcsin(0.5 * (vdotv(ze, yv) - vdotv(zv, ye)))
    theta_yu = arcsin(0.5 * (vdotv(ze, xu) - vdotv(zu, xe)))
    theta_yv = arcsin(0.5 * (vdotv(ze, xv) - vdotv(zv, xe)))
    theta_zu = arcsin(0.5 * (vdotv(ye, xu) - vdotv(yu, xe)))
    theta_zv = arcsin(0.5 * (vdotv(ye, xv) - vdotv(yv, xe)))

    return array([theta_xu, theta_xv, theta_yu, theta_yv, theta_zu, theta_zv])
github compas-dev / compas / src / compas / hpc / algorithms / drx_numba.py View on Github external
Qb = Xf - Xi
                Qc = Xf - Xs
                Qn = cross_vectors_numba(Qa, Qb)
                mu = 0.5 * (Xf - Xs)
                La = length_vector_numba(Qa)
                Lb = length_vector_numba(Qb)
                Lc = length_vector_numba(Qc)
                LQn = length_vector_numba(Qn)
                Lmu = length_vector_numba(mu)
                a = arccos((La**2 + Lb**2 - Lc**2) / (2 * La * Lb))
                k = 2 * sin(a) / Lc
                ex = Qn / LQn
                ez = mu / Lmu
                ey = cross_vectors_numba(ez, ex)
                K = k * Qn / LQn
                Kx = dot_vectors_numba(K, ex) * ex
                Ky = dot_vectors_numba(K, ey) * ey
                Mc = EIx[i] * Kx + EIy[i] * Ky
                cma = cross_vectors_numba(Mc, Qa)
                cmb = cross_vectors_numba(Mc, Qb)
                ua = cma / length_vector_numba(cma)
                ub = cmb / length_vector_numba(cmb)
                c1 = cross_vectors_numba(Qa, ua)
                c2 = cross_vectors_numba(Qb, ub)
                Lc1 = length_vector_numba(c1)
                Lc2 = length_vector_numba(c2)
                Ms = Mc[0]**2 + Mc[1]**2 + Mc[2]**2
                Sa = ua * Ms * Lc1 / (La * dot_vectors_numba(Mc, c1))
                Sb = ub * Ms * Lc2 / (Lb * dot_vectors_numba(Mc, c2))
                S[inds[i], :] += Sa
                S[indi[i], :] -= Sa + Sb
                S[indf[i], :] += Sb