44       real*8 shp(7,8),xs(3,7),xsi(2,3),xl(3,8),sh(3),xsj(3),xi,et,
    45      &  xip,xim,xim2,etp,etm,etm2,xipet,ximet
    63       shp(4,1)=xim*etm*(-xipet-1.d0)/4.d0
    64       shp(4,2)=xip*etm*(ximet-1.d0)/4.d0
    65       shp(4,3)=xip*etp*(xipet-1.d0)/4.d0
    66       shp(4,4)=xim*etp*(-ximet-1.d0)/4.d0
    67       shp(4,5)=xim2*etm/2.d0
    68       shp(4,6)=xip*etm2/2.d0
    69       shp(4,7)=xim2*etp/2.d0
    70       shp(4,8)=xim*etm2/2.d0
    76       shp(1,1)=etm*(xi+xipet)/4.d0
    77       shp(1,2)=etm*(xi+ximet)/4.d0
    78       shp(1,3)=etp*(xi+xipet)/4.d0
    79       shp(1,4)=etp*(xi+ximet)/4.d0
    87       shp(2,1)=xim*(et+xipet)/4.d0
    88       shp(2,2)=xip*(et-ximet)/4.d0
    89       shp(2,3)=xip*(et+xipet)/4.d0
    90       shp(2,4)=xim*(et-ximet)/4.d0
   105             xs(i,j)=xs(i,j)+xl(i,k)*shp(j,k)
   112       xsj(1)=xs(2,1)*xs(3,2)-xs(3,1)*xs(2,2)
   113       xsj(2)=xs(1,2)*xs(3,1)-xs(3,2)*xs(1,1)
   114       xsj(3)=xs(1,1)*xs(2,2)-xs(2,1)*xs(1,2)
   121          if(dabs(xsj(3)).gt.1.d-10) 
then   122             xsi(1,1)=xs(2,2)/xsj(3)
   123             xsi(2,2)=xs(1,1)/xsj(3)
   124             xsi(1,2)=-xs(1,2)/xsj(3)
   125             xsi(2,1)=-xs(2,1)/xsj(3)
   126             if(dabs(xsj(2)).gt.1.d-10) 
then   127                xsi(2,3)=xs(1,1)/(-xsj(2))
   128                xsi(1,3)=-xs(1,2)/(-xsj(2))
   129             elseif(dabs(xsj(1)).gt.1.d-10) 
then   130                xsi(2,3)=xs(2,1)/xsj(1)
   131                xsi(1,3)=-xs(2,2)/xsj(1)
   136          elseif(dabs(xsj(2)).gt.1.d-10) 
then   137             xsi(1,1)=xs(3,2)/(-xsj(2))
   138             xsi(2,3)=xs(1,1)/(-xsj(2))
   139             xsi(1,3)=-xs(1,2)/(-xsj(2))
   140             xsi(2,1)=-xs(3,1)/(-xsj(2))
   141             if(dabs(xsj(1)).gt.1.d-10) 
then   142                xsi(1,2)=xs(3,2)/xsj(1)
   143                xsi(2,2)=-xs(3,1)/xsj(1)
   149             xsi(1,2)=xs(3,2)/xsj(1)
   150             xsi(2,3)=xs(2,1)/xsj(1)
   151             xsi(1,3)=-xs(2,2)/xsj(1)
   152             xsi(2,2)=-xs(3,1)/xsj(1)
   161                sh(j)=shp(1,k)*xsi(1,j)+shp(2,k)*xsi(2,j)
   168       elseif(iflag.eq.4) 
then   183          shp(6,1)=(1.d0-2.d0*xipet)/4.d0
   184          shp(6,2)=(-1.d0-2.d0*ximet)/4.d0
   185          shp(6,3)=(1.d0+2.d0*xipet)/4.d0
   186          shp(6,4)=(-1.d0+2.d0*ximet)/4.d0
   210                   xs(i,j)=xs(i,j)+xl(i,k)*shp(j,k)