*     ************************************************************************

      subroutine invpss( elcomp, elptr, compel, comptr )

*     ************************************************************************

*     Purpose :
*     ---------

*     This routine inverse the partially separable structure.

*     On input, the components of the successive elements are
*     containt in the integer vector ELCOMP(.).The integer
*     pointer vector ELPTR(.) points to the first component
*     index of the successive elements.

*     On output, the elements in which the successive
*     components appears are containt in the integer vector
*     COMPEL(.).The integer pointer vector COMPTR(.) points
*     to the first element index of the successive components.

*     Parameters :
*     ------------

*     n       ( int )

*       input  : the number of components of the problem.
*       output : unmodified.

*     nel     ( int )

*       input  : the number of elements of the problem.
*       output : unmodified.

*     elcomp  ( int )

*       input  : the elemental component list describing
*                the partially separable structure.
*       output : unmodified

*     elptr   ( int )

*       input  : the pointer list associated to the elemental
*                component list ELCOMP.
*       output : unmodified

*     compel  ( int )

*       input  : arbitrary.
*       output : the componental elemet list describing
*                the inverse partially separable structure.

*     comptr  ( int )

*       input  : arbitrary.
*       output : the pointer list associated to the elemental
*                component list COMPEL.

*     Routine used :
*     --------------

*     Isetvl.

*     Programming :
*     -------------

*     D. Tuyttens 

*     Remark :
*     --------

*     The coherence of the information contained in the input
*     is not checked by the routine.

*     ========================================================================

*     Routine parameters

      integer elcomp(*), elptr(*), compel(*), comptr(*)

*     Internal variables

      integer i, j

*     Common specifications

      integer           arcs, nodes, elem
      common / prbdim / arcs, nodes, elem

*
*     Initialize COMPTR
*
      call isetvl( arcs+1, comptr, 1, 0 )
*
*     Count number of times the components appaer
*
      do 10 i = 1 , abs(elptr(elem+1))-1
        comptr(elcomp(i)) = comptr(elcomp(i))+1
 10   continue
*
*     Construction of the pointer list
*
      comptr(1) = comptr(1) + 1
      do 20 i = 2 , arcs
        comptr(i) = comptr(i) + comptr(i-1)
 20   continue
      comptr(arcs+1) = comptr(arcs)
*
*     Construction of the the componental element list
*
      do 30 i = 1 , elem
        do 40 j = abs(elptr(i)) , abs(elptr(i+1))-1
          compel(comptr(elcomp(j))-1) = i
          comptr(elcomp(j)) = comptr(elcomp(j))-1
 40     continue
 30   continue
*
      return
      end
