C PARTIT    SOURCE    CB215821  17/07/21    21:15:22     9513           
c---------------------------------------------------------------------
c
      SUBROUTINE PARTIT (NDIME, NSTR1, NTENS, NCOMP,
     .                   betam, sgeff, sgten, sgcom)
c
c=====================================================================
c                                                                    =
c   This subroutine determines principal stresses and directions and =
c   performs split of stress tensor into tensile and compressive     =
c   contributions (eigen system).                                    =
c                  ------------                                      =
c   Variables:                                                       =
c                                                                    =
c       ntens                  no. of tension componentes            =
c       ncomp                   "   " compre.      "                 =
c                                                                    =
c       betam                  rotation matrix                       =
c       sgeff                  effect. stress tensor to be splitted  =
c       sgten                  tension stress tensor contribution    =
c       sgcom                  compre.    "      "        "          =
c                                                                    =
c       stpri                  eigen stresses                        =
c                                                                    =
c   Author: Rui Faria                           Version: 93.08.25    =
c                                               --------             =
c=====================================================================
      IMPLICIT INTEGER(I-N)
      integer   ndime, nstr1, ntens, ncomp
      real*8    sgeff (nstr1), sgten (nstr1), sgcom (nstr1),
     .          betam (ndime,ndime)
c
      integer   istrs
      real*8    eigen, stpri (3)
c=====----------------------------------------------------------------
c  determination of principal stresses and directions                |
c=====----------------------------------------------------------------
C+CCd
      if (nstr1 .eq. 6)  then
          call pstres (6, sgeff, stpri)
          call pdirec (3, nstr1, sgeff, stpri, betam)
      else
          call pdirec (2, nstr1, sgeff, stpri, betam)
      end if
C CCd
c=====----------------------------------------------------------------
c  partition of stress tensor                                        |
c=====----------------------------------------------------------------
      ntens = 0
      ncomp = 0
c
      do 10 istrs = 1, 3
         eigen = stpri (istrs)
         if (eigen .ge. 0.0 d0)  then
             ntens = ntens + 1
             sgten (istrs) = eigen
             sgcom (istrs) = 0.0 d0
         else
             ncomp = ncomp + 1
             sgten (istrs) = 0.0 d0
             sgcom (istrs) = eigen
         end if
   10 continue
c
      return
      end


 
