C B2COQ2    SOURCE    CHAT      05/01/12    21:31:09     5004
      SUBROUTINE B2COQ2(XSTRS,NSTRS,xddl,nbddl,xel,nbnn,t,p,igau)
      IMPLICIT INTEGER(I-N)
      IMPLICIT REAL*8 (A-H,O-Z)

      parameter(xzero=0.d0,demi=0.5d0,un=1.d0,deux=2.d0,trois=3.d0,
     +          quatre=4.d0,six=6.d0)

      dimension xstrs(*),xddl(*),xel(3,*),t(*),p(*)
      dimension ddlloc(6),z(3,3)


-INC PPARAM
-INC CCOPTIO

      D=SQRT((XEL(1,2)-XEL(1,1))**2+(XEL(2,2)-XEL(2,1))**2)
      SP=(XEL(1,2)-XEL(1,1))/D
      CP=(XEL(2,2)-XEL(2,1))/D

      z(1,1)=sp
      z(1,2)=cp
      z(1,3)=xzero
      z(2,1)=-cp
      z(2,2)=sp
      z(2,3)=xzero
      z(3,1)=xzero
      z(3,2)=xzero
      z(3,3)=un

      do 100 i=1,3
         ddlloc(i  )=xzero
         ddlloc(i+3)=xzero
         do 101 j=1,3
            ddlloc(i  )=ddlloc(i  )+z(i,j)*xddl(j  )
            ddlloc(i+3)=ddlloc(i+3)+z(i,j)*xddl(j+3)
 101     continue
 100  continue

      s=t(igau)*demi+demi

      dudx = xstrs(1)
      terme1=six*s*(s-un)
      dwdx = terme1*(ddlloc(2)-ddlloc(5))/D
      dwdx = dwdx + ddlloc(3)*(trois*s*s-quatre*s+un)
     +            + ddlloc(6)*(trois*s*s-deux*s     )

c ... on modifie ep_ss dans tous les cas :
c         PLAN GENE       PLAN CONT      PLAN DEFO
      if(ifour.eq.-3.or.ifour.eq.-2.or.ifour.eq.-1.or.
c            AXIS                FOURIER N° 0
     &   ifour.eq. 0.or.(ifour.eq.1.and.nifour.eq.0)) then
         xstrs(1)=xstrs(1)+demi*(dudx*dudx+dwdx*dwdx)
      endif

c ... on modifie ep_theta_theta ou ep_zz en modes :
c          AXIS        PLAN GENE            FOURIER N° 0
      if(ifour.eq.0.or.ifour.eq.-3.or.(ifour.eq.1.and.nifour.eq.0)) then
         xstrs(2) = xstrs(2) + demi*xstrs(2)*xstrs(2)
      endif

c ... on ne modifie pas de cisaillement ep_s_theta en mode Fourier 0,
c     car rien ne depend de theta, or ce terme contient les derivées par
c     rapport à theta ...

      RETURN
      END



