C GRADGE    SOURCE    KK2000    14/04/10    21:15:07     8032
      SUBROUTINE GRADGE(ICEN,IELTFA,IFAC,IFACEL,INORM,ICHCL,ICHAM)
C------------------------------------------------------------------
C PROJET        :  CASTEM 2000
C
C NOM           :  GRADGE
C
C DESCRIPTION   :  Cette subroutine est appellee par
C                  PENT15 et calcule les coefficients a appliquer
C                  sur la fonction dont on veut calculer le gradient
C                  pour chacune des coordonnees. Ces coefficients
C                  sont stockes dans ICHAM
C
C LANGAGE       :  FORTRAN 77 + ESOPE 2000
C
C AUTEUR        :  A. BECCANTINI, SFME/LTMF
C
C-----------------------------------------------------------------
C
C APPELES (E/S) :
C
C APPELES (Calcul):  CONSDU, RSETXI, ELKONF
C
C-----------------------------------------------------------------
C
C INPUT        : ICEN   : 'CENTRE' points
C
C                IELTFA : Element-faces
C
C                IFAC   : 'FACE' points
C
C                IFACEL : Left center - face center -right center
C                         Same order as IFAC
C
C                INORM  : Face normals CHAMPOINT
C
C                ICHCL  : BC CHAMPOINT
C
C
C OUTPUT        : ICHAM : MCHEML which contains the coefficients to
C                         compute gradients.
C
C-----------------------------------------------------------------
C
C HISTORIQUE (Anomalies et modifications eventuelles)
C
C HISTORIQUE     : 14.10.98, Creation
C
C-----------------------------------------------------------------
C
C
C
      IMPLICIT INTEGER(I-N)
      IMPLICIT REAL*8(A-H,O-Z)
C
      INTEGER ICEN, IELTFA, IFACEL, INORM, ICHCL, ICHAM, IFAC
     &     ,MLECOE
C

-INC PPARAM
-INC CCOPTIO
-INC SMLENTI
-INC SMELEME
C
C**** The FACE and CENTRE neighbors of each 'CENTRE' points
C     Two cases:
C     - If the 'FACE' point belongs to just one element, it belongs to
C       the neighbors of the element 'CENTRE'
C     - If the 'FACE' point belongs to two elements, the elements CENTREs
C       are neighbors
C
      CALL RLENCE(ICEN,IELTFA,IFAC,IFACEL,MELEME)
      IF(IERR.NE.0) GOTO 9999
C
C     RLENCE creates MELEME,
C     the mesh which contains the neighbors of the CENTRE and
C     the CENTRE itself
CC
CC**** Test RLENCE
CC
C      SEGACT MELEME
C      NBSOUS=MELEME.LISOUS(/1)
C      JG=MAX(NBSOUS,1)
C      SEGINI MLENTI
C      IF (JG.EQ.1)THEN
C         MLENTI.LECT(1)=MELEME
C      ELSE
C         DO ISOUS=1,JG,1
C            MLENTI.LECT(ISOUS)=MELEME.LISOUS(ISOUS)
C         ENDDO
C      ENDIF
C
C      DO ISOUS=1,JG,1
C         WRITE(IOIMP,*) 'SGP :', ISOUS, MLENTI.LECT(ISOUS)
C         IPT1=MLENTI.LECT(ISOUS)
C         SEGACT IPT1
C         NBNN=IPT1.NUM(/1)
C         NBELEM=IPT1.NUM(/2)
C         DO IELEM=1,NBELEM,1
C            WRITE(IOIMP,*) 'Center =', IPT1.NUM(NBNN,IELEM)
C            WRITE(IOIMP,*) 'Neighbors =',
C     &           (IPT1.NUM(IVOI,IELEM),IVOI=1,(NBNN-1))
C         ENDDO
C      ENDDO
CC
CC**** Fin test RLENCE
CC
C
      CALL RLEXCE(MELEME,ICEN,IFAC,INORM,ICHCL,MLECOE)
      IF(IERR.NE.0) GOTO 9999
C
C     MLECOE : list of integers.
C     MLECOE.LECT(I) is the pointer of the matrix of real
C     which contains the coefficient of the i-th centre
C     to compute its gradient as function of the values on
C     its neighbors.
C
      CALL RLXCE1(MELEME,MLECOE,ICHAM)
      IF(IERR.NE.0) GOTO 9999
C
 9999 RETURN
      END










