      SUBROUTINE  GENELM ( IE, M, NE, NDFREE, NITER, LPTEST, LHOMO, 
     1    NHOMO, NULCOL, N, NSPACE, NELFRE, NRB, NQP, NGEOM,
     2    NPARM, NNPFIX, NNPFLO, MISCFX, MISCFL, NLPFIX, NLPFLO, 
     3    LNODE, INDEX, X, DDOLD, COORD, S, C, H, DGH, B, E, EB, 
     4    STRAIN, STRAN0, STRESS, BODY, PT, WT, XYZ, DLH, G, DLG,
     5    AJ, AJINV, HINTG, D, PRTLPT, FLTNP, FLTEL, FLTMIS,
     6    ELPROP, PRTLPT, PRTMAT, MISFIX, NPFIX, LPFIX, LPROP, 
     7    LPPROP, NTAPE1, NTAPE2, NTAPE3, NTAPE4, NTAPE5, LT, 
     8    LSHAPE, LTUSER, NG )
C     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C          GENERATE ELEMENT MATRICES AND POST SOLUTION DATA
C     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
CDP   IMPLICIT REAL*8 (A-H,O-Z)
C         SYSTEM DATA
      DIMENSION  X(M,NSPACE), DDOLD(NDFREE), LNODE(N), INDEX(NELFRE)
C         SYSTEM PROPERTIES
      DIMENSION  PRTLPT(N,0:NNPFLO), FLTNP(M,0:NNPFLO), 
     1           FLTEL(NE,0:NLPFLO), NPFIX(M,0:NNPFIX), 
     2           LPFIX(NE,0:NLPFIX)
C        FOR USE IN ELSQ, ELCOL, OR ELPOST:
      DIMENSION  COORD(N,NSPACE), S(NELFRE,NELFRE),C(NELFRE), H(N), 
     1           DGH(NSPACE,N), B(NRB,NELFRE), E(NRB,NRB), 
     2           EB(NRB,NELFRE), STRAIN(NRB+2), STRAN0(NRB), 
     3           STRESS(NRB+2), BODY(NSPACE), PT(NPARM,0:NQP), 
     4           WT(0:NQP), DLH(NSPACE,N), G(NGEOM), DLG(NPARM,NGEOM),
     5           AJ(NSPACE,NSPACE), AJINV(NSPACE,NSPACE), HINTG(N), 
     6           XYZ(NSPACE), D(NELFRE), FLTMIS(0:MISCFL), 
     7           ELPROP(0:NLPFLO), PRTMAT(0:NLPFLO), MISFIX(0:MISCFX), 
     8           LPROP(0:NLPFIX), LPPROP(0:NNPFIX)
C                     VARIABLES:
C     AJ      = JACOBIAN
C     AJINV   = JACOBIAN INVERSE
C     B       = STRAIN-DISPLACEMENT (GRADIENT) MATRIX
C     BODY    = BODY FORCE VECTOR
C     COORD   = SPATIAL COORDINATES OF ELEMENT'S NODES
C     D       = NODAL PARAMETERS ASSOCIATED WITH AN ELEMENT
C     DDOLD   = SYSTEM NODAL PARAMETERS FROM LAST ITERATION
C     DGH     = GLOBAL DERIVATIVES INTERPOLATION FUNCTIONS
C     DLG     = LOCAL DERIVATIVES GEOMETRIC INTERPOLATION
C     DLH     = LOCAL DERIVATIVES INTERPOLATION FUNCTIONS
C     E       = CONSTITUTIVE MATRIX
C     EB      = PRODUCT OF E*B
C     ELPROP  = ELEMENT ARRAY OF REAL PROPERTIES
C     FLTEL   = REAL PROPERTIES OF ELEMENTS
C     FLTMIS  = MISCELLANEOUS REAL PROPERTIES OF SYSTEM
C     FLTNP   = REAL PROPERTIES OF SYSTEM NODES
C     G       = GEOMETRIC INTERPOLATION FUNCTIONS
C     H       = SOLUTION INTERPOLATION FUNCTIONS
C     HINTG   = INTEGRAL OF INTERPOLATION FUNCTIONS
C     IE      = CURRENT ELEMENT NUMBER
C     INDEX   = SYSTEM DOF NUMBERS ASSOCIATED WITH ELEMENT
C     LHOMO   = 1, IF ELEMENT PROPERTIES ARE HOMOGENEOUS
C     LNODE   = THE N ELEMENT INCIDENCES OF THE ELEMENT
C     LPFIX   = SYSTEM ARRAY OF INTEGER ELEM PROPERTIES
C     LPPROP  = INTEGER PROPERTIES AT EACH ELEMENT NODE
C     LPROP   = ARRAY INTEGER ELEMENT PROPERTIES
C     LPTEST  > 0, IF ELEMENT PROPERTIES HAVE BEEN DEFINED
C     M       = NUMBER OF SYSTEM NODES
C     MISFIX  = MISCELLANEOUS INTEGER SYSTEM PROPERTIES
C     N       = NUMBER OF NODES PER ELEMENT
C     NDFREE  = TOTAL NUMBER OF SYSTEM DEGREES OF FREEDOM
C     NE      = NUMBER OF ELEMENTS
C     NELFRE  = NUMBER OF DEGREES OF FREEDOM PER ELEMENT
C     NGEOM   = NUMBER OF GEOMETRY NODES
C     NHOMO   = 1, IF NODAL PROPERTIES ARE HOMOGENEOUS
C     NITER   = NO. OF ITERATIONS TO BE RUN (USUALLY 1)
C     NMAT    = MATERIAL TYPE NUMBER 
C     NPARM   = DIMENSION OF PARAMWETRIC SPACE
C     NPFIX   = INTEGER PROPERTIES AT ALL NODES
C     NQP     = NUMBER OF QUADRATURE POINTS
C     NRB     = NUMBER OF ROWS IN B AND E MATRICES
C     NSPACE  = DIMENSION OF SPACE
C     NTAPE1  = UNIT FOR POST SOLUTION MATRICES STORAGE
C     NTAPE2,3,4,5 = OPTIONAL UNITS FOR USER (USED WHEN > 0)
C     NULCOL  > 0, IF ELEMENT COLUMN MATRIX IS ALWAYS ZERO
C     PRTLPT  = REAL PROPERTIES AT ELEMENT NODES
C     PRTMAT  = REAL ELEM PROPERTIES BASED ON MATERIAL NUMBER
C     PT      = QUADRATURE COORDINATES
C     S       = ELEMENT SQUARE MATRIX
C     STRAIN  = STRAIN OR GRADIENT VECTOR
C     STRAN0  = INITIAL STRAIN OR GRADIENT VECTOR
C     STRESS  = STRESS VECTOR
C     WT      = QUADRATURE WEIGHTS
C     X       = COORDINATES OF SYSTEM NODES
C     XYZ     = SPACE COORDINATES AT A POINT
C
C-->   EXTRACT NODAL COORDINATES
      CALL  ELCORD (M, N, NSPACE, X, COORD, LNODE)
C      EXTRACT NODAL PARAMETERS FROM LAST ITERATION (IF ANY)
      IF ( NITER .GT. 1 )  
     1     CALL  ELFRE (NDFREE, NELFRE, D, DDOLD, INDEX)
C      EXTRACT NODAL POINT PROPERTIES (IF ANY)
      IF ( NNPFLO .GT. 0 )  
     1     CALL  LPTPRT (N, M, NNPFLO, FLTNP, PRTLPT, NNPFIX, NPFIX, 
     2                   LPPROP, LNODE, NHOMO)
C-->   EXTRACT ELEMENT PROPERTIES (IF ANY)
      IF ( LPTEST .GT. 0 )  
     1     CALL ELPRTY (IE, LHOMO, NE, NLPFIX, NLPFLO, LPFIX, FLTEL, 
     2                  LPROP, ELPROP)
C-->   EXTRACT MATERIAL PROPERTIES (IF ANY)
      IF ( NMAT .GT. 0 )  
     1     CALL MATPRT (NMAT, NLPFLO, MISCFL, FLTMIS, PRTMAT)
C-->   GENERATE ELEMENT SQUARE AND COLUMN MATRICES
      CALL  ELSQ (N, NSPACE, NELFRE, NRB, NQP, NGEOM, NPARM, NNPFIX,
     1            NNPFLO, MISCFX, MISCFL, NLPFIX, NLPFLO, COORD, S, 
     2            C, H, DGH, B, E, EB, STRAIN, STRAN0, STRESS, BODY, 
     3            PT, WT, XYZ, DLH, G, DLG, AJ, AJINV, HINTG, D, 
     4            PRTLPT, FLTMIS, ELPROP, PRTLPT, PRTMAT, MISFIX, 
     5            LSHAPE, LPROP, LPPROP, NTAPE1, NTAPE2, NTAPE3, 
     6            NTAPE4, NTAPE5, LNODE, NG, IE )
      IF ( NULCOL .EQ. 0 )  
     1     CALL  ELCOL (N, NSPACE, NELFRE, NRB, NQP, NGEOM, NPARM, 
     2           NNPFIX, NNPFLO, MISCFX, MISCFL, NLPFIX, NLPFLO, 
     3           COORD, C, H, DGH, B, E, EB, STRAIN, STRAN0, STRESS, 
     4           BODY, PT, WT, XYZ, DLH, G, DLG, AJ, AJINV, HINTG, 
     5           D, PRTLPT, FLTMIS, ELPROP, PRTLPT, PRTMAT, MISFIX, 
     6           LSHAPE, LPROP, LPPROP, NTAPE1, NTAPE2, NTAPE3, 
     7           NTAPE4, NTAPE5, LNODE, NG )
C-->   STORE DATA FOR POST SOLUTION CALCULATIONS (IF ANY)
      IF ( NTAPE1 .GT. 0 )  
     1     CALL   ELPOST (N, NSPACE, NELFRE, NRB, NQP, NNPFIX, 
     2            NNPFLO, MISCFX, MISCFL, NLPFIX, NLPFLO, H, 
     3            DGH, B, E, EB, STRAIN, STRAN0, STRESS, BODY, 
     4            HINTG, D, PRTLPT, FLTMIS, ELPROP, PRTLPT, 
     5            PRTMAT, MISFIX, LSHAPE, LPROP, LPPROP, NTAPE1, 
     6            NTAPE2, NTAPE3, NTAPE4, NTAPE5, LNODE, NG )
C      NOTE:  SYSTEM PROPERTIES UPDATE COULD BE DONE HERE
      RETURN
      END
