      module mgpreset
c ======================================================================
c
c
c       programmer     Jos van Kan
c       version 1.2    date  8- 7-1997
c       version 1.1    10-04-1997
c        version 1.0    date Tue Apr  8 1997
c
c
c
c   copyright (c) 1997-1997  "TU Delft"
c   permission to copy or distribute this software or documentation
c   in hard copy or soft copy granted only by written license
c   obtained from "TU Delft".
c   all rights reserved. no part of this publication may be reproduced,
c   stored in a retrieval system ( e.g., in memory, disk, or core)
c   or be transmitted by any means, electronic, mechanical, photocopy,
c   recording, or otherwise, without written permission from the
c   publisher.
c
c ********************************************************************
c
c                         DESCRIPTION
c
c   Contains the named constants of the mgpackage and also the default
c   mapping of the 9 and the 27 point stencil.
c
c ********************************************************************
c
c                      KEYWORDS
c  multi_grid
c
c ********************************************************************
c
c                      INPUT / OUTPUT    PARAMETERS
c
      implicit none

c ********************************************************************
c
c                    COMMON BLOCKS
c
c ********************************************************************
c
c                    LOCAL PARAMETERS
c
      integer, parameter :: MAXLEVEL = 19
      integer, parameter :: PT27 = 0
      integer, parameter :: PT19 = 1
      integer, parameter :: PT7 = 2
      integer, parameter :: CELLC = 0, VERTEXC = 1
      integer, parameter :: FULLCORS = 0, SEMICORS = 1
      integer, parameter :: SUB = 1, DIAG = 2, SUP = 3
      integer, parameter :: sizexi = 41, sizeyi = 61, sizezi = 81
      integer, parameter :: matri = 101, rhsri = 121, solri = 141
      integer, parameter :: resri = 161, corri = 181
      integer, parameter :: LUxri = 201, LUyri = 221, LUzri = 241
      integer, parameter :: hileveli=1, corsnini=2, slacki=3
      integer, parameter :: offrbufi=21, offscri=22
      integer, parameter :: wirecnti=23, MAXRBUFi=24
      integer, parameter :: errcnti=31, nfatali=32
      integer, parameter :: prelud_i=33, YES=100
      integer, save :: p00, p10, p20, p01, p11, p21, p02, p12, p22
      integer, save :: p000,p100,p200,p010,p110,p210,p020,p120,p220
      integer, save :: p001,p101,p201,p011,p111,p211,p021,p121,p221
      integer, save :: p002,p102,p202,p012,p112,p212,p022,p122,p222
      integer, save :: molstruc
      logical, save :: flevel0
c
c     cellc     Cell centered (module mgpreset)
c     corri     Rbuf (ibuf (corri + ilevel)) is the first element
c               of the correction vector at level ilevel. (ilevel >=0)
c               (module mgpreset)
c     corsnini  Ibuf (corsnini) contains the method of coarsening
c               for this block. (fullcors or semicors) (module
c               mgpreset)
c     diag      Diagonal index in tridiag matrix (module mgpreset)
c     errcnti   Ibuf (errcnti) contains number of times the error
c               handler has been called for this block. (module
c               mgpreset)
c     flevel0   Flag to denote whether we are on level 0
c               (module mgpreset)
c     fullcors  Fullcoarsening (type coarsening) (module mgpreset)
c     hileveli  Ibuf (hileveli) contains the highest level of
c               coarsening for this block. (<= MAXLEVEL) (module
c               mgpreset)
c     luxri     Rbuf (ibuf (LUxri + ilevel)) is the first element
c               of the LUx decomposition at level ilevel (ilevel >= 0)
c               (module mgpreset)
c     luyri     Rbuf (ibuf (LUyri + ilevel)) is the first element
c               of the LUy decomposition at level ilevel (ilevel >= 0)
c               (module mgpreset)
c     luzri     Rbuf (ibuf (LUzri + ilevel)) is the first element
c               of the LUz decomposition at level ilevel (ilevel >= 0)
c               (module mgpreset)
c     matri     Rbuf (ibuf (matri + ilevel)) is the first element
c               of the RAP operator at level ilevel (ilevel >= 1)
c               (module mgpreset)
c     maxlevel  Maximum level allowed for (semi)coarsening (module
c               mgpreset)
c     maxrbufi  Ibuf (maxrbufi) contains maximum size of rbuf (module
c               mgpreset)
c     molstruc  To signify the molecule structure on the finest level:
c               pt27 (default), pt19 or pt7 (module mgpreset)
c     nfatali   Ibuf (nfatali) contains number of fatal errors
c               for this block (module mgpreset)
c     offrbufi  Ibuf (offrbufi) contains pointer to first unused place
c               in rbuf (module mgpreset)
c     offscri   Ibuf (offscri) contains index where scratch space begins
c               in rbuf (module mgpreset)
c     p00       Index of point in stencil 2D (module mgpreset)
c     p000      Index of point in stencil 3D (module mgpreset)
c     p001      Index of point in stencil 3D (module mgpreset)
c     p002      Index of point in stencil 3D (module mgpreset)
c     p01       Index of point in stencil 2D (module mgpreset)
c     p010      Index of point in stencil 3D (module mgpreset)
c     p011      Index of point in stencil 3D (module mgpreset)
c     p012      Index of point in stencil 3D (module mgpreset)
c     p02       Index of point in stencil 2D (module mgpreset)
c     p020      Index of point in stencil 3D (module mgpreset)
c     p021      Index of point in stencil 3D (module mgpreset)
c     p022      Index of point in stencil 3D (module mgpreset)
c     p10       Index of point in stencil 2D (module mgpreset)
c     p100      Index of point in stencil 3D (module mgpreset)
c     p101      Index of point in stencil 3D (module mgpreset)
c     p102      Index of point in stencil 3D (module mgpreset)
c     p11       Index of point in stencil 2D (module mgpreset)
c     p110      Index of point in stencil 3D (module mgpreset)
c     p111      Index of point in stencil 3D (module mgpreset)
c     p112      Index of point in stencil 3D (module mgpreset)
c     p12       Index of point in stencil 2D (module mgpreset)
c     p120      Index of point in stencil 3D (module mgpreset)
c     p121      Index of point in stencil 3D (module mgpreset)
c     p122      Index of point in stencil 3D (module mgpreset)
c     p20       Index of point in stencil 2D (module mgpreset)
c     p200      Index of point in stencil 3D (module mgpreset)
c     p201      Index of point in stencil 3D (module mgpreset)
c     p202      Index of point in stencil 3D (module mgpreset)
c     p21       Index of point in stencil 2D (module mgpreset)
c     p210      Index of point in stencil 3D (module mgpreset)
c     p211      Index of point in stencil 3D (module mgpreset)
c     p212      Index of point in stencil 3D (module mgpreset)
c     p22       Index of point in stencil 2D (module mgpreset)
c     p220      Index of point in stencil 3D (module mgpreset)
c     p221      Index of point in stencil 3D (module mgpreset)
c     p222      Index of point in stencil 3D (module mgpreset)
c     prelud_i  Ibuf (prelud_i) = 100 if prelude has been called
c               for this block. (module mgpreset)
c     pt19      Named constant (1). Molecule has 19 points on level 0
c               (module mgpreset)
c     pt27      Named constant (0). Molecule has 27 points on level 0
c               (module mgpreset)
c     pt7       Named constant (2). Molecule has 7 points on level 0
c               (module mgpreset)
c     resri     Rbuf (ibuf (resri + ilevel)) is the first element
c               of the res vector at level ilevel (ilevel >= 0) (module
c               mgpreset)
c     rhsri     Rbuf (ibuf (rhsri + ilevel)) is the first element
c               of the right hand side vector at level ilevel
c               (ilevel >= 1) (module mgpreset)
c     semicors  Semicoarsening (type coarsening) (module mgpreset)
c     sizexi    Ibuf(sizexi + ilevel)) contains number of points
c               in x direction at level ilevel. (0 = finest) (module
c               mgpreset)
c     sizeyi    Ibuf(sizeyi + ilevel)) contains number of points
c               in y direction at level ilevel. (0 = finest) (module
c               mgpreset)
c     sizezi    Ibuf(sizezi + ilevel)) contains number of points
c               in z direction at level ilevel. (0 = finest) (module
c               mgpreset)
c     slacki    Ibuf (slacki) is the first element of the 6 element
c               slack array xslacklo, xslackhi, yslacklo, yslackhi,
c               zslacklo, zslackhi, (module mgpreset)
c     solri     Rbuf (ibuf (solri + ilevel)) is the first element
c               of the sol vector at level ilevel (ilevel >= 1) (module
c               mgpreset)
c     sub       Subdiagonal index in tridiagonal matrix (module
c               mgpreset)
c     sup       Superdiagonal index in tridiagonal matrix (module
c               mgpreset)
c     vertexc   Vertex centered (type center) (module mgpreset)
c     wirecnti  Ibuf (wirecnti) contains the wirecount (module
c               mgpreset)
c     yes       Named constant (module mgpreset)
c
c ********************************************************************
c
c                      SUBROUTINES CALLED
c
c ********************************************************************
c
c                              I/O
c
c ********************************************************************
c
c                    ERROR MESSAGES
c
c ********************************************************************
c
c                    PSEUDO CODE
c
c ********************************************************************
c
c                    DATA STATEMENTS
c
c --- pij can be remapped if the user wishes to do so
      data p00, p10, p20, p01, p11, p21, p02, p12, p22
     +   /  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,  9   /
      data p000, p100, p200, p010, p110, p210, p020, p120, p220
     +   /   1 ,   2 ,   3 ,   4 ,   5 ,   6 ,   7 ,   8 ,   9   /
      data p001, p101, p201, p011, p111, p211, p021, p121, p221
     +   /  10 ,  11 ,  12 ,  13 ,  14 ,  15 ,  16 ,  17 ,  18   /
      data p002, p102, p202, p012, p112, p212, p022, p122, p222
     +   /  19,   20 ,  21 ,  22 ,  23 ,  24 ,  25 ,  26 ,  27   /
      data molstruc /0/
      data flevel0 /.true./
c ======================================================================
c
      end module mgpreset
