1!$Id:$
2      subroutine ptrans(ia,angl,ul,p,s,nel,ndf,nst,isw)
3
4!      * * F E A P * * A Finite Element Analysis Program
5
6!....  Copyright (c) 1984-2017: Regents of the University of California
7!                               All rights reserved
8
9!-----[--.----+----.----+----.-----------------------------------------]
10!      Purpose: Set transformation data for element computations
11!               with sloping boundary conditions
12
13!      Inputs:
14!         ia(*)     - Degrees of freedom to rotate
15!         angl(*)   - Array of element nodal angles
16!         nel       - Number of nodes on element
17!         ndf       - Number dof/node
18!         nst       - Dimension of element arrays
19!         isw       - Switch: rotate ul if isw=1; otherwise element
20!                     arrays
21
22!      Outputs:
23!         ul(*)     - Element solution variables
24!         p(*)      - Element vector
25!         s(*,*)    - Element matrix
26!-----[--.----+----.----+----.-----------------------------------------]
27
28      implicit  none
29
30      integer   nel,ndf,nst,isw, i1,ij1,ij2, i, j
31      real*8    cs,sn,tm
32
33      integer   ia(2)
34      real*8    angl(*),ul(nst,4),p(ndf,*),s(nst,nst)
35
36      save
37
38!     Subroutine to make two-dimesional rotations
39
40      ij1 = ia(1)
41      ij2 = ia(2)
42
43      if(ndf.le.1) return
44
45!     Transform displacement quantities to element coordinates
46
47      if(isw.eq.1) then
48        do i = 1,nel
49          if(angl(i).ne.0.0d0) then
50            call pdegree(angl(i), sn,cs)
51            do j = 1,6
52              tm        = cs*ul(ij1,j) - sn*ul(ij2,j)
53              ul(ij2,j) = sn*ul(ij1,j) + cs*ul(ij2,j)
54              ul(ij1,j) = tm
55            end do
56          endif
57          ij1 = ij1 + ndf
58          ij2 = ij2 + ndf
59        end do
60
61!     Transform element arrays to global coordinates
62
63      else
64        i1 = 0
65        do i = 1,nel
66          if(angl(i).ne.0.0d0) then
67            call pdegree(angl(i), sn,cs)
68
69!           Transform load vector
70
71            tm       = cs*p(ij1,i) + sn*p(ij2,i)
72            p(ij2,i) =-sn*p(ij1,i) + cs*p(ij2,i)
73            p(ij1,i) = tm
74            if(isw.eq.2) then
75
76!             Postmultiply s by transformation
77
78              do j = 1,nst
79                tm         = s(j,i1+ij1)*cs + s(j,i1+ij2)*sn
80                s(j,i1+ij2)=-s(j,i1+ij1)*sn + s(j,i1+ij2)*cs
81                s(j,i1+ij1)= tm
82              end do
83
84!             Premultiply s by transformation
85
86              do j = 1,nst
87                tm         = cs*s(i1+ij1,j) + sn*s(i1+ij2,j)
88                s(i1+ij2,j)=-sn*s(i1+ij1,j) + cs*s(i1+ij2,j)
89                s(i1+ij1,j)= tm
90              end do
91            endif
92          endif
93          i1 = i1 + ndf
94        end do
95      endif
96
97      end
98