Establish the external nodes and set up the transformation matrix for orientation
| 1834 | // Establish the external nodes and set up the transformation matrix |
| 1835 | // for orientation |
| 1836 | void |
| 1837 | ZeroLength::setUp( int Nd1, int Nd2, |
| 1838 | const Vector &x, |
| 1839 | const Vector &yp ) |
| 1840 | { |
| 1841 | // ensure the connectedExternalNode ID is of correct size & set values |
| 1842 | if (connectedExternalNodes.Size() != 2) |
| 1843 | opserr << "FATAL ZeroLength::setUp - failed to create an ID of correct size\n"; |
| 1844 | |
| 1845 | connectedExternalNodes(0) = Nd1; |
| 1846 | connectedExternalNodes(1) = Nd2; |
| 1847 | |
| 1848 | int i; |
| 1849 | for (i=0; i<2; i++) |
| 1850 | theNodes[i] = 0; |
| 1851 | |
| 1852 | // check that vectors for orientation are correct size |
| 1853 | if ( x.Size() != 3 || yp.Size() != 3 ) |
| 1854 | opserr << "FATAL ZeroLength::setUp - incorrect dimension of orientation vectors\n"; |
| 1855 | |
| 1856 | // establish orientation of element for the transformation matrix |
| 1857 | // z = x cross yp |
| 1858 | Vector z(3); |
| 1859 | z(0) = x(1)*yp(2) - x(2)*yp(1); |
| 1860 | z(1) = x(2)*yp(0) - x(0)*yp(2); |
| 1861 | z(2) = x(0)*yp(1) - x(1)*yp(0); |
| 1862 | |
| 1863 | // y = z cross x |
| 1864 | Vector y(3); |
| 1865 | y(0) = z(1)*x(2) - z(2)*x(1); |
| 1866 | y(1) = z(2)*x(0) - z(0)*x(2); |
| 1867 | y(2) = z(0)*x(1) - z(1)*x(0); |
| 1868 | |
| 1869 | // compute length(norm) of vectors |
| 1870 | double xn = x.Norm(); |
| 1871 | double yn = y.Norm(); |
| 1872 | double zn = z.Norm(); |
| 1873 | |
| 1874 | // check valid x and y vectors, i.e. not parallel and of zero length |
| 1875 | if (xn == 0 || yn == 0 || zn == 0) { |
| 1876 | opserr << "FATAL ZeroLength::setUp - invalid vectors to constructor\n"; |
| 1877 | } |
| 1878 | |
| 1879 | // create transformation matrix of direction cosines |
| 1880 | for ( i=0; i<3; i++ ) { |
| 1881 | transformation(0,i) = x(i)/xn; |
| 1882 | transformation(1,i) = y(i)/yn; |
| 1883 | transformation(2,i) = z(i)/zn; |
| 1884 | } |
| 1885 | |
| 1886 | } |
| 1887 | |
| 1888 | |
| 1889 | // Check that direction is in the range of 0 to 5 |
no test coverage detected