      MODULE BLK1MOD

      INCLUDE 'PARAM.COM'
!     BLK1
!-
      REAL HSIZE
	  COMMON /SSIZE/  HSIZE

      INTEGER MAXP,MAXE,MAXLIN,MAXSTO,MAXECON,MAXLN,MAELN
     

      INTEGER*2 INSKP,IESKP,INEW,NCORN,IJUN,ISWTAGN,iswtintp
!IPK MAY02      INTEGER*2 NOP,IMAT,IEM,NEF,NEFLAG,LINTYP,LAY
      INTEGER*2 IMAT,LINTYP,LAY,IRTYP
      INTEGER*4 NOP,IEM,NEF,NEFLAG,ILINEL
!     REAL*8 CORD,XUSR,YUSR,XC,YC,CMAP,XMAP,YMAP,pscale,xref,yref
      REAL*8 CORD,XUSR,YUSR,XC,YC,pscale,xref,yref
      REAL*8 ALXX,ALYY,ALWD,BLXX,BLYY,BLWD,XBRLEN,CNX,CNY,WIDTHD,HLEFT,HMID,HRIGHT,HSET
      
      INTEGER*2 MSN 
      ALLOCATABLE MSN(:) 


      ALLOCATABLE CORD(:,:),XUSR(:),YUSR(:),XC(:),YC(:),IRTYP(:)&
                  ,NOP(:,:),IMAT(:),THTA(:),IMATL(:),CORDSN(:,:)&
                  ,WD(:) ,WD1(:),INSKP(:), IESKP(:),NCORN(:)&
                  ,WIDTH(:), SS1(:), SS2(:), WIDS(:)&
                   ,IJUN(:),INEW(:),IEM(:),LINTYP(:),NEFLAG(:),NEF(:,:),LAY(:),WTLAY(:,:)&
                   ,WIDBS(:),SSO(:),NODDEL(:),IELDEL(:)&
                   ,NOPSV(:,:),nefsv(:,:),IMATSV(:),LOCK(:),BS1(:),NKEY1(:),EDIF(:),ANGOP(:)&
                   ,IGRPNUM(:,:),MAXENT(:),IGRPSER(:),IUSEDM(:),IOD(:)&
         ,ALXX(:),ALYY(:),BLXX(:),BLYY(:),ALWD(:),BLWD(:),ITYPBC(:),CNX(:,:),CNY(:,:),XBRLEN(:)&
         ,HLEFT(:),HMID(:),HRIGHT(:),HSET(:,:),WIDTHD(:)
      ALLOCATABLE NRF(:),AREF(:),LEVREM(:),TRANSEL(:),WLEN(:),WHGT(:)
      INTEGER*8 MAXPTS
      COMMON /BLK/  MAXPTS,PSCALE,xref,yref&
                   , IPNN, IPEN, XMIN, YMIN, XMAX, YMAX, NLAYD,ILAYTP&
                   ,VOID, VDX, XSCALE, YSCALE,AMAP,IRESTT&
                   ,NXPMIN, NYPMIN, NXPMAX, NYPMAX, IPP&
                   ,XPMIN, YPMIN, XPMAX, YPMAX, WDSCAL,IESW&
                   ,NPLAST,NELAST,NEFL,NENTRY,IECHG,ICHG&
                   ,IIN, IBAK, LUNIT,IGIN,IS11,IMP,IGFG,ISWAP,ITRIAN&
                   ,klint,jlint,lmpnam,IDELV,nmapf,NSIGF,NPUNDO,NEUNDO,nefsav,nesav&
                   ,xadded,yadded,icolsw,rad,colint,ielvsw,ISWTAGN,iswtintp,eref,igrp,igrpout,MAXIGRP&
                   ,JPTSB,ILINEL
!IPK MAR02 ADD BS1
!IPK FEB02 ADD LOCK
!IPK MAY01 ADD NODDEL AND IELDEL
!IPK JUL98 WIDBS AND SSO ADDED
!IPK JAN98 IDELV ADDED
!ipk feb94 line above added, two lines changed may 94 to add xref,yref
!     9             ,LINTYP(MAXLIN),NEFLAG(150),NEF(600,3),LAY(MAXP)
!
!IPK MAR04      INTEGER*2 ILIST,LLIST
      INTEGER*4 ILIST,LLIST
      
      ALLOCATABLE ILIST(:,:),LLIST(:)
      COMMON /BLK1/ NLST, ICCLN(140,350),NCLM
!
      CHARACTER*80 TITLE
      CHARACTER*24 HLABL
!ipk feb94 add
      character*40 mpnam
!ipk dec97 line above modified
 
      CHARACTER*1 ALABL(10)
      COMMON /BLKA1/ TITLE,HLABL,ALABL,MPNAM
!ipk dec97 line above modified
!
!IPK JAN01 INCREASE IPSW TO 10
      COMMON /HEDS/ NP,NE,NHTP,NMESS,NBRR,IPSW(15),IRMAIN,ISCRN,icolon(12),IQSW(2),IRDISP,ntempin,igfgsw,igfgswb,ICRIN,IPW1,WIDEL,WIDSCL,itrianout
!ycw mar97 add
      COMMON /CROSS/ ICRS,XPCS(2),YPCS(2),NCSNOD,XCND(50),YCND(50),&
                     NCSPTS,XELVP(50),YELVP(50),ZELVP(50),SELVP(50),&
                     ZREF,DFACTOR,ZMIN,IXNOD,LCROSS&
				    ,IVMIL(MCRS),NRIVL(MCRS),NOREACH(MCRS)&
                    ,CRSDAT(MCRS,-4:MPTS,3),NCRSEC,XCRS(MCRS),YCRS(MCRS)

      ALLOCATABLE NRIVCR1(:),WTRIVCR1(:),NRIVCR2(:),WTRIVCR2(:)

!NRIVCR1(MAXP),WTRIVCR1(MAXP)&
!                    ,NRIVCR2(MAXP),WTRIVCR2(MAXP),

      LOGICAL LCROSS

      COMMON /UNITS/IOT,IOT1

	  COMMON /INTERPL/ IGRID(MAXGRD,MAXGRD),NX,NY,XGRID,YGRID

      real*8 xusrsto,yusrsto
	  INTEGER*2 IMATSTO
	  
	  ALLOCATABLE  xusrsto(:,:),yusrsto(:,:),wdsto(:,:),&
        WIDTHsto(:,:), SS1sto(:,:), SS2sto(:,:), WIDSsto(:,:)&
       ,WIDBSsto(:,:),SSOsto(:,:),bs1sto(:,:)&
	   ,nopsto(:,:,:),imatsto(:,:),thtasto(:,:)

!   loaded/ xusrsto(maxp,maxsto),yusrsto(maxp,maxsto),wdsto(maxp,maxsto),&
!        WIDTHsto(MAXP,maxsto), SS1sto(MAXP,maxsto), SS2sto(MAXP,maxsto), WIDSsto(MAXP,maxsto)&
!       ,WIDBSsto(MAXP,maxsto),SSOsto(MAXP,maxsto),bs1sto(maxp,maxsto)&
!	   ,nopsto(maxe,8,maxsto),imatsto(maxe,maxsto),thtasto(maxe,maxsto)
	  
      ALLOCATABLE ICCLNSTO(:,:,:)&
	   ,NPSTO(:),NESTO(:),NLSTSTO(:),NCLMSTO(:)


	  INTEGER*4 ILISTSTO,LLISTSTO
      ALLOCATABLE ILISTSTO(:,:,:),LLISTSTO(:,:)

	  COMMON /TMPLIST/ ilisttmp(100),INREORD
	  
      ALLOCATABLE ICN(:) 
      
      ALLOCATABLE ICONNCT(:,:),NKEP(:)
	  
	  ALLOCATABLE IOUTLST(:,:),NOUTLST(:),XOUT(:,:),YOUT(:,:)

   	  COMMON /VIEWS/ HANG,VANG,VRTSCAL,HANGOLD,VANGOLD,VRTORIG,IASPCT
      
      INTEGER KID(900,5)

	  
	  END MODULE