// in global 3D coordinate system bp::tuple computeShearAndBending() { PolyVec Vx, Vy, Fz, Mx, My, Tz; beam->shearAndBending(Vx, Vy, Fz, Mx, My, Tz); bp::list Vx0, Vy0, Fz0, Mx0, My0, Tz0; int n = beam->getNumNodes() - 1; for(int i = 0; i < n; i++) { Vx0.append(Vx(i).eval(0.0)); Vy0.append(Vy(i).eval(0.0)); Fz0.append(Fz(i).eval(0.0)); Mx0.append(-My(i).eval(0.0)); // translate back to global coordinates My0.append(Mx(i).eval(0.0)); // translate back to global coordinates Tz0.append(Tz(i).eval(0.0)); } Vx0.append(Vx(n-1).eval(1.0)); Vy0.append(Vy(n-1).eval(1.0)); Fz0.append(Fz(n-1).eval(1.0)); Mx0.append(-My(n-1).eval(1.0)); // translate back to global coordinates My0.append(Mx(n-1).eval(1.0)); // translate back to global coordinates Tz0.append(Tz(n-1).eval(1.0)); return bp::make_tuple(bpn::array(Vx0), bpn::array(Vy0), bpn::array(Fz0), bpn::array(Mx0), bpn::array(My0), bpn::array(Tz0)); }
// in global 3D coordinate system py::tuple computeShearAndBending(){ PolyVec Vx, Vy, Fz, Mx, My, Tz; beam->shearAndBending(Vx, Vy, Fz, Mx, My, Tz); int n = beam->getNumNodes() - 1; int nodes = n + 1; Vector Vx0(nodes), Vy0(nodes), Fz0(nodes), Mx0(nodes), My0(nodes), Tz0(nodes); for(int i = 0; i < n; i++) { Vx0[i] = Vx[i].eval(0.0); Vy0[i] = Vy[i].eval(0.0); Fz0[i] = Fz[i].eval(0.0); Mx0[i] = -My[i].eval(0.0); // translate back to global coordinates My0[i] = Mx[i].eval(0.0); // translate back to global coordinates Tz0[i] = Tz[i].eval(0.0); } Vx0[n] = Vx[n-1].eval(1.0); Vy0[n] = Vy[n-1].eval(1.0); Fz0[n] = Fz[n-1].eval(1.0); Mx0[n] = -My[n-1].eval(1.0); // translate back to global coordinates My0[n] = Mx[n-1].eval(1.0); // translate back to global coordinates Tz0[n] = Tz[n-1].eval(1.0); return py::make_tuple(Vx0, Vy0, Fz0, Mx0, My0, Tz0); }