Set basic deformation-displacement transformation matrix for 1d uniaxial materials
| 1901 | // Set basic deformation-displacement transformation matrix for 1d |
| 1902 | // uniaxial materials |
| 1903 | void |
| 1904 | ZeroLength::setTran1d( Etype elemType, |
| 1905 | int numMat ) |
| 1906 | { |
| 1907 | enum Dtype { TRANS, ROTATE }; |
| 1908 | |
| 1909 | int indx, dir; |
| 1910 | Dtype dirType; |
| 1911 | |
| 1912 | // Create 1d transformation matrix |
| 1913 | t1d = new Matrix(numMat,numDOF); |
| 1914 | |
| 1915 | if (t1d == 0) |
| 1916 | opserr << "FATAL ZeroLength::setTran1d - can't allocate 1d transformation matrix\n"; |
| 1917 | |
| 1918 | // Use reference for convenience and zero matrix. |
| 1919 | Matrix& tran = *t1d; |
| 1920 | tran.Zero(); |
| 1921 | |
| 1922 | // loop over materials, setting row in tran for each material depending on dimensionality of element |
| 1923 | |
| 1924 | for ( int i=0; i<numMat; i++ ) { |
| 1925 | |
| 1926 | dir = (*dir1d)(i); // direction 0 to 5; |
| 1927 | indx = dir % 3; // direction 0, 1, 2 for axis of translation or rotation |
| 1928 | |
| 1929 | // set direction type to translation or rotation |
| 1930 | dirType = (dir<3) ? TRANS : ROTATE; |
| 1931 | |
| 1932 | // now switch on dimensionality of element |
| 1933 | |
| 1934 | switch (elemType) { |
| 1935 | |
| 1936 | case D1N2: |
| 1937 | if (dirType == TRANS) |
| 1938 | tran(i,1) = transformation(indx,0); |
| 1939 | break; |
| 1940 | |
| 1941 | case D2N4: |
| 1942 | if (dirType == TRANS) { |
| 1943 | tran(i,2) = transformation(indx,0); |
| 1944 | tran(i,3) = transformation(indx,1); |
| 1945 | } |
| 1946 | break; |
| 1947 | |
| 1948 | case D2N6: |
| 1949 | if (dirType == TRANS) { |
| 1950 | tran(i,3) = transformation(indx,0); |
| 1951 | tran(i,4) = transformation(indx,1); |
| 1952 | tran(i,5) = 0.0; |
| 1953 | } else if (dirType == ROTATE) { |
| 1954 | tran(i,3) = 0.0; |
| 1955 | tran(i,4) = 0.0; |
| 1956 | tran(i,5) = transformation(indx,2); |
| 1957 | } |
| 1958 | break; |
| 1959 | |
| 1960 | case D3N6: |