Index: /trunk/AGRIF/AA_make
===================================================================
--- /trunk/AGRIF/AA_make	(revision 396)
+++ /trunk/AGRIF/AA_make	(revision 396)
@@ -0,0 +1,123 @@
+#- $Id$
+
+TMP=../../../tmp
+
+SRM=/bin/rm -f
+
+#-Q- sxnec C_L = $(FC_L)   
+#-Q- sxnec C_O = $(FC_O)   
+#-Q- sx6nec C_L	= $(FC_L) 
+#-Q- sx6nec C_O	= $(FC_O) 
+#-Q- sxdkrz C_L	= $(FC_L) 
+#-Q- sxdkrz C_O	= $(FC_O) 
+#-Q- eshpux C_L	= $(FC_L) 
+#-Q- eshpux C_O	= $(FC_O) 
+#-Q- aix F_O = $(w_w) -I$(MODDIR) -qmoddir=$(MODDIR) -qextname
+#-Q- osxxlf F_O = $(w_w) -I$(MODDIR) -qmoddir=$(MODDIR) -qextname
+
+AGRIFOBJS=AGRIF_OBJS
+AGRIFFILES=AGRIF_FILES
+AGRIFYOURFILES=AGRIF_YOURFILES
+
+FILENAMES= modbc modmpp modcluster modinit modinitvars modinterp  \
+	   modtypes modbcfunction modutil modcurgridfunctions \
+	   modmask modsauv modupdate modinterpbasic\
+	   modupdatebasic modlinktomodel modarrays
+	   
+OBJS1=$(addprefix $(AGRIFOBJS)/,$(FILENAMES))
+OBJS=$(addsuffix .o,$(OBJS1))
+
+
+AGRIF_FILES1=$(addprefix $(AGRIFFILES)/,$(FILENAMES))
+AGRIF_FILES=$(addsuffix .F,$(AGRIF_FILES1))
+
+all :   conv_exe key $(MODDIR)/libagrif.a $(SXMODEL_LIB)
+	@echo AGRIF is OK
+
+conv_exe : 
+	@( cd LIB ; $(M_K) -f Makefile C_L="$(C_L)" C_O="$(C_O)" )
+
+key : 
+	-@if [ "`cat KEY_CPP`" != "$(P_P)" ] ; then \
+	echo "$(P_P)" > KEY_CPP ; fi
+
+$(MODDIR)/libagrif.a : $(OBJS)
+	@$(A_C) $@ $(OBJS)
+
+$(SXMODEL_LIB) : 
+#-Q- sxnec	$(A_X) $@ $(OBJS)
+#-Q- sx6nec	$(A_X) $@ $(OBJS)
+#-Q- sxdkrz	$(A_X) $@ $(OBJS)
+#-Q- eshpux	$(A_X) $@ $(OBJS)
+
+$(AGRIFOBJS)/%.o : $(AGRIFFILES)/%.F KEY_CPP
+	@$(SRM) $(AGRIFYOURFILES)/$(*F).f
+	@$(P_C) $(P_O) $(AGRIFFILES)/$(*F).F > $(AGRIFYOURFILES)/$(*F).f
+	@$(F_C) $(F_O) $(FFLAGS_EXTEND) $(AGRIF_OPTS) -c $(AGRIFYOURFILES)/$(*F).f -o $(AGRIFOBJS)/$(*F).o
+#-Q- linux	@$(SRM) $*.lst
+#-Q- ibm	@$(SRM) $*.lst
+#-Q- aix	@$(SRM) $*.lst
+#-Q- sxnec	mv *.mod $(MODDIR)
+#-Q- sx6nec	mv *.mod $(MODDIR)
+#-Q- sxdkrz	mv *.mod $(MODDIR)
+#-Q- eshpux	mv *.mod $(MODDIR)
+#-Q- solaris	mv *.mod $(MODDIR)
+
+
+$(AGRIFOBJS)/modarrays.o: $(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modbc.o: $(AGRIFOBJS)/modinterp.o
+
+$(AGRIFOBJS)/modbcfunction.o: $(AGRIFOBJS)/modupdate.o \
+			 $(AGRIFOBJS)/modbc.o 
+
+$(AGRIFOBJS)/modcluster.o: $(AGRIFOBJS)/modsauv.o \
+			$(AGRIFOBJS)/modinitvars.o \
+			$(AGRIFOBJS)/modcurgridfunctions.o
+
+$(AGRIFOBJS)/modcurgridfunctions.o: $(AGRIFOBJS)/modinit.o
+
+$(AGRIFOBJS)/modinit.o: $(AGRIFOBJS)/modlinktomodel.o \
+			$(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modinitvars.o: $(AGRIFOBJS)/modlinktomodel.o \
+			$(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modinterpbasic.o: $(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modinterp.o: $(AGRIFOBJS)/modcurgridfunctions.o \
+			$(AGRIFOBJS)/modmask.o \
+			$(AGRIFOBJS)/modarrays.o \
+			$(AGRIFOBJS)/modmpp.o \
+			$(AGRIFOBJS)/modinterpbasic.o
+
+$(AGRIFOBJS)/modlinktomodel.o: $(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modmask.o: $(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modsauv.o: $(AGRIFOBJS)/modarrays.o \
+			$(AGRIFOBJS)/modlinktomodel.o \
+			$(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modupdatebasic.o: $(AGRIFOBJS)/modtypes.o
+
+$(AGRIFOBJS)/modupdate.o: $(AGRIFOBJS)/modmask.o \
+			$(AGRIFOBJS)/modcurgridfunctions.o \
+			$(AGRIFOBJS)/modarrays.o \
+			$(AGRIFOBJS)/modmpp.o \
+			$(AGRIFOBJS)/modupdatebasic.o
+
+$(AGRIFOBJS)/modutil.o: $(AGRIFOBJS)/modcurgridfunctions.o \
+			$(AGRIFOBJS)/modcluster.o
+
+$(AGRIFOBJS)/modmpp.o: $(AGRIFOBJS)/modtypes.o \
+			$(AGRIFOBJS)/modarrays.o
+
+clean : FORCE
+	$(SRM) $(OBJS) $(MODOBJS)$(LIBDIR)/libagrif.a 
+	
+cleanall : FORCE
+	$(SRM) $(OBJS) $(MODOBJS)$(LIBDIR)/libagrif.a 
+	@(cd LIB ; $(M_K) -f Makefile clean )
+
+FORCE :
Index: /trunk/AGRIF/AA_make.ldef
===================================================================
--- /trunk/AGRIF/AA_make.ldef	(revision 396)
+++ /trunk/AGRIF/AA_make.ldef	(revision 396)
@@ -0,0 +1,29 @@
+#- $Id$
+#---------------------------------------------------------------------
+#- Creation des elements relatifs a AGRIF (lib, config)
+#---------------------------------------------------------------------
+SHELL = /bin/sh
+#---------------------------------------------------------------------
+LIBDIR = ../../lib
+MODDIR = $(LIBDIR)
+#---------------------------------------------------------------------
+#--- -DNC_REAL option is needed if compiled in simple precision
+#--- In case you switch to double precision use -DNC_DOUBLE
+#-
+# Compilation:
+#-Q- lxiv7 FFLAGS_EXTEND=  -I..
+#-Q- lxiv8 FFLAGS_EXTEND=  -I..
+#-Q- sun   FFLAGS_EXTEND= -I..
+#-Q- aix   FFLAGS_EXTEND = -I.. -I$(HOME)/include/ -qsuffix=f=f
+#-Q- aix   AGRIF_OPTS = -qfixed -qrecur
+#-Q- ibm   FFLAGS_EXTEND = -I.. -I$(HOME)/include/ -qsuffix=f=f
+#-Q- ibm   AGRIF_OPTS = -qfixed -qrecur
+#-
+MODEL_LIB = $(LIBDIR)/libagrif.a
+SXMODEL_LIB = $(MODEL_LIB)
+#-Q- sxnec  SXMODEL_LIB = $(LIBDIR)/libsxagrif.a
+#-Q- sx6nec SXMODEL_LIB = $(LIBDIR)/libsxagrif.a
+#-Q- sxdkrz SXMODEL_LIB = $(LIBDIR)/libsxagrif.a
+#-Q- eshpux SXMODEL_LIB = $(LIBDIR)/libsxagrif.a
+#-
+P_P=$(AGRIF_MPI)
Index: /trunk/AGRIF/AGRIF_FILES/modarrays.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modarrays.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modarrays.F	(revision 396)
@@ -0,0 +1,1420 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Arrays
+C      
+      Module Agrif_Arrays
+      Use Agrif_Types
+C
+      implicit none
+C      
+      Contains
+C     **************************************************************************
+CCC   Subroutine Agrif_Childbounds
+C     **************************************************************************
+C
+      Subroutine Agrif_Childbounds(nbdim,lboundloc,uboundloc,
+     &                 pttab,petab,pttruetab,cetruetab,memberin)
+C
+CCC   Description:
+CCC   Subroutine calculating the global indices of the child grid
+C
+C
+C     Declarations:
+C
+
+C
+C     Arguments
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(nbdim) :: lboundloc,uboundloc
+      INTEGER,DIMENSION(nbdim) :: pttab,petab,pttruetab,cetruetab
+      LOGICAL :: memberin
+C
+C     Local variables
+      INTEGER :: i,lbglob,ubglob
+C
+#ifdef AGRIF_MPI
+      INTEGER :: indglob1,indglob2
+#endif
+C
+C
+      do i = 1,nbdim
+C
+        lbglob = lboundloc(i)
+        ubglob = uboundloc(i)
+C
+#ifdef AGRIF_MPI
+C
+        Call AGRIF_InvLoc(lbglob,Agrif_ProcRank,i,indglob1)
+C
+        Call AGRIF_InvLoc(ubglob,Agrif_ProcRank,i,indglob2)
+C
+        pttruetab(i) = max(pttab(i),indglob1)        
+C
+        cetruetab(i) = min(petab(i),indglob2)                 
+C
+#else
+C
+        pttruetab(i) = max(pttab(i),lbglob)        
+C
+        cetruetab(i) = min(petab(i),ubglob)
+C
+#endif
+C
+      enddo
+
+      memberin = .TRUE.
+
+      do i=1,nbdim
+        IF (cetruetab(i) < pttruetab(i)) THEN
+          memberin = .FALSE.
+          EXIT
+        ENDIF
+      enddo
+C
+      Return
+C
+C
+      End Subroutine Agrif_Childbounds
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_nbdim_Get_bound
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_Get_bound(Variable,
+     &                           lower,upper,indice,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to get the lower and the upper boundaries of a
+C     table. Output datas are scalar.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      ! we want extract boundaries of this table
+      TYPE(AGRIF_Variable), Pointer :: Variable    
+      INTEGER              :: lower,upper ! output data
+      ! direction in wich we want to know the dimension
+      INTEGER              :: indice      
+      INTEGER              :: nbdim       ! dimension of the table
+C
+C     Local variables
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+           lower = lbound(Variable % array1,indice)
+           upper = ubound(Variable % array1,indice)
+      CASE (2)
+           lower = lbound(Variable % array2,indice)
+           upper = ubound(Variable % array2,indice)
+      CASE (3)
+           lower = lbound(Variable % array3,indice)
+           upper = ubound(Variable % array3,indice)
+      CASE (4)
+           lower = lbound(Variable % array4,indice)
+           upper = ubound(Variable % array4,indice)
+      CASE (5)
+           lower = lbound(Variable % array5,indice)
+           upper = ubound(Variable % array5,indice)
+      CASE (6)
+           lower = lbound(Variable % array6,indice)
+           upper = ubound(Variable % array6,indice)
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_Get_bound       
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Get_bound_dimension
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_Get_bound_dimension(Variable,
+     &                              lower,upper,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to get the lower and the upper boundaries of a
+C        table. Output datas are scalar.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      ! we want extract boundaries of this table
+      TYPE(AGRIF_Variable), Pointer     :: Variable    
+      INTEGER                  :: nbdim       ! dimension of the table
+      INTEGER,DIMENSION(nbdim) :: lower,upper ! output data
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+           lower = lbound(Variable % array1)
+           upper = ubound(Variable % array1)
+      CASE (2)
+           lower = lbound(Variable % array2)
+           upper = ubound(Variable % array2)
+      CASE (3)
+           lower = lbound(Variable % array3)
+           upper = ubound(Variable % array3)
+      CASE (4)
+           lower = lbound(Variable % array4)
+           upper = ubound(Variable % array4)
+      CASE (5)
+           lower = lbound(Variable % array5)
+           upper = ubound(Variable % array5)
+      CASE (6)
+           lower = lbound(Variable % array6)
+           upper = ubound(Variable % array6)
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_Get_bound_dimension     
+      
+C     **************************************************************************
+CCC   Subroutine Agrif_nbdim_allocation
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_allocation(Variable,inf,sup,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to Allocate the table Variable
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer     :: Variable    
+      INTEGER                  :: nbdim       ! dimension of the table
+      INTEGER,DIMENSION(nbdim) :: inf,sup
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+         allocate(Variable%array1(
+     &            inf(1):sup(1)))
+      CASE (2)
+          allocate(Variable%array2(
+     &            inf(1):sup(1),
+     &            inf(2):sup(2)))
+      CASE (3)
+         allocate(Variable%array3(
+     &            inf(1):sup(1),
+     &            inf(2):sup(2),
+     &            inf(3):sup(3)))
+      CASE (4)
+         allocate(Variable%array4(
+     &            inf(1):sup(1),
+     &            inf(2):sup(2),
+     &            inf(3):sup(3),
+     &            inf(4):sup(4)))
+      CASE (5)
+         allocate(Variable%array5(
+     &            inf(1):sup(1),
+     &            inf(2):sup(2),
+     &            inf(3):sup(3),
+     &            inf(4):sup(4),
+     &            inf(5):sup(5)))
+      CASE (6)
+         allocate(Variable%array6(
+     &            inf(1):sup(1),
+     &            inf(2):sup(2),
+     &            inf(3):sup(3),
+     &            inf(4):sup(4),
+     &            inf(5):sup(5),
+     &            inf(6):sup(6)))
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_allocation
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_nbdim_deallocation
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_deallocation(Variable,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to give the same value to the table Variable
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer     :: Variable    
+      INTEGER                  :: nbdim       ! dimension of the table
+C
+C     Local variables       
+C
+
+      SELECT CASE (nbdim)
+      CASE (1)
+         Deallocate(Variable%array1)
+      CASE (2)
+         Deallocate(Variable%array2)
+      CASE (3)
+         Deallocate(Variable%array3)
+      CASE (4)
+         Deallocate(Variable%array4)
+      CASE (5)
+         Deallocate(Variable%array5)
+      CASE (6)
+         Deallocate(Variable%array6)
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_deallocation
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_nbdim_Full_VarEQreal
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_Full_VarEQreal(Variable,Value,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to get the lower and the upper boundaries of a
+C        table. Output datas are scalar.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer :: Variable    
+      REAL                 :: Value       
+      INTEGER              :: nbdim       ! dimension of the table
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+        Variable%array1 = Value      
+      CASE (2)
+        Variable%array2 = Value
+      CASE (3)
+        Variable%array3 = Value
+      CASE (4)
+        Variable%array4 = Value
+      CASE (5)
+        Variable%array5 = Value
+      CASE (6)
+        Variable%array6 = Value
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_Full_VarEQreal       
+C
+C
+#if !defined AGRIF_MPI
+C     **************************************************************************
+CCC   Subroutine Agrif_nbdim_VarEQreal
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_VarEQreal(Variable,inf,sup,Value,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to give the same value to a part of 
+C        the table Variable
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer :: Variable    
+      REAL                 :: Value       
+      INTEGER              :: nbdim       ! dimension of the table
+      INTEGER,DIMENSION(nbdim) :: inf,sup
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+         Variable%array1(
+     &             inf(1):sup(1)
+     &             )  = Value
+      CASE (2)
+         Variable%array2(
+     &             inf(1):sup(1),
+     &             inf(2):sup(2)
+     &             )  = Value
+      CASE (3)
+         Variable%array3(
+     &             inf(1):sup(1),
+     &             inf(2):sup(2),
+     &             inf(3):sup(3)
+     &             )  = Value
+      CASE (4)
+         Variable%array4(
+     &             inf(1):sup(1),
+     &             inf(2):sup(2),
+     &             inf(3):sup(3),
+     &             inf(4):sup(4)
+     &             )  = Value
+      CASE (5)
+         Variable%array5(
+     &             inf(1):sup(1),
+     &             inf(2):sup(2),
+     &             inf(3):sup(3),
+     &             inf(4):sup(4),
+     &             inf(5):sup(5)
+     &             )  = Value
+      CASE (6)
+         Variable%array6(
+     &             inf(1):sup(1),
+     &             inf(2):sup(2),
+     &             inf(3):sup(3),
+     &             inf(4):sup(4),
+     &             inf(5):sup(5),
+     &             inf(6):sup(6)
+     &             )  = Value
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_VarEQreal       
+#endif
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_nbdim_VarEQvar
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_VarEQvar(Variable,inf,sup,
+     &                                Variable2,inf2,sup2,
+     &                                nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to give the value of a part of the table 
+C        Variable2 to the table Variable
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer     :: Variable
+      TYPE(AGRIF_Variable), Pointer     :: Variable2
+      INTEGER                  :: nbdim       ! dimension of the table
+      INTEGER,DIMENSION(nbdim) :: inf,sup
+      INTEGER,DIMENSION(nbdim) :: inf2,sup2
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+         Variable%array1(inf(1):sup(1)) = 
+     &         Variable2%array1(inf2(1):sup2(1))
+      CASE (2)
+         Variable%array2(inf(1):sup(1),
+     &                         inf(2):sup(2)) = 
+     &         Variable2%array2(inf2(1):sup2(1),
+     &                          inf2(2):sup2(2))
+      CASE (3)
+         Variable%array3(inf(1):sup(1),
+     &                         inf(2):sup(2), 
+     &                         inf(3):sup(3)) = 
+     &         Variable2%array3(inf2(1):sup2(1),
+     &                          inf2(2):sup2(2),
+     &                          inf2(3):sup2(3))
+      CASE (4)
+        Variable%array4(inf(1):sup(1),
+     &                         inf(2):sup(2), 
+     &                         inf(3):sup(3),
+     &                         inf(4):sup(4)) = 
+     &         Variable2%array4(inf2(1):sup2(1),
+     &                          inf2(2):sup2(2),
+     &                          inf2(3):sup2(3),
+     &                          inf2(4):sup2(4))
+      CASE (5)
+        Variable%array5(inf(1):sup(1),
+     &                         inf(2):sup(2), 
+     &                         inf(3):sup(3),
+     &                         inf(4):sup(4), 
+     &                         inf(5):sup(5)) = 
+     &         Variable2%array5(inf2(1):sup2(1),
+     &                          inf2(2):sup2(2),
+     &                          inf2(3):sup2(3),
+     &                          inf2(4):sup2(4),
+     &                          inf2(5):sup2(5))
+      CASE (6)
+        Variable%array6(inf(1):sup(1),
+     &                         inf(2):sup(2),
+     &                         inf(3):sup(3),
+     &                         inf(4):sup(4),
+     &                         inf(5):sup(5),
+     &                         inf(6):sup(6)) = 
+     &         Variable2%array6(inf2(1):sup2(1),
+     &                          inf2(2):sup2(2),
+     &                          inf2(3):sup2(3),
+     &                          inf2(4):sup2(4),
+     &                          inf2(5):sup2(5),
+     &                          inf2(6):sup2(6))
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_VarEQvar
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_nbdim_Full_VarEQvar
+C     **************************************************************************
+C
+      Subroutine Agrif_nbdim_Full_VarEQvar(Variable,Variable2,
+     &                                nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to give the value of the table Variable2 
+C        to the table Variable
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer     :: Variable
+      TYPE(AGRIF_Variable), Pointer     :: Variable2
+      INTEGER                  :: nbdim       ! dimension of the table
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+          Variable%array1 = Variable2%array1
+      CASE (2)
+          Variable%array2 = Variable2%array2
+      CASE (3)
+          Variable%array3 = Variable2%array3
+      CASE (4)
+          Variable%array4 = Variable2%array4
+      CASE (5)
+          Variable%array5 = Variable2%array5
+      CASE (6)
+          Variable%array6 = Variable2%array6
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_nbdim_Full_VarEQvar
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_array2vector
+C     **************************************************************************
+C
+      Subroutine Agrif_array2vector(array,bounds,vector,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to record the array into the vector
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer       :: array
+      REAL, DIMENSION(:)         :: vector      ! Array used for the time 
+      INTEGER                    :: nbdim       ! dimension of the table
+      INTEGER,DIMENSION(nbdim,2) :: bounds
+C
+C     Local variables       
+C
+      INTEGER                      :: nind,ir,jr,kr,lr,mr,nr
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+         nind=0
+         do ir=bounds(1,1),bounds(1,2)
+            nind=nind+1
+            array%array1(ir) = vector(nind)
+         enddo       
+C
+      CASE (2)
+         nind=0
+          do jr=bounds(2,1),bounds(2,2)
+           do ir=bounds(1,1),bounds(1,2)
+               nind=nind+1
+               array%array2(ir,jr) = vector(nind)
+           enddo
+         enddo        
+C
+      CASE (3)
+         nind=0
+        do kr=bounds(3,1),bounds(3,2)
+           do jr=bounds(2,1),bounds(2,2)
+             do ir=bounds(1,1),bounds(1,2)
+                  nind=nind+1
+                  array%array3(ir,jr,kr) = vector(nind)
+             enddo
+           enddo
+         enddo      
+C
+      CASE (4)
+         nind=0
+        do lr=bounds(4,1),bounds(4,2)
+          do kr=bounds(3,1),bounds(3,2)
+             do jr=bounds(2,1),bounds(2,2)
+               do ir=bounds(1,1),bounds(1,2)
+                     nind=nind+1
+                     array%array4(ir,jr,kr,lr) = vector(nind)
+               enddo
+             enddo
+           enddo
+         enddo          
+C
+      CASE (5)
+         nind=0
+         do mr=bounds(5,1),bounds(5,2)
+         do lr=bounds(4,1),bounds(4,2)
+          do kr=bounds(3,1),bounds(3,2) 
+              do jr=bounds(2,1),bounds(2,2)
+                 do ir=bounds(1,1),bounds(1,2)
+                     nind=nind+1
+                     array%array5(ir,jr,kr,lr,mr) = vector(nind)
+                 enddo
+               enddo
+             enddo
+           enddo
+         enddo        
+C
+      CASE (6)
+         nind=0
+        do nr=bounds(6,1),bounds(6,2)
+          do mr=bounds(5,1),bounds(5,2)
+          do lr=bounds(4,1),bounds(4,2)
+           do kr=bounds(3,1),bounds(3,2)
+             do jr=bounds(2,1),bounds(2,2)
+                   do ir=bounds(1,1),bounds(1,2)
+                     nind=nind+1
+                     array%array6(ir,jr,kr,lr,mr,nr) = vector(nind)
+                   enddo
+                 enddo
+               enddo
+             enddo
+           enddo
+         enddo       
+        END SELECT
+C
+      return
+C
+      End Subroutine Agrif_array2vector
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_vector2array
+C     **************************************************************************
+C
+      Subroutine Agrif_vector2array(vector,array,bounds,nbdim)
+C
+CCC   Description:
+CCC   This subroutine is used to record the array into the vector
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_Variable), Pointer       :: array
+      REAL, DIMENSION(:)         :: vector      ! Array used for the time 
+      INTEGER                    :: nbdim       ! dimension of the table
+      INTEGER,DIMENSION(nbdim,2) :: bounds
+C
+C     Local variables       
+C
+      INTEGER                      :: nind,ir,jr,kr,lr,mr,nr
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+         nind=0
+         do ir=bounds(1,1),bounds(1,2)
+            nind=nind+1
+            vector(nind) = array%array1(ir)
+         enddo       
+C
+      CASE (2)
+         nind=0
+        do jr=bounds(2,1),bounds(2,2)
+           do ir=bounds(1,1),bounds(1,2)
+               nind=nind+1
+               vector(nind) = array%array2(ir,jr)
+           enddo
+         enddo      
+C
+      CASE (3)
+         nind=0
+        do kr=bounds(3,1),bounds(3,2)
+          do jr=bounds(2,1),bounds(2,2)
+             do ir=bounds(1,1),bounds(1,2)
+                  nind=nind+1
+                  vector(nind) = array%array3(ir,jr,kr)
+             enddo
+           enddo
+         enddo       
+C
+      CASE (4)
+         nind=0
+          do lr=bounds(4,1),bounds(4,2)
+           do kr=bounds(3,1),bounds(3,2)
+             do jr=bounds(2,1),bounds(2,2)
+               do ir=bounds(1,1),bounds(1,2)
+                     nind=nind+1
+                     vector(nind) = array%array4(ir,jr,kr,lr)
+               enddo
+             enddo
+           enddo
+         enddo         
+C
+      CASE (5)
+         nind=0
+         do mr=bounds(5,1),bounds(5,2)
+           do lr=bounds(4,1),bounds(4,2)
+            do kr=bounds(3,1),bounds(3,2) 
+              do jr=bounds(2,1),bounds(2,2)
+                 do ir=bounds(1,1),bounds(1,2)
+                     nind=nind+1
+                     vector(nind) = array%array5(ir,jr,kr,lr,mr)
+                 enddo
+               enddo
+             enddo
+           enddo
+         enddo   
+C
+      CASE (6)
+         nind=0
+        do nr=bounds(6,1),bounds(6,2)
+           do mr=bounds(5,1),bounds(5,2)
+             do lr=bounds(4,1),bounds(4,2)
+               do kr=bounds(3,1),bounds(3,2)
+                do jr=bounds(2,1),bounds(2,2)
+                   do ir=bounds(1,1),bounds(1,2)
+                     nind=nind+1
+                     vector(nind) = array%array6(ir,jr,kr,lr,mr,nr)
+                   enddo
+                 enddo
+               enddo
+             enddo
+           enddo
+         enddo       
+      END SELECT
+C
+      return
+C
+      End Subroutine Agrif_vector2array
+
+#ifdef AGRIF_MPI
+C     **************************************************************************
+CCC   Subroutine GiveAgrif_SpecialValueToTab_mpi
+C     **************************************************************************
+C
+      Subroutine GiveAgrif_SpecialValueToTab_mpi(Variable1,Variable2,
+     &                  bound1,lower,upper,Value,nbdim)
+C
+CCC   Description:
+CCC   
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_VARIABLE), Pointer    :: Variable1
+      TYPE(AGRIF_VARIABLE), Pointer    :: Variable2
+      INTEGER                  :: nbdim
+      INTEGER,DIMENSION(:,:,:) :: bound1
+      INTEGER,DIMENSION(nbdim) :: lower,upper
+      REAL                     :: Value
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+             Where (Variable1 % array1(
+     &           bound1(lower(1),1,2):bound1(upper(1),1,2)) 
+     &            == Value)
+             Variable2 % array1(lower(1):upper(1))
+     &                        = Value
+C      
+              End Where
+      CASE (2)
+             Where (Variable1 % array2(
+     &           bound1(lower(1),1,2):bound1(upper(1),1,2),
+     &           bound1(lower(2),2,2):bound1(upper(2),2,2)) 
+     &            == Value)
+             Variable2 % array2(lower(1):upper(1),
+     &                          lower(2):upper(2))
+     &                        = Value
+C      
+              End Where
+      CASE (3)
+             Where (Variable1 % array3(
+     &           bound1(lower(1),1,2):bound1(upper(1),1,2),
+     &           bound1(lower(2),2,2):bound1(upper(2),2,2), 
+     &           bound1(lower(3),3,2):bound1(upper(3),3,2)) 
+     &            == Value)
+             Variable2 % array3(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3))
+     &                         = Value
+C      
+              End Where
+      CASE (4)
+             Where (Variable1 % array4(
+     &           bound1(lower(1),1,2):bound1(upper(1),1,2),
+     &           bound1(lower(2),2,2):bound1(upper(2),2,2), 
+     &           bound1(lower(3),3,2):bound1(upper(3),3,2),
+     &           bound1(lower(4),4,2):bound1(upper(4),4,2)) 
+     &            == Value)
+             Variable2 % array4(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3),
+     &                          lower(4):upper(4))
+     &                        = Value
+C      
+              End Where
+      CASE (5)
+             Where (Variable1 % array5(
+     &           bound1(lower(1),1,2):bound1(upper(1),1,2),
+     &           bound1(lower(2),2,2):bound1(upper(2),2,2),
+     &           bound1(lower(3),3,2):bound1(upper(3),3,2),
+     &           bound1(lower(4),4,2):bound1(upper(4),4,2),
+     &           bound1(lower(5),5,2):bound1(upper(5),5,2)) 
+     &            == Value)
+             Variable2 % array5(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3),
+     &                          lower(4):upper(4),
+     &                          lower(5):upper(5))
+     &                        = Value
+C      
+              End Where
+      CASE (6)
+             Where (Variable1 % array6(
+     &           bound1(lower(1),1,2):bound1(upper(1),1,2),
+     &           bound1(lower(2),2,2):bound1(upper(2),2,2),
+     &           bound1(lower(2),3,2):bound1(upper(3),3,2),
+     &           bound1(lower(4),4,2):bound1(upper(4),4,2),
+     &           bound1(lower(5),5,2):bound1(upper(5),5,2),
+     &           bound1(lower(6),6,2):bound1(upper(6),6,2)) 
+     &            == Value)
+             Variable2 % array6(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3),
+     &                          lower(4):upper(4),
+     &                          lower(5):upper(5),
+     &                          lower(6):upper(6))
+     &                        = Value
+C      
+              End Where
+      END SELECT
+C
+      return
+C
+      End Subroutine GiveAgrif_SpecialValueToTab_mpi    
+#else
+C     **************************************************************************
+CCC   Subroutine GiveAgrif_SpecialValueToTab
+C     **************************************************************************
+C
+      Subroutine GiveAgrif_SpecialValueToTab(Variable1,Variable2,
+     &                  lower,upper,Value,nbdim)
+C
+CCC   Description:
+CCC   
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_VARIABLE), Pointer    :: Variable1
+      TYPE(AGRIF_VARIABLE), Pointer    :: Variable2
+      INTEGER                  :: nbdim
+      INTEGER,DIMENSION(nbdim) :: lower,upper
+      REAL                     :: Value
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+             Where (Variable1 % array1(
+     &           lower(1):upper(1))
+     &            == Value)
+             Variable2 % array1(lower(1):upper(1))
+     &                        = Value
+C      
+              End Where
+      CASE (2)
+             Where (Variable1 % array2(
+     &           lower(1):upper(1),
+     &           lower(2):upper(2)) 
+     &            == Value)
+             Variable2 % array2(lower(1):upper(1),
+     &                          lower(2):upper(2))
+     &                        = Value
+C      
+              End Where
+      CASE (3)
+             Where (Variable1 % array3(
+     &           lower(1):upper(1),
+     &           lower(2):upper(2), 
+     &           lower(3):upper(3)) 
+     &            == Value)
+             Variable2 % array3(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3))
+     &                         = Value
+C      
+              End Where
+      CASE (4)
+             Where (Variable1 % array4(
+     &           lower(1):upper(1),
+     &           lower(2):upper(2), 
+     &           lower(3):upper(3),
+     &           lower(4):upper(4)) 
+     &            == Value)
+             Variable2 % array4(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3),
+     &                          lower(4):upper(4))
+     &                        = Value
+C      
+              End Where
+      CASE (5)
+             Where (Variable1 % array5(
+     &           lower(1):upper(1),
+     &           lower(2):upper(2),
+     &           lower(3):upper(3),
+     &           lower(4):upper(4),
+     &           lower(5):upper(5)) 
+     &            == Value)
+             Variable2 % array5(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3),
+     &                          lower(4):upper(4),
+     &                          lower(5):upper(5))
+     &                        = Value
+C      
+              End Where
+      CASE (6)
+             Where (Variable1 % array6(
+     &           lower(1):upper(1),
+     &           lower(2):upper(2),
+     &           lower(2):upper(3),
+     &           lower(4):upper(4),
+     &           lower(5):upper(5),
+     &           lower(6):upper(6)) 
+     &            == Value)
+             Variable2 % array6(lower(1):upper(1),
+     &                          lower(2):upper(2),
+     &                          lower(3):upper(3),
+     &                          lower(4):upper(4),
+     &                          lower(5):upper(5),
+     &                          lower(6):upper(6))
+     &                        = Value
+C      
+              End Where
+      END SELECT
+C
+      return
+C
+      End Subroutine GiveAgrif_SpecialValueToTab   
+#endif
+C
+C
+#ifdef AGRIF_MPI
+C     **************************************************************************
+CCC   Subroutine Where_ValTabToTab_mpi
+C     **************************************************************************
+C
+      Subroutine Where_ValTabToTab_mpi(
+     &                  Variable1,Variable2,
+     &                  lower,upper,Value,nbdim)
+C
+CCC   Description:
+CCC   
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+C
+      TYPE(AGRIF_VARIABLE), Pointer     :: Variable1
+      TYPE(AGRIF_VARIABLE), Pointer     :: Variable2
+      INTEGER                  :: nbdim
+      INTEGER,DIMENSION(nbdim) :: lower,upper
+      REAL                     :: Value
+      INTEGER :: i,j,k,l,m,n
+C
+C     Local variables       
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+            DO i = lower(1),upper(1)
+              IF (variable1%array1(i) == Value) then
+                variable1%array1(i)=Variable2%array1(i)
+              ENDIF
+            ENDDO
+      CASE (2)
+            DO j = lower(2),upper(2)
+            DO i = lower(1),upper(1)
+              IF (variable1%array2(i,j) == Value) then
+                variable1%array2(i,j)=Variable2%array2(i,j)
+              ENDIF
+            ENDDO
+            ENDDO
+      CASE (3)
+            DO k = lower(3),upper(3)
+            DO j = lower(2),upper(2)
+            DO i = lower(1),upper(1)
+              IF (variable1%array3(i,j,k) == Value) then
+                variable1%array3(i,j,k)=Variable2%array3(i,j,k)
+              ENDIF
+            ENDDO
+            ENDDO
+            ENDDO
+      CASE (4)
+            DO l = lower(4),upper(4)
+            DO k = lower(3),upper(3)
+            DO j = lower(2),upper(2)
+            DO i = lower(1),upper(1)
+              IF (variable1%array4(i,j,k,l) == Value) then
+                variable1%array4(i,j,k,l)=Variable2%array4(i,j,k,l)
+              ENDIF
+            ENDDO
+            ENDDO
+            ENDDO
+            ENDDO
+      CASE (5)
+            DO m = lower(5),upper(5)
+            DO l = lower(4),upper(4)
+            DO k = lower(3),upper(3)
+            DO j = lower(2),upper(2)
+            DO i = lower(1),upper(1)
+              IF (variable1%array5(i,j,k,l,m) == Value) then
+              variable1%array5(i,j,k,l,m)=Variable2%array5(i,j,k,l,m)
+              ENDIF
+            ENDDO
+            ENDDO
+            ENDDO
+            ENDDO
+            ENDDO
+      CASE (6)
+            DO n = lower(6),upper(6)
+            DO m = lower(5),upper(5)
+            DO l = lower(4),upper(4)
+            DO k = lower(3),upper(3)
+            DO j = lower(2),upper(2)
+            DO i = lower(1),upper(1)
+              IF (variable1%array6(i,j,k,l,m,n) == Value) then
+            variable1%array6(i,j,k,l,m,n)=Variable2%array6(i,j,k,l,m,n)
+              ENDIF
+            ENDDO
+            ENDDO
+            ENDDO
+            ENDDO
+            ENDDO
+            ENDDO
+      END SELECT
+C
+      return
+C
+      End Subroutine Where_ValTabToTab_mpi    
+#endif
+
+C     **************************************************************************
+CCC   Subroutine PreProcessToInterpOrUpdate
+C     **************************************************************************
+C
+      Subroutine PreProcessToInterpOrUpdate(parent,child,
+     &             petab_Child,
+     &             pttab_Child,pttab_Parent,
+     &             s_Child,s_Parent,
+     &             ds_Child,ds_Parent,
+     &             nbdim)
+C
+CCC   Description:
+CCC   
+C
+C     Declarations:
+C      
+C     arguments                                   
+      TYPE(AGRIF_PVariable) :: parent   ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child    ! Variable on the child grid
+      INTEGER :: nbdim                  
+      INTEGER,DIMENSION(6) :: pttab_child  
+      INTEGER,DIMENSION(6) :: petab_child      
+      INTEGER,DIMENSION(6) :: pttab_parent  
+      TYPE(AGRIF_Variable), Pointer :: root ! Pointer on the variable of the 
+                                            ! root grid
+      TYPE(Agrif_Grid), Pointer :: Agrif_Child_Gr,Agrif_Parent_Gr
+      REAL, DIMENSION(6) :: s_child,s_parent
+      REAL, DIMENSION(6) :: ds_child,ds_parent
+C     locals variables
+      INTEGER :: n
+      
+C
+C     Arguments      
+C
+
+C
+C     Local variables       
+C
+      Agrif_Child_Gr => Agrif_Curgrid
+      Agrif_Parent_Gr => Agrif_Curgrid % parent
+C
+      root => child % var % root_var 
+C
+C     Number of dimensions of the current grid
+      nbdim = root % nbdim
+C      
+      do n=1,nbdim
+C            
+        Select case(root % interptab(n))
+C
+C       Value of interptab(n) can be either x,y,z or N for a no space 
+C       DIMENSION            
+C
+C         The DIMENSION is 'x'
+          case('x')
+C
+            pttab_Child(n) = root % point(1)
+C            
+            pttab_Parent(n) = root % point(1)
+C        
+            s_Child(n) = Agrif_Child_Gr % Agrif_x(1)
+C
+            s_Parent(n) = Agrif_Parent_Gr % Agrif_x(1)
+C        
+            ds_Child(n) = Agrif_Child_Gr % Agrif_d(1)
+C
+            ds_Parent(n) = Agrif_Parent_Gr % Agrif_d(1)
+C                      
+            if (root % posvar(n).EQ.1) then
+C          
+              petab_Child(n) = pttab_Child(n) + Agrif_Child_Gr%nb(1)
+C        
+              else
+C          
+                petab_Child(n) = pttab_Child(n) + 
+     &                              Agrif_Child_Gr%nb(1) - 1
+C          
+                s_Child(n) = s_Child(n) + ds_Child(n)/2.
+C
+                s_Parent(n) = s_Parent(n) + ds_Parent(n)/2.
+C        
+            endif                  
+C
+C         The DIMENSION is 'y'
+          case('y')
+C
+            pttab_Child(n) = root % point(2)
+C            
+            pttab_Parent(n) = root % point(2)
+C        
+            s_Child(n) = Agrif_Child_Gr % Agrif_x(2)
+C
+            s_Parent(n) = Agrif_Parent_Gr % Agrif_x(2) 
+C        
+            ds_Child(n) = Agrif_Child_Gr % Agrif_d(2)
+C
+            ds_Parent(n) = Agrif_Parent_Gr % Agrif_d(2)
+C                      
+            if (root % posvar(n).EQ.1) then
+C          
+             petab_Child(n) = pttab_Child(n) + Agrif_Child_Gr%nb(2)
+C          
+              else
+C          
+                petab_Child(n) = pttab_Child(n) + 
+     &                       Agrif_Child_Gr%nb(2) - 1
+C          
+                s_Child(n) = s_Child(n) + ds_Child(n)/2.
+C
+                s_Parent(n) = s_Parent(n) + ds_Parent(n)/2.
+C        
+            endif
+            
+C
+C         The DIMENSION is 'z'                            
+          case('z')
+C
+            pttab_Child(n) = root % point(3)
+C            
+            pttab_Parent(n) = root % point(3)
+C        
+            s_Child(n) = Agrif_Child_Gr % Agrif_x(3)
+C
+            s_Parent(n) = Agrif_Parent_Gr % Agrif_x(3)
+C        
+            ds_Child(n) = Agrif_Child_Gr % Agrif_d(3)
+C
+            ds_Parent(n) = Agrif_Parent_Gr % Agrif_d(3)
+C                      
+            if (root % posvar(n).EQ.1) then
+C          
+             petab_Child(n) = pttab_Child(n) + Agrif_Child_Gr%nb(3)
+C          
+              else
+C          
+                petab_Child(n) = pttab_Child(n) + 
+     &                      Agrif_Child_Gr%nb(3) - 1
+C
+                s_Child(n) = s_Child(n) + ds_Child(n)/2.
+C
+                s_Parent(n) = s_Parent(n) + ds_Parent(n)/2.
+C        
+            endif       
+C 
+C         The DIMENSION is not space                            
+          case('N')
+C
+C         The next coefficients are calculated in order to do a simple copy of 
+C         values of the grid variable when the procedure of interpolation is 
+C         called for this DIMENSION 
+C      
+            Call Agrif_nbdim_Get_bound(child % var,
+     &                           pttab_Child(n),petab_Child(n),n,nbdim)
+C
+C           No interpolation but only a copy of the values of the grid variable
+C
+            pttab_Parent(n) = pttab_Child(n)
+C              
+            s_Child(n)=0.
+C      
+            s_Parent(n)=0. 
+C      
+            ds_Child(n)=1.
+C      
+            ds_Parent(n)=1.
+C
+        End select
+C            
+      enddo     
+C
+      return
+C
+      End Subroutine PreProcessToInterpOrUpdate     
+
+#ifdef AGRIF_MPI
+C
+C     **************************************************************************
+CCC   Subroutine GetLocalBoundaries
+C     **************************************************************************
+C
+      Subroutine GetLocalBoundaries(tab1,tab2,i,lb,ub,deb,fin)
+C
+CCC   Descritpion:
+C 
+C
+C     Declarations:
+C
+
+C
+C
+C     Scalar arguments
+      INTEGER  ::  tab1,tab2
+      INTEGER  ::  i
+      INTEGER  ::  lb,ub
+      INTEGER  ::  deb,fin
+C
+C     Local scalars
+      INTEGER  ::  imin,imax
+      INTEGER  ::  i1,i2
+C
+C
+      Call AGRIF_InvLoc(lb,AGRIF_ProcRank,i,imin)
+C
+      Call AGRIF_InvLoc(ub,AGRIF_ProcRank,i,imax)
+C
+C
+      if (imin > tab2) then
+C
+          i1 = imax - imin
+C
+        else
+C
+          i1 = max(tab1 - imin,0)
+C
+      endif
+C
+      if (imax < tab1) then
+C
+          i2 = -(imax - imin)
+C
+        else
+C
+          i2 = min(tab2 - imax,0)
+C
+      endif
+C
+      deb = lb + i1
+C
+      fin = ub + i2
+C
+C
+      End Subroutine GetLocalBoundaries
+C
+#endif
+C
+C
+#ifdef AGRIF_MPI
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_GlobtoLocInd
+C     **************************************************************************
+C
+      Subroutine Agrif_GlobtoLocInd(tabarray,lboundl,uboundl,tab1,tab2,
+     &                              nbdim,rank)
+C
+CCC   Description:
+CCC   For a global index located on the current processor, tabarray gives the 
+CCC   corresponding local index   
+C
+C
+C     Declarations:
+C
+
+C
+C     Arguments
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(nbdim) :: tab1,tab2
+      INTEGER,DIMENSION(minval(tab1):maxval(tab2),nbdim,2 ) :: tabarray
+      INTEGER,DIMENSION(nbdim) :: lboundl,uboundl
+      INTEGER :: rank
+C
+C     Local variables
+      INTEGER :: i,i1,k
+C
+C
+      tabarray(:,:,1) = 0
+C        
+      do i = 1,nbdim
+C       
+        Call Agrif_Invloc(lboundl(i),rank,i,i1)
+        
+        do k=tab1(i)+lboundl(i)-i1,tab2(i)+lboundl(i)-i1
+           tabarray(k-lboundl(i)+i1,i,1)=1
+           tabarray(k-lboundl(i)+i1,i,2)=k
+        enddo
+
+C
+      enddo
+C
+      Return
+C
+C
+      End Subroutine Agrif_GlobtoLocInd
+
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_GlobtoLocInd2
+C     **************************************************************************
+C
+      Subroutine Agrif_GlobtoLocInd2(tabarray,lboundl,uboundl,tab1,tab2,
+     &                              nbdim,rank,member)
+C
+CCC   Description:
+CCC   For a global index located on the current processor, tabarray gives the 
+CCC   corresponding local index   
+C
+C
+C     Declarations:
+C
+
+C
+C     Arguments
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(nbdim) :: tab1,tab2
+      INTEGER,DIMENSION(nbdim,2,2 ) :: tabarray
+      INTEGER,DIMENSION(nbdim) :: lboundl,uboundl
+      INTEGER :: rank
+      LOGICAL :: member
+C    
+C     Local variables
+      INTEGER :: i,i1,k
+      INTEGER :: nbloc(nbdim)
+C
+C
+      tabarray(:,1,:) =  HUGE(1)
+      tabarray(:,2,:) =  -HUGE(1)
+
+      nbloc = 0
+C        
+      do i = 1,nbdim
+C       
+        Call Agrif_Invloc(lboundl(i),rank,i,i1)
+        
+        do k=tab1(i)+lboundl(i)-i1,tab2(i)+lboundl(i)-i1
+          IF ((k .GE. lboundl(i)) .AND. (k.LE.uboundl(i))) THEN
+            nbloc(i) = 1
+            tabarray(i,1,1) = min(tabarray(i,1,1),k-lboundl(i)+i1)
+            tabarray(i,2,1) = max(tabarray(i,2,1),k-lboundl(i)+i1)
+        
+            tabarray(i,1,2) = min(tabarray(i,1,2),k)
+            tabarray(i,2,2) = max(tabarray(i,2,2),k)
+          ENDIF
+        enddo
+C
+      enddo
+
+      member = .FALSE.
+      IF (sum(nbloc) == nbdim) member = .TRUE.
+C
+      Return
+C
+C
+      End Subroutine Agrif_GlobtoLocInd2
+C
+#endif      
+
+      End Module Agrif_Arrays
Index: /trunk/AGRIF/AGRIF_FILES/modbc.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modbc.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modbc.F	(revision 396)
@@ -0,0 +1,1194 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Boundary 
+C 
+      Module Agrif_Boundary  
+C
+CCC   Description:
+CCC   Module to calculate the boundary conditions on the child grids from their
+CCC   parent grids.
+C
+C     Modules used:  
+C   
+      Use Agrif_Interpolation        
+C
+      IMPLICIT NONE
+C        
+      CONTAINS   
+C     Define procedures contained in this module
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_bc_1d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_bc_1d(TypeInterp,parent,child,tab,deb,fin,
+     &                              weight,pweight)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions on a fine grid for a 1D 
+CCC   grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER,DIMENSION(6) :: TypeInterp    ! TYPE of interpolation
+                                            ! (linear,...)
+      TYPE(AGRIF_PVariable) :: parent       ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child        ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp    ! Temporary variable on the child 
+                                            ! grid
+      INTEGER :: deb,fin                    ! Positions of the  interpolations 
+      REAL, DIMENSION(
+     &    lbound(child%var%array1,1):ubound(child%var%array1,1)
+     &    ), Target :: tab ! Values of the grid variable
+      LOGICAL :: pweight                    ! Indicates if weight is used for  
+                                            ! the temporal interpolation 
+      REAL :: weight                        ! Coefficient for the time 
+                                            ! interpolation
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid
+C     variable.  
+C
+      allocate(childtemp % var)  
+C
+      childtemp % var % root_var => child % var % root_var
+C      
+C     Values of the grid variable
+      childtemp % var % array1 => tab  
+C
+C     Temporary results for the time interpolation before and after the space 
+C     interpolation 
+      childtemp % var % oldvalues2D => child % var % oldvalues2D
+C 
+C     Index indicating if a space interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex       
+      childtemp % var % Interpolationshouldbemade = 
+     &                 child % var % Interpolationshouldbemade       
+C
+C     Call to the procedure for the calculations of the boundary conditions
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight)
+C
+      child % var % oldvalues2D => childtemp % var % oldvalues2D
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_bc_1D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_bc_2d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_bc_2d(TypeInterp,parent,child,tab,deb,fin,
+     &                              weight,pweight,procname)
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions on a fine grid for a 2D 
+CCC   grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      External :: procname
+      Optional :: procname
+      INTEGER,DIMENSION(6) :: TypeInterp    ! TYPE of interpolation (linear, 
+                                            ! lagrange, spline, ... )
+      TYPE(AGRIF_PVariable) :: parent       ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child        ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp    ! Temporary variable on the child 
+                                            ! grid
+      INTEGER :: deb,fin                    ! Positions where interpolations are
+                                            ! done on the fine grid 
+      REAL, DIMENSION(
+     &         lbound(child%var%array2,1): ubound(child%var%array2,1),
+     &         lbound(child%var%array2,2): ubound(child%var%array2,2)), 
+     &         Target :: tab ! Values of the grid variable
+      LOGICAL :: pweight                    ! Indicates if weight is used for  
+                                            ! the temporal interpolation 
+      REAL :: weight                        ! Coefficient for the time 
+                                            ! interpolation
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid
+C     variable.   
+C
+      allocate(childtemp % var)  
+C
+      childtemp % var % root_var => child % var % root_var
+C      
+C     Values of the grid variable
+      childtemp % var % array2 => tab  
+C
+C     Temporary results for the time interpolation before and after the space 
+C     interpolation 
+      childtemp % var % oldvalues2D => child % var % oldvalues2D
+C 
+C     Index indicating if a space interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex       
+      childtemp % var % Interpolationshouldbemade = 
+     &                 child % var % Interpolationshouldbemade       
+C
+C     Call to the procedure for the calculations of the boundary conditions
+      IF (present(procname)) THEN
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight,procname)
+      ELSE
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight)
+      ENDIF
+
+C   
+      child % var % oldvalues2D => childtemp % var % oldvalues2D
+C         
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_bc_2D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_bc_3d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_bc_3d(TypeInterp,parent,child,tab,deb,fin,
+     &                              weight,pweight,procname)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions on a fine grid for a 3D 
+CCC   variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments 
+      External :: procname
+      Optional :: procname     
+      INTEGER,DIMENSION(6) :: TypeInterp    ! TYPE of interpolation (linear, 
+                                            ! lagrange, spline, ... )
+      TYPE(AGRIF_PVariable) :: parent       ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child        ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp    ! Temporary variable on the child
+                                            ! grid
+      INTEGER :: deb,fin                    ! Positions where interpolations 
+                                            ! are done on the fine grid 
+      REAL, DIMENSION(
+     &         lbound(child%var%array3,1):ubound(child%var%array3,1),
+     &         lbound(child%var%array3,2):ubound(child%var%array3,2),
+     &         lbound(child%var%array3,3):ubound(child%var%array3,3)
+     &         ), Target :: tab ! Values of the grid variable
+      LOGICAL :: pweight                    ! Indicates if weight is used for 
+                                            ! the temporal interpolation 
+      REAL :: weight                        ! Coefficient for the time 
+                                            ! interpolation
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid 
+C     variable.  
+C
+      allocate(childtemp % var)  
+C
+      childtemp % var % root_var => child % var % root_var       
+C      
+C     Values of the grid variable
+      childtemp % var % array3 => tab
+C
+C     Temporary results for the time interpolation before and after the space 
+C     interpolation  
+      childtemp % var % oldvalues2D => child % var % oldvalues2D
+C 
+C     Index indicating if a space interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex
+      childtemp % var % Interpolationshouldbemade = 
+     &                 child % var % Interpolationshouldbemade       
+C
+C     Call to the procedure for the calculations of the boundary conditions     
+      IF (present(procname)) THEN
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight,procname)
+      ELSE
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight)
+      ENDIF
+C
+      child % var % oldvalues2D => childtemp % var % oldvalues2D
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_bc_3D               
+C
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_bc_4d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_bc_4d(TypeInterp,parent,child,tab,deb,fin,
+     &                             weight,pweight,procname)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions on a fine grid for a 4D 
+CCC   grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      External :: procname
+      Optional :: procname     
+      INTEGER,DIMENSION(6) :: TypeInterp      ! TYPE of interpolation (linear, 
+                                              ! lagrange, spline, ... )
+      TYPE(AGRIF_PVariable) :: parent         ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child          ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp      ! Temporary varaiable on the child
+                                              ! grid
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid 
+      REAL, DIMENSION(
+     &        lbound(child%var%array4,1):ubound(child%var%array4,1),
+     &        lbound(child%var%array4,2):ubound(child%var%array4,2),
+     &        lbound(child%var%array4,3):ubound(child%var%array4,3),
+     &        lbound(child%var%array4,4):ubound(child%var%array4,4)
+     &        ), Target :: tab ! Values of the grid variable
+      LOGICAL :: pweight                      ! Indicates if weight is used for 
+                                              ! the temporal interpolation 
+      REAL :: weight                          ! Coefficient for the time 
+                                              ! interpolation
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid 
+C     variable.  
+C
+      allocate(childtemp % var)  
+C
+      childtemp % var % root_var => child % var % root_var 
+C      
+C     Values of the grid variable
+      childtemp % var % array4 => tab  
+C
+C     Temporary results for the time interpolation before and after the space 
+C     interpolation       
+      childtemp % var % oldvalues2D => child % var % oldvalues2D
+C 
+C     Index indicating if a space interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex       
+      childtemp % var % Interpolationshouldbemade = 
+     &                 child % var % Interpolationshouldbemade       
+C
+C     Call to the procedure for the calculations of the boundary conditions
+      IF (present(procname)) THEN
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight,procname)
+      ELSE
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight)
+      ENDIF
+C
+      child % var % oldvalues2D => childtemp % var % oldvalues2D
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_bc_4D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_bc_5d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_bc_5d(TypeInterp,parent,child,tab,deb,fin,
+     &                             weight,pweight,procname)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions on a fine grid for a 5D 
+CCC   grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      External :: procname
+      Optional :: procname     
+      INTEGER,DIMENSION(6) :: TypeInterp      ! TYPE of interpolation (linear, 
+                                              ! lagrange, spline, ... )
+      TYPE(AGRIF_PVariable) :: parent         ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child          ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp      ! Temporary varaiable on the child
+                                              ! grid
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid 
+      REAL, DIMENSION(
+     &         lbound(child%var%array5,1):ubound(child%var%array5,1),
+     &         lbound(child%var%array5,2):ubound(child%var%array5,2),
+     &         lbound(child%var%array5,3):ubound(child%var%array5,3),
+     &         lbound(child%var%array5,4):ubound(child%var%array5,4),
+     &         lbound(child%var%array5,5):ubound(child%var%array5,5)
+     &         ), Target :: tab ! Values of the grid variable
+      LOGICAL :: pweight                      ! Indicates if weight is used for 
+                                              ! the temporal interpolation 
+      REAL :: weight                          ! Coefficient for the time 
+                                              ! interpolation
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid 
+C     variable.  
+C
+      allocate(childtemp % var)  
+C
+      childtemp % var % root_var => child % var % root_var 
+C      
+C     Values of the grid variable
+      childtemp % var % array5 => tab  
+C
+C     Temporary results for the time interpolation before and after the space 
+C     interpolation       
+      childtemp % var % oldvalues2D => child % var % oldvalues2D
+C 
+C     Index indicating if a space interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex       
+      childtemp % var % Interpolationshouldbemade = 
+     &                 child % var % Interpolationshouldbemade       
+C
+C     Call to the procedure for the calculations of the boundary conditions  
+      IF (present(procname)) THEN
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight,procname)
+      ELSE
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight)
+      ENDIF
+C
+      child % var % oldvalues2D => childtemp % var % oldvalues2D
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_bc_5D
+C
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_bc_6d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_bc_6d(TypeInterp,parent,child,tab,deb,fin,
+     &                             weight,pweight)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions on a fine grid for a 6D 
+CCC   grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER,DIMENSION(6) :: TypeInterp      ! TYPE of interpolation (linear, 
+                                              ! lagrange, spline, ... )
+      TYPE(AGRIF_PVariable) :: parent         ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child          ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp      ! Temporary varaiable on the child
+                                              ! grid
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid 
+      REAL, DIMENSION(
+     &         lbound(child%var%array6,1):ubound(child%var%array6,1),
+     &         lbound(child%var%array6,2):ubound(child%var%array6,2),
+     &         lbound(child%var%array6,3):ubound(child%var%array6,3),
+     &         lbound(child%var%array6,4):ubound(child%var%array6,4),
+     &         lbound(child%var%array6,5):ubound(child%var%array6,5),
+     &         lbound(child%var%array6,6):ubound(child%var%array6,6)
+     &         ), Target :: tab ! Values of the grid variable
+      LOGICAL :: pweight                      ! Indicates if weight is used for 
+                                              ! the temporal interpolation 
+      REAL :: weight                          ! Coefficient for the time 
+                                              ! interpolation
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE representing the grid 
+C     variable.  
+C
+      allocate(childtemp % var)  
+C
+      childtemp % var % root_var => child % var % root_var 
+C      
+C     Values of the grid variable
+      childtemp % var % array6 => tab  
+C
+C     Temporary results for the time interpolation before and after the space 
+C     interpolation       
+      childtemp % var % oldvalues2D => child % var % oldvalues2D
+C 
+C     Index indicating if a space interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex       
+      childtemp % var % Interpolationshouldbemade = 
+     &                 child % var % Interpolationshouldbemade       
+C
+C     Call to the procedure for the calculations of the boundary conditions
+      Call Agrif_CorrectVariable
+     &     (TypeInterp,parent,childtemp,deb,fin,pweight,weight)
+C
+      child % var % oldvalues2D => childtemp % var % oldvalues2D
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_bc_6D
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_CorrectVariable
+C     **************************************************************************
+C
+      Subroutine AGRIF_CorrectVariable(TypeInterp,parent,child,deb,fin,
+     &                                 pweight,weight,procname)
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions on a fine grid.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments
+      External :: procname
+      Optional :: procname
+      TYPE(AGRIF_PVariable) :: parent         ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child          ! Variable on the child grid
+      INTEGER,DIMENSION(6)  :: TypeInterp     ! TYPE of interpolation
+                                              !    (linear,lagrange,...)
+      INTEGER               :: deb,fin        ! Positions where boundary
+                                              !    conditions are calculated
+      LOGICAL               :: pweight        ! Indicates if weight is used 
+                                              !    for the time interpolation 
+      REAL                  :: weight         ! Coefficient for the time
+                                              !    interpolation
+C
+C     Local scalars
+      TYPE(Agrif_Grid)    , Pointer :: Agrif_Child_Gr,Agrif_Parent_Gr
+      TYPE(AGRIF_Variable), Pointer :: root   ! Variable on the root grid
+      INTEGER                       :: nbdim  ! Number of dimensions of 
+                                              !    the grid variable 
+      INTEGER                       :: n
+      INTEGER,DIMENSION(6)          :: pttab_child  ! Index of the first point
+                                                    !    inside the domain for
+                                                    !    the child grid variable
+      INTEGER,DIMENSION(6)          :: pttab_parent ! Index of the first point
+                                                    !    inside the domain for
+                                                    !    the parent grid
+                                                    !    variable
+      INTEGER,DIMENSION(6)          :: nbtab_Child  ! Number of the cells
+      INTEGER,DIMENSION(6)          :: posvartab_Child    ! Position of the
+                                                    !    variable on the cell 
+      INTEGER,DIMENSION(6)          :: loctab_Child ! Indicates if the child
+                                                    !    grid has a common
+                                                    !    border with the root
+                                                    !    grid      
+      REAL, DIMENSION(6)            :: s_child,s_parent   ! Positions of the
+                                                    !    parent and child grids
+      REAL, DIMENSION(6)            :: ds_child,ds_parent ! Space steps of the
+                                                    !    parent and child grids 
+C
+C
+      loctab_child(:) = 0
+C
+      Agrif_Child_Gr => Agrif_Curgrid
+      Agrif_Parent_Gr => Agrif_Curgrid % parent
+      root => child % var % root_var 
+      nbdim = root % nbdim
+C
+      do n = 1,nbdim
+        posvartab_child(n) = root % posvar(n)      
+      enddo
+C
+C
+      do n = 1,nbdim
+C
+        Select case(root % interptab(n))
+C
+          case('x') ! x DIMENSION
+C
+            nbtab_Child(n) = Agrif_Child_Gr % nb(1)
+            pttab_Child(n) = root % point(1)
+            pttab_Parent(n) = root % point(1)
+            s_Child(n) = Agrif_Child_Gr % Agrif_x(1)
+            s_Parent(n) = Agrif_Parent_Gr % Agrif_x(1)
+            ds_Child(n) = Agrif_Child_Gr % Agrif_d(1)
+            ds_Parent(n) = Agrif_Parent_Gr % Agrif_d(1)
+            if (root % posvar(n) == 2) then
+                s_Child(n) = s_Child(n) + ds_Child(n)/2.
+                s_Parent(n) = s_Parent(n) + ds_Parent(n)/2.
+            endif
+C
+            if (Agrif_CURGRID % NearRootBorder(1)) 
+     &         loctab_child(n) = -1
+            if (Agrif_CURGRID % DistantRootBorder(1))
+     &         loctab_child(n) = -2
+            if ((Agrif_CURGRID % NearRootBorder(1)) .AND. 
+     &          (Agrif_CURGRID % DistantRootBorder(1))) 
+     &         loctab_child(n) = -3
+C
+          case('y') ! y DIMENSION      
+C
+            nbtab_Child(n) = Agrif_Child_Gr % nb(2)
+            pttab_Child(n) = root % point(2)
+            pttab_Parent(n) = root % point(2)
+            s_Child(n) = Agrif_Child_Gr % Agrif_x(2)
+            s_Parent(n) = Agrif_Parent_Gr % Agrif_x(2) 
+            ds_Child(n) = Agrif_Child_Gr % Agrif_d(2)
+            ds_Parent(n) = Agrif_Parent_Gr % Agrif_d(2)
+            if (root % posvar(n) == 2) then        
+                s_Child(n) = s_Child(n) + ds_Child(n)/2.
+                s_Parent(n) = s_Parent(n) + ds_Parent(n)/2.
+            endif        
+C
+            if (Agrif_CURGRID % NearRootBorder(2)) 
+     &         loctab_child(n) = -1
+            if (Agrif_CURGRID % DistantRootBorder(2)) 
+     &         loctab_child(n) = -2
+            if ((Agrif_CURGRID % NearRootBorder(2)) .AND. 
+     &          (Agrif_CURGRID % DistantRootBorder(2))) 
+     &         loctab_child(n) = -3
+C
+          case('z') ! z DIMENSION
+C
+            nbtab_Child(n) = Agrif_Child_Gr % nb(3)
+            pttab_Child(n) = root % point(3)
+            pttab_Parent(n) = root % point(3)
+            s_Child(n) = Agrif_Child_Gr % Agrif_x(3)
+            s_Parent(n) = Agrif_Parent_Gr % Agrif_x(3)
+            ds_Child(n) = Agrif_Child_Gr % Agrif_d(3)
+            ds_Parent(n) = Agrif_Parent_Gr % Agrif_d(3)
+            if (root % posvar(n) == 2) then        
+                s_Child(n) = s_Child(n) + ds_Child(n)/2.
+                s_Parent(n) = s_Parent(n) + ds_Parent(n)/2.
+            endif        
+C
+            if (Agrif_CURGRID % NearRootBorder(3)) 
+     &         loctab_child(n) = -1
+            if (Agrif_CURGRID % DistantRootBorder(3)) 
+     &         loctab_child(n) = -2
+            if ((Agrif_CURGRID % NearRootBorder(3)) .AND. 
+     &          (Agrif_CURGRID % DistantRootBorder(3))) 
+     &         loctab_child(n) = -3
+C
+          case('N') ! No space DIMENSION      
+C
+            select case (nbdim) 
+C      
+              case(1)
+                nbtab_Child(n) = SIZE(child % var % array1,n) - 1
+                pttab_Child(n) = lbound(child % var % array1,n)
+              case(2)
+                nbtab_Child(n) = SIZE(child % var % array2,n) - 1
+                pttab_Child(n) = lbound(child % var % array2,n)
+              case(3)
+                nbtab_Child(n) = SIZE(child % var % array3,n) - 1
+                pttab_Child(n) = lbound(child % var % array3,n)  
+              case(4)
+                nbtab_Child(n) = SIZE(child % var % array4,n) - 1
+                pttab_Child(n) = lbound(child % var % array4,n)
+              case(5)
+                nbtab_Child(n) = SIZE(child % var % array5,n) - 1
+                pttab_Child(n) = lbound(child % var % array5,n)      
+              case(6)
+                nbtab_Child(n) = SIZE(child % var % array6,n) - 1
+                pttab_Child(n) = lbound(child % var % array6,n)      
+C
+            end select
+C
+C           No interpolation but only a copy of the values of the grid variable
+C      
+            posvartab_child(n) = 1
+            pttab_Parent(n)= pttab_Child(n)
+            s_Child(n)=0.
+            s_Parent(n)=0. 
+            ds_Child(n)=1.
+            ds_Parent(n)=1.
+            loctab_child(n) = -3
+C
+        End select
+C
+      enddo
+C
+         IF (present(procname)) THEN
+          Call AGRIF_CorrectnD
+     &         (TypeInterp,parent,child,deb,fin,pweight,weight,
+     &          pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &          nbtab_Child(1:nbdim),posvartab_Child(1:nbdim),
+     &          loctab_Child(1:nbdim),
+     &          s_Child(1:nbdim),s_Parent(1:nbdim),
+     &          ds_Child(1:nbdim),ds_Parent(1:nbdim),nbdim,procname)
+        ELSE
+          Call AGRIF_CorrectnD
+     &         (TypeInterp,parent,child,deb,fin,pweight,weight,
+     &          pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &          nbtab_Child(1:nbdim),posvartab_Child(1:nbdim),
+     &          loctab_Child(1:nbdim),
+     &          s_Child(1:nbdim),s_Parent(1:nbdim),
+     &          ds_Child(1:nbdim),ds_Parent(1:nbdim),nbdim)
+         ENDIF
+C
+C
+      End subroutine AGRIF_CorrectVariable
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Correctnd
+C     **************************************************************************
+C
+      Subroutine AGRIF_Correctnd(TypeInterp,parent,child,deb,fin,
+     &                           pweight,weight,
+     &                           pttab_child,pttab_Parent,
+     &                           nbtab_Child,posvartab_Child,
+     &                           loctab_Child,
+     &                           s_Child,s_Parent,
+     &                           ds_Child,ds_Parent,nbdim,procname)
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions for a nD grid variable on 
+CCC   a fine grid by using a space and time interpolations; it is called by the 
+CCC   Agrif_CorrectVariable procedure.
+C
+C
+C     Declarations:
+C
+      
+C
+#ifdef AGRIF_MPI
+C
+#include "mpif.h"
+C
+#endif
+C
+C     Arguments
+      External :: procname
+      Optional :: procname
+      INTEGER,DIMENSION(6) :: TypeInterp ! TYPE of interpolation (linear, 
+                                         !   spline,...)  
+      TYPE(AGRIF_PVariable)    :: parent ! Variable on the parent grid
+      TYPE(AGRIF_PVariable)    :: child  ! Variable on the child grid 
+      INTEGER                  :: deb,fin ! Positions where interpolations 
+                                         !    are done
+      LOGICAL                  :: pweight ! Indicates if weight is used for 
+                                         !    the temporal interpolation
+      REAL                     :: weight ! Coefficient for the temporal
+                                         !    interpolation
+      INTEGER                  :: nbdim  ! Number of dimensions of the grid
+                                         !    variable
+      INTEGER,DIMENSION(nbdim) :: pttab_child ! Index of the first point inside
+                                         !    the domain for the parent 
+                                         !    grid variable
+      INTEGER,DIMENSION(nbdim) :: pttab_Parent ! Index of the first point 
+                                         !   inside the domain for the 
+                                         !   child grid variable
+      INTEGER,DIMENSION(nbdim) :: nbtab_Child ! Number of cells of the child
+                                         !    grid
+      INTEGER,DIMENSION(nbdim) :: posvartab_Child ! Position of the grid
+                                         !    variable (1 or 2)
+      INTEGER,DIMENSION(nbdim) :: loctab_Child ! Indicates if the child 
+                                        !    grid has a common border with 
+                                        !    the root grid
+      REAL   ,DIMENSION(nbdim) :: s_Child,s_Parent ! Positions of the parent 
+                                        !   and child grids 
+      REAL   ,DIMENSION(nbdim) :: ds_Child,ds_Parent ! Space steps of the 
+                                        !    parent and child grids
+C
+C     Local variables
+      TYPE(AGRIF_PVariable)        :: restore ! Variable on the parent     
+      INTEGER,DIMENSION(nbdim,2)   :: lubglob
+      INTEGER                      :: i          
+      INTEGER                      :: kindex  ! Index used for safeguard 
+                                       !    and time interpolation
+      INTEGER,DIMENSION(nbdim,2,2) :: indtab ! Arrays indicating the limits 
+                                       !    of the child     
+      INTEGER,DIMENSION(nbdim,2,2) :: indtruetab ! grid variable where 
+                                       !   boundary conditions are 
+      INTEGER,DIMENSION(nbdim,2,2,nbdim)   :: ptres,ptres2 ! calculated
+      INTEGER                      :: nb,ndir,n,sizetab
+      REAL, DIMENSION(:), Allocatable :: tab ! Array used for the interpolation
+      REAL    :: c1t,c2t               ! Coefficients for the time interpolation
+                                       !    (c2t=1-c1t) 
+C
+#ifdef AGRIF_MPI
+C
+      INTEGER,DIMENSION(nbdim)   :: lower,upper
+      INTEGER,DIMENSION(nbdim)   :: ltab,utab
+      INTEGER,DIMENSION(nbdim)   :: lb,ub
+      INTEGER,DIMENSION(nbdim,2) :: iminmaxg
+      INTEGER                    :: code
+C
+#endif            
+C      
+C
+      indtab(1:nbdim,2,1) = pttab_child(1:nbdim) + nbtab_child(1:nbdim)
+     &          + deb
+      indtab(1:nbdim,2,2) = indtab(1:nbdim,2,1) + ( fin - deb )
+       
+      indtab(1:nbdim,1,1) = pttab_child(1:nbdim) - fin
+      indtab(1:nbdim,1,2) = pttab_child(1:nbdim) - deb
+                  
+      WHERE (posvartab_child(1:nbdim) == 2)
+        indtab(1:nbdim,1,1) = indtab(1:nbdim,1,1) - 1
+        indtab(1:nbdim,1,2) = indtab(1:nbdim,1,2) - 1
+      END WHERE
+
+#if !defined AGRIF_MPI
+      Call Agrif_nbdim_Get_bound_dimension(child%var,lubglob(:,1),
+     &              lubglob(:,2),nbdim)
+C
+#else
+C     
+      Call Agrif_nbdim_Get_bound_dimension(child%var,lb,ub,nbdim)
+      
+      DO i = 1,nbdim
+C
+        Call Agrif_Invloc(lb(i),Agrif_Procrank,i,iminmaxg(i,1))
+        Call Agrif_Invloc(ub(i),Agrif_Procrank,i,iminmaxg(i,2))
+C
+      ENDDO
+C
+      iminmaxg(1:nbdim,2) = - iminmaxg(1:nbdim,2)
+      
+      CALL MPI_ALLREDUCE(iminmaxg,lubglob,2*nbdim,MPI_INTEGER,MPI_MIN,
+     &                     MPI_COMM_WORLD,code)  
+     
+      lubglob(1:nbdim,2) = - lubglob(1:nbdim,2)      
+C
+#endif 
+C     
+      indtruetab(1:nbdim,1,1) = max(indtab(1:nbdim,1,1),
+     &     lubglob(1:nbdim,1))
+      indtruetab(1:nbdim,1,2) = max(indtab(1:nbdim,1,2),
+     &     lubglob(1:nbdim,1))
+      indtruetab(1:nbdim,2,1) = min(indtab(1:nbdim,2,1),
+     &     lubglob(1:nbdim,2))
+      indtruetab(1:nbdim,2,2) = min(indtab(1:nbdim,2,2),
+     &     lubglob(1:nbdim,2))
+                        
+C 
+C
+      do nb = 1,nbdim
+C
+        do ndir = 1,2      
+C
+          if (loctab_child(nb) /= (-ndir) 
+     &        .AND. loctab_child(nb) /= -3) then
+C           
+              do n = 1,2
+C
+                ptres(nb,n,ndir,nb) = indtruetab(nb,ndir,n)  
+C
+              enddo              
+C
+              do i = 1,nbdim
+C     
+                if (i .NE. nb) then      
+C
+                    if (loctab_child(i) == -1 
+     &                                 .OR. loctab_child(i) == -3) then
+C
+                        ptres(i,1,ndir,nb) = pttab_child(i)
+C
+                      else
+C
+                        ptres(i,1,ndir,nb) = indtruetab(i,1,1)
+C
+                    endif
+C
+                    if (loctab_child(i) == -2 
+     &                                 .OR. loctab_child(i) == -3) then
+C
+                        if (posvartab_child(i) == 1) then
+C
+                            ptres(i,2,ndir,nb) = pttab_child(i)
+     &                                                 + nbtab_child(i)
+C
+                          else
+C
+                            ptres(i,2,ndir,nb) = pttab_child(i)
+     &                                             + nbtab_child(i) - 1
+C
+                        endif                             
+C
+                      else
+C
+                        ptres(i,2,ndir,nb) = indtruetab(i,2,2)
+C
+                    endif                        
+C      
+                endif
+C      
+              enddo
+      
+C
+#if defined AGRIF_MPI
+                 Call Agrif_nbdim_Get_bound_dimension
+     &                    (child%var,lower,upper,nbdim)
+
+              do i = 1,nbdim
+C
+                 Call GetLocalBoundaries(ptres(i,1,ndir,nb),
+     &                                  ptres(i,2,ndir,nb),i,
+     &                                  lower(i),upper(i),
+     &                                  ltab(i),utab(i))
+                 ptres2(i,1,ndir,nb) = max(ltab(i),lower(i)) 
+                 ptres2(i,2,ndir,nb) = min(utab(i),upper(i))
+                 if ((i == nb) .AND. (ndir == 1)) then 
+                     ptres2(i,2,ndir,nb) = max(utab(i),lower(i))
+                 elseif ((i == nb) .AND. (ndir == 2)) then
+                     ptres2(i,1,ndir,nb) = min(ltab(i),upper(i)) 
+                 endif
+C
+              enddo
+#else
+              ptres2(:,:,ndir,nb) = ptres(:,:,ndir,nb)
+#endif      
+            
+        endif
+      
+        enddo
+       enddo
+C
+      if (child % var % interpIndex 
+     &        /= Agrif_Curgrid % parent % ngridstep .OR.
+     &    child%var%Interpolationshouldbemade ) then
+C
+C     Space interpolation 
+C      
+      kindex = 1    
+C
+      do nb = 1,nbdim
+C
+        do ndir = 1,2                
+C
+          if (loctab_child(nb) /= (-ndir) 
+     &        .AND. loctab_child(nb) /= -3) then  
+C
+              IF (present(procname)) THEN
+              Call Agrif_InterpnD
+     &             (TYPEInterp,parent,child,
+     &              ptres(1:nbdim,1,ndir,nb),ptres(1:nbdim,2,ndir,nb),
+     &              pttab_child(1:nbdim),pttab_Parent(1:nbdim),
+     &              s_Child(1:nbdim),s_Parent(1:nbdim),
+     &              ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &              restore,.FALSE.,nbdim,procname)
+              ELSE
+              Call Agrif_InterpnD              
+     &             (TYPEInterp,parent,child,
+     &              ptres(1:nbdim,1,ndir,nb),ptres(1:nbdim,2,ndir,nb),
+     &              pttab_child(1:nbdim),pttab_Parent(1:nbdim),
+     &              s_Child(1:nbdim),s_Parent(1:nbdim),
+     &              ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &              restore,.FALSE.,nbdim)
+              ENDIF
+     
+              IF (.NOT. child%var%interpolationshouldbemade) THEN
+C     
+C             Safeguard of the values of the grid variable (at times n and n+1
+C                on the parent grid)
+C      
+              sizetab = 1
+C
+              do i = 1,nbdim
+C          
+                sizetab = sizetab 
+     &              * (ptres2(i,2,ndir,nb)-ptres2(i,1,ndir,nb)+1)
+C      
+              enddo
+C              
+              allocate(tab(sizetab))
+C
+             Call Agrif_vector2array(
+     &                      tab,child%var,
+     &                      ptres2(:,:,ndir,nb),
+     &                      nbdim)
+
+C     
+              Call saveAfterInterp
+     &             (child,tab,kindex)
+C
+C
+              deallocate(tab)     
+           ENDIF
+C
+          endif
+C
+        enddo       
+C
+      enddo     
+C
+C
+      child % var % interpIndex = Agrif_Curgrid % parent % ngridstep
+C
+C
+      endif  
+      
+              IF (.NOT. child%var%interpolationshouldbemade) THEN
+C
+C
+C     Calculation of the coefficients c1t and c2t for the temporary
+C        interpolation
+      if (pweight) then
+C
+          c1t = weight
+C
+        else
+C
+          c1t = (REAL(AGRIF_Nbstepint()) + 1.) / Agrif_Rhot()
+C
+      endif
+C                                  
+      c2t = 1. - c1t
+C           
+C     Time interpolation
+C
+      kindex = 1
+C
+      do nb = 1,nbdim
+C
+        do ndir = 1,2      
+C
+          if (loctab_child(nb) /= (-ndir) 
+     &        .AND. loctab_child(nb) /= -3) then
+C      
+              sizetab=1   
+C
+              do i = 1,nbdim
+C          
+                sizetab = sizetab
+     &             * (ptres2(i,2,ndir,nb)-ptres2(i,1,ndir,nb)+1)
+C      
+              enddo
+C              
+              allocate(tab(sizetab))
+C
+             Call Agrif_vector2array(
+     &                      tab,child%var,
+     &                      ptres2(:,:,ndir,nb),
+     &                      nbdim)
+C    
+C                  
+              Call timeInterpolation
+     &             (child,tab,kindex,c1t,c2t)           
+C
+C
+          Call Agrif_array2vector(
+     &                   child%var,
+     &                   ptres2(:,:,ndir,nb),
+     &                   tab,nbdim)
+C
+C         
+              deallocate(tab)
+C 
+          endif
+C
+        enddo
+C      
+      enddo
+C      
+
+       ENDIF
+C  
+      End Subroutine Agrif_Correctnd
+C
+C
+C     **************************************************************************
+CCC   Subroutine saveAfterInterp
+C     **************************************************************************
+C
+      Subroutine saveAfterInterp(child,tab,kindex)
+C
+CCC   Descritpion:
+CCC   Subroutine used to save the values of the grid variable on the fine grid 
+CCC   after the space interpolation. 
+C
+C     Declarations:
+C
+      
+C
+C     argument
+      TYPE (AGRIF_PVariable) :: child   ! The fine grid variable
+      REAL, DIMENSION(:)     :: tab     ! Values on the fine grid variable 
+                                        !   after the space interpolation  
+      INTEGER                :: kindex  ! Index indicating where this safeguard 
+                                        ! is done on the fine grid
+C
+C     Local scalars
+      INTEGER :: newsize                ! Size of the domain where boundary
+                                        !    conditions are calculated
+      INTEGER :: i
+C
+C
+C     Allocation of the array oldvalues2d
+      newsize = size(tab)
+C
+      if (newsize .LE. 0) return
+C
+      Call checkSize
+     &     (child,kindex+newsize)  
+C
+C
+C     Safeguard in the oldvalues2d array       
+C            
+      if (child % var % interpIndex 
+     &        /= Agrif_Curgrid % parent % ngridstep ) then
+         do i = 1,newsize
+           child % var % oldvalues2d(kindex,1) = child % var %
+     &                                        oldvalues2d(kindex,2) 
+           child % var % oldvalues2d(kindex,2) = tab(i)
+           kindex = kindex + 1
+         enddo
+      else
+        do i = 1,newsize
+           child % var % oldvalues2d(kindex,2) = tab(i)
+           kindex = kindex + 1
+         enddo
+      endif
+     
+
+C
+C                                                  
+      End subroutine saveAfterInterp
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine timeInterpolation
+C     **************************************************************************
+C
+      Subroutine timeInterpolation(child,tab,kindex,c1t,c2t) 
+C
+CCC   Descritpion:
+CCC   Subroutine for a linear time interpolation on the child grid. 
+C
+C     Declarations:
+C
+      
+C
+C     argument
+      TYPE (AGRIF_PVariable) :: child  ! The fine grid variable
+      REAL, DIMENSION(:)     :: tab
+      INTEGER                :: kindex ! Index indicating the values of the fine
+                                       ! grid got before and after the space 
+                                       ! interpolation and used for the time 
+                                       ! interpolation
+      REAL                   :: c1t,c2t! coefficients for the time interpolation
+                                       ! (c2t=1-c1t)  
+C
+C     Local aruments      
+      INTEGER :: i
+C
+C
+      do i = 1,size(tab)
+        tab(i) = c2t*child % var % oldvalues2d(kindex,1)   
+     &         + c1t*child % var % oldvalues2d(kindex,2)        
+        kindex = kindex + 1        
+      enddo                                             
+C
+C
+      End subroutine timeInterpolation      
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine checkSize
+C     **************************************************************************
+C
+      Subroutine checkSize(child,newsize)
+C
+CCC   Descritpion:
+CCC   Subroutine used in the saveAfterInterp procedure to allocate the 
+CCC   oldvalues2d array. 
+C
+C     Declarations:
+C
+      
+C      
+C     TYPE argument
+      TYPE (AGRIF_PVariable) :: child  ! The fine grid variable
+C 
+C     Scalar arguments
+      INTEGER :: newsize               ! Size of the domains where the boundary 
+                                       ! conditions are calculated  
+C
+C     Local arrays
+      REAL, DIMENSION(:,:), Allocatable :: tempoldvalues ! Temporary array
+C                
+C
+      if (.NOT. associated(child % var % oldvalues2d)) then
+C
+          allocate(child % var % oldvalues2d(newsize,2))
+C  
+          child % var % oldvalues2d=0.
+C
+        else
+C
+          if (SIZE(child % var % oldvalues2d,1) < newsize) then   
+C
+              allocate(tempoldvalues(SIZE(child % var %
+     &                                    oldvalues2d,1),2))
+C
+              tempoldvalues = child % var % oldvalues2d
+C
+              deallocate(child % var % oldvalues2d)
+C
+              allocate(child % var % oldvalues2d(newsize,2))
+C            
+              child%var%oldvalues2d=0.
+C
+              child % var % oldvalues2d(1:SIZE(tempoldvalues,1),:) = 
+     &        tempoldvalues(:,:)
+C
+              deallocate(tempoldvalues)
+C
+          endif 
+C
+      endif                                                    
+C
+C
+      End  Subroutine checkSize
+C
+C
+C
+C      
+      End Module AGRIF_boundary
+
Index: /trunk/AGRIF/AGRIF_FILES/modbcfunction.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modbcfunction.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modbcfunction.F	(revision 396)
@@ -0,0 +1,1422 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module AGRIF_bcfunction
+C
+C 
+      Module  Agrif_bcfunction
+CCC   Description:
+CCC   
+C
+C     Modules used:
+C  
+      Use Agrif_Boundary
+      Use Agrif_Update
+C             
+      IMPLICIT NONE
+C
+      interface Agrif_Bc_variable
+          module procedure Agrif_Bc_variable0d,
+     &                     Agrif_Bc_variable1d,
+     &                     Agrif_Bc_variable2d,
+     &                     Agrif_Bc_variable3d,
+     &                     Agrif_Bc_variable4d,
+     &                     Agrif_Bc_variable5d
+      end interface       
+C
+      interface Agrif_Set_Parent
+          module procedure Agrif_Set_Parent_int,
+     &                     Agrif_Set_Parent_real
+      end interface       
+C
+      interface Agrif_Interp_variable
+          module procedure Agrif_Interp_var0d,
+     &                     Agrif_Interp_var1d,
+     &                     Agrif_Interp_var2d,
+     &                     Agrif_Interp_var3d,
+     &                     Agrif_Interp_var4d,
+     &                     Agrif_Interp_var5d
+      end interface       
+C
+      interface Agrif_Init_variable
+          module procedure Agrif_Init_variable0d,
+     &                     Agrif_Init_variable1d,
+     &                     Agrif_Init_variable2d,
+     &                     Agrif_Init_variable3d
+      end interface       
+C
+      interface Agrif_update_variable
+          module procedure Agrif_update_var0d,
+     &                     Agrif_update_var1d,
+     &                     Agrif_update_var2d,
+     &                     Agrif_update_var3d,
+     &                     Agrif_update_var4d,
+     &                     Agrif_update_var5d
+      end interface       
+C
+      Contains 
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_type
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_type(tabvarsindic,posvar,point)
+C
+CCC   Description:
+CCC   To set the TYPE of the variable.
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C
+C
+C     Arguments      
+C
+      INTEGER, DIMENSION(:) :: posvar
+      INTEGER, DIMENSION(:) :: point
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+      INTEGER :: dimensio ! DIMENSION of the variable
+      INTEGER :: i
+C
+C
+C     Begin 
+C
+      dimensio = Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim
+C
+      Allocate( 
+     & Agrif_Mygrid % tabvars(tabvarsindic)%var % posvar(dimensio))
+
+      do i = 1 , dimensio
+         Agrif_Mygrid % tabvars(tabvarsindic) %var % posvar(i)
+     &                       = posvar(i)
+         Agrif_Mygrid % tabvars(tabvarsindic) %var % point(i) 
+     &                       = point(i)
+      enddo
+C
+C
+      End Subroutine Agrif_Set_type
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_parent_int
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_parent_int(tabvarsindic,value)
+C
+CCC   Description:
+CCC   To set the TYPE of the variable.
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C
+C
+C     Arguments      
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+      INTEGER :: Value
+C
+C     Begin 
+C
+      Agrif_Curgrid % parent % tabvars(tabvarsindic) % 
+     &         var % iarray0 = value
+C
+C
+      End Subroutine Agrif_Set_parent_int
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_parent_real
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_parent_real(tabvarsindic,value)
+C
+CCC   Description:
+CCC   To set the TYPE of the variable.
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C
+C
+C     Arguments      
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+      REAL :: Value
+C
+C     Begin 
+C
+      Agrif_Curgrid % parent % tabvars(tabvarsindic) % 
+     &          var % array0 = value
+C
+C
+      End Subroutine Agrif_Set_parent_real
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_raf
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_raf(tabvarsindic,tabraf)
+C
+CCC   Description:
+CCC   Attention tabraf est de taille trois si on ne raffine pas suivant z la
+CCC             troisieme entree du tableau tabraf est 'N'
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C     Arguments      
+C
+      CHARACTER(*) ,DIMENSION(:) :: tabraf
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+      INTEGER :: dimensio ! DIMENSION of the variable
+      INTEGER :: i
+C
+C
+C     Begin 
+C
+      dimensio = Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim
+C         
+      Allocate(
+     & Agrif_Mygrid % tabvars(tabvarsindic)%var% interptab(dimensio))
+
+      do i = 1 , dimensio
+         Agrif_Mygrid % tabvars(tabvarsindic) %var % interptab(i) 
+     &                 = TRIM(tabraf(i))
+      enddo
+C
+      End Subroutine Agrif_Set_raf
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_bc
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_bc(tabvarsindic,point,
+     &          Interpolationshouldbemade)
+C
+CCC   Description:
+CCC
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C     Arguments      
+C
+      INTEGER, DIMENSION(2) :: point
+      LOGICAL, OPTIONAL :: Interpolationshouldbemade
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+C
+C     Begin 
+C
+C     
+      if (Agrif_Curgrid % fixedrank .NE. 0) then    
+      allocate(Agrif_Curgrid%tabvars(tabvarsindic)%var % interpIndex)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % interpIndex = -1
+      if ( PRESENT(Interpolationshouldbemade) ) then
+         Agrif_Curgrid%tabvars(tabvarsindic)%var %
+     &     Interpolationshouldbemade = Interpolationshouldbemade
+      endif
+      Allocate(
+     & Agrif_Curgrid%tabvars(tabvarsindic)%var % oldvalues2D(1,2))
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % oldvalues2D = 0. 
+      endif
+C
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % bcinf = point(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % bcsup = point(2)
+C
+      End Subroutine Agrif_Set_bc
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_interp
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_interp(tabvarsindic,interp,interp1,interp2,
+     &                interp3)
+C
+CCC   Description:
+C
+C     Declarations:
+C      
+C     Arguments      
+C
+      INTEGER, OPTIONAL      :: interp,interp1,interp2,interp3
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+C     Begin 
+C
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % Typeinterp = 
+     &    Agrif_Constant
+      IF (present(interp)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % Typeinterp = 
+     &           interp
+      ENDIF
+      IF (present(interp1)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % Typeinterp(1) = 
+     &           interp1
+      ENDIF
+      IF (present(interp2)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % Typeinterp(2) = 
+     &           interp2
+      ENDIF
+      IF (present(interp3)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % Typeinterp(3) = 
+     &           interp3
+      ENDIF
+C
+      End Subroutine Agrif_Set_interp
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_bcinterp
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_bcinterp(tabvarsindic,interp,interp1,
+     &      interp2,interp3)
+C
+CCC   Description:
+
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C     Arguments      
+C
+      INTEGER, OPTIONAL      :: interp,interp1,interp2,interp3
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+C
+C     Begin 
+C
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % bctypeinterp = 
+     &           Agrif_Constant
+      IF (present(interp)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % bctypeinterp = 
+     &           interp
+      ENDIF
+      IF (present(interp1)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % bctypeinterp(1) = 
+     &           interp1
+      ENDIF
+      IF (present(interp2)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % bctypeinterp(2) = 
+     &           interp2
+      ENDIF
+      IF (present(interp3)) THEN
+      Agrif_Mygrid % tabvars(tabvarsindic)% var % bctypeinterp(3) = 
+     &           interp3
+      ENDIF
+C
+      End Subroutine Agrif_Set_bcinterp
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_Update
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_Update(tabvarsindic,point)
+C
+CCC   Description:
+CCC
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C     Arguments      
+C
+      INTEGER, DIMENSION(2) :: point
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+C
+C     Begin 
+C
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = point(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = point(2)
+C
+      End Subroutine Agrif_Set_Update
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_UpdateType
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_UpdateType(tabvarsindic,
+     &                                  update,update1,update2,
+     &                                  update3,update4,update5)
+C
+CCC   Description:
+
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C     Arguments      
+C
+      INTEGER, OPTIONAL           :: update, update1,
+     &       update2, update3,update4,update5
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+C
+C     Begin 
+C
+      Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate = 
+     &                   Agrif_Update_Copy
+      
+      IF (present(update)) THEN
+        Agrif_Mygrid % tabvars(tabvarsindic)% var % typeupdate = 
+     &           update
+      ENDIF
+      IF (present(update1)) THEN
+        Agrif_Mygrid % tabvars(tabvarsindic)% var % typeupdate(1) = 
+     &           update1
+      ENDIF  
+      IF (present(update2)) THEN
+        Agrif_Mygrid % tabvars(tabvarsindic)% var % typeupdate(2) = 
+     &           update2
+      ENDIF  
+      IF (present(update3)) THEN
+        Agrif_Mygrid % tabvars(tabvarsindic)% var % typeupdate(3) = 
+     &           update3
+      ENDIF 
+      IF (present(update4)) THEN
+        Agrif_Mygrid % tabvars(tabvarsindic)% var % typeupdate(4) = 
+     &           update4
+      ENDIF       
+      IF (present(update5)) THEN
+        Agrif_Mygrid % tabvars(tabvarsindic)% var % typeupdate(5) = 
+     &           update5
+      ENDIF                  
+C
+      End Subroutine Agrif_Set_UpdateType           
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Set_restore
+C     **************************************************************************
+C 
+      Subroutine Agrif_Set_restore(tabvarsindic)
+C
+CCC   Description:
+CCC   
+C
+C     Modules used:
+C      
+
+C
+C     Declarations:
+C      
+C     Arguments      
+C
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+C     Begin 
+C
+C
+      Agrif_Mygrid%tabvars(tabvarsindic)%var % restaure = .TRUE.
+C
+      End Subroutine Agrif_Set_restore
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Init_variable0d
+C     **************************************************************************
+      Subroutine Agrif_Init_variable0d(tabvarsindic0,tabvarsindic)
+
+      INTEGER :: tabvarsindic0 ! indice of the variable in tabvars
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C      
+      CALL Agrif_Interp_variable(tabvarsindic0,tabvarsindic)
+      CALL Agrif_Bc_variable(tabvarsindic0,tabvarsindic,1.)
+
+      End Subroutine Agrif_Init_variable0d
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Init_variable1d
+C     **************************************************************************
+      Subroutine Agrif_Init_variable1d(q,tabvarsindic)
+
+      REAL, DIMENSION(:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C
+      CALL Agrif_Interp_variable(q,tabvarsindic)
+      CALL Agrif_Bc_variable(q,tabvarsindic,1.)
+
+      End Subroutine Agrif_Init_variable1d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Init_variable2d
+C     **************************************************************************
+      Subroutine Agrif_Init_variable2d(q,tabvarsindic)
+
+      REAL,  DIMENSION(:,:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C
+      CALL Agrif_Interp_variable(q,tabvarsindic)
+      CALL Agrif_Bc_variable(q,tabvarsindic,1.)
+
+      End Subroutine Agrif_Init_variable2d
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Init_variable3d
+C     **************************************************************************
+      Subroutine Agrif_Init_variable3d(q,tabvarsindic)
+
+      REAL,  DIMENSION(:,:,:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C
+      CALL Agrif_Interp_variable(q,tabvarsindic)
+      CALL Agrif_Bc_variable(q,tabvarsindic,1.)
+C
+      End Subroutine Agrif_Init_variable3d
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Bc_variable0d
+C     **************************************************************************
+      Subroutine Agrif_Bc_variable0d(tabvarsindic0,tabvarsindic,
+     &                               calledweight,procname)
+
+      INTEGER :: tabvarsindic0 ! indice of the variable in tabvars
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C        
+      External :: procname
+      Optional ::  procname
+      REAL, OPTIONAL :: calledweight
+      REAL    :: weight
+      LOGICAL :: pweight
+C
+      INTEGER :: dimensio      
+
+      if (Agrif_Root()) Return
+C
+      dimensio =  Agrif_Mygrid % tabvars(tabvarsindic) % var % nbdim    
+C
+      if ( PRESENT(calledweight) ) then
+        weight=calledweight      
+        pweight = .TRUE.
+      else
+        weight = 0.
+        pweight = .FALSE.
+      endif
+C      
+C
+
+      
+      if ( dimensio .EQ. 1 ) Call Agrif_Interp_Bc_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array1,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,
+     & pweight)
+C
+      if ( dimensio .EQ. 2 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array2,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)
+      ELSE
+      Call Agrif_Interp_Bc_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array2,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+      endif
+C
+      if ( dimensio .EQ. 3 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array3,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)      
+      ELSE
+      Call Agrif_Interp_Bc_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array3,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+      endif
+C
+      if ( dimensio .EQ. 4 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array4,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)      
+      ELSE
+      Call Agrif_Interp_Bc_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array4,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+      endif
+C
+      if ( dimensio .EQ. 5 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array5,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)      
+      ELSE
+      Call Agrif_Interp_Bc_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array5,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+      endif
+C
+      if ( dimensio .EQ. 6 ) Call Agrif_Interp_Bc_6D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) %var % array6,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,
+     & pweight)
+C
+C
+      End Subroutine Agrif_Bc_variable0d
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Bc_variable1d
+C     **************************************************************************
+      Subroutine Agrif_Bc_variable1d(q,tabvarsindic,calledweight)
+
+      REAL   , DIMENSION(:)          :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C        
+      REAL, OPTIONAL :: calledweight
+      REAL    :: weight
+      LOGICAL :: pweight
+C
+      if ( PRESENT(calledweight) ) then
+        weight=calledweight      
+        pweight = .TRUE.
+      else
+        weight = 0.
+        pweight = .FALSE.
+      endif
+C      
+C
+      if (Agrif_Root()) Return
+      
+      Call Agrif_Interp_Bc_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,
+     & pweight)
+      End Subroutine Agrif_Bc_variable1d
+C
+C
+CC
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Bc_variable2d
+C     **************************************************************************
+      Subroutine Agrif_Bc_variable2d(q,tabvarsindic,calledweight,
+     &                                 procname)
+
+      REAL   , DIMENSION(:,:)          :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C        
+      REAL, OPTIONAL :: calledweight
+      REAL    :: weight
+      LOGICAL :: pweight
+C
+      if ( PRESENT(calledweight) ) then
+        weight=calledweight
+        pweight = .TRUE.
+      else
+        weight = 0.
+        pweight = .FALSE.
+      endif
+C      
+C
+
+      if (Agrif_Root()) Return
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)      
+      ELSE
+       Call Agrif_Interp_Bc_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+
+      End Subroutine Agrif_Bc_variable2d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Bc_variable3d
+C     **************************************************************************
+      Subroutine Agrif_Bc_variable3d(q,tabvarsindic,calledweight,
+     &                               procname)
+
+      REAL   , Dimension(:,:,:)          :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C        
+      REAL, OPTIONAL :: calledweight
+      REAL    :: weight
+      LOGICAL :: pweight
+C
+      if ( PRESENT(calledweight) ) then
+        weight=calledweight      
+        pweight = .TRUE.
+      else
+        weight = 0.
+        pweight = .FALSE.
+      endif
+C      
+C      
+      If (Agrif_Root()) Return
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)      
+      ELSE
+      Call Agrif_Interp_Bc_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+      End Subroutine Agrif_Bc_variable3d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Bc_variable4d
+C     **************************************************************************
+      Subroutine Agrif_Bc_variable4d(q,tabvarsindic,calledweight,
+     &                               procname)
+
+      REAL   , Dimension(:,:,:,:)          :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C        
+      REAL, OPTIONAL :: calledweight
+      REAL    :: weight
+      LOGICAL :: pweight
+C
+      if ( PRESENT(calledweight) ) then
+        weight=calledweight      
+        pweight = .TRUE.
+      else
+        weight = 0.
+        pweight = .FALSE.
+      endif
+C      
+C      
+      If (Agrif_Root()) Return
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)      
+      ELSE
+      Call Agrif_Interp_Bc_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+      End Subroutine Agrif_Bc_variable4d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Bc_variable5d
+C     **************************************************************************
+      Subroutine Agrif_Bc_variable5d(q,tabvarsindic,calledweight,
+     &                              procname)
+
+      REAL   , Dimension(:,:,:,:,:)          :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C        
+      REAL, OPTIONAL :: calledweight
+      REAL    :: weight
+      LOGICAL :: pweight
+C
+      if ( PRESENT(calledweight) ) then
+        weight=calledweight      
+        pweight = .TRUE.
+      else
+        weight = 0.
+        pweight = .FALSE.
+      endif
+C      
+C      
+      If (Agrif_Root()) Return
+      IF (present(procname)) THEN
+      Call Agrif_Interp_Bc_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight,procname)      
+      ELSE
+      Call Agrif_Interp_Bc_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % bctypeinterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % bcsup,
+     & weight,pweight)
+      ENDIF
+      End Subroutine Agrif_Bc_variable5d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_var0D
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_var0d(tabvarsindic0,tabvarsindic)
+
+      INTEGER :: tabvarsindic0 ! indice of the variable in tabvars
+      INTEGER :: tabvarsindic  ! indice of the variable in tabvars
+      INTEGER :: dimensio  ! indice of the variable in tabvars
+C      
+      if (Agrif_Root()) Return
+C     
+      dimensio = Agrif_Mygrid % tabvars(tabvarsindic) % var % nbdim 
+C
+      if ( dimensio .EQ. 1 )
+     & Call Agrif_Interp_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array1 ,     
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+C
+      if ( dimensio .EQ. 2 )
+     & Call Agrif_Interp_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array2 ,     
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+C
+      if ( dimensio .EQ. 3 )
+     & Call Agrif_Interp_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array3 ,     
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+C
+      if ( dimensio .EQ. 4 )
+     & Call Agrif_Interp_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array4 ,     
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+C
+      if ( dimensio .EQ. 5 )
+     & Call Agrif_Interp_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array5 ,     
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+C
+      if ( dimensio .EQ. 6 )
+     & Call Agrif_Interp_6D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array6 ,     
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+C
+      Return
+      End Subroutine Agrif_Interp_var0d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_var1d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_var1d(q,tabvarsindic)
+
+      REAL, DIMENSION(:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C      
+      Call Agrif_Interp_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+
+      Return
+      End Subroutine Agrif_Interp_var1d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_var2d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_var2d(q,tabvarsindic)
+
+      REAL,  DIMENSION(:,:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+       if (Agrif_Root()) Return
+C
+       Call Agrif_Interp_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+
+      Return
+      End Subroutine Agrif_Interp_var2d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_var3d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_var3d(q,tabvarsindic)
+
+      REAL,  DIMENSION(:,:,:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C
+      Call Agrif_Interp_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+
+      Return
+      End Subroutine Agrif_Interp_var3d
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_var4d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_var4d(q,tabvarsindic)
+
+      REAL,  DIMENSION(:,:,:,:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C
+      Call Agrif_Interp_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+
+      Return
+      End Subroutine Agrif_Interp_var4d     
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_var5d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_var5d(q,tabvarsindic)
+
+      REAL,  DIMENSION(:,:,:,:,:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      if (Agrif_Root()) Return
+C
+      Call Agrif_Interp_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var %  TypeInterp,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % restaure,
+     & Agrif_Mygrid % tabvars(tabvarsindic) %var % nbdim)
+
+      Return
+      End Subroutine Agrif_Interp_var5d       
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_update_var0d
+C     **************************************************************************
+C 
+      Subroutine Agrif_update_var0d(tabvarsindic0,tabvarsindic,
+     &                              locupdate,procname)
+
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+      INTEGER :: tabvarsindic0 ! indice of the variable in tabvars
+      External :: procname
+      Optional ::  procname      
+      INTEGER :: dimensio
+      INTEGER, DIMENSION(2), OPTIONAL :: locupdate
+C
+      dimensio = Agrif_Mygrid % tabvars(tabvarsindic) % var % nbdim 
+C      
+      if (Agrif_Root()) Return
+C     
+      IF (present(locupdate)) THEN
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = locupdate(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = locupdate(2)
+      ELSE
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = -99
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = -99
+      ENDIF
+ 
+      if ( dimensio .EQ. 1 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Update_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array1 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array1 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+      endif
+      if ( dimensio .EQ. 2 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Update_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array2 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array2 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+      endif
+      if ( dimensio .EQ. 3 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Update_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array3 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array3 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+      endif
+      if ( dimensio .EQ. 4 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Update_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array4 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array4 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+      endif
+      if ( dimensio .EQ. 5 ) then
+      IF (present(procname)) THEN
+      Call Agrif_Update_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array5 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic0) % var % array5 ,     
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+      endif
+
+      Return
+      End Subroutine Agrif_update_var0d
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_update_var1d
+C     **************************************************************************
+C 
+      Subroutine Agrif_update_var1d(q,tabvarsindic,locupdate,procname)
+
+      REAL,  DIMENSION(:) :: q
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+      External :: procname
+      Optional ::  procname      
+      INTEGER, DIMENSION(2), OPTIONAL :: locupdate
+C      
+      if (Agrif_Root()) Return
+C     
+      IF (present(locupdate)) THEN
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = locupdate(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = locupdate(2)
+      ELSE
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = -99
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = -99
+      ENDIF
+ 
+      IF (present(procname)) THEN
+      Call Agrif_Update_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_1D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+
+      Return
+      End Subroutine Agrif_update_var1d
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_update_var2d
+C     **************************************************************************
+C 
+      Subroutine Agrif_update_var2d(q,tabvarsindic,locupdate,procname)
+
+      REAL,  DIMENSION(:,:) :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER, DIMENSION(2), OPTIONAL :: locupdate 
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C      
+      IF (Agrif_Root()) RETURN
+C 
+      IF (present(locupdate)) THEN
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = locupdate(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = locupdate(2)
+      ELSE
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = -99
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = -99
+      ENDIF
+ 
+      IF (present(procname)) THEN
+      Call Agrif_Update_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_2D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+
+      Return
+      End Subroutine Agrif_update_var2d
+C 
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_update_var3d
+C     **************************************************************************
+C 
+      Subroutine Agrif_update_var3d(q,tabvarsindic,locupdate,procname)
+
+      REAL,  DIMENSION(:,:,:) :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER, DIMENSION(2), OPTIONAL :: locupdate
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C      
+      IF (Agrif_Root()) RETURN
+C      
+
+      IF (present(locupdate)) THEN
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = locupdate(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = locupdate(2)
+      ELSE
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = -99
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = -99
+      ENDIF
+
+      IF (present(procname)) THEN
+      Call Agrif_Update_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_3D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+
+      Return
+      End Subroutine Agrif_update_var3d
+C 
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_update_var4d
+C     **************************************************************************
+C 
+      Subroutine Agrif_update_var4d(q,tabvarsindic,locupdate,procname)
+
+      REAL,  DIMENSION(:,:,:,:) :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER, DIMENSION(2), OPTIONAL :: locupdate
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C      
+      IF (Agrif_Root()) RETURN
+C      
+      IF (present(locupdate)) THEN
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = locupdate(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = locupdate(2)
+      ELSE
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = -99
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = -99
+      ENDIF
+
+      IF (present(procname)) THEN
+      Call Agrif_Update_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_4D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+
+      Return
+      End Subroutine Agrif_update_var4d  
+C 
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_update_var5d
+C     **************************************************************************
+C 
+      Subroutine Agrif_update_var5d(q,tabvarsindic,locupdate,procname)
+
+      REAL,  DIMENSION(:,:,:,:,:) :: q
+      External :: procname
+      Optional ::  procname
+      INTEGER, DIMENSION(2), OPTIONAL :: locupdate
+      INTEGER :: tabvarsindic ! indice of the variable in tabvars
+C
+      IF (Agrif_Root()) RETURN
+C      
+      IF (present(locupdate)) THEN
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = locupdate(1)
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = locupdate(2)
+      ELSE
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updateinf = -99
+      Agrif_Curgrid%tabvars(tabvarsindic)%var % updatesup = -99
+      ENDIF
+
+      IF (present(procname)) THEN
+      Call Agrif_Update_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup,
+     & procname)
+      ELSE
+      Call Agrif_Update_5D(
+     & Agrif_Mygrid % tabvars(tabvarsindic) % var % typeupdate,
+     & Agrif_Curgrid % parent % tabvars(tabvarsindic),
+     & Agrif_Curgrid % tabvars(tabvarsindic),q,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updateinf,
+     & Agrif_Curgrid % tabvars(tabvarsindic) % var % updatesup)      
+      ENDIF
+
+      Return
+      End Subroutine Agrif_update_var5d          
+C
+      End module Agrif_bcfunction
Index: /trunk/AGRIF/AGRIF_FILES/modcluster.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modcluster.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modcluster.F	(revision 396)
@@ -0,0 +1,1443 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module AGRIF_Clustering  
+C
+C
+      Module Agrif_Clustering 
+C
+CCC   Description:
+CCC   Module to create and initialize the grid hierarchy from the 
+CCC   AGRIF_FixedGrids.in file.
+C
+C     Modules used:
+C  
+      Use Agrif_Curgridfunctions 
+      Use Agrif_Init_Vars
+      Use Agrif_Save
+C             
+      IMPLICIT NONE
+C        
+      Contains 
+C     Define procedures contained in this module
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Cluster_All  
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_Cluster_All(g,coarsegrid)
+C
+CCC   Description:
+CCC   Subroutine for the clustering. A temporary grid hierarchy, pointed by 
+CCC   coarsegrid, is created.
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+C     Pointer arguments    
+      TYPE(AGRIF_grid)     ,pointer   :: g        ! Pointer on the current grid
+      TYPE(AGRIF_rectangle),pointer   :: coarsegrid
+C      
+C     Local pointer         
+      TYPE(AGRIF_lrectangle),pointer  :: parcours 
+      TYPE(AGRIF_grid)      ,pointer  :: newgrid 
+      REAL                            :: g_eps
+      INTEGER                         :: iii
+C      
+      g_eps = huge(1.)
+      do iii = 1 , Agrif_Probdim
+         g_eps = min(g_eps,g%Agrif_d(iii))
+      enddo
+C
+      g_eps = g_eps/100.                  
+C
+C     Necessary condition for clustering 
+      do iii = 1 , Agrif_Probdim
+         if (g%Agrif_d(iii)/Agrif_coeffref(iii).LT.
+     &                   (Agrif_mind(iii)-g_eps)) Return
+      enddo
+C
+      Nullify(coarsegrid%childgrids)
+C
+      Call Agrif_ClusterGridnD(g,coarsegrid) 
+C
+      parcours => coarsegrid % childgrids                   
+C      
+      do while (associated(parcours))
+C      
+C       Newgrid is created. It is a copy of a fine grid created previously by
+C          clustering.      
+        Allocate(newgrid)
+C      
+        Nullify(newgrid%child_grids)
+C
+        do iii = 1 , Agrif_Probdim
+           newgrid % nb(iii) = (parcours % r % imax(iii) - 
+     &                          parcours % r % imin(iii)) *
+     &                          Agrif_Coeffref(iii)
+C        
+           newgrid % Agrif_x(iii) = g%Agrif_x(iii) + 
+     &                         (parcours %r % imin(iii) -1) 
+     &                         *g%Agrif_d(iii)
+C 
+           newgrid % Agrif_d(iii) = g%Agrif_d(iii) / Agrif_Coeffref(iii)
+C
+        enddo
+C
+        if ( Agrif_Probdim .EQ. 1 ) then
+           allocate(newgrid%tabpoint1D(newgrid%nb(1)+1))
+           newgrid%tabpoint1D = 0
+        endif
+C
+        if ( Agrif_Probdim .EQ. 2 ) then
+           allocate(newgrid%tabpoint2D(newgrid%nb(1)+1,
+     &                                 newgrid%nb(2)+1))
+           newgrid%tabpoint2D = 0      
+        endif
+C
+        if ( Agrif_Probdim .EQ. 3 ) then
+           allocate(newgrid%tabpoint3D(newgrid%nb(1)+1,
+     &                                 newgrid%nb(2)+1,
+     &                                 newgrid%nb(3)+1))
+           newgrid%tabpoint3D = 0
+        endif
+C       Points detection on newgrid
+        Call Agrif_TabpointsnD(Agrif_mygrid,newgrid) 
+C
+C       Recursive call to Agrif_Cluster_All            
+        Call Agrif_Cluster_All (newgrid, parcours % r)       
+C
+        parcours => parcours % next 
+C      
+        if ( Agrif_Probdim .EQ. 1 ) Deallocate(newgrid%tabpoint1D)
+        if ( Agrif_Probdim .EQ. 2 ) Deallocate(newgrid%tabpoint2D)
+        if ( Agrif_Probdim .EQ. 3 ) Deallocate(newgrid%tabpoint3D)
+C
+        Deallocate(newgrid)   
+C
+      enddo
+C
+C      
+      End Subroutine Agrif_Cluster_All
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_TabpointsnD
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_TabpointsnD(g,newgrid)
+C
+CCC   Description:
+CCC   Copy on newgrid of points detected on the grid hierarchy pointed by g.   
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+C     Arguments
+      TYPE(Agrif_Grid),pointer   :: g,newgrid
+C
+C     Local variables      
+      TYPE(Agrif_Pgrid),pointer  :: parcours
+C
+      REAL                  :: g_eps,newgrid_eps,eps
+      REAL   , DIMENSION(3) :: newmin,newmax
+      REAL   , DIMENSION(3) :: gmin,gmax
+      REAL   , DIMENSION(3) :: xmin
+      INTEGER, DIMENSION(3) :: igmin,inewmin
+      INTEGER, DIMENSION(3) :: inewmax
+      INTEGER               :: iii
+      INTEGER               :: i,j,k
+      INTEGER               :: i0,j0,k0
+C
+C     
+      parcours => g % child_grids
+C
+      do While(associated(parcours))
+        Call Agrif_TabpointsnD(parcours%gr,newgrid)
+        parcours => parcours % next
+      enddo      
+C
+      g_eps = 10.
+      newgrid_eps = 10.
+C      
+      do iii = 1 , Agrif_probdim
+         g_eps = min( g_eps , g % Agrif_d(iii) )
+         newgrid_eps = min(newgrid_eps,newgrid%Agrif_d(iii))
+      enddo
+C
+      eps = min(g_eps,newgrid_eps)/100.                  
+C                   
+      do iii = 1 , Agrif_probdim
+         if (newgrid%Agrif_d(iii) .LT. (g%Agrif_d(iii)-eps)) Return
+C                   
+         gmin(iii) = g%Agrif_x(iii)
+         gmax(iii) = g%Agrif_x(iii) + g%nb(iii) * g%Agrif_d(iii)
+C 
+         newmin(iii) = newgrid%Agrif_x(iii)
+         newmax(iii) = newgrid%Agrif_x(iii) + newgrid%nb(iii) *
+     &                 newgrid%Agrif_d(iii)
+C      
+         if (gmax(iii) .LT. newmin(iii)) Return
+C
+         if (gmin(iii) .GT. newmax(iii)) Return
+C           
+         inewmin(iii) = 1 - floor(-(max(gmin(iii),newmin(iii))-
+     &                    newmin(iii))
+     &                   /newgrid%Agrif_d(iii)) 
+C          
+         xmin(iii) = newgrid%Agrif_x(iii) + (inewmin(iii)-1)*
+     &              newgrid%Agrif_d(iii)          
+C        
+         igmin(iii) = 1 + nint((xmin(iii)-gmin(iii))/g%Agrif_d(iii))
+C
+         inewmax(iii) = 1 + int((min(gmax(iii),newmax(iii))-
+     &                  newmin(iii))/newgrid%Agrif_d(iii))
+      enddo
+C                
+      if ( Agrif_probdim .EQ. 1 ) then
+         i0 = igmin(1)
+         do i = inewmin(1),inewmax(1)
+            newgrid%tabpoint1D(i) = max(
+     &                           newgrid%tabpoint1D(i),
+     &                           g%tabpoint1D(i0))
+         enddo
+         i0 = i0 + int(newgrid%Agrif_d(1)/g%Agrif_d(1))
+      endif
+C
+      if ( Agrif_probdim .EQ. 2 ) then
+         i0 = igmin(1)
+         do i = inewmin(1),inewmax(1)
+            j0 = igmin(2)
+            do j = inewmin(2),inewmax(2)
+               newgrid%tabpoint2D(i,j) = max(
+     &                           newgrid%tabpoint2D(i,j),
+     &                           g%tabpoint2D(i0,j0))
+               j0 = j0 + int(newgrid%Agrif_d(2)/g%Agrif_d(2))
+            enddo
+            i0 = i0 + int(newgrid%Agrif_d(1)/g%Agrif_d(1))
+         enddo
+      endif
+C
+      if ( Agrif_probdim .EQ. 3 ) then
+         i0 = igmin(1)
+         do i = inewmin(1),inewmax(1)
+            j0 = igmin(2)
+            do j = inewmin(2),inewmax(2)
+               k0 = igmin(3)
+               do k = inewmin(3),inewmax(3)
+                  newgrid%tabpoint3D(i,j,k) = max(
+     &                           newgrid%tabpoint3D(i,j,k),
+     &                           g%tabpoint3D(i0,j0,k0))
+                  k0 = k0 + int(newgrid%Agrif_d(3)/g%Agrif_d(3))
+               enddo                                        
+               j0 = j0 + int(newgrid%Agrif_d(2)/g%Agrif_d(2))
+            enddo
+            i0 = i0 + int(newgrid%Agrif_d(1)/g%Agrif_d(1))
+         enddo
+      endif
+C
+      Return
+C
+C
+      End Subroutine Agrif_TabpointsnD
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_ClusterGridnD
+C     **************************************************************************
+C      
+      Subroutine Agrif_ClusterGridnD(g,coarsegrid)
+C
+CCC   Description:
+CCC   Clustering on the grid pointed by g.
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+C     Pointer arguments
+      TYPE(AGRIF_grid)     ,pointer  :: g          ! Pointer on the current grid
+      TYPE(AGRIF_rectangle),pointer  :: coarsegrid
+C
+C     Local variables      
+      TYPE(Agrif_rectangle) :: newrect
+      TYPE(Agrif_Variable)  :: newflag
+C
+      INTEGER               :: i,j,k
+      INTEGER ,DIMENSION(3) :: sx
+      INTEGER               :: bufferwidth,flagpoints
+      INTEGER               :: n1,n2,m1,m2,o1,o2
+      INTEGER               :: iii
+C
+C      
+      bufferwidth = int(Agrif_Minwidth/5.)
+C      
+      do iii = 1 , Agrif_probdim
+         sx(iii) = g % nb(iii) + 1
+      enddo
+C                  
+      if ( Agrif_probdim .EQ. 1 ) then
+         allocate(newflag%iarray1(sx(1)))
+         newflag%iarray1 = 0      
+      endif
+      if ( Agrif_probdim .EQ. 2 ) then
+         allocate(newflag%iarray2(sx(1),sx(2)))
+         newflag%iarray2 = 0      
+      endif
+      if ( Agrif_probdim .EQ. 3 ) then
+         allocate(newflag%iarray3(sx(1),sx(2),sx(3)))
+         newflag%iarray3 = 0      
+      endif
+C
+      flagpoints = 0 
+C      
+      if (bufferwidth>0) then 
+C      
+         if ( Agrif_probdim .EQ. 1 ) then
+            do i = bufferwidth,sx(1)-bufferwidth+1      
+               if (g % tabpoint1D(i) .EQ. 1) then
+                  m1 = i - bufferwidth + 1
+                  m2 = i + bufferwidth - 1                  
+                  flagpoints = flagpoints + 1
+                  newflag%iarray1(m1:m2)=1 
+               endif 
+            enddo    
+         endif
+C
+        if ( Agrif_probdim .EQ. 2 ) then
+           do i = bufferwidth,sx(1)-bufferwidth+1      
+               do j = bufferwidth,sx(2)-bufferwidth+1
+                  if (g % tabpoint2D(i,j) .EQ. 1) then
+                     n1 = j - bufferwidth + 1
+                     n2 = j + bufferwidth - 1
+                     m1 = i - bufferwidth + 1
+                     m2 = i + bufferwidth - 1                  
+                     flagpoints = flagpoints + 1
+                     newflag%iarray2(m1:m2,n1:n2)=1 
+                  endif  
+               enddo    
+            enddo
+         endif
+C
+        if ( Agrif_probdim .EQ. 3 ) then
+            do i = bufferwidth,sx(1)-bufferwidth+1      
+               do j = bufferwidth,sx(2)-bufferwidth+1
+                  do k = bufferwidth,sx(3)-bufferwidth+1
+                     if (g % tabpoint3D(i,j,k) .EQ. 1) then
+                        o1 = k - bufferwidth + 1
+                        o2 = k + bufferwidth - 1
+                        n1 = j - bufferwidth + 1
+                        n2 = j + bufferwidth - 1
+                        m1 = i - bufferwidth + 1
+                        m2 = i + bufferwidth - 1                  
+                        flagpoints = flagpoints + 1
+                        newflag%iarray3(m1:m2,n1:n2,o1:o2)=1 
+                     endif 
+                  enddo  
+               enddo    
+            enddo
+        endif
+      else
+          flagpoints = 1       
+C
+          if ( Agrif_probdim .EQ. 1 ) then
+          newflag%iarray1 = g % tabpoint1D
+          endif
+          if ( Agrif_probdim .EQ. 2 ) then
+          newflag%iarray2 = g % tabpoint2D
+          endif
+          if ( Agrif_probdim .EQ. 3 ) then
+          newflag%iarray3 = g % tabpoint3D
+          endif
+      endif
+C       
+      if (flagpoints .EQ. 0) then       
+          if ( Agrif_probdim .EQ. 1 ) deallocate(newflag%iarray1) 
+          if ( Agrif_probdim .EQ. 2 ) deallocate(newflag%iarray2) 
+          if ( Agrif_probdim .EQ. 3 ) deallocate(newflag%iarray3) 
+          Return 
+      endif       
+C      
+      do iii = 1 , Agrif_probdim
+         newrect % imin(iii) = 1
+         newrect % imax(iii) = sx(iii)
+      enddo
+C      
+      Call Agrif_Clusternd(newflag,
+     &                     coarsegrid%childgrids,newrect) 
+C      
+      if ( Agrif_probdim .EQ. 1 ) deallocate(newflag%iarray1)
+      if ( Agrif_probdim .EQ. 2 ) deallocate(newflag%iarray2)
+      if ( Agrif_probdim .EQ. 3 ) deallocate(newflag%iarray3)
+C  
+C    
+      End Subroutine Agrif_ClusterGridnD
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_ClusternD
+C     **************************************************************************
+C
+      Recursive subroutine Agrif_Clusternd(flag,boxlib,oldB) 
+C
+CCC   Description:
+CCC   Clustering on the grid pointed by oldB.
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+C     Arguments  
+      TYPE(Agrif_rectangle) ::  oldB    
+      TYPE(Agrif_Variable)  :: flag
+c      INTEGER,DIMENSION(oldB%imin(1):oldB%imax(1),
+c     &                  oldB%imin(2):oldB%imax(2)) :: flag
+      TYPE(Agrif_lrectangle),pointer :: boxlib      
+C
+C     Local variables      
+      TYPE(Agrif_lrectangle),pointer :: tempbox,parcbox,parcbox2       
+      TYPE(Agrif_rectangle) :: newB,newB2
+      INTEGER :: i,j,k,iii
+      INTEGER,DIMENSION(:),allocatable :: i_sig 
+      INTEGER,DIMENSION(:),allocatable :: j_sig       
+      INTEGER,DIMENSION(:),allocatable :: k_sig       
+      INTEGER,DIMENSION(3) :: ipu,ipl
+      INTEGER,DIMENSION(3) :: istr,islice
+      REAL :: cureff
+      REAL :: neweff
+      INTEGER :: ValMax,ValSum,TailleTab
+      INTEGER :: nbpoints,nbpointsflag  
+      LOGICAL :: test
+C          
+      allocate(i_sig(oldB%imin(1):oldB%imax(1)))
+      if ( Agrif_probdim .GE. 2 ) 
+     & allocate(j_sig(oldB%imin(2):oldB%imax(2)))
+      if ( Agrif_probdim .EQ. 3 ) 
+     & allocate(k_sig(oldB%imin(3):oldB%imax(3)))
+C
+      test = .FALSE.
+      do iii = 1 , Agrif_probdim
+         test = test .OR. ( (oldB%imax(iii)-oldB%imin(iii)+1) 
+     &                    .LT. Agrif_Minwidth)
+      enddo
+      if ( test ) Return
+C     
+      if ( Agrif_probdim .EQ. 1 ) i_sig = flag%iarray1
+      if ( Agrif_probdim .EQ. 2 ) then
+         do i = oldB%imin(1),oldB%imax(1)
+           i_sig(i) = SUM(flag%iarray2(i,
+     &                            oldB%imin(2):oldB%imax(2)))
+         enddo
+         do j = oldB%imin(2),oldB%imax(2)
+           j_sig(j) = SUM(flag%iarray2(
+     &                            oldB%imin(1):oldB%imax(1),j))
+         enddo      
+      endif
+      if ( Agrif_probdim .EQ. 3 ) then
+         do i = oldB%imin(1),oldB%imax(1)
+            i_sig(i) = SUM(flag%iarray3(i,
+     &                            oldB%imin(2):oldB%imax(2),
+     &                            oldB%imin(3):oldB%imax(3)))
+         enddo
+         do j = oldB%imin(2),oldB%imax(2)
+            j_sig(j) = SUM(flag%iarray3(
+     &                          oldB%imin(1):oldB%imax(1),j,
+     &                          oldB%imin(3):oldB%imax(3)))
+         enddo
+         do k = oldB%imin(3),oldB%imax(3)
+            k_sig(k) = SUM(flag%iarray3(
+     &                          oldB%imin(1):oldB%imax(1),
+     &                          oldB%imin(2):oldB%imax(2),k))
+         enddo      
+      endif
+C                    
+      do iii = 1 , Agrif_probdim
+         ipl(iii) = oldB%imin(iii)
+         ipu(iii) = oldB%imax(iii)
+      enddo
+C           
+      Call Agrif_Clusterprune(i_sig,ipl(1),ipu(1)) 
+      if ( Agrif_probdim .GE. 2 ) 
+     &   Call Agrif_Clusterprune(j_sig,ipl(2),ipu(2))      
+      if ( Agrif_probdim .EQ. 3 ) 
+     &   Call Agrif_Clusterprune(k_sig,ipl(3),ipu(3))      
+C     
+      test = .TRUE.
+      do iii = 1 , Agrif_probdim
+         test = test .AND. (ipl(iii).EQ.oldB%imin(iii))
+         test = test .AND. (ipu(iii).EQ.oldB%imax(iii))
+      enddo
+      
+      if (.NOT. test) then 
+          do iii = 1 , Agrif_probdim
+             newB%imin(iii) = ipl(iii)
+             newB%imax(iii) = ipu(iii)
+          enddo
+C        
+          if ( Agrif_probdim .EQ. 1 ) 
+     &       nbpoints = SUM(flag%iarray1(newB%imin(1):newB%imax(1)))   
+          if ( Agrif_probdim .EQ. 2 ) 
+     &       nbpoints = SUM(flag%iarray2(newB%imin(1):newB%imax(1),
+     &                           newB%imin(2):newB%imax(2)))   
+          if ( Agrif_probdim .EQ. 3 ) 
+     &       nbpoints = SUM(flag%iarray3(newB%imin(1):newB%imax(1),
+     &                           newB%imin(2):newB%imax(2),   
+     &                           newB%imin(3):newB%imax(3)))
+C   
+          if ( Agrif_probdim .EQ. 1 ) 
+     &       TailleTab = newB%imax(1)-newB%imin(1)+1
+          if ( Agrif_probdim .EQ. 2 ) 
+     &       TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                   (newB%imax(2)-newB%imin(2)+1)
+          if ( Agrif_probdim .EQ. 3 ) 
+     &       TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                   (newB%imax(2)-newB%imin(2)+1)*
+     &                   (newB%imax(3)-newB%imin(3)+1)
+C
+          neweff = REAL(nbpoints)/TailleTab
+C     
+          if (nbpoints.GT.0) then
+C        
+              if ((neweff .GT .Agrif_efficiency)) then
+                  Call Agrif_Add_Rectangle(newB,boxlib)
+                  Return
+              else
+C            
+                  tempbox => boxlib
+                  newB2 = newB
+                  Call Agrif_Clusternd(flag,
+     &                      boxlib,newB)
+C     
+C                 Compute new efficiency
+C
+                  cureff = neweff
+                  parcbox2 => boxlib
+                  nbpoints = 0
+                  nbpointsflag = 0
+C
+                  do While (associated(parcbox2))
+                    if (associated(parcbox2,tempbox)) Exit
+                    newB = parcbox2%r
+C
+                    if ( Agrif_probdim .EQ. 1 ) Valsum = 
+     &                                 SUM(flag%iarray1(
+     &                                 newB%imin(1):newB%imax(1)))
+                    if ( Agrif_probdim .EQ. 2 ) Valsum = 
+     &                                 SUM(flag%iarray2(
+     &                                 newB%imin(1):newB%imax(1),
+     &                                 newB%imin(2):newB%imax(2)))
+                    if ( Agrif_probdim .EQ. 3 ) Valsum = 
+     &                                 SUM(flag%iarray3(
+     &                                 newB%imin(1):newB%imax(1),
+     &                                 newB%imin(2):newB%imax(2),
+     &                                 newB%imin(3):newB%imax(3)))
+C
+                    nbpointsflag = nbpointsflag + ValSum
+                    if ( Agrif_probdim .EQ. 1 ) 
+     &                 TailleTab = newB%imax(1)-newB%imin(1)+1
+                    if ( Agrif_probdim .EQ. 2 ) 
+     &                 TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                             (newB%imax(2)-newB%imin(2)+1)
+                    if ( Agrif_probdim .EQ. 3 ) 
+     &                 TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                             (newB%imax(2)-newB%imin(2)+1)*
+     &                             (newB%imax(3)-newB%imin(3)+1)
+                    nbpoints = nbpoints + TailleTab
+                    parcbox2 => parcbox2%next  
+                  enddo  
+C coefficient 1.05 avant 1.15 possibilité de laisser choix à l utilisateur
+                  if  (REAL(nbpointsflag)/REAL(nbpoints)
+     &                 .LT.(1.05*cureff)) then
+                      parcbox2 => boxlib            
+                      do While (associated(parcbox2))
+                        if (associated(parcbox2,tempbox)) Exit
+                        deallocate(parcbox2%r)
+                        parcbox2 => parcbox2%next             
+                      enddo      
+                      boxlib => tempbox
+                      Call Agrif_Add_Rectangle(newB2,boxlib)
+                      Return
+                  endif
+              endif         
+          endif
+          Return
+      endif 
+C       
+      do iii = 1 , Agrif_Probdim
+         istr(iii) = oldB%imax(iii)
+         islice(iii) = oldB%imin(iii)
+      enddo     
+C      
+      Call Agrif_Clusterslice(i_sig,islice(1),istr(1)) 
+      if ( Agrif_probdim .GE. 2 ) 
+     & Call Agrif_Clusterslice(j_sig,islice(2),istr(2)) 
+      if ( Agrif_probdim .EQ. 3 ) 
+     & Call Agrif_Clusterslice(k_sig,islice(3),istr(3)) 
+C      
+      ValSum = 0
+      do iii = 1 , Agrif_Probdim
+         Valsum = valSum + islice(iii)
+      enddo
+C      
+      if ( Valsum .EQ. -Agrif_Probdim ) then 
+          Call Agrif_Add_Rectangle(oldB,boxlib) 
+          Return 
+      endif 
+C       
+      nullify(tempbox)
+      tempbox => boxlib
+      if ( Agrif_probdim .EQ. 1 ) 
+     &      cureff  = oldB%imax(1)-oldB%imin(1)+1
+      if ( Agrif_probdim .EQ. 2 ) 
+     &      cureff  = (oldB%imax(1)-oldB%imin(1)+1)*
+     &                (oldB%imax(2)-oldB%imin(2)+1)
+      if ( Agrif_probdim .EQ. 3 ) 
+     &       cureff = (oldB%imax(1)-oldB%imin(1)+1)*
+     &                (oldB%imax(2)-oldB%imin(2)+1)*
+     &                (oldB%imax(3)-oldB%imin(3)+1)
+      Nullify(parcbox)
+C 
+      do iii = 1 , Agrif_Probdim
+          newB%imax(iii) = oldB%imax(iii)            
+          newB%imin(iii) = oldB%imin(iii)
+      enddo     
+C
+      ValMax = 0
+      do iii = 1 , Agrif_Probdim
+         ValMax = Max(ValMax,istr(iii))
+      enddo
+C
+      if (istr(1) .EQ. ValMax ) then
+          newB%imax(1) = islice(1)
+          Call Agrif_Add_Rectangle(newB,parcbox)                   
+          newB%imin(1) = islice(1)+1
+          newB%imax(1) = oldB%imax(1)
+          Call Agrif_Add_Rectangle(newB,parcbox)
+      elseif ( Agrif_probdim .GE. 2 ) then
+         if (istr(2) .EQ. ValMax ) then
+            newB%imax(2) = islice(2)
+            Call Agrif_Add_Rectangle(newB,parcbox)
+            newB%imin(2) = islice(2)+1
+            newB%imax(2) = oldB%imax(2)
+            Call Agrif_Add_Rectangle(newB,parcbox)
+         elseif ( Agrif_probdim .EQ. 3 ) then
+            newB%imax(3) = islice(3)
+            Call Agrif_Add_Rectangle(newB,parcbox)
+            newB%imin(3) = islice(3)+1
+            newB%imax(3) = oldB%imax(3)
+            Call Agrif_Add_Rectangle(newB,parcbox)
+         endif
+      endif
+C      
+      do While (associated(parcbox))
+        newB = parcbox%r            
+C
+        if ( Agrif_probdim .EQ. 1 ) nbpoints = 
+     &                                 SUM(flag%iarray1(
+     &                                 newB%imin(1):newB%imax(1)))
+        if ( Agrif_probdim .EQ. 2 ) nbpoints = 
+     &                                 SUM(flag%iarray2(
+     &                                 newB%imin(1):newB%imax(1),
+     &                                 newB%imin(2):newB%imax(2)))
+        if ( Agrif_probdim .EQ. 3 ) nbpoints = 
+     &                                 SUM(flag%iarray3(
+     &                                 newB%imin(1):newB%imax(1),
+     &                                 newB%imin(2):newB%imax(2),
+     &                                 newB%imin(3):newB%imax(3)))
+C      
+       if ( Agrif_probdim .EQ. 1 ) 
+     &                 TailleTab = newB%imax(1)-newB%imin(1)+1
+       if ( Agrif_probdim .EQ. 2 ) 
+     &                 TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                             (newB%imax(2)-newB%imin(2)+1)
+       if ( Agrif_probdim .EQ. 3 ) 
+     &                 TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                             (newB%imax(2)-newB%imin(2)+1)*
+     &                             (newB%imax(3)-newB%imin(3)+1)
+
+        neweff = REAL(nbpoints) / TailleTab
+C     
+        if (nbpoints .GT. 0) then
+C      
+            if ((neweff .GT .Agrif_efficiency)) then
+                Call Agrif_Add_Rectangle(newB,boxlib)
+            else
+                tempbox => boxlib
+                newB2 = newB
+                Call Agrif_Clusternd(flag,
+     &                      boxlib,newB)
+C
+C               Compute new efficiency
+C
+                cureff = neweff
+                parcbox2 => boxlib
+                nbpoints = 0
+                nbpointsflag = 0
+C
+                do While (associated(parcbox2))
+                  if (associated(parcbox2,tempbox)) Exit
+                  newB = parcbox2%r
+C
+                  if ( Agrif_probdim .EQ. 1 ) ValSum = 
+     &                                 SUM(flag%iarray1(
+     &                                 newB%imin(1):newB%imax(1)))
+                  if ( Agrif_probdim .EQ. 2 ) ValSum = 
+     &                                 SUM(flag%iarray2(
+     &                                 newB%imin(1):newB%imax(1),
+     &                                 newB%imin(2):newB%imax(2)))
+                  if ( Agrif_probdim .EQ. 3 ) ValSum = 
+     &                                 SUM(flag%iarray3(
+     &                                 newB%imin(1):newB%imax(1),
+     &                                 newB%imin(2):newB%imax(2),
+     &                                 newB%imin(3):newB%imax(3)))
+C
+                  nbpointsflag = nbpointsflag + ValSum
+C
+                    if ( Agrif_probdim .EQ. 1 ) 
+     &                 TailleTab = newB%imax(1)-newB%imin(1)+1
+                    if ( Agrif_probdim .EQ. 2 ) 
+     &                 TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                             (newB%imax(2)-newB%imin(2)+1)
+                    if ( Agrif_probdim .EQ. 3 ) 
+     &                 TailleTab = (newB%imax(1)-newB%imin(1)+1)*
+     &                             (newB%imax(2)-newB%imin(2)+1)*
+     &                             (newB%imax(3)-newB%imin(3)+1)
+
+                  nbpoints = nbpoints + TailleTab
+C              
+                  parcbox2 => parcbox2%next  
+                enddo   
+C            
+                if  (REAL(nbpointsflag)/REAL(nbpoints)
+     &               .LT.(1.15*cureff)) then
+                    parcbox2 => boxlib            
+                    do While (associated(parcbox2))
+                      if (associated(parcbox2,tempbox)) Exit
+                      deallocate(parcbox2%r)
+                      parcbox2 => parcbox2%next             
+                    enddo
+                    boxlib => tempbox
+                    Call Agrif_Add_Rectangle(newB2,boxlib)
+                endif
+            endif
+        endif
+        parcbox => parcbox%next
+      enddo
+C      
+C      
+      Return
+C      
+      End Subroutine Agrif_Clusternd 
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Clusterslice
+C     **************************************************************************
+C                           
+      Subroutine Agrif_Clusterslice(sig,slice,str) 
+C
+C
+CCC   Description:
+CCC   
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+C     Arguments 
+      INTEGER                      :: slice,str
+      INTEGER,DIMENSION(slice:str) :: sig 
+C
+C     Local variables      
+      INTEGER                      :: ideb,ifin
+      INTEGER                      :: i,t,a,di,ts 
+      INTEGER,DIMENSION(slice:str) :: lap 
+C
+C    
+      ideb = slice
+      ifin = str
+C    
+      if (SIZE(sig) <= 2*Agrif_Minwidth) then
+          str = -1 
+          slice = -1 
+          Return
+      endif
+C      
+      t = -1 
+      a = -1 
+C
+      do i = ideb+Agrif_Minwidth-1,ifin-Agrif_Minwidth
+          if (sig(i) .EQ. 0) then
+              if ((i-ideb) < (ifin-i)) then
+                  di = i - ideb
+                else 
+                  di = ifin - i 
+              endif
+C
+              if (di > t) then
+                a = i 
+                t = di 
+              endif
+         endif
+      enddo
+C      
+      if (a .NE. (-1)) then
+          slice = a 
+          str = t 
+          Return
+      endif
+C      
+      t = -1 
+      a = -1 
+C      
+      do i = ideb+1,ifin-1 
+        lap(i) = sig(i+1) + sig(i-1) - 2*sig(i) 
+      enddo
+C      
+      do i = ideb + Agrif_Minwidth-1,ifin-Agrif_Minwidth
+        if ((lap(i+1)*lap(i)) .LE. 0) then
+            ts = ABS(lap(i+1) - lap(i)) 
+            if (ts > t) then
+                t = ts 
+                a = i
+            endif
+       endif
+      enddo
+C      
+      if (a .EQ. (ideb + Agrif_Minwidth - 1)) then
+          a = -1
+          t = -1
+      endif
+C      
+      slice = a 
+      str = t 
+C
+C      
+      End Subroutine Agrif_Clusterslice       
+C
+C
+C    
+C     **************************************************************************
+CCC   Subroutine Agrif_Clusterprune
+C     **************************************************************************
+C      
+      Subroutine Agrif_Clusterprune(sig,pl,pu) 
+C
+C
+CCC   Description:
+CCC   
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+C     Arguments
+      INTEGER                  :: pl,pu 
+      INTEGER,DIMENSION(pl:pu) :: sig
+C
+C     Local variables      
+      INTEGER :: ideb,ifin       
+      INTEGER :: diff,addl,addu,udist,ldist  
+C
+C      
+      ideb = pl
+      ifin = pu
+C      
+      if (SIZE(sig) <= Agrif_Minwidth) then
+          return 
+      endif 
+C       
+      do While ((sig(pl) .EQ. 0) .AND. (pl < ifin)) 
+        pl = pl + 1 
+      enddo 
+C       
+      do While ((sig(pu) .EQ. 0) .AND. (pu > ideb)) 
+        pu = pu - 1 
+      enddo 
+C       
+      if ((pu-pl) < Agrif_Minwidth) then
+          diff = Agrif_Minwidth - (pu - pl + 1) 
+          udist = ifin - pu 
+          ldist = pl - ideb
+          addl = diff / 2 
+          addu = diff - addl 
+          if (addu > udist) then
+              addu = udist 
+              addl = diff - addu 
+          endif
+C         
+          if (addl > ldist) then
+              addl = ldist 
+              addu = diff - addl
+          endif
+C         
+          pu = pu + addu 
+          pl = pl - addl         
+C      
+      endif 
+C       
+C
+      End Subroutine Agrif_Clusterprune
+C
+C
+C              
+C     **************************************************************************
+CCC   Subroutine Agrif_Add_Rectangle 
+C     **************************************************************************
+C        
+      Subroutine Agrif_Add_Rectangle(R,LR)
+C
+CCC   Description:
+CCC   Subroutine to add the Agrif_Rectangle R in a list managed by LR.
+C
+C     Declarations:
+C
+C     Arguments               
+      TYPE(AGRIF_rectangle)           :: R  
+      TYPE(AGRIF_lrectangle), Pointer :: LR
+C
+C     Local variable        
+      TYPE(AGRIF_lrectangle), Pointer :: newrect  
+C
+      INTEGER                         :: iii 
+C
+C        
+      allocate(newrect)
+      allocate(newrect % r)
+C
+      newrect % r = R
+C      
+      do iii = 1 , Agrif_Probdim
+         newrect % r % spaceref(iii) = Agrif_Coeffref(iii)
+         newrect % r % timeref(iii) = Agrif_Coeffreft(iii)
+      enddo
+C              
+      newrect % r % number = -1            
+      Nullify(newrect % r % childgrids)
+      newrect % next => LR  
+      LR => newrect  
+C
+C      
+      End Subroutine Agrif_Add_Rectangle   
+C  
+C
+C  
+C     **************************************************************************
+CCC   Subroutine Agrif_Read_Fix_Grd  
+C     **************************************************************************
+C      
+      Recursive Subroutine Agrif_Read_Fix_Grd(coarsegrid,j,nunit)
+C
+CCC   Description:
+CCC   Subroutine to create the grid hierarchy from the reading of the 
+CCC   AGRIF_FixedGrids.in file.
+C
+CC    Method:
+CC    Recursive subroutine and creation of a first grid hierarchy from the
+CC    reading of the AGRIF_FixedGrids.in file.        
+C
+C     Declarations:
+C
+C     Pointer argument      
+      TYPE(AGRIF_rectangle), Pointer   :: coarsegrid ! Pointer on the first grid
+                                                     ! of the grid hierarchy
+C                                    
+C     Scalar arguments                                    
+      INTEGER                          :: j          ! Number of the new grid
+      INTEGER                          :: nunit      ! unit associated with file
+C      
+C     Local variables      
+      TYPE(AGRIF_rectangle)            :: newrect    ! Pointer on a new grid   
+      TYPE(AGRIF_lrectangle), Pointer  :: parcours   ! Pointer for the recursive
+                                                     !    procedure
+      TYPE(AGRIF_lrectangle), Pointer  :: newlrect
+      TYPE(AGRIF_lrectangle), Pointer  :: end_list       
+      INTEGER                          :: i          ! for each child grid
+      INTEGER                          :: nb_grids   ! Number of child grids
+      INTEGER                          :: iii
+C          
+C
+      Nullify(newrect%childgrids)
+C      
+C     Reading of the number of child grids        
+      read(nunit,*) nb_grids
+C      
+C     coarsegrid%nbgridchild = nb_grids
+C      
+      allocate(end_list)
+C
+      nullify(end_list % r)
+      nullify(end_list % next)
+C      
+      coarsegrid % childgrids => end_list
+C
+C     Reading of imin(1),imax(1),imin(2),imax(2),imin(3),imax(3), and space and
+C        time refinement factors for each child grid.
+C     Creation and addition of the new grid to the grid hierarchy. 
+C
+      do i = 1,nb_grids
+        allocate(newlrect)      
+        newrect % number = j   ! Number of the grid
+C
+        if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
+           if (Agrif_Probdim == 3) then  
+            read(nunit,*) newrect % imin(1), newrect % imax(1),
+     &                    newrect % imin(2), newrect % imax(2),
+     &                    newrect % imin(3), newrect % imax(3),
+     &                    newrect % spaceref(1),newrect % spaceref(2),
+     &                    newrect % spaceref(3),
+     &                    newrect % timeref(1),newrect % timeref(2),
+     &                    newrect % timeref(3)
+           elseif (Agrif_Probdim == 2) then            
+            read(nunit,*) newrect % imin(1),newrect % imax(1),
+     &                  newrect % imin(2),newrect % imax(2),
+     &                    newrect % spaceref(1),newrect % spaceref(2),
+     &                    newrect % timeref(1),newrect % timeref(2)
+           elseif (Agrif_Probdim == 1) then
+            read(nunit,*) newrect % imin(1), newrect % imax(1),
+     &                    newrect % spaceref(1),
+     &                    newrect % timeref(1)
+           endif
+        else
+           if (Agrif_Probdim == 3) then  
+            read(nunit,*) newrect % imin(1), newrect % imax(1),
+     &                    newrect % imin(2), newrect % imax(2),
+     &                    newrect % imin(3), newrect % imax(3),
+     &                    newrect % spaceref(1),newrect % spaceref(2),
+     &                    newrect % spaceref(3),
+     &                    newrect % timeref(1)
+           elseif (Agrif_Probdim == 2) then            
+            read(nunit,*) newrect % imin(1),newrect % imax(1),
+     &                  newrect % imin(2),newrect % imax(2),
+     &                    newrect % spaceref(1),newrect % spaceref(2),
+     &                    newrect % timeref(1)
+           elseif (Agrif_Probdim == 1) then
+            read(nunit,*) newrect % imin(1), newrect % imax(1),
+     &                    newrect % spaceref(1),
+     &                    newrect % timeref(1)
+           endif
+C
+           if ( Agrif_probdim .GE. 2 ) then
+              do iii = 2 , Agrif_probdim
+                 newrect % timeref(iii) = newrect % timeref(1) 
+              enddo
+           endif
+C
+        endif
+C
+C       Addition to the grid hierarchy
+C
+        nullify(newrect % childgrids)
+        j = j + 1
+        Allocate(newlrect%r)
+        newlrect % r = newrect 
+        nullify(newlrect % next)
+        end_list % next => newlrect
+        end_list => end_list % next
+      enddo
+C      
+      coarsegrid % childgrids => coarsegrid % childgrids % next
+      parcours => coarsegrid % childgrids
+C
+C     Recursive operation to create the grid hierarchy branch by branch
+C
+      do while (associated(parcours))
+        call Agrif_Read_Fix_Grd (parcours % r,j,nunit)
+        parcours => parcours % next
+      enddo
+C      
+C
+      End Subroutine Agrif_Read_Fix_Grd        
+C        
+C 
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Create_Grids  
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_Create_Grids(g,coarsegrid)
+C
+CCC   Description:
+CCC   Subroutine to create the grid hierarchy (g) from the one created with the
+CCC   Agrif_Read_Fix_Grd or Agrif_Cluster_All procedures (coarsegrid).
+C
+CC    Method:
+CC    Recursive subroutine.        
+C
+C     Declarations:
+C
+C     Pointer arguments        
+      TYPE(AGRIF_grid)     , Pointer  :: g          ! Pointer on the root coarse
+                                                    ! grid
+      TYPE(AGRIF_rectangle), Pointer  :: coarsegrid ! Pointer on the root coarse
+                                                    ! grid of the grid hierarchy
+                                                    ! created with the
+                                                    ! Agrif_Read_Fix_Grd
+                                                    ! subroutine
+C
+C     Local pointers
+      TYPE(Agrif_grid)      , Pointer :: newgrid    ! New grid
+      TYPE(Agrif_pgrid)     , Pointer :: newpgrid
+      TYPE(Agrif_pgrid)     , Pointer :: parcours2
+      TYPE(Agrif_lrectangle), Pointer :: parcours
+      TYPE(Agrif_pgrid)     , Pointer :: end_list
+      TYPE(Agrif_pgrid)     , Pointer :: parcours3
+C
+C     Local scalars      
+      LOGICAL                         :: nullliste
+      INTEGER                         :: iii
+      INTEGER                         :: moving_grid_id = 0      
+
+C
+      parcours3 => g % child_grids
+C     
+      if (associated(parcours3)) then
+          do While (associated(parcours3 % next))
+            parcours3 => parcours3 % next
+          enddo
+          end_list => parcours3
+          nullliste=.FALSE.
+        else
+          allocate(end_list)
+          nullify(end_list % gr)
+          nullify(end_list % next)      
+          g % child_grids => end_list 
+          parcours3 => end_list      
+          nullliste=.TRUE.
+      endif
+C      
+      parcours => coarsegrid % childgrids
+C      
+C     Creation of the grid hierarchy from the one created by using the 
+C     Agrif_Read_Fix_Grd subroutine 
+C
+      do while (associated(parcours))
+        allocate(newgrid)        
+        moving_grid_id=moving_grid_id+1
+        newgrid % grid_id = moving_grid_id
+        do iii = 1 , Agrif_Probdim
+           newgrid % spaceref(iii) = parcours % r % spaceref(iii)
+           newgrid % timeref(iii) = parcours % r % timeref(iii)
+        enddo
+C
+        do iii = 1 , Agrif_Probdim
+          newgrid % nb(iii) = (parcours % r % imax(iii) 
+     &                       - parcours % r % imin(iii)) 
+     &                       * parcours % r % spaceref(iii)
+C     
+          newgrid % ix(iii) =  parcours % r % imin(iii)
+C
+          newgrid % Agrif_d(iii) = g % Agrif_d(iii) 
+     &                  / REAL(newgrid % spaceref(iii))
+C
+          newgrid % Agrif_x(iii) = g % Agrif_x(iii) +
+     &      (parcours % r % imin(iii) - 1)* g % Agrif_d(iii)
+C      
+        enddo
+C
+C       Pointer on the parent grid                        
+C
+        newgrid % parent => g      
+C      
+C       Grid pointed by newgrid is a fixed grid      
+C
+        if (parcours % r % number .GT. 0) then      
+            newgrid % fixed = .true.  
+          else
+            newgrid % fixed = .false.
+        endif
+C
+C       Number of the grid pointed by newgrid
+        newgrid % fixedrank = parcours % r % number
+C           
+C       No time calculation on this grid         
+        newgrid % ngridstep = 0      
+C
+C       Test indicating if the current grid has a common border with the root 
+C       coarse grid in the x direction
+        do iii = 1 , Agrif_Probdim
+           newgrid % NearRootBorder(iii) = .FALSE.
+C        
+           if ((newgrid % parent % NearRootBorder(iii)) .AND. 
+     &         (newgrid % ix(iii) == 1)) then
+               newgrid % NearRootBorder(iii) = .TRUE.
+           endif
+C
+           newgrid % DistantRootBorder(iii) = .FALSE.
+C 
+           if ((newgrid % parent % DistantRootBorder(iii)) .AND. 
+     &         (newgrid % ix(iii) + 
+     &         (newgrid % nb(iii)/newgrid % spaceref(iii))  
+     &          - 1  == newgrid % parent % nb(iii))) then
+               newgrid % DistantRootBorder(iii) = .TRUE.
+           endif
+        enddo
+C
+C       Writing in output files
+C
+        newgrid % oldgrid = .FALSE.      
+C
+C     
+C       Definition of the CHARACTERistics of the variable of the grid pointed by
+C       newgrid 
+        Call Agrif_Create_Var (newgrid)
+C      
+C       Instanciation of the grid pointed by newgrid and its variables
+        Call Agrif_Instance (newgrid)
+C       
+C       Nullify the variable of the grid pointed by newgrid
+C
+C
+C       Addition of this grid to the grid hierarchy 
+C      
+        nullify(newgrid % child_grids)
+        allocate(newpgrid)  
+        newpgrid % gr => newgrid
+        nullify(newpgrid % next)
+        end_list % next => newpgrid
+        end_list => end_list % next               
+        parcours => parcours % next
+C
+C       Updating the total number of fixed grids
+        if (newgrid % fixed) then
+            AGRIF_nbfixedgrids = AGRIF_nbfixedgrids + 1
+        endif
+C                  
+      enddo
+C
+C
+      if (nullliste) then
+          g % child_grids => g % child_grids % next
+          parcours2 => g % child_grids
+          deallocate(parcours3)
+        else
+          parcours2 => parcours3 % next
+      endif
+C      
+      parcours => coarsegrid % childgrids
+C
+C     Recursive call to the subroutine Agrif_Create_Fixed_Grids to create the
+C     grid hierarchy
+C      
+      do while (associated(parcours))
+        Call Agrif_Create_Grids (parcours2 % gr,parcours % r)
+        parcours => parcours % next
+        parcours2 => parcours2 % next
+      enddo 
+C      
+      Return      
+C                  
+      End Subroutine Agrif_Create_Grids
+C
+C      
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Init_Hierarchy  
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_Init_Hierarchy(g) 
+C
+CCC   Description:
+CCC   Subroutine to initialize all the grids except the root coarse grid (this 
+CCC   one, pointed by AGRIF_mygrid, is initialized by the subroutine 
+CCC   Agrif_Init_Grids defi ned in the module Agrif_Util and called in the main 
+CCC   program ). 
+C
+CC    Method:
+CC    Recursive subroutine.        
+C
+C     Declarations:
+C
+C     Pointer argument      
+      TYPE(AGRIF_grid), Pointer  :: g         ! Pointer on the root coarse grid 
+C      
+C     Local variables      
+      TYPE(AGRIF_pgrid), Pointer :: parcours  ! Pointer for the recursive call
+      LOGICAL                    :: Init_Hierarchy
+C      
+C
+      parcours=>g%child_grids
+C      
+      do while (associated(parcours))
+        Init_Hierarchy = .false.
+        if ( AGRIF_USE_FIXED_GRIDS .EQ. 1 .OR. 
+     &       AGRIF_USE_ONLY_FIXED_GRIDS .EQ. 1 ) then
+           if ((parcours%gr%fixed) 
+     &         .AND. (Agrif_mygrid%ngridstep == 0)) then
+              Init_Hierarchy = .true.
+           endif      
+       endif
+C
+       if (.NOT. parcours%gr%fixed) Init_Hierarchy = .true.
+       if (parcours % gr % oldgrid) Init_Hierarchy = .false.
+C
+       if (Init_Hierarchy) then 
+C
+C           Instanciation of the grid pointed by parcours%gr and its variables 
+            Call Agrif_Instance (parcours % gr)
+C    
+C           Allocation of the arrays containing values of the variables of the
+C           grid pointed by parcours%gr      
+C      
+            Call Agrif_Allocation (parcours % gr)     
+C       
+            Call Agrif_Instance(parcours % gr)
+C
+            if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
+              Call Agrif_Allocate_Restore (parcours % gr)
+            endif
+C
+            if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
+C              Initialization by copy of the grids created by clustering 
+               Call AGRIF_CopyFromold_All (parcours%gr,
+     &                                     Agrif_oldmygrid)
+            endif
+C
+C           Initialization by interpolation 
+C           (this routine is written by the user) 
+            Call Agrif_InitValues()
+C
+            if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
+               Call Agrif_Free_Restore (parcours % gr)
+            endif
+C
+       endif                                  
+       parcours => parcours % next 
+C         
+      enddo
+C
+      parcours => g % child_grids
+C      
+C     Recursive operation to initialize all the grids
+      do while (associated(parcours))
+        Call Agrif_Init_Hierarchy (parcours%gr)
+        parcours => parcours%next
+      enddo
+C      
+      End Subroutine Agrif_Init_Hierarchy 
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Allocate_Restore  
+C     **************************************************************************
+C
+      Subroutine Agrif_Allocate_Restore(Agrif_Gr)
+C      
+C      
+C     Modules used:
+C
+      TYPE(AGRIF_grid), Pointer  :: Agrif_Gr   ! Pointer on the root coarse grid
+C     
+      INTEGER                    :: i
+C
+        do i = 1 , Agrif_NbVariables
+            if ( Agrif_Mygrid%tabvars(i)%var % restaure ) then
+            if ( Agrif_Gr%tabvars(i)%var % nbdim .EQ. 1 ) then    
+            Allocate( Agrif_Gr%tabvars(i)%var%  
+     &    Restore1D(lbound(Agrif_Gr%tabvars(i)%var%array1,1) 
+     &    :ubound(Agrif_Gr%tabvars(i)%var%array1,1))) 
+            Agrif_Gr%tabvars(i)%var%Restore1D = 0
+C
+            endif
+            if ( Agrif_Gr%tabvars(i)%var % nbdim .EQ. 2 ) then
+            Allocate( Agrif_Gr%tabvars(i)%var%Restore2D(  
+     &      lbound(Agrif_Gr%tabvars(i)%var%array2,1):         
+     &      ubound(Agrif_Gr%tabvars(i)%var%array2,1),         
+     &      lbound(Agrif_Gr%tabvars(i)%var%array2,2)          
+     &      :ubound(Agrif_Gr%tabvars(i)%var%array2,2)))         
+            Agrif_Gr%tabvars(i)%var%Restore2D = 0
+C
+            endif
+            if ( Agrif_Mygrid%tabvars(i)%var % nbdim .EQ. 3 ) then
+C     
+            Allocate( Agrif_Gr%tabvars(i)%var%Restore3D( 
+     &      lbound(Agrif_Gr%tabvars(i)%var%array3,1):        
+     &      ubound(Agrif_Gr%tabvars(i)%var%array3,1),        
+     &      lbound(Agrif_Gr%tabvars(i)%var%array3,2):        
+     &      ubound(Agrif_Gr%tabvars(i)%var%array3,2),        
+     &      lbound(Agrif_Gr%tabvars(i)%var%array3,3):        
+     &      ubound(Agrif_Gr%tabvars(i)%var%array3,3)))  
+            Agrif_Gr%tabvars(i)%var%Restore3D = 0
+            endif
+C 
+            endif
+          enddo
+C
+      Return
+C
+C      
+      End Subroutine Agrif_Allocate_Restore      
+C
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Free_Restore  
+C     **************************************************************************
+C
+      Subroutine Agrif_Free_Restore(Agrif_Gr)
+C
+C      
+C     Pointer argument      
+      TYPE(AGRIF_grid), Pointer  :: Agrif_Gr   ! Pointer on the root coarse grid
+      INTEGER :: i     
+C
+      do i = 1 , Agrif_NbVariables
+         if ( Agrif_Mygrid % tabvars(i) % var % restaure) then
+C  
+            if (associated(Agrif_Gr%tabvars(i)%var%Restore1D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%Restore1D)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%Restore2D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%Restore2D)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%Restore3D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%Restore3D)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%Restore4D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%Restore4D)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%Restore5D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%Restore5D)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%Restore6D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%Restore6D)
+            endif
+C 
+        endif
+      enddo
+C 
+      Return
+C
+C      
+      End Subroutine Agrif_Free_Restore
+C
+C
+C
+      End Module Agrif_Clustering
Index: /trunk/AGRIF/AGRIF_FILES/modcurgridfunctions.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modcurgridfunctions.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modcurgridfunctions.F	(revision 396)
@@ -0,0 +1,782 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place-  Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_CurgridFunctions      
+C      
+      Module Agrif_CurgridFunctions    
+C  
+CCC   Description:
+CCC   Module to define some procedures concerning the current grid
+C
+C     Modules used: 
+C
+      Use Agrif_Init
+C
+      IMPLICIT NONE
+C
+C
+      Contains
+C     Define procedures contained in this module
+C
+C     **************************************************************************
+CCC   Function Agrif_Rhot
+C     **************************************************************************
+C
+      Function Agrif_Rhot()
+C  
+CCC   Description:
+CCC   Function returning the time refinement factor of the current grid.
+C
+C     Declarations:
+C  
+      
+C
+      REAL :: Agrif_Rhot  ! Result
+C
+C     Local scalar      
+      INTEGER :: res         ! Intermediate result
+      INTEGER :: iii
+C
+C
+      res=1
+C
+      do iii = 1 , Agrif_Probdim
+         res = max(res, AGRIF_Curgrid % timeref(iii))
+      enddo
+C
+      Agrif_Rhot = float(res)
+C
+C
+      End function Agrif_rhot
+C
+C
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_IRhot
+C     **************************************************************************
+C
+      Function Agrif_IRhot()
+C  
+CCC   Description:
+CCC   Function returning the time refinement factor of the current grid.
+C
+C     Declarations:
+C  
+      
+C
+      INTEGER :: Agrif_IRhot  ! Result
+C
+C     Local scalar      
+      INTEGER :: res         ! Intermediate result
+      INTEGER :: iii
+C
+C
+      res=1
+C
+      do iii = 1 , Agrif_Probdim
+         res = max(res, AGRIF_Curgrid % timeref(iii))
+      enddo
+C
+      Agrif_IRhot = res
+C
+C
+      End function Agrif_IRhot
+C
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Parent_Rhot
+C     **************************************************************************
+C
+      Function Agrif_Parent_Rhot()
+C  
+CCC   Description:
+CCC   Function returning the time refinement factor of the parent grid of the 
+CCC   current grid.
+C
+C     Declarations:
+C  
+      
+C
+      REAL :: Agrif_Parent_Rhot  ! Result
+C
+C     Local scalar      
+      INTEGER :: res         ! Intermediate result
+      INTEGER :: iii
+C
+C
+      res=1
+C
+      do iii = 1 , Agrif_Probdim
+         res = max(res, AGRIF_Curgrid % parent % timeref(iii))
+      enddo
+C
+      Agrif_Parent_Rhot = float(res)
+C
+C
+      End function Agrif_Parent_Rhot      
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Parent_IRhot
+C     **************************************************************************
+C
+      Function Agrif_Parent_IRhot()
+C  
+CCC   Description:
+CCC   Function returning the time refinement factor of the parent grid of the 
+CCC   current grid.
+C
+C     Declarations:
+C  
+      
+C
+      INTEGER :: Agrif_Parent_IRhot  ! Result
+C
+C     Local scalar      
+      INTEGER :: res         ! Intermediate result
+      INTEGER :: iii
+C
+C
+      res=1
+C
+      do iii = 1 , Agrif_Probdim
+         res = max(res, AGRIF_Curgrid % parent % timeref(iii))
+      enddo
+C
+      Agrif_Parent_IRhot = res
+C
+C
+      End function Agrif_Parent_IRhot      
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Nbstepint
+C     **************************************************************************
+C
+      Function Agrif_Nbstepint()
+C  
+CCC   Description:
+CCC   Function for the calculation of the coefficients used for the time 
+CCC   interpolation (module Agrif_Boundary).
+C
+C     Declarations:
+C  
+      
+C            
+      INTEGER :: Agrif_nbstepint  ! result
+C
+C
+      Agrif_nbstepint = mod(AGRIF_CURGRID % ngridstep,
+     &                      int(AGRIF_rhot()))
+C
+C
+      End function Agrif_Nbstepint
+C
+C
+C
+CC    **************************************************************************
+CCC   Function Agrif_Parent_Nbstepint
+C     **************************************************************************
+C
+      Function Agrif_Parent_Nbstepint()
+C  
+CCC   Description:
+CCC   Function for the calculation of the coefficients used for the time 
+CCC   interpolation (module Agrif_Boundary).
+C
+C     Declarations:
+C  
+      
+C            
+      INTEGER :: Agrif_Parent_Nbstepint  ! result
+C
+C
+      Agrif_Parent_Nbstepint = mod(AGRIF_CURGRID % parent % ngridstep, 
+     &                             int(AGRIF_Parent_Rhot()))
+C
+C
+      End function Agrif_Parent_Nbstepint
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_InterpNearBorderX
+C     **************************************************************************
+C
+      Subroutine Agrif_InterpNearBorderX()
+C  
+CCC   Description:
+CCC   Subroutine allowing to interpole (in the x direction) on a near border of 
+CCC   the current grid if this one has a common border with the root coarse 
+CCC   grid.   
+C
+C     Declarations:
+C  
+      
+C
+C
+      AGRIF_CURGRID % NearRootBorder(1) = .FALSE.             
+C
+C
+      End Subroutine Agrif_InterpNearBorderX 
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_InterpDistantBorderX
+C     **************************************************************************
+C
+      Subroutine Agrif_InterpDistantBorderX()
+C  
+CCC   Description:
+CCC   Subroutine allowing to interpole (in the x direction) on a distant border 
+CCC   of the current grid if this one has a common border with the root coarse  
+CCC   grid.
+C
+C     Declarations:
+C  
+
+C
+C
+      AGRIF_CURGRID % DistantRootBorder(1) = .FALSE.             
+C
+C
+      End Subroutine Agrif_InterpDistantBorderX                 
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_InterpNearBorderY
+C     **************************************************************************
+C
+      Subroutine Agrif_InterpNearBorderY()
+C  
+CCC   Description:
+CCC   Subroutine allowing to interpole (in the y direction) on a near border of 
+CCC   the current grid if this one has a common border with the root coarse 
+CCC   grid.
+C
+C     Declarations:
+C  
+      
+C
+C
+      AGRIF_CURGRID % NearRootBorder(2) = .FALSE.             
+C
+C
+      End Subroutine Agrif_InterpNearBorderY
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_InterpDistantBorderY
+C     **************************************************************************
+C
+      Subroutine Agrif_InterpDistantBorderY()
+C  
+CCC   Description:
+CCC   Subroutine allowing to interpole (in the y direction) on a distant border 
+CCC   of the current grid if this one has a common border with the root coarse  
+CCC   grid.
+C
+C     Declarations:
+C  
+      
+C
+C
+      AGRIF_CURGRID % DistantRootBorder(2) = .FALSE.             
+C
+C
+      End Subroutine Agrif_InterpDistantBorderY      
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_InterpNearBorderZ
+C     **************************************************************************
+C
+      Subroutine Agrif_InterpNearBorderZ()
+C  
+CCC   Description:
+CCC   Subroutine allowing to interpole (in the z direction) on a near border of 
+CCC   the current grid if this one has a common border with the root coarse 
+CCC   grid.
+C
+C     Declarations:
+C  
+      
+C
+C
+      AGRIF_CURGRID % NearRootBorder(3) = .FALSE.             
+C
+C
+      End Subroutine Agrif_InterpNearBorderZ
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_InterpDistantBorderZ
+C     **************************************************************************
+C
+      Subroutine Agrif_InterpDistantBorderZ()
+C  
+CCC   Description:
+CCC   Subroutine allowing to interpole (in the z direction) on a distant border 
+CCC   of the current grid if this one has a common border with the root coarse  
+CCC   grid.
+C
+C     Declarations:
+C  
+      
+C
+C
+      AGRIF_CURGRID % DistantRootBorder(3) = .FALSE.             
+C
+C
+      End Subroutine Agrif_InterpDistantBorderZ
+C 
+C     **************************************************************************
+CCC   Function Agrif_Parent_Nb_Step
+C     ************************************************************************** 
+C 
+      Function AGRIF_Parent_Nb_Step() 
+C  
+CCC   Description:
+CCC   Function returning the number of time steps of the parent grid of the
+CCC   current grid.
+C
+C     Declarations:
+C    
+      
+C
+      INTEGER :: AGRIF_Parent_Nb_Step ! Result 
+C
+C
+      if (Agrif_Root()) then  
+C     
+          Agrif_Parent_Nb_Step = -1 
+C       
+        else
+C       
+          Agrif_Parent_Nb_Step = Agrif_Curgrid % parent % ngridstep
+C     
+      endif
+C
+C     
+      End function Agrif_Parent_Nb_Step    
+C 
+C
+C 
+C     **************************************************************************
+CCC   Function Agrif_Root
+C     **************************************************************************
+C
+      Function Agrif_Root()
+C     
+CCC   Description:
+CCC   Function indicating if the current grid is or not the root grid.
+C
+C     Declarations:
+C
+      
+C
+      LOGICAL :: Agrif_Root   ! Result
+C    
+C
+      if (AGRIF_CURGRID % fixedrank .EQ. 0) then
+C          
+          Agrif_Root = .TRUE.
+C    
+        else
+C    
+          Agrif_Root = .FALSE.
+C     
+      endif
+C
+C    
+      End function Agrif_Root
+C
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Parent_Root
+C     **************************************************************************
+C
+      Function Agrif_Parent_Root()
+C     
+CCC   Description:
+CCC   Function indicating if the parent grid of the current grid is or not the 
+CCC   root grid.
+C
+C     Declarations:
+C
+      
+C
+      LOGICAL :: Agrif_Parent_Root   ! Result
+C    
+C
+      if (AGRIF_CURGRID % parent % fixedrank .EQ. 0) then
+C          
+          Agrif_Parent_Root = .TRUE.
+C    
+        else
+C    
+          Agrif_Parent_Root = .FALSE.
+C     
+      endif
+C
+C    
+      End function Agrif_Parent_Root     
+C 
+C
+C 
+C     **************************************************************************
+CCC   Function Agrif_Fixed
+C     **************************************************************************
+C 
+      Function Agrif_Fixed()
+C  
+CCC   Description:
+CCC   Function returning the number of the current grid.
+C
+C     Declarations:
+C   
+      
+C
+      INTEGER Agrif_Fixed   ! Result 
+C 
+C
+      if (Agrif_Curgrid % fixed) then
+C     
+          Agrif_Fixed = Agrif_Curgrid % fixedrank 
+C
+        else
+C     
+         Agrif_Fixed = -1
+C        
+      endif
+C
+C     
+      End function Agrif_Fixed 
+C
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Parent_Fixed
+C     **************************************************************************
+ 
+      Function Agrif_Parent_Fixed()
+C  
+CCC   Description:
+CCC   Function returning the number of the parent grid of the current grid.
+C
+C     Declarations:
+C   
+      
+C
+      INTEGER Agrif_Parent_Fixed   ! Result 
+C 
+C
+      if (Agrif_Curgrid % parent % fixed) then
+C     
+          Agrif_Parent_Fixed = AGRIF_CURGRID % parent % fixedrank 
+C
+        else
+C     
+         Agrif_Parent_Fixed = 0
+C        
+      endif
+C
+C     
+      End function Agrif_Parent_Fixed
+C
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Is_Fixed
+C     **************************************************************************
+ 
+      Function Agrif_Is_Fixed()
+C  
+CCC   Description:
+CCC   Function returning true if the current grid is fixed.
+C
+C     Declarations:
+C   
+      
+C
+      LOGICAL Agrif_Is_Fixed   ! Result 
+C 
+C
+      if (Agrif_Curgrid % fixed) then
+C     
+          Agrif_Is_Fixed = .true.
+C
+        else
+C     
+          Agrif_Is_Fixed = .false.
+C        
+      endif
+C
+C     
+      End function Agrif_Is_Fixed
+C
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Parent_Is_Fixed
+C     **************************************************************************
+ 
+      Function Agrif_Parent_Is_Fixed()
+C  
+CCC   Description:
+CCC   Function returning true if the parent grid of the current grid is fixed.
+C
+C     Declarations:
+C   
+      
+C
+      LOGICAL Agrif_Parent_Is_Fixed   ! Result 
+C 
+C
+      if (Agrif_Curgrid % parent % fixed) then
+C     
+          Agrif_Parent_Is_Fixed = .true.
+C
+        else
+C     
+          Agrif_Parent_Is_Fixed = .false.
+C        
+      endif
+C
+C     
+      End function Agrif_Parent_Is_Fixed            
+C
+C 
+C
+C     **************************************************************************
+CCC   Function AGRIF_CFixed
+C     **************************************************************************
+ 
+            Function AGRIF_CFixed()
+C  
+CCC   Description:
+CCC   Function returning the number of the current grid.
+C
+C     Declarations:
+C   
+      
+C
+      CHARACTER(3) AGRIF_CFixed   ! Result 
+C
+C     Local variables      
+      CHARACTER(3) cfixed
+      INTEGER fixed
+C 
+C
+      fixed = Agrif_Fixed()
+C      
+      if(fixed.NE.-1) then
+C
+           if (fixed .LE. 9) then
+C
+               write(cfixed,'(i1)')fixed
+C 
+           else
+C   
+               write(cfixed,'(i2)')fixed
+C      
+           endif
+C
+           AGrif_Cfixed=cfixed
+C      
+      else
+C
+      print*,'Call to AGRIF_CFixed() on a moving grid'
+      stop
+C
+      endif     
+
+      End function AGRIF_CFixed
+C
+C
+C
+C     **************************************************************************
+CCC   Function AGRIF_Parent_CFixed
+C     **************************************************************************
+ 
+      Function AGRIF_Parent_CFixed()
+C  
+CCC   Description:
+CCC   Function returning the number of the parent grid of the current grid.
+C
+C     Declarations:
+C   
+      
+C
+      CHARACTER(3) AGRIF_Parent_CFixed   ! Result 
+C
+C     Local variables      
+      CHARACTER(3) cfixed
+      INTEGER fixed
+C 
+C
+      fixed = Agrif_Parent_Fixed()
+C      
+      if(fixed.NE.-1) then
+C
+          if (fixed .LE. 9) then
+C
+              write(cfixed,'(i1)')fixed
+C      
+          else
+C        
+              write(cfixed,'(i2)')fixed
+C      
+          endif
+C
+          AGrif_Parent_Cfixed=cfixed
+C
+      else
+C
+      print*,'Illegal call to AGRIF_Parent_CFixed()'
+      stop     
+C
+      endif
+
+      End function AGRIF_Parent_CFixed      
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_ChildGrid_to_ParentGrid
+C     **************************************************************************
+C
+      Subroutine Agrif_ChildGrid_to_ParentGrid()
+C  
+CCC   Description:
+CCC   Subroutine allowing to make the pointer AGRIF_CURGRID point on the parent
+CCC   grid of the current grid.
+C
+C     Declarations:
+C  
+      
+C
+C
+      AGRIF_saveCURGRID => AGRIF_CURGRID
+C
+      Call AGRIF_INSTANCE(AGRIF_CURGRID%parent)            
+C
+C
+      End Subroutine Agrif_ChildGrid_to_ParentGrid
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_ParentGrid_to_ChildGrid
+C     **************************************************************************
+C
+      Subroutine Agrif_ParentGrid_to_ChildGrid()
+C  
+CCC   Description:
+CCC   Subroutine allowing to make the pointer AGRIF_CURGRID point on the child 
+CCC   grid after having called the Agrif_ChildGrid_to_ParentGrid subroutine.
+C
+C     Declarations:
+C  
+      
+C
+C
+      Call AGRIF_INSTANCE(AGRIF_saveCURGRID)            
+C
+C
+      End Subroutine Agrif_ParentGrid_to_ChildGrid
+C
+C
+C
+C     **************************************************************************
+CCC   Function Agrif_Get_Unit
+C     **************************************************************************
+C
+      Function Agrif_Get_Unit()
+
+CCC   Description : return a unit not connected to any file
+C
+C     Declarations
+C
+      
+C
+      INTEGER Agrif_Get_Unit
+C
+C     Local scalars
+      INTEGER n
+      LOGICAL op
+C
+      INTEGER :: nunit
+      INTEGER :: iii,out,iiimax
+      Logical :: BEXIST
+      INTEGER,DIMENSION(1:10) :: ForbiddenUnit
+C
+C
+C     Load forbidden Unit if the file Agrif_forbidenUnit exist
+C      
+
+      INQUIRE(FILE='Agrif_forbiddenUnit.txt',EXIST=BEXIST)
+      If (.not. BEXIST) Then
+c          File Agrif_forbiddenUnit.txt not found
+      Else
+           nunit = 777
+           open(nunit,file='Agrif_forbiddenUnit.txt',form='formatted',
+     &          status="old")
+              iii = 1
+              do while ( .TRUE. )
+                 read(nunit,*,END = 99) ForbiddenUnit(iii)
+                 iii = iii + 1
+              enddo
+   99         CONTINUE
+              iiimax = iii
+           close(nunit)
+      endif     
+C 
+      do n = 7,1000
+C 
+        Inquire(Unit=n,Opened=op)
+C
+        out = 0
+        if ( BEXIST .AND. .NOT.op) then
+           do iii = 1 , iiimax
+              if ( n .EQ. ForbiddenUnit(iii) ) out = 1
+           enddo
+        endif
+C
+        if (.NOT.op .AND. out .EQ. 0) exit
+C      
+      enddo
+C
+      Agrif_Get_Unit=n
+C
+C
+      End Function Agrif_Get_Unit
+C
+      End Module Agrif_CurgridFunctions 
Index: /trunk/AGRIF/AGRIF_FILES/modinit.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modinit.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modinit.F	(revision 396)
@@ -0,0 +1,227 @@
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place-  Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Init
+C
+      Module Agrif_Init 
+C
+CCC   Description:
+CCC   Several operations on the variables of the current grid (creation,
+CCC   instanciation, ...) used during the creation of the grid hierarchy and
+CCC   during the time integration.
+C
+C     Modules used: 
+C
+      Use Agrif_Types 
+      Use Agrif_link
+C   
+      IMPLICIT NONE
+C
+      Contains
+C     Defininition of the procedures contained in this module
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Allocation  
+C     **************************************************************************
+C  
+      Subroutine Agrif_Allocation(Agrif_Gr)
+C
+CCC   Description:
+CCC   Subroutine to allocate the arrays containing the values of the variables 
+CCC   of the current grd.
+C
+CC    Method:
+CC    Use of the allocate function.  
+C
+C     Declarations:
+C      
+C     Pointer argument:
+      TYPE(AGRIF_grid), Pointer :: Agrif_Gr  ! Pointer on the current grid
+C 
+C     Allocation of the arrays of the variables  
+C     We cut this in several files to avoid long compilation timings
+C
+      Call Agrif_Allocationcalls(Agrif_Gr)
+C
+      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
+C
+         if ( Agrif_Probdim .EQ. 1 ) 
+     &      Allocate(Agrif_Gr%tabpoint1D(Agrif_Gr%nb(1)+1))
+         if ( Agrif_Probdim .EQ. 2 ) 
+     &      Allocate(Agrif_Gr%tabpoint2D(Agrif_Gr%nb(1)+1,
+     &       Agrif_Gr%nb(2)+1))      
+         if ( Agrif_Probdim .EQ. 3 ) 
+     &      Allocate(Agrif_Gr%tabpoint3D(Agrif_Gr%nb(1)+1,
+     &       Agrif_Gr%nb(2)+1,Agrif_Gr%nb(3)+1))      
+C
+      endif
+C 
+      End Subroutine Agrif_Allocation
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Instance 
+C     **************************************************************************
+C 
+      Subroutine Agrif_Instance(Agrif_Gr)
+C
+CCC   Description:
+CCC   Subroutine to do an instance of the common variables to the variables of  
+CCC   the current grid.
+C
+CC    Method:
+CC    Pointing the common variables on these of the current grid.  
+C
+C     Declarations:
+C        
+
+C
+C
+
+C
+C     Pointer argument: 
+      Type(Agrif_Grid), Pointer :: Agrif_Gr   ! Pointer on the current grid  
+C 
+C
+      Agrif_Curgrid => Agrif_Gr
+      Agrif_tabvars => Agrif_Curgrid % tabvars
+C
+      Call Agrif_Get_numberofcells(Agrif_Gr)
+C
+C
+C     Calculation of isf,jsf,nzsf and of the index of the output file 
+      Call Agrif_InitWorkSpace() 
+C
+C 
+      End Subroutine Agrif_Instance
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_initialisations  
+C     **************************************************************************
+      Subroutine Agrif_initialisations(Agrif_Gr)
+C
+CCC   Description:
+C
+CC    Method:
+C
+C     Declarations:
+C        
+      INTEGER :: i
+C
+C     Pointer argument: 
+      Type(Agrif_Grid), Pointer  :: Agrif_Gr
+C
+      do i = 1 , Agrif_NbVariables
+C 
+         Agrif_Gr % tabvars(i) % var % nbdim = 0
+C
+         if (associated(Agrif_Gr%tabvars(i)%var%array1)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 1
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%array2)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 2
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%array3)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 3
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%array4)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 4
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%array5)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 5
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%array6)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 6
+         endif
+C
+         if (associated(Agrif_Gr%tabvars(i)%var%darray1)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 1
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%darray2)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 2
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%darray3)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 3
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%darray4)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 4
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%darray5)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 5
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%darray6)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 6
+         endif
+C
+         if (associated(Agrif_Gr%tabvars(i)%var%larray1)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 1
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%larray2)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 2
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%larray3)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 3
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%larray4)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 4
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%larray5)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 5
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%larray6)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 6
+         endif
+C
+         if (associated(Agrif_Gr%tabvars(i)%var%iarray1)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 1
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%iarray2)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 2
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%iarray3)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 3
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%iarray4)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 4
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%iarray5)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 5
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%iarray6)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 6
+         endif
+C
+         if (associated(Agrif_Gr%tabvars(i)%var%carray1)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 1
+         endif
+         if (associated(Agrif_Gr%tabvars(i)%var%carray2)) then
+             Agrif_Gr % tabvars(i) % var % nbdim = 2
+         endif
+C 
+      enddo
+C
+      Return
+C 
+C
+      End Subroutine Agrif_initialisations
+C 
+C
+      End Module AGRIF_Init 
Index: /trunk/AGRIF/AGRIF_FILES/modinitvars.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modinitvars.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modinitvars.F	(revision 396)
@@ -0,0 +1,125 @@
+!
+! $Id$
+!
+C     Agrif (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Init_Vars
+C
+      Module Agrif_Init_Vars
+C
+CCC   Description:
+CCC   Initialization of the variables of the current grid.
+C
+C     Modules used: 
+C      
+      Use Agrif_Types
+      Use Agrif_link
+C   
+      IMPLICIT NONE
+C
+      Contains
+C     Defininition of the procedures contained in this module 
+C  
+C 
+C     **************************************************************************
+CCC   Subroutine Agrif_Create_var 
+C     **************************************************************************
+C  
+      Subroutine Agrif_Create_Var(Agrif_Gr)
+C
+CCC   Description:
+CCC   Allocation of the field "var" of the grid variables.
+CCC   Fields "root_var", "nbdim" and "parent_var" of the grid variables.
+CCC   Array "tabvars" of the current grid. 
+C
+CC    Method:                  
+C 
+C     Declarations:
+C
+      
+C
+C     Pointer argument:
+      TYPE(Agrif_Grid),pointer   :: Agrif_Gr  ! Pointer on the current grid
+      INTEGER :: nb
+C
+C     Array "tabvars" of the current grid. 
+C
+      Allocate(Agrif_Gr % tabvars(Agrif_NbVariables))
+C      
+      do nb = 1, Agrif_NbVariables
+        Allocate(Agrif_Gr % tabvars(nb) % var)
+      enddo
+
+C     Fields "root_var", "nbdim" and "parent_var" of the grid variables.     
+      if (Agrif_Gr % fixedrank .NE.0) then
+         do nb = 1, Agrif_NbVariables     
+            Agrif_Gr % tabvars(nb) % parent_var => 
+     &      Agrif_Gr % parent %tabvars(nb)
+            Agrif_Gr % tabvars(nb) % var % nbdim =
+     &      Agrif_Mygrid % tabvars(nb) % var % nbdim
+            Agrif_Gr % tabvars(nb) % var % root_var =>
+     &      Agrif_Mygrid % tabvars(nb) % var          
+         enddo
+      endif
+C           
+      End Subroutine Agrif_Create_Var
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_CreateVar
+C     **************************************************************************
+C 
+      Subroutine Agrif_CreateVar(Agrif_Gr)            
+C
+CCC   Description:
+CCC   This subroutine allows to make a link between Mygrid and the current grid 
+C
+C     Modules used:
+C      
+C
+C     Declarations:
+C      
+C
+C
+C     Arguments      
+C
+      TYPE(Agrif_Grid),pointer   :: Agrif_Gr    ! Pointer on the current grid
+      INTEGER                    :: i           ! Loop
+C
+      if (Agrif_Gr % fixedrank .NE. 0) then
+C  
+         do i = 1 , Agrif_NbVariables 
+            Agrif_Gr % tabvars(i) % parent_var => 
+     &      Agrif_Gr % parent % tabvars(i) 
+            Agrif_Gr % tabvars(i) % var % root_var => 
+     &      Agrif_Mygrid % tabvars(i) % var
+            Agrif_Gr % tabvars(i) % var % nbdim  = 
+     &      Agrif_Gr % parent % tabvars(i) % var % nbdim
+         enddo 
+C	 
+      endif 
+C       
+      End Subroutine Agrif_CreateVar
+C
+C
+C
+      End Module Agrif_Init_Vars
Index: /trunk/AGRIF/AGRIF_FILES/modinterp.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modinterp.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modinterp.F	(revision 396)
@@ -0,0 +1,1816 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Interpolation
+C
+      Module Agrif_Interpolation
+C
+CCC   Description:
+CCC   Module to initialize a fine grid from its parent grid, by using a space 
+CCC   interpolation
+C
+C     Modules used:
+C  
+      Use Agrif_Interpbasic
+      Use Agrif_Arrays
+      Use Agrif_Mask 
+      Use Agrif_CurgridFunctions
+#if defined AGRIF_MPI
+      Use Agrif_mpp
+#endif
+C      
+      IMPLICIT NONE
+C
+      CONTAINS
+C     Define procedures contained in this module        
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_1d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_1d(TypeInterp,parent,child,tab,
+     &    torestore,nbdim)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions of a fine grid for a 1D
+C        grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(6) :: TypeInterp     ! Kind of interpolation
+                                             !    (linear,lagrange,spline)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+                                             !    grid
+      LOGICAL :: torestore
+      REAL, DIMENSION(
+     &         lbound(child%var%array1,1):ubound(child%var%array1,1)
+     &         ), Target :: tab    ! Result
+C
+C
+      allocate(childtemp % var)  
+C      
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = nbdim
+C
+C     Tab is the result of the interpolation
+      childtemp % var % array1 => tab 
+C      
+      if (torestore) then
+C 
+          childtemp % var % array1 = child % var % array1
+C          
+          childtemp % var % restore1D => child % var % restore1D
+C      
+        else
+C        
+          Nullify(childtemp % var % restore1D)
+C      
+      endif     
+C 
+C     Index indicating (in the Agrif_Interp1D procedure) if a space
+C        interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex       
+      childtemp % var % Interpolationshouldbemade = 
+     &    child % var % Interpolationshouldbemade       
+C      
+      Call Agrif_InterpVariable
+     &     (TypeInterp,parent,childtemp,torestore)
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_1D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_2d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_2d(TypeInterp,parent,child,tab,
+     &                           torestore,nbdim)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions of a fine grid for a 2D
+C        grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(6) :: TypeInterp     ! Kind of interpolation
+                                             !    (linear,lagrange,spline)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+                                             !    grid
+      LOGICAL :: torestore
+      REAL, DIMENSION(
+     &    lbound(child%var%array2,1):ubound(child%var%array2,1),
+     &    lbound(child%var%array2,2):ubound(child%var%array2,2)
+     &    ), Target :: tab    ! Result
+C
+C
+      allocate(childtemp % var)  
+C      
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = nbdim
+C
+C     Tab is the result of the interpolation
+      childtemp % var % array2 => tab  
+C      
+      if (torestore) then      
+C 
+          childtemp % var % array2 = child % var % array2
+C 
+          childtemp % var % restore2D => child % var % restore2D        
+C      
+        else
+C        
+          Nullify(childtemp % var % restore2D)
+C      
+      endif       
+C 
+C     Index indicating (in the Agrif_Interp2D procedure) if a space
+C        interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex       
+      childtemp % var % Interpolationshouldbemade = 
+     &    child % var % Interpolationshouldbemade       
+C     
+      Call Agrif_InterpVariable
+     &     (TypeInterp,parent,childtemp,torestore)
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_2D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_3d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_3d(TypeInterp,parent,child,tab,
+     &   torestore,nbdim)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions of a fine grid for a 3D
+C        grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(6) :: TypeInterp     ! Kind of interpolation
+                                             !    (linear,lagrange,spline)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+                                             !    grid
+      LOGICAL :: torestore
+      REAL, DIMENSION(
+     &      lbound(child%var%array3,1):ubound(child%var%array3,1),
+     &      lbound(child%var%array3,2):ubound(child%var%array3,2),
+     &      lbound(child%var%array3,3):ubound(child%var%array3,3)
+     &      ), Target :: tab  ! Results
+C
+C
+      allocate(childtemp % var)  
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = nbdim  
+C     
+C     Tab is the result of the interpolation 
+      childtemp % var % array3 => tab 
+C      
+      if (torestore) then
+C     
+          childtemp % var % array3 = child % var % array3
+C
+          childtemp % var % restore3D => child % var % restore3D
+C      
+        else
+C        
+          Nullify(childtemp % var % restore3D)
+C      
+      endif
+C 
+C     Index indicating (in the Agrif_Interp3D procedure) if a space
+C        interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex    
+      childtemp % var % Interpolationshouldbemade = 
+     &    child % var % Interpolationshouldbemade       
+C     
+      Call Agrif_InterpVariable
+     &     (TypeInterp,parent,childtemp,torestore)
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_3D               
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_4d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_4d(TypeInterp,parent,child,tab,
+     &   torestore,nbdim)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions of a fine grid for a 4D
+C        grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(6) :: TypeInterp     ! Kind of interpolation
+                                             !    (linear,lagrange,spline)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+                                             !    grid
+      LOGICAL :: torestore
+      REAL, DIMENSION(
+     &      lbound(child%var%array4,1):ubound(child%var%array4,1),
+     &      lbound(child%var%array4,2):ubound(child%var%array4,2),
+     &      lbound(child%var%array4,3):ubound(child%var%array4,3),
+     &      lbound(child%var%array4,4):ubound(child%var%array4,4)
+     &      ), Target :: tab  ! Results
+C
+C
+      allocate(childtemp % var)  
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = nbdim  
+C      
+C     Tab is the result of the interpolation
+      childtemp % var % array4 => tab 
+C 
+      if (torestore) then
+C 
+          childtemp % var % array4 = child % var % array4
+C
+          childtemp % var % restore4D => child % var % restore4D
+C      
+        else
+C        
+          Nullify(childtemp % var % restore4D)
+C      
+      endif        
+C 
+C     Index indicating (in the Agrif_Interp4D procedure) if a space
+C        interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex    
+      childtemp % var % Interpolationshouldbemade = 
+     &    child % var % Interpolationshouldbemade       
+C     
+      Call Agrif_InterpVariable
+     &     (TypeInterp,parent,childtemp,torestore)
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_4D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_5d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_5d(TypeInterp,parent,child,tab,
+     &   torestore,nbdim)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions of a fine grid for a 5D
+C        grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(6) :: TypeInterp     ! Kind of interpolation
+                                             !    (linear,lagrange,spline)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+                                             !    grid
+      LOGICAL :: torestore
+      REAL, DIMENSION(
+     &      lbound(child%var%array5,1):ubound(child%var%array5,1),
+     &      lbound(child%var%array5,2):ubound(child%var%array5,2),
+     &      lbound(child%var%array5,3):ubound(child%var%array5,3),
+     &      lbound(child%var%array5,4):ubound(child%var%array5,4),
+     &      lbound(child%var%array5,5):ubound(child%var%array5,5)
+     &      ),  Target :: tab  ! Results
+C
+C
+      allocate(childtemp % var)  
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = nbdim  
+C      
+C     Tab is the result of the interpolation
+      childtemp % var % array5 => tab  
+C      
+      if (torestore) then
+C 
+          childtemp % var % array5 = child % var % array5
+C
+          childtemp % var % restore5D => child % var % restore5D
+C      
+        else
+C        
+          Nullify(childtemp % var % restore5D)
+C      
+      endif       
+C 
+C     Index indicating (in the Agrif_Interp5D procedure) if a space
+C        interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex    
+      childtemp % var % Interpolationshouldbemade = 
+     &    child % var % Interpolationshouldbemade       
+C      
+      Call Agrif_InterpVariable
+     &     (TypeInterp,parent,childtemp,torestore)
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_5D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_6d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Interp_6d(TypeInterp,parent,child,tab,
+     &  torestore,nbdim)            
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions of a fine grid for a 6D
+C        grid variable.
+C
+C     Declarations:
+C      
+      
+C
+C     Arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(6) :: TypeInterp     ! Kind of interpolation
+                                             !    (linear,lagrange,spline)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+                                             !    grid
+      LOGICAL :: torestore
+      REAL, DIMENSION(
+     &      lbound(child%var%array6,1):ubound(child%var%array6,1),
+     &      lbound(child%var%array6,2):ubound(child%var%array6,2),
+     &      lbound(child%var%array6,3):ubound(child%var%array6,3),
+     &      lbound(child%var%array6,4):ubound(child%var%array6,4),
+     &      lbound(child%var%array6,5):ubound(child%var%array6,5),
+     &      lbound(child%var%array6,6):ubound(child%var%array6,6)
+     &      ),  Target :: tab  ! Results
+C
+C
+      allocate(childtemp % var)  
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = nbdim  
+C      
+C     Tab is the result of the interpolation
+      childtemp % var % array6 => tab  
+C      
+      if (torestore) then
+C 
+          childtemp % var % array6 = child % var % array6
+C
+          childtemp % var % restore6D => child % var % restore6D
+C      
+        else
+C        
+          Nullify(childtemp % var % restore6D)
+C      
+      endif       
+C 
+C     Index indicating (in the Agrif_Interp6D procedure) if a space
+C        interpolation is necessary
+      childtemp % var % interpIndex => child % var % interpIndex    
+      childtemp % var % Interpolationshouldbemade = 
+     &    child % var % Interpolationshouldbemade       
+C      
+      Call Agrif_InterpVariable
+     &     (TypeInterp,parent,childtemp,torestore)
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Interp_6D
+C
+C
+C
+C     **************************************************************************
+C     Subroutine Agrif_InterpVariable    
+C     **************************************************************************
+C   
+      Subroutine Agrif_InterpVariable(TYPEinterp,parent,child,torestore)
+C
+CCC   Description:
+CCC   Subroutine to set some arguments of subroutine Agrif_InterpnD, n being the
+CCC   DIMENSION of the grid variable.
+C
+CC    Declarations:
+C      
+c      
+C      
+C
+C     Scalar argument
+      INTEGER,DIMENSION(6) :: TYPEinterp! TYPE of interpolation
+                                        !    (linear,spline,...)
+C     Data TYPE arguments                                   
+      TYPE(AGRIF_PVariable) :: parent   ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child    ! Variable on the child grid
+C
+C     LOGICAL argument      
+      LOGICAL:: torestore               ! Its value is .false., it indicates the
+                                        ! results of the interpolation are    
+                                        ! applied on the whole current grid   
+C
+C     Local scalars      
+      INTEGER               :: nbdim          ! Number of dimensions of the
+                                              !    current grid
+      INTEGER ,DIMENSION(6) :: pttab_child  
+      INTEGER ,DIMENSION(6) :: petab_child      
+      INTEGER ,DIMENSION(6) :: pttab_parent  
+      REAL    ,DIMENSION(6) :: s_child,s_parent
+      REAL    ,DIMENSION(6) :: ds_child,ds_parent
+C
+      Call PreProcessToInterpOrUpdate(parent,child,
+     &             petab_Child(1:nbdim),
+     &             pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &             s_Child(1:nbdim),s_Parent(1:nbdim),
+     &             ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &             nbdim)
+C
+C
+C     Call to a procedure of interpolation against the number of dimensions of 
+C     the grid variable
+C
+      call Agrif_InterpnD
+     &            (TYPEinterp,parent,child,
+     &             pttab_Child(1:nbdim),petab_Child(1:nbdim),
+     &             pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &             s_Child(1:nbdim),s_Parent(1:nbdim),
+     &             ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &             child,torestore,nbdim)
+C
+      Return
+C
+C
+      End subroutine Agrif_InterpVariable       
+C
+C
+C     **************************************************************************
+C     Subroutine Agrif_InterpnD  
+C     **************************************************************************
+C  
+      Subroutine Agrif_InterpnD(TYPEinterp,parent,child,
+     &                          pttab,petab,
+     &                          pttab_Child,pttab_Parent,
+     &                          s_Child,s_Parent,ds_Child,ds_Parent,
+     &                          restore,torestore,nbdim,procname)
+C
+C     Description:
+C     Subroutine to interpolate a nD grid variable from its parent grid,
+C     by using a space interpolation. 
+C
+C     Declarations:
+C
+      
+C
+#ifdef AGRIF_MPI
+C
+#include "mpif.h"
+C
+#endif
+C
+C     Arguments
+      External :: procname
+      Optional :: procname
+      INTEGER                    :: nbdim
+      INTEGER,DIMENSION(6)       :: TYPEinterp         ! TYPE of interpolation
+                                                       !    (linear,...)
+      TYPE(AGRIF_PVARIABLE)      :: parent             ! Variable of the parent
+                                                       !    grid
+      TYPE(AGRIF_PVARIABLE)      :: child              ! Variable of the child
+                                                       !    grid
+      INTEGER,DIMENSION(nbdim)   :: pttab              ! Index of the first
+                                                       !    point inside the
+                                                       !    domain
+      INTEGER,DIMENSION(nbdim)   :: petab              ! Index of the first
+                                                       !    point inside the
+                                                       !    domain
+      INTEGER,DIMENSION(nbdim)   :: pttab_Child        ! Index of the first
+                                                       !    point inside the
+                                                       !    domain for the child
+                                                       !    grid variable
+      INTEGER,DIMENSION(nbdim)   :: pttab_Parent       ! Index of the first
+                                                       !    point inside the
+                                                       !    domain for the
+                                                       !    parent grid variable
+      TYPE(AGRIF_PVARIABLE)      :: restore            ! Indicates points where
+                                                       !    interpolation
+      REAL,DIMENSION(nbdim)      :: s_Child,s_Parent   ! Positions of the parent
+                                                       !    and child grids
+      REAL,DIMENSION(nbdim)      :: ds_Child,ds_Parent ! Space steps of the
+                                                       !    parent and child
+                                                       !    grids
+      LOGICAL                        :: torestore      ! Indicates if the array
+                                                       !    restore is used
+C
+C     Local pointers
+      TYPE(AGRIF_PVARIABLE)      :: tempP,tempPextend  ! Temporary parent grid variable
+      TYPE(AGRIF_PVARIABLE)      :: tempC      ! Temporary child grid variable
+C
+C     Local scalars        
+      INTEGER                     :: i,j,k,l,m,n
+      INTEGER,DIMENSION(nbdim)    :: pttruetab,cetruetab
+      INTEGER,DIMENSION(nbdim)    :: indmin,indmax
+      LOGICAL,DIMENSION(nbdim)    :: noraftab
+      REAL   ,DIMENSION(nbdim)    :: s_Child_temp,s_Parent_temp
+      INTEGER,DIMENSION(nbdim)    :: lowerbound,upperbound
+      INTEGER,DIMENSION(nbdim)    :: indminglob,indmaxglob
+      INTEGER,DIMENSION(nbdim,2,2) :: childarray
+      INTEGER,DIMENSION(nbdim,2,2) :: parentarray
+      LOGICAL :: memberin,member
+      TYPE(AGRIF_PVARIABLE)                      ::  parentvalues
+C
+#ifdef AGRIF_MPI
+C
+      LOGICAL :: memberout
+      INTEGER,PARAMETER                          :: etiquette = 100
+      INTEGER                                    :: code
+      INTEGER,DIMENSION(nbdim)    :: indminglob2,indmaxglob2
+      INTEGER,DIMENSION(nbdim,4)           :: tab3
+      INTEGER,DIMENSION(nbdim,4,0:Agrif_Nbprocs-1) :: tab4
+      INTEGER,DIMENSION(nbdim,0:Agrif_Nbprocs-1,4) :: tab4t
+C
+#endif      
+C     
+C   
+C     Boundaries of the current grid where interpolation is done
+      Call Agrif_nbdim_Get_bound_dimension(child % var,
+     &                               lowerbound,upperbound,nbdim)
+
+      Call Agrif_Childbounds(nbdim,lowerbound,upperbound,
+     &                                   pttab,petab,
+     &                                   pttruetab,cetruetab,memberin)
+C
+C
+
+      Call Agrif_Parentbounds(TYPEinterp,nbdim,indminglob,indmaxglob,
+     &                        s_Parent_temp,s_Child_temp,
+     &                        s_Child,ds_Child,
+     &                        s_Parent,ds_Parent,
+     &                        pttab,petab,
+     &                        pttab_Child,pttab_Parent,
+     &                        child%var%root_var%posvar,
+     &                        child % var % root_var % interptab)
+
+
+#ifdef AGRIF_MPI 
+
+      IF (memberin) THEN
+      Call Agrif_Parentbounds(TYPEinterp,nbdim,indmin,indmax,
+     &                        s_Parent_temp,s_Child_temp,
+     &                        s_Child,ds_Child,
+     &                        s_Parent,ds_Parent,
+     &                        pttruetab,cetruetab,
+     &                        pttab_Child,pttab_Parent,
+     &                        child%var%root_var%posvar,
+     &                        child % var % root_var % interptab)
+      ENDIF
+   
+
+      Call Agrif_nbdim_Get_bound_dimension(parent%var,
+     &                              lowerbound,upperbound,nbdim)
+
+      Call Agrif_ChildGrid_to_ParentGrid()
+C
+      Call Agrif_Childbounds(nbdim,
+     &                       lowerbound,upperbound,
+     &                       indminglob,indmaxglob,
+     &                       indminglob2,indmaxglob2,member)
+
+C
+      IF (member) THEN
+      Call Agrif_GlobtoLocInd2(parentarray,
+     &                     lowerbound,upperbound,
+     &                     indminglob2,indmaxglob2,
+     &                     nbdim,Agrif_Procrank,
+     &                     member)
+            endif
+
+      Call Agrif_ParentGrid_to_ChildGrid()
+#else
+      parentarray(:,1,1) = indminglob
+      parentarray(:,2,1) = indmaxglob
+      parentarray(:,1,2) = indminglob
+      parentarray(:,2,2) = indmaxglob
+      indmin = indminglob
+      indmax = indmaxglob
+      member = .TRUE.
+#endif
+
+
+
+      IF (member) THEN
+      allocate(tempP%var)
+
+C
+      Call Agrif_nbdim_allocation(tempP%var,
+     &     parentarray(:,1,1),parentarray(:,2,1),nbdim)
+
+      Call Agrif_nbdim_Full_VarEQreal(tempP%var,0.,nbdim)
+
+
+
+      IF (present(procname)) THEN
+      Call Agrif_ChildGrid_to_ParentGrid()
+            SELECT CASE (nbdim)
+        CASE(1)
+          CALL procname(tempP%var%array1,
+     &                          parentarray(1,1,2),parentarray(1,2,2))
+        CASE(2)
+          CALL procname(tempP%var%array2,
+     &                          parentarray(1,1,2),parentarray(1,2,2),
+     &                          parentarray(2,1,2),parentarray(2,2,2))
+        CASE(3)
+          CALL procname(tempP%var%array3,
+     &                          parentarray(1,1,2),parentarray(1,2,2),
+     &                          parentarray(2,1,2),parentarray(2,2,2),
+     &                          parentarray(3,1,2),parentarray(3,2,2))
+        CASE(4)
+          CALL procname(tempP%var%array4,
+     &                          parentarray(1,1,2),parentarray(1,2,2),
+     &                          parentarray(2,1,2),parentarray(2,2,2),
+     &                          parentarray(3,1,2),parentarray(3,2,2),
+     &                          parentarray(4,1,2),parentarray(4,2,2))
+        CASE(5)
+          CALL procname(tempP%var%array5,
+     &                          parentarray(1,1,2),parentarray(1,2,2),
+     &                          parentarray(2,1,2),parentarray(2,2,2),
+     &                          parentarray(3,1,2),parentarray(3,2,2),
+     &                          parentarray(4,1,2),parentarray(4,2,2),
+     &                          parentarray(5,1,2),parentarray(5,2,2))
+        CASE(6)
+          CALL procname(tempP%var%array6,
+     &                          parentarray(1,1,2),parentarray(1,2,2),
+     &                          parentarray(2,1,2),parentarray(2,2,2),
+     &                          parentarray(3,1,2),parentarray(3,2,2),
+     &                          parentarray(4,1,2),parentarray(4,2,2),
+     &                          parentarray(5,1,2),parentarray(5,2,2),
+     &                          parentarray(6,1,2),parentarray(6,2,2))
+            END SELECT
+      Call Agrif_ParentGrid_to_ChildGrid()
+      ELSE
+      Call Agrif_nbdim_VarEQvar(tempP%var,
+     &        parentarray(:,1,1),parentarray(:,2,1),
+     &        parent%var,parentarray(:,1,2),parentarray(:,2,2),
+     &        nbdim)
+      ENDIF
+            endif
+
+#ifdef AGRIF_MPI
+      tab3(:,1) = indminglob2(:)
+      tab3(:,2) = indmaxglob2(:)
+      tab3(:,3) = indmin(:)
+      tab3(:,4) = indmax(:)
+C
+C
+      Call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim,
+     &                   MPI_INTEGER,MPI_COMM_WORLD,code)
+
+      Allocate(tempPextend%var)
+      DO k=0,Agrif_Nbprocs-1
+       do j=1,4
+         do i=1,nbdim
+         tab4t(i,k,j) = tab4(i,j,k)
+                enddo
+      enddo
+      enddo
+      Call Get_External_Data(tempP,tempPextend,tab4t(:,:,1),
+     &            tab4t(:,:,2),
+     &            tab4t(:,:,3),tab4t(:,:,4),nbdim,member,memberin)
+#else
+      tempPextend%var => tempP%var
+#endif
+
+C
+C
+      IF (memberin) THEN
+      allocate(tempC%var)
+C
+
+      Call Agrif_nbdim_allocation(tempC%var,pttruetab,cetruetab,nbdim)
+
+C
+C
+C     Special values on the parent grid
+      if (Agrif_UseSpecialValue) then
+C
+          noraftab(1:nbdim) =
+     &         child % var % root_var % interptab(1:nbdim) .EQ. 'N'
+C
+          Allocate(parentvalues%var)
+C
+          Call Agrif_nbdim_allocation
+     &               (parentvalues%var,indmin,indmax,nbdim)
+          Call Agrif_nbdim_Full_VarEQvar
+     &               (parentvalues%var,tempPextend%var,nbdim)
+C
+          Call Agrif_CheckMasknD(tempPextend,
+     &                           parentvalues,
+     &                           indmin(1:nbdim),indmax(1:nbdim),
+     &                           indmin(1:nbdim),indmax(1:nbdim),
+     &                           noraftab(1:nbdim),nbdim)
+C
+          Call Agrif_nbdim_deallocation(parentvalues%var,nbdim)
+          Deallocate(parentvalues%var)
+C
+C
+      endif      
+
+C
+C
+C     Interpolation of the current grid
+
+      IF (memberin) THEN
+      if ( nbdim .EQ. 1 ) then
+         Call Agrif_Interp_1D_recursive(TypeInterp,
+     &           tempPextend%var%array1,tempC%var%array1,
+     &           indmin,indmax,
+     &           pttruetab,cetruetab,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      elseif ( nbdim .EQ. 2 ) then
+
+         Call Agrif_Interp_2D_recursive(TypeInterp,
+     &           tempPextend%var%array2,tempC%var%array2,
+     &           indmin,indmax,
+     &           pttruetab,cetruetab,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      elseif ( nbdim .EQ. 3 ) then
+
+         Call Agrif_Interp_3D_recursive(TypeInterp,
+     &           tempPextend%var%array3,tempC%var%array3,
+     &           indmin,indmax,
+     &           pttruetab,cetruetab,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      elseif ( nbdim .EQ. 4 ) then
+         Call Agrif_Interp_4D_recursive(TypeInterp,
+     &           tempPextend%var%array4,tempC%var%array4,
+     &           indmin,indmax,
+     &           pttruetab,cetruetab,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      elseif ( nbdim .EQ. 5 ) then
+         Call Agrif_Interp_5D_recursive(TypeInterp,
+     &           tempPextend%var%array5,tempC%var%array5,
+     &           indmin,indmax,
+     &           pttruetab,cetruetab,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      elseif ( nbdim .EQ. 6 ) then
+         Call Agrif_Interp_6D_recursive(TypeInterp,
+     &           tempPextend%var%array6,tempC%var%array6,
+     &           indmin,indmax,
+     &           pttruetab,cetruetab,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+       endif
+
+
+C
+C
+C     Special values on the child grid  
+      if (Agrif_UseSpecialValueFineGrid) then
+C
+#ifdef AGRIF_MPI
+C        
+          Call GiveAgrif_SpecialValueToTab_mpi(child%var,tempC%var,
+     &                 childarray,
+     &                 pttruetab,cetruetab,
+     &                 Agrif_SpecialValueFineGrid,nbdim)
+C
+#else
+C
+          Call GiveAgrif_SpecialValueToTab(child%var,tempC%var,
+     &                  pttruetab,cetruetab,
+     &                  Agrif_SpecialValueFineGrid,nbdim)
+C
+#endif 
+C
+C        
+      endif
+C  
+
+      Call Agrif_nbdim_Get_bound_dimension(child % var,
+     &                               lowerbound,upperbound,nbdim)
+
+#ifdef AGRIF_MPI
+      Call Agrif_GlobtoLocInd2(childarray,
+     &                     lowerbound,upperbound,
+     &                     pttruetab,cetruetab,
+     &                     nbdim,Agrif_Procrank,
+     &                     memberout)
+
+#else
+       childarray(:,1,1) = pttruetab
+       childarray(:,2,1) = cetruetab
+       childarray(:,1,2) = pttruetab
+       childarray(:,2,2) = cetruetab
+ccccccccccccccc       memberout = .TRUE.
+#endif
+
+      endif
+
+C
+      if (torestore) then
+C
+#ifdef AGRIF_MPI
+C
+        SELECT CASE (nbdim)
+        CASE (1)
+             do i = pttruetab(1),cetruetab(1)         
+ChildarrayAModifier                if (restore%var%restore1D(i) == 0) 
+ChildarrayAModifier     &                child%var%array1(childarray(i,1,2)
+ChildarrayAModifier     &                                 ) = 
+ChildarrayAModifier     &                tempC%var%array1(i)
+             enddo
+        CASE (2)
+             do i = pttruetab(1),cetruetab(1)
+             do j = pttruetab(2),cetruetab(2)
+ChildarrayAModifier                   if (restore%var%restore2D(i,j) == 0) 
+ChildarrayAModifier     &                child%var%array2(childarray(i,1,2),
+ChildarrayAModifier     &                                 childarray(j,2,2)) = 
+ChildarrayAModifier     &                tempC%var%array2(i,j)
+             enddo
+             enddo
+        CASE (3)
+             do i = pttruetab(1),cetruetab(1)
+             do j = pttruetab(2),cetruetab(2)  
+             do k = pttruetab(3),cetruetab(3)
+ChildarrayAModifier                      if (restore%var%restore3D(i,j,k) == 0) 
+ChildarrayAModifier     &                child%var%array3(childarray(i,1,2),
+ChildarrayAModifier     &                                 childarray(j,2,2),
+ChildarrayAModifier     &                                 childarray(k,3,2)) = 
+ChildarrayAModifier     &                tempC%var%array3(i,j,k)
+             enddo
+             enddo
+             enddo
+        CASE (4)
+             do i = pttruetab(1),cetruetab(1)
+             do j = pttruetab(2),cetruetab(2)
+             do k = pttruetab(3),cetruetab(3)
+             do l = pttruetab(4),cetruetab(4)
+ChildarrayAModifier                         if (restore%var%restore4D(i,j,k,l) == 0) 
+ChildarrayAModifier     &                      child%var%array4(childarray(i,1,2),
+ChildarrayAModifier     &                                       childarray(j,2,2),
+ChildarrayAModifier     &                                       childarray(k,3,2),
+ChildarrayAModifier     &                                       childarray(l,4,2)) = 
+ChildarrayAModifier     &                      tempC%var%array4(i,j,k,l)
+             enddo
+             enddo
+             enddo
+             enddo
+        CASE (5)
+             do i = pttruetab(1),cetruetab(1)
+             do j = pttruetab(2),cetruetab(2)
+             do k = pttruetab(3),cetruetab(3)
+             do l = pttruetab(4),cetruetab(4)
+             do m = pttruetab(5),cetruetab(5)
+ChildarrayAModifier              if (restore%var%restore5D(i,j,k,l,m) == 0) 
+ChildarrayAModifier     &                child%var%array5(childarray(i,1,2),
+ChildarrayAModifier     &                                 childarray(j,2,2),
+ChildarrayAModifier     &                                 childarray(k,3,2),
+ChildarrayAModifier     &                                 childarray(l,4,2),
+ChildarrayAModifier     &                                 childarray(m,5,2)) = 
+ChildarrayAModifier     &                tempC%var%array5(i,j,k,l,m)
+             enddo
+             enddo
+             enddo
+             enddo
+             enddo
+        CASE (6)
+             do i = pttruetab(1),cetruetab(1)
+             do j = pttruetab(2),cetruetab(2)
+             do k = pttruetab(3),cetruetab(3)
+             do l = pttruetab(4),cetruetab(4)
+             do m = pttruetab(5),cetruetab(5)
+             do n = pttruetab(6),cetruetab(6)
+ChildarrayAModifier              if (restore%var%restore6D(i,j,k,l,m,n) == 0) 
+ChildarrayAModifier     &                child%var%array6(childarray(i,1,2),
+ChildarrayAModifier     &                                 childarray(j,2,2),
+ChildarrayAModifier     &                                 childarray(k,3,2),
+ChildarrayAModifier     &                                 childarray(l,4,2),
+ChildarrayAModifier     &                                 childarray(m,5,2),
+ChildarrayAModifier     &                                 childarray(n,6,2)) = 
+ChildarrayAModifier     &                tempC%var%array6(i,j,k,l,m,n)
+             enddo
+             enddo
+             enddo
+             enddo
+             enddo
+             enddo
+        END SELECT
+C
+#else
+        SELECT CASE (nbdim)
+        CASE (1)
+           do i = pttruetab(1),cetruetab(1)         
+            if (restore%var%restore1D(i) == 0)
+     &            child % var % array1(i) = 
+     &            tempC % var % array1(i)    
+          enddo
+        CASE (2)
+           do j = pttruetab(2),cetruetab(2)
+             do i = pttruetab(1),cetruetab(1)    
+              if (restore%var%restore2D(i,j) == 0)
+     &              child % var % array2(i,j) = 
+     &              tempC % var % array2(i,j)    
+              enddo
+             enddo
+        CASE (3)
+           do k = pttruetab(3),cetruetab(3)
+           do j = pttruetab(2),cetruetab(2)
+             do i = pttruetab(1),cetruetab(1) 
+              if (restore%var%restore3D(i,j,k) == 0)
+     &                  child % var % array3(i,j,k) =
+     &                  tempC % var % array3(i,j,k)    
+                  enddo
+              enddo
+             enddo
+        CASE (4)
+           do l = pttruetab(4),cetruetab(4)
+           do k = pttruetab(3),cetruetab(3)
+          do j = pttruetab(2),cetruetab(2)
+             do i = pttruetab(1),cetruetab(1)
+                if (restore%var%restore4D(i,j,k,l) == 0)
+     &                 child % var % array4(i,j,k,l) = 
+     &                 tempC % var % array4(i,j,k,l)    
+             enddo
+             enddo
+              enddo
+             enddo
+        CASE (5)
+           do m = pttruetab(5),cetruetab(5)
+          do l = pttruetab(4),cetruetab(4)
+         do k = pttruetab(3),cetruetab(3)
+           do j = pttruetab(2),cetruetab(2)
+             do i = pttruetab(1),cetruetab(1)
+                if (restore%var%restore5D(i,j,k,l,m) == 0)
+     &                  child % var % array5(i,j,k,l,m) = 
+     &                  tempC % var % array5(i,j,k,l,m)    
+             enddo
+             enddo
+                  enddo
+              enddo
+             enddo
+        CASE (6)
+           do n = pttruetab(6),cetruetab(6)
+          do m = pttruetab(5),cetruetab(5)
+          do l = pttruetab(4),cetruetab(4)
+         do k = pttruetab(3),cetruetab(3)
+          do j = pttruetab(2),cetruetab(2)
+             do i = pttruetab(1),cetruetab(1)
+                if (restore%var%restore6D(i,j,k,l,m,n) == 0)
+     &                      child % var % array6(i,j,k,l,m,n) = 
+     &                      tempC % var % array6(i,j,k,l,m,n)    
+             enddo
+            enddo
+                      enddo
+                  enddo
+              enddo
+             enddo
+        END SELECT
+C
+#endif
+C        
+        else
+C
+C
+          IF (memberin) THEN
+          SELECT CASE (nbdim)
+          CASE (1)
+            child%var%array1(childarray(1,1,2):childarray(1,2,2)) =
+     &       tempC%var%array1(childarray(1,1,1):childarray(1,2,1))
+          CASE (2)
+            child%var%array2(childarray(1,1,2):childarray(1,2,2),
+     &                       childarray(2,1,2):childarray(2,2,2)) =
+     &      tempC%var%array2(childarray(1,1,1):childarray(1,2,1),
+     &                       childarray(2,1,1):childarray(2,2,1))
+          CASE (3)
+            child%var%array3(childarray(1,1,2):childarray(1,2,2),
+     &                       childarray(2,1,2):childarray(2,2,2),
+     &                       childarray(3,1,2):childarray(3,2,2)) =
+     &      tempC%var%array3(childarray(1,1,1):childarray(1,2,1),
+     &                       childarray(2,1,1):childarray(2,2,1),
+     &                       childarray(3,1,1):childarray(3,2,1))
+          CASE (4)
+            child%var%array4(childarray(1,1,2):childarray(1,2,2),
+     &                       childarray(2,1,2):childarray(2,2,2),
+     &                       childarray(3,1,2):childarray(3,2,2),
+     &                       childarray(4,1,2):childarray(4,2,2)) =
+     &      tempC%var%array4(childarray(1,1,1):childarray(1,2,1),
+     &                       childarray(2,1,1):childarray(2,2,1),
+     &                       childarray(3,1,1):childarray(3,2,1),
+     &                       childarray(4,1,1):childarray(4,2,1))
+          CASE (5)
+            child%var%array5(childarray(1,1,2):childarray(1,2,2),
+     &                       childarray(2,1,2):childarray(2,2,2),
+     &                       childarray(3,1,2):childarray(3,2,2),
+     &                       childarray(4,1,2):childarray(4,2,2),
+     &                       childarray(5,1,2):childarray(5,2,2)) =
+     &      tempC%var%array5(childarray(1,1,1):childarray(1,2,1),
+     &                       childarray(2,1,1):childarray(2,2,1),
+     &                       childarray(3,1,1):childarray(3,2,1),
+     &                       childarray(4,1,1):childarray(4,2,1),
+     &                       childarray(5,1,1):childarray(5,2,1))
+          CASE (6)
+            child%var%array6(childarray(1,1,2):childarray(1,2,2),
+     &                       childarray(2,1,2):childarray(2,2,2),
+     &                       childarray(3,1,2):childarray(3,2,2),
+     &                       childarray(4,1,2):childarray(4,2,2),
+     &                       childarray(5,1,2):childarray(5,2,2),
+     &                       childarray(6,1,2):childarray(6,2,2)) =
+     &      tempC%var%array6(childarray(1,1,1):childarray(1,2,1),
+     &                       childarray(2,1,1):childarray(2,2,1),
+     &                       childarray(3,1,1):childarray(3,2,1),
+     &                       childarray(4,1,1):childarray(4,2,1),
+     &                       childarray(5,1,1):childarray(5,2,1),
+     &                       childarray(6,1,1):childarray(6,2,1))
+          END SELECT
+          ENDIF
+C
+C       
+      endif
+
+        Call Agrif_nbdim_deallocation(tempPextend%var,nbdim)
+        deallocate(tempPextend%var)
+
+      Call Agrif_nbdim_deallocation(tempC%var,nbdim)
+      
+      Deallocate(tempC % var)
+      ELSE
+      
+      deallocate(tempPextend%var)
+
+      ENDIF
+C
+C             
+C     Deallocations
+#ifdef AGRIF_MPI        
+      IF (member) THEN
+      Call Agrif_nbdim_deallocation(tempP%var,nbdim)
+      Deallocate(tempP % var)
+      endif
+#endif
+C
+C
+      
+C
+C
+      End Subroutine Agrif_InterpnD 
+C
+C
+C
+C                  
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Parentbounds
+C     **************************************************************************
+C
+      Subroutine Agrif_Parentbounds(TYPEinterp,nbdim,indmin,indmax,
+     &                              s_Parent_temp,
+     &                              s_Child_temp,s_Child,ds_Child,
+     &                              s_Parent,ds_Parent,
+     &                              pttruetab,cetruetab,pttab_Child,
+     &                              pttab_Parent,posvar,interptab)
+C
+CCC   Description:
+CCC   Subroutine calculating the bounds of the parent grid for the interpolation
+CCC   of the child grid     
+C
+C
+C     Declarations:
+C
+      
+C
+#ifdef AGRIF_MPI
+C
+ccccccccccccccccccccccc#include "mpif.h"
+C
+#endif
+C
+C     Arguments
+      INTEGER :: nbdim
+      INTEGER, DIMENSION(6) :: TypeInterp
+      INTEGER,DIMENSION(nbdim) :: indmin,indmax
+      REAL,DIMENSION(nbdim) :: s_Parent_temp,s_child_temp
+      REAL,DIMENSION(nbdim) :: s_Child,ds_child
+      REAL,DIMENSION(nbdim) :: s_Parent,ds_Parent
+      INTEGER,DIMENSION(nbdim) :: pttruetab,cetruetab
+      INTEGER,DIMENSION(nbdim) :: pttab_Child,pttab_Parent
+      INTEGER,DIMENSION(nbdim) :: posvar
+      CHARACTER(6), DIMENSION(nbdim) :: interptab
+C
+C     Local variables
+      INTEGER :: i
+      REAL,DIMENSION(nbdim) :: dim_newmin,dim_newmax      
+C
+      dim_newmin = s_Child + (pttruetab - pttab_Child) * ds_Child
+      dim_newmax = s_Child + (cetruetab - pttab_Child) * ds_Child
+      
+      DO i = 1,nbdim         
+C     
+        indmin(i) = pttab_Parent(i) + 
+     &         agrif_int((dim_newmin(i)-s_Parent(i))/ds_Parent(i))
+C
+        indmax(i) = pttab_Parent(i) + 
+     &                agrif_ceiling((dim_newmax(i)-
+     &                s_Parent(i))/ds_Parent(i))
+     
+C
+C
+C       Necessary for the Quadratic interpolation
+C  
+
+        IF ((pttruetab(i) == cetruetab(i)) .AND. 
+     &                           (posvar(i) == 1)) THEN
+        ELSEIF (interptab(i) .EQ. 'N') THEN
+        ELSEIF ( TYPEinterp(i) .eq. Agrif_ppm .or.
+     &      TYPEinterp(i) .eq. Agrif_eno ) THEN            
+           indmin(i) = indmin(i) - 2  
+           indmax(i) = indmax(i) + 2                  
+        ELSE IF( TYPEinterp(i) .ne. Agrif_constant ) THEN
+           indmin(i) = indmin(i) - 1  
+           indmax(i) = indmax(i) + 1
+        ENDIF
+        
+
+C        
+       ENDDO 
+C
+        s_Parent_temp = s_Parent + (indmin - pttab_Parent) * ds_Parent
+C     
+        s_Child_temp = s_Child + (pttruetab - pttab_Child) * ds_Child
+C
+C
+      Return
+C
+C
+      End Subroutine Agrif_Parentbounds
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_1D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Interp_1D_recursive(TypeInterp,tabin,tabout,
+     &           indmin,indmax, 
+     &           pttab_child,petab_child,
+     &           s_child,s_parent,ds_child,ds_parent,nbdim)     
+C
+CCC   Description:
+CCC   Subroutine for the interpolation of a 1D grid variable. 
+CCC   It calls Agrif_InterpBase. 
+C
+C     Declarations:
+C
+      
+C
+C     Arguments
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(1) :: TypeInterp
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim) :: s_child,s_parent
+      REAL, DIMENSION(nbdim) :: ds_child,ds_parent
+      REAL, DIMENSION(indmin(nbdim):indmax(nbdim)) :: tabin        
+      REAL, DIMENSION(pttab_child(nbdim):petab_child(nbdim)) :: tabout
+C
+C
+C     Commentaire perso : nbdim vaut toujours 1 ici. 
+C
+      Call Agrif_InterpBase(TypeInterp(1),
+     &                  tabin(indmin(nbdim):indmax(nbdim)),
+     &                  tabout(pttab_child(nbdim):petab_child(nbdim)),
+     &                  indmin(nbdim),indmax(nbdim),            
+     &                  pttab_child(nbdim),petab_child(nbdim),
+     &                  s_parent(nbdim),s_child(nbdim),
+     &                  ds_parent(nbdim),ds_child(nbdim))
+C                
+      Return
+C
+C
+      End Subroutine Agrif_Interp_1D_recursive
+C
+C
+C      
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_2D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Interp_2D_recursive(TypeInterp,
+     &           tabin,tabout,
+     &           indmin,indmax,   
+     &           pttab_child,petab_child,
+     &            s_child, s_parent,
+     &           ds_child,ds_parent,
+     &           nbdim)
+C
+CCC   Description:
+CCC   Subroutine for the interpolation of a 2D grid variable. 
+CCC   It calls Agrif_Interp_1D_recursive and Agrif_InterpBase.    
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER                   :: nbdim
+      INTEGER,DIMENSION(2)      :: TypeInterp
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL   , DIMENSION(nbdim) ::  s_child, s_parent
+      REAL   , DIMENSION(nbdim) :: ds_child,ds_parent
+      REAL   , DIMENSION(
+     &                indmin(nbdim-1):indmax(nbdim-1),
+     &                indmin(nbdim):indmax(nbdim)
+     &                ) :: tabin        
+      REAL   , DIMENSION(
+     &                pttab_child(nbdim-1):petab_child(nbdim-1),
+     &                pttab_child(nbdim):petab_child(nbdim)
+     &                ) :: tabout
+C
+C     Local variables      
+      REAL, DIMENSION(:,:), Allocatable :: tabtemp
+      INTEGER i,j
+C
+C        
+      Allocate(tabtemp(pttab_child(nbdim-1):petab_child(nbdim-1),
+     &                 indmin(nbdim):indmax(nbdim)))
+C
+C
+C     Commentaire perso : nbdim vaut toujours 2 ici.
+C
+      do j = indmin(nbdim),indmax(nbdim)
+C        
+        Call Agrif_Interp_1D_recursive(TypeInterp(1),
+     &         tabin(indmin(nbdim-1):indmax(nbdim-1),j),
+     &         tabtemp(pttab_child(nbdim-1):petab_child(nbdim-1),j),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C        
+      enddo
+C        
+      do i=pttab_child(nbdim-1),petab_child(nbdim-1)
+C
+        Call Agrif_InterpBase(TypeInterp(2),
+     &           tabtemp(i,indmin(nbdim):indmax(nbdim)),
+     &                  tabout(i,pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C        
+      enddo
+C                
+      Deallocate(tabtemp)
+C
+      Return
+C
+C
+      End Subroutine Agrif_Interp_2D_recursive
+C
+C
+C      
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_3D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Interp_3D_recursive(TypeInterp,tabin,tabout,
+     &           indmin,indmax,   
+     &           pttab_child,petab_child,
+     &           s_child,s_parent,ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine for the interpolation of a 3D grid variable. 
+CCC   It calls Agrif_Interp_2D_recursive and Agrif_InterpBase.    
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(3) :: TypeInterp
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent
+      REAL, DIMENSION(indmin(nbdim-2):indmax(nbdim-2),
+     &                indmin(nbdim-1):indmax(nbdim-1),
+     &                indmin(nbdim)  :indmax(nbdim)) :: tabin        
+      REAL, DIMENSION(pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                pttab_child(nbdim-1):petab_child(nbdim-1),
+     &                pttab_child(nbdim):petab_child(nbdim)) :: tabout
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:), Allocatable :: tabtemp
+      INTEGER i,j,k
+C
+C        
+      Allocate(tabtemp(pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                 pttab_child(nbdim-1):petab_child(nbdim-1),
+     &                 indmin(nbdim):indmax(nbdim)))
+C
+      do k = indmin(nbdim),indmax(nbdim)
+C        
+        Call Agrif_Interp_2D_recursive(TypeInterp(1:2),
+     &         tabin(indmin(nbdim-2):indmax(nbdim-2),
+     &         indmin(nbdim-1):indmax(nbdim-1),k),
+     &         tabtemp(pttab_child(nbdim-2):petab_child(nbdim-2),
+     &         pttab_child(nbdim-1):petab_child(nbdim-1),k),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C        
+      enddo
+C
+      do j=pttab_child(nbdim-1),petab_child(nbdim-1) 
+C        
+        do i=pttab_child(nbdim-2),petab_child(nbdim-2)
+C
+          Call Agrif_InterpBase(TypeInterp(3),
+     &           tabtemp(i,j,indmin(nbdim):indmax(nbdim)),
+     &           tabout(i,j,pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C
+        enddo 
+C       
+      enddo
+C                
+      Deallocate(tabtemp)
+C
+      Return
+C        
+C
+      End Subroutine Agrif_Interp_3D_recursive
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_4D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Interp_4D_recursive(TypeInterp,tabin,tabout,
+     &           indmin,indmax,   
+     &           pttab_child,petab_child,
+     &           s_child,s_parent,ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine for the interpolation of a 4D grid variable. 
+CCC   It calls Agrif_Interp_3D_recursive and Agrif_InterpBase.    
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(4) :: TypeInterp
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent
+      REAL, DIMENSION(indmin(nbdim-3):indmax(nbdim-3),
+     &                indmin(nbdim-2):indmax(nbdim-2),
+     &                indmin(nbdim-1):indmax(nbdim-1),
+     &                indmin(nbdim):indmax(nbdim)) :: tabin        
+      REAL, DIMENSION(pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                pttab_child(nbdim-1):petab_child(nbdim-1),
+     &                pttab_child(nbdim):petab_child(nbdim)) :: tabout
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:,:), Allocatable :: tabtemp
+      INTEGER i,j,k,l
+C
+C        
+      Allocate(tabtemp(pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                 pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                 pttab_child(nbdim-1):petab_child(nbdim-1),  
+     &                 indmin(nbdim):indmax(nbdim)))
+C
+      do l = indmin(nbdim),indmax(nbdim)
+C        
+        Call Agrif_Interp_3D_recursive(TypeInterp(1:3),
+     &         tabin(indmin(nbdim-3):indmax(nbdim-3),
+     &               indmin(nbdim-2):indmax(nbdim-2),
+     &               indmin(nbdim-1):indmax(nbdim-1),l),
+     &         tabtemp(pttab_child(nbdim-3):petab_child(nbdim-3),
+     &         pttab_child(nbdim-2):petab_child(nbdim-2),
+     &         pttab_child(nbdim-1):petab_child(nbdim-1),l),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C        
+      enddo
+C
+      do k = pttab_child(nbdim-1),petab_child(nbdim-1)
+C
+        do j = pttab_child(nbdim-2),petab_child(nbdim-2) 
+C        
+          do i = pttab_child(nbdim-3),petab_child(nbdim-3)
+C
+            Call Agrif_InterpBase(TypeInterp(4),
+     &           tabtemp(i,j,k,indmin(nbdim):indmax(nbdim)),
+     &           tabout(i,j,k,pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C
+          enddo
+C
+        enddo 
+C       
+      enddo
+C                
+      Deallocate(tabtemp)
+C
+      Return
+C
+C        
+      End Subroutine Agrif_Interp_4D_recursive
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_5D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Interp_5D_recursive(TypeInterp,tabin,tabout,
+     &           indmin,indmax,   
+     &           pttab_child,petab_child,
+     &           s_child,s_parent,ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine for the interpolation of a 5D grid variable. 
+CCC   It calls Agrif_Interp_4D_recursive and Agrif_InterpBase.    
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(5) :: TypeInterp
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent
+      REAL, DIMENSION(indmin(nbdim-4):indmax(nbdim-4),
+     &                indmin(nbdim-3):indmax(nbdim-3),
+     &                indmin(nbdim-2):indmax(nbdim-2),
+     &                indmin(nbdim-1):indmax(nbdim-1),
+     &                indmin(nbdim):indmax(nbdim)) :: tabin  
+      REAL, DIMENSION(pttab_child(nbdim-4):petab_child(nbdim-4),
+     &                pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                pttab_child(nbdim-1):petab_child(nbdim-1),
+     &                pttab_child(nbdim):petab_child(nbdim)) :: tabout
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:,:,:), Allocatable :: tabtemp
+      INTEGER i,j,k,l,m
+C
+C        
+      Allocate(tabtemp(pttab_child(nbdim-4):petab_child(nbdim-4),
+     &                 pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                 pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                 pttab_child(nbdim-1):petab_child(nbdim-1),    
+     &                 indmin(nbdim):indmax(nbdim)))
+C
+      do m = indmin(nbdim),indmax(nbdim)
+C        
+        Call Agrif_Interp_4D_recursive(TypeInterp(1:4),
+     &         tabin(indmin(nbdim-4):indmax(nbdim-4),
+     &               indmin(nbdim-3):indmax(nbdim-3),
+     &               indmin(nbdim-2):indmax(nbdim-2),
+     &               indmin(nbdim-1):indmax(nbdim-1),m),
+     &         tabtemp(pttab_child(nbdim-4):petab_child(nbdim-4),
+     &                 pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                 pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                 pttab_child(nbdim-1):petab_child(nbdim-1),m),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C        
+      enddo
+C
+      do l = pttab_child(nbdim-1),petab_child(nbdim-1) 
+C
+        do k = pttab_child(nbdim-2),petab_child(nbdim-2)
+C
+          do j = pttab_child(nbdim-3),petab_child(nbdim-3) 
+C        
+            do i = pttab_child(nbdim-4),petab_child(nbdim-4)
+C
+              Call Agrif_InterpBase(TypeInterp(5),
+     &             tabtemp(i,j,k,l,indmin(nbdim):indmax(nbdim)),
+     &                    tabout(i,j,k,l,
+     &             pttab_child(nbdim):petab_child(nbdim)),
+     &             indmin(nbdim),indmax(nbdim),
+     &             pttab_child(nbdim),petab_child(nbdim),
+     &             s_parent(nbdim),s_child(nbdim),
+     &             ds_parent(nbdim),ds_child(nbdim))
+C
+            enddo
+C
+          enddo
+C
+        enddo 
+C       
+      enddo
+C                
+      Deallocate(tabtemp)
+C
+      Return
+C
+C        
+      End Subroutine Agrif_Interp_5D_recursive
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Interp_6D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Interp_6D_recursive(TypeInterp,tabin,tabout,
+     &           indmin,indmax,   
+     &           pttab_child,petab_child,
+     &           s_child,s_parent,ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine for the interpolation of a 6D grid variable. 
+CCC   It calls Agrif_Interp_4D_recursive and Agrif_InterpBase.    
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(6) :: TypeInterp
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent
+      REAL, DIMENSION(indmin(nbdim-5):indmax(nbdim-5),
+     &                indmin(nbdim-4):indmax(nbdim-4),
+     &                indmin(nbdim-3):indmax(nbdim-3), 
+     &                indmin(nbdim-2):indmax(nbdim-2),
+     &                indmin(nbdim-1):indmax(nbdim-1),
+     &                indmin(nbdim):indmax(nbdim)) :: tabin        
+      REAL, DIMENSION(pttab_child(nbdim-5):petab_child(nbdim-5),
+     &                pttab_child(nbdim-4):petab_child(nbdim-4),
+     &                pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                pttab_child(nbdim-1):petab_child(nbdim-1),
+     &                pttab_child(nbdim):petab_child(nbdim)) :: tabout
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:,:,:,:), Allocatable :: tabtemp
+      INTEGER i,j,k,l,m,n
+C
+C        
+      Allocate(tabtemp(pttab_child(nbdim-5):petab_child(nbdim-5),
+     &                 pttab_child(nbdim-4):petab_child(nbdim-4),
+     &                 pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                 pttab_child(nbdim-2):petab_child(nbdim-2),    
+     &                 pttab_child(nbdim-1):petab_child(nbdim-1),    
+     &                 indmin(nbdim):indmax(nbdim)))
+C
+      do n = indmin(nbdim),indmax(nbdim)
+C        
+        Call Agrif_Interp_5D_recursive(TypeInterp(1:5),
+     &         tabin(indmin(nbdim-5):indmax(nbdim-5),
+     &               indmin(nbdim-4):indmax(nbdim-4),
+     &               indmin(nbdim-3):indmax(nbdim-3),
+     &               indmin(nbdim-2):indmax(nbdim-2),
+     &               indmin(nbdim-1):indmax(nbdim-1),n),
+     &         tabtemp(pttab_child(nbdim-5):petab_child(nbdim-5),
+     &                 pttab_child(nbdim-4):petab_child(nbdim-4),
+     &                 pttab_child(nbdim-3):petab_child(nbdim-3),
+     &                 pttab_child(nbdim-2):petab_child(nbdim-2),
+     &                 pttab_child(nbdim-1):petab_child(nbdim-1),n),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C        
+      enddo
+C
+      do m = pttab_child(nbdim-1),petab_child(nbdim-1) 
+      do l = pttab_child(nbdim-2),petab_child(nbdim-2) 
+C
+        do k = pttab_child(nbdim-3),petab_child(nbdim-3)
+C
+          do j = pttab_child(nbdim-4),petab_child(nbdim-4) 
+C        
+            do i = pttab_child(nbdim-5),petab_child(nbdim-5)
+C
+              Call Agrif_InterpBase(TypeInterp(6),
+     &             tabtemp(i,j,k,l,m,indmin(nbdim):indmax(nbdim)),
+     &                    tabout(i,j,k,l,m,
+     &                    pttab_child(nbdim):petab_child(nbdim)),
+     &             indmin(nbdim),indmax(nbdim),
+     &             pttab_child(nbdim),petab_child(nbdim),
+     &             s_parent(nbdim),s_child(nbdim),
+     &             ds_parent(nbdim),ds_child(nbdim))
+C
+            enddo
+C
+          enddo
+C
+        enddo 
+C       
+      enddo
+      enddo
+C                
+      Deallocate(tabtemp)
+C
+      Return
+C
+C        
+      End Subroutine Agrif_Interp_6D_recursive
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_InterpBase  
+C     **************************************************************************
+C  
+      Subroutine Agrif_InterpBase(TypeInterp,
+     &                           parenttab,childtab,
+     &                           indmin,indmax,pttab_child,petab_child,
+     &                           s_parent,s_child,ds_parent,ds_child)   
+C
+CCC   Description:
+CCC   Subroutine calling the interpolation method chosen by the user (linear, 
+CCC   lagrange or spline). 
+C
+C     Declarations:
+C
+      
+C
+      INTEGER                :: TypeInterp
+      INTEGER :: indmin,indmax
+      INTEGER :: pttab_child,petab_child
+      REAL,DIMENSION(indmin:indmax)           :: parenttab       
+      REAL,DIMENSION(pttab_child:petab_child) :: childtab      
+      REAL    :: s_parent,s_child,ds_parent,ds_child 
+C 
+C
+       IF ((indmin == indmax).AND.(pttab_child == petab_child)) THEN
+         childtab(pttab_child) = parenttab(indmin)
+       ELSEIF (TYPEinterp .EQ. AGRIF_LINEAR) then    
+C
+C         Linear interpolation         
+          Call linear1D
+     &         (parenttab,childtab,
+     &          indmax-indmin+1,petab_child-pttab_child+1,
+     &          s_parent,s_child,ds_parent,ds_child)
+C          
+        elseif (TYPEinterp .EQ. AGRIF_LAGRANGE) then
+C          
+C         Lagrange interpolation    
+          Call lagrange1D
+     &        (parenttab,childtab,
+     &         indmax-indmin+1,petab_child-pttab_child+1,
+     &         s_parent,s_child,ds_parent,ds_child)
+C            
+        elseif (TYPEinterp .EQ. AGRIF_ENO) then
+C          
+C         Eno interpolation
+          Call eno1D
+     &         (parenttab,childtab,
+     &         indmax-indmin+1,petab_child-pttab_child+1,
+     &         s_parent,s_child,ds_parent,ds_child)
+C              
+        Else if (TYPEinterp .EQ. AGRIF_LINEARCONSERV) then
+C          
+C         Linear conservative interpolation
+          
+          Call linear1Dconserv
+     &         (parenttab,childtab,
+     &         indmax-indmin+1,petab_child-pttab_child+1,
+     &         s_parent,s_child,ds_parent,ds_child)   
+C              
+        Else if (TYPEinterp .EQ. AGRIF_LINEARCONSERVLIM) then
+C          
+C         Linear conservative interpolation
+          
+          Call linear1Dconservlim
+     &         (parenttab,childtab,
+     &         indmax-indmin+1,petab_child-pttab_child+1,
+     &         s_parent,s_child,ds_parent,ds_child)         
+C              
+        elseif (TYPEinterp .EQ. AGRIF_CONSTANT) then
+C          
+          Call constant1D
+     &         (parenttab,childtab,
+     &         indmax-indmin+1,petab_child-pttab_child+1,
+     &         s_parent,s_child,ds_parent,ds_child)
+C              
+      elseif ( TYPEinterp .EQ. AGRIF_PPM ) then
+          Call ppm1D         
+     &         (parenttab,childtab,
+     &         indmax-indmin+1,petab_child-pttab_child+1,
+     &         s_parent,s_child,ds_parent,ds_child)
+C
+      endif 
+C
+C      
+      End Subroutine Agrif_InterpBase 
+C
+
+
+C                        
+      End Module Agrif_Interpolation
Index: /trunk/AGRIF/AGRIF_FILES/modinterpbasic.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modinterpbasic.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modinterpbasic.F	(revision 396)
@@ -0,0 +1,860 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Interpbasic
+C
+      Module Agrif_Interpbasic
+C
+CCC   Description:
+CCC   Module containing different procedures of interpolation (linear,lagrange,
+CCC   spline,...) used in the Agrif_Interpolation module.
+C
+C     Modules used:
+      USE Agrif_types
+C
+      IMPLICIT NONE
+C             
+      CONTAINS
+C     Define procedures contained in this module
+C 
+C
+C     **************************************************************************  
+CCC   Subroutine Linear1d  
+C     ************************************************************************** 
+C 
+      Subroutine Linear1d(x,y,np,nc,
+     &                    s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do a linear 1D interpolation on a child grid (vector y) from
+CCC   its parent grid (vector x).  
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C        
+C     Arguments
+      INTEGER             :: np,nc      
+      REAL, DIMENSION(np) :: x      
+      REAL, DIMENSION(nc) :: y  
+      REAL                :: s_parent,s_child,ds_parent,ds_child
+C
+C     Local scalars
+      INTEGER :: i,coeffraf,locind_parent_left
+      REAL    :: ypos,globind_parent_left
+C
+C
+
+      coeffraf = nint(ds_parent/ds_child)
+C
+      if (coeffraf == 1) then
+C
+          locind_parent_left = 1 + nint((s_child - s_parent)/ds_parent)
+C        
+          y(1:nc) = x(locind_parent_left:locind_parent_left+nc-1)
+C
+          return
+C
+      endif                          
+C
+      ypos = s_child      
+C
+      do i = 1,nc-1
+C
+        locind_parent_left = 1 + agrif_int((ypos - s_parent)/ds_parent)
+C
+        globind_parent_left = s_parent 
+     &                        + (locind_parent_left - 1)*ds_parent
+C        
+        y(i) = ((globind_parent_left + ds_parent - ypos)
+     &          *x(locind_parent_left)
+     &        + (ypos - globind_parent_left)
+     &          *x(locind_parent_left+1))
+     &         / ds_parent                
+C
+        ypos = ypos + ds_child
+C
+      enddo
+C
+      locind_parent_left = 1 + agrif_int((ypos - s_parent)/ds_parent)
+C
+      if (locind_parent_left == np) then
+C
+          y(nc) = x(np)
+C
+        else
+C
+          globind_parent_left = s_parent 
+     &                        + (locind_parent_left - 1)*ds_parent  
+C      
+          y(nc) = ((globind_parent_left + ds_parent - ypos)
+     &            *x(locind_parent_left)
+     &          + (ypos - globind_parent_left)
+     &            *x(locind_parent_left+1))
+     &           / ds_parent     
+C
+      endif                                          
+C           
+      Return
+C
+C       
+      End Subroutine Linear1d   
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Lagrange1d  
+C     **************************************************************************
+C
+      Subroutine Lagrange1d(x,y,np,nc,
+     &                      s_parent,s_child,ds_parent,ds_child)
+C
+CCC   Description:
+CCC   Subroutine to do a lagrange 1D interpolation on a child grid (vector y) 
+CCC   from its parent grid (vector x).  
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C             
+C     Arguments
+      INTEGER             :: np,nc      
+      REAL, DIMENSION(np) :: x      
+      REAL, DIMENSION(nc) :: y  
+      REAL                :: s_parent,s_child,ds_parent,ds_child 
+C
+C     Local scalars
+      INTEGER :: i,coeffraf,locind_parent_left
+      REAL    :: ypos,globind_parent_left
+      REAL    :: X1,X2,X3 
+C
+C 
+      if (np <= 2) then
+C      
+          Call Linear1D(x,y,np,nc,
+     &                  s_parent,s_child,ds_parent,ds_child)
+C         
+         Return
+C 
+      endif
+C
+      coeffraf = nint(ds_parent/ds_child)
+C
+      if (coeffraf == 1) then
+C
+          locind_parent_left = 1 + nint((s_child - s_parent)/ds_parent)
+C        
+          y(1:nc) = x(locind_parent_left:locind_parent_left+nc-1)
+C
+          return
+C
+      endif
+C
+      ypos = s_child      
+C
+      do i = 1,nc
+C
+        locind_parent_left = 1 + agrif_int((ypos - s_parent)/ds_parent)
+C
+        globind_parent_left = s_parent 
+     &                        + (locind_parent_left - 1)*ds_parent 
+C
+        if (locind_parent_left+2 <= np) then            
+C
+            X1 = (x(locind_parent_left+1)-x(locind_parent_left))
+     &           /ds_parent
+C 
+            X2 = (x(locind_parent_left+2)-x(locind_parent_left+1))
+     &           /ds_parent
+C
+            X3 = (X2 - X1)/(2.*ds_parent)                 
+C
+            y(i) = x(locind_parent_left) + 
+     &             (ypos - globind_parent_left)*X1 +
+     &             (ypos - globind_parent_left)*
+     &             (ypos - globind_parent_left - ds_parent)*X3 
+C
+          elseif (locind_parent_left+1 <= np) then 
+C
+            X1 = (x(locind_parent_left)-x(locind_parent_left-1))
+     &           /ds_parent
+C     
+            X2 = (x(locind_parent_left+1)-x(locind_parent_left))
+     &           /ds_parent
+C 
+            X3 = (X2 - X1)/(2.*ds_parent)                 
+C
+            y(i) = x(locind_parent_left-1) + 
+     &             (ypos - globind_parent_left - ds_parent)*X1 +
+     &             (ypos - globind_parent_left - ds_parent)*
+     &             (ypos - globind_parent_left)*X3
+C
+          else
+C
+            X1 = (x(locind_parent_left-1)-x(locind_parent_left-2))
+     &           /ds_parent
+C     
+            X2 = (x(locind_parent_left)-x(locind_parent_left-1))
+     &           /ds_parent
+C 
+            X3 = (X2 - X1)/(2.*ds_parent)                 
+C
+            y(i) = x(locind_parent_left-2) + 
+     &             (ypos - globind_parent_left - 2.*ds_parent)*X1 +
+     &             (ypos - globind_parent_left - 2.*ds_parent)*
+     &             (ypos - globind_parent_left - ds_parent)*X3
+C
+        endif   
+C       
+        ypos = ypos + ds_child 
+C
+      enddo
+C
+      return
+C
+C       
+      End Subroutine Lagrange1d 
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Constant1d  
+C     ************************************************************************** 
+C 
+      Subroutine constant1d(x,y,np,nc,
+     &                    s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do a linear 1D interpolation on a child grid (vector y) from
+CCC   its parent grid (vector x).  
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C        
+C     Arguments
+      INTEGER             :: np,nc      
+      REAL, DIMENSION(np) :: x      
+      REAL, DIMENSION(nc) :: y  
+      REAL                :: s_parent,s_child,ds_parent,ds_child
+C
+C     Local scalars
+      INTEGER :: i,coeffraf,locind_parent
+      REAL    :: ypos
+C
+C
+
+      coeffraf = nint(ds_parent/ds_child)
+C
+      if (coeffraf == 1) then
+C
+          locind_parent = 1 + nint((s_child - s_parent)/ds_parent)
+C        
+          y(1:nc) = x(locind_parent:locind_parent+nc-1)
+C
+          return
+C
+      endif                          
+C
+      ypos = s_child      
+C
+      do i = 1,nc
+C
+        locind_parent = 1 + nint((ypos - s_parent)/ds_parent)
+C
+        y(i) = x(locind_parent)
+C
+        ypos = ypos + ds_child
+C
+      enddo
+C           
+      Return
+C
+C       
+      End Subroutine constant1d   
+C
+C     **************************************************************************  
+CCC   Subroutine Linear1dconserv
+C     ************************************************************************** 
+C 
+      Subroutine Linear1dconserv(x,y,np,nc,
+     &                    s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do a linear 1D interpolation on a child grid (vector y) from
+CCC   its parent grid (vector x).  
+C
+CC    Method:
+C
+C     Declarations:
+C
+      Implicit none
+C        
+C     Arguments
+      Integer             :: np,nc      
+      Real, Dimension(np) :: x      
+      Real, Dimension(nc) :: y
+      Real, Dimension(:),Allocatable :: ytemp
+      Real                :: s_parent,s_child,ds_parent,ds_child
+C
+C     Local scalars
+      Integer :: i,coeffraf,locind_parent_left,locind_parent_last
+      Real    :: ypos
+      integer :: i1,i2,ii
+      real :: xpmin,xpmax,slope
+      INTEGER :: diffmod
+      REAL :: xdiffmod
+
+C
+C
+
+      coeffraf = nint(ds_parent/ds_child)
+C
+      If (coeffraf == 1) Then
+C
+          locind_parent_left = 1 + nint((s_child - s_parent)/ds_parent)
+C        
+          y(1:nc) = x(locind_parent_left:locind_parent_left+nc-1)
+C
+          return
+C
+      End If
+C              
+      diffmod = 0
+      IF (mod(coeffraf,2) == 0) diffmod = 1  
+
+      xdiffmod = real(diffmod)/2.
+                         
+      allocate(ytemp(-2*coeffraf:nc+2*coeffraf))
+C
+      ypos = s_child  
+C      
+      locind_parent_left = 1 + agrif_int((ypos - s_parent)/ds_parent) 
+
+      locind_parent_last = 1 +
+     &  agrif_ceiling((ypos +(nc - 1) *ds_child - s_parent)/ds_parent)
+     
+      xpmin = s_parent + (locind_parent_left-1)*ds_parent 
+      xpmax = s_parent + (locind_parent_last-1)*ds_parent          
+      
+      i1 = 1+agrif_int((xpmin-s_child)/ds_child)
+      i2 = 1+agrif_int((xpmax-s_child)/ds_child)
+
+      i = i1
+      
+      if (locind_parent_left == 1) then
+        slope=
+     &   (x(locind_parent_left+1)-x(locind_parent_left))/(coeffraf)
+      else
+         slope=
+     &   (x(locind_parent_left+1)-x(locind_parent_left-1))/(2.*coeffraf)
+      endif
+      
+        do ii=i-coeffraf/2+diffmod,i+coeffraf/2
+          ytemp(ii) = x(locind_parent_left)+(ii-i-xdiffmod/2.)*slope
+        enddo 
+
+        locind_parent_left = locind_parent_left + 1
+                      
+      do i=i1 +  coeffraf, i2 - coeffraf,coeffraf
+        slope=
+     &   (x(locind_parent_left+1)-x(locind_parent_left-1))/(2.*coeffraf)
+        do ii=i-coeffraf/2+diffmod,i+coeffraf/2
+          ytemp(ii) = x(locind_parent_left)+(ii-i-xdiffmod/2.)*slope
+        enddo
+        locind_parent_left = locind_parent_left + 1
+      enddo
+      
+      i = i2
+      
+      if (locind_parent_left == np) then
+        slope=
+     &   (x(locind_parent_left)-x(locind_parent_left-1))/(coeffraf)
+      else
+         slope=
+     &   (x(locind_parent_left+1)-x(locind_parent_left-1))/(2.*coeffraf)
+      endif
+      
+        do ii=i-coeffraf/2+diffmod,nc
+          ytemp(ii) = x(locind_parent_left)+(ii-i-xdiffmod/2.)*slope
+        enddo      
+C
+      y(1:nc)=ytemp(1:nc)                                   
+C           
+      deallocate(ytemp)
+      Return
+C       
+      End Subroutine Linear1dconserv
+      
+C
+C     **************************************************************************  
+CCC   Subroutine Linear1dconservlim
+C     ************************************************************************** 
+C 
+      Subroutine Linear1dconservlim(x,y,np,nc,
+     &                    s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do a linear 1D interpolation on a child grid (vector y) from
+CCC   its parent grid (vector x).  
+C
+CC    Method:
+C
+C     Declarations:
+C
+      Implicit none
+C        
+C     Arguments
+      Integer             :: np,nc      
+      Real, Dimension(np) :: x      
+      Real, Dimension(nc) :: y
+      Real, Dimension(:),Allocatable :: ytemp
+      Real                :: s_parent,s_child,ds_parent,ds_child
+C
+C     Local scalars
+      Integer :: i,coeffraf,locind_parent_left,locind_parent_last
+      Real    :: ypos
+      integer :: i1,i2,ii
+      real :: xpmin,xpmax,slope
+      INTEGER :: diffmod
+      real :: xdiffmod
+C
+C
+
+      coeffraf = nint(ds_parent/ds_child)
+C
+      If (coeffraf == 1) Then
+C
+          locind_parent_left = 1 + nint((s_child - s_parent)/ds_parent)
+C        
+          y(1:nc) = x(locind_parent_left:locind_parent_left+nc-1)
+C
+          return
+C
+      End If
+C
+      IF (coeffraf .NE.3) THEN
+      print *,'LINEARCONSERVLIM not ready for refinement ratio = ',
+     &   coeffraf
+      stop
+      ENDIF   
+      
+      diffmod = 0
+      IF (mod(coeffraf,2) == 0) diffmod = 1        
+
+      xdiffmod = real(diffmod)/2.
+                         
+      allocate(ytemp(-2*coeffraf:nc+2*coeffraf))
+C
+      ypos = s_child  
+C      
+      locind_parent_left = 1 + agrif_int((ypos - s_parent)/ds_parent) 
+
+      locind_parent_last = 1 +
+     &  agrif_ceiling((ypos +(nc - 1) *ds_child - s_parent)/ds_parent)
+     
+      xpmin = s_parent + (locind_parent_left-1)*ds_parent 
+      xpmax = s_parent + (locind_parent_last-1)*ds_parent          
+      
+      i1 = 1+agrif_int((xpmin-s_child)/ds_child)
+      i2 = 1+agrif_int((xpmax-s_child)/ds_child)
+
+      i = i1
+      
+      if (locind_parent_left == 1) then
+        slope=0.       
+      else
+        slope = vanleer(x(locind_parent_left-1:locind_parent_left+1))
+        slope = slope / coeffraf    
+      endif
+      
+        do ii=i-coeffraf/2+diffmod,i+coeffraf/2
+          ytemp(ii) = x(locind_parent_left)+(ii-i-xdiffmod/2.)*slope
+        enddo 
+
+        locind_parent_left = locind_parent_left + 1
+                      
+      do i=i1 +  coeffraf, i2 - coeffraf,coeffraf     
+        slope = vanleer(x(locind_parent_left-1:locind_parent_left+1))
+        slope = slope / coeffraf
+
+        do ii=i-coeffraf/2+diffmod,i+coeffraf/2
+          ytemp(ii) = x(locind_parent_left)+(ii-i-xdiffmod/2.)*slope
+        enddo
+        locind_parent_left = locind_parent_left + 1
+      enddo
+      
+      i = i2
+      
+      if (locind_parent_left == np) then
+        slope=0.     
+      else
+        slope = vanleer(x(locind_parent_left-1:locind_parent_left+1))
+        slope = slope / coeffraf      
+      endif
+      
+        do ii=i-coeffraf/2+diffmod,nc
+          ytemp(ii) = x(locind_parent_left)+(ii-i-xdiffmod/2.)*slope
+        enddo      
+C
+      y(1:nc)=ytemp(1:nc)                                   
+C           
+      deallocate(ytemp)
+      Return
+C       
+      End Subroutine Linear1dconservlim      
+C         
+
+C     **************************************************************************  
+CCC   Subroutine ppm1d
+C     ************************************************************************** 
+C 
+      Subroutine ppm1d(x,y,np,nc,
+     &                    s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do a 1D interpolation and apply monotonicity constraints
+CCC   using piecewise parabolic method  
+CCC   on a child grid (vector y) from its parent grid (vector x).
+CC    Method:
+C
+C     Declarations:
+C
+      Implicit none
+C        
+C     Arguments
+      Integer             :: np,nc      
+      Real, Dimension(np) :: x      
+      Real, Dimension(nc) :: y
+      Real, Dimension(:),Allocatable :: ytemp
+      Real                :: s_parent,s_child,ds_parent,ds_child
+C
+C     Local scalars
+      Integer :: i,coeffraf,locind_parent_left,locind_parent_last
+      Integer :: iparent,ipos,pos,nmin,nmax
+      Real    :: ypos
+      integer :: i1,jj
+      Real :: xpmin,cavg,a,b
+C      
+      Real :: xrmin,xrmax,am3,s2,s1  
+      Real, Dimension(np) :: dela,xr,xl,delta,a6,slope,slope2
+      Real, Dimension(:),Allocatable  :: diff,diff2,diff3    
+      INTEGER :: diffmod
+C      
+      coeffraf = nint(ds_parent/ds_child)
+C
+      If (coeffraf == 1) Then
+          locind_parent_left = 1 + nint((s_child - s_parent)/ds_parent)
+          y(1:nc) = x(locind_parent_left:locind_parent_left+nc-1)
+          return
+      End If
+C      
+      Allocate(ytemp(-2*coeffraf:nc+2*coeffraf))
+      ypos = s_child  
+C
+      locind_parent_left = 1 + agrif_int((ypos - s_parent)/ds_parent) 
+      locind_parent_last = 1 +
+     &      agrif_ceiling((ypos +(nc - 1) 
+     &      *ds_child - s_parent)/ds_parent)  
+C
+      xpmin = s_parent + (locind_parent_left-1)*ds_parent       
+      i1 = 1+agrif_int((xpmin-s_child)/ds_child)        
+C     
+      Allocate( diff(coeffraf),diff2(coeffraf),diff3(coeffraf) )
+C      
+         diff(:) = ds_child/ds_parent
+C      
+      Do i=1,coeffraf
+         a = real(i-1)*ds_child/ds_parent
+         b = real(i)*ds_child/ds_parent
+         diff2(i) = 0.5*(b*b - a*a)  
+         diff3(i) = (1./3.)*(b*b*b - a*a*a)
+      End do
+C
+      if( locind_parent_last+2 <= np ) then
+           nmax = locind_parent_last+2    
+      else if( locind_parent_last+1 <= np ) then
+           nmax = locind_parent_last+1
+      else
+           nmax = locind_parent_last 
+      endif     
+C      
+      if(locind_parent_left-1 >= 1) then
+          nmin = locind_parent_left-1
+      else 
+          nmin = locind_parent_left
+      endif    
+C 
+      Do i = nmin,nmax
+         slope(i) = x(i) - x(i-1)
+         slope2(i) = 2.*abs(slope(i))
+      Enddo
+C
+      Do i = nmin,nmax-1
+         dela(i) = 0.5 * ( slope(i) + slope(i+1) )
+C Van Leer slope limiter
+         dela(i) = min( abs(dela(i)),slope2(i),
+     &                  slope2(i+1) )*sign(1.,dela(i))
+         IF( slope(i)*slope(i+1) <= 0. ) dela(i) = 0.
+      Enddo
+C
+      Do i = nmin,nmax-2
+         xr(i) = x(i) + (1./2.)*slope(i+1) + (-1./6.)*dela(i+1)
+     &                                     + ( 1./6. )*dela(i)
+      Enddo
+C
+      Do i = nmin,nmax-2
+         xrmin = min(x(i),x(i+1))
+         xrmax = max(x(i),x(i+1))
+         xr(i) = min(xr(i),xrmax)
+         xr(i) = max(xr(i),xrmin)
+         xl(i+1) = xr(i)         
+      Enddo
+C apply parabolic monotonicity
+       Do i = locind_parent_left,locind_parent_last
+          If( ( (xr(i)-x(i))* (x(i)-xl(i)) ) .le. 0. ) then
+             xl(i) = x(i) 
+             xr(i) = x(i)
+          Endif          
+          delta(i) = xr(i) - xl(i)
+          am3 = 3. * x(i)
+          s1  = am3 - 2. * xr(i)
+          s2  = am3 - 2. * xl(i)
+          IF( delta(i) * (xl(i) - s1) .le. 0. ) xl(i) = s1
+          IF( delta(i) * (s2 - xr(i)) .le. 0. ) xr(i) = s2
+          delta(i) = xr(i) - xl(i)
+          a6(i) = 6.*x(i)-3.*(xl(i) +xr(i))
+C
+       End do   
+C
+        diffmod = 0
+	IF (mod(coeffraf,2) == 0) diffmod = 1           
+C
+        ipos = i1
+C               
+        Do iparent = locind_parent_left,locind_parent_last       
+             pos=1
+             cavg = 0.
+             Do jj = ipos - coeffraf/2+diffmod,ipos + coeffraf/2
+C
+               ytemp(jj) = (diff(pos)*xl(iparent)   
+     &             + diff2(pos)
+     &             *  (delta(iparent)+a6(iparent))
+     &             - diff3(pos)*a6(iparent))*coeffraf
+                              
+               cavg = cavg + ytemp(jj)
+               pos = pos+1 
+             End do 
+             ipos = ipos + coeffraf
+C
+        End do     
+C
+C
+        y(1:nc)=ytemp(1:nc)                                 
+        deallocate(ytemp)                
+        deallocate(diff, diff2, diff3)
+      Return
+      End Subroutine ppm1d
+C                              
+C     **************************************************************************  
+CCC   Subroutine eno1d
+C     ************************************************************************** 
+C 
+      Subroutine eno1d(x,y,np,nc,
+     &                    s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   ---- p 163-164 Computational gasdynamics ----
+CCC   Subroutine to do a 1D interpolation 
+CCC   using piecewise polynomial ENO reconstruction technique  
+CCC   on a child grid (vector y) from its parent grid (vector x).
+CC    Method:
+C
+C     Declarations:
+C
+      Implicit none
+C        
+C     Arguments
+      Integer             :: np,nc      
+      Real, Dimension(np) :: x      
+      Real, Dimension(nc) :: y
+      Real, Dimension(:),Allocatable :: ytemp
+      Real                :: s_parent,s_child,ds_parent,ds_child
+C
+C     Local scalars
+      Integer :: i,coeffraf,locind_parent_left,locind_parent_last
+      Integer :: ipos,pos
+      Real    :: ypos,xi
+      integer :: i1,jj
+      Real :: xpmin,cavg
+C 
+      Real, Dimension(3,np) :: dd,c
+      Integer :: left
+C           
+      Real, DImension(1:np+1) :: xhalf
+      Real, Dimension(:,:),Allocatable  :: Xbar 
+      INTEGER :: diffmod     
+C
+      coeffraf = nint(ds_parent/ds_child)
+C      
+      If (coeffraf == 1) Then
+          locind_parent_left = 1 + nint((s_child - s_parent)/ds_parent)
+          y(1:nc) = x(locind_parent_left:locind_parent_left+nc-1)
+          return
+      End If     
+      
+      diffmod = 0
+      IF (mod(coeffraf,2) == 0) diffmod = 1  
+C      
+      Allocate(ytemp(-2*coeffraf:nc+2*coeffraf))
+      ypos = s_child  
+      locind_parent_left = 1 + agrif_int((ypos - s_parent)/ds_parent) 
+      locind_parent_last = 1 +
+     &      agrif_ceiling((ypos +(nc - 1) *ds_child - 
+     &      s_parent)/ds_parent)       
+      xpmin = s_parent + (locind_parent_left-1)*ds_parent      
+      i1 = 1+agrif_int((xpmin-s_child)/ds_child)           
+C      
+      xhalf(np+1) = np + 0.5
+      Do i = 1,np
+          xhalf(i) = i - 0.5
+      Enddo
+C
+C compute divided differences
+C
+      dd(1,1:np) = x(1:np)
+      dd(2,1:np-1) = 0.5*( dd(1,2:np) - dd(1,1:np-1) )
+      dd(3,1:np-2) = (1./3.)*( dd(2,2:np-1) - dd(2,1:np-2) )
+C
+      Allocate( Xbar( coeffraf,2 ) )
+      xi = 0.5
+      Do i = 1,coeffraf
+        Xbar(i,1) = (i-1)*ds_child/ds_parent - xi
+        Xbar(i,2) = i*ds_child/ds_parent - xi
+      Enddo
+C
+      ipos = i1
+C           
+      DO i = locind_parent_left,locind_parent_last           
+         left = i           
+         do jj = 2,3
+             If(abs(dd(jj,left)) .gt. abs(dd(jj,left-1)))
+     &               left = left-1            
+         enddo
+C           
+C  convert to Taylor series form
+C
+         Call Taylor(i,xhalf(left:left+2),dd(1:3,left),c(1:3,i))
+      ENDDO     
+C
+C evaluate the reconstruction on each cell
+C
+       DO i = locind_parent_left,locind_parent_last  
+C
+         cavg = 0.
+         pos = 1.            
+C         
+         Do jj = ipos - coeffraf/2+diffmod,ipos + coeffraf/2
+           ytemp(jj) =(c(1,i)*(Xbar(pos,2)-Xbar(pos,1))
+     &                +c(2,i)*(Xbar(pos,2)*Xbar(pos,2)-
+     &                         Xbar(pos,1)*Xbar(pos,1))
+     &                +c(3,i)*(Xbar(pos,2)*Xbar(pos,2)*Xbar(pos,2)-
+     &                         Xbar(pos,1)*Xbar(pos,1)*Xbar(pos,1)))
+     &                         *coeffraf
+           cavg = cavg + ytemp(jj)
+           pos = pos+1
+         Enddo                
+         ipos = ipos + coeffraf                 
+      ENDDO
+C
+      y(1:nc)=ytemp(1:nc)                                            
+      deallocate(ytemp,Xbar)                 
+C      
+      Return       
+      End Subroutine eno1d
+C 
+C      
+C     **************************************************************************  
+CCC   Subroutine taylor
+C     ************************************************************************** 
+C       
+      subroutine taylor(ind,xhalf,dd,c)      
+C      
+      Integer :: ind
+      real,dimension(3) :: dd,c     
+      real,dimension(0:3,0:3) :: d 
+      real,dimension(3) :: xhalf    
+      integer ::i,j
+C      
+C
+      d(0,0:3)=1.
+      do i = 1,3
+         d(i,0)=(ind-xhalf(i))*d(i-1,0)
+      enddo  
+C      
+      do i = 1,3
+         do j = 1,3-i
+           d(i,j) = d(i,j-1) + (ind-xhalf(i+j))*d(i-1,j)
+         enddo
+      enddo
+C         
+      do j = 1,3        
+         c(j) = 0.
+         do i=0,3-j
+            c(j) = c(j) + d(i,j)*dd(i+j)         
+         enddo
+      enddo
+C      
+      end subroutine taylor    
+      
+      
+      REAL FUNCTION vanleer(tab)
+      REAL, DIMENSION(3) :: tab
+       real res1
+       real p1,p2,p3
+       
+       p1=(tab(3)-tab(1))/2.
+       p2=2.*(tab(2)-tab(1))
+       p3=2.*(tab(3)-tab(2))
+       
+       if ((p1>0.).AND.(p2>0.).AND.(p3>0)) then
+          res1=minval((/p1,p2,p3/))
+       elseif ((p1<0.).AND.(p2<0.).AND.(p3<0)) then
+          res1=maxval((/p1,p2,p3/))
+       else
+          res1=0.
+       endif
+          
+          vanleer = res1   
+      
+      
+      END FUNCTION vanleer 
+
+C      
+      End Module Agrif_Interpbasic
Index: /trunk/AGRIF/AGRIF_FILES/modlinktomodel.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modlinktomodel.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modlinktomodel.F	(revision 396)
@@ -0,0 +1,173 @@
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place -  Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+      Module Agrif_link
+C
+CCC   Description:
+CCC   This module is used to link AGRIF files to the model
+C
+C     Modules used: 
+C
+c        external Agrif_InitValues
+c        external Agrif_InitWorkspace
+c        external Agrif_detect
+C
+      IMPLICIT NONE        
+        external Agrif_probdim_modtype_def
+        external Agrif_clustering_def
+C     Interface                       
+      Interface
+         Subroutine Agrif_Set_numberofcells(Agrif_Gr)
+         Use Agrif_Types, Only : Agrif_grid
+         TYPE(Agrif_Grid), Pointer :: Agrif_Gr   ! Pointer on the current grid  
+         End Subroutine Agrif_Set_numberofcells
+        
+         Subroutine Agrif_Get_numberofcells(Agrif_Gr)
+         Use Agrif_Types, Only : Agrif_grid
+         TYPE(Agrif_Grid), Pointer :: Agrif_Gr   ! Pointer on the current grid  
+         End Subroutine Agrif_Get_numberofcells
+         
+         Subroutine Agrif_Allocationcalls(Agrif_Gr)
+         Use Agrif_Types, Only : Agrif_grid
+         TYPE(Agrif_Grid), Pointer :: Agrif_Gr   ! Pointer on the current grid  
+         End Subroutine Agrif_Allocationcalls
+      End interface
+   
+      End Module Agrif_link
+C     **************************************************************************
+CCC   Function Agrif_parent
+C        modify by conv. To use : un_parent = Agrif_Parent(un)
+C     **************************************************************************
+CCC   Function Agrif_Get_Coarse_Grid
+C        modify by conv. To use : un_Mygrid = Agrif_Get_Coarse_grid(un)
+C     **************************************************************************
+CCC   Function Agrif_Rhox
+C        modify by conv. To use : var = Agrif_Rhox()
+C                    REAL(Agrif_Curgrid % spaceref(1))
+C     **************************************************************************
+CCC   Function Agrif_Parent_Rhox
+C        modify by conv. To use : var = Agrif_Parent_Rhox()
+C                    REAL(Agrif_Curgrid % parent % spaceref(1))
+C     **************************************************************************
+CCC   Function Agrif_Irhox
+C        modify by conv. To use : var = Agrif_Parent_IRhox()
+C                    Agrif_Curgrid % spaceref(1)
+C     **************************************************************************
+CCC   Function Agrif_Parent_Irhox
+C        modify by conv. To use : var = Agrif_Parent_IRhox()
+C                    Agrif_Curgrid % parent % spaceref(1)
+C     **************************************************************************
+CCC   Function Agrif_Rhoy
+C        modify by conv. To use : var = Agrif_Rhoy()
+C                    REAL(Agrif_Curgrid % spaceref(2))
+C     **************************************************************************
+CCC   Function Agrif_Parent_Rhoy
+C        modify by conv. To use : var = Agrif_Parent_Rhoy()
+C                    REAL(Agrif_Curgrid % parent % spaceref(2))
+C     **************************************************************************
+CCC   Function Agrif_Irhoy
+C        modify by conv. To use : var = Agrif_Parent_IRhoy()
+C                    Agrif_Curgrid % spaceref(2)
+C     **************************************************************************
+CCC   Function Agrif_Parent_Irhoy
+C        modify by conv. To use : var = Agrif_Parent_IRhoy()
+C                    Agrif_Curgrid % parent % spaceref(2)
+C     **************************************************************************
+CCC   Function Agrif_Rhoz
+C        modify by conv. To use : var = Agrif_Rhoz()
+C                    REAL(Agrif_Curgrid % spaceref(3))
+C     **************************************************************************
+CCC   Function Agrif_Parent_Rhoz
+C        modify by conv. To use : var = Agrif_Parent_Rhoz()
+C                    REAL(Agrif_Curgrid % parent % spaceref(3))
+C     **************************************************************************
+CCC   Function Agrif_Irhoz
+C        modify by conv. To use : var = Agrif_Parent_IRhoz()
+C                    Agrif_Curgrid % spaceref(3)
+C     **************************************************************************
+CCC   Function Agrif_Parent_Irhoz
+C        modify by conv. To use : var = Agrif_Parent_IRhoz()
+C                    Agrif_Curgrid % parent % spaceref(3)
+C     **************************************************************************
+CCC   Function Agrif_NearCommonBorderX
+C        modify by conv. To use : var = Agrif_NearCommonBorderX()
+C                       AGRIF_CURGRID % NearRootBorder(1)
+C     **************************************************************************
+CCC   Function Agrif_NearCommonBorderY
+C        modify by conv. To use : var = Agrif_NearCommonBorderY()
+C                       AGRIF_CURGRID % NearRootBorder(2)
+C     **************************************************************************
+CCC   Function Agrif_NearCommonBorderZ
+C        modify by conv. To use : var = Agrif_NearCommonBorderZ()
+C                       AGRIF_CURGRID % NearRootBorder(3)
+C     **************************************************************************
+CCC   Function Agrif_DistantCommonBorderX
+C        modify by conv. To use : var = Agrif_DistantCommonBorderX()
+C                       AGRIF_CURGRID % DistantRootBorder(1)
+C     **************************************************************************
+CCC   Function Agrif_DistantCommonBorderY
+C        modify by conv. To use : var = Agrif_DistantCommonBorderY()
+C                       AGRIF_CURGRID % DistantRootBorder(2)
+C     **************************************************************************
+CCC   Function Agrif_DistantCommonBorderZ
+C        modify by conv. To use : var = Agrif_DistantCommonBorderZ()
+C                       AGRIF_CURGRID % DistantRootBorder(3)
+C     **************************************************************************
+CCC   Function Agrif_Nb_Step
+C        modify by conv. To use : var = Agrif_Nb_Step()
+C                          AGRIF_CURGRID % ngridstep
+C     **************************************************************************
+CCC   Function Agrif_Nb_Fine_Grids
+C        modify by conv. To use : var = Agrif_Nb_Fine_Grids()
+C                         Agrif_nbfixedgrids 
+C     **************************************************************************
+CCC   Function Agrif_Ix
+C        modify by conv. To use : var = Agrif_Ix()
+C                         Agrif_CURGRID % ix(1) 
+C     **************************************************************************
+CCC   Function Agrif_Parent_Ix
+C        modify by conv. To use : var = Agrif_Parent_Ix()
+C                        Agrif_CURGRID % parent % ix(1) 
+C     **************************************************************************
+CCC   Function Agrif_Iy
+C        modify by conv. To use : var = Agrif_Iy()
+C                        AGRIF_CURGRID % ix(2) 
+C     **************************************************************************
+CCC   Function Agrif_Parent_Iy
+C        modify by conv. To use : var = Agrif_Parent_Iy()
+C                       Agrif_CURGRID % parent % ix(2) 
+C     **************************************************************************
+CCC   Function Agrif_Iz
+C        modify by conv. To use : var = Agrif_Iz()
+C                      AGRIF_CURGRID % ix(3) 
+C     **************************************************************************
+CCC   Function Agrif_Parent_Iz
+C        modify by conv. To use : var = Agrif_Parent_Iz()
+C                     Agrif_CURGRID % parent % ix(3) 
+C     **************************************************************************
+CCC   Function Agrif_Get_grid_id
+C        modify by conv. To use : var = Agrif_Get_grid_id()
+C                    Agrif_CURGRID % grid_id
+C     **************************************************************************
+CCC   Function Agrif_Get_parent_id
+C        modify by conv. To use : var = Agrif_Get_parent_id()
+C                    Agrif_CURGRID % parent % grid_id
+C     **************************************************************************
Index: /trunk/AGRIF/AGRIF_FILES/modmask.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modmask.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modmask.F	(revision 396)
@@ -0,0 +1,365 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place -  Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Mask
+C
+      Module Agrif_Mask
+C
+CCC   Description:
+CCC   Module for masks
+C
+C     Modules used: 
+C
+      Use Agrif_Types       
+C
+      IMPLICIT NONE
+      Integer, Parameter :: MaxSearch = 5
+C
+      CONTAINS
+C     Define procedures contained in this module
+C
+C     **************************************************************************
+C     Subroutine Agrif_CheckMasknD
+C     **************************************************************************
+C       
+      Subroutine Agrif_CheckMasknD(tempP,parent,pbtab,petab,ppbtab,
+     &               ppetab,noraftab,nbdim)
+C
+CCC   Description:
+CCC   Subroutine called in the procedure Agrif_InterpnD to recalculate the value 
+CCC   of the parent grid variable when this one is equal to Agrif_SpecialValue. 
+C
+C     Declarations:
+C
+       
+C
+C     Arrays arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(nbdim) :: pbtab  ! Limits of the parent grid used  
+      INTEGER,DIMENSION(nbdim) :: petab  ! interpolation of the child grid
+      LOGICAL,DIMENSION(nbdim) :: noraftab
+      INTEGER,DIMENSION(nbdim) :: ppbtab,ppetab
+C
+C     Pointer argument
+      TYPE(AGRIF_PVARIABLE) :: tempP  ! Part of the parent grid used for 
+                                      ! the interpolation of the child grid                     
+C     Data TYPE argument                                   
+      TYPE(AGRIF_PVARIABLE) :: parent      ! The parent grid
+C
+C     Local scalar
+      INTEGER                   :: i0,j0,k0,l0,m0,n0
+C      
+C     Local arrays
+C
+C      
+      SELECT CASE (nbdim)
+      CASE (1)
+         do i0 = pbtab(1),petab(1)
+         IF (tempP%var%array1(i0)
+     &                        == Agrif_SpecialValue) Then
+            Call CalculNewValTempP((/i0/),
+     &                             tempP,parent,
+     &                             ppbtab,ppetab,
+     &                             noraftab,nbdim)
+         ENDIF
+         enddo
+      CASE (2)
+         do j0 = pbtab(2),petab(2)
+         do i0 = pbtab(1),petab(1)
+         IF (tempP%var%array2(i0,j0)
+     &                        == Agrif_SpecialValue) Then
+            Call CalculNewValTempP((/i0,j0/),
+     &                             tempP,parent,
+     &                             ppbtab,ppetab,
+     &                             noraftab,nbdim)
+         ENDIF
+         enddo  
+         enddo
+      CASE (3)
+         do k0 = pbtab(3),petab(3)
+         do j0 = pbtab(2),petab(2)
+         do i0 = pbtab(1),petab(1)
+         IF (tempP%var%array3(i0,j0,k0)
+     &                        == Agrif_SpecialValue) Then
+            Call CalculNewValTempP((/i0,j0,k0/),
+     &                             tempP,parent,
+     &                             ppbtab,ppetab,
+     &                             noraftab,nbdim)
+         ENDIF
+         enddo
+         enddo  
+         enddo
+      CASE (4)
+         do l0 = pbtab(4),petab(4)
+         do k0 = pbtab(3),petab(3)
+         do j0 = pbtab(2),petab(2)
+         do i0 = pbtab(1),petab(1)
+         IF (tempP%var%array4(i0,j0,k0,l0) 
+     &                        == Agrif_SpecialValue) Then
+            Call CalculNewValTempP((/i0,j0,k0,l0/),
+     &                             tempP,parent,
+     &                             ppbtab,ppetab,
+     &                             noraftab,nbdim)
+         ENDIF
+         enddo
+         enddo
+         enddo  
+         enddo
+      CASE (5)
+         do m0 = pbtab(5),petab(5)
+         do l0 = pbtab(4),petab(4)
+         do k0 = pbtab(3),petab(3)
+         do j0 = pbtab(2),petab(2)
+         do i0 = pbtab(1),petab(1)
+         IF (tempP%var%array5(i0,j0,k0,l0,m0) 
+     &                       == Agrif_SpecialValue) Then
+            Call CalculNewValTempP((/i0,j0,k0,l0,m0/),
+     &                             tempP,parent,
+     &                             ppbtab,ppetab,
+     &                             noraftab,nbdim)
+         ENDIF
+         enddo
+         enddo
+         enddo  
+         enddo
+         enddo
+      CASE (6)
+         do n0 = pbtab(6),petab(6)
+         do m0 = pbtab(5),petab(5)
+         do l0 = pbtab(4),petab(4)
+         do k0 = pbtab(3),petab(3)
+         do j0 = pbtab(2),petab(2)
+         do i0 = pbtab(1),petab(1)
+         IF (tempP%var%array6(i0,j0,k0,l0,m0,n0) 
+     &                       == Agrif_SpecialValue) Then
+            Call CalculNewValTempP((/i0,j0,k0,l0,m0,n0/),
+     &                             tempP,parent,
+     &                             ppbtab,ppetab,
+     &                             noraftab,nbdim)
+         ENDIF
+         enddo
+         enddo
+         enddo
+         enddo  
+         enddo
+         enddo
+      END SELECT
+C
+C      
+C     
+      End Subroutine Agrif_CheckMasknD
+C
+C
+C     **************************************************************************
+C     Subroutine CalculNewValTempP
+C     **************************************************************************
+C       
+      Subroutine CalculNewValTempP(indic,
+     &               tempP,parent,ppbtab,
+     &               ppetab,noraftab,nbdim)
+C
+CCC   Description:
+CCC   Subroutine called in the procedure Agrif_InterpnD to recalculate the value 
+CCC   of the parent grid variable when this one is equal to Agrif_SpecialValue. 
+C
+C     Declarations:
+C
+       
+C
+C     Arrays arguments      
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(nbdim) :: indic
+      LOGICAL,DIMENSION(nbdim) :: noraftab
+      INTEGER,DIMENSION(nbdim) :: ppbtab,ppetab
+C
+C     Pointer argument
+      TYPE(AGRIF_PVARIABLE) :: tempP  ! Part of the parent grid used for 
+                                      ! the interpolation of the child grid                     
+C     Data TYPE argument                                   
+      TYPE(AGRIF_PVARIABLE) :: parent      ! The parent grid
+C
+C     Local scalar
+      INTEGER                  :: i,ii,iii,jj,kk,ll,mm,nn 
+      INTEGER,DIMENSION(nbdim) :: imin,imax
+      INTEGER                  :: Nbvals
+      REAL                     :: Res
+      REAL                     :: ValParent
+      INTEGER                  :: ValMax
+      LOGICAL                  :: firsttest
+C      
+C     Local arrays      
+C
+      ValMax = 1
+      do iii = 1 , nbdim
+         IF (.NOT.noraftab(iii)) THEN
+         ValMax = max(ValMax,ppetab(iii)-indic(iii))
+         ValMax = max(ValMax,indic(iii)-ppbtab(iii))
+         ENDIF
+      enddo
+C
+      Valmax = min(Valmax,MaxSearch)
+C
+      imin = indic
+      imax = indic
+C
+         i = 1
+         firsttest = .TRUE.
+C
+         do While(i <= ValMax)
+C
+         IF ((i == 1).AND.(firsttest)) i = Valmax
+
+            do iii = 1 , nbdim
+               if (.NOT.noraftab(iii)) then
+                  imin(iii) = max(indic(iii) - i,ppbtab(iii))
+                  imax(iii) = min(indic(iii) + i,ppetab(iii))
+               endif            
+            enddo
+C
+            Res = 0.
+            Nbvals = 0
+C
+            if ( nbdim .EQ. 1 ) then
+               do ii = imin(1),imax(1)
+                    ValParent = parent%var%array1(ii)
+                    if ( ValParent .NE. Agrif_SpecialValue) then
+                        Res = Res + ValParent
+                        Nbvals = Nbvals + 1
+                    endif 
+               enddo
+            endif
+C
+            if ( nbdim .EQ. 2 ) then
+               do jj = imin(2),imax(2)
+               do ii = imin(1),imax(1)
+                    ValParent = parent%var%array2(ii,jj)
+                    if ( ValParent .NE. Agrif_SpecialValue) then
+                        Res = Res + ValParent
+                        Nbvals = Nbvals + 1
+                    endif 
+               enddo  
+               enddo
+            endif
+C
+            if ( nbdim .EQ. 3 ) then
+               do kk = imin(3),imax(3)
+               do jj = imin(2),imax(2)
+               do ii = imin(1),imax(1)
+                    ValParent = parent%var%array3(ii,jj,kk)
+                    if ( ValParent .NE. Agrif_SpecialValue) then
+                        Res = Res + ValParent
+                        Nbvals = Nbvals + 1
+                    endif 
+                        enddo
+                  enddo  
+               enddo
+            endif
+C
+            if ( nbdim .EQ. 4 ) then
+               do ll = imin(4),imax(4)
+               do kk = imin(3),imax(3)
+               do jj = imin(2),imax(2)
+               do ii = imin(1),imax(1)
+                    ValParent = parent%var%array4(ii,jj,kk,ll)
+                    if ( ValParent .NE. Agrif_SpecialValue) then
+                        Res = Res + ValParent
+                        Nbvals = Nbvals + 1
+                    endif 
+                              enddo
+                        enddo
+                  enddo  
+               enddo
+            endif
+C
+            if ( nbdim .EQ. 5 ) then
+               do mm = imin(5),imax(5)
+               do ll = imin(4),imax(4)
+               do kk = imin(3),imax(3)
+               do jj = imin(2),imax(2)
+               do ii = imin(1),imax(1)
+                    ValParent = parent%var%array5(ii,jj,kk,ll,mm)
+                    if ( ValParent .NE. Agrif_SpecialValue) then
+                        Res = Res + ValParent
+                        Nbvals = Nbvals + 1
+                    endif 
+                                    enddo
+                              enddo
+                        enddo
+                  enddo  
+               enddo
+            endif
+C
+            if ( nbdim .EQ. 6 ) then
+               do nn = imin(6),imax(6)
+               do mm = imin(5),imax(5)
+               do ll = imin(4),imax(4)
+               do kk = imin(3),imax(3)
+               do jj = imin(2),imax(2)
+               do ii = imin(1),imax(1)
+                    ValParent = parent%var%array6(ii,jj,kk,ll,mm,nn)
+                    if ( ValParent .NE. Agrif_SpecialValue) then
+                        Res = Res + ValParent
+                        Nbvals = Nbvals + 1
+                    endif 
+                                          enddo
+                                    enddo
+                              enddo
+                        enddo
+                  enddo  
+               enddo
+            endif
+C
+C
+            
+            if (Nbvals.GT.0) then
+              if (firsttest) then
+                   firsttest = .FALSE.
+                   cycle
+              endif
+              if ( nbdim .EQ. 1 ) tempP%var%array1(indic(1)) 
+     &           = Res/Nbvals
+              if ( nbdim .EQ. 2 ) tempP%var%array2(indic(1),
+     &                            indic(2)) = Res/Nbvals
+              if ( nbdim .EQ. 3 ) tempP%var%array3(indic(1),
+     &                            indic(2),indic(3)) = Res/Nbvals
+              if ( nbdim .EQ. 4 ) tempP%var%array4(indic(1),
+     &                            indic(2),indic(3),indic(4))
+     &                = Res/Nbvals
+              if ( nbdim .EQ. 5 ) tempP%var%array5(indic(1),
+     &                            indic(2),indic(3),indic(4),
+     &                   indic(5)) = Res/Nbvals
+              if ( nbdim .EQ. 6 ) tempP%var%array6(indic(1),
+     &                            indic(2),indic(3),indic(4),
+     &                           indic(5),indic(6)) = Res/Nbvals
+              exit
+            else
+               if (firsttest) exit
+               i = i + 1                      
+            endif
+          enddo            
+C     
+      End Subroutine CalculNewValTempP
+C
+C
+      End Module Agrif_Mask       
Index: /trunk/AGRIF/AGRIF_FILES/modmpp.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modmpp.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modmpp.F	(revision 396)
@@ -0,0 +1,508 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_mpp
+C
+      Module Agrif_mpp
+      Use Agrif_Types
+      Use Agrif_Arrays
+
+      Contains
+#ifdef AGRIF_MPI
+C
+      Subroutine Get_External_Data(tempC,tempCextend,pttruetab,
+     &   cetruetab,pttruetabwhole,cetruetabwhole,nbdim,memberin,
+     &   memberout)
+
+      IMPLICIT NONE
+#include "mpif.h"
+      INTEGER :: nbdim
+      TYPE(Agrif_PVariable) :: tempC, tempCextend
+      INTEGER,DIMENSION(nbdim,0:Agrif_NbProcs-1)    :: pttruetab,
+     &                                                 cetruetab
+      INTEGER,DIMENSION(nbdim,0:Agrif_NbProcs-1)    :: pttruetabwhole,
+     &                                                 cetruetabwhole
+      INTEGER :: k,i,k2
+      LOGICAL :: sendtoproc(0:Agrif_Nbprocs-1)
+      INTEGER,DIMENSION(nbdim,0:Agrif_NbProcs-1)    :: imin,imax
+      LOGICAL :: memberin, memberout
+      INTEGER :: imintmp, imaxtmp,j,i1
+      INTEGER :: imin1,imax1
+      LOGICAL :: tochange,tochangebis
+      INTEGER,DIMENSION(nbdim,0:Agrif_NbProcs-1)    :: pttruetab2,
+     &                                                 cetruetab2
+      LOGICAL :: memberout1(1),memberoutall(0:Agrif_Nbprocs-1)
+      INTEGER :: code
+
+C pttruetab2 and cetruetab2 are modified arraysin order to always
+C send the most inner points
+
+        
+         memberout1(1) = memberout
+
+         CALL MPI_ALLGATHER(memberout1,1,MPI_LOGICAL,memberoutall,
+     &                  1,MPI_LOGICAL,MPI_COMM_WORLD,code)
+
+         pttruetab2(:,Agrif_Procrank) = pttruetab(:,Agrif_Procrank)
+         cetruetab2(:,Agrif_Procrank) = cetruetab(:,Agrif_Procrank)
+         do k2=0,Agrif_Nbprocs-1
+            do i=1,nbdim
+
+           tochangebis=.TRUE.
+           DO i1=1,nbdim
+            IF (i .NE. i1) THEN
+              IF ((pttruetab(i1,Agrif_Procrank).NE.pttruetab(i1,k2)).OR.
+     &          (cetruetab(i1,Agrif_Procrank).NE.cetruetab(i1,k2))) THEN
+                   tochangebis = .FALSE.
+               EXIT
+              ENDIF
+             ENDIF
+           ENDDO
+
+           IF (tochangebis) THEN
+
+
+          imin1 = max(pttruetab(i,Agrif_Procrank),
+     &                    pttruetab(i,k2))
+          imax1 = min(cetruetab(i,Agrif_Procrank),
+     &                    cetruetab(i,k2))
+
+C Always send the most interior points
+
+           tochange = .false.
+           IF (cetruetab(i,Agrif_Procrank)> cetruetab(i,k2)) THEN
+
+           DO j=imin1,imax1
+             IF ((cetruetab(i,k2)-j) >
+     &             (j-pttruetab(i,Agrif_Procrank))) THEN
+             imintmp = j+1
+             tochange = .TRUE.
+             ELSE
+              EXIT
+             ENDIF
+          ENDDO
+          ENDIF
+
+           if (tochange) then
+C
+              pttruetab2(i,Agrif_Procrank) = imintmp
+C
+          endif
+
+           tochange = .FALSE.
+           imaxtmp=0
+           IF (pttruetab(i,Agrif_Procrank) < pttruetab(i,k2)) THEN
+          DO j=imax1,imin1,-1
+            IF ((j-pttruetab(i,k2)) >
+     &             (cetruetab(i,Agrif_Procrank)-j)) THEN
+             imaxtmp = j-1
+             tochange = .TRUE.
+            ELSE
+             EXIT
+            ENDIF
+          ENDDO
+
+          ENDIF
+
+                    if (tochange) then
+C
+              cetruetab2(i,Agrif_Procrank) = imaxtmp
+C
+          endif
+C
+
+          ENDIF
+           enddo
+         enddo
+
+
+       do k = 0,Agrif_NbProcs-1
+C
+        sendtoproc(k) = .true.
+C
+        do i = 1,nbdim
+C
+          imin(i,k) = max(pttruetab2(i,Agrif_Procrank),
+     &                    pttruetabwhole(i,k))
+          imax(i,k) = min(cetruetab2(i,Agrif_Procrank),
+     &                    cetruetabwhole(i,k))
+C
+          if (imin(i,k) > imax(i,k)) then
+C
+              sendtoproc(k) = .false.
+C
+          endif
+C
+        enddo
+        IF (.NOT.memberoutall(k)) THEN
+           sendtoproc(k) = .FALSE.
+        ENDIF
+C
+      enddo
+
+
+c       IF (.NOT.memberin) sendtoproc = .FALSE.
+
+      IF (memberout) THEN
+      Call Agrif_nbdim_allocation(tempCextend%var,
+     &                 pttruetabwhole(:,Agrif_ProcRank),
+     &                 cetruetabwhole(:,Agrif_ProcRank),nbdim)
+      call Agrif_nbdim_Full_VarEQreal(tempCextend%var,0.,nbdim)
+      ENDIF
+
+      IF (sendtoproc(Agrif_ProcRank)) THEN
+           Call Agrif_nbdim_VarEQvar(tempCextend%var,
+     &                               imin(:,Agrif_Procrank),
+     &                               imax(:,Agrif_Procrank),
+     &                               tempC%var,
+     &                               imin(:,Agrif_Procrank),
+     &                               imax(:,Agrif_Procrank),
+     &                               nbdim)
+      ENDIF
+
+      Call Exchangesamelevel(sendtoproc,nbdim,imin,imax,tempC,
+     &     tempCextend)
+
+      End Subroutine Get_External_Data
+
+       Subroutine ExchangeSameLevel(sendtoproc,nbdim,imin,imax,
+     &          tempC,tempCextend)
+      Implicit None
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(nbdim,0:Agrif_Nbprocs-1) :: imin,imax
+      INTEGER,DIMENSION(nbdim,2,0:Agrif_Nbprocs-1) :: iminmax_temp
+      INTEGER,DIMENSION(nbdim,0:Agrif_Nbprocs-1) :: imin_recv,imax_recv
+      TYPE(Agrif_PVARIABLE) :: tempC,tempCextend
+      LOGICAL,DIMENSION(0:Agrif_Nbprocs-1)       :: sendtoproc
+      LOGICAL,DIMENSION(0:Agrif_Nbprocs-1)       :: recvfromproc
+      LOGICAL                                    :: res
+      TYPE(AGRIF_PVARIABLE)                      :: temprecv
+
+#include "mpif.h"
+          INTEGER :: i,k
+          INTEGER :: etiquette = 100
+          INTEGER :: code, datasize
+          INTEGER,DIMENSION(MPI_STATUS_SIZE)   :: statut
+
+
+      do k = 0,Agrif_ProcRank-1
+C
+C
+            Call MPI_SEND(sendtoproc(k),1,MPI_LOGICAL,k,etiquette,
+     &                    MPI_COMM_WORLD,code)
+C
+            if (sendtoproc(k)) then
+C
+                iminmax_temp(:,1,k) = imin(:,k)
+                iminmax_temp(:,2,k) = imax(:,k)
+
+                Call MPI_SEND(iminmax_temp(:,:,k),
+     &                        2*nbdim,MPI_INTEGER,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+C
+                datasize = 1
+C
+                do i = 1,nbdim
+C
+                  datasize = datasize * (imax(i,k)-imin(i,k)+1)
+C
+                enddo
+C
+                SELECT CASE(nbdim)
+                CASE(1)
+                   Call MPI_SEND(tempC%var%array1(
+     &                        imin(1,k):imax(1,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(2)
+                   Call MPI_SEND(tempC%var%array2(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(3)
+                   Call MPI_SEND(tempC%var%array3(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(4)
+                   Call MPI_SEND(tempC%var%array4(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k),
+     &                        imin(4,k):imax(4,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(5)
+                   Call MPI_SEND(tempC%var%array5(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k),
+     &                        imin(4,k):imax(4,k),
+     &                        imin(5,k):imax(5,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(6)
+                   Call MPI_SEND(tempC%var%array6(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k),
+     &                        imin(4,k):imax(4,k),
+     &                        imin(5,k):imax(5,k),
+     &                        imin(6,k):imax(6,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                END SELECT
+C
+            endif
+
+C
+      enddo
+C
+C
+C     Reception from others processors of the necessary part of the parent grid
+      do k = Agrif_ProcRank+1,Agrif_Nbprocs-1
+C
+C
+            Call MPI_RECV(res,1,MPI_LOGICAL,k,etiquette,
+     &                    MPI_COMM_WORLD,statut,code)
+C
+            recvfromproc(k) = res
+
+C
+            if (recvfromproc(k)) then
+C
+                Call MPI_RECV(iminmax_temp(:,:,k),
+     &                        2*nbdim,MPI_INTEGER,k,etiquette,
+     &                        MPI_COMM_WORLD,statut,code)
+
+                imin_recv(:,k) = iminmax_temp(:,1,k)
+                imax_recv(:,k) = iminmax_temp(:,2,k)
+
+                datasize = 1
+C
+                do i = 1,nbdim
+C
+                datasize = datasize * (imax_recv(i,k)-imin_recv(i,k)+1)
+C
+                enddo
+
+                allocate(temprecv%var)
+             call Agrif_nbdim_allocation(temprecv%var,imin_recv(:,k),
+     &   imax_recv(:,k),nbdim)
+            SELECT CASE(nbdim)
+            CASE(1)
+              Call MPI_RECV(temprecv%var%array1,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(2)
+              Call MPI_RECV(temprecv%var%array2,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(3)
+              Call MPI_RECV(temprecv%var%array3,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+
+            CASE(4)
+              Call MPI_RECV(temprecv%var%array4,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(5)
+              Call MPI_RECV(temprecv%var%array5,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(6)
+              Call MPI_RECV(temprecv%var%array6,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+       END SELECT
+            
+            Call where_valtabtotab_mpi(tempCextend%var,
+     &             temprecv%var,imin_recv(:,k),imax_recv(:,k),0.,nbdim)
+     
+                Call Agrif_nbdim_deallocation(temprecv%var,nbdim)
+                deallocate(temprecv%var)
+
+            endif
+
+C
+      enddo
+
+
+      do k = Agrif_ProcRank+1,Agrif_Nbprocs-1
+C
+C
+            Call MPI_SEND(sendtoproc(k),1,MPI_LOGICAL,k,etiquette,
+     &                    MPI_COMM_WORLD,code)
+C
+            if (sendtoproc(k)) then
+C
+                iminmax_temp(:,1,k) = imin(:,k)
+                iminmax_temp(:,2,k) = imax(:,k)
+
+                Call MPI_SEND(iminmax_temp(:,:,k),
+     &                        2*nbdim,MPI_INTEGER,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+C
+                datasize = 1
+C
+                do i = 1,nbdim
+C
+                  datasize = datasize * (imax(i,k)-imin(i,k)+1)
+C
+                enddo
+C
+                SELECT CASE(nbdim)
+                CASE(1)
+                   Call MPI_SEND(tempC%var%array1(
+     &                        imin(1,k):imax(1,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(2)
+                   Call MPI_SEND(tempC%var%array2(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(3)
+                   Call MPI_SEND(tempC%var%array3(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(4)
+                   Call MPI_SEND(tempC%var%array4(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k),
+     &                        imin(4,k):imax(4,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(5)
+                   Call MPI_SEND(tempC%var%array5(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k),
+     &                        imin(4,k):imax(4,k),
+     &                        imin(5,k):imax(5,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                CASE(6)
+                   Call MPI_SEND(tempC%var%array6(
+     &                        imin(1,k):imax(1,k),
+     &                        imin(2,k):imax(2,k),
+     &                        imin(3,k):imax(3,k),
+     &                        imin(4,k):imax(4,k),
+     &                        imin(5,k):imax(5,k),
+     &                        imin(6,k):imax(6,k)),
+     &                        datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &                        MPI_COMM_WORLD,code)
+                END SELECT
+C
+            endif
+
+C
+      enddo
+
+C
+C
+C     Reception from others processors of the necessary part of the parent grid
+      do k = Agrif_ProcRank-1,0,-1
+C
+C
+            Call MPI_RECV(res,1,MPI_LOGICAL,k,etiquette,
+     &                    MPI_COMM_WORLD,statut,code)
+C
+            recvfromproc(k) = res
+
+C
+            if (recvfromproc(k)) then
+C
+                Call MPI_RECV(iminmax_temp(:,:,k),
+     &                        2*nbdim,MPI_INTEGER,k,etiquette,
+     &                        MPI_COMM_WORLD,statut,code)
+
+                imin_recv(:,k) = iminmax_temp(:,1,k)
+                imax_recv(:,k) = iminmax_temp(:,2,k)
+
+                datasize = 1
+C
+                do i = 1,nbdim
+C
+                datasize = datasize * (imax_recv(i,k)-imin_recv(i,k)+1)
+C
+                enddo
+                allocate(temprecv%var)
+             call Agrif_nbdim_allocation(temprecv%var,imin_recv(:,k),
+     &   imax_recv(:,k),nbdim)
+            SELECT CASE(nbdim)
+            CASE(1)
+              Call MPI_RECV(temprecv%var%array1,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(2)
+              Call MPI_RECV(temprecv%var%array2,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(3)
+              Call MPI_RECV(temprecv%var%array3,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+
+            CASE(4)
+              Call MPI_RECV(temprecv%var%array4,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(5)
+              Call MPI_RECV(temprecv%var%array5,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+            CASE(6)
+              Call MPI_RECV(temprecv%var%array6,
+     &               datasize,MPI_DOUBLE_PRECISION,k,etiquette,
+     &               MPI_COMM_WORLD,statut,code)
+          END SELECT
+            
+            Call where_valtabtotab_mpi(tempCextend%var,
+     &             temprecv%var,imin_recv(:,k),imax_recv(:,k),0.,nbdim)
+     
+                Call Agrif_nbdim_deallocation(temprecv%var,nbdim)
+                deallocate(temprecv%var)
+            endif
+
+C
+      enddo
+
+          End Subroutine ExchangeSamelevel
+
+#else
+      Subroutine Agrif_mpp_empty()
+      End Subroutine Agrif_mpp_empty
+#endif
+
+      End Module Agrif_mpp
Index: /trunk/AGRIF/AGRIF_FILES/modsauv.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modsauv.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modsauv.F	(revision 396)
@@ -0,0 +1,821 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Save  
+C
+      Module Agrif_Save 
+C
+CCC   Description:   
+CCC   Module for the initialization by copy of the grids created by clustering.
+C
+C     Modules used:
+C      
+      Use Agrif_Types
+      Use Agrif_Link
+      Use Agrif_Arrays
+C
+      IMPLICIT NONE
+C
+      Contains
+C     Definition of procedures contained in this module.
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Free_data_before
+C     **************************************************************************
+C
+      Subroutine Agrif_Free_data_before(Agrif_Gr)
+C
+CCC   Description:
+CCC   
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+      
+C      
+C     Pointer argument    
+      TYPE(Agrif_Grid),pointer   :: Agrif_Gr ! Pointer on the current grid
+      INTEGER i
+C
+C   
+      do i = 1 , AGRIF_NbVariables
+         if ( .NOT. Agrif_Mygrid % tabvars(i) % var % restaure) then
+C 
+            if (associated(Agrif_Gr%tabvars(i)%var%array1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array6)
+            endif
+C
+            if (associated(Agrif_Gr%tabvars(i)%var%darray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray6)
+            endif
+C
+            if (associated(Agrif_Gr%tabvars(i)%var%larray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray6)
+            endif
+C
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray6)
+            endif
+C
+            if (associated(Agrif_Gr%tabvars(i)%var%carray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%carray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%carray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%carray2)
+            endif
+C
+            if (associated(Agrif_Gr%tabvars(i)%var%oldvalues2D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%oldvalues2D)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%interpIndex)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%interpIndex)
+            endif
+C
+            Deallocate(Agrif_Gr%tabvars(i)%var)
+C 
+        endif
+      enddo
+C
+C 
+C
+      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
+         if ( Agrif_Probdim .EQ. 1 ) Deallocate(Agrif_Gr%tabpoint1D)
+         if ( Agrif_Probdim .EQ. 2 ) Deallocate(Agrif_Gr%tabpoint2D)
+         if ( Agrif_Probdim .EQ. 3 ) Deallocate(Agrif_Gr%tabpoint3D)
+      endif
+C          
+      Return
+C
+C
+      End Subroutine Agrif_Free_data_before
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Free_data_after
+C     **************************************************************************
+C      
+      Subroutine Agrif_Free_data_after(Agrif_Gr)
+C
+CCC   Description:
+CCC   
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+C
+      
+C
+C     Pointer argument    
+      TYPE(Agrif_Grid),pointer   :: Agrif_Gr  ! Pointer on the current grid
+      INTEGER i
+C
+C      
+      do i = 1 , AGRIF_NbVariables
+         if ( Agrif_Mygrid % tabvars(i) % var % restaure) then
+C 
+            if (associated(Agrif_Gr%tabvars(i)%var%array1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%array6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%array6)
+            endif
+!
+            if (associated(Agrif_Gr%tabvars(i)%var%darray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%darray6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%darray6)
+            endif
+!
+            if (associated(Agrif_Gr%tabvars(i)%var%larray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%larray6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%larray6)
+            endif
+!
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray2)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray3)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray3)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray4)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray4)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray5)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray5)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%iarray6)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%iarray6)
+            endif
+!
+            if (associated(Agrif_Gr%tabvars(i)%var%carray1)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%carray1)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%carray2)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%carray2)
+            endif
+!
+            if (associated(Agrif_Gr%tabvars(i)%var%oldvalues2D)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%oldvalues2D)
+            endif
+            if (associated(Agrif_Gr%tabvars(i)%var%interpIndex)) then
+               Deallocate(Agrif_Gr%tabvars(i)%var%interpIndex)
+            endif
+!
+            Deallocate(Agrif_Gr%tabvars(i)%var)
+! 
+         endif
+      enddo
+C
+C      
+      Return
+C
+C
+      End Subroutine Agrif_Free_data_after      
+C
+C
+CC    **************************************************************************
+CCC   Subroutine AGRIF_CopyFromold_All
+C     **************************************************************************
+C
+      Recursive Subroutine AGRIF_CopyFromold_All(g,oldchildgrids)
+C
+CCC   Description:
+CCC   Routine called in the Agrif_Init_Hierarchy procedure 
+C       (Agrif_Clustering module). 
+C
+CC    Method:        
+C
+C     Declarations:
+C
+      
+C      
+C     Pointer argument    
+      TYPE(AGRIF_grid),pointer   :: g ! Pointer on the current grid
+      TYPE(AGRIF_pgrid),pointer   :: oldchildgrids
+C
+C     Local pointer
+      TYPE(AGRIF_pgrid),pointer  :: parcours ! Pointer for the recursive 
+                                             ! procedure 
+      REAL g_eps,eps,oldgrid_eps
+      INTEGER :: out
+      INTEGER :: iii
+C
+      out = 0
+C                                                                           
+      parcours => oldchildgrids  
+C
+      do while (associated(parcours))
+C 
+        if ((.NOT. g % fixed) .AND. (parcours % gr %oldgrid)) then
+C        
+            g_eps = huge(1.)
+            oldgrid_eps = huge(1.)
+            do iii = 1 , Agrif_Probdim
+               g_eps = min(g_eps,g % Agrif_d(iii))
+               oldgrid_eps = min(oldgrid_eps,
+     &                       parcours % gr % Agrif_d(iii))
+            enddo
+C
+            eps = min(g_eps,oldgrid_eps)/100.                  
+C
+
+            do iii = 1 , Agrif_Probdim
+               if (g % Agrif_d(iii) .LT. 
+     &             (parcours % gr % Agrif_d(iii) - eps)) then
+C            
+                   parcours => parcours % next
+C            
+                   out = 1
+C   
+                   Cycle
+C             
+               endif
+C      
+            enddo
+        if ( out .EQ. 1 ) Cycle
+C
+            Call AGRIF_CopyFromOld(g,parcours%gr)
+C
+        endif
+C                     
+        Call Agrif_CopyFromold_All
+     &             (g, parcours % gr % child_grids)
+C        
+        parcours => parcours % next
+C        
+      enddo
+C
+C     
+      Return      
+C
+C
+      End Subroutine AGRIF_CopyFromold_All
+C
+C
+C      
+C     **************************************************************************
+CCC   Subroutine Agrif_CopyFromold
+C     **************************************************************************
+C      
+      Subroutine Agrif_CopyFromold(Agrif_New_Gr,Agrif_Old_Gr)
+C
+CCC   Description:
+CCC   Call to the Agrif_Copy procedure.
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+      
+C      
+C     Pointer argument    
+      TYPE(Agrif_Grid),Pointer   :: Agrif_New_Gr  ! Pointer on the current grid
+      TYPE(Agrif_Grid),Pointer :: Agrif_Old_Gr    ! Pointer on an old grid
+      INTEGER :: i
+C
+C      
+      do i = 1 , AGRIF_NbVariables
+         if ( Agrif_Mygrid % tabvars(i) % var % restaure ) then
+C
+            Call Agrif_Copy(Agrif_New_Gr,Agrif_Old_Gr,
+     &           Agrif_New_Gr % tabvars(i),
+     &           Agrif_Old_Gr % tabvars(i))
+C
+        endif
+      enddo
+
+C      
+C            
+      Return
+C
+C      
+      End Subroutine Agrif_CopyFromold
+C
+C
+CC
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Copy
+C     **************************************************************************
+C      
+      Subroutine Agrif_Copy(Agrif_New_Gr,Agrif_Old_Gr,New_Var,Old_Var)
+C     
+CCC   Description:
+CCC   Sets arguments of the Agrif_UpdatenD procedures, n being the number of 
+CCC   DIMENSION of the grid variable.
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+      
+C
+C     Pointer argument    
+      TYPE(Agrif_Grid),Pointer   :: Agrif_New_Gr   ! Pointer on the current grid
+      TYPE(Agrif_Grid), Pointer :: Agrif_Old_Gr    ! Pointer on an old grid
+      TYPE(Agrif_Pvariable) :: New_Var, Old_Var
+      INTEGER :: nbdim                  ! Number of dimensions of the current 
+                                        ! grid      
+      INTEGER,DIMENSION(6) :: pttabnew  ! Indexes of the first point in the 
+                                        ! domain
+      INTEGER,DIMENSION(6) :: petabnew  ! Indexes of the first point in the 
+                                        ! domain
+      INTEGER,DIMENSION(6) :: pttabold  ! Indexes of the first point in the 
+                                        ! domain
+      INTEGER,DIMENSION(6) :: petabold  ! Indexes of the first point in the 
+                                        ! domain
+      INTEGER,DIMENSION(6) :: nbtabold  ! Number of cells in each direction
+      
+      INTEGER,DIMENSION(6) :: nbtabnew  ! Number of cells in each direction   
+      TYPE(AGRIF_Variable), Pointer :: root ! Pointer on the variable of the 
+                                            ! root grid
+      REAL, DIMENSION(6) :: snew,sold
+      REAL, DIMENSION(6) :: dsnew,dsold                              
+      REAL :: eps
+      INTEGER :: n
+C
+C  
+      root => New_Var % var % root_var 
+C      
+      nbdim = root % nbdim
+C         
+      do n=1,nbdim
+C  
+        select case(root % interptab(n))
+C        
+        case('x')                
+C
+          pttabnew(n) = root % point(1)
+C        
+          pttabold(n) = root % point(1)
+C        
+          snew(n) = Agrif_New_Gr % Agrif_x(1)
+C
+          sold(n) = Agrif_Old_Gr % Agrif_x(1) 
+C        
+          dsnew(n) = Agrif_New_Gr % Agrif_d(1)
+C
+          dsold(n) = Agrif_Old_Gr % Agrif_d(1)
+C                      
+          if (root % posvar(n) .EQ. 1) then
+C          
+              petabnew(n) = pttabnew(n) + Agrif_New_Gr % nb(1)
+C          
+              petabold(n) = pttabold(n) + Agrif_Old_Gr % nb(1)         
+C        
+            else
+C          
+              petabnew(n) = pttabnew(n) + Agrif_New_Gr % nb(1) - 1
+C          
+              petabold(n) = pttabold(n) + Agrif_Old_Gr % nb(1) - 1
+C
+              snew(n) = snew(n) + dsnew(n)/2.
+C
+              sold(n) = sold(n) + dsold(n)/2.
+C        
+          endif           
+C        
+        case('y')
+C        
+          pttabnew(n) = root % point(2)
+C        
+          pttabold(n) = root % point(2)
+C        
+          snew(n) = Agrif_New_Gr % Agrif_x(2)
+C        
+          sold(n) = Agrif_Old_Gr % Agrif_x(2)
+C        
+          dsnew(n) = Agrif_New_Gr % Agrif_d(2)
+C        
+          dsold(n) = Agrif_Old_Gr % Agrif_d(2)
+C                
+          if (root % posvar(n) .EQ. 1) then
+C        
+              petabnew(n) = pttabnew(n) + Agrif_New_Gr % nb(2)
+C          
+              petabold(n) = pttabold(n) + Agrif_Old_Gr % nb(2)         
+C        
+            else
+C          
+              petabnew(n) = pttabnew(n) + Agrif_New_Gr % nb(2) - 1
+C          
+              petabold(n) = pttabold(n) + Agrif_Old_Gr % nb(2) - 1
+C
+              snew(n) = snew(n) + dsnew(n)/2.
+C
+              sold(n) = sold(n) + dsold(n)/2.                    
+C        
+          endif 
+C        
+        case('z')
+C        
+          pttabnew(n) = root % point(3)
+C        
+          pttabold(n) = root % point(3)
+C        
+          snew(n) = Agrif_New_Gr % Agrif_x(3)
+C        
+          sold(n) = Agrif_Old_Gr % Agrif_x(3)
+C        
+          dsnew(n) = Agrif_New_Gr % Agrif_d(3)
+C        
+          dsold(n) = Agrif_Old_Gr % Agrif_d(3)
+C                
+          if (root % posvar(n) .EQ. 1) then
+C        
+              petabnew(n) = pttabnew(n) + Agrif_New_Gr % nb(3)
+C          
+              petabold(n) = pttabold(n) + Agrif_Old_Gr % nb(3)         
+C        
+            else
+C          
+             petabnew(n) = pttabnew(n) + Agrif_New_Gr % nb(3) - 1
+C          
+             petabold(n) = pttabold(n) + Agrif_Old_Gr % nb(3) - 1
+C
+             snew(n) = snew(n) + dsnew(n)/2.
+C
+             sold(n) = sold(n) + dsold(n)/2.                   
+C        
+          endif
+C          
+        case('N')
+C        
+          Call Agrif_nbdim_Get_bound(New_Var%var,
+     &                           pttabnew(n),petabnew(n),
+     &                           n,nbdim)
+C        
+          pttabold(n) = pttabnew(n)
+C      
+          petabold(n) = petabnew(n)
+C              
+          snew(n) = 0.
+C      
+          sold(n) = 0. 
+C      
+          dsnew(n) = 1.
+C      
+          dsold(n) = 1.
+C        
+        end select
+C      
+      enddo
+C      
+      do n = 1,nbdim
+C      
+        nbtabnew(n) = petabnew(n) - pttabnew(n)
+C      
+        nbtabold(n) = petabold(n) - pttabold(n)      
+C 
+      enddo      
+C
+      eps = min(minval(dsnew(1:nbdim)),minval(dsold(1:nbdim)))
+C     
+      eps = eps/100.      
+C      
+      do n = 1,nbdim
+C      
+        if (snew(n) .GT. (sold(n)+dsold(n)*nbtabold(n)+eps)) Return
+C      
+        if ((snew(n)+dsnew(n)*nbtabnew(n)-eps) .LT. sold(n)) Return
+C      
+      enddo
+C            
+C
+      Call AGRIF_CopynD
+     &        (New_Var,Old_Var,pttabold,petabold,pttabnew,petabnew,
+     &         sold,snew,dsold,dsnew,nbdim) 
+C      
+C 
+      Return
+C      
+C
+      End Subroutine Agrif_Copy
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_CopynD
+C     **************************************************************************
+C      
+      Subroutine Agrif_CopynD(New_Var,Old_Var,pttabold,petabold,
+     &                        pttabnew,petabnew,sold,snew,dsold,
+     &                        dsnew,nbdim)
+C     
+CCC   Description:
+CCC   Copy of the nD New_Var variable from the nD Old_Var variable.
+C
+CC    Method:
+CC            
+C
+C     Declarations:
+C
+      
+C
+      INTEGER :: nbdim
+      TYPE(Agrif_Pvariable) :: New_Var, Old_Var     
+      INTEGER,DIMENSION(nbdim) :: pttabnew 
+      INTEGER,DIMENSION(nbdim) :: petabnew
+      INTEGER,DIMENSION(nbdim) :: pttabold
+      INTEGER,DIMENSION(nbdim) :: petabold      
+      REAL, DIMENSION(nbdim) :: snew,sold
+      REAL, DIMENSION(nbdim) :: dsnew,dsold 
+C
+      INTEGER :: i,j,k,l,m,n,i0,j0,k0,l0,m0,n0
+C
+      REAL, DIMENSION(nbdim) :: dim_gmin,dim_gmax
+      REAL, DIMENSION(nbdim) :: dim_newmin,dim_newmax
+      REAL, DIMENSION(nbdim) :: dim_min
+      INTEGER, DIMENSION(nbdim) :: ind_gmin,ind_newmin
+      INTEGER, DIMENSION(nbdim) ::  ind_newmax
+C               
+C
+      do i = 1,nbdim
+C      
+        dim_gmin(i) = sold(i)
+        dim_gmax(i) = sold(i) + (petabold(i)-pttabold(i)) * dsold(i)
+C 
+        dim_newmin(i) = snew(i)
+        dim_newmax(i) = snew(i) + (petabnew(i)-pttabnew(i)) * dsnew(i)
+C
+      enddo         
+C
+      do i = 1,nbdim
+C  
+        if (dim_gmax(i) .LT. dim_newmin(i)) Return
+C      
+        if (dim_gmin(i) .GT. dim_newmax(i)) Return
+C
+      enddo
+C
+C
+      do i = 1,nbdim
+C 
+        ind_newmin(i) = pttabnew(i) - floor(-(max(dim_gmin(i),
+     &                      dim_newmin(i))-dim_newmin(i))/dsnew(i)) 
+C      
+        dim_min(i) = snew(i) + (ind_newmin(i)-pttabnew(i))*dsnew(i)
+C      
+        ind_gmin(i) = pttabold(i) + nint((dim_min(i)-
+     &                dim_gmin(i))/dsold(i))      
+C
+        ind_newmax(i) = pttabnew(i) 
+     &                  + int((min(dim_gmax(i),dim_newmax(i))
+     &                         -dim_newmin(i))/dsnew(i))
+C
+      enddo 
+C
+C
+C
+      SELECT CASE (nbdim)
+      CASE (1)
+         i0 = ind_gmin(1)
+         do i = ind_newmin(1),ind_newmax(1)
+            New_Var % var % array1(i) =
+     &      Old_Var % var % array1(i0)
+            New_Var % var % restore1D(i) = 1   
+         i0 = i0 + int(dsnew(1)/dsold(1))
+         enddo
+      CASE (2)
+        i0 = ind_gmin(1)
+        do i = ind_newmin(1),ind_newmax(1)
+        j0 = ind_gmin(2)
+        do j = ind_newmin(2),ind_newmax(2)
+           New_Var % var % array2(i,j) =
+     &            Old_Var % var % array2(i0,j0)
+           New_Var % var % restore2D(i,j) = 1
+               j0 = j0 + int(dsnew(2)/dsold(2))
+        enddo
+        i0 = i0 + int(dsnew(1)/dsold(1))
+        enddo
+      CASE (3)
+        i0 = ind_gmin(1)
+        do i = ind_newmin(1),ind_newmax(1)
+        j0 = ind_gmin(2)
+        do j = ind_newmin(2),ind_newmax(2)
+        k0 = ind_gmin(3)
+        do k = ind_newmin(3),ind_newmax(3)
+           New_Var % var % array3(i,j,k) =
+     &                  Old_Var % var % array3(i0,j0,k0)
+           New_Var % var % restore3D(i,j,k) = 1   
+                     k0 = k0 + int(dsnew(3)/dsold(3))
+        enddo
+        j0 = j0 + int(dsnew(2)/dsold(2))
+        enddo
+        i0 = i0 + int(dsnew(1)/dsold(1))
+        enddo
+      CASE (4)
+        i0 = ind_gmin(1)
+        do i = ind_newmin(1),ind_newmax(1)
+        j0 = ind_gmin(2)
+        do j = ind_newmin(2),ind_newmax(2)
+        k0 = ind_gmin(3)
+        do k = ind_newmin(3),ind_newmax(3)
+        l0 = ind_gmin(4)
+        do l = ind_newmin(4),ind_newmax(4) 
+           New_Var % var % array4(i,j,k,l) =
+     &                        Old_Var % var % array4(i0,j0,k0,l0)
+           New_Var % var % restore4D(i,j,k,l) = 1   
+        l0 = l0 + int(dsnew(4)/dsold(4))
+        enddo
+        k0 = k0 + int(dsnew(3)/dsold(3))
+        enddo
+        j0 = j0 + int(dsnew(2)/dsold(2))
+        enddo
+        i0 = i0 + int(dsnew(1)/dsold(1))
+        enddo
+      CASE (5)
+        i0 = ind_gmin(1)
+        do i = ind_newmin(1),ind_newmax(1)
+        j0 = ind_gmin(2)
+        do j = ind_newmin(2),ind_newmax(2)
+        k0 = ind_gmin(3)
+        do k = ind_newmin(3),ind_newmax(3)
+        l0 = ind_gmin(4)
+        do l = ind_newmin(4),ind_newmax(4) 
+        m0 = ind_gmin(5)
+        do m = ind_newmin(5),ind_newmax(5)
+           New_Var % var % array5(i,j,k,l,m) =
+     &                        Old_Var % var % array5(i0,j0,k0,l0,m0)
+           New_Var % var % restore5D(i,j,k,l,m) = 1
+        m0 = m0 + int(dsnew(5)/dsold(5)) 
+        enddo
+        l0 = l0 + int(dsnew(4)/dsold(4))
+        enddo
+        k0 = k0 + int(dsnew(3)/dsold(3))
+        enddo
+        j0 = j0 + int(dsnew(2)/dsold(2))
+        enddo
+        i0 = i0 + int(dsnew(1)/dsold(1))
+        enddo
+      CASE (6)
+        i0 = ind_gmin(1)
+        do i = ind_newmin(1),ind_newmax(1)
+        j0 = ind_gmin(2)
+        do j = ind_newmin(2),ind_newmax(2)
+        k0 = ind_gmin(3)
+        do k = ind_newmin(3),ind_newmax(3)
+        l0 = ind_gmin(4)
+        do l = ind_newmin(4),ind_newmax(4) 
+        m0 = ind_gmin(5)
+        do m = ind_newmin(5),ind_newmax(5)
+        n0 = ind_gmin(6)
+        do n = ind_newmin(6),ind_newmax(6)
+           New_Var % var % array6(i,j,k,l,m,n) =
+     &                        Old_Var % var % array6(i0,j0,k0,l0,m0,n0)
+           New_Var % var % restore6D(i,j,k,l,m,n) = 1
+        n0 = n0 + int(dsnew(6)/dsold(6)) 
+        enddo
+        m0 = m0 + int(dsnew(5)/dsold(5)) 
+        enddo
+        l0 = l0 + int(dsnew(4)/dsold(4))
+        enddo
+        k0 = k0 + int(dsnew(3)/dsold(3))
+        enddo
+        j0 = j0 + int(dsnew(2)/dsold(2))
+        enddo
+        i0 = i0 + int(dsnew(1)/dsold(1))
+        enddo
+      END SELECT
+C           
+      Return
+C
+C
+      End Subroutine Agrif_CopynD                    
+C
+C
+C
+      End module Agrif_Save
Index: /trunk/AGRIF/AGRIF_FILES/modtypes.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modtypes.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modtypes.F	(revision 396)
@@ -0,0 +1,354 @@
+C     Agrif (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place-Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_types  
+C
+      Module Agrif_types 
+C
+CCC   Description:
+CCC   Definition of data types used in Agrif, of several variables and
+C        PARAMETERs.     
+C
+      IMPLICIT NONE
+C
+C     **************************************************************************
+CCC   TYPE Agrif_LRECTANGLE
+C     **************************************************************************
+C
+CCC   Description:
+CCC   Data TYPE allowing a grid to reach a grid on the same level or its child
+CCC   grids.
+C
+      TYPE Agrif_lrectangle  
+           TYPE(Agrif_rectangle) , Pointer :: r    ! to reach a child grid
+           TYPE(Agrif_lrectangle), Pointer :: next ! to reach a grid on the 
+                                                   !    same level
+      End TYPE Agrif_lrectangle  
+C
+C     **************************************************************************
+CCC   TYPE Agrif_RECTANGLE: 
+C     **************************************************************************
+C
+CCC   Description:
+CCC   Data TYPE to define several CHARACTERistics of a grid (number,position,
+CCC   time and space refinement factors,...). 
+C
+      TYPE Agrif_rectangle
+           INTEGER                         :: number      ! Number of the grid
+           ! Number of child grids 
+           INTEGER                         :: nbgridchild 
+           ! Minimal position in the x,y and z direction
+           INTEGER, DIMENSION(3)           :: imin        
+           ! Maximal position in the x,y and z direction 
+           INTEGER, DIMENSION(3)           :: imax 
+           ! Space refinement factor in the x,y and z direction  
+           INTEGER, DIMENSION(3)           :: spaceref    
+           ! Time refinement factor in the x,y and z direction
+           INTEGER, DIMENSION(3)           :: timeref     
+           ! Pointer to reach a grid on  the same level or a child grid
+           TYPE(Agrif_lrectangle), Pointer :: childgrids  
+      End TYPE Agrif_rectangle  
+C
+C
+C
+C     **************************************************************************
+CCC   TYPE Agrif_PGrid
+C     **************************************************************************
+C
+CCC   Description:
+CCC   Data TYPE to go over the grid hierarchy (used for the creation of this 
+CCC   grid hierarchy and during the time integration).
+C 
+      TYPE Agrif_pgrid  
+           ! allows to reach a child grid  
+           TYPE(Agrif_grid) , Pointer :: gr
+           ! allows to reach the grids of the same level 
+           TYPE(Agrif_pgrid), Pointer :: next 
+      End TYPE Agrif_pgrid 
+C
+C
+C
+C     **************************************************************************
+CCC   TYPE Agrif_PVariable
+C     **************************************************************************
+C
+CCC   Description:
+CCC   Data TYPE to define a grid variable.
+C
+      TYPE Agrif_PVariable 
+           ! This field allows to get the various CHARACTERistics 
+           !   of the variable (defined by the Agrif_Variable data TYPE)
+           TYPE(Agrif_Variable) , Pointer :: var  
+           ! Pointer on the parent grid
+           TYPE(Agrif_PVariable), Pointer :: parent_var 
+      End TYPE Agrif_PVariable 
+C
+C     **************************************************************************
+CCC   TYPE Agrif_Grid
+C     **************************************************************************
+C
+CCC   Description:
+CCC   Data TYPE to define a grid (position, space and time refinement factors).
+C
+      TYPE Agrif_grid  
+           ! pointer on the parent grid 
+           TYPE(Agrif_grid)                    ,Pointer :: parent      
+           ! pointer on the child grids 
+           TYPE(Agrif_pgrid)                   ,Pointer :: child_grids 
+           ! List of the grid variables   
+           TYPE(Agrif_PVariable), DIMENSION(:) ,Pointer :: tabvars     
+C
+           ! Global x,y and z position
+           REAL    ,DIMENSION(3)                   :: Agrif_x   
+           ! Global space step in the x,y and z direction
+           REAL    ,DIMENSION(3)                   :: Agrif_d
+           ! number of cells in the x,y and z direction
+           INTEGER ,DIMENSION(3)                   :: nb        
+           ! minimal position in the x,y and z direction
+           INTEGER ,DIMENSION(3)                   :: ix        
+           ! Space refinement factor in the x,y and z direction
+           INTEGER ,DIMENSION(3)                   :: spaceref  
+           ! Time refinement factor in the x,y and z direction 
+           INTEGER ,DIMENSION(3)                   :: timeref   
+           INTEGER ,DIMENSION(:)          ,Pointer :: restore1D   
+           INTEGER ,DIMENSION(:,:)        ,Pointer :: restore2D   
+           INTEGER ,DIMENSION(:,:,:)      ,Pointer :: restore3D 
+           INTEGER ,DIMENSION(:,:,:,:)    ,Pointer :: restore4D
+           INTEGER ,DIMENSION(:,:,:,:,:)  ,Pointer :: restore5D
+           INTEGER ,DIMENSION(:,:,:,:,:,:),Pointer :: restore6D
+           ! number of time step  
+           INTEGER                                 :: ngridstep 
+           INTEGER                                 :: rank  
+           !moving grid id
+           INTEGER                                 :: grid_id
+           ! number of the grid 
+           INTEGER                                 :: fixedrank 
+           ! fixed or moving grid ?  
+           LOGICAL                                 :: fixed     
+           LOGICAL                                 :: oldgrid   
+C          LOGICALs indicating if the current grid has a common border 
+C             with the root coarse grid
+           LOGICAL ,DIMENSION(3)                   :: NearRootBorder
+           LOGICAL ,DIMENSION(3)                   :: DistantRootBorder
+C          Arrays for adaptive grid refinement
+           REAL    ,DIMENSION(:)          ,Pointer :: valtabpoint1D
+           REAL    ,DIMENSION(:,:)        ,Pointer :: valtabpoint2D
+           REAL    ,DIMENSION(:,:,:)      ,Pointer :: valtabpoint3D
+           INTEGER ,DIMENSION(:)          ,Pointer :: tabpoint1D
+           INTEGER ,DIMENSION(:,:)        ,Pointer :: tabpoint2D
+           INTEGER ,DIMENSION(:,:,:)      ,Pointer :: tabpoint3D
+      End TYPE Agrif_grid
+C
+C     **************************************************************************
+CCC   TYPE Agrif_VARIABLE
+C     **************************************************************************
+C     
+CCC   Description:
+CCC   Data TYPE to CHARACTERize a grid variable.   
+C
+      TYPE Agrif_Variable 
+C       
+         ! Pointer on the variable of the root grid 
+         TYPE(Agrif_Variable), Pointer :: root_var 
+C
+         ! index of the first point in the REAL domain (x,y and z direction)
+         INTEGER     ,DIMENSION(6)          :: point
+         ! position of the variable on the cell (1 for the boarder of 
+         !    the edge, 2 for the center)
+         INTEGER     ,DIMENSION(:) ,Pointer :: posvar      => NULL() 
+         ! Indication for the space interpolation (module Agrif_Boundary)
+         INTEGER                   ,Pointer :: interpIndex => NULL() 
+         ! number of DIMENSIONs of the grid variable
+         INTEGER                            :: nbdim = 0             
+         ! Array indicating the TYPE of DIMENSION (space or not) for 
+         !    each of them 
+         CHARACTER(6),DIMENSION(:) ,Pointer :: interptab   => NULL() 
+C        Arrays containing the values of the grid variables (REAL)
+         REAL                                    :: array0 
+         REAL   , DIMENSION(:)          ,Pointer :: array1    => NULL()
+         REAL   , DIMENSION(:,:)        ,Pointer :: array2    => NULL()
+         REAL   , DIMENSION(:,:,:)      ,Pointer :: array3    => NULL()
+         REAL   , DIMENSION(:,:,:,:)    ,Pointer :: array4    => NULL()
+         REAL   , DIMENSION(:,:,:,:,:)  ,Pointer :: array5    => NULL()
+         REAL   , DIMENSION(:,:,:,:,:,:),Pointer :: array6    => NULL()
+C        Arrays containing the values of the grid variables (REAL*8)
+         REAL(8)                                 :: darray0
+         REAL(8), DIMENSION(:)          ,Pointer :: darray1   => NULL()
+         REAL(8), DIMENSION(:,:)        ,Pointer :: darray2   => NULL()
+         REAL(8), DIMENSION(:,:,:)      ,Pointer :: darray3   => NULL()
+         REAL(8), DIMENSION(:,:,:,:)    ,Pointer :: darray4   => NULL()
+         REAL(8), DIMENSION(:,:,:,:,:)  ,Pointer :: darray5   => NULL()
+         REAL(8), DIMENSION(:,:,:,:,:,:),Pointer :: darray6   => NULL()
+C        Arrays containing the values of the grid variables (LOGICAL)
+         LOGICAL                                 :: larray0
+         LOGICAL, DIMENSION(:)          ,Pointer :: larray1   => NULL()
+         LOGICAL, DIMENSION(:,:)        ,Pointer :: larray2   => NULL()
+         LOGICAL, DIMENSION(:,:,:)      ,Pointer :: larray3   => NULL()
+         LOGICAL, DIMENSION(:,:,:,:)    ,Pointer :: larray4   => NULL()
+         LOGICAL, DIMENSION(:,:,:,:,:)  ,Pointer :: larray5   => NULL()
+         LOGICAL, DIMENSION(:,:,:,:,:,:),Pointer :: larray6   => NULL()
+C         Arrays containing the values of the grid variables (INTEGER)   
+         INTEGER                                 :: iarray0
+         INTEGER, DIMENSION(:)          ,Pointer :: iarray1   => NULL()
+         INTEGER, DIMENSION(:,:)        ,Pointer :: iarray2   => NULL()
+         INTEGER, DIMENSION(:,:,:)      ,Pointer :: iarray3   => NULL()
+         INTEGER, DIMENSION(:,:,:,:)    ,Pointer :: iarray4   => NULL()
+         INTEGER, DIMENSION(:,:,:,:,:)  ,Pointer :: iarray5   => NULL()
+         INTEGER, DIMENSION(:,:,:,:,:,:),Pointer :: iarray6   => NULL()
+C
+         INTEGER, DIMENSION(:)          ,Pointer :: restore1D => NULL()
+         INTEGER, DIMENSION(:,:)        ,Pointer :: restore2D => NULL()
+         INTEGER, DIMENSION(:,:,:)      ,Pointer :: restore3D => NULL()
+         INTEGER, DIMENSION(:,:,:,:)    ,Pointer :: restore4D => NULL()
+         INTEGER, DIMENSION(:,:,:,:,:)  ,Pointer :: restore5D => NULL()
+         INTEGER, DIMENSION(:,:,:,:,:,:),Pointer :: restore6D => NULL()
+C   
+         CHARACTER(2050)                          :: carray0
+         CHARACTER(200), DIMENSION(:)    ,Pointer :: carray1   => NULL()
+         CHARACTER(200), DIMENSION(:,:)  ,Pointer :: carray2   => NULL()
+C
+         ! Array used for the time interpolation
+         REAL   , DIMENSION(:,:)      ,Pointer :: oldvalues2D => NULL()
+
+         ! if the variable should be restore -> =1
+         LOGICAL :: restaure = .FALSE.
+         ! the interpolation should be made in any case
+         LOGICAL :: Interpolationshouldbemade = .FALSE. 
+         INTEGER :: bcinf ! option bc
+         INTEGER :: bcsup ! option bc
+         INTEGER :: updateinf ! option update
+         INTEGER :: updatesup ! option update         
+         INTEGER, DIMENSION(6) :: bcTYPEinterp ! option bcinterp
+         INTEGER, DIMENSION(6) :: TYPEinterp ! option interp
+         INTEGER, DIMENSION(6) :: TYPEupdate ! option update
+C
+      End TYPE Agrif_Variable   
+C
+C     **************************************************************************
+CCC   Different PARAMETERs
+C     **************************************************************************
+      TYPE(Agrif_PVariable), DIMENSION(:) ,Pointer :: Agrif_tabvars
+C
+      ! this pointer always points on the root grid of the grid hierarchy
+      TYPE(Agrif_grid)  ,Pointer :: Agrif_Mygrid      
+      ! Pointer used in the Agrif_regrid subroutine (Agrif_Util module). 
+      !    It contains  the safeguard of the grid hierarchy.
+      TYPE(Agrif_pgrid) ,Pointer :: Agrif_oldmygrid   
+      ! pointer to the current grid (the link is done by using the
+      !    Agrif_Instance   procedure (module Agrif_Init)) 
+      TYPE(Agrif_grid)  ,Pointer :: Agrif_Curgrid
+      ! Pointer used in the Agrif_ChildGrid_to_ParentGrid and 
+      !    Agrif_ParentGrid_to_ChildGrid subroutines 
+      !    (Agrif_CurgridFunctions module). It contains the 
+      !    safeguard of the current grid hierarchy.
+      TYPE(Agrif_grid)  ,Pointer :: Agrif_saveCURGRID
+C
+      ! Problem DIMENSION
+      INTEGER               :: Agrif_Probdim
+      ! number of variables
+      INTEGER               :: Agrif_NbVariables
+      ! number of fixed grids in the grid hierarchy
+      INTEGER               :: Agrif_nbfixedgrids            
+      ! space refinement factor
+      INTEGER ,DIMENSION(3) :: Agrif_coeffref
+      ! time refinement factor
+      INTEGER ,DIMENSION(3) :: Agrif_coeffreft
+      ! LOGICAL to use special values on the parent grid
+      LOGICAL               :: Agrif_UseSpecialValue
+      ! LOGICAL to use special values on the parent grid
+      LOGICAL               :: Agrif_UseSpecialValueInUpdate
+      ! LOGICAL to use special values on the current grid
+      LOGICAL               :: Agrif_UseSpecialValueFineGrid
+      ! Special values on the parent grid
+      REAL                  :: Agrif_SpecialValue
+      ! Special values on the current grid
+      REAL                  :: Agrif_SpecialValueFineGrid
+C   clustering PARAMETERs
+      INTEGER               :: Agrif_Regridding
+      INTEGER               :: Agrif_Minwidth
+      REAL                  :: Agrif_Efficiency
+      REAL    ,DIMENSION(3) :: Agrif_mind
+C     PARAMETERs for the interpolation of the child grids
+      ! linear interpolation
+      INTEGER ,PARAMETER    :: Agrif_linear=1
+      ! lagrange interpolation
+      INTEGER ,PARAMETER    :: Agrif_lagrange=2
+      ! spline interpolation
+      INTEGER ,PARAMETER    :: Agrif_eno=3
+      ! user s interpolation
+      INTEGER ,PARAMETER    :: Agrif_user_interp=4
+      ! constant interpolation
+      INTEGER ,PARAMETER    :: Agrif_constant=5
+      ! linear conservative interpolation 
+      INTEGER ,PARAMETER    :: Agrif_linearconserv=6
+      ! linear conservative interpolation       
+      INTEGER ,PARAMETER    :: Agrif_linearconservlim=7
+      INTEGER ,PARAMETER    :: Agrif_ppm=8    
+C     PARAMETERs for the update of the parent grids      
+      INTEGER ,PARAMETER    :: Agrif_Update_Copy=1           ! copy
+      INTEGER ,PARAMETER    :: Agrif_Update_Average=2        ! average
+      INTEGER ,PARAMETER    :: Agrif_Update_Full_Weighting=3 ! full-weighting 
+C     Raffinement grid switch definition
+      ! Agrif_USE_ONLY_FIXED_GRIDS =1 if fixed grid mode
+      INTEGER               :: Agrif_USE_ONLY_FIXED_GRIDS    
+      ! Agrif_USE_FIXED_GRIDS = 1 if AMR mode + fixed grid 
+      !    else only AMR mode
+      INTEGER               :: Agrif_USE_FIXED_GRIDS         
+C
+#ifdef AGRIF_MPI
+      INTEGER :: Agrif_Nbprocs  ! Number of processors
+      INTEGER :: Agrif_ProcRank ! Rank of the current processor 
+      INTEGER :: Agrif_Group    ! Group associated to MPI_COMM_WORLD
+      INTEGER :: Agrif_MPIPREC
+#endif
+C
+      contains
+C   
+      Integer Function agrif_ceiling(x)
+C             
+          Real :: x
+          Integer ::i 
+C
+          i = floor(x)
+C      
+          if( abs(x - i).le.0.0001 )then
+             agrif_ceiling = i
+          else
+             agrif_ceiling = i+1
+          endif      
+C
+      End Function
+C
+      Integer Function agrif_int(x)
+C             
+          Real :: x
+          Integer ::i 
+C
+          i = floor(x) + 1
+C      
+          if( abs(x - i).le.0.0001 )then
+             agrif_int = i
+          else
+             agrif_int = i-1
+          endif      
+C
+      End Function
+      End Module Agrif_TYPEs  
Index: /trunk/AGRIF/AGRIF_FILES/modupdate.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modupdate.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modupdate.F	(revision 396)
@@ -0,0 +1,2244 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Update
+C
+      Module Agrif_Update
+C
+CCC   Description:
+CCC   Module to update a parent grid from its child grids
+C
+C     Modules used:
+C   
+      Use Agrif_Updatebasic
+c      Use Agrif_Boundary
+      Use Agrif_Arrays
+      Use Agrif_CurgridFunctions
+      Use Agrif_Mask
+#ifdef AGRIF_MPI
+      Use Agrif_mpp
+#endif
+C
+      IMPLICIT NONE
+C      
+      CONTAINS
+C     Define procedures contained in this module
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Update_1d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Update_1d(TypeUpdate,parent,child,tab,deb,fin,
+     &                           procname)
+C
+CCC   Description:
+CCC   Subroutine to update a 1D grid variable on the parent grid.
+C
+C     Declarations:
+C
+      
+C
+C     Arguments      
+      INTEGER, DIMENSION(6) :: TypeUpdate                  ! TYPE of update (copy or average)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid       
+      External :: procname
+      Optional ::  procname      
+      REAL, DIMENSION(lbound(child%var%array1,1):
+     &                ubound(child%var%array1,1)), Target :: tab  ! Results
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE  
+      allocate(childtemp % var)
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = 1  
+C      
+C     Values on the current grid used for the update
+      childtemp % var % array1 => tab      
+C
+     
+      IF (present(procname)) THEN
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin,procname)
+      ELSE
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin)
+      ENDIF     
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Update_1D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Update_2d
+C     **************************************************************************
+C 
+
+      Subroutine Agrif_Update_2d(TypeUpdate,parent,child,tab,deb,fin,
+     &                           procname)
+C
+CCC   Description:
+CCC   Subroutine to update a 2D grid variable on the parent grid.
+C
+C     Declarations:
+C
+      
+C
+C     Arguments      
+      INTEGER, DIMENSION(6) :: TypeUpdate                  ! TYPE of update (copy or average)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid 
+                                              
+      External :: procname
+      Optional ::  procname
+                                                          
+      REAL, DIMENSION(
+     &      lbound(child%var%array2,1):ubound(child%var%array2,1),
+     &      lbound(child%var%array2,2):ubound(child%var%array2,2)),
+     &      Target :: tab  ! Results
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE
+      allocate(childtemp % var)
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = 2  
+C      
+C     Values on the current grid used for the update
+      childtemp % var % array2 => tab      
+C
+      IF (present(procname)) THEN
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin,procname)
+      ELSE
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin)
+      ENDIF
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Update_2D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Update_3d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Update_3d(TypeUpdate,parent,child,tab,deb,fin,
+     &                           procname)
+C
+CCC   Description:
+CCC   Subroutine to update a 3D grid variable on the parent grid.
+C
+C     Declarations:
+C
+      
+C
+C     Arguments      
+      INTEGER, DIMENSION(6) :: TypeUpdate                  ! TYPE of update (copy or average)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid    
+      External :: procname
+      Optional ::  procname
+                                                       
+      REAL, DIMENSION(
+     &      lbound(child%var%array3,1):ubound(child%var%array3,1),
+     &      lbound(child%var%array3,2):ubound(child%var%array3,2),
+     &      lbound(child%var%array3,3):ubound(child%var%array3,3)),
+     &      Target :: tab  ! Results    
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE  
+      allocate(childtemp % var)
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = 3  
+C      
+C     Values on the current grid used for the update
+      childtemp % var % array3 => tab     
+C
+      IF (present(procname)) THEN
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin,procname)
+      ELSE
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin)
+      ENDIF
+C      
+      DEALLOCATE(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Update_3D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Update_4d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Update_4d(TypeUpdate,parent,child,tab,deb,fin,
+     &                           procname)
+C
+CCC   Description:
+CCC   Subroutine to update a 4D grid variable on the parent grid.
+C
+C     Declarations:
+C
+      
+C
+C     Arguments      
+      INTEGER, DIMENSION(6) :: TypeUpdate                  ! TYPE of update (copy or average)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid     
+      External :: procname
+      Optional ::  procname        
+      REAL, DIMENSION(
+     &      lbound(child%var%array4,1):ubound(child%var%array4,1),
+     &      lbound(child%var%array4,2):ubound(child%var%array4,2),
+     &      lbound(child%var%array4,3):ubound(child%var%array4,3),
+     &      lbound(child%var%array4,4):ubound(child%var%array4,4)),
+     &      Target :: tab  ! Results
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE  
+      allocate(childtemp % var)
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = 4  
+C      
+C     Values on the current grid used for the update
+      childtemp % var % array4 => tab     
+C
+      IF (present(procname)) THEN
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin,procname)
+      ELSE
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin)
+      ENDIF
+C
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Update_4D
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Update_5d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Update_5d(TypeUpdate,parent,child,tab,deb,fin,
+     &                           procname)
+C
+CCC   Description:
+CCC   Subroutine to update a 5D grid variable on the parent grid.
+C
+C     Declarations:
+C
+      
+C
+C     Arguments      
+      INTEGER, DIMENSION(6) :: TypeUpdate                  ! TYPE of update (copy or average)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid     
+      External :: procname
+      Optional ::  procname
+              
+      REAL, DIMENSION(
+     &      lbound(child%var%array5,1):ubound(child%var%array5,1),
+     &      lbound(child%var%array5,2):ubound(child%var%array5,2),
+     &      lbound(child%var%array5,3):ubound(child%var%array5,3),
+     &      lbound(child%var%array5,4):ubound(child%var%array5,4),
+     &      lbound(child%var%array5,5):ubound(child%var%array5,5)),
+     &      Target :: tab  ! Results
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE  
+      allocate(childtemp % var)
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = 5  
+C      
+C     Values on the current grid used for the update
+      childtemp % var % array5 => tab      
+C
+      IF (present(procname)) THEN
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin,procname)
+      ELSE
+      CALL Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin)
+      ENDIF
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Update_5D
+C
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Update_6d
+C     **************************************************************************
+C 
+      Subroutine Agrif_Update_6d(TypeUpdate,parent,child,tab,deb,fin)
+C
+CCC   Description:
+CCC   Subroutine to update a 6D grid variable on the parent grid.
+C
+C     Declarations:
+C
+      
+C
+C     Arguments      
+      INTEGER, DIMENSION(6) :: TypeUpdate                  ! TYPE of update (copy or average)
+      TYPE(AGRIF_PVariable) :: parent        ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child         ! Variable on the child grid
+      TYPE(AGRIF_PVariable) :: childtemp     ! Temporary variable on the child
+      INTEGER :: deb,fin                      ! Positions where interpolations 
+                                              ! are done on the fine grid       
+      REAL, DIMENSION(
+     &      lbound(child%var%array6,1):ubound(child%var%array6,1),
+     &      lbound(child%var%array6,2):ubound(child%var%array6,2),
+     &      lbound(child%var%array6,3):ubound(child%var%array6,3),
+     &      lbound(child%var%array6,4):ubound(child%var%array6,4),
+     &      lbound(child%var%array6,5):ubound(child%var%array6,5),
+     &      lbound(child%var%array6,6):ubound(child%var%array6,6)),
+     &      Target :: tab  ! Results
+C
+C
+C     Definition of a temporary AGRIF_PVariable data TYPE  
+      allocate(childtemp % var)
+C
+C     Pointer on the root variable
+      childtemp % var % root_var => child % var %root_var
+C      
+C     Number of dimensions of the grid variable
+      childtemp % var % nbdim = 6  
+C      
+C     Values on the current grid used for the update
+      childtemp % var % array6 => tab      
+C
+      Call Agrif_UpdateVariable
+     &     (TypeUpdate,parent,child,deb,fin)
+C      
+      deallocate(childtemp % var)
+C
+C       
+      End Subroutine Agrif_Update_6D
+C
+C
+C
+C     **************************************************************************  
+C     Subroutine Agrif_UpdateVariable    
+C     **************************************************************************  
+C   
+      Subroutine Agrif_UpdateVariable(TypeUpdate,parent,child,deb,fin,
+     &                   procname)   
+C
+CCC   Description:
+CCC   Subroutine to set arguments of Agrif_UpdatenD, n being the number of
+C         dimensions of the grid variable.
+C
+CC    Declarations:
+C      
+c      
+C      
+C     Scalar argument
+      INTEGER, DIMENSION(6) :: TypeUpdate                  ! TYPE of update (copy or average)
+C     Data TYPE arguments
+      TYPE(AGRIF_PVariable) :: parent   ! Variable on the parent grid
+      TYPE(AGRIF_PVariable) :: child    ! Variable on the child grid 
+      INTEGER               :: deb,fin  ! Positions where boundary conditions
+                                        !    are calculated     
+      External :: procname
+      Optional ::  procname
+      
+C
+C     Local scalars      
+      INTEGER :: nbdim                  ! Number of dimensions of the current
+                                        !    grid
+      INTEGER ,DIMENSION(6) :: pttab_child  
+      INTEGER ,DIMENSION(6) :: petab_child      
+      INTEGER ,DIMENSION(6) :: pttab_parent  
+      REAL    ,DIMENSION(6) :: s_child,s_parent
+      REAL    ,DIMENSION(6) :: ds_child,ds_parent
+      INTEGER,DIMENSION(6)          :: loctab_Child ! Indicates if the child
+                                        !    grid has a common border with 
+                                        !    the root grid            
+      TYPE(AGRIF_Variable), Pointer :: root               ! Variable on the root grid
+      INTEGER,DIMENSION(6)          :: posvartab_Child    ! Position of the
+                                        !    variable on the cell
+      INTEGER,DIMENSION(6)          :: nbtab_Child        ! Number of the cells    
+      INTEGER :: n              
+      LOGICAL :: wholeupdate
+C
+C 
+
+      loctab_child(:) = 0
+C
+      root => child % var % root_var 
+      nbdim = root % nbdim
+C
+      do n = 1,nbdim
+        posvartab_child(n) = root % posvar(n)
+      enddo
+C      
+      
+      Call PreProcessToInterpOrUpdate(parent,child,
+     &             petab_Child(1:nbdim),
+     &             pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &             s_Child(1:nbdim),s_Parent(1:nbdim),
+     &             ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &             nbdim)
+C
+C
+      do n = 1,nbdim
+C
+        Select case(root % interptab(n))
+C
+          case('x') ! x DIMENSION
+C
+            nbtab_Child(n) = Agrif_Curgrid % nb(1)
+C
+          case('y') ! y DIMENSION      
+C
+            nbtab_Child(n) = Agrif_Curgrid % nb(2)
+C
+          case('z') ! z DIMENSION
+C
+            nbtab_Child(n) = Agrif_Curgrid % nb(3)
+C
+          case('N') ! No space DIMENSION      
+C
+            select case (nbdim) 
+C      
+              case(1)
+                nbtab_Child(n) = SIZE(child % var % array1,n) - 1
+              case(2)
+                nbtab_Child(n) = SIZE(child % var % array2,n) - 1
+              case(3)
+                nbtab_Child(n) = SIZE(child % var % array3,n) - 1
+              case(4)
+                nbtab_Child(n) = SIZE(child % var % array4,n) - 1
+              case(5)
+                nbtab_Child(n) = SIZE(child % var % array5,n) - 1  
+              case(6)
+                nbtab_Child(n) = SIZE(child % var % array6,n) - 1 
+C
+            end select
+C
+C           No interpolation but only a copy of the values of the grid variable      
+C      
+            posvartab_child(n) = 1
+            
+            loctab_child(n) = -3
+C
+        End select
+C
+      enddo
+      
+C     Call to a procedure of update according to the number of dimensions of
+C     the grid variable
+
+      wholeupdate = .FALSE.
+
+      IF ((deb == -99) .AND. (deb == fin)) THEN
+       wholeupdate = .TRUE.
+      ENDIF
+
+      IF ((deb > fin)) THEN
+       wholeupdate = .TRUE.
+      ENDIF
+     
+       IF (present(procname)) THEN
+
+          IF (wholeupdate) THEN
+
+          Call AGRIF_UpdateWhole
+     &         (TypeUpdate,parent,child,deb,fin,
+     &          pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &          nbtab_Child(1:nbdim),posvartab_Child(1:nbdim),
+     &          loctab_Child(1:nbdim),
+     &          s_Child(1:nbdim),s_Parent(1:nbdim),
+     &          ds_Child(1:nbdim),ds_Parent(1:nbdim),nbdim,procname)  
+         ELSE
+          Call AGRIF_UpdateBcnD
+     &         (TypeUpdate,parent,child,deb,fin,
+     &          pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &          nbtab_Child(1:nbdim),posvartab_Child(1:nbdim),
+     &          loctab_Child(1:nbdim),
+     &          s_Child(1:nbdim),s_Parent(1:nbdim),
+     &          ds_Child(1:nbdim),ds_Parent(1:nbdim),nbdim,procname)  
+         ENDIF
+       ELSE
+         IF (wholeupdate) THEN
+          Call AGRIF_UpdateWhole
+     &         (TypeUpdate,parent,child,deb,fin,
+     &          pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &          nbtab_Child(1:nbdim),posvartab_Child(1:nbdim),
+     &          loctab_Child(1:nbdim),
+     &          s_Child(1:nbdim),s_Parent(1:nbdim),
+     &          ds_Child(1:nbdim),ds_Parent(1:nbdim),nbdim)
+         ELSE
+          Call AGRIF_UpdateBcnD
+     &         (TypeUpdate,parent,child,deb,fin,
+     &          pttab_Child(1:nbdim),pttab_Parent(1:nbdim),
+     &          nbtab_Child(1:nbdim),posvartab_Child(1:nbdim),
+     &          loctab_Child(1:nbdim),
+     &          s_Child(1:nbdim),s_Parent(1:nbdim),
+     &          ds_Child(1:nbdim),ds_Parent(1:nbdim),nbdim)
+         ENDIF
+       ENDIF
+C
+      Return
+C
+C
+      End subroutine Agrif_UpdateVariable
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_UpdateWhole
+C     **************************************************************************               
+C
+      Subroutine AGRIF_UpdateWhole(TypeUpdate,parent,child,deb,fin,
+     &                           pttab_child,pttab_Parent,
+     &                           nbtab_Child,posvartab_Child,
+     &                           loctab_Child,
+     &                           s_Child,s_Parent,
+     &                           ds_Child,ds_Parent,nbdim,procname)
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions for a nD grid variable on 
+CCC   a fine grid by using a space and time interpolations; it is called by the 
+CCC   Agrif_CorrectVariable procedure.
+C
+C
+C     Declarations:
+C
+      
+C
+#ifdef AGRIF_MPI
+C
+#include "mpif.h"
+C
+#endif
+C
+C     Arguments
+      INTEGER, DIMENSION(6) :: TypeUpdate            ! TYPE of update (copy or
+                                                     !    average) 
+      TYPE(AGRIF_PVariable)    :: parent             ! Variable on the parent
+                                                     !    grid
+      TYPE(AGRIF_PVariable)    :: child              ! Variable on the child
+                                                     !    grid 
+      INTEGER :: deb, fin
+      INTEGER                  :: nbdim              ! Number of dimensions of
+                                                     !    the grid variable
+      INTEGER,DIMENSION(nbdim) :: pttab_child        ! Index of the first point
+                                                     !    inside the domain for
+                                                     !    the parent grid
+                                                     !    variable
+      INTEGER,DIMENSION(nbdim) :: pttab_Parent       ! Index of the first point
+                                                     !    inside the domain for
+                                                     !    the child grid
+                                                     !    variable
+      INTEGER,DIMENSION(nbdim) :: nbtab_Child        ! Number of cells of the
+                                                     !    child grid
+      INTEGER,DIMENSION(nbdim) :: posvartab_Child    ! Position of the grid
+                                                     !    variable (1 or 2)
+      INTEGER,DIMENSION(nbdim) :: loctab_Child       ! Indicates if the child
+                                                     !    grid has a common
+                                                     !    border with the root
+                                                     !    grid
+      REAL   ,DIMENSION(nbdim) :: s_Child,s_Parent   ! Positions of the parent
+                                                     !    and child grids 
+      REAL   ,DIMENSION(nbdim) :: ds_Child,ds_Parent ! Space steps of the parent
+                                                     !    and child grids
+      External :: procname
+      Optional ::  procname      
+C
+C     Local variables     
+      INTEGER,DIMENSION(nbdim,2)   :: lubglob
+      INTEGER                      :: i                 
+      INTEGER,DIMENSION(nbdim,2,2) :: indtab         ! Arrays indicating the
+                                                     !    limits of the child
+      INTEGER,DIMENSION(nbdim,2,2) :: indtruetab     ! grid variable where
+                                                     !   boundary conditions are
+      integer :: coeffraf
+      INTEGER :: debloc, finloc
+C
+#ifdef AGRIF_MPI
+C
+      INTEGER,DIMENSION(nbdim)   :: lb,ub
+      INTEGER,DIMENSION(nbdim,2) :: iminmaxg
+      INTEGER                    :: code
+C
+#endif
+C      
+C
+C indtab contains the limits for the fine grid points that will be used
+C in the update scheme
+
+      DO i = 1, nbdim
+        coeffraf = nint(ds_Parent(i)/ds_Child(i))
+        debloc = 0
+        finloc = nbtab_Child(i)/coeffraf - 1
+
+        IF (posvartab_child(i) == 1) THEN
+           finloc = finloc - 1
+        ENDIF
+
+        IF (deb > fin) THEN
+          debloc = deb
+          finloc = finloc - deb
+        ENDIF
+
+        indtab(i,1,1) = pttab_child(i) + (debloc + 1) * coeffraf
+        indtab(i,1,2) = pttab_child(i) + (finloc + 1) * coeffraf
+
+        IF (posvartab_child(i) == 1) THEN
+          IF (TypeUpdate(i) .NE. Agrif_Update_Copy) THEN
+            indtab(i,1,1) = indtab(i,1,1) - coeffraf / 2
+            indtab(i,1,2) = indtab(i,1,2) + coeffraf / 2
+          ENDIF
+        ELSE
+          indtab(i,1,1) = indtab(i,1,1) - coeffraf
+          indtab(i,1,2) = indtab(i,1,2) - 1
+        ENDIF
+        IF (loctab_child(i) == -3) THEN
+           indtab(i,1,1) = pttab_child(i)
+C
+               if (posvartab_child(i) == 1) then
+C
+               indtab(i,1,2) = pttab_child(i) + nbtab_child(i) 
+C
+               else
+C
+               indtab(i,1,2) = pttab_child(i) + nbtab_child(i) - 1
+               ENDIF
+        ENDIF
+      ENDDO
+
+C lubglob contains the global lbound and ubound of the child array
+C lubglob(:,1) : global lbound for each dimension
+C lubglob(:,2) : global lbound for each dimension
+
+#if !defined AGRIF_MPI
+        Call Agrif_nbdim_Get_bound_dimension(child % var,lubglob(:,1),
+     &               lubglob(:,2),nbdim)
+C
+#else
+C     
+        Call Agrif_nbdim_Get_bound_dimension(child % var,lb,ub,nbdim)
+      DO i = 1,nbdim
+C
+        Call Agrif_Invloc(lb(i),Agrif_Procrank,i,iminmaxg(i,1))
+        Call Agrif_Invloc(ub(i),Agrif_Procrank,i,iminmaxg(i,2))
+C
+      ENDDO
+C
+      iminmaxg(1:nbdim,2) = - iminmaxg(1:nbdim,2)
+      
+      CALL MPI_ALLREDUCE(iminmaxg,lubglob,2*nbdim,MPI_INTEGER,MPI_MIN,
+     &                     MPI_COMM_WORLD,code)
+
+      lubglob(1:nbdim,2) = - lubglob(1:nbdim,2)      
+C
+#endif 
+C
+
+      indtruetab(1:nbdim,1,1) = max(indtab(1:nbdim,1,1),
+     &     lubglob(1:nbdim,1))
+      indtruetab(1:nbdim,1,2) = min(indtab(1:nbdim,1,2),
+     &     lubglob(1:nbdim,2))
+
+C
+C
+
+           IF (present(procname)) THEN
+              Call Agrif_UpdatenD              
+     &             (TypeUpdate,parent,child,
+     &              indtruetab(1:nbdim,1,1),indtruetab(1:nbdim,1,2),
+     &              pttab_child(1:nbdim),pttab_Parent(1:nbdim),
+     &              s_Child(1:nbdim),s_Parent(1:nbdim),
+     &              ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &              posvartab_child,loctab_Child,
+     &              nbdim,procname)
+           ELSE
+              Call Agrif_UpdatenD              
+     &             (TypeUpdate,parent,child,
+     &              indtruetab(1:nbdim,1,1),indtruetab(1:nbdim,1,2),
+     &              pttab_child(1:nbdim),pttab_Parent(1:nbdim),
+     &              s_Child(1:nbdim),s_Parent(1:nbdim),
+     &              ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &              posvartab_child,loctab_Child,
+     &              nbdim)           
+           ENDIF
+C
+C      
+C  
+      End Subroutine Agrif_UpdateWhole
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_UpdateBcnd
+C     **************************************************************************               
+C
+      Subroutine AGRIF_UpdateBcnd(TypeUpdate,parent,child,deb,fin,
+     &                           pttab_child,pttab_Parent,
+     &                           nbtab_Child,posvartab_Child,
+     &                           loctab_Child,
+     &                           s_Child,s_Parent,
+     &                           ds_Child,ds_Parent,nbdim,procname)
+C
+CCC   Description:
+CCC   Subroutine to calculate the boundary conditions for a nD grid variable on
+CCC   a fine grid by using a space and time interpolations; it is called by the 
+CCC   Agrif_CorrectVariable procedure.
+C
+C
+C     Declarations:
+C
+      
+C
+#ifdef AGRIF_MPI
+C
+#include "mpif.h"
+C
+#endif
+C
+C     Arguments
+      INTEGER, DIMENSION(6) :: TypeUpdate            ! TYPE of update 
+                                                     !   (copy or average) 
+      TYPE(AGRIF_PVariable)    :: parent             ! Variable on the parent
+                                                     !   grid
+      TYPE(AGRIF_PVariable)    :: child              ! Variable on the child
+                                                     !   grid 
+      INTEGER                  :: deb,fin            ! Positions where
+                                                     !   interpolations are done
+      INTEGER                  :: nbdim              ! Number of dimensions of
+                                                     !   the grid variable
+      INTEGER,DIMENSION(nbdim) :: pttab_child        ! Index of the first point
+                                                     !   inside the domain for
+                                                     !   the parent grid
+                                                     !   variable
+      INTEGER,DIMENSION(nbdim) :: pttab_Parent       ! Index of the first point
+                                                     !   inside the domain for
+                                                     !   the child grid variable
+      INTEGER,DIMENSION(nbdim) :: nbtab_Child        ! Number of cells of the
+                                                     !   child grid
+      INTEGER,DIMENSION(nbdim) :: posvartab_Child    ! Position of the grid
+                                                     !   variable (1 or 2)
+      INTEGER,DIMENSION(nbdim) :: loctab_Child       ! Indicates if the child
+                                                     !   grid has a common
+                                                     !   border with the root
+                                                     !   grid
+      REAL   ,DIMENSION(nbdim) :: s_Child,s_Parent   ! Positions of the parent
+                                                     !   and child grids 
+      REAL   ,DIMENSION(nbdim) :: ds_Child,ds_Parent ! Space steps of the parent
+                                                     !   and child grids
+      External :: procname
+      Optional ::  procname      
+C
+C     Local variables
+      INTEGER,DIMENSION(nbdim,2)   :: lubglob
+      INTEGER                      :: i                 
+      INTEGER,DIMENSION(nbdim,2,2) :: indtab         ! Arrays indicating the
+                                                     !   limits of the child
+      INTEGER,DIMENSION(nbdim,2,2) :: indtruetab     ! grid variable where
+                                                     !  boundary conditions are 
+      INTEGER,DIMENSION(nbdim,2,2,nbdim)   :: ptres      ! calculated
+      INTEGER                      :: nb,ndir,n
+      integer :: coeffraf
+C
+#ifdef AGRIF_MPI
+C
+      INTEGER,DIMENSION(nbdim)   :: lb,ub
+      INTEGER,DIMENSION(nbdim,2) :: iminmaxg
+      INTEGER                    :: code
+C
+#endif
+C      
+C
+
+      DO i = 1, nbdim
+        coeffraf = nint(ds_Parent(i)/ds_Child(i))
+        indtab(i,1,1) = pttab_child(i) + (deb + 1) * coeffraf
+        indtab(i,1,2) = pttab_child(i) + (fin + 1) * coeffraf
+
+        indtab(i,2,1) = pttab_child(i) + nbtab_child(i)
+     &    - (fin + 1) *  coeffraf
+        indtab(i,2,2) = pttab_child(i) + nbtab_child(i)
+     &    - (deb + 1) *  coeffraf
+
+        IF (posvartab_child(i) == 1) THEN
+          IF (TypeUpdate(i) .NE. Agrif_Update_Copy) THEN
+            indtab(i,:,1) = indtab(i,:,1) - coeffraf / 2
+            indtab(i,:,2) = indtab(i,:,2) + coeffraf / 2
+          ENDIF
+        ELSE
+          indtab(i,1,1) = indtab(i,1,1) - coeffraf
+          indtab(i,1,2) = indtab(i,1,2) - 1
+          indtab(i,2,2) = indtab(i,2,2) + coeffraf - 1
+        ENDIF
+      ENDDO
+
+#if !defined AGRIF_MPI      
+        Call Agrif_nbdim_Get_bound_dimension(child % var,lubglob(:,1),
+     &               lubglob(:,2),nbdim)
+
+C
+#else
+C     
+        Call Agrif_nbdim_Get_bound_dimension(child % var,lb,ub,nbdim)
+      DO i = 1,nbdim
+C
+        Call Agrif_Invloc(lb(i),Agrif_Procrank,i,iminmaxg(i,1))
+        Call Agrif_Invloc(ub(i),Agrif_Procrank,i,iminmaxg(i,2))
+C
+      ENDDO
+C
+      iminmaxg(1:nbdim,2) = - iminmaxg(1:nbdim,2)
+      
+      CALL MPI_ALLREDUCE(iminmaxg,lubglob,2*nbdim,MPI_INTEGER,MPI_MIN,
+     &                     MPI_COMM_WORLD,code)  
+     
+      lubglob(1:nbdim,2) = - lubglob(1:nbdim,2)      
+C
+#endif 
+C     
+      indtruetab(1:nbdim,1,1) = max(indtab(1:nbdim,1,1),
+     &     lubglob(1:nbdim,1))
+      indtruetab(1:nbdim,1,2) = max(indtab(1:nbdim,1,2),
+     &     lubglob(1:nbdim,1))
+      indtruetab(1:nbdim,2,1) = min(indtab(1:nbdim,2,1),
+     &     lubglob(1:nbdim,2))
+      indtruetab(1:nbdim,2,2) = min(indtab(1:nbdim,2,2),
+     &     lubglob(1:nbdim,2))
+                        
+C 
+C
+      do nb = 1,nbdim
+C
+        do ndir = 1,2
+C
+          if (loctab_child(nb) /= -3) then
+C           
+              do n = 1,2
+C
+                ptres(nb,n,ndir,nb) = indtruetab(nb,ndir,n)
+C
+              enddo              
+C
+              do i = 1,nbdim
+C     
+                if (i .NE. nb) then      
+C
+                    if (loctab_child(i) == -3) then
+C
+                        ptres(i,1,ndir,nb) = pttab_child(i)
+C
+                      else
+C
+                        ptres(i,1,ndir,nb) = indtruetab(i,1,1)
+C
+                    endif
+C
+                    if (loctab_child(i) == -3) then
+C
+                        if (posvartab_child(i) == 1) then
+C
+                            ptres(i,2,ndir,nb) = pttab_child(i) 
+     &                                + nbtab_child(i)
+C
+                          else
+C
+                            ptres(i,2,ndir,nb) = pttab_child(i) 
+     &                             + nbtab_child(i) - 1
+C
+                        endif                             
+C
+                      else
+C
+                        ptres(i,2,ndir,nb) = indtruetab(i,2,2)
+C
+                    endif                        
+C      
+                endif
+C      
+              enddo
+      
+C
+            
+        endif
+      
+        enddo
+       enddo
+C
+
+C
+
+      do nb = 1,nbdim
+C
+        do ndir = 1,2                
+C
+          if (loctab_child(nb) /= -3) then
+C
+           IF (present(procname)) THEN
+              Call Agrif_UpdatenD              
+     &             (TypeUpdate,parent,child,
+     &              ptres(1:nbdim,1,ndir,nb),ptres(1:nbdim,2,ndir,nb),
+     &              pttab_child(1:nbdim),pttab_Parent(1:nbdim),
+     &              s_Child(1:nbdim),s_Parent(1:nbdim),
+     &              ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &              posvartab_Child,loctab_Child,
+     &              nbdim,procname)
+           ELSE
+              Call Agrif_UpdatenD              
+     &             (TypeUpdate,parent,child,
+     &              ptres(1:nbdim,1,ndir,nb),ptres(1:nbdim,2,ndir,nb),
+     &              pttab_child(1:nbdim),pttab_Parent(1:nbdim),
+     &              s_Child(1:nbdim),s_Parent(1:nbdim),
+     &              ds_Child(1:nbdim),ds_Parent(1:nbdim),
+     &              posvartab_Child,loctab_Child,
+     &              nbdim)           
+           ENDIF
+C
+          endif
+          
+C
+        enddo       
+C
+      enddo
+C
+C      
+C  
+      End Subroutine Agrif_UpdateBcnd
+C
+C     **************************************************************************  
+CCC   Subroutine Agrif_UpdatenD  
+C     **************************************************************************  
+C  
+      Subroutine Agrif_UpdatenD(TypeUpdate,parent,child,
+     &                          pttab,petab,
+     &                          pttab_Child,pttab_Parent,
+     &                          s_Child,s_Parent,
+     &                          ds_Child,ds_Parent,
+     &                          posvartab_Child,loctab_Child,
+     &                          nbdim,procname)  
+C
+C     Description:
+C     Subroutine to update a 2D grid variable on the parent grid of 
+C        the current grid. 
+C
+C     Declarations:
+C
+      
+C
+#ifdef AGRIF_MPI
+C
+#include "mpif.h"
+C
+#endif
+C
+C     Arguments
+      INTEGER                    :: nbdim
+      INTEGER, DIMENSION(6) :: TypeUpdate              ! TYPE of update 
+                                                       !  (copy or average)
+      TYPE(AGRIF_PVARIABLE)      :: parent             ! Variable of the parent
+                                                       !   grid   
+      TYPE(AGRIF_PVARIABLE)      :: child              ! Variable of the child
+                                                       !   grid
+      INTEGER,DIMENSION(nbdim)   :: pttab              ! Index of the first
+                                                       !   point inside the
+                                                       !   domain
+      INTEGER,DIMENSION(nbdim)   :: petab              ! Index of the first
+                                                       !   point inside the
+                                                       !   domain
+      INTEGER,DIMENSION(nbdim)   :: pttab_Child        ! Index of the first
+                                                       !   point inside the
+                                                       !   domain for the child
+                                                       !   grid variable
+      INTEGER,DIMENSION(nbdim)   :: pttab_Parent       ! Index of the first
+                                                       !   point inside the
+                                                       !   domain for the parent
+                                                       !   grid variable
+      REAL,DIMENSION(nbdim)      :: s_Child,s_Parent   ! Positions of the parent
+                                                       !   and child grids
+      REAL,DIMENSION(nbdim)      :: ds_Child,ds_Parent ! Space steps of the
+                                                       !   parent and child
+                                                       !   grids 
+      External :: procname
+      Optional ::  procname
+C
+C     Local pointers
+      TYPE(AGRIF_PVARIABLE)      :: tempP      ! Temporary parent grid variable
+      TYPE(AGRIF_PVARIABLE)      :: tempC      ! Temporary child grid variable
+C
+C     Local scalars
+      INTEGER,DIMENSION(nbdim)    :: pttruetab,cetruetab
+      INTEGER,DIMENSION(nbdim)    :: posvartab_Child,loctab_Child
+      INTEGER,DIMENSION(nbdim)    :: indmin,indmax
+      INTEGER,DIMENSION(nbdim)    :: indminglob,indmaxglob
+      REAL   ,DIMENSION(nbdim)    :: s_Child_temp,s_Parent_temp
+cccccccc      LOGICAL,DIMENSION(nbdim)    :: noraftab
+      INTEGER,DIMENSION(nbdim)    :: lowerbound,upperbound
+      LOGICAL :: memberin, member
+      INTEGER,DIMENSION(nbdim)    :: pttruetabwhole,cetruetabwhole
+      INTEGER,DIMENSION(nbdim,2,2) :: childarray
+      INTEGER,DIMENSION(nbdim,2,2) :: parentarray
+      TYPE(AGRIF_PVARIABLE)      :: tempCextend,tempPextend ! Temporary child
+                                                            !    grid
+C
+#ifdef AGRIF_MPI
+C
+      INTEGER,DIMENSION(nbdim)    :: indminglob2,indmaxglob2
+      INTEGER                              :: code
+      INTEGER                              :: i,j,k
+      INTEGER,DIMENSION(nbdim,4)           :: tab3
+      INTEGER,DIMENSION(nbdim,4,0:Agrif_Nbprocs-1) :: tab4
+      INTEGER,DIMENSION(nbdim,0:Agrif_Nbprocs-1,4) :: tab4t
+ccccccccccccccc      TYPE(AGRIF_PVARIABLE)                :: childvalues
+C
+#endif
+C
+  
+C
+C     local lbound and ubound of the child array
+
+      Call Agrif_nbdim_Get_bound_dimension(child%var,
+     &                              lowerbound,upperbound,nbdim)
+
+C here pttab and petab corresponds to the (global) indices of the points needed
+C in the update
+C pttruetab and cetruetab contains only indices that are present
+C on the local processor
+
+      Call Agrif_Childbounds(nbdim,
+     &                       lowerbound,upperbound,
+     &                       pttab,petab,
+     &                       pttruetab,cetruetab,memberin)
+
+       Call Agrif_Prtbounds(nbdim,indminglob,indmaxglob,s_Parent_temp,
+     &                     s_Child_temp,s_Child,ds_Child,
+     &                     s_Parent,ds_Parent,
+     &                     pttab,petab,pttab_Child,
+     &                     pttab_Parent,
+     &                     posvartab_Child,TypeUpdate,loctab_Child
+#ifdef AGRIF_MPI
+     &                 ,pttruetabwhole,cetruetabwhole
+#endif
+     &     )
+
+#ifdef AGRIF_MPI
+      IF (memberin) THEN
+       Call Agrif_GlobtoLocInd2(childarray,
+     &                     lowerbound,upperbound,
+     &                     pttruetab,cetruetab,
+     &                     nbdim,Agrif_Procrank,
+     &                     member)
+
+      ENDIF
+
+
+         Call Agrif_Prtbounds(nbdim,indmin,indmax,s_Parent_temp,
+     &                     s_Child_temp,s_Child,ds_Child,
+     &                     s_Parent,ds_Parent,
+     &                     pttruetab,cetruetab,pttab_Child,
+     &                     pttab_Parent,
+     &                     posvartab_Child,TypeUpdate,loctab_Child
+     &                 ,pttruetabwhole,cetruetabwhole
+     &     )
+
+#else
+       indmin = indminglob
+       indmax = indmaxglob
+       pttruetabwhole = pttruetab
+       cetruetabwhole = cetruetab
+       childarray(:,1,2) = pttruetab
+       childarray(:,2,2) = cetruetab
+#endif
+
+
+      IF (memberin) THEN
+      allocate(tempC%var)
+
+C
+      Call Agrif_nbdim_allocation(tempC%var,
+     &                 pttruetab,cetruetab,nbdim)
+
+      Call Agrif_nbdim_Full_VarEQreal(tempC%var,0.,nbdim)
+
+
+
+      IF (present(procname)) THEN
+        SELECT CASE (nbdim)
+        CASE(1)
+          CALL procname(tempC%var%array1,
+     &                          childarray(1,1,2),childarray(1,2,2),
+     &                                   .TRUE.)
+        CASE(2)
+          CALL procname(tempC%var%array2,
+     &                          childarray(1,1,2),childarray(1,2,2),
+     &                          childarray(2,1,2),childarray(2,2,2),
+     &                                   .TRUE.)
+        CASE(3)
+          CALL procname(tempC%var%array3,
+     &                          childarray(1,1,2),childarray(1,2,2),
+     &                          childarray(2,1,2),childarray(2,2,2),
+     &                          childarray(3,1,2),childarray(3,2,2),
+     &                                   .TRUE.)
+        CASE(4)
+          CALL procname(tempC%var%array4,
+     &                          childarray(1,1,2),childarray(1,2,2),
+     &                          childarray(2,1,2),childarray(2,2,2),
+     &                          childarray(3,1,2),childarray(3,2,2),
+     &                          childarray(4,1,2),childarray(4,2,2),
+     &                                   .TRUE.)
+        CASE(5)
+          CALL procname(tempC%var%array5,
+     &                          childarray(1,1,2),childarray(1,2,2),
+     &                          childarray(2,1,2),childarray(2,2,2),
+     &                          childarray(3,1,2),childarray(3,2,2),
+     &                          childarray(4,1,2),childarray(4,2,2),
+     &                          childarray(5,1,2),childarray(5,2,2),
+     &                                   .TRUE.)
+        CASE(6)
+          CALL procname(tempC%var%array6,
+     &                          childarray(1,1,2),childarray(1,2,2),
+     &                          childarray(2,1,2),childarray(2,2,2),
+     &                          childarray(3,1,2),childarray(3,2,2),
+     &                          childarray(4,1,2),childarray(4,2,2),
+     &                          childarray(5,1,2),childarray(5,2,2),
+     &                          childarray(6,1,2),childarray(6,2,2),
+     &                                   .TRUE.)
+        END SELECT
+      ELSE
+      Call Agrif_nbdim_VarEQvar(tempC%var,pttruetab,cetruetab,
+     &          child%var,childarray(:,1,2),childarray(:,2,2),
+     &                          nbdim)
+      ENDIF
+
+      ENDIF
+
+
+
+C
+C
+#ifdef AGRIF_MPI
+C
+C     tab2 contains the necessary limits of the parent grid for each processor
+
+      tab3(:,1) = pttruetab(:)
+      tab3(:,2) = cetruetab(:)
+      tab3(:,3) = pttruetabwhole(:)
+      tab3(:,4) = cetruetabwhole(:)
+C
+C
+      Call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim,
+     &                   MPI_INTEGER,MPI_COMM_WORLD,code)
+
+      Allocate(tempCextend%var)
+      DO k=0,Agrif_Nbprocs-1
+       do j=1,4
+         do i=1,nbdim
+         tab4t(i,k,j) = tab4(i,j,k)
+         enddo
+       enddo
+      enddo
+      Call Get_External_Data(tempC,tempCextend,tab4t(:,:,1),
+     &            tab4t(:,:,2),
+     &            tab4t(:,:,3),tab4t(:,:,4),nbdim,memberin,memberin)
+
+#else
+      tempCextend%var => tempC%var
+#endif
+
+C
+C
+C     Update of the parent grid (tempP) from the child grid (tempC)
+
+
+      IF (memberin) THEN
+
+      allocate(tempP%var)
+      Call Agrif_nbdim_allocation(tempP%var,
+     &                 indmin,indmax,nbdim)
+
+      if ( nbdim .EQ. 1 ) then
+         Call Agrif_Update_1D_recursive(TypeUpdate,
+     &           tempP%var%array1,tempCextend%var%array1,
+     &           indmin,indmax,
+     &           pttruetabwhole,cetruetabwhole,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      endif
+      if ( nbdim .EQ. 2 ) then
+         Call Agrif_Update_2D_recursive(TypeUpdate,
+     &           tempP%var%array2,tempCextend%var%array2,
+     &           indmin,indmax,
+     &           pttruetabwhole,cetruetabwhole,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      endif
+
+      if ( nbdim .EQ. 3 ) then
+         Call Agrif_Update_3D_recursive(TypeUpdate,
+     &           tempP%var%array3,tempCextend%var%array3,
+     &           indmin,indmax,
+     &           pttruetabwhole,cetruetabwhole,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      endif
+      if ( nbdim .EQ. 4 ) then
+         Call Agrif_Update_4D_recursive(TypeUpdate,
+     &           tempP%var%array4,tempCextend%var%array4,
+     &           indmin,indmax,
+     &           pttruetabwhole,cetruetabwhole,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      endif
+      if ( nbdim .EQ. 5 ) then
+         Call Agrif_Update_5D_recursive(TypeUpdate,
+     &           tempP%var%array5,tempCextend%var%array5,
+     &           indmin,indmax,
+     &           pttruetabwhole,cetruetabwhole,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      endif
+      if ( nbdim .EQ. 6 ) then
+         Call Agrif_Update_6D_recursive(TypeUpdate,
+     &           tempP%var%array6,tempCextend%var%array6,
+     &           indmin,indmax,
+     &           pttruetabwhole,cetruetabwhole,
+     &           s_Child_temp,s_Parent_temp,
+     &           ds_Child,ds_Parent,nbdim)
+      endif
+
+      Call Agrif_nbdim_deallocation(tempCextend%var,nbdim)
+      Deallocate(tempCextend%var)
+
+      ENDIF
+
+#ifdef AGRIF_MPI
+      Call Agrif_nbdim_Get_bound_dimension(parent%var,
+     &                              lowerbound,upperbound,nbdim)
+
+      Call Agrif_ChildGrid_to_ParentGrid()
+C
+      Call Agrif_Childbounds(nbdim,
+     &                       lowerbound,upperbound,
+     &                       indminglob,indmaxglob,
+     &                       indminglob2,indmaxglob2,member)
+C
+      IF (member) THEN
+      Call Agrif_GlobtoLocInd2(parentarray,
+     &                     lowerbound,upperbound,
+     &                     indminglob2,indmaxglob2,
+     &                     nbdim,Agrif_Procrank,
+     &                     member)
+      ENDIF
+
+      Call Agrif_ParentGrid_to_ChildGrid()
+
+      tab3(:,1) = indmin(:)
+      tab3(:,2) = indmax(:)
+      tab3(:,3) = indminglob2(:)
+      tab3(:,4) = indmaxglob2(:)
+C
+      Call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim,
+     &                   MPI_INTEGER,MPI_COMM_WORLD,code)
+
+      Allocate(tempPextend%var)
+      DO k=0,Agrif_Nbprocs-1
+       do j=1,4
+         do i=1,nbdim
+         tab4t(i,k,j) = tab4(i,j,k)
+         enddo
+       enddo
+      enddo
+      Call Get_External_Data(tempP,tempPextend,tab4t(:,:,1),
+     &            tab4t(:,:,2),
+     &            tab4t(:,:,3),tab4t(:,:,4),nbdim,memberin,member)
+
+#else
+      tempPextend%var => tempP%var
+      parentarray(:,1,1) = indmin
+      parentarray(:,2,1) = indmax
+      parentarray(:,1,2) = indmin
+      parentarray(:,2,2) = indmax
+      member = .TRUE.
+#endif
+
+C
+C
+C
+C     Special values on the child grid
+      if (Agrif_UseSpecialValueFineGrid) then
+C
+ccc         noraftab(1:nbdim) =
+ccc     &    child % var % root_var % interptab(1:nbdim) .EQ. 'N'
+C
+#ifdef AGRIF_MPI
+C
+c          Allocate(childvalues% var)
+C
+c          Call Agrif_nbdim_allocation(childvalues%var,
+c     &                      pttruetab,cetruetab,nbdim)
+c          Call Agrif_nbdim_Full_VarEQvar(childvalues% var,
+c     &                                tempC% var,
+c     &                                nbdim)
+c          Call Agrif_CheckMasknD(tempC,childvalues,
+c     &                           pttruetab(1:nbdim),cetruetab(1:nbdim),
+c     &                           pttruetab(1:nbdim),cetruetab(1:nbdim),
+c     &                           noraftab(1:nbdim),nbdim)
+c          Call Agrif_nbdim_deallocation(childvalues% var,nbdim)
+c         Deallocate(childvalues % var)
+C
+#else
+C
+c          Call Agrif_nbdim_Get_bound_dimension(child%var,
+c     &                              lowerbound,upperbound,nbdim)
+c          Call Agrif_CheckMasknD(tempC,child,
+c     &                           pttruetab(1:nbdim),cetruetab(1:nbdim),
+c     &                           lowerbound,
+c     &                           upperbound,
+c     &                           noraftab(1:nbdim),nbdim)
+C
+#endif
+C
+      endif
+
+
+C
+C
+C
+C
+C     Special values on the parent grid
+      if (Agrif_UseSpecialValue) then
+C
+#ifdef AGRIF_MPI
+C
+c          Call GiveAgrif_SpecialValueToTab_mpi(parent%var,tempP%var,
+c     &                 parentarray,
+c     &                 indmin,indmax,
+c     &                 Agrif_SpecialValue,nbdim)
+C
+C
+#else
+C
+c          Call GiveAgrif_SpecialValueToTab(parent%var,tempP%var,
+c     &                  indmin,indmax,
+c     &                  Agrif_SpecialValue,nbdim)
+C
+#endif
+C
+C
+      endif   
+C
+C
+        IF (member) THEN
+
+          IF (present(procname)) THEN
+            CALL Agrif_ChildGrid_to_ParentGrid()
+            SELECT CASE(nbdim)
+            CASE(1)
+            CALL procname(
+     &      tempPextend%var%array1(
+     &                      parentarray(1,1,1):parentarray(1,2,1)),
+     &                      parentarray(1,1,2),parentarray(1,2,2),
+     &                                   .FALSE.
+     &                      )
+            CASE(2)
+            CALL procname(
+     &      tempPextend%var%array2(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1)),
+     &                      parentarray(1,1,2),parentarray(1,2,2),
+     &                      parentarray(2,1,2),parentarray(2,2,2),
+     &                                   .FALSE.
+     &                      )
+            CASE(3)
+            CALL procname(
+     &      tempPextend%var%array3(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1)),
+     &                      parentarray(1,1,2),parentarray(1,2,2),
+     &                      parentarray(2,1,2),parentarray(2,2,2),
+     &                      parentarray(3,1,2),parentarray(3,2,2),
+     &                                   .FALSE.
+     &                      )
+            CASE(4)
+            CALL procname(
+     &      tempPextend%var%array4(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1),
+     &                      parentarray(4,1,1):parentarray(4,2,1)),
+     &                      parentarray(1,1,2),parentarray(1,2,2),
+     &                      parentarray(2,1,2),parentarray(2,2,2),
+     &                      parentarray(3,1,2),parentarray(3,2,2),
+     &                      parentarray(4,1,2),parentarray(4,2,2),
+     &                                   .FALSE.
+     &                      )
+            CASE(5)
+            CALL procname(
+     &      tempPextend%var%array5(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1),
+     &                      parentarray(4,1,1):parentarray(4,2,1),
+     &                      parentarray(5,1,1):parentarray(5,2,1)),
+     &                      parentarray(1,1,2),parentarray(1,2,2),
+     &                      parentarray(2,1,2),parentarray(2,2,2),
+     &                      parentarray(3,1,2),parentarray(3,2,2),
+     &                      parentarray(4,1,2),parentarray(4,2,2),
+     &                      parentarray(5,1,2),parentarray(5,2,2),
+     &                                   .FALSE.
+     &                      )
+            CASE(6)
+            CALL procname(
+     &      tempPextend%var%array6(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1),
+     &                      parentarray(4,1,1):parentarray(4,2,1),
+     &                      parentarray(5,1,1):parentarray(5,2,1),
+     &                      parentarray(6,1,1):parentarray(6,2,1)),
+     &                      parentarray(1,1,2),parentarray(1,2,2),
+     &                      parentarray(2,1,2),parentarray(2,2,2),
+     &                      parentarray(3,1,2),parentarray(3,2,2),
+     &                      parentarray(4,1,2),parentarray(4,2,2),
+     &                      parentarray(5,1,2),parentarray(5,2,2),
+     &                      parentarray(6,1,2),parentarray(6,2,2),
+     &                                   .FALSE.
+     &                      )
+            END SELECT
+            CALL Agrif_ParentGrid_to_ChildGrid()
+          ELSE
+            SELECT CASE(nbdim)
+            CASE(1)
+            parent%var%array1(parentarray(1,1,2):parentarray(1,2,2)) =
+     &      tempPextend%var%array1(
+     &                      parentarray(1,1,1):parentarray(1,2,1))
+            CASE(2)
+            parent%var%array2(parentarray(1,1,2):parentarray(1,2,2),
+     &                      parentarray(2,1,2):parentarray(2,2,2)) =
+     &      tempPextend%var%array2(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1))
+            CASE(3)
+            parent%var%array3(parentarray(1,1,2):parentarray(1,2,2),
+     &                      parentarray(2,1,2):parentarray(2,2,2),
+     &                      parentarray(3,1,2):parentarray(3,2,2)) =
+     &      tempPextend%var%array3(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1))
+            CASE(4)
+            parent%var%array4(parentarray(1,1,2):parentarray(1,2,2),
+     &                      parentarray(2,1,2):parentarray(2,2,2),
+     &                      parentarray(3,1,2):parentarray(3,2,2),
+     &                      parentarray(4,1,2):parentarray(4,2,2)) =
+     &      tempPextend%var%array4(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1),
+     &                      parentarray(4,1,1):parentarray(4,2,1))
+            CASE(5)
+            parent%var%array5(parentarray(1,1,2):parentarray(1,2,2),
+     &                      parentarray(2,1,2):parentarray(2,2,2),
+     &                      parentarray(3,1,2):parentarray(3,2,2),
+     &                      parentarray(4,1,2):parentarray(4,2,2),
+     &                      parentarray(5,1,2):parentarray(5,2,2)) =
+     &      tempPextend%var%array5(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1),
+     &                      parentarray(4,1,1):parentarray(4,2,1),
+     &                      parentarray(5,1,1):parentarray(5,2,1))
+            CASE(6)
+            parent%var%array6(parentarray(1,1,2):parentarray(1,2,2),
+     &                      parentarray(2,1,2):parentarray(2,2,2),
+     &                      parentarray(3,1,2):parentarray(3,2,2),
+     &                      parentarray(4,1,2):parentarray(4,2,2),
+     &                      parentarray(5,1,2):parentarray(5,2,2),
+     &                      parentarray(6,1,2):parentarray(6,2,2)) =
+     &      tempPextend%var%array6(
+     &                      parentarray(1,1,1):parentarray(1,2,1),
+     &                      parentarray(2,1,1):parentarray(2,2,1),
+     &                      parentarray(3,1,1):parentarray(3,2,1),
+     &                      parentarray(4,1,1):parentarray(4,2,1),
+     &                      parentarray(5,1,1):parentarray(5,2,1),
+     &                      parentarray(6,1,1):parentarray(6,2,1))
+            END SELECT
+          ENDIF
+
+        Call Agrif_nbdim_deallocation(tempPextend%var,nbdim)
+       ENDIF
+C
+C
+C     Deallocations
+
+      IF (memberin) THEN
+#ifdef AGRIF_MPI
+      Call Agrif_nbdim_deallocation(tempP%var,nbdim)
+      Call Agrif_nbdim_deallocation(tempC%var,nbdim)
+      Deallocate(tempC % var)
+#endif
+      Deallocate(tempP % var)
+      ENDIF
+#ifdef AGRIF_MPI
+      Deallocate(tempPextend%var)
+      IF (.Not.memberin) Deallocate(tempCextend%var)
+#endif
+
+C
+C
+      End Subroutine Agrif_UpdatenD
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Prtbounds
+C     **************************************************************************
+C
+      Subroutine Agrif_Prtbounds(nbdim,indmin,indmax,s_Parent_temp,
+     &                              s_Child_temp,s_Child,ds_Child,
+     &                              s_Parent,ds_Parent,
+     &                              pttruetab,cetruetab,pttab_Child,
+     &                              pttab_Parent,
+     &                              posvartab_child,TypeUpdate,
+     &                              loctab_Child
+#ifdef AGRIF_MPI
+     &                 ,pttruetabwhole,cetruetabwhole
+#endif
+     &                 )
+C
+CCC   Description:
+CCC   Subroutine calculating the bounds of the parent grid to be updated
+CCC   by the child grid     
+C
+C
+C     Declarations:
+C
+      
+C
+#ifdef AGRIF_MPI
+cccccccccccccccccccccccccc#include "mpif.h"
+#endif
+C
+C     Arguments
+      INTEGER :: nbdim
+      INTEGER,DIMENSION(nbdim) :: indmin,indmax
+      REAL,DIMENSION(nbdim) :: s_Parent_temp,s_child_temp
+      REAL,DIMENSION(nbdim) :: s_Child,ds_child
+      REAL,DIMENSION(nbdim) :: s_Parent,ds_Parent
+      INTEGER,DIMENSION(nbdim) :: pttruetab,cetruetab
+      INTEGER,DIMENSION(nbdim) :: posvartab_child,TypeUpdate
+      INTEGER,DIMENSION(nbdim) :: loctab_Child
+      INTEGER,DIMENSION(nbdim) :: pttab_Child,pttab_Parent
+C
+C     Local variables
+      INTEGER :: i
+      REAL,DIMENSION(nbdim) :: dim_newmin,dim_newmax      
+#ifdef AGRIF_MPI
+      INTEGER,DIMENSION(nbdim)    :: pttruetabwhole,cetruetabwhole
+      REAL :: positionmin,positionmax
+      INTEGER :: imin,imax
+#endif
+C
+C
+      do i = 1,nbdim
+C
+        dim_newmin(i) = s_Child(i) + (pttruetab(i) -
+     &                                pttab_Child(i)) * ds_Child(i)
+C
+        dim_newmax(i) = s_Child(i) + (cetruetab(i) - 
+     &                                pttab_Child(i)) * ds_Child(i)
+C     
+        indmin(i) = pttab_Parent(i) +
+     &        agrif_ceiling((dim_newmin(i)-s_Parent(i))/ds_Parent(i))
+C
+        indmax(i) = pttab_Parent(i) +
+     &        agrif_int((dim_newmax(i)-s_Parent(i))/ds_Parent(i))
+C
+#ifdef AGRIF_MPI
+        positionmin = s_Parent(i) + (indmin(i)-
+     &                          pttab_Parent(i))*ds_Parent(i)
+        IF (loctab_Child(i) .NE. -3) THEN
+        IF (posvartab_child(i) == 1) THEN
+          IF (TypeUpdate(i) .NE. Agrif_Update_Copy) THEN
+        positionmin = positionmin - ds_Parent(i)/2.
+          ENDIF
+        ELSE
+        positionmin = positionmin - ds_Parent(i)/2.
+        ENDIF
+        ENDIF
+        imin = pttab_Child(i) +
+     &        agrif_ceiling((positionmin-s_Child(i))/ds_Child(i))
+
+       positionmin = s_Child(i) + (imin -
+     &                                pttab_Child(i)) * ds_Child(i)
+
+        pttruetabwhole(i) = imin
+
+        positionmax = s_Parent(i) + (indmax(i)-
+     &                          pttab_Parent(i))*ds_Parent(i)
+        IF (loctab_Child(i) .NE. -3) THEN
+        IF (posvartab_child(i) == 1) THEN
+          IF (TypeUpdate(i) .NE. Agrif_Update_Copy) THEN
+        positionmax = positionmax  + ds_Parent(i)/2.
+          ENDIF
+        ELSE
+        positionmax = positionmax  + ds_Parent(i)/2.
+        ENDIF
+        ENDIF
+        imax = pttab_Child(i) +
+     &        agrif_int((positionmax-s_Child(i))/ds_Child(i))
+
+        positionmax = s_Child(i) + (imax -
+     &                                pttab_Child(i)) * ds_Child(i)
+
+        cetruetabwhole(i) = imax
+
+#endif
+C
+        s_Parent_temp(i) = s_Parent(i) + 
+     &                     (indmin(i) - pttab_Parent(i)) * 
+     &                      ds_Parent(i) 
+C     
+        s_Child_temp(i) = dim_newmin(i)
+
+#ifdef AGRIF_MPI
+        s_Child_temp(i) = positionmin
+#endif
+C
+      enddo
+C
+      Return
+C
+C
+      End Subroutine Agrif_Prtbounds
+C
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Update_1D_Recursive
+C     **************************************************************************
+C
+      Subroutine Agrif_Update_1D_recursive(TypeUpdate,tempP,tempC,
+     &                                     indmin,indmax,
+     &                                     pttab_child,petab_child,
+     &                                     s_child,s_parent,
+     &                                     ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine to update a 1D grid variable on the parent grid.
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C
+C     Arguments
+      INTEGER                   :: nbdim
+      INTEGER, DIMENSION(nbdim) :: TypeUpdate            ! TYPE of update (copy or average)
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim)    :: s_child,s_parent
+      REAL, DIMENSION(nbdim)    :: ds_child,ds_parent
+      REAL, DIMENSION(indmin(nbdim):indmax(nbdim))           :: tempP
+      REAL, DIMENSION(pttab_child(nbdim):petab_child(nbdim)) :: tempC
+C
+C
+      Call Agrif_UpdateBase(TypeUpdate(1),
+     &                  tempP(indmin(nbdim):indmax(nbdim)),
+     &                  tempC(pttab_child(nbdim):petab_child(nbdim)),
+     &                  indmin(nbdim),indmax(nbdim),           
+     &                  pttab_child(nbdim),petab_child(nbdim),
+     &                  s_parent(nbdim),s_child(nbdim),
+     &                  ds_parent(nbdim),ds_child(nbdim))
+C
+      Return
+C
+C
+      End Subroutine Agrif_Update_1D_recursive
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Agrif_Update_2D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Update_2D_recursive(TypeUpdate,tempP,tempC,
+     &                                     indmin,indmax,   
+     &                                     pttab_child,petab_child,
+     &                                     s_child,s_parent,
+     &                                     ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine to update a 2D grid variable on the parent grid. 
+CCC   It calls Agrif_Update_1D_Recursive and Agrif_UpdateBase.   
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER                   :: nbdim
+      INTEGER, DIMENSION(nbdim) :: TypeUpdate            ! TYPE of update (copy or average)
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim)    :: s_child,s_parent
+      REAL, DIMENSION(nbdim)    :: ds_child,ds_parent
+      REAL, DIMENSION(indmin(1):indmax(1),
+     &                indmin(2):indmax(2))           :: tempP
+      REAL, DIMENSION(pttab_child(1):petab_child(1),
+     &                pttab_child(2):petab_child(2)) :: tempC
+C
+C     Local variables      
+      REAL, DIMENSION(:,:), Allocatable :: tabtemp
+      INTEGER :: i,j
+C
+C
+      Allocate(tabtemp(indmin(1):indmax(1),
+     &                 pttab_child(2):petab_child(2)))
+C
+      do j = pttab_child(nbdim),petab_child(nbdim)
+C
+        Call Agrif_Update_1D_recursive(TypeUpdate,    
+     &         tabtemp(indmin(nbdim-1):indmax(nbdim-1),j),
+     &         tempC(pttab_child(nbdim-1):petab_child(nbdim-1),j),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C
+      enddo
+C
+      do i = indmin(1),indmax(1)
+C
+        Call Agrif_UpdateBase(TypeUpdate(2),
+     &           tempP(i,indmin(nbdim):indmax(nbdim)),
+     &          tabtemp(i,pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C        
+      enddo
+C
+      Deallocate(tabtemp)
+C
+      Return
+C
+C
+      End Subroutine Agrif_Update_2D_recursive
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Agrif_Update_3D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Update_3D_recursive(TypeUpdate,tempP,tempC,
+     &                                     indmin,indmax,   
+     &                                     pttab_child,petab_child,
+     &                                     s_child,s_parent,
+     &                                     ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine to update a 3D grid variable on the parent grid. 
+CCC   It calls Agrif_Update_2D_Recursive and Agrif_UpdateBase.   
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER                   :: nbdim
+      INTEGER, DIMENSION(nbdim) :: TypeUpdate            ! TYPE of update (copy or average)
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim)    :: s_child,s_parent
+      REAL, DIMENSION(nbdim)    :: ds_child,ds_parent
+      REAL, DIMENSION(indmin(1):indmax(1),
+     &                indmin(2):indmax(2),
+     &                indmin(3):indmax(3))           :: tempP
+      REAL, DIMENSION(pttab_child(1):petab_child(1),
+     &                pttab_child(2):petab_child(2),
+     &                pttab_child(3):petab_child(3)) :: tempC
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:), Allocatable :: tabtemp
+      INTEGER :: i,j,k
+C
+C
+      Allocate(tabtemp(indmin(1):indmax(1),
+     &                 indmin(2):indmax(2), 
+     &                 pttab_child(3):petab_child(3)))
+C
+      do k = pttab_child(nbdim),petab_child(nbdim)
+C
+        Call Agrif_Update_2D_recursive(TypeUpdate,    
+     &         tabtemp(indmin(nbdim-2):indmax(nbdim-2),
+     &                 indmin(nbdim-1):indmax(nbdim-1),k),
+     &         tempC(pttab_child(nbdim-2):petab_child(nbdim-2),
+     &               pttab_child(nbdim-1):petab_child(nbdim-1),k),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C
+      enddo
+C
+C
+      do j = indmin(2),indmax(2)
+C
+        do i = indmin(1),indmax(1)
+C
+          Call Agrif_UpdateBase(TypeUpdate(3),
+     &           tempP(i,j,indmin(nbdim):indmax(nbdim)),
+     &          tabtemp(i,j,pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C
+        enddo 
+C        
+      enddo
+C
+      Deallocate(tabtemp)
+C
+      Return
+C
+C
+      End Subroutine Agrif_Update_3D_recursive
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Agrif_Update_4D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Update_4D_recursive(TypeUpdate,tempP,tempC,
+     &                                     indmin,indmax,   
+     &                                     pttab_child,petab_child,
+     &                                     s_child,s_parent,
+     &                                     ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine to update a 4D grid variable on the parent grid. 
+CCC   It calls Agrif_Update_3D_Recursive and Agrif_UpdateBase.    
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER                   :: nbdim
+      INTEGER, DIMENSION(nbdim) :: TypeUpdate            ! TYPE of update (copy or average)
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim)    :: s_child,s_parent
+      REAL, DIMENSION(nbdim)    :: ds_child,ds_parent
+      REAL, DIMENSION(indmin(1):indmax(1),
+     &                indmin(2):indmax(2),
+     &                indmin(3):indmax(3),
+     &                indmin(4):indmax(4))           :: tempP
+      REAL, DIMENSION(pttab_child(1):petab_child(1),
+     &                pttab_child(2):petab_child(2),
+     &                pttab_child(3):petab_child(3),
+     &                pttab_child(4):petab_child(4)) :: tempC
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:,:), Allocatable :: tabtemp
+      INTEGER :: i,j,k,l
+C
+C
+      Allocate(tabtemp(indmin(1):indmax(1),
+     &                 indmin(2):indmax(2),
+     &                 indmin(3):indmax(3), 
+     &                 pttab_child(4):petab_child(4)))
+C
+      do l = pttab_child(nbdim),petab_child(nbdim)
+C
+        Call Agrif_Update_3D_recursive(TypeUpdate,    
+     &         tabtemp(indmin(nbdim-3):indmax(nbdim-3),
+     &                 indmin(nbdim-2):indmax(nbdim-2),
+     &                 indmin(nbdim-1):indmax(nbdim-1),l),
+     &         tempC(pttab_child(nbdim-3):petab_child(nbdim-3),
+     &               pttab_child(nbdim-2):petab_child(nbdim-2),
+     &               pttab_child(nbdim-1):petab_child(nbdim-1),l),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C
+      enddo
+C
+      do k = indmin(3),indmax(3)
+C
+        do j = indmin(2),indmax(2)
+C
+          do i = indmin(1),indmax(1)
+C
+            Call Agrif_UpdateBase(TypeUpdate(4),
+     &           tempP(i,j,k,indmin(nbdim):indmax(nbdim)),
+     &          tabtemp(i,j,k,pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C
+          enddo 
+C
+        enddo 
+C        
+      enddo
+C
+      Deallocate(tabtemp)
+C
+      Return
+C
+C
+      End Subroutine Agrif_Update_4D_recursive
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Agrif_Update_5D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Update_5D_recursive(TypeUpdate,tempP,tempC,
+     &                                     indmin,indmax,   
+     &                                     pttab_child,petab_child,
+     &                                     s_child,s_parent,
+     &                                     ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine to update a 5D grid variable on the parent grid. 
+CCC   It calls Agrif_Update_4D_Recursive and Agrif_UpdateBase.    
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER                   :: nbdim
+      INTEGER, DIMENSION(nbdim) :: TypeUpdate            ! TYPE of update (copy or average)
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim)    :: s_child,s_parent
+      REAL, DIMENSION(nbdim)    :: ds_child,ds_parent
+      REAL, DIMENSION(indmin(1):indmax(1),
+     &                indmin(2):indmax(2),
+     &                indmin(3):indmax(3),
+     &                indmin(4):indmax(4),
+     &                indmin(5):indmax(5))           :: tempP
+      REAL, DIMENSION(pttab_child(1):petab_child(1),
+     &                pttab_child(2):petab_child(2),
+     &                pttab_child(3):petab_child(3),
+     &                pttab_child(4):petab_child(4),
+     &                pttab_child(5):petab_child(5)) :: tempC
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:,:,:), Allocatable :: tabtemp
+      INTEGER :: i,j,k,l,m
+C
+C
+      Allocate(tabtemp(indmin(1):indmax(1),
+     &                 indmin(2):indmax(2),
+     &                 indmin(3):indmax(3),
+     &                 indmin(4):indmax(4),   
+     &                 pttab_child(5):petab_child(5)))
+C
+      do m = pttab_child(nbdim),petab_child(nbdim)
+C
+        Call Agrif_Update_4D_recursive(TypeUpdate,    
+     &         tabtemp(indmin(nbdim-4):indmax(nbdim-4),
+     &                 indmin(nbdim-3):indmax(nbdim-3),
+     &                 indmin(nbdim-2):indmax(nbdim-2),
+     &                 indmin(nbdim-1):indmax(nbdim-1),m),
+     &         tempC(pttab_child(nbdim-4):petab_child(nbdim-4),
+     &               pttab_child(nbdim-3):petab_child(nbdim-3),
+     &               pttab_child(nbdim-2):petab_child(nbdim-2),
+     &               pttab_child(nbdim-1):petab_child(nbdim-1),m),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C
+      enddo
+C
+      do l = indmin(4),indmax(4)
+C
+        do k = indmin(3),indmax(3)
+C
+          do j = indmin(2),indmax(2)
+C
+            do i = indmin(1),indmax(1)
+C
+              Call Agrif_UpdateBase(TypeUpdate(5),
+     &           tempP(i,j,k,l,indmin(nbdim):indmax(nbdim)),
+     &          tabtemp(i,j,k,l,
+     &                   pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C
+            enddo
+C
+          enddo 
+C
+        enddo 
+C        
+      enddo
+C
+      Deallocate(tabtemp)
+C
+      Return
+C
+C
+      End Subroutine Agrif_Update_5D_recursive
+C
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Agrif_Update_6D_Recursive 
+C     **************************************************************************
+C
+      Subroutine Agrif_Update_6D_recursive(TypeUpdate,tempP,tempC,
+     &                                     indmin,indmax,   
+     &                                     pttab_child,petab_child,
+     &                                     s_child,s_parent,
+     &                                     ds_child,ds_parent,nbdim)
+C
+CCC   Description:
+CCC   Subroutine to update a 6D grid variable on the parent grid. 
+CCC   It calls Agrif_Update_5D_Recursive and Agrif_UpdateBase.    
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C     
+      INTEGER                   :: nbdim
+      INTEGER, DIMENSION(nbdim) :: TypeUpdate            ! TYPE of update (copy or average)
+      INTEGER, DIMENSION(nbdim) :: indmin,indmax
+      INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child
+      REAL, DIMENSION(nbdim)    :: s_child,s_parent
+      REAL, DIMENSION(nbdim)    :: ds_child,ds_parent
+      REAL, DIMENSION(indmin(1):indmax(1),
+     &                indmin(2):indmax(2),
+     &                indmin(3):indmax(3),
+     &                indmin(4):indmax(4),
+     &                indmin(5):indmax(5),
+     &                indmin(6):indmax(6))           :: tempP
+      REAL, DIMENSION(pttab_child(1):petab_child(1),
+     &                pttab_child(2):petab_child(2),
+     &                pttab_child(3):petab_child(3),
+     &                pttab_child(4):petab_child(4),
+     &                pttab_child(5):petab_child(5),
+     &                pttab_child(6):petab_child(6)) :: tempC
+C
+C     Local variables      
+      REAL, DIMENSION(:,:,:,:,:,:), Allocatable :: tabtemp
+      INTEGER :: i,j,k,l,m,n
+C
+C
+      Allocate(tabtemp(indmin(1):indmax(1),
+     &                 indmin(2):indmax(2),
+     &                 indmin(3):indmax(3),
+     &                 indmin(4):indmax(4),   
+     &                 indmin(5):indmax(5),   
+     &                 pttab_child(6):petab_child(6)))
+C
+      do n = pttab_child(nbdim),petab_child(nbdim)
+C
+        Call Agrif_Update_5D_recursive(TypeUpdate,    
+     &         tabtemp(indmin(nbdim-5):indmax(nbdim-5),
+     &                 indmin(nbdim-4):indmax(nbdim-4),
+     &                 indmin(nbdim-3):indmax(nbdim-3),
+     &                 indmin(nbdim-2):indmax(nbdim-2),
+     &                 indmin(nbdim-1):indmax(nbdim-1),n),
+     &         tempC(pttab_child(nbdim-5):petab_child(nbdim-5),
+     &               pttab_child(nbdim-4):petab_child(nbdim-4),
+     &               pttab_child(nbdim-3):petab_child(nbdim-3),
+     &               pttab_child(nbdim-2):petab_child(nbdim-2),
+     &               pttab_child(nbdim-1):petab_child(nbdim-1),n),
+     &         indmin(1:nbdim-1),indmax(1:nbdim-1),
+     &         pttab_child(1:nbdim-1),petab_child(1:nbdim-1),
+     &         s_child(1:nbdim-1),s_parent(1:nbdim-1),
+     &         ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1)
+C
+      enddo
+C
+      do m = indmin(5),indmax(5)
+      do l = indmin(4),indmax(4)
+C
+        do k = indmin(3),indmax(3)
+C
+          do j = indmin(2),indmax(2)
+C
+            do i = indmin(1),indmax(1)
+C
+              Call Agrif_UpdateBase(TypeUpdate(6),
+     &           tempP(i,j,k,l,m,indmin(nbdim):indmax(nbdim)),
+     &          tabtemp(i,j,k,l,m,
+     &                   pttab_child(nbdim):petab_child(nbdim)),
+     &           indmin(nbdim),indmax(nbdim),
+     &           pttab_child(nbdim),petab_child(nbdim),
+     &           s_parent(nbdim),s_child(nbdim),
+     &           ds_parent(nbdim),ds_child(nbdim))
+C
+            enddo
+C
+          enddo 
+C
+        enddo 
+C        
+      enddo
+      enddo
+C
+      Deallocate(tabtemp)
+C
+      Return
+C
+C
+      End Subroutine Agrif_Update_6D_recursive
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Agrif_UpdateBase  
+C     **************************************************************************  
+C  
+      Subroutine Agrif_UpdateBase(TypeUpdate,
+     &                            parenttab,childtab,
+     &                            indmin,indmax,pttab_child,petab_child,
+     &                            s_parent,s_child,ds_parent,ds_child)
+C
+CCC   Description:
+CCC   Subroutine calling the updating method chosen by the user (copy, average
+CCC   or full-weighting).    
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C
+      INTEGER :: TypeUpdate
+      INTEGER :: indmin,indmax
+      INTEGER :: pttab_child,petab_child
+      REAL,DIMENSION(indmin:indmax)           :: parenttab       
+      REAL,DIMENSION(pttab_child:petab_child) :: childtab      
+      REAL    :: s_parent,s_child
+      REAL    :: ds_parent,ds_child       
+C
+C
+      if (TypeUpdate == AGRIF_Update_copy) then
+C             
+          Call copy1D
+     &       (parenttab,childtab,
+     &          indmax-indmin+1,petab_child-pttab_child+1,
+     &          s_parent,s_child,ds_parent,ds_child)     
+C
+        elseif (TypeUpdate == AGRIF_Update_average) then
+C             
+          Call average1D
+     &       (parenttab,childtab,
+     &          indmax-indmin+1,petab_child-pttab_child+1,
+     &          s_parent,s_child,ds_parent,ds_child)    
+C
+        elseif (TypeUpdate == AGRIF_Update_full_weighting) then
+C             
+          Call full_weighting1D
+     &       (parenttab,childtab,
+     &          indmax-indmin+1,petab_child-pttab_child+1,
+     &          s_parent,s_child,ds_parent,ds_child)
+C
+      endif 
+C
+      Return                
+C
+C      
+      End Subroutine Agrif_UpdateBase
+C
+C
+      End Module Agrif_Update
+
+
+
+      
Index: /trunk/AGRIF/AGRIF_FILES/modupdatebasic.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modupdatebasic.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modupdatebasic.F	(revision 396)
@@ -0,0 +1,264 @@
+!
+! $Id$
+!
+C     AGRIF (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place -  Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Updatebasic
+C      
+C
+      Module Agrif_Updatebasic
+C
+CCC   Description:
+CCC   Module containing different procedures of update (copy,average,
+CCC   full_weighting) used in the Agrif_Update module.
+C
+C     Modules used:
+C
+      USE Agrif_types
+      
+      IMPLICIT NONE
+C             
+
+      CONTAINS
+C     Define procedures contained in this module
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Copy1d  
+C     ************************************************************************** 
+C
+      Subroutine copy1d(x,y,np,nc,
+     &                  s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do a copy on a parent grid (vector x) from its child grid 
+CCC   (vector y).  
+C
+CC    Method:
+C
+C     Declarations:
+C
+      
+C        
+C     Arguments
+      INTEGER             :: np,nc      
+      REAL, DIMENSION(np) :: x      
+      REAL, DIMENSION(nc) :: y  
+      REAL                :: s_parent,s_child
+      REAL                :: ds_parent,ds_child
+C
+C     Local variables
+      INTEGER :: i,locind_child_left,coeffraf
+C 
+C
+      coeffraf = nint(ds_parent/ds_child)
+C
+      if (coeffraf == 1) then
+C
+          locind_child_left = 1 + nint((s_parent - s_child)/ds_child)
+C        
+          x(1:np) = y(locind_child_left:locind_child_left+np-1)
+C
+          return
+C
+      endif
+C
+      
+      locind_child_left = 1 + nint((s_parent - s_child)/ds_child)
+      
+      do i = 1,np
+C      
+         x(i) = y(locind_child_left)
+C
+         locind_child_left = locind_child_left + coeffraf
+C         
+      enddo    
+       
+C
+      Return 
+C
+C
+      End Subroutine copy1d
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Average1d  
+C     ************************************************************************** 
+C   
+      Subroutine average1d(x,y,np,nc,
+     &                     s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do an update by average on a parent grid (vector x)from its 
+CCC   child grid (vector y).
+C
+C     Arguments
+      INTEGER             :: np,nc      
+      REAL, DIMENSION(np) :: x      
+      REAL, DIMENSION(nc) :: y  
+      REAL                :: s_parent,s_child
+      REAL                :: ds_parent,ds_child
+C
+C     Local variables
+      INTEGER :: i,locind_child_left,coeffraf,ii
+      REAL    :: xpos 
+      INTEGER :: nbnonnuls
+      INTEGER :: diffmod
+C 
+C
+      coeffraf = nint(ds_parent/ds_child)
+C
+      if (coeffraf == 1) then
+C
+          locind_child_left = 1 + nint((s_parent - s_child)/ds_child)
+C        
+          x(1:np) = y(locind_child_left:locind_child_left+np-1)
+C
+          return
+C
+      endif
+C
+      xpos = s_parent      
+      
+      x = 0.
+C
+      diffmod = 0
+      
+      IF ( mod(coeffraf,2) == 0 ) diffmod = 1
+      
+      do i = 1,np
+C
+        locind_child_left = 1 + agrif_int((xpos - s_child)/ds_child)
+C
+        if ((locind_child_left-1 < 1) 
+     &      .OR. (locind_child_left+1 > nc)) then 
+C
+            x(i) = y(locind_child_left)                
+C
+          else 
+          nbnonnuls = 0
+          Do ii = -coeffraf/2+locind_child_left+diffmod,
+     &                coeffraf/2+locind_child_left
+C 
+            IF (Agrif_UseSpecialValueInUpdate) THEN
+            IF (y(ii) .NE. Agrif_SpecialValueFineGrid) THEN
+               nbnonnuls = nbnonnuls + 1
+               x(i) = x(i) + y(ii)
+            ENDIF
+            ELSE
+               x(i) = x(i) + y(ii)
+            ENDIF
+          End Do
+            IF (Agrif_UseSpecialValueInUpdate) THEN
+                 IF (nbnonnuls .NE. 0) THEN
+                    x(i) = x(i)/nbnonnuls
+                 ELSE
+                    x(i) = Agrif_SpecialValueFineGrid
+                 ENDIF
+            ELSE
+                 x(i) = x(i)/coeffraf
+            ENDIF
+C
+        endif
+C
+        xpos = xpos + ds_parent
+C
+      enddo
+C
+      Return 
+C            
+C     
+      End Subroutine average1d
+C
+C
+C
+C     **************************************************************************  
+CCC   Subroutine Full_weighting1d  
+C     **************************************************************************  
+C
+      Subroutine full_weighting1D(x,y,np,nc,
+     &                            s_parent,s_child,ds_parent,ds_child) 
+C
+CCC   Description:
+CCC   Subroutine to do an update by full_weighting on a parent grid (vector x) 
+CCC   from its child grid (vector y).
+C 
+C     Arguments
+      INTEGER             :: np,nc      
+      REAL, DIMENSION(np) :: x      
+      REAL, DIMENSION(nc) :: y  
+      REAL                :: s_parent,s_child
+      REAL                :: ds_parent,ds_child
+C
+C     Local variables
+      INTEGER :: i,locind_child_left,coeffraf
+      REAL    :: xpos 
+C 
+C
+      coeffraf = nint(ds_parent/ds_child)
+C
+      if (coeffraf == 1) then
+C
+          locind_child_left = 1 + nint((s_parent - s_child)/ds_child)
+C        
+          x(1:np) = y(locind_child_left:locind_child_left+np-1)
+C
+          return
+C
+      endif
+C
+      IF (coeffraf .NE. 3) THEN
+        print *,'FULL WEIGHTING NOT READY FOR COEFFRAF = 3'
+	STOP
+      ENDIF
+      xpos = s_parent      
+C
+      do i = 1,np
+C
+        locind_child_left = 1 + nint((xpos - s_child)/ds_child)
+C
+        if ((locind_child_left-1 < 1) 
+     &      .OR. (locind_child_left+1 > nc)) then 
+C      Agrif_UseSpecialValueInUpdate = .TRUE.
+            x(i) = y(locind_child_left)                
+C
+          else
+C        
+            x(i) = (y(locind_child_left-1)+2.*y(locind_child_left)+
+     &              y(locind_child_left+1))/4.                
+C
+        endif
+C
+        xpos = xpos + ds_parent
+C
+      enddo
+C
+      Return 
+C            
+C
+      End Subroutine full_weighting1D      
+C
+C
+C
+      End module AGRIF_updatebasic
Index: /trunk/AGRIF/AGRIF_FILES/modutil.F
===================================================================
--- /trunk/AGRIF/AGRIF_FILES/modutil.F	(revision 396)
+++ /trunk/AGRIF/AGRIF_FILES/modutil.F	(revision 396)
@@ -0,0 +1,799 @@
+!
+! $Id$
+!
+C     Agrif (Adaptive Grid Refinement In Fortran)
+C
+C     Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr)
+C                        Christophe Vouland (Christophe.Vouland@imag.fr)    
+C
+C     This program is free software; you can redistribute it and/or modify
+C     it under the terms of the GNU General Public License as published by
+C     the Free Software Foundation; either version 2 of the License, or
+C     (at your option) any later version.
+C
+C     This program is distributed in the hope that it will be useful,
+C     but WITHOUT ANY WARRANTY; without even the implied warranty of
+C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+C     GNU General Public License for more details.
+C
+C     You should have received a copy of the GNU General Public License
+C     along with this program; if not, write to the Free Software
+C     Foundation, Inc., 59 Temple Place-  Suite 330, Boston, MA 02111-1307, USA.
+C
+C
+C
+CCC   Module Agrif_Util 
+C 
+      Module Agrif_Util 
+C
+C
+CCC   Description:   
+CCC   This module contains the two procedures called in the main program : 
+CCC   Agrif_Init_Grids allowing the initialization of the root coarse grid, and
+CCC   Agrif_Step allowing the creation of the grid hierarchy and the management
+CCC   of the time integration. 
+C
+C     Modules used:
+C
+      Use Agrif_Clustering    
+      Use Agrif_bcfunction
+C      
+      IMPLICIT NONE
+C
+      Contains
+C     Definition of procedures contained in this module.
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Step
+C     **************************************************************************
+C 
+      Subroutine Agrif_Step(procname) 
+C
+CCC   Description:
+CCC   Subroutine to create the grid hierarchy and to manage the time integration 
+CCC   procedure. It is called in the main program.
+C
+CC    Method:
+CC    Call on subroutines Agrif_Regrid and Agrif_Integrate.
+C
+C     Declarations:
+C
+      Optional :: procname
+      External :: procname
+C
+#ifdef AGRIF_MPI
+      Integer      :: code
+#include "mpif.h"
+C
+C
+      If (Agrif_Mygrid % ngridstep == 0) Then
+          Call MPI_COMM_SIZE(MPI_COMM_WORLD,Agrif_Nbprocs,code)
+          Call MPI_COMM_RANK(MPI_COMM_WORLD,Agrif_ProcRank,code)
+          Call MPI_COMM_GROUP(MPI_COMM_WORLD,Agrif_Group,code)
+      endif
+#endif
+C
+C     Creation and initialization of the grid hierarchy 
+C
+C  
+C    Set the clustering variables
+C
+      Call Agrif_clustering_def()
+C      
+      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 1 ) then
+C     
+         If (Agrif_Mygrid % ngridstep == 0) then
+C
+            Call Agrif_Regrid
+C 
+            Call Agrif_Instance           
+     &          (Agrif_Mygrid)           
+         endif
+C
+      else
+C    
+         If (mod(Agrif_Mygrid % ngridstep, Agrif_Regridding) == 0) then
+C
+            Call Agrif_Regrid
+C  
+            Call Agrif_Instance           
+     &          (Agrif_Mygrid)  
+C            
+         endif
+C
+      endif
+C
+C     Time integration of the grid hierarchy
+C
+      If (present(procname)) Then
+         Call Agrif_Integrate (Agrif_Mygrid,procname)
+      Else
+         Call Agrif_Integrate (Agrif_Mygrid)      
+      endif
+C    
+      If (associated(Agrif_Mygrid%child_grids)) 
+     &   Call Agrif_Instance (Agrif_Mygrid)
+C
+      Return
+C             
+      End Subroutine Agrif_Step      
+
+C     **************************************************************************
+CCC   Subroutine Agrif_Step_Child
+C     **************************************************************************
+C
+      Subroutine Agrif_Step_Child(procname)
+C
+CCC   Description:
+CCC   Subroutine to create the grid hierarchy and to manage the time integration
+CCC   procedure. It is called in the main program.
+C
+CC    Method:
+CC    Call on subroutines Agrif_Regrid and Agrif_Integrate.
+C
+C     Declarations:
+C
+      Optional :: procname
+      External :: procname
+C
+C     Time integration of the grid hierarchy
+C
+      If (present(procname)) Then
+         Call Agrif_Integrate_Child (Agrif_Mygrid,procname)
+      Else
+         Call Agrif_Integrate_Child (Agrif_Mygrid)
+      endif
+C    
+      If (associated(Agrif_Mygrid%child_grids))
+     &   Call Agrif_Instance (Agrif_Mygrid)
+C
+      Return
+C
+      End Subroutine Agrif_Step_Child
+
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Regrid
+C     **************************************************************************
+C
+      Subroutine Agrif_Regrid
+C
+CCC   Description:
+CCC   Subroutine to create the grid hierarchy from fixed grids and 
+CC       adaptive mesh refinement.
+C
+CC    Method:        
+C
+C     Declarations:
+C
+C     Local variables      
+      Type(Agrif_Rectangle), Pointer     :: coarsegrid_fixed
+      Type(Agrif_Rectangle), Pointer     :: coarsegrid_moving  
+      INTEGER                            :: j
+      INTEGER :: nunit
+      INTEGER                            :: iii
+      Logical :: BEXIST
+C 
+      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 )
+     &   Call Agrif_detect_all(Agrif_Mygrid) ! Detection of areas to be refined
+C
+      Allocate(coarsegrid_fixed)
+      Allocate(coarsegrid_moving)
+C
+      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) 
+     &    Call Agrif_Cluster_All(Agrif_Mygrid,coarsegrid_moving) ! Clustering
+C
+      if ( Agrif_USE_FIXED_GRIDS .EQ. 1 .OR. 
+     &     Agrif_USE_ONLY_FIXED_GRIDS .EQ. 1 ) then
+C
+      If (Agrif_Mygrid % ngridstep == 0) Then
+          nunit = Agrif_Get_Unit()
+          open(nunit,file='AGRIF_FixedGrids.in',form='formatted',
+     &           status="old",ERR=99) ! Opening of the Agrif_FixedGrids.in file
+          j = 1
+C         Creation of the grid hierarchy from the Agrif_FixedGrids.in file 
+            do iii = 1 , Agrif_Probdim
+               coarsegrid_fixed % imin(iii) = 1
+               coarsegrid_fixed % imax(iii) = Agrif_Mygrid % nb(iii) + 1
+            enddo
+C      
+            Call Agrif_Read_Fix_Grd (coarsegrid_fixed,j,nunit)     
+            close(nunit) ! Closing of the Agrif_FixedGrids.in file 
+C
+          Nullify(Agrif_oldmygrid)
+          Nullify(Agrif_Mygrid  % child_grids)
+C        
+C         Creation of the grid hierarchy from coarsegrid_fixed
+            Call Agrif_Create_Grids (Agrif_Mygrid,coarsegrid_fixed)
+        Else        
+          Agrif_oldmygrid => Agrif_Mygrid % child_grids
+         endif
+      else
+      Agrif_oldmygrid => Agrif_Mygrid % child_grids
+      Nullify(Agrif_Mygrid  % child_grids)
+      endif
+C
+      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) then
+C      
+      Call Agrif_Free_before_All(Agrif_oldmygrid)
+C 
+C     Creation of the grid hierarchy from coarsegrid_moving    
+      Call Agrif_Create_Grids
+     &     (Agrif_Mygrid,coarsegrid_moving)
+C
+      endif
+C
+C     Initialization of the grid hierarchy by copy or interpolation
+C
+      Call Agrif_Init_Hierarchy(Agrif_Mygrid)
+C
+      if ( Agrif_USE_ONLY_FIXED_GRIDS .EQ. 0 ) 
+     &        Call Agrif_Free_after_All(Agrif_oldmygrid)
+C
+      Deallocate(coarsegrid_fixed)
+      Deallocate(coarsegrid_moving)
+C      
+      Return
+C
+C     Opening error
+C
+   99 INQUIRE(FILE='AGRIF_FixedGrids.in',EXIST=BEXIST)
+      If (.not. BEXIST) Then
+          print*,'ERROR : File AGRIF_FixedGrids.in not found.'
+          STOP 
+        Else
+          print*,'Error opening file AGRIF_FixedGrids.in'
+          STOP         
+      endif     
+C      
+      End Subroutine Agrif_Regrid
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_detect_All
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_detect_all(g)
+C
+CCC   Description:
+CCC   Subroutine to detect areas to be refined.
+C
+CC    Method:        
+C
+C     Declarations:
+C
+      
+C      
+C     Pointer argument    
+      TYPE(Agrif_Grid) ,pointer  :: g        ! Pointer on the current grid
+C      
+C     Local variables
+      Type(Agrif_pgrid),pointer  :: parcours ! Pointer for the recursive 
+                                             ! procedure      
+      INTEGER, DIMENSION(3)      :: size
+      INTEGER                    :: iii
+      Real :: g_eps     
+C
+      parcours => g % child_grids
+C  
+C     To be positioned on the finer grids of the grid hierarchy          
+C  
+      do while (associated(parcours))       
+         Call Agrif_detect_all (parcours % gr)  
+        parcours => parcours % next             
+      enddo
+C
+      g_eps = huge(1.)
+      do iii = 1 , Agrif_Probdim
+         g_eps=min(g_eps,g%Agrif_d(iii))
+      enddo
+C
+      g_eps = g_eps/100.
+C          
+      if ( Agrif_Probdim .EQ. 1 ) g%tabpoint1D=0
+      if ( Agrif_Probdim .EQ. 2 ) g%tabpoint2D=0
+      if ( Agrif_Probdim .EQ. 3 ) g%tabpoint3D=0
+C      
+      do iii = 1 , Agrif_Probdim
+         if (g%Agrif_d(iii)/Agrif_coeffref(iii).LT.
+     &                     (Agrif_mind(iii)-g_eps)) Return
+      enddo
+C                                       
+      Call Agrif_instance(g)
+C  
+C     Detection (Agrif_detect is a user s routine)
+C      
+      do iii = 1 , Agrif_Probdim
+         size(iii) = g%nb(iii) + 1
+      enddo
+C
+      SELECT CASE (Agrif_Probdim)
+      CASE (1) 
+         Call Agrif_detect(g%tabpoint1D,size)
+      CASE (2) 
+         Call Agrif_detect(g%tabpoint2D,size)
+      CASE (3) 
+         Call Agrif_detect(g%tabpoint3D,size)
+      END SELECT
+C
+C     Addition of the areas detected on the child grids
+C      
+      parcours => g % child_grids 
+C           
+      Do while (associated(parcours))
+        Call Agrif_Add_detected_areas (g,parcours % gr)
+        parcours => parcours % next 
+      enddo
+C     
+      Return      
+C
+      End Subroutine Agrif_detect_all
+C      
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Add_detected_areas
+C     **************************************************************************
+C      
+      Subroutine Agrif_Add_detected_areas(parentgrid,childgrid)
+C
+CCC   Description:
+CCC   Subroutine to add on the parent grid the areas detected 
+CC       on its child grids.
+C
+CC    Method:        
+C
+C     Declarations:
+C
+      
+C 
+      Type(Agrif_Grid),pointer   :: parentgrid,childgrid
+C      
+      Integer :: i,j,k
+C
+      do i = 1,childgrid%nb(1)+1
+         if ( Agrif_Probdim .EQ. 1 ) then
+            If (childgrid%tabpoint1D(i).EQ.1) Then
+                parentgrid%tabpoint1D(childgrid%ix(1)+
+     &                 (i-1)/Agrif_Coeffref(1)) = 1
+            endif
+         else
+            do j=1,childgrid%nb(2)+1
+               if (Agrif_Probdim.EQ.2) then
+              If (childgrid%tabpoint2D(i,j).EQ.1) Then
+                  parentgrid%tabpoint2D(
+     &                  childgrid%ix(1)+(i-1)/Agrif_Coeffref(1),
+     &                  childgrid%ix(2)+(j-1)/Agrif_Coeffref(2)) = 1
+                  endif
+               else
+                  do k=1,childgrid%nb(3)+1
+                If (childgrid%tabpoint3D(i,j,k).EQ.1) Then
+                    parentgrid%tabpoint3D(
+     &                     childgrid%ix(1)+(i-1)/Agrif_Coeffref(1),
+     &                     childgrid%ix(2)+(j-1)/Agrif_Coeffref(2),
+     &                     childgrid%ix(3)+(k-1)/Agrif_Coeffref(3)) = 1
+                     endif
+                  enddo
+               endif
+            enddo
+         endif
+      enddo
+C      
+      Return
+C
+      End Subroutine Agrif_Add_detected_areas   
+C      
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Free_before_All
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_Free_before_All(g)
+C
+CCC   Description:
+C
+CC    Method:        
+C
+C     Declarations:
+C
+C     Pointer argument    
+      Type(Agrif_pgrid),pointer   :: g        ! Pointer on the current grid
+C
+C     Local pointer
+      Type(Agrif_pgrid),pointer  :: parcours ! Pointer for the recursive 
+                                             ! procedure      
+C
+C
+      parcours => g        
+C      
+      Do while (associated(parcours))     
+        If (.not. parcours%gr%fixed) Then
+            Call Agrif_Free_data_before(parcours%gr)
+            parcours % gr % oldgrid = .TRUE.        
+        endif
+C
+        Call Agrif_Free_before_all (parcours % gr % child_grids)
+C  
+        parcours => parcours % next             
+      enddo
+C     
+      Return      
+C
+C
+      End Subroutine Agrif_Free_before_All
+C
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Free_after_All
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_Free_after_All(g)
+C
+CCC   Description:
+C
+CC    Method:        
+C
+C     Declarations:
+C
+      
+C      
+C     Pointer argument    
+      Type(Agrif_pgrid),pointer   :: g       ! Pointer on the current grid
+C
+C     Local pointers
+      TYPE(Agrif_pgrid),pointer  :: parcours ! Pointer for the recursive proced
+      Type(Agrif_pgrid),pointer  :: preparcours   
+      Type(Agrif_pgrid),pointer  :: preparcoursini 
+C
+C
+      Allocate(preparcours)
+C 
+      preparcoursini => preparcours
+C 
+      Nullify(preparcours % gr)
+C 
+      preparcours % next => g
+C
+      parcours => g
+C      
+      Do while (associated(parcours))
+C
+         if ( (.NOT. parcours% gr% fixed) .AND.
+     &        (parcours% gr% oldgrid    ) ) then
+          Call Agrif_Free_data_after(parcours%gr)
+         endif
+C
+         Call Agrif_Free_after_all (parcours % gr % child_grids)
+C
+      If (parcours % gr % oldgrid) Then
+          Deallocate(parcours % gr)
+          preparcours % next => parcours % next
+          Deallocate(parcours)
+          parcours => preparcours % next
+        Else
+          preparcours => preparcours % next
+          parcours => parcours % next 
+         endif       
+      enddo
+C
+      Deallocate(preparcoursini)
+C     
+      Return      
+C
+      End Subroutine Agrif_Free_after_All
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Integrate
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_Integrate(g, procname)         
+C
+CCC   Description:
+CCC   Subroutine to manage the time integration of the grid hierarchy.
+C
+CC    Method:
+CC    Recursive subroutine and call on subroutines Agrif_Instance & Agrif_Step
+C
+C     Declarations:
+C
+      
+C      
+C     Pointer argument    
+      Type(Agrif_Grid),pointer   :: g        ! Pointer on the current grid
+C
+C     main procedure name
+      Optional :: procname
+      External :: procname      
+C      
+C     Local pointer
+      Type(Agrif_pgrid),pointer  :: parcours ! Pointer for the recursive 
+                                             ! procedure
+C
+C     Local scalars
+      INTEGER                    :: nbt      ! Number of time steps 
+                                             ! of the current grid
+      INTEGER                    :: k        
+      INTEGER                    :: iii
+C  
+C     Instanciation of the variables of the current grid
+      If (g%fixedrank .NE.0) Then      
+      Call Agrif_Instance
+     &     (g)
+      End If
+C       
+C     One step on the current grid      
+C
+      If (present(procname)) Then
+         Call procname ()      
+      Else
+        write(*,*) 'The name of the step subroutine has not '
+        write(*,*) 'been given in the subroutine Agrif_Integrate'
+        stop
+      endif
+C
+C     Number of time steps on the current grid      
+C
+      g%ngridstep = g % ngridstep + 1
+C      
+      parcours => g % child_grids
+C    
+C     Recursive procedure for the time integration of the grid hierarchy      
+      Do while (associated(parcours))
+C
+C       Instanciation of the variables of the current grid            
+        Call Agrif_Instance
+     &           (parcours % gr)
+C       
+C       Number of time steps
+        nbt = 1
+        do iii = 1 , Agrif_Probdim
+           nbt = max(nbt, parcours % gr % timeref(iii))
+        enddo
+C       
+        Do k = 1,nbt
+C       
+           If (present(procname)) Then
+                 Call Agrif_Integrate (parcours % gr, procname)
+           Else
+                 Call Agrif_Integrate (parcours % gr)      
+           endif
+C       
+        enddo     
+C  
+        parcours => parcours % next
+C     
+      enddo
+C
+C      
+      End Subroutine Agrif_Integrate 
+
+C     **************************************************************************
+CCC   Subroutine Agrif_Integrate_Child
+C     **************************************************************************
+C
+      Recursive Subroutine Agrif_Integrate_Child(g,procname)
+C
+CCC   Description:
+CCC   Subroutine to manage the time integration of the grid hierarchy.
+C
+CC    Method:
+CC    Recursive subroutine and call on subroutines Agrif_Instance & Agrif_Step.
+C
+C     Declarations:
+C
+
+C
+C     Pointer argument
+      Type(Agrif_Grid),pointer   :: g        ! Pointer on the current grid
+C
+C     main procedure name
+      Optional :: procname
+      External :: procname
+C
+C     Local pointer
+      Type(Agrif_pgrid),pointer  :: parcours ! Pointer for the recursive
+                                             ! procedure
+C
+C     One step on the current grid
+C
+      If (present(procname)) Then
+         Call procname ()      
+      Else
+        write(*,*) 'The name of the step subroutine has not '
+        write(*,*) 'been given in the subroutine Agrif_Integrate'
+        stop
+      endif
+C
+C     Number of time steps on the current grid
+C
+C
+      parcours => g % child_grids
+C
+C     Recursive procedure for the time integration of the grid hierarchy      
+      Do while (associated(parcours))
+C
+C       Instanciation of the variables of the current grid
+        Call Agrif_Instance
+     &           (parcours % gr)
+
+C       
+           If (present(procname)) Then
+                 Call Agrif_Integrate_Child (parcours % gr, procname)
+           Else
+                 Call Agrif_Integrate_Child (parcours % gr)
+           endif
+C  
+        parcours => parcours % next
+C     
+      enddo
+C
+C
+      End Subroutine Agrif_Integrate_Child
+
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Init_Grids
+C     **************************************************************************
+C      
+      Subroutine Agrif_Init_Grids
+C
+CCC   Description:
+CCC   Subroutine to initialize the root coarse grid pointed by Agrif_Mygrid. 
+CCC   It is called in the main program.
+C
+C     Declarations:
+C
+C
+      INTEGER :: iii
+C
+C             definition of the probdim and modtypes variables
+C
+#ifdef AGRIF_MPI
+#include "mpif.h"
+      Agrif_MPIPREC = MPI_DOUBLE_PRECISION
+#endif
+      Call Agrif_probdim_modtype_def()
+C      
+      Agrif_UseSpecialValue = .FALSE.
+      Agrif_UseSpecialValueFineGrid = .FALSE.
+      Agrif_SpecialValue = 0.
+      Agrif_SpecialValueFineGrid = 0.
+C      
+C     Allocation of Agrif_Mygrid
+      allocate(Agrif_Mygrid)
+C      
+C     Space and time refinement factors are set to 1 on the root grid
+C
+      do iii = 1 , Agrif_Probdim
+         Agrif_Mygrid % spaceref(iii) = 1
+         Agrif_Mygrid % timeref(iii) = 1
+      enddo
+C      
+C     Initialization of the number of time steps    
+      Agrif_Mygrid % ngridstep = 0
+      Agrif_Mygrid % grid_id = 0
+C
+C     No parent grid for the root coarse grid
+      Nullify(Agrif_Mygrid % parent)
+C      
+C     Initialization of the minimum positions, global abscissa and space steps  
+      do iii= 1 ,  Agrif_Probdim
+         Agrif_Mygrid % ix(iii) = 1            
+         Agrif_Mygrid % Agrif_x(iii) = 0.
+         Agrif_Mygrid % Agrif_d(iii) = 1. 
+C     Borders of the root coarse grid 
+         Agrif_Mygrid % NearRootBorder(iii) = .true.  
+         Agrif_Mygrid % DistantRootBorder(iii) = .true.      
+      enddo
+C  
+C     The root coarse grid is a fixed grid
+      Agrif_Mygrid % fixed = .TRUE.
+C      
+C     Number of the grid pointed by Agrif_Mygrid (root coarse grid)
+      Agrif_Mygrid % rank = 1      
+C 
+C     Number of the root grid as a fixed grid   
+      Agrif_Mygrid % fixedrank = 0  
+C 
+C     Initialization of some fields of the root grid variables     
+      Call Agrif_Create_Var (Agrif_Mygrid)
+C      
+C     Initialization of the other fields of the root grid variables (number of 
+C     cells, positions, number and type of its dimensions, ...)  
+      Call Agrif_Set_numberofcells(Agrif_Mygrid)
+C      
+      Call Agrif_Instance (Agrif_Mygrid)        
+C             
+C     Allocation of the array containing the values of the grid variables
+      Call Agrif_Allocation (Agrif_Mygrid)
+C        
+      Call Agrif_initialisations(Agrif_Mygrid)
+C      
+      nullify(Agrif_Mygrid % child_grids)
+C 
+C     Total number of fixed grids   
+      Agrif_nbfixedgrids = 0         
+C      
+      Call Agrif_Instance (Agrif_Mygrid)
+C        
+      End Subroutine Agrif_Init_Grids  
+C
+C
+C     **************************************************************************
+CCC   Subroutine Agrif_Deallocation
+C     **************************************************************************
+C      
+      Subroutine Agrif_Deallocation
+C
+CCC   Description:
+CCC   Subroutine to initialize the root coarse grid pointed by Agrif_Mygrid. 
+CCC   It is called in the main program.
+C
+C     Declarations:
+C
+C
+      INTEGER :: nb
+C
+C             definition of the probdim and modtypes variables
+C
+      do nb = 1, Agrif_NbVariables
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % array1) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % array1)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % array2) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % array2)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % array3) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % array3)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % array4) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % array4)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % array5) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % array5)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % array6) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % array6)
+C
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % iarray1) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % iarray1)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % iarray2) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % iarray2)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % iarray3) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % iarray3)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % iarray4) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % iarray4)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % iarray5) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % iarray5)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % iarray6) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % iarray6)
+C
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % larray1) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % larray1)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % larray2) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % larray2)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % larray3) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % larray3)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % larray4) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % larray4)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % larray5) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % larray5)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % larray6) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % larray6)
+C
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % carray1) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % carray1)
+          if ( associated(Agrif_Mygrid % tabvars(nb) % var % carray2) ) 
+     &       Deallocate(Agrif_Mygrid % tabvars(nb) % var % carray2)
+      enddo
+C
+      do nb = 1, Agrif_NbVariables
+        Deallocate(Agrif_Mygrid % tabvars(nb) % var)
+      enddo
+C
+      Deallocate(Agrif_Mygrid % tabvars)
+C
+      Deallocate(Agrif_Mygrid)
+C
+      End Subroutine  Agrif_Deallocation 
+C
+      End module Agrif_Util 
Index: /trunk/AGRIF/KEY_CPP
===================================================================
--- /trunk/AGRIF/KEY_CPP	(revision 396)
+++ /trunk/AGRIF/KEY_CPP	(revision 396)
@@ -0,0 +1,1 @@
+
Index: /trunk/AGRIF/LIB/DiversListe.c
===================================================================
--- /trunk/AGRIF/LIB/DiversListe.c	(revision 396)
+++ /trunk/AGRIF/LIB/DiversListe.c	(revision 396)
@@ -0,0 +1,377 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                      COM_1_AddCommonvartolist                              */
+/******************************************************************************/
+/*  This subroutines is used to add the variable defined in common in the     */
+/*     commonlist                                                             */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void COM_1_AddCommonvartolist()
+{
+   listvarcommon *newvar;
+   
+   newvar = (listvarcommon *)malloc(sizeof(listvarcommon));
+   strcpy(newvar->nomvar,commonvar);
+   strcpy(newvar->commonname,commonblockname);
+   strcpy(newvar->subroutinename,subroutinename);
+   newvar->positioninblock= positioninblock;
+
+   newvar->suiv = NULL;
+
+   if ( !commonlist )
+   {
+      commonlist = newvar;
+   }
+   else
+   {
+      newvar->suiv = commonlist;
+      commonlist = newvar;
+   }
+}
+
+/******************************************************************************/
+/*                     Addtolistnom                                           */
+/******************************************************************************/
+/* This subroutine is used to add a variable to the list                      */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+listnom *Addtolistnom(char *nom, listnom *listin)
+{
+   listnom *newnom;
+   listnom *parcours;
+   int out;
+
+   if ( !listin )
+   {
+      newnom=(listnom *) malloc (sizeof (listnom));
+      strcpy(newnom->nom,nom);
+      newnom->suiv = NULL;
+      listin = newnom;
+   }
+   else
+   {
+      parcours = listin;
+      out = 0 ;
+      while ( parcours && out == 0 )
+      {
+         if ( !strcasecmp(parcours->nom,nom) ) out = 1 ;
+         else parcours=parcours->suiv;
+      }
+      if ( out == 0 ) 
+      {
+          newnom=(listnom *) malloc (sizeof (listnom));
+          strcpy(newnom->nom,nom);
+          newnom->suiv = listin;
+          listin = newnom;
+      }
+   }
+   return listin;
+}
+
+/******************************************************************************/
+/*                           Add_listname                                     */
+/******************************************************************************/
+/* This subroutine is used to add a        variable to the list               */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+listname *Add_listname(char *nom,listname *input)
+{
+   listname *newnom;
+   listname *parcours;
+   int out;
+
+   if ( !input )
+   {
+      newnom=(listname *) malloc (sizeof (listname));
+      strcpy(newnom->name,nom);
+      newnom->suiv = NULL;
+      input = newnom;
+   }
+   else
+   {
+      parcours = input;
+      out = 0 ;
+      while ( parcours && out == 0 )
+      {
+         if ( !strcasecmp(parcours->name,nom) ) out = 1;
+         else parcours=parcours->suiv;         
+      }
+      if ( out == 0 )
+      {
+         newnom=(listname *) malloc (sizeof (listname));
+         strcpy(newnom->name,nom);
+         newnom->suiv = input;
+         input = newnom;
+      }
+   }
+   return input;
+}
+
+/******************************************************************************/
+/*                     Add_ModuleTo_listofmodules                             */
+/******************************************************************************/
+/* This subroutine is used to add a        variable to the list               */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void Add_ModuleTo_listofmodules(char *nom)
+{
+   listnom *newnom;
+
+   newnom=(listnom *) malloc (sizeof (listnom));
+   strcpy(newnom->nom,nom);
+   newnom->suiv = listofmodules;
+   listofmodules = newnom;   
+}
+
+/******************************************************************************/
+/*                    ModuleIsDefineInInputFile                               */
+/******************************************************************************/
+/* This subroutine is used to know if the module is defined in the input file */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+int ModuleIsDefineInInputFile(char *name)
+{
+   listnom *newnom;
+   int out;
+   
+   out = 0;
+   if ( listofmodules ) 
+   {
+      newnom = listofmodules;
+      while( newnom && out == 0 )
+      {
+         if ( !strcasecmp(newnom->nom,name) ) out = 1 ;
+         else newnom=newnom->suiv;
+      }
+   }
+   return out;
+}
+
+/******************************************************************************/
+/*                         AddNameToListNamelist                              */
+/******************************************************************************/
+/* This subroutine is used to add a listvar l at the end of a listvar         */
+/* glob.                                                                      */
+/*                                                                            */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + glob +--->+ glob +--->+ glob +--->+ glob +--->+  l   +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+void AddNameToListNamelist(char * name)
+{
+   listnamelist *newvar;
+
+   if ( strcasecmp(name,"") )
+   {
+      newvar =(listnamelist*)malloc(sizeof(listnamelist));
+      strcpy(newvar->name,name);
+      newvar->suiv = listenamelist;
+      listenamelist = newvar;
+   }
+}
+
+/******************************************************************************/
+/*                      Addmoduletothelisttmp                                 */
+/******************************************************************************/
+/* This subroutine is used to add a record to a list of struct                */
+/* listusemodule                                                              */
+/******************************************************************************/
+/*                                                                            */
+/*       subroutine sub ... USE mod1 ===> insert in list                      */
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ list +--->+ list +--->+ list +--->+ list +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*       list =  listofmoduletmp                                              */
+/*                                                                            */
+/******************************************************************************/
+void Addmoduletothelisttmp(char *name)
+{
+  listusemodule *newmodule;
+  listusemodule *parcours;
+  int out;
+
+  if ( !listofmoduletmp)
+  {
+    newmodule =(listusemodule *)malloc(sizeof(listusemodule));
+    strcpy(newmodule->usemodule,name);
+    strcpy(newmodule->cursubroutine,subroutinename);  
+    newmodule->suiv = NULL;
+    listofmoduletmp = newmodule ;
+  }
+  else
+  {
+    parcours = listofmoduletmp;
+    out = 0;
+    while( parcours && out == 0 )
+    {
+       if ( !strcasecmp(parcours->usemodule,name) ) out = 1;
+       else parcours = parcours->suiv;
+    }
+    if ( out == 0 )
+    {
+       newmodule =(listusemodule *)malloc(sizeof(listusemodule));
+       strcpy(newmodule->usemodule,name);
+       strcpy(newmodule->cursubroutine,subroutinename);  
+       newmodule->suiv = listofmoduletmp;
+       listofmoduletmp = newmodule;
+    }
+  }
+}
+
+/******************************************************************************/
+/*                     Add_ModuleTo_Modulelist                                */
+/******************************************************************************/
+/* This subroutine is used to add a        variable to the list               */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void Add_ModuleTo_Modulelist(char *nom)
+{
+   listnom *newnom;
+
+   newnom=(listnom *) malloc (sizeof (listnom));
+   strcpy(newnom->nom,nom);
+   newnom->suiv = modulelist;
+   modulelist = newnom;   
+}
+
+/******************************************************************************/
+/*                 OPTI_1_completelistvarpointtovar                           */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/* We should complete the listvarpointtovar                                   */ 
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_1_completelistvarpointtovar(char *namemodule,listcouple *couple)
+{
+   listvarpointtovar *pointtmp;
+   
+   if ( firstpass == 1 ) 
+   {
+      /* we should complete the Listofvarpointtovar                           */
+      pointtmp=(listvarpointtovar *)malloc(sizeof(listvarpointtovar));
+      strcpy(pointtmp->usemodule,namemodule);
+      strcpy(pointtmp->cursubroutine,subroutinename);
+      pointtmp->couple = couple;
+      if ( Listofvarpointtovar )
+      {
+         pointtmp->suiv = Listofvarpointtovar;
+         Listofvarpointtovar = pointtmp;
+      }
+      else
+      {
+         pointtmp->suiv = NULL;
+         Listofvarpointtovar = pointtmp;    
+      }
+   }
+}
+
+/******************************************************************************/
+/*                        Addincludetothelist                                 */
+/******************************************************************************/
+/* This subroutine is used to add a record to a list of struct                */
+/*  listofincludebysubroutine                                                 */
+/******************************************************************************/
+/*                                                                            */
+/*       subroutine sub ... USE mod1 ===> insert in list                      */
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ list +--->+ list +--->+ list +--->+ list +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*       list =  listofmodulebysubroutine                                     */
+/*                                                                            */
+/******************************************************************************/
+void Addincludetothelist(char *name)
+{
+  listusemodule *newinclude;
+
+  newinclude =(listusemodule *)malloc(sizeof(listusemodule));
+  strcpy(newinclude->usemodule,name);
+  strcpy(newinclude->cursubroutine,subroutinename);  
+  newinclude->suiv = NULL;
+
+  if ( !listofincludebysubroutine)
+  {
+     listofincludebysubroutine  = newinclude ;
+  }
+  else
+  {
+    newinclude->suiv = listofincludebysubroutine;
+    listofincludebysubroutine = newinclude;
+  }
+}
+
+
+/******************************************************************************/
+/*                        WriteIncludeDeclaration                             */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void WriteIncludeDeclaration()
+{
+  listusemodule *newinclude;
+
+  newinclude = listofincludebysubroutine;
+  fprintf(fortranout,"\n");
+  while ( newinclude )
+  {
+     if ( !strcasecmp(newinclude->cursubroutine,subroutinename) )
+     {
+        fprintf(fortranout,"      INCLUDE %s \n",newinclude->usemodule);
+     }
+     newinclude = newinclude ->suiv;  
+  }
+}
Index: /trunk/AGRIF/LIB/Makefile
===================================================================
--- /trunk/AGRIF/LIB/Makefile	(revision 396)
+++ /trunk/AGRIF/LIB/Makefile	(revision 396)
@@ -0,0 +1,48 @@
+#- option to debug
+C_D = # -g -Wall
+# Compilation:
+CC		= @$(C_L) $(C_O) $(C_D)
+#-
+OBJS = main.o WriteInFile.o toamr.o tests.o fortran.o  \
+       dependfile.o SubLoopCreation.o WorkWithlistvarindoloop.o \
+       WorkWithvarofsubroutineliste.o WorkWithParameterlist.o \
+       Writedeclarations.o WorkWithglobliste.o UtilFortran.o \
+       UtilNotGridDep.o WorkWithlistdatavariable.o \
+       DiversListe.o UtilAgrif.o WorkWithAllocatelist.o \
+       UtilCharacter.o UtilListe.o UtilFile.o \
+       WorkWithlistofmodulebysubroutine.o WorkWithlistmoduleinfile.o
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+all : conv
+	@echo CONV is ok
+
+conv :  $(OBJS)
+	@$(CC) $(OBJS) -o ../$@
+
+main.o : main.c
+fortran.o : fortran.c	
+toamr.o : toamr.c decl.h
+WriteInFile.o : WriteInFile.c decl.h
+tests.o : tests.c decl.h
+dependfile.o : dependfile.c decl.h	
+SubLoopCreation.o : SubLoopCreation.c decl.h	
+WorkWithglobliste.o : WorkWithglobliste.c decl.h	
+WorkWithlistvarindoloop.o : WorkWithlistvarindoloop.c decl.h	
+WorkWithvarofsubroutineliste.o : WorkWithvarofsubroutineliste.c decl.h	
+Writedeclarations.o : Writedeclarations.c decl.h	
+UtilFortran.o : UtilFortran.c decl.h	
+WorkWithParameterlist.o : WorkWithParameterlist.c decl.h	
+UtilNotGridDep.o : UtilNotGridDep.c decl.h	
+WorkWithlistdatavariable.o : WorkWithlistdatavariable.c decl.h	
+DiversListe.o : DiversListe.c decl.h	
+UtilAgrif.o : UtilAgrif.c decl.h	
+WorkWithAllocatelist.o : WorkWithAllocatelist.c decl.h
+UtilCharacter.o : UtilCharacter.c decl.h
+UtilListe.o : UtilListe.c decl.h
+UtilFile.o : UtilFile.c decl.h
+WorkWithlistofmodulebysubroutine.o : WorkWithlistofmodulebysubroutine.c decl.h
+WorkWithlistmoduleinfile.o : WorkWithlistmoduleinfile.c decl.h
+clean : 
+	/bin/rm -f *.o y.output
Index: /trunk/AGRIF/LIB/Makefile.lex
===================================================================
--- /trunk/AGRIF/LIB/Makefile.lex	(revision 396)
+++ /trunk/AGRIF/LIB/Makefile.lex	(revision 396)
@@ -0,0 +1,72 @@
+# Compilation:
+CC		= cc -O
+LEX		= flex
+
+# option de flex et pas de lex
+LEXFLAGS=-i
+YACC = byacc -t -v
+
+
+OBJS = main.o WriteInFile.o toamr.o tests.o fortran.o  \
+       dependfile.o SubLoopCreation.o WorkWithlistvarindoloop.o \
+       WorkWithvarofsubroutineliste.o WorkWithParameterlist.o \
+       Writedeclarations.o WorkWithglobliste.o UtilFortran.o \
+       UtilNotGridDep.o WorkWithlistdatavariable.o \
+       DiversListe.o UtilAgrif.o WorkWithAllocatelist.o \
+       UtilCharacter.o UtilListe.o UtilFile.o \
+       WorkWithlistofmodulebysubroutine.o WorkWithlistmoduleinfile.o
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+all : conv
+
+conv :  $(OBJS)
+	$(CC) $(OBJS)  $(LEXLIB) -o ../$@
+
+main.o : main.c
+main.c : convert.tab.c  convert.yy.c
+	rm -f main.c
+	cat convert.tab.c  convert.yy.c > main.c
+	rm -f convert.yy.c convert.tab.c
+fortran.o : fortran.c	
+fortran.c : fortran.tab.c fortran.yy.c
+	rm -f fortran.c
+	cat fortran.tab.c  fortran.yy.c > fortran.c	
+	rm -f fortran.yy.c fortran.tab.c
+convert.tab.c : convert.y decl.h
+	$(YACC) convert.y
+	mv -f y.tab.c convert.tab.c
+fortran.tab.c : fortran.y decl.h
+	$(YACC) -p fortran fortran.y
+	mv -f y.tab.c fortran.tab.c	
+convert.yy.c : convert.lex
+	$(LEX) $(LEXFLAGS) -oconvert.yy.c convert.lex 
+fortran.yy.c : fortran.lex
+	$(LEX) $(LEXFLAGS) -Pfortran -ofortran.yy.c fortran.lex
+	
+toamr.o : toamr.c decl.h
+WriteInFile.o : WriteInFile.c decl.h
+tests.o : tests.c decl.h
+dependfile.o : dependfile.c decl.h
+SubLoopCreation.o : SubLoopCreation.c decl.h
+WorkWithglobliste.o : WorkWithglobliste.c decl.h
+WorkWithlistvarindoloop.o : WorkWithlistvarindoloop.c decl.h
+WorkWithvarofsubroutineliste.o : WorkWithvarofsubroutineliste.c decl.h
+Writedeclarations.o : Writedeclarations.c decl.h
+UtilFortran.o : UtilFortran.c decl.h
+WorkWithParameterlist.o : WorkWithParameterlist.c decl.h
+UtilNotGridDep.o : UtilNotGridDep.c decl.h
+WorkWithlistdatavariable.o : WorkWithlistdatavariable.c decl.h
+DiversListe.o : DiversListe.c decl.h
+UtilAgrif.o : UtilAgrif.c decl.h
+WorkWithAllocatelist.o : WorkWithAllocatelist.c decl.h
+UtilCharacter.o : UtilCharacter.c decl.h
+UtilListe.o : UtilListe.c decl.h
+UtilFile.o : UtilFile.c decl.h
+WorkWithlistofmodulebysubroutine.o : WorkWithlistofmodulebysubroutine.c decl.h
+WorkWithlistmoduleinfile.o : WorkWithlistmoduleinfile.c decl.h
+clean : 
+	/bin/rm -f *.o y.tab.c main.c lex.yy.c fortran.c \
+	fortran.tab.c fortran.yy.c convert.tab.c convert.yy.c \
+	y.output
Index: /trunk/AGRIF/LIB/SubLoopCreation.c
===================================================================
--- /trunk/AGRIF/LIB/SubLoopCreation.c	(revision 396)
+++ /trunk/AGRIF/LIB/SubLoopCreation.c	(revision 396)
@@ -0,0 +1,514 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+
+/******************************************************************************/
+/*     preparation and write of the argument list of a subroutine             */
+/******************************************************************************/
+ 
+ 
+/******************************************************************************/
+/*                        OPTI_0_writeheadnewsubforsub                        */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should write the head of the subroutine sub_loop_<subroutinename>       */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_0_writeheadnewsubforsub()
+{
+   int out;
+   listusemodule *newmodule;
+   
+   if ( firstpass == 0 && OPTI_0_IsTabvarsUseInArgument() == 1 ) 
+   {
+
+      /* we should add the use agrif_util if it is necessary                  */
+      newmodule = listofmodulebysubroutine;
+      out = 0 ;
+      if ( adduseagrifutil != 1 && inmodulemeet == 0 )
+      {
+         while ( newmodule && out == 0 )
+         {
+             if ( !strcasecmp(newmodule->cursubroutine,subroutinename) ||
+                  !strcasecmp(newmodule->cursubroutine," ")
+                 )
+             {
+                if ( !strcasecmp(newmodule->charusemodule,"Agrif_Util") ) 
+                                                                        out = 1;
+             }
+             newmodule = newmodule ->suiv;  
+         }
+         if ( out == 0 ) tofich(fortranout,
+                             "\n      USE Agrif_Types, ONLY : Agrif_tabvars",1);
+      }
+      /* we should modify the name of the variable in the                     */
+      /* listvarindoloop which has been declared by the way of the            */
+      /* USE fortran  function : USE MOD, U => V                              */
+      ModifyThelistvarindoloop();
+      /* And write the head of the new subroutine                             */
+      WriteHeadofSubroutineLoop(); 
+      if ( OPTI_0_IsAllocateInThisSubroutine() == 1 && inmodulemeet == 0 )
+      {
+         tofich(fortranout,"\n      USE Agrif_Types, ONLY : Agrif_tabvars",1); 
+      }
+      else if ( out == 1 && fortran77 == 1 ) tofich(fortranout,
+                                                    "\n      USE Agrif_Util",1);
+      WriteUsemoduleDeclaration();
+      WriteIncludeDeclaration();
+      if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortranout,
+                                                       "      IMPLICIT NONE\n");
+      /* We should write once the declaration of tables (extract              */
+      /*    from pointer) in the new subroutine                               */
+      tmpdeclaration_everdone = 1;
+      if ( todebug == 1 ) fprintf(fortranout,"!!! 111111111111111 \n");
+      if ( fortran77 == 1 ) writesub_loopdeclaration
+                                                     (parameterlist,fortranout);
+      if ( todebug == 1 ) fprintf(fortranout,"!!! 222222222222222 \n");
+      writesub_loopdeclaration(listvarindoloop,fortranout);
+      if ( todebug == 1 ) fprintf(fortranout,"!!! 333333333333333 \n");
+      if ( fortran77 == 1 ) writesub_loopdeclaration
+                                              (varofsubroutineliste,fortranout);
+      if ( todebug == 1 ) fprintf(fortranout,"!!! 444444444444444 \n");
+      if ( fortran77 == 1 ) writesub_loopdeclaration
+                                                     (varsubroutine,fortranout);
+      if ( todebug == 1 ) fprintf(fortranout,"!!! 555555555555555 \n");
+      /* now we should write the function declaration                         */
+      /*    case if it is the                                                 */
+      writedeclaration (functionlistvar, fortranout,varofsubroutineliste);
+      if ( todebug == 1 ) fprintf(fortranout,"!!! 666666666666666 \n");
+   }
+   else if ( firstpass == 0 )
+   {
+      WriteUsemoduleDeclaration();
+      WriteIncludeDeclaration();
+   }
+   
+}
+
+
+/******************************************************************************/
+/*                        OPTI_0_writeheadnewsubforfunc                       */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should write the head of the subroutine sub_loop_<subroutinename>       */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_0_writeheadnewsubforfunc()
+{
+   int out;
+   listusemodule *newmodule;
+
+   if ( firstpass == 0 && OPTI_0_IsTabvarsUseInArgument() == 1 )
+   {
+      /* we should add the use agrif_util if it is necessary                  */
+      newmodule = listofmodulebysubroutine;
+      out = 0 ;
+      if ( adduseagrifutil != 1 && inmodulemeet == 0 )
+      {
+         while ( newmodule && out == 0 )
+         {
+             if ( !strcasecmp(newmodule->cursubroutine,subroutinename) ||
+                  !strcasecmp(newmodule->cursubroutine," ")
+                 )
+             {
+                if ( !strcasecmp(newmodule->charusemodule,"Agrif_Util") ) 
+                                                                        out = 1;
+             }
+             newmodule = newmodule ->suiv;  
+         }
+         if ( out == 0 ) tofich(fortranout,
+                             "\n      USE Agrif_Types, ONLY : Agrif_tabvars",1);
+      }
+      WriteHeadofSubroutineLoop();   
+      if ( OPTI_0_IsAllocateInThisSubroutine() == 1 && inmodulemeet == 0 )
+           tofich(fortranout,"\n      USE Agrif_Types, ONLY : Agrif_tabvars",1);
+      WriteUsemoduleDeclaration();
+      WriteIncludeDeclaration();
+      if ( ImplicitNoneInSubroutine() == 1 ) fprintf(fortranout,
+                                                       "      IMPLICIT NONE\n");
+      /* We should write once the declaration of tables (extract              */
+      /*    from pointer) in the new subroutine                               */
+      tmpdeclaration_everdone = 1;
+      if ( fortran77 == 1 ) writesub_loopdeclaration
+                                                     (parameterlist,fortranout);
+      writesub_loopdeclaration(listvarindoloop,fortranout);
+      if ( fortran77 == 1 ) writesub_loopdeclaration
+                                                     (varsubroutine,fortranout);
+      if ( fortran77 == 1 ) writesub_loopdeclaration
+                                              (varofsubroutineliste,fortranout);
+      /* now we should write the function declaration                         */
+      /*    case if it is the                                                 */
+      writedeclaration (functionlistvar, fortranout,varofsubroutineliste);
+   }
+   else if ( firstpass == 0 ) 
+   {
+      WriteUsemoduleDeclaration();
+      WriteIncludeDeclaration();
+   }
+}
+
+
+/******************************************************************************/
+/*                    OPTI_0_writesubroutinedeclaration                       */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should write the declaration of the subroutine in order to              */
+/* create the new sub_loop subroutine                                         */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_0_writesubroutinedeclaration(listvar *listtomodify)
+{
+   if ( VariableIsParameter == 0 && SaveDeclare == 0)
+   {
+      if (firstpass == 0 && OPTI_0_IsTabvarsUseInArgument() == 1 )
+      {
+         /* We should write this declaration into the original                */
+         /*    subroutine too                                                 */
+        if ( fortran77 == 1                 && 
+             paramdeclaration_everdone == 0 && 
+             varofsubroutineliste 
+           )
+        {
+           paramdeclaration_everdone = 1;
+           writedeclarationsubroutinedeclaration
+                             (parameterlist,oldfortranout,varofsubroutineliste);
+        }
+        writedeclaration (listtomodify, oldfortranout,varofsubroutineliste);
+      }
+   }
+}
+
+/******************************************************************************/
+/*                    WriteVariablelist_subloop                               */
+/******************************************************************************/
+/* This subroutine is used to write the list of the variable which            */
+/* should be called by the sub_loop_<name> subroutine                         */
+/* The first part is composed by the list of the local variables              */
+/******************************************************************************/
+/*                                                                            */
+/*    varofsubroutineliste              a,b,c,  &                             */
+/*                                      d,e,f,  &                             */
+/*     a,b,c,d,e,f,g,h     ========>    g,h                                   */
+/*                                                                            */
+/******************************************************************************/
+void WriteVariablelist_subloop(FILE *outputfile)
+{
+   listvar *parcours;   
+   char ligne[LONGNOM];
+   int compteur;
+   
+   parcours = varofsubroutineliste;
+   didvariableadded = 0;
+   compteur = 0 ;
+   
+   while ( parcours )   
+   {
+      /* if the readed variable is a variable of the subroutine               */
+      /*    subroutinename we should write the name of this variable          */
+      /*    in the output file                                                */
+      if ( !strcasecmp(parcours->var->modulename,subroutinename) )
+      {      
+         if ( didvariableadded == 0 )
+         {
+            strcpy(ligne,"");
+         }
+         else
+         {
+            if ( compteur == 0 ) strcpy(ligne,"");
+            strcat(ligne,",");
+         }
+         strcat(ligne,parcours->var->nomvar);
+         didvariableadded = 1;
+         compteur = compteur + 1;
+         if ( compteur == 3 ) 
+         {
+            if ( fortran77 == 0 ) strcat(ligne," &");
+            if ( fortran77 == 0 ) fprintf(outputfile,"\n      %s",ligne);
+            else fprintf(outputfile,"\n     & %s",ligne);
+            compteur = 0;
+         }
+      }
+      parcours = parcours -> suiv;   
+   }
+   if ( compteur != 3 && compteur != 0 ) 
+   {
+      if ( fortran77 == 0 ) fprintf(outputfile,"\n      %s &",ligne);
+      else fprintf(outputfile,"\n     & %s ",ligne);
+   }
+}
+
+
+/******************************************************************************/
+/*                     WriteVariablelist_subloop_Call                         */
+/******************************************************************************/
+/* This subroutine is used to write the list of the variable which            */
+/* should be called by the sub_loop_<name> subroutine into the called         */
+/* The second part is composed by the list of the global table                */
+/******************************************************************************/
+/*                                                                            */
+/*      listvarindoloop        SubloopScalar = 0 | SubloopScalar = 1          */
+/*                                a,b,c,  &      |  a,b(1,1),c,      &        */
+/*     a,b,c,d,e,f,g,h  =====>    d,e,f,  &      |  d(1),e(1,1,1),f, &        */
+/*                                g,h            |  g,h(1,1)                  */
+/*                                                                            */
+/******************************************************************************/
+void  WriteVariablelist_subloop_Call(FILE *outputfile)
+{
+   listvar *parcours;   
+   char ligne[LONGNOM*100];
+   char ligne2[10];
+   int i;
+   
+   parcours = listvarindoloop;
+   while ( parcours )   
+   {
+      /* if the readed variable is a variable of the subroutine               */
+      /*    subroutinename we should write the name of this variable          */
+      /*    in the output file                                                */
+      if ( !strcasecmp(parcours->var->modulename,subroutinename) )
+      {
+         if ( didvariableadded == 0 )
+         {
+            strcpy(ligne,"");
+         }
+         else
+         {
+            strcpy(ligne,"");
+            strcat(ligne,",");
+         }
+         strcat(ligne,vargridcurgridtabvars(parcours->var,0));
+         /* if it is asked in the call of the conv we should give             */
+         /* scalar in argument, so we should put (1,1,1) after the            */
+         /* the name of the variable                                          */
+         if (  SubloopScalar != 0 && 
+               (OPTI_0_IsVarAllocatable(parcours->var->nomvar) == 0 && 
+	       parcours->var->pointerdeclare == 0 ) &&
+               parcours->var->nbdim != 0 )
+         {
+             i = 1;
+             while ( i <=  parcours->var->nbdim )
+             {
+                if ( i == 1 ) strcat(ligne,"( ");
+                if ( SubloopScalar == 2 )
+                {
+                   strcat(ligne,":");
+                   if ( i != parcours->var->nbdim ) strcat(ligne,",");
+                }
+                else
+                {
+                   strcat(ligne," lbound( ");
+                   strcat(ligne,vargridcurgridtabvars(parcours->var,0));
+                   strcat(ligne,",");
+                   strcpy(ligne2,"");
+                   sprintf(ligne2,"%d",i);
+                   strcat(ligne,ligne2);
+                   if ( i != parcours->var->nbdim ) strcat(ligne,"),");
+                }
+                if ( i == parcours->var->nbdim ) strcat(ligne,"))");
+                i++;
+             }
+         }
+         didvariableadded = 1;
+         if ( fortran77 == 0 ) strcat(ligne," &");
+         if ( fortran77 == 0 ) fprintf(outputfile,"\n");
+         else fprintf(outputfile,"\n     & ");
+         tofich(outputfile,ligne,0);
+      }
+      parcours = parcours -> suiv;   
+   }
+   /* Now we should replace the last ", &" by " &"                            */
+   if ( didvariableadded != 0 && fortran77 == 0 ) fseek(outputfile,-1,SEEK_CUR);
+   if ( didvariableadded == 0 ) fseek(outputfile,-2,SEEK_CUR);
+}
+
+
+/******************************************************************************/
+/*                       WriteVariablelist_subloop_Def                        */
+/******************************************************************************/
+/* This subroutine is used to write the list of the variable which            */
+/* should be called by the sub_loop_<name> subroutine into the def            */
+/* The second part is composed by the list of the global table                */
+/* <name>_tmp                                                                 */
+/******************************************************************************/
+/*                                                                            */
+/*       listvarindoloop                                                      */
+/*                                a-tmp,b-tmp,c_tmp, &                        */
+/*     a,b,c,d,e,f,g,h  =====>    d_tmp,e_tmp,f_tmp, &                        */
+/*                                g_tmp,h_tmp                                 */
+/*                                                                            */
+/******************************************************************************/
+void  WriteVariablelist_subloop_Def(FILE *outputfile)
+{
+   listvar *parcours;   
+   char ligne[LONGNOM];
+   int compteur;
+
+   parcours = listvarindoloop;
+   compteur = 0 ;
+   while ( parcours )   
+   {
+      /* if the readed variable is a variable of the subroutine               */
+      /*    subrotinename we should write the name of this variable           */
+      /*    in the output file                                                */
+      if ( !strcasecmp(parcours->var->modulename,subroutinename) )
+      {
+         if ( didvariableadded == 0 )
+         {
+            strcpy(ligne,"");
+         }
+         else
+         {
+            if ( compteur == 0 ) strcpy(ligne,"");
+            strcat(ligne,",");
+         }
+         strcat(ligne,parcours->var->nomvar);
+         compteur = compteur + 1;
+         didvariableadded = 1;
+         if ( compteur == 3 ) 
+         {
+            if ( fortran77 == 0 ) strcat(ligne," &");
+            if ( fortran77 == 0 ) fprintf(outputfile,"\n      %s",ligne);
+            else fprintf(outputfile,"\n     & %s",ligne);
+            compteur = 0;
+         }
+      }
+      parcours = parcours -> suiv;   
+   }   
+   if ( compteur != 3 && compteur != 0 )
+   {
+      if ( fortran77 == 0 ) fprintf(outputfile,"\n      %s &",ligne);
+      else fprintf(outputfile,"\n     & %s",ligne);
+   }
+
+   /* Now we should replace the last ", &" by " &"                            */
+   if ( didvariableadded != 0 && fortran77 == 0 ) fseek(outputfile,-1,SEEK_CUR);
+   if ( didvariableadded == 0 ) fseek(outputfile,-1,SEEK_CUR);
+}
+
+
+/******************************************************************************/
+/*                      WriteHeadofSubroutineLoop                             */
+/******************************************************************************/
+/* This subroutine is used to write the head of the subroutine                */
+/* Sub_Loop_<name>                                                            */
+/******************************************************************************/
+/*                 Sub_loop_subroutine.h                                      */
+/*                                                                            */
+/*                 subroutine Sub_Loop_subroutine ( &                         */
+/*                 a,b,c, &                                                   */
+/* SubLoopScalar   d,e(1,1),f(1,1,1), &                                       */
+/*                 g,h  &                                                     */
+/*                 )                                                          */
+/* adduseagrifutil USE Agrif_Util                                             */
+/******************************************************************************/
+void  WriteHeadofSubroutineLoop()
+{
+   char ligne[LONGNOM];
+   FILE * subloop;
+
+
+   tofich(fortranout,"\n",1);
+   /* Open this newfile                                                       */
+   sprintf(ligne,"Sub_Loop_%s.h",subroutinename);
+   subloop = associate(ligne);
+   /*                                                                         */
+   if ( fortran77 == 0 ) sprintf(ligne,"      subroutine Sub_Loop_%s( &"
+                                                               ,subroutinename);
+   else sprintf(ligne,"      subroutine Sub_Loop_%s( ",subroutinename);
+   fprintf(subloop,ligne);
+   /*                                                                         */
+   WriteVariablelist_subloop(subloop);
+   WriteVariablelist_subloop_Def(subloop);
+   /*                                                                         */
+   sprintf(ligne,")");
+   tofich(subloop,ligne,1);   
+   /* if USE agrif_Util should be add                                         */
+   if ( adduseagrifutil == 1 ) fprintf(subloop,"\n      USE Agrif_Util\n");
+   /*                                                                         */
+   oldfortranout = fortranout;
+   fortranout = subloop;
+}
+
+/******************************************************************************/
+/*                OPTI_0_closeandcallsubloopandincludeit                      */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should close the sub_loop subroutine, call it and close the             */
+/* function (suborfun = 0)                                                    */
+/* subroutine (suborfun = 1)                                                  */
+/* end (suborfun = 2)                                                         */
+/* end program (suborfun = 3)                                                 */
+/* and include the sub_loop subroutine after                                  */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_0_closeandcallsubloopandincludeit(int suborfun, char endsub[LONGNOM],
+                                                          char optname[LONGNOM])
+{
+   char ligne[LONGNOM];
+
+   if ( firstpass == 0 ) 
+   {
+   if ( OPTI_0_IsTabvarsUseInArgument() == 1 )
+   {
+      /* We should remove the key word end subroutine                         */
+      RemoveWordCUR(fortranout,(long)(-strlen(optname)-strlen(endsub)-1),
+                                       strlen(optname)+strlen(endsub)+1);
+      /* We should close the loop subroutine                                  */
+      sprintf(ligne,"\n      end subroutine Sub_Loop_%s",subroutinename);
+      tofich(fortranout,ligne,1);
+      fclose(fortranout);  
+      fortranout = oldfortranout;
+      /* Now we add the call af the new subroutine                            */
+      if ( fortran77 == 0 ) sprintf(ligne,"\n      Call Sub_Loop_%s( &"
+                                                               ,subroutinename);
+      else sprintf(ligne,"\n      Call Sub_Loop_%s( ",subroutinename);
+      fprintf(fortranout,ligne);
+      /* Write the list of the local variables used in this new subroutine    */
+      WriteVariablelist_subloop(fortranout);
+      /* Write the list of the global tables used in this new subroutine      */
+      /*    in doloop                                                         */
+      WriteVariablelist_subloop_Call(fortranout);  
+      /* Close the parenthesis of the new subroutine called                   */
+      sprintf(ligne,")");
+      tofich(fortranout,ligne,1);  
+      /* We should close the original subroutine                              */
+      if ( !strcasecmp(subofagrifinitgrids,subroutinename) )
+      {
+/*         fprintf(fortranout,"      CALL Agrif_Deallocation\n");*/
+      }
+      if ( suborfun == 3 ) sprintf(ligne,"\n      end program %s"
+                                                               ,subroutinename);
+      if ( suborfun == 2 ) sprintf(ligne,"\n      end");
+      if ( suborfun == 1 ) sprintf(ligne,"\n      end subroutine %s"
+                                                               ,subroutinename);
+      if ( suborfun == 0 ) sprintf(ligne,"\n      end function %s"
+                                                               ,subroutinename);
+      tofich(fortranout,ligne,1);
+      /* we should include the above file in the original code                */
+      sprintf(ligne,"\n#include \"Sub_Loop_%s.h\" \n",subroutinename);
+      tofich(fortranout,ligne,1);
+      }
+   }
+}
Index: /trunk/AGRIF/LIB/UtilAgrif.c
===================================================================
--- /trunk/AGRIF/LIB/UtilAgrif.c	(revision 396)
+++ /trunk/AGRIF/LIB/UtilAgrif.c	(revision 396)
@@ -0,0 +1,761 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+/******************************************************************************/
+/*                      AGRIF_n_Vartonumber                                   */
+/******************************************************************************/
+/* This subroutine is used to know if Agrif_ is locate in the char            */
+/* tokname                                                                    */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int AGRIF_n_Vartonumber(char *tokname)
+{
+   int agrifintheword;
+   
+   agrifintheword = 0;
+        if ( !strcasecmp(tokname,"Agrif_parent")         ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_set_type")       ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_set_raf")        ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_set_bc")         ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_set_bcinterp")   ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_bc_variable")    ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_set_parent")     ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_interp_variable")) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_init_variable")  ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_update_variable")) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_Set_interp")     ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_Set_Update")     ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_Set_UpdateType") ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"Agrif_Set_restore")    ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"agrif_init_grids")     ) agrifintheword = 1;
+   else if ( !strcasecmp(tokname,"agrif_step")           ) agrifintheword = 1;
+
+   return agrifintheword;
+}
+
+/******************************************************************************/
+/*                      AGRIF_n_Agrif_in_Tok_NAME                             */
+/******************************************************************************/
+/* This subroutine is used to know if Agrif_ is locate in the char            */
+/* tokname                                                                    */
+/******************************************************************************/
+/*                                                                            */
+/*                 Agrif_name --------------> Agrif_in_Tok_NAME = 1           */
+/*                       name --------------> Agrif_in_Tok_NAME = 0           */
+/*                                                                            */
+/******************************************************************************/
+int AGRIF_n_Agrif_in_Tok_NAME(char *tokname)
+{
+   int agrifintheword;
+   
+   if ( strncasecmp(tokname,"Agrif_",6) == 0 )  agrifintheword = 1;
+   else agrifintheword = 0;
+
+   return agrifintheword;
+}
+
+
+/******************************************************************************/
+/*          AGRIF_1_completeListofvariableinagriffunction                     */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/* We should complete the Listofvariableinagriffunction                       */
+/******************************************************************************/
+/*                                                                            */
+/*               Agrif_Parent(variable) ====>         variable                */
+/*                                                        \                   */
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + list +--->+ list +--->+ list +--->+ list +--->+ NEW  +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*       list =  Listofvariableinagriffunction                                */
+/*                                                                            */
+/******************************************************************************/
+void AGRIF_1_completeListofvariableinagriffunction(char *ident)
+{
+   listnom *listnomtmp;
+   listnom *parcours;
+
+   if ( firstpass == 1 ) 
+   {
+      if ( Listofvariableinagriffunction )
+      {
+         parcours = Listofvariableinagriffunction;
+	 while ( parcours && strcasecmp(parcours->nom,ident) )
+	 {
+	    parcours = parcours->suiv;
+	 }
+	 if ( !parcours )
+	 {
+            listnomtmp=(listnom *)malloc(sizeof(listnom));
+            strcpy(listnomtmp->nom,ident);
+	    listnomtmp->suiv = NULL;	
+	    listnomtmp->suiv = Listofvariableinagriffunction;
+            Listofvariableinagriffunction = listnomtmp;
+	 }
+      }
+      else
+      {
+         listnomtmp=(listnom *)malloc(sizeof(listnom));
+         strcpy(listnomtmp->nom,ident);
+	 listnomtmp->suiv = NULL;
+	 Listofvariableinagriffunction = listnomtmp;
+      }
+   }
+}
+
+/******************************************************************************/
+/*                     AGRIF_0_ModifyTheVariableName                          */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/*               Agrif_<toto>(variable) ====>     Agrif_<toto>(variable)      */
+/*                                                                            */
+/******************************************************************************/
+void AGRIF_0_ModifyTheVariableName(char *ident)
+{
+   listvar *newvar;
+   int out;
+
+   if ( firstpass == 0 ) 
+   {
+      /* looking for the ident in the listvarindoloop                         */
+      if ( inagrifcallargument == 1 ) 
+      {
+         if ( fortran77 == 0 ) newvar = globalvarofusefile;
+         else newvar = globliste;
+      }
+      else newvar = globliste;
+      out=0;
+      while ( newvar && out == 0 ) 
+      {
+         if ( !strcasecmp(newvar->var->nomvar,ident) ) out = 1;
+         else newvar=newvar->suiv;      
+      }
+      if ( out == 1 ) 
+      {
+         /* remove the variable                                               */
+         RemoveWordCUR(fortranout,(long)(-strlen(ident)),
+                               strlen(ident));
+         fseek(fortranout,(long)(-strlen(ident)),SEEK_CUR);
+         /* then write the new name                                           */
+         if ( inagrifcallargument == 1 && agrif_parentcall == 0 )
+            fprintf(fortranout,"%d",newvar->var->indicetabvars);
+         else
+         {
+            fprintf(fortranout,"%s",vargridcurgridtabvars(newvar->var,0));
+            colnum = strlen(vargridcurgridtabvars(newvar->var,0));
+            if ( colnum >= 25 ) 
+            {
+              if ( fortran77 == 0 )
+              {
+                 fprintf(fortranout," & \n      ");
+              }
+              else
+              {
+                 fprintf(fortranout," \n     & ");                 
+              }
+            }
+         }
+      }
+      else
+      {
+         /* we should look in the globalvarofusefile                          */
+         if ( inagrifcallargument != 1 )
+         {
+            newvar = globalvarofusefile;
+            while ( newvar && out == 0 ) 
+            {
+               if ( !strcasecmp(newvar->var->nomvar,ident) ) out = 1;
+               else newvar=newvar->suiv;      
+            }
+            if ( out == 1 ) 
+            {
+               /* remove the variable                                         */
+               RemoveWordCUR(fortranout,(long)(-strlen(ident)),
+                                     strlen(ident));
+               fseek(fortranout,(long)(-strlen(ident)),SEEK_CUR);
+               /* then write the new name                                     */
+               if ( colnum >= 25 ) 
+               {
+                 if ( fortran77 == 0 )
+                 {
+                    fprintf(fortranout," & \n      ");
+                 }
+                 else
+                 {
+                    fprintf(fortranout," \n     & ");                 
+                 }
+               }
+               fprintf(fortranout,"%s",vargridcurgridtabvars(newvar->var,0));
+               colnum = strlen(vargridcurgridtabvars(newvar->var,0));
+            }
+         }
+      }
+   }
+}
+
+
+/******************************************************************************/
+/*             AGRIF_n_AddsubroutineTolistsubwhereagrifused                   */
+/******************************************************************************/
+/* This subroutine is used to add a record to                                 */
+/* listofsubroutinewhereagrifisused                                           */
+/******************************************************************************/
+/*                                                                            */
+/*       subroutine sub ... Agrif_<something>                                 */
+/*                                                                            */
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + list +--->+ list +--->+ list +--->+ list +--->+ sub  +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*       list = listofsubroutinewhereagrifisused                              */
+/*                                                                            */
+/******************************************************************************/
+void  AGRIF_n_AddsubroutineTolistsubwhereagrifused()
+{
+  listnom *listnomtmp;
+  listnom *parcours;
+
+  if ( !listofsubroutinewhereagrifisused )
+  {
+     listnomtmp=(listnom *)malloc(sizeof(listnom));
+     strcpy(listnomtmp->nom,subroutinename);
+     listnomtmp->suiv = NULL;	
+     listofsubroutinewhereagrifisused  =  listnomtmp;
+  }
+  else
+  {
+    parcours = listofsubroutinewhereagrifisused;
+    while ( parcours && strcasecmp(parcours->nom,subroutinename) )
+    {
+       parcours = parcours->suiv;
+    }
+    if ( !parcours )
+    {
+       listnomtmp=(listnom *)malloc(sizeof(listnom));
+       strcpy(listnomtmp->nom,subroutinename);
+       listnomtmp->suiv = listofsubroutinewhereagrifisused;	
+       listofsubroutinewhereagrifisused  =  listnomtmp;       
+    }
+  }
+}
+
+/******************************************************************************/
+/*                          AGRIF_n_AddUseAgrifUtil                           */
+/******************************************************************************/
+/* Add use Agrif_Util at the beginning of the subroutine definition           */
+/* if it is necessary                                                         */
+/******************************************************************************/
+/*                                                                            */
+/*       subroutine sub            |  subroutine sub                          */
+/*                                 |  USE Agrif_Util                          */
+/*       implicit none             |  implicit none                           */
+/*       ...                       |  ...                                     */
+/*       ... Agrif_<something>     |  ... Agrif_<something>                   */
+/*       ...                       |  ...                                     */
+/*       end                       |  end                                     */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void  AGRIF_n_AddUseAgrifUtil()
+{
+  listnom *parcours;
+  listusemodule *newmodule;
+  int out;
+
+  parcours = listofsubroutinewhereagrifisused;
+  while ( parcours && strcasecmp(parcours->nom,subroutinename) )  
+  {
+     parcours = parcours -> suiv;
+  }
+  if ( parcours )
+  {
+     /* we should add the use agrif_util if it is necessary                   */
+     newmodule = listofmodulebysubroutine;
+     out=0;
+     while( newmodule && out == 0)
+     {
+        if ( !strcasecmp(newmodule->cursubroutine,subroutinename) ||
+             !strcasecmp(newmodule->cursubroutine," ")  )
+        {
+           if ( !strcasecmp(newmodule->charusemodule,"Agrif_Util") ) out = 1 ;
+        }
+        newmodule = newmodule ->suiv;
+     }
+     
+     if ( out == 0 && inmodulemeet == 0 ) 
+     {
+        fprintf(fortranout,"\n      USE Agrif_Util \n");
+        adduseagrifutil = 1 ;
+     }
+  }
+}
+
+
+/******************************************************************************/
+/*                         AGRIF_0_AgrifParentNotify                          */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/*               Agrif_<toto>(variable) ====>     Agrif_<toto>(variable)      */
+/*                                                                            */
+/******************************************************************************/
+void AGRIF_0_NotifyAgrifFunction(char *ident)
+{
+   if ( firstpass == 0 ) 
+   {
+      if ( !strcasecmp(ident,"Agrif_parent") ) 
+      {
+         InAgrifParentDef = 1;
+         pos_curagrifparent = setposcur()-12;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Get_Coarse_grid") ) 
+      {
+         InAgrifParentDef = 2;
+         pos_curagrifparent = setposcur()-21;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Rhox") ) 
+      {
+         InAgrifParentDef = 3;
+         pos_curagrifparent = setposcur()-10;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_Rhox") ) 
+      {
+         InAgrifParentDef = 4;
+         pos_curagrifparent = setposcur()-17;
+      }
+      else if ( !strcasecmp(ident,"Agrif_IRhox") ) 
+      {
+         InAgrifParentDef = 5;
+         pos_curagrifparent = setposcur()-11;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_IRhox") ) 
+      {
+         InAgrifParentDef = 6;
+         pos_curagrifparent = setposcur()-18;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Rhoy") ) 
+      {
+         InAgrifParentDef = 7;
+         pos_curagrifparent = setposcur()-10;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_Rhoy") ) 
+      {
+         InAgrifParentDef = 8;
+         pos_curagrifparent = setposcur()-17;
+      }
+      else if ( !strcasecmp(ident,"Agrif_IRhoy") ) 
+      {
+         InAgrifParentDef = 9;
+         pos_curagrifparent = setposcur()-11;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_IRhoy") ) 
+      {
+         InAgrifParentDef = 10;
+         pos_curagrifparent = setposcur()-18;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Rhoz") ) 
+      {
+         InAgrifParentDef = 11;
+         pos_curagrifparent = setposcur()-10;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_Rhoz") ) 
+      {
+         InAgrifParentDef = 12;
+         pos_curagrifparent = setposcur()-17;
+      }
+      else if ( !strcasecmp(ident,"Agrif_IRhoz") ) 
+      {
+         InAgrifParentDef = 13;
+         pos_curagrifparent = setposcur()-11;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_IRhoz") )
+      {
+         InAgrifParentDef = 14;
+         pos_curagrifparent = setposcur()-18;
+      }
+      else if ( !strcasecmp(ident,"Agrif_NearCommonBorderX") )
+      {
+         InAgrifParentDef = 15;
+         pos_curagrifparent = setposcur()-23;
+      }
+      else if ( !strcasecmp(ident,"Agrif_NearCommonBorderY") )
+      {
+         InAgrifParentDef = 16;
+         pos_curagrifparent = setposcur()-23;
+      }
+      else if ( !strcasecmp(ident,"Agrif_NearCommonBorderZ") )
+      {
+         InAgrifParentDef = 17;
+         pos_curagrifparent = setposcur()-23;
+      }
+      else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderX") )
+      {
+         InAgrifParentDef = 18;
+         pos_curagrifparent = setposcur()-26;
+      }
+      else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderY") )
+      {
+         InAgrifParentDef = 19;
+         pos_curagrifparent = setposcur()-26;
+      }
+      else if ( !strcasecmp(ident,"Agrif_DistantCommonBorderZ") )
+      {
+         InAgrifParentDef = 20;
+         pos_curagrifparent = setposcur()-26;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Get_parent_id") )
+      {
+         InAgrifParentDef = 21;
+         pos_curagrifparent = setposcur()-19;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Get_grid_id") )
+      {
+         InAgrifParentDef = 22;
+         pos_curagrifparent = setposcur()-17;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_Iz") )
+      {
+         InAgrifParentDef = 23;
+         pos_curagrifparent = setposcur()-15;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_Iy") )
+      {
+         InAgrifParentDef = 24;
+         pos_curagrifparent = setposcur()-15;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Parent_Ix") )
+      {
+         InAgrifParentDef = 25;
+         pos_curagrifparent = setposcur()-15;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Iz") )
+      {
+         InAgrifParentDef = 26;
+         pos_curagrifparent = setposcur()-8;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Iy") )
+      {
+         InAgrifParentDef = 27;
+         pos_curagrifparent = setposcur()-8;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Ix") )
+      {
+         InAgrifParentDef = 28;
+         pos_curagrifparent = setposcur()-8;
+      }
+      else if ( !strcasecmp(ident,"Agrif_Nb_Fine_Grids") )
+      {
+         InAgrifParentDef = 29;
+         pos_curagrifparent = setposcur()-19;
+      }
+      else if ( !strcasecmp(ident,"AGRIF_Nb_Step") )
+      {
+         InAgrifParentDef = 30;
+         pos_curagrifparent = setposcur()-13;
+      }
+   }
+}
+
+/******************************************************************************/
+/*                       AGRIF_0_ModifyTheAgrifFunction                       */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/*               Agrif_<toto>(variable) ====>     Agrif_<toto>(variable)      */
+/*                                                                            */
+/******************************************************************************/
+void AGRIF_0_ModifyTheAgrifFunction(char *ident)
+{
+   if ( InAgrifParentDef != 0 )
+          AGRIF_0_AgriffunctionModify(ident,InAgrifParentDef);
+   /*                                                                         */
+   InAgrifParentDef = 0;
+}
+
+
+/******************************************************************************/
+/*                         AGRIF_0_AgriffunctionModify                        */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/* if whichone = 1 Agrif_parent ===>                                          */
+/*                                                                            */
+/* if whichone = 2 Agrif_Get_coarse_grid ===>                                 */
+/*                                                                            */
+/* if whichone = 3 Agrif_Rhox ===>                                            */
+/*                                                                            */
+/* if whichone = 4 Agrif_Parent_Rhox ===>                                     */
+/*                                                                            */
+/* if whichone = 5 Agrif_IRhox ===>                                           */
+/*                                                                            */
+/* if whichone = 6 Agrif_Parent_IRhox ===>                                    */
+/*                                                                            */
+/* if whichone = 7 Agrif_Rhoy ===>                                            */
+/*                                                                            */
+/* if whichone = 8 Agrif_Parent_Rhoy ===>                                     */
+/*                                                                            */
+/* if whichone = 9 Agrif_IRhoy ===>                                           */
+/*                                                                            */
+/* if whichone = 10 Agrif_Parent_IRhoy ===>                                   */
+/*                                                                            */
+/* if whichone = 11 Agrif_Rhoz ===>                                           */
+/*                                                                            */
+/* if whichone = 12 Agrif_Parent_Rhoz ===>                                    */
+/*                                                                            */
+/* if whichone = 13 Agrif_IRhoz ===>                                          */
+/*                                                                            */
+/* if whichone = 14 Agrif_Parent_IRhoz ===>                                   */
+/*                                                                            */
+/* if whichone = 15 Agrif_NearCommonBorderX ===>                              */
+/*                                                                            */
+/* if whichone = 16 Agrif_NearCommonBorderX ===>                              */
+/*                                                                            */
+/* if whichone = 17 Agrif_NearCommonBorderX ===>                              */
+/*                                                                            */
+/* if whichone = 18 Agrif_DistantCommonBorderX ===>                           */
+/*                                                                            */
+/* if whichone = 19 Agrif_DistantCommonBorderY ===>                           */
+/*                                                                            */
+/* if whichone = 20 Agrif_DistantCommonBorderZ ===>                           */
+/*                                                                            */
+/* if whichone = 21 Agrif_Get_parent_id ===>                                  */
+/*                                                                            */
+/* if whichone = 22 Agrif_Get_grid_id ===>                                    */
+/*                                                                            */
+/* if whichone = 23 Agrif_Parent_Iz ===>                                      */
+/*                                                                            */
+/* if whichone = 24 Agrif_Parent_Iy ===>                                      */
+/*                                                                            */
+/* if whichone = 25 Agrif_Parent_Ix ===>                                      */
+/*                                                                            */
+/* if whichone = 26 Agrif_Iz ===>                                             */
+/*                                                                            */
+/* if whichone = 27 Agrif_Iy ===>                                             */
+/*                                                                            */
+/* if whichone = 28 Agrif_Ix ===>                                             */
+/*                                                                            */
+/* if whichone = 29 Agrif_Nb_Fine_Grids ===>                                  */
+/*                                                                            */
+/* if whichone = 30 AGRIF_Nb_Step ===>                                        */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void AGRIF_0_AgriffunctionModify(char *ident,int whichone)
+{
+   char toprint[LONGNOM];
+
+   if ( firstpass == 0 ) 
+   {
+      strcpy(toprint,"");
+      pos_end = setposcur();
+      fseek(fortranout,pos_curagrifparent,SEEK_SET);
+      if ( whichone == 1 || whichone == 2 ) 
+      {
+         /*                                                                   */
+         FindAndChangeNameToTabvars(ident,toprint,globliste,1);
+         if ( !strcasecmp(ident,toprint) )
+         {
+            if ( ! globalvarofusefile ) RecordUseModulesVariables();
+            /* la liste des use de cette subroutine                           */
+            strcpy(toprint,"");
+            FindAndChangeNameToTabvars(ident,
+                                          toprint,globalvarofusefile,whichone);
+         }
+      }
+      else if ( whichone == 3 ) /* Agrif_Rhox                                 */
+      {
+         sprintf(toprint,"REAL(Agrif_Curgrid %% spaceref(1))");
+      }
+      else if ( whichone == 4 ) /* Agrif_Parent_Rhox                          */
+      {
+         sprintf(toprint,"REAL(Agrif_Curgrid %% parent %% spaceref(1))");
+      }
+      else if ( whichone == 5 ) /* Agrif_Rhox                                 */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% spaceref(1)");
+      }
+      else if ( whichone == 6 ) /* Agrif_Parent_Rhox                          */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% parent %% spaceref(1)");
+      }
+      else if ( whichone == 7 ) /* Agrif_Rhoy                                 */
+      {
+         sprintf(toprint,"REAL(Agrif_Curgrid %% spaceref(2))");
+      }
+      else if ( whichone == 8 ) /* Agrif_Parent_Rhoy                          */
+      {
+         sprintf(toprint,"REAL(Agrif_Curgrid %% parent %% spaceref(2))");
+      }
+      else if ( whichone == 9 ) /* Agrif_Rhoy                                 */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% spaceref(2)");
+      }
+      else if ( whichone == 10 ) /* Agrif_Parent_Rhoy                         */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% parent %% spaceref(2)");
+      }
+      else if ( whichone == 11 ) /* Agrif_Rhoz                                */
+      {
+         sprintf(toprint,"REAL(Agrif_Curgrid %% spaceref(3))");
+      }
+      else if ( whichone == 12 ) /* Agrif_Parent_Rhoz                         */
+      {
+         sprintf(toprint,"REAL(Agrif_Curgrid %% parent %% spaceref(3))");
+      }
+      else if ( whichone == 13 ) /* Agrif_Rhoz                                */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% spaceref(3)");
+      }
+      else if ( whichone == 14 ) /* Agrif_Parent_Rhoz                         */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% parent %% spaceref(3)");
+      }
+      else if ( whichone == 15 ) /* Agrif_NearCommonBorderX                   */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% NearRootBorder(1)");
+      }
+      else if ( whichone == 16 ) /* Agrif_NearCommonBorderY                   */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% NearRootBorder(2)");
+      }
+      else if ( whichone == 17 ) /* Agrif_NearCommonBorderZ                   */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% NearRootBorder(3)");
+      }
+      else if ( whichone == 18 ) /* Agrif_NearCommonBorderX                   */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% DistantRootBorder(1)");
+      }
+      else if ( whichone == 19 ) /* Agrif_NearCommonBorderY                   */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% DistantRootBorder(2)");
+      }
+      else if ( whichone == 20 ) /* Agrif_NearCommonBorderZ                   */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% DistantRootBorder(3)");
+      }
+      else if ( whichone == 21 ) /* Agrif_Get_parent_id                       */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% parent %% grid_id");
+      }
+      else if ( whichone == 22 ) /*  Agrif_Get_grid_id                        */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% grid_id");
+      }
+      else if ( whichone == 23 ) /*  Agrif_Parent_Iz                          */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% parent %% ix(3)");
+      }
+      else if ( whichone == 24 ) /*  Agrif_Parent_Iy                          */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% parent %% ix(2)");
+      }
+      else if ( whichone == 25 ) /*  Agrif_Parent_Ix                          */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% parent %% ix(1)");
+      }
+      else if ( whichone == 26 ) /* Agrif_Iz                                  */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% ix(3)");
+      }
+      else if ( whichone == 27 ) /* Agrif_Iy                                  */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% ix(2)");
+      }
+      else if ( whichone == 28 ) /* Agrif_Ix                                  */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% ix(1)");
+      }
+      else if ( whichone == 29 ) /* Agrif_Nb_Fine_Grids                       */
+      {
+         sprintf(toprint,"Agrif_nbfixedgrids");
+      }
+      else if ( whichone == 30 ) /* AGRIF_Nb_Step                             */
+      {
+         sprintf(toprint,"Agrif_Curgrid %% ngridstep");
+      }
+      if ( whichone == 1 || whichone == 2 ) 
+      {
+         tofich(fortranout,toprint,0);
+      }
+      else
+      {
+         if( fortran77 == 0 ) fprintf(fortranout," & \n");
+         else fprintf(fortranout,"\n     & ");
+         fprintf(fortranout,"%s",toprint);
+      }
+   }
+}
+
+
+
+/******************************************************************************/
+/*                          AGRIF_0_AddUseAgrifInModuleDeclaration            */
+/******************************************************************************/
+/* Add use Agrif_Util at the beginning of the subroutine definition           */
+/* if it is necessary                                                         */
+/******************************************************************************/
+/*                                                                            */
+/*       subroutine sub            |  subroutine sub                          */
+/*                                 |  USE Agrif_Util                          */
+/*       implicit none             |  implicit none                           */
+/*       ...                       |  ...                                     */
+/*       ... Agrif_<something>     |  ... Agrif_<something>                   */
+/*       ...                       |  ...                                     */
+/*       end                       |  end                                     */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void  AGRIF_0_AddUseAgrifInModuleDeclaration()
+{
+  listusemodule *newmodule;
+  int out;
+
+   if ( firstpass == 0 ) 
+   {
+      out = 1 ;
+      /* We should see if agrif_tabvars is the only                           */
+      /*    necessary tools in the agrif librairy                             */
+      newmodule = listofmodulebysubroutine;
+      while( newmodule && out == 1 && !listofsubroutinewhereagrifisused )
+      {
+         if ( !strcasecmp(newmodule->cursubroutine,subroutinename) ||
+              !strcasecmp(newmodule->cursubroutine," ")  )
+         {
+            if ( !strcasecmp(newmodule->charusemodule,"Agrif_Util") ) out = 0 ;
+         }
+         newmodule = newmodule ->suiv;
+      }
+
+      if ( out == 0 || listofsubroutinewhereagrifisused ) 
+                               fprintf(fortranout,"\n       USE Agrif_Util \n");
+      else fprintf(fortranout,
+                           "\n       USE Agrif_types\n");
+
+   }
+}
Index: /trunk/AGRIF/LIB/UtilCharacter.c
===================================================================
--- /trunk/AGRIF/LIB/UtilCharacter.c	(revision 396)
+++ /trunk/AGRIF/LIB/UtilCharacter.c	(revision 396)
@@ -0,0 +1,322 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+
+
+
+/******************************************************************************/
+/*                         FindAndChangeNameToTabvars                         */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+/* if  whichone = 0 ----> Agrif_tabvars(i) % var % array2                     */
+/*                                                                            */
+/* if  whichone = 1 ----> Agrif_tabvars(i) % parentvar % var % array2         */
+/*                                                                            */
+/******************************************************************************/
+void FindAndChangeNameToTabvars(char name[LONGNOM],char toprint[LONGNOM],
+                                listvar * listtosee, int whichone)
+{
+   listvar *newvar;
+   int out;
+   
+   if ( strcasecmp(name,"") )
+   {
+      newvar=listtosee;
+      out=0;
+      while( newvar && out == 0 )
+      {
+         if ( !strcasecmp(newvar->var->nomvar,name) )
+         {
+            out = 1;
+            strcat(toprint,vargridcurgridtabvars(newvar->var,whichone));
+         }
+         else newvar=newvar->suiv;
+      }
+      if ( out == 0 ) strcat(toprint,name);
+   }
+}
+
+
+/******************************************************************************/
+/*                     ChangeTheInitalvaluebyTabvarsName                      */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread, int whichone)
+{
+   char toprinttmp[LONGNOM];
+   int i;
+   char chartmp[2];
+   
+   i=0;
+   strcpy(toprintglob,"");
+   strcpy(toprinttmp,"");
+   /*                                                                         */
+   while ( i < strlen(nom) )
+   {
+      if ( nom[i] == '+' ) 
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,"+");
+      }
+      else if ( nom[i] == '-' ) 
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,"-");
+      }
+      else if ( nom[i] == '*' )
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,"*");
+      }
+      else if ( nom[i] == '/' )
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,"/");
+      }
+      else if ( nom[i] == '(' )
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,"(");
+      }
+      else if ( nom[i] == ')' )
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,")");
+      }
+      else if ( nom[i] == ':' )
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,":");
+      }
+      else if ( nom[i] == ',' )
+      {
+         FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+         strcpy(toprinttmp,"");
+         strcat(toprintglob,",");
+      }
+      else
+      {
+         sprintf(chartmp,"%c",nom[i]);        
+         strcat(toprinttmp,chartmp);
+      }
+      /*                                                                      */
+      i=i+1;
+   }
+   FindAndChangeNameToTabvars(toprinttmp,toprintglob,listtoread,whichone);
+   strcpy(toprinttmp,"");
+   
+   /*                                                                         */
+   return toprintglob;
+}
+
+
+void IsVarInUseFile(char *nom)
+{
+   listvar *parcours;
+   listparameter *parcoursparam;
+   int out;
+
+   out = 0;
+
+   parcours = globliste;
+   while( parcours && out == 0 )
+   {
+      if ( !strcasecmp(nom,parcours->var->nomvar) ) out =1 ;
+     else parcours=parcours->suiv;
+   }
+   if ( out == 0 )
+   {
+      parcours = globparam;
+      while( parcours && out == 0 )
+      {
+         if ( !strcasecmp(nom,parcours->var->nomvar) ) out =1 ;
+        else parcours=parcours->suiv;
+      }
+   }
+   if ( out == 0 )
+   {
+      parcours = parameterlist;
+      while( parcours && out == 0 )
+      {
+         if ( !strcasecmp(nom,parcours->var->nomvar) ) out =1 ;
+        else parcours=parcours->suiv;
+      }
+   }
+   if ( out == 0 )
+   {
+      parcoursparam = tmpparameterlocallist;
+      while( parcoursparam && out == 0 )
+      {
+         if ( !strcasecmp(nom,parcoursparam->name) ) out =2 ;
+         else parcoursparam=parcoursparam->suiv;
+      }
+   }
+   if ( out == 0 )
+   {
+      parcours = globalvarofusefile;
+      while( parcours && out == 0 )
+      {
+         if ( !strcasecmp(nom,parcours->var->nomvar) ) out =2 ;
+        else parcours=parcours->suiv;
+      }
+   }
+   if ( out == 0 || out == 2 )
+   {
+      parcoursparam = tmpparameterlocallist2;
+      while( parcoursparam && out != 1 )
+      {
+         if ( !strcasecmp(nom,parcoursparam->name) ) out =1 ;
+         else parcoursparam=parcoursparam->suiv;
+      }
+      if ( out == 1 ) 
+      {
+         strcpy(charusemodule,parcoursparam->modulename);
+         Addmoduletothelist(parcoursparam->modulename);
+      }
+   }
+   if ( out == 0 ) printf("--- in UtilCharacter we do not found the \n");
+   if ( out == 0 ) printf("---  variable %s, the module where this \n",nom);
+   if ( out == 0 ) printf("---  variable has been defined has not been\n");
+   if ( out == 0 ) printf("---  found.\n");
+}
+
+/******************************************************************************/
+/*                      DecomposeTheNameinlistnom                             */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+listnom *DecomposeTheNameinlistnom(char *nom, listnom * listout)
+{
+   char toprinttmp[LONGNOM];
+   int i;
+   char chartmp[2];
+   
+   i=0;
+   strcpy(toprinttmp,"");
+   /*                                                                         */
+   while ( i < strlen(nom) )
+   {
+      if ( nom[i] == '+' ||
+           nom[i] == '-' ||
+           nom[i] == '*' ||
+           nom[i] == '/' ||
+           nom[i] == ')' ||
+           nom[i] == '(' ||
+           nom[i] == ',' ||
+           nom[i] == ':' 
+         ) 
+      {
+         if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) )
+         { 
+             listout = Addtolistnom(toprinttmp,listout);
+             
+         }
+         strcpy(toprinttmp,"");
+      }
+      else
+      {
+         sprintf(chartmp,"%c",nom[i]);        
+         strcat(toprinttmp,chartmp);
+      }
+      /*                                                                      */
+      i=i+1;
+   }
+   if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 
+   { 
+      listout = Addtolistnom(toprinttmp,listout);
+   }
+   strcpy(toprinttmp,"");
+ 
+   return listout;   
+}
+
+
+/******************************************************************************/
+/*                      DecomposeTheName                                      */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/*               Agrif_<toto>(variable) ====>     Agrif_<toto>(variable)      */
+/*                                                                            */
+/******************************************************************************/
+void DecomposeTheName(char *nom)
+{
+   char toprinttmp[LONGNOM];
+   int i;
+   char chartmp[2];
+   
+   i=0;
+   strcpy(toprinttmp,"");
+   /*                                                                         */
+   while ( i < strlen(nom) )
+   {
+      if ( nom[i] == '+' ||
+           nom[i] == '-' ||
+           nom[i] == '*' ||
+           nom[i] == '/' ||
+           nom[i] == ')' ||
+           nom[i] == '(' ||
+           nom[i] == ',' ||
+           nom[i] == ':' 
+         ) 
+      {
+         if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) )
+         { 
+            ajoutevarindoloop_definedimension (toprinttmp);
+            /* Is this variable present in globvarofusefile                   */
+            IsVarInUseFile(toprinttmp);
+         }
+         strcpy(toprinttmp,"");
+      }
+      else
+      {
+         sprintf(chartmp,"%c",nom[i]);        
+         strcat(toprinttmp,chartmp);
+      }
+      /*                                                                      */
+      i=i+1;
+   }
+   if (strcasecmp(toprinttmp,"") && ( toprinttmp[0] >= 'A' ) ) 
+   { 
+      ajoutevarindoloop_definedimension (toprinttmp);
+      /* Is this variable present in globvarofusefile                         */
+      IsVarInUseFile(toprinttmp);
+   }
+   strcpy(toprinttmp,"");
+   
+}
Index: /trunk/AGRIF/LIB/UtilFile.c
===================================================================
--- /trunk/AGRIF/LIB/UtilFile.c	(revision 396)
+++ /trunk/AGRIF/LIB/UtilFile.c	(revision 396)
@@ -0,0 +1,132 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+
+/******************************************************************************/
+/*                            associate                                       */
+/******************************************************************************/
+/* This subroutine is used to open a file                                     */
+/******************************************************************************/
+FILE * associate (char *filename)
+{
+  char filefich[LONGNOM];
+  sprintf(filefich,"%s/%s",nomdir,filename);
+  return fopen (filefich, "w");
+}
+
+
+/******************************************************************************/
+/*                          associateaplus                                    */
+/******************************************************************************/
+/* This subroutine is used to open a file with option a+                      */
+/******************************************************************************/
+FILE * associateaplus (char *filename)
+{
+  char filefich[LONGNOM];
+  sprintf(filefich,"%s/%s",nomdir,filename);
+  return fopen (filefich, "a+");
+}
+
+
+/******************************************************************************/
+/*                           setposcur                                        */
+/******************************************************************************/
+/* This subroutine is used to know the current position in the file           */
+/******************************************************************************/
+/*                                                                            */
+/*                      setposcur ---------> position in file                 */
+/*                                                                            */
+/******************************************************************************/
+long int setposcur()
+{
+   fflush(fortranout);
+   return ftell(fortranout);
+}
+
+/******************************************************************************/
+/*                      setposcurinoldfortranout                              */
+/******************************************************************************/
+/* This subroutine is used to know the position in the oldfortranout         */
+/******************************************************************************/
+/*                                                                            */
+/*             setposcurinoldfortranout ---------> position in file           */
+/*                                                                            */
+/******************************************************************************/
+long int setposcurinoldfortranout()
+{
+   fflush(oldfortranout);
+   return ftell(oldfortranout);
+}
+
+/******************************************************************************/
+/*                       decl_0_modifdeclarationssave                         */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should modify this declaration in the file fortranout. case SAVE        */
+/******************************************************************************/
+void decl_0_modifdeclarationssave(listvar *listtomodify)
+{
+   if ( VariableIsParameter == 0 && SaveDeclare == 1) 
+   {
+      if (firstpass == 0)
+      {
+         pos_end = setposcur();
+         RemoveWordSET(fortranout,pos_cur,
+                               pos_end-pos_cur);
+      }
+   }      
+}
+
+/******************************************************************************/
+/*                    OPTI_0_copyuse                                          */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should write in the fortranout the USE tok_name                         */
+/* read in the original file                                                  */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_0_copyuse(char *namemodule)
+{
+   if (firstpass == 0 && OPTI_0_IsTabvarsUseInArgument() == 1 )
+   {
+      /* We should write this declaration into the original subroutine too    */
+      fprintf(oldfortranout,"      USE %s \n",namemodule);
+   }
+}
+
+/******************************************************************************/
+/*                    OPTI_0_copyuseonly                                      */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should write in the fortranout the USE tok_name, only                   */
+/* read in the original file                                                  */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_0_copyuseonly(char *namemodule)
+{
+   if (firstpass == 0 && OPTI_0_IsTabvarsUseInArgument() == 1 )
+   {
+      /* We should write this declaration into the original subroutine too    */
+      fprintf(oldfortranout,"      USE %s , ONLY : \n",namemodule);
+   }
+}
Index: /trunk/AGRIF/LIB/UtilFortran.c
===================================================================
--- /trunk/AGRIF/LIB/UtilFortran.c	(revision 396)
+++ /trunk/AGRIF/LIB/UtilFortran.c	(revision 396)
@@ -0,0 +1,282 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                            initdimprob                                     */
+/******************************************************************************/
+/* This subroutine is used to initialized grid dimension variable             */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void initdimprob(int dimprobmod, char * nx, char * ny,char* nz)
+{
+  dimprob = dimprobmod;
+
+  strcpy(nbmaillesX,nx);
+  strcpy(nbmaillesY,ny);
+  strcpy(nbmaillesZ,nz);
+}
+
+/******************************************************************************/
+/*                      Variableshouldberemove                                */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/*               Agrif_<toto>(variable) ====>     Agrif_<toto>(variable)      */
+/*                                                                            */
+/******************************************************************************/
+int Variableshouldberemove(char *nom)
+{
+
+   int remove;
+   
+   remove = 0 ; 
+   
+   if ( remove == 0 && !strcasecmp(nom,"RESHAPE") ) remove = 1 ;  
+   if ( remove == 0 && AGRIF_n_Agrif_in_Tok_NAME(nom) == 1 ) remove = 1 ;  
+
+   return remove;   
+}
+
+/******************************************************************************/
+/*                          variableisglobal                                  */
+/******************************************************************************/
+/* This subroutine is to know if a variable is global                         */
+/******************************************************************************/
+int variableisglobal(listvar *curvar, listvar *listin)
+{
+  int Globalite;
+  listvar *newvar;
+
+
+  Globalite = 0;
+  newvar = listin;
+  while ( newvar && Globalite == 0 )
+  {
+     if ( !strcasecmp(newvar->var->nomvar,curvar->var->nomvar) )
+     {
+        Globalite = 1;
+        /* Now we should give the definition of the variable in the           */
+        /* table listvarindoloop                                              */
+        strcpy(curvar->var->typevar,newvar->var->typevar);
+        strcpy(curvar->var->dimchar,newvar->var->dimchar);
+        curvar->var->nbdim = newvar->var->nbdim;
+        curvar->var->dimensiongiven = newvar->var->dimensiongiven;
+        curvar->var->typegiven = newvar->var->typegiven;
+        curvar->var->allocatable = newvar->var->allocatable;
+        curvar->var->pointerdeclare = newvar->var->pointerdeclare;
+        curvar->var->indicetabvars = newvar->var->indicetabvars;
+        strcpy(curvar->var->precision,newvar->var->precision);
+        strcpy(curvar->var->readedlistdimension,
+                                              newvar->var->readedlistdimension);
+     }
+     else
+     {
+         newvar = newvar->suiv;
+     }
+  }
+
+  return Globalite ;
+}
+
+/******************************************************************************/
+/*                     variableisparameterglobal                              */
+/******************************************************************************/
+/* This subroutine is to know if a variable is global                         */
+/******************************************************************************/
+int variableisparameterglobal(listvar *curvar, listparameter *listin)
+{
+  int Globalite;
+  listparameter *newvar;
+
+  Globalite = 0;
+  newvar = listin;
+  while ( newvar && Globalite == 0 )
+  {
+     if ( !strcasecmp(newvar->name,curvar->var->nomvar) ) Globalite = 1;
+     else newvar = newvar->suiv;
+  }
+
+  return Globalite ;
+}
+
+
+/******************************************************************************/
+/*                 addi_1_addsubroutine_inst_back_alloc                       */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should add subroutine of instanciation, back instaciation and           */
+/* allocation                                                                 */
+/* if moduleorcontains = 1 we are at the end module keyword                   */
+/* if moduleorcontains = 0 we are at the contains   keyword                   */
+/******************************************************************************/
+void addi_0_addsubroutine_inst_back_alloc(int moduleorcontains)
+{
+   char ligne[LONGNOM];
+   int Allocisempty;
+   listvar *newvar;
+   
+
+   if ( firstpass == 0)
+   {
+     /* It is necessary to know if this subroutine is not empty               */
+     Allocisempty = 0;
+     newvar = globliste;
+     while ( newvar && Allocisempty == 0 )
+     {
+        if ( !strcasecmp(newvar->var->modulename,curmodulename)) Allocisempty=1;
+        else newvar = newvar->suiv;
+     }
+     if ( Allocisempty == 1 )
+     {
+         while ( newvar &&
+                 !strcasecmp(newvar->var->modulename,curmodulename) &&
+                 Allocisempty == 1 )
+         {
+            if ( (newvar->var->nbdim !=0          &&
+                  newvar->var->allocatable != 1 ) ||
+                 (newvar->var->nbdim == 0         &&
+                  strcmp(newvar->var->initialvalue,"")) ) Allocisempty = 0;
+            else newvar = newvar->suiv;
+         }
+     }
+     if ( Allocisempty == 0 )
+     {
+      if ( MOD_n_InstanceInModule() == 1)
+      {
+         /* we should remove end module <name>                                */
+         if ( moduleorcontains == 1 )
+         {
+            RemoveWordCUR(fortranout,(long)(-strlen(curmodulename)-12),
+                                          strlen(curmodulename)+11);
+         }
+         /* we should remove contains                                         */
+         if ( moduleorcontains == 0 )
+         {
+            RemoveWordCUR(fortranout,(long)(-8),8);
+         }
+         strcpy (ligne, "\n      PUBLIC Alloc_agrif_");
+         strcat (ligne, curmodulename);
+         strcat (ligne, "\n");
+         fprintf(fortranout,ligne);
+      }
+      if (MOD_n_InstanceInModule() == 1)
+      {      
+         fprintf(fortranout,"\n      contains\n"); 
+         strcpy (ligne, "\n#include \"alloc_agrif_");
+         strcat (ligne, curmodulename);
+         strcat (ligne, ".h\"\n");
+         fprintf(fortranout,ligne);
+         /* On reecrit la mot cle end module qui a ete efface du fichier      */
+         /*    d'origine                                                      */
+         if ( moduleorcontains == 1 ) fprintf(fortranout,"\n      end module %s"
+                                                                ,curmodulename);
+      }
+     }
+   }
+}
+
+
+/******************************************************************************/
+/*                          OPTI_0_IsTabvarsUseInArgument                     */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int OPTI_0_IsTabvarsUseInArgument()
+{
+   int out;
+   int doloopout;
+   listvar *parcours;   
+
+   out=1;
+  
+   if ( listvarindoloop )
+   {
+      doloopout = 0;
+      parcours = listvarindoloop;
+      while ( parcours && doloopout == 0 )   
+      {
+         if ( !strcasecmp(parcours->var->modulename,subroutinename) ) 
+                                                                  doloopout = 1;
+         else parcours = parcours->suiv;
+      }
+      if (  doloopout == 0 ) out = 0;
+      else out = 1 ;
+   }
+   else out = 0;
+
+   return out;
+}
+
+
+/******************************************************************************/
+/*                        ImplicitNoneInSubroutine                            */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int ImplicitNoneInSubroutine()
+{
+  listname *parcours;
+  int out;
+
+  parcours= listimplicitnone;
+  out = 0 ;
+  while ( parcours && out == 0 )
+  {
+     if ( !strcasecmp(parcours->name,subroutinename) ) out = 1;
+     else parcours = parcours->suiv;
+  
+  }
+  return out;
+}
+
+/******************************************************************************/
+/*                          OPTI_0_varispointer                               */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int OPTI_0_varispointer(char *ident)
+{
+   listvar *newvar;
+   int out;
+
+   out =0;
+   if (firstpass == 0 )
+   {
+      newvar = globalvarofusefile;
+      while ( newvar && out == 0 )
+      {
+         if ( !strcmp(ident,newvar->var->nomvar) && 
+              newvar->var->pointerdeclare == 1 )  out = 1;
+         else newvar = newvar->suiv;
+      }
+   }
+   return out;
+}
Index: /trunk/AGRIF/LIB/UtilListe.c
===================================================================
--- /trunk/AGRIF/LIB/UtilListe.c	(revision 396)
+++ /trunk/AGRIF/LIB/UtilListe.c	(revision 396)
@@ -0,0 +1,445 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+
+/******************************************************************************/
+/*                            AddListvartolistvar                             */
+/******************************************************************************/
+/* This subroutine is used to add a listvar l at the end of a listvar         */
+/* glob.                                                                      */
+/*                                                                            */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + glob +--->+ glob +--->+ glob +--->+ glob +--->+  l   +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+listvar * AddListvarToListvar(listvar *l,listvar *glob,int ValueFirstpass)
+{
+   listvar *newvar;
+
+   if ( firstpass == ValueFirstpass )
+   {
+      if ( !glob) glob = l ;
+      else
+      {
+         newvar=glob;
+         while (newvar->suiv) newvar = newvar->suiv;
+         newvar->suiv = l;
+      }
+   }
+   return glob;
+}
+
+/******************************************************************************/
+/*                       CreateAndFillin_Curvar                               */
+/******************************************************************************/
+/* This subroutine is used to create the record corresponding to the          */
+/* list of declaration                                                        */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void CreateAndFillin_Curvar(char *type,char *tokname,
+                            listdim *dims,variable *curvar)
+{
+   if (!strcasecmp(type,"character") && CharacterSizeGiven == 1 )    
+                            strcpy(curvar->dimchar,CharacterSize);
+
+  /* On donne la precision de la variable si elle a ete donnee                */
+  curvar->c_star = 0;
+  if ( c_star == 1 ) curvar->c_star = 1;
+  /*                                                                          */
+  if ( lengspecgiven == 1 ) strcpy(curvar->vallengspec,vallengspec);
+  curvar->lengspecgiven=0;
+  if ( lengspecgiven == 1 ) curvar->lengspecgiven=1;
+
+  if ( PrecisionGiven == 1 )  strcpy(curvar->precision,NamePrecision);
+  /* Si cette variable a ete declaree dans un module on met curvar->module=1  */
+  if ( inmoduledeclare == 1 || SaveDeclare == 1)
+  {
+      curvar->module = 1;
+      /* Puis on donne le nom du module dans curvar->modulename               */
+      strcpy(curvar->modulename,curmodulename);
+   }
+   else if (insubroutinedeclare == 1 )
+   /* we give the name of the subroutine to the modulename                    */
+   {
+      strcpy(curvar->modulename,subroutinename);
+   }
+   /* Si cette variable a ete initialisee                                     */
+   if (InitialValueGiven == 1 ) strcpy(curvar->initialvalue,InitValue); 
+   /* Si cette variable est declaree en save                                  */
+   if (SaveDeclare == 1 ) curvar->save = 1;
+   /* Si cette variable est allocatable                                       */
+   if (Allocatabledeclare == 1 ) curvar->allocatable=1;
+   /* if INTENT spec has been given                                           */
+   if ( IntentDeclare == 1 ) strcpy(curvar->IntentSpec,IntentSpec);
+}
+
+
+/******************************************************************************/
+/*                        duplicatelistvar                                    */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+listvar * duplicatelistvar(listvar * orig)
+{
+   listvar *newlist;
+   listvar *parcours;
+   listvar *tmplistvar;
+   listvar *tmplistvarprec;
+   listdim *tmplistdim;
+   variable *tmpvar;
+
+   tmplistvarprec = (listvar *)NULL;
+   newlist = (listvar *)NULL;
+   parcours = orig;
+   while ( parcours )
+   {
+      tmplistvar = (listvar *)malloc(sizeof(listvar));
+      tmpvar = (variable *)malloc(sizeof(variable));
+      /*                                                                      */
+      strcpy(tmpvar->typevar,parcours->var->typevar);      
+      strcpy(tmpvar->nomvar,parcours->var->nomvar);      
+      strcpy(tmpvar->oldname,parcours->var->oldname);      
+      strcpy(tmpvar->dimchar,parcours->var->dimchar);      
+      if ( parcours->var->dimension )
+      {
+         tmplistdim = (listdim *)malloc(sizeof(listdim));
+         tmplistdim = parcours->var->dimension;
+         tmpvar->dimension = tmplistdim;
+      }
+      tmpvar->nbdim=parcours->var->nbdim;
+      tmpvar->common=parcours->var->common;
+      tmpvar->positioninblock=parcours->var->positioninblock;
+      tmpvar->module=parcours->var->module;
+      tmpvar->save=parcours->var->save;
+      tmpvar->VariableIsParameter=parcours->var->VariableIsParameter;
+      strcpy(tmpvar->modulename,parcours->var->modulename);      
+      strcpy(tmpvar->commonname,parcours->var->commonname);      
+      strcpy(tmpvar->vallengspec,parcours->var->vallengspec);
+      strcpy(tmpvar->nameinttypename,parcours->var->nameinttypename);
+      tmpvar->lengspecgiven=parcours->var->lengspecgiven;
+      tmpvar->pointedvar=parcours->var->pointedvar;
+      strcpy(tmpvar->commoninfile,parcours->var->commoninfile);      
+      strcpy(tmpvar->subroutinename,parcours->var->subroutinename);      
+      tmpvar->dimensiongiven=parcours->var->dimensiongiven;
+      tmpvar->c_star=parcours->var->c_star;
+      tmpvar->typegiven=parcours->var->typegiven;
+      tmpvar->isparameter=parcours->var->isparameter;
+      strcpy(tmpvar->precision,parcours->var->precision);
+      strcpy(tmpvar->initialvalue,parcours->var->initialvalue);
+      tmpvar->pointerdeclare=parcours->var->pointerdeclare;
+      tmpvar->optionaldeclare=parcours->var->optionaldeclare;
+      tmpvar->allocatable=parcours->var->allocatable;
+      strcpy(tmpvar->IntentSpec,parcours->var->IntentSpec);
+      tmpvar->dimsempty=parcours->var->dimsempty;
+      strcpy(tmpvar->readedlistdimension,parcours->var->readedlistdimension);
+      /*                                                                      */
+      tmplistvar->var = tmpvar;
+      tmplistvar->suiv = NULL;
+      /*                                                                      */
+      if ( !newlist )
+      {
+         newlist = tmplistvar;
+         tmplistvarprec = newlist;
+      }
+      else
+      {
+         tmplistvarprec->suiv = tmplistvar;
+         tmplistvarprec = tmplistvar;
+      }
+      /*                                                                      */
+      parcours = parcours->suiv;
+   }
+   return newlist;
+}
+
+/******************************************************************************/
+/*                           insertdim                                        */
+/******************************************************************************/
+/* This subroutine is used to insert a record in a list of                    */
+/* struct : listdim                                                           */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ lin  +--->+ lin  +--->+ lin  +--->+  lin +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+listdim * insertdim(listdim *lin,typedim nom)
+{
+   listdim *newdim ;
+
+   newdim=(listdim *) malloc (sizeof (listdim));
+   newdim->dim=nom;
+   newdim->suiv=lin;
+   
+   return newdim;
+}
+
+/******************************************************************************/
+/*                           reverse                                          */
+/******************************************************************************/
+/* This subroutine is used to reverse a list                                  */
+/******************************************************************************/
+/*        _______     _______                 _______     _______             */
+/*       +      +    +      +                +      +    +      +             */
+/*       +  A   +--->+   B  +--------------->+  B   +--->+   A  +             */
+/*       +______+    +______+                +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+listdim *reverse(listdim *lin)
+{
+   listdim *newdim1;
+   listdim *newdim2;
+   listdim *lout;
+
+   lout=(listdim *) NULL;
+
+   newdim1=lin;
+   while (newdim1)
+   {
+      newdim2=(listdim *) malloc(sizeof(listdim));
+      newdim2->dim=newdim1->dim;
+      newdim2->suiv=lout;
+      lout=newdim2;
+      newdim1=newdim1->suiv;
+   }
+   return lout;
+}
+
+/******************************************************************************/
+/*                            change_dim_char                                 */
+/******************************************************************************/
+/* This subroutine is used to change the dimension in the list lin            */
+/******************************************************************************/
+/*        _______     _______                 _______     _______             */
+/*       +  l   +    +  l   +                +  l   +    +   l  +             */
+/*       + old  +--->+ old  +--------------->+ lin  +--->+  lin +             */
+/*       +______+    +______+                +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+void change_dim_char(listdim *lin,listvar * l)
+{
+   listvar *parcours_var;
+   variable *v;
+  
+   
+   parcours_var=l;
+   while(parcours_var)
+   { 
+      v=parcours_var->var;
+      strcpy(v->dimchar,(lin->dim).last);
+      parcours_var=parcours_var->suiv;
+   }
+}
+
+
+/******************************************************************************/
+/*                                num_dims                                    */
+/******************************************************************************/
+/* This subroutine is used to know the dimension of a table                   */
+/******************************************************************************/
+/*                                                                            */
+/*             Dimension(jpi,jpj,jpk) ----------> num_dims = 3                */
+/*                                                                            */
+/******************************************************************************/
+int num_dims(listdim *d)
+{
+   listdim *parcours;
+   int compteur = 0;
+
+   parcours = d;
+   while(parcours)
+   {
+     compteur++;
+     parcours=parcours->suiv;
+   }
+   return compteur;  
+}
+
+
+/******************************************************************************/
+/*                          CREATEVAR                                         */
+/******************************************************************************/
+/* This subroutine is used to create and initialized a record of the          */
+/*      struct : variable                                                     */
+/******************************************************************************/
+variable * createvar(char *nom,listdim *d)
+{
+  variable *var;
+  listdim *dims;
+  char ligne[LONGNOM];
+  char listdimension[LONGNOM];
+
+   var=(variable *) malloc(sizeof(variable));
+   strcpy(var->nomvar,nom);
+   /* Definition of the number of this variable in the table tabvars          */
+   var->indicetabvars = 0;
+   if ( firstpass == 1 && ( aftercontainsdeclare == 0 || 
+                            SaveDeclare == 1          ||
+                            fortran77 == 1 ) 
+      )
+   {
+      indicemaxtabvars = indicemaxtabvars + 1;
+      var->indicetabvars = indicemaxtabvars;
+   }
+   /*                                                                         */
+   var->pointerdeclare=0;
+   var->dimsempty=0;
+   var->optionaldeclare=0;
+   var->dimensiongiven=0;
+   var->isparameter=0;
+   var->positioninblock=0;
+   var->VariableIsParameter = 0;
+   var->PublicDeclare = 0;
+   var->PrivateDeclare = 0;
+   var->ExternalDeclare = 0;
+   var->common=0;
+   var->allocatable=0;
+   var->module=0; 
+   var->typegiven=0;
+   var->save=0;
+   /*                                                                         */
+   strcpy(var->nameinttypename,"");
+   strcpy(listdimension,"");
+   strcpy(var->modulename,"");
+   strcpy(var->commonname,"");
+   strcpy(var->commoninfile,mainfile);
+   strcpy(var->subroutinename,subroutinename);
+   strcpy(var->dimchar,"");
+   strcpy(var->oldname,"");
+   strcpy(var->precision,""); 
+   strcpy(var->initialvalue,""); 
+   strcpy(var->IntentSpec,""); 
+   /*                                                                         */
+   if ( inttypename         == 1 ) strcpy(var->nameinttypename,nameinttypename);
+   if ( optionaldeclare     == 1 ) var->optionaldeclare = 1;
+   if ( pointerdeclare      == 1 ) var->pointerdeclare = 1;
+   if ( VariableIsParameter == 1 ) var->isparameter = 1;
+   if ( VariableIsParameter == 1 ) var->VariableIsParameter = 1 ;
+   if ( PublicDeclare       == 1 ) var->PublicDeclare = 1 ;
+   if ( PrivateDeclare      == 1 ) var->PrivateDeclare = 1;
+   if ( ExternalDeclare     == 1 ) var->ExternalDeclare = 1; 
+   /*                                                                         */
+   var->dimension=d;
+   /* Creation of the string for the dimension of this variable               */
+   dimsempty = 1;
+   if ( d )
+   {
+      var->dimensiongiven=1;
+      dims = d;
+      while (dims)
+      {
+         if ( strcasecmp(dims->dim.first,"") || strcasecmp(dims->dim.last,""))
+                                                                  dimsempty = 0;
+         sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
+         strcat(listdimension,ligne);
+         if ( dims->suiv )
+         {
+            strcat(listdimension,",");	     
+         }
+         dims = dims->suiv;
+      }
+      if ( dimsempty == 1 ) var->dimsempty=1;
+   }
+   strcpy(var->readedlistdimension,listdimension);
+   /*                                                                         */
+   var->nbdim=num_dims(d);
+   /*                                                                         */
+   return var;
+}
+
+/******************************************************************************/
+/*                            INSERTVAR                                       */
+/******************************************************************************/
+/* This subroutine is used to insert a record in a list of the                */
+/*      struct : listvar                                                      */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       +  lin +--->+  lin +--->+ lin  +--->+ lin  +--->+ NEW  +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+listvar * insertvar(listvar *lin,variable *v)
+{
+   listvar *newvar ;
+   listvar *tmpvar ;
+
+   newvar=(listvar *) malloc (sizeof (listvar));
+   newvar->var=v;
+   newvar->suiv = NULL;
+   if (!lin)
+   {
+      newvar->suiv=NULL;
+      lin = newvar;
+   }
+   else
+   {
+      tmpvar = lin ;
+      while (tmpvar->suiv)
+      {
+         tmpvar = tmpvar ->suiv ;
+      }
+      tmpvar -> suiv = newvar;   
+   }
+   return lin;
+}
+
+/******************************************************************************/
+/*                             SETTYPE                                        */
+/******************************************************************************/
+/* This subroutine is used to give the same variable type at each             */
+/*      record of the list of the struct : listvar                            */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       + REAL +    + REAL +    + REAL +    + REAL +    + REAL +             */
+/*       +  lin +--->+  lin +--->+ lin  +--->+ lin  +--->+ lin  +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+listvar *settype(char *nom,listvar *lin)
+{
+   listvar *newvar;
+   variable *v;
+
+   newvar=lin;
+   while (newvar)
+   {
+      v=newvar->var;
+      strcpy(v->typevar,nom);
+      v->typegiven=1;
+      newvar=newvar->suiv;
+   }
+   newvar=lin;
+   return newvar ;
+}
+
Index: /trunk/AGRIF/LIB/UtilNotGridDep.c
===================================================================
--- /trunk/AGRIF/LIB/UtilNotGridDep.c	(revision 396)
+++ /trunk/AGRIF/LIB/UtilNotGridDep.c	(revision 396)
@@ -0,0 +1,190 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                        ajoutenotgriddep                                    */
+/******************************************************************************/
+/* This subroutine is used to add a record into listenotgriddepend            */
+/*    This variable is add only if it is not present in the list              */
+/*    This variable is add at the end of the list                             */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       + not  +    + not  +    +  not +    +  not +    +      +             */
+/*       + grid +--->+ grid +--->+ grid +--->+ grid +--->+ NEW  +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+void ajoutenotgriddep (char *name)
+{
+   /*                                                                         */
+   variabletempo =(variable *)NULL;
+   listvartempo=(listvar *)NULL;
+   /* create the record                                                       */
+   variabletempo=createvar(name,NULL);
+   /* look in the listenotgriddepend if this variable exist                   */
+   listvartempo = listenotgriddepend;
+   while (listvartempo)
+   {
+     if (!strcasecmp(listvartempo->var->nomvar,name))
+     {
+        /* if this variable exist -> exit of the program                      */
+        printf(" The variable %s\n",name);
+        printf(" has been declared twice \n");
+        printf(" as a non grid dependent variable \n");
+        exit(1);
+     }
+      listvartempo= listvartempo->suiv;
+   }
+   /* if variable does not exist, we add it                                   */
+   listvartempo = insertvar(listenotgriddepend,variabletempo);
+   listenotgriddepend = listvartempo;
+}
+
+/******************************************************************************/
+/*                           RemoveNotgriddependFromGlobliste                 */
+/******************************************************************************/
+/* This subroutine is used to remove from the globliste all variables         */
+/* which are not grid dependent                                               */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + glob +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                          not grid                          */
+/*                                            remove                          */
+/*                                                                            */
+/******************************************************************************/
+void RemoveNotgriddependFromGlobliste()
+{
+   listvar  *newvarglobliste;
+   listvar  *newvargloblistePrec;
+   listvar  *newvarnotgriddepend;
+   listvar  *newvarnotgriddependPrec;
+   int      Out;
+   int      Out1;
+   
+   if ( listenotgriddepend )
+   {
+      newvargloblistePrec = (listvar *)NULL;
+      newvarnotgriddependPrec = (listvar *)NULL;
+      /* Read of the globliste                                                */
+      newvarglobliste = globliste;
+      Out1 = 1 ;
+      while ( newvarglobliste && Out1 == 1 )
+      {
+         newvarnotgriddepend = listenotgriddepend;
+	 Out = 1 ;
+         /* Read of the notgriddepend                                         */
+	 while ( newvarnotgriddepend && Out == 1 )
+	 {
+            /* If the variable is in the notgriddepend list                   */
+	    if ( ! strcasecmp(newvarglobliste->var->nomvar,
+                                             newvarnotgriddepend->var->nomvar) )
+	    {
+               /* We should go out of the loop so Out = 0                     */
+               Out = 0 ;
+	       /* We remove the variable from the globliste                   */
+	       /* If we are at the beginning of the globliste                 */
+               if ( newvarglobliste == globliste )
+               {
+                  globliste = globliste->suiv;		     
+               }
+               else
+               {
+                  newvargloblistePrec->suiv = newvarglobliste->suiv;
+                  newvarglobliste = newvargloblistePrec;
+               }
+               /* We remove the variable from the notgriddepend list          */
+              if ( newvarnotgriddepend == listenotgriddepend )
+              {
+                 listenotgriddepend = listenotgriddepend->suiv;		     
+              }
+              else
+              {
+                 newvarnotgriddependPrec->suiv = newvarnotgriddepend->suiv;
+                 newvarnotgriddepend = newvarnotgriddependPrec;
+               }
+	    }
+            /* If the variable is not in the notgriddepend list               */
+	    else
+	    {
+	       newvarnotgriddependPrec = newvarnotgriddepend;
+	       newvarnotgriddepend = newvarnotgriddepend->suiv;
+	    }
+	 }
+	 /* If the notgriddepend list is empty we go out of this subroutine   */
+	 if ( !listenotgriddepend )
+	 {
+	    Out1 = 0;
+	 }
+	 newvargloblistePrec = newvarglobliste;
+	 newvarglobliste = newvarglobliste->suiv;
+      }
+   }
+}
+
+/******************************************************************************/
+/*                      VarIsNonGridDepend                                    */
+/******************************************************************************/
+/* This subroutine is used to know if a variable has been declared as non     */
+/* grid dependent                                                             */
+/******************************************************************************/
+/*                                                                            */
+/*  notgriddepend variable;    ----------->  VarIsNonGridDepend = 1           */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+int VarIsNonGridDepend(char *name)
+{
+   listvar *newvar;
+   int out;
+
+   newvar = listenotgriddepend;
+   out=0;
+   while (newvar && out == 0 )
+   {
+      if ( !strcasecmp(newvar->var->nomvar,name) ) out = 1;
+      else newvar = newvar->suiv;
+   }
+   return out;
+}
+
+
+/******************************************************************************/
+/*                       DECL_0_NonGridDepDeclaration                         */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/* We should modify this declaration in the file fortranout                   */
+/******************************************************************************/
+void DECL_0_NonGridDepDeclaration(listvar *listtomodify)
+{
+   if ( (aftercontainsdeclare == 0 && VariableIsParameter == 0) )
+   {
+      if (firstpass == 0)
+      {
+         pos_end = setposcur();
+         RemoveWordSET(fortranout,pos_cur,
+                               pos_end-pos_cur);
+         /* Modifications of declarations */
+         NonGridDepDeclaration(listtomodify);
+      }
+   }
+}
Index: /trunk/AGRIF/LIB/WorkWithAllocatelist.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithAllocatelist.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithAllocatelist.c	(revision 396)
@@ -0,0 +1,179 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+
+/******************************************************************************/
+/*                       OPTI_1_AddIdentToTheAllocateList                     */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_1_AddIdentToTheAllocateList(char *nom)
+{
+   listallocate *newvar;
+   listallocate *parcours;
+   int out;
+
+   if ( firstpass == 1 ) 
+   {
+      if ( !AllocateList )
+      {
+         newvar = (listallocate *)malloc(sizeof(listallocate));
+         strcpy(newvar->nomvar,nom);
+         strcpy(newvar->subroutine,subroutinename);
+         strcpy(newvar->module,curmodulename);
+         newvar->suiv = NULL;
+         AllocateList = newvar;
+      }
+      else
+      {
+         parcours = AllocateList;
+         out = 0 ; 
+         while ( parcours->suiv && out == 0 )
+         {
+            if (  !strcasecmp(parcours->nomvar,nom) &&
+                  !strcasecmp(parcours->subroutine,subroutinename) &&
+                  !strcasecmp(parcours->module,curmodulename) ) out = 1;
+            else
+               parcours=parcours->suiv;               
+         }
+         if ( out == 0 ) 
+         {
+            if (  !strcasecmp(parcours->nomvar,nom) &&
+                  !strcasecmp(parcours->subroutine,subroutinename) &&
+                  !strcasecmp(parcours->module,curmodulename) ) out = 1;
+            else
+            {
+               /* add the record                                              */
+              newvar = (listallocate *)malloc(sizeof(listallocate));
+              strcpy(newvar->nomvar,nom);
+              strcpy(newvar->subroutine,subroutinename);
+              strcpy(newvar->module,curmodulename);
+              newvar->suiv = NULL;
+              parcours->suiv = newvar;
+            }
+         }
+      }
+   }
+}
+
+/******************************************************************************/
+/*                       OPTI_0_IsAllocateInThisSubroutine                    */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int OPTI_0_IsAllocateInThisSubroutine()
+{
+   listallocate *parcours;
+   int out;
+
+   out = 0 ; 
+   if ( firstpass == 0 ) 
+   {
+      parcours = AllocateList;
+      while ( parcours && out == 0 )
+      {
+         if ( !strcasecmp(parcours->subroutine,subroutinename)  )
+         {
+            out = 1 ;
+         }
+         else parcours=parcours->suiv;               
+      }
+   }
+   return out;
+}
+
+/******************************************************************************/
+/*                       OPTI_0_IsVarAllocatable                              */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int OPTI_0_IsVarAllocatable(char *ident)
+{
+   listallocate *parcours;
+   int out;
+
+   out = 0 ; 
+   if ( firstpass == 0 ) 
+   {
+      parcours = AllocateList;
+      while ( parcours && out == 0 )
+      {
+         if ( !strcasecmp(parcours->nomvar,ident)  ) out = 1 ;
+         else parcours=parcours->suiv;               
+      }
+   }
+   return out;
+}
+
+
+/******************************************************************************/
+/*                     OPTI_0_varisallocatable                                */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int OPTI_0_varisallocatable(char *ident)
+{
+   listvar *newvar;
+   listallocate *newvaralloc;
+   int out;
+
+   out =0;
+   if (firstpass == 0 )
+   {
+      newvar = globalvarofusefile;
+      while ( newvar && out == 0 )
+      {
+         if ( !strcmp(ident,newvar->var->nomvar) && 
+              newvar->var->allocatable == 1 )  out = 1;
+         else newvar = newvar->suiv;
+      }
+      if ( out == 0 )
+      {
+         newvar = globliste;
+         while ( newvar && out == 0 )
+         {
+            if ( !strcmp(ident,newvar->var->nomvar) && 
+                 newvar->var->allocatable == 1 )  out = 1;
+            else newvar = newvar->suiv;
+         }      
+      }
+      if ( out == 0 )
+      {
+         newvaralloc = AllocateList;
+         while ( newvar && out == 0 )
+         {
+            if ( !strcasecmp(ident,newvaralloc->nomvar) && 
+                 !strcasecmp(newvaralloc->subroutine,subroutinename)
+               )  out = 1;
+            else newvaralloc = newvaralloc->suiv;
+         }      
+      }
+   }
+   return out;
+}
Index: /trunk/AGRIF/LIB/WorkWithParameterlist.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithParameterlist.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithParameterlist.c	(revision 396)
@@ -0,0 +1,128 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                       COM_1_AddvartoParamlist                              */
+/******************************************************************************/
+/*  This subroutines is used to add the variable defined in common in the     */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void COM_1_AddvartoParamlist(listvar *listin)
+{
+   listvar *parcours;
+   
+   if ( firstpass == 1 )
+   {
+      if ( !parameterlist )
+      {
+         parameterlist = listin;
+      }
+      else
+      {
+         parcours = parameterlist;
+         while (parcours->suiv) parcours=parcours->suiv;
+      
+         parcours->suiv = listin;
+      }
+   }
+}
+
+/******************************************************************************/
+/*                   COM_1_UpdateparameterlistWithlistvarindoloop             */
+/******************************************************************************/
+/*  This subroutines is used to add the variable defined in common in the     */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void COM_1_UpdateparameterlistWithlistvarindoloop()
+{
+   listvar *parcours;
+   listvar *parcours2;
+   listvar *parcours3;
+   listvar *parcoursprec;
+   int out;
+   
+   parcours = parameterlist;
+   while ( parcours )
+   {
+   if ( !strcasecmp(parcours->var->subroutinename,subroutinename) )
+   { 
+      /* We should look in the listvarindoloop if this variable is present    */
+      parcours2=listvarindoloop;
+      out=0;
+      while( parcours2 && out == 0 )
+      {
+         if ( !strcasecmp(parcours->var->nomvar,parcours2->var->nomvar) &&
+              !strcasecmp(parcours->var->subroutinename,
+                                            parcours2->var->modulename) 
+            )
+         {
+            parcours->var->VariableIsParameter = 1;
+            /* we should find in the globliste the type of this variable      */
+            parcours3 = globliste;
+            while ( parcours3 && out == 0 )
+            {
+               if ( !strcasecmp(parcours3->var->nomvar,parcours->var->nomvar) )
+               {
+                  out = 1 ;
+                  strcpy(parcours->var->typevar,parcours3->var->typevar);
+               }
+               else
+               {
+                  parcours3 = parcours3->suiv;
+               }
+            }            
+            out = 1 ;
+         }
+         else
+         {
+            parcours2 = parcours2->suiv;
+         }
+      }
+      if ( out == 0 )
+      {
+         /* we did not find it                                                */
+         /* we should remove the variable from the globliste                  */
+         if ( parcours ==  parameterlist)
+         {
+            parameterlist = parameterlist->suiv;
+            parcours = parameterlist;
+         }
+         else
+         {
+            parcoursprec->suiv = parcours->suiv;
+            parcours = parcoursprec->suiv;
+         }
+      }
+      else
+      {
+         parcoursprec = parcours;
+         parcours = parcours->suiv;
+      }
+   }
+   else
+   {
+      parcoursprec = parcours;
+      parcours = parcours->suiv;
+   }
+   }
+}
Index: /trunk/AGRIF/LIB/WorkWithglobliste.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithglobliste.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithglobliste.c	(revision 396)
@@ -0,0 +1,402 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                     CompareNewparsingandoldone                             */
+/******************************************************************************/
+/* this subroutine is used to compare the old treatement with                 */
+/* the new one                                                                */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + glob +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*           =         not=         =                                         */
+/*        _______     _______     _______                                     */
+/*       +      +    +      +    +      +                                     */
+/*       + tmp  +--->+ tmp  +--->+ tmp  +                                     */
+/*       +______+    +______+    +______+                                     */
+/*                                                                            */
+/******************************************************************************/
+void CompareNewparsingandoldone()
+{
+   listvar *NewTreated;
+   listvar *OldTreated;
+   listvar *OldTreatedPrec;
+   int Out;
+   listindice *newindice;
+
+   OldTreatedPrec = (listvar *)NULL;
+   NewTreated = globliste;
+   while ( NewTreated )
+   {
+         /* we are going to compare the two treatement                        */
+         /* each time that we meet in the oldlist the same record we          */
+         /* remove it from the tmplocallist                                   */
+         OldTreated = tmplocallist;
+         Out = 0;
+         while ( OldTreated && Out == 0 )
+         { 
+            if ( !strcasecmp(NewTreated->var->nomvar, OldTreated->var->nomvar))
+            {
+               /* We should keep the same indice for tabvars table than       */
+               /* the old one                                                 */
+               NewTreated->var->indicetabvars = OldTreated->var->indicetabvars;
+               /* we remove it from the tmplocallist                          */
+               if ( OldTreated == tmplocallist ) 
+               {
+                  tmplocallist = tmplocallist -> suiv;
+               }
+               else
+               {
+                  OldTreatedPrec->suiv = OldTreated -> suiv;
+               }  
+               /* We go out of the loop because we find two variables         */
+               /* with the same name in the same file                         */
+               Out = 1;
+            }
+            else
+            {
+               OldTreatedPrec = OldTreated;
+               OldTreated = OldTreated -> suiv;
+            }
+      }
+      
+      if ( !OldTreated  && Out == 0) 
+      {
+         /* if this tmplocallist has been readed without finding the          */
+         /* variable of the globliste                                         */
+         /* it means that this variable has been added                        */
+         /* in this case we choose a new tabvars indice                       */
+	 /* for this variable                                                 */
+         if ( Listofavailableindices )
+         {
+            NewTreated->var->indicetabvars = Listofavailableindices -> indice;
+            Listofavailableindices = Listofavailableindices ->suiv;
+         }
+         else
+         {
+            indicemaxtabvars = indicemaxtabvars + 1;
+            NewTreated->var->indicetabvars = indicemaxtabvars;
+         }
+      }
+      /*  On passe a l'enregistrement suivant */
+      NewTreated = NewTreated -> suiv;
+   }
+   if ( tmplocallist )
+   {
+      /* if the tmplocallist is not empty it means that some variables        */
+      /* has been removed in the new version of the filetoparse               */
+      /* in this case we should record the indice of the tabvars              */
+      /* to know that this field is empty                                     */
+      while (tmplocallist)
+      {    
+         if ( tmplocallist -> var -> indicetabvars != 0 )
+         {
+            newindice=(listindice *) malloc (sizeof (listindice));
+            newindice -> indice = tmplocallist -> var -> indicetabvars;
+            newindice -> suiv = Listofavailableindices;
+            Listofavailableindices = newindice;
+         }
+         tmplocallist = tmplocallist -> suiv;
+      }
+   }
+}
+
+
+/******************************************************************************/
+/*                          decl_1_ajoutevar                                  */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/* We should add this declaration to the globliste                            */
+/******************************************************************************/
+void decl_1_ajoutevar(listvar *listtoadd)
+{
+   if ( firstpass == 1 && VariableIsParameter == 0 )
+   if ( aftercontainsdeclare == 0 || fortran77 == 1 )
+   {
+      globliste = AddListvarToListvar(listtoadd,globliste,1);
+   }
+}
+
+/******************************************************************************/
+/*                          decl_1_ajoutevarsave                              */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/* We should add this declaration to the globliste. case SAVE                 */
+/******************************************************************************/
+void decl_1_ajoutevarsave(listvar *listtoadd)
+{
+   if ( VariableIsParameter == 0 && SaveDeclare == 1 && firstpass == 1 )
+   {
+      globliste = AddListvarToListvar(listtoadd,globliste,1);
+   }      
+}
+
+/******************************************************************************/
+/*                       UpdateIndiceTabvarsofGlobliste                      */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void UpdateIndiceTabvarsofGlobliste()
+{
+
+   int indicetmp;
+   listvar *NewTreated;
+   listvar *OldTreated;
+   listvar *OldTreatedPrec;
+   int Out;
+   FILE *dependglobaloutput;
+   
+   
+   if ( Did_filetoparse_treated == 1 )
+   {
+
+   Recordtmplocallist(NameTamponfile);
+
+   if ((dependglobaloutput=fopen(".dependglobal","r"))!=NULL) 
+   {
+      fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars);
+      fclose(dependglobaloutput);
+      oldindicemaxtabvars = indicemaxtabvars;
+   }
+   /* Read the list of available indice                                       */
+   Readthedependavailablefile();
+   /*                                                                         */
+   indicetmp = indicemaxtabvars;
+   OldTreatedPrec = (listvar *)NULL;
+   NewTreated = globliste;
+   while ( NewTreated )
+   {
+         /* we are going to compare the two treatement                        */
+         /* each time that we meet in the oldlist the same record we          */
+         /* remove it from the tmplocallist                                   */
+         OldTreated = tmplocallist;
+         Out = 0;
+         while ( OldTreated && Out == 0 )
+         { 
+            if ( !strcasecmp(NewTreated->var->nomvar, OldTreated->var->nomvar))
+            {
+               /* We should keep the same indice for tabvars table than       */
+               /* the old one                                                 */
+               NewTreated->var->indicetabvars = OldTreated->var->indicetabvars;
+               /* we remove it from the tmplocallist                          */
+               if ( OldTreated == tmplocallist ) 
+               {
+                  tmplocallist = tmplocallist -> suiv;
+               }
+               else
+               {
+                  OldTreatedPrec->suiv = OldTreated -> suiv;
+               }  
+               /* We go out of the loop because we find two variables         */
+               /* with the same name in the same file                         */
+               Out = 1;
+            }
+            else
+            {
+               OldTreatedPrec = OldTreated;
+               OldTreated = OldTreated -> suiv;
+            }
+      }
+      
+      if ( !OldTreated  && Out == 0) 
+      {
+         /* if this tmplocallist has been readed without finding the          */
+         /* variable of the globliste                                         */
+         /* it means that this variable has been added                        */
+         /* in this case we choose a new tabvars indice                       */
+	 /* for this variable                                                 */
+         if ( Listofavailableindices )
+         {
+            NewTreated->var->indicetabvars = Listofavailableindices -> indice;
+            Listofavailableindices = Listofavailableindices ->suiv;
+         }
+         else
+         {
+            indicetmp = indicetmp + 1;
+            NewTreated->var->indicetabvars = indicetmp;
+         }
+      }
+      /*  On passe a l'enregistrement suivant */
+      NewTreated = NewTreated -> suiv;
+   }
+   tmplocallist = NULL;
+   
+   } /* end of Did_filetoparse_treated == 1                                   */
+}
+
+/******************************************************************************/
+/*                  UpdateIndiceTabvarsofGloblisteFromCommon                  */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void UpdateIndiceTabvarsofGloblisteFromCommon()
+{
+
+   listnom *parcours;
+   listvar *parcours2;
+   listvar *listtmp;
+   listvar *parcoursglob;
+   listvar *parcoursglob2;
+   int find;
+   int NumberofNewVar;
+   int NumberofVar;
+   
+   listtmp = ( listvar *)NULL ;
+   NumberofNewVar=0;
+   NumberofVar=0;
+   parcours = modulelist;
+   while( parcours )
+   {
+      listtmp = Recordglobalvarofusefile( parcours->nom  , listtmp);
+      parcours=parcours->suiv;
+   }
+   /*                                                                         */
+   parcoursglob = globliste;
+   /* if this common has been ever read, we should update the tabvars         */
+   /*    indices                                                              */
+   while ( parcoursglob )
+   {
+      NumberofVar = NumberofVar +1 ;
+      parcours2 = listtmp;
+      find = 0 ;
+      while ( parcours2 && find == 0 )
+      {
+         if ( !strcasecmp(parcoursglob->var->nomvar,parcours2->var->nomvar) &&
+              !strcasecmp(parcoursglob->var->commonname,
+                                                parcours2->var->commonname)
+            )
+         {
+            parcoursglob->var->indicetabvars = parcours2->var->indicetabvars;
+            strcpy(parcoursglob->var->commoninfile,
+                                               parcours2->var->commoninfile);
+               find = 1;
+         }
+         parcours2 = parcours2->suiv;
+      }
+      /* if we did not find it, it means that it is a new variable            */
+      /*    we should see if this variable has not been defined twice later   */
+      if ( find == 0 && (parcoursglob->var->indicetabvars > 
+           (oldindicemaxtabvars + NumberofNewVar)) )
+      {
+         NumberofNewVar = NumberofNewVar +1 ;
+         parcoursglob->var->indicetabvars = oldindicemaxtabvars 
+                                                               + NumberofNewVar;
+         parcoursglob2 = parcoursglob;
+         while ( parcoursglob2 )
+         {
+            if ( !strcasecmp(parcoursglob->var->nomvar,
+                                                parcoursglob2->var->nomvar) &&
+                 !strcasecmp(parcoursglob->var->commonname,
+                                            parcoursglob2->var->commonname)
+               )
+            {
+               parcoursglob2->var->indicetabvars = oldindicemaxtabvars 
+                                                               + NumberofNewVar;
+            }
+            parcoursglob2 = parcoursglob2->suiv;
+         }
+      }
+      /*                                                                      */
+      parcoursglob  = parcoursglob  ->suiv;
+   }
+   indicemaxtabvars = oldindicemaxtabvars + NumberofNewVar;
+}
+
+
+/******************************************************************************/
+/*                   COM_1_UpdateGloblisteWithcommonlist                      */
+/******************************************************************************/
+/*  This subroutines is used to add the variable defined in common in the     */
+/*     commonlist                                                             */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void COM_1_UpdateGloblisteWithcommonlist()
+{
+   listvarcommon *parcours;
+   listvar *parcoursindic;
+   listvar *parcoursvar;
+   listvar *parcoursvarprec;
+   int out;
+   
+   parcoursvar = globliste;
+   while ( parcoursvar )
+   {
+      /* We should look in the commonlist if this variable is present         */
+      parcours=commonlist;
+      out=0;
+      while( parcours && out == 0 )
+      {
+         if ( !strcasecmp(parcoursvar->var->nomvar,parcours->nomvar) &&
+              !strcasecmp(parcoursvar->var->subroutinename,
+                                           parcours->subroutinename) 
+            )
+         {
+            out = 1 ;
+            /* we should update the globliste                                 */
+            strcpy(parcoursvar->var->commonname,parcours->commonname);
+            parcoursvar->var->positioninblock = parcours->positioninblock;
+            parcoursvar->var->common = 1;
+         }
+         else
+         {
+            parcours = parcours->suiv;
+         }
+      }
+      if ( out == 0 )
+      {
+         /* We should update the tabvarsindic of the following variable       */
+         /*    present in the globliste                                       */
+         parcoursindic = parcoursvar;
+         indicemaxtabvars=indicemaxtabvars-1;
+         while(parcoursindic)
+         {
+            parcoursindic->var->indicetabvars =
+                                            parcoursindic->var->indicetabvars-1;
+            parcoursindic = parcoursindic->suiv;
+         }
+         /* we did not find it                                                */
+         /* we should remove the variable from the globliste                  */
+         if ( parcoursvar == globliste )
+         {
+            globliste = globliste->suiv;
+            parcoursvar = globliste;
+         }
+         else
+         {
+            parcoursvarprec->suiv = parcoursvar->suiv;
+            parcoursvar = parcoursvarprec->suiv;
+         }
+      }
+      else
+      {
+         parcoursvarprec = parcoursvar;
+         parcoursvar = parcoursvar->suiv;
+      }
+   }
+}
Index: /trunk/AGRIF/LIB/WorkWithlistdatavariable.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithlistdatavariable.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithlistdatavariable.c	(revision 396)
@@ -0,0 +1,122 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+/******************************************************************************/
+/*                          DATA_n_COMPLETEDATALIST                           */
+/******************************************************************************/
+/* This subroutine is used to add a record to listdatavariable                */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ data +--->+ data +--->+ data +--->+  data+             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+void DATA_n_CompleteDataList (char *name,char *values)
+{
+  listvar *newvar;
+  
+  newvar=(listvar *)malloc(sizeof(listvar));
+  newvar->var=(variable *)malloc(sizeof(variable));
+  strcpy(newvar->var->nomvar,name);  
+  strcpy(newvar->var->initialvalue,values); 
+  newvar->suiv = NULL; 
+
+  if ( !listdatavariable )
+  {
+     listdatavariable  = newvar ;
+  }
+  else
+  {
+     newvar->suiv = listdatavariable;
+     listdatavariable = newvar;
+  }
+}
+
+
+/******************************************************************************/
+/*                    DATA_1_COMPLETEGLOBLISTEWITHDATALIST                    */
+/******************************************************************************/
+/* This subroutine is used to complete the variable initialisation            */
+/* in the globliste with the listdatavariable                                 */
+/******************************************************************************/
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + data +--->+ data +--->+ data +--->+ data +--->+ data +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                  ||                                        */
+/*                                  ||                                        */
+/*                                  ||                                        */
+/*                                  ||                                        */
+/*                            initialvalue                                    */
+/*                                  ||                                        */
+/*                                  ||                                        */
+/*        _______     _______     __\/___     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + glob +--->+ glob +--->+ glob +--->+ glob +--->+ glob +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/******************************************************************************/
+void DATA_1_CompleteGlobListeWithDatalist ()
+{
+  listvar *newvar;
+  listvar *globlistetmp;
+  int out;
+  
+  /* We are looking for each variable of the listdatavariable where           */
+  /* are they located in the globliste                                        */
+  newvar = listdatavariable;
+  while ( newvar )
+  {
+     globlistetmp = globliste;
+     out = 0 ;
+     while( globlistetmp && out == 0 )
+     {
+        if ( !strcasecmp(newvar->var->nomvar,globlistetmp->var->nomvar) )
+	{
+           out = 1;
+	   if ( strcasecmp(globlistetmp->var->initialvalue,"") )
+	   {
+              printf("The variable %s has ever a initial value \n"
+                                                         , newvar->var->nomvar);
+              printf("Error in the CompleteGlobListeWithDatalist routine \n");
+              exit(0);	      
+	   }
+	   else
+	   {
+              strcpy(globlistetmp->var->initialvalue,newvar->var->initialvalue);
+	   }
+	}
+	else
+	{
+        globlistetmp = globlistetmp->suiv;
+	}
+     }
+     if ( !globlistetmp )
+     {
+        printf("The variable %s has not bee found in the globliste \n"
+                                                         , newvar->var->nomvar);
+        printf("Error in the CompleteGlobListeWithDatalist routine \n");
+	exit(0);
+     }
+     newvar = newvar->suiv;
+  }
+}
+
Index: /trunk/AGRIF/LIB/WorkWithlistmoduleinfile.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithlistmoduleinfile.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithlistmoduleinfile.c	(revision 396)
@@ -0,0 +1,160 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                   MOD_1_FillInlistmodule                                   */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void MOD_1_FillInlistmodule()
+{
+   listmodule *tmplist;
+   
+   
+   if (firstpass == 1) 
+   {   
+      tmplist = (listmodule *)malloc(sizeof(listmodule));
+      strcpy(tmplist->module,curmodulename);
+      tmplist->InstanceShouldMade = 0;
+      tmplist->Instance = 0;
+      /*         */
+      if ( !listmoduleinfile)
+      {
+         listmoduleinfile = tmplist;  
+         tmplist->suiv = NULL;
+      }
+      else
+      {
+         tmplist->suiv = listmoduleinfile;
+         listmoduleinfile = tmplist;      
+      }
+   }
+}
+
+
+/******************************************************************************/
+/*                MOD_1_InstanceShouldMadeTo0InModule                         */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void MOD_1_InstanceShouldMadeTo0InModule()
+{
+   listmodule *tmplist;
+   
+   
+   if (firstpass == 1 && listmoduleinfile ) 
+   {
+      tmplist=listmoduleinfile;
+      /* we should find the module in the listmoduleinfile                    */
+      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
+      /* and turn the flag to 0                                               */
+      tmplist->InstanceShouldMade = 0 ;
+   }
+}
+
+
+/******************************************************************************/
+/*                MOD_1_InstanceShouldMadeTo1InModule                         */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void MOD_1_InstanceShouldMadeTo1InModule()
+{
+   listmodule *tmplist;
+   
+   
+   if (firstpass == 1 && listmoduleinfile ) 
+   {
+      tmplist=listmoduleinfile;
+      /* we should find the module in the listmoduleinfile                    */
+      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
+      /* and turn the flag to 0                                               */
+      tmplist->InstanceShouldMade = 1 ;
+   }
+}
+
+/******************************************************************************/
+/*                     MOD_1_InstanceTo1InModule                              */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void MOD_1_InstanceTo1InModule()
+{
+   listmodule *tmplist;
+   
+   
+   if (firstpass == 1 && listmoduleinfile ) 
+   {
+      tmplist=listmoduleinfile;
+      /* we should find the module in the listmoduleinfile                    */
+      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
+      /* and turn the flag to 0                                               */
+      tmplist->Instance = 1 ;
+   }
+}
+
+/******************************************************************************/
+/*                     MOD_n_InstanceShouldMadeInModule                       */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int MOD_n_InstanceShouldMadeInModule()
+{
+   listmodule *tmplist;
+   
+   
+   if ( listmoduleinfile ) 
+   {
+      tmplist=listmoduleinfile;
+      /* we should find the module in the listmoduleinfile                    */
+      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
+      /* and turn the flag to 0                                               */
+      return tmplist->InstanceShouldMade;
+   }
+   else
+   {
+      return 0;
+   }
+}
+
+/******************************************************************************/
+/*                          MOD_n_InstanceInModule                            */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int MOD_n_InstanceInModule()
+{
+   listmodule *tmplist;
+   
+   
+   if ( listmoduleinfile ) 
+   {
+      tmplist=listmoduleinfile;
+      /* we should find the module in the listmoduleinfile                    */
+      while ( strcasecmp(tmplist->module,curmodulename) ) tmplist=tmplist->suiv;
+      /* and turn the flag to 0                                               */
+      return tmplist->Instance;
+   }
+   else
+   {
+      return 0;
+   }
+}
Index: /trunk/AGRIF/LIB/WorkWithlistofmodulebysubroutine.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithlistofmodulebysubroutine.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithlistofmodulebysubroutine.c	(revision 396)
@@ -0,0 +1,190 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "decl.h"
+
+
+
+/******************************************************************************/
+/*                    RecordUseModulesVariables                               */
+/******************************************************************************/
+/******************************************************************************/
+void RecordUseModulesVariables()
+{
+  listusemodule *tmplistmodule;
+
+  /* we should record all variables defined in modules used in this file      */
+  if ( listofmodulebysubroutine )
+  {
+     globalvarofusefile = (listvar *)NULL;
+     tmpparameterlocallist = (listparameter *)NULL;
+     listofvarofusemodulecreated = 1;
+     tmplistmodule = listofmodulebysubroutine;
+     while ( tmplistmodule )
+     {
+        if ( tmplistmodule->firstuse == 1 )
+        {
+           /* check if the file .depend<usemodule> exist                      */
+           globalvarofusefile = Recordglobalvarofusefile
+                                  (tmplistmodule->usemodule,globalvarofusefile);
+
+           tmpparameterlocallist = ReaddependParameterList
+                               (tmplistmodule->usemodule,tmpparameterlocallist);
+
+        }
+
+        tmplistmodule = tmplistmodule->suiv;
+     }
+  }
+}
+
+/******************************************************************************/
+/*                RecordUseModulesUseModulesVariables                         */
+/******************************************************************************/
+/******************************************************************************/
+void  RecordUseModulesUseModulesVariables()
+{
+  listusemodule *tmplistmodule;
+
+  /* we should record all variables defined in modules used in this file      */
+  if ( listofmodulebysubroutine )
+  {
+     /* and we should read the .depend of the module used by the module used  */
+     tmplistmodule = listofmodulebysubroutine;
+     while ( tmplistmodule )
+     {
+        Readthedependlistofmoduleused(tmplistmodule->usemodule);
+        while( tmpuselocallist )
+        {
+           Addmoduletothelisttmp(tmpuselocallist->usemodule);
+           tmpuselocallist = tmpuselocallist->suiv;
+        }
+        tmplistmodule = tmplistmodule->suiv;
+     }
+           
+     globalvarofusefile2 = (listvar *)NULL;
+     tmpparameterlocallist2 = (listparameter *)NULL;
+     tmplistmodule = listofmoduletmp;
+     while ( tmplistmodule )
+     {
+        /* check if the file .depend<usemodule> exist                         */
+        globalvarofusefile2 = Recordglobalvarofusefile
+                                 (tmplistmodule->usemodule,globalvarofusefile2);
+
+        tmpparameterlocallist2 = ReaddependParameterList
+                              (tmplistmodule->usemodule,tmpparameterlocallist2);
+        
+        tmplistmodule = tmplistmodule->suiv;
+     }
+  }
+}
+
+
+/******************************************************************************/
+/*                        Addmoduletothelist                                  */
+/******************************************************************************/
+/* This subroutine is used to add a record to a list of struct                */
+/* listusemodule                                                              */
+/******************************************************************************/
+/*                                                                            */
+/*       subroutine sub ... USE mod1 ===> insert in list                      */
+/*        _______     _______     _______     _______     _______             */
+/*       +      +    +      +    +      +    +      +    +      +             */
+/*       + NEW  +--->+ list +--->+ list +--->+ list +--->+ list +             */
+/*       +______+    +______+    +______+    +______+    +______+             */
+/*                                                                            */
+/*       list =  listofmodulebysubroutine                                     */
+/*                                                                            */
+/******************************************************************************/
+void Addmoduletothelist(char *name)
+{
+  listusemodule *newmodule;
+  listusemodule *parcours;
+  int out;
+
+  newmodule =(listusemodule *)malloc(sizeof(listusemodule));
+  strcpy(newmodule->usemodule,name);
+  strcpy(newmodule->charusemodule,charusemodule);
+  strcpy(newmodule->cursubroutine,subroutinename);  
+  newmodule->firstuse = 1 ;  
+  newmodule->suiv = NULL;
+
+  if ( !listofmodulebysubroutine)
+  {
+      listofmodulebysubroutine = newmodule ;
+  }
+  else
+  {
+    parcours = listofmodulebysubroutine;
+    while ( parcours && newmodule->firstuse == 1 )
+    {
+       if ( !strcasecmp(name,parcours->usemodule) ) 
+       {
+          newmodule->firstuse = 0 ;
+       }
+       parcours=parcours->suiv;
+    }
+    /* we can not add the same module twice for the same subroutine           */
+    parcours = listofmodulebysubroutine;
+    out = 0 ;
+    while ( parcours && out == 0 )
+    {
+       if ( !strcasecmp(name,parcours->usemodule) &&
+            !strcasecmp(subroutinename,parcours->cursubroutine)
+           )
+       {
+          out = 1 ;
+          free(newmodule);
+       }
+       else parcours=parcours->suiv;
+    }
+    if ( out == 0 )
+    {
+       newmodule->suiv = listofmodulebysubroutine;
+       listofmodulebysubroutine = newmodule;
+    }
+  }
+}
+
+
+/******************************************************************************/
+/*                        WriteUsemoduleDeclaration                           */
+/******************************************************************************/
+/* Firstpass 0                                                                */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void WriteUsemoduleDeclaration()
+{
+  listusemodule *newmodule;
+
+  newmodule = listofmodulebysubroutine;
+  fprintf(fortranout,"\n");
+  while ( newmodule )
+  {
+     if ( !strcasecmp(newmodule->cursubroutine,subroutinename) )
+     {
+        if ( strcasecmp(newmodule->charusemodule,"Agrif_Util") ||
+            adduseagrifutil != 1 ) fprintf(fortranout,"      USE %s \n"
+                                                     ,newmodule->charusemodule);
+     }
+        newmodule = newmodule ->suiv;  
+  }
+}
Index: /trunk/AGRIF/LIB/WorkWithlistvarindoloop.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithlistvarindoloop.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithlistvarindoloop.c	(revision 396)
@@ -0,0 +1,546 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "decl.h"
+
+/******************************************************************************/
+/*                    OPTI_1_cleanlistvarfordoloop                            */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/* We should clean all the list used for the do loop OPTImization             */
+/* if endsuborfunc = 1 we are at the end of the subroutine                    */
+/* if endsuborfunc = 0 we are at the end of the function                      */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void OPTI_1_cleanlistvarfordoloop(int endsuborfunc)
+{
+   listvar *tmplist;
+   
+   if ( firstpass == 1 ) 
+   {
+      if ( fortran77 == 1 ) UpdatevarofsubroutinelisteWithcommonlist();
+      if ( fortran77 == 1 ) COM_1_UpdateparameterlistWithlistvarindoloop();
+      if ( fortran77 == 1 ) COM_1_UpdateGloblisteWithcommonlist();
+      if ( endsuborfunc == 1 ) CompleteThelistvarindoloop();
+      if ( fortran77 == 0 ) UpdateIndiceTabvarsofGlobliste();
+      else UpdateIndiceTabvarsofGloblisteFromCommon();
+      CleanThelistvarindoloop();
+      CleanFromThelistvarindoloopTheAgrifSubArguments();
+      tmplist = (listvar *)NULL;
+      if ( fortran77 == 1 ) tmplist = duplicatelistvar(varofsubroutineliste);
+      if ( fortran77 == 1 ) varsubroutine = AddListvarToListvar
+                                                      (tmplist,varsubroutine,1);
+      CleanThelistvarofsubroutineliste();
+      if ( fortran77 == 1 ) COM_1_UpdatevarsubroutineWithvarofsubroutinelist();
+   }
+}
+
+/******************************************************************************/
+/*                    OPTI_1_ajoutevarindoloop                                */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/* We should complete the listvarindoloop                                     */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void OPTI_1_ajoutevarindoloop(char *ident)
+{
+   /* In the first pass we record all variables presents in the do loop       */
+   if (firstpass == 1 && insubroutinedeclare == 1 ) ajoutevarindoloop(ident);
+}
+
+/******************************************************************************/
+/*                        AJOUTEVARINDOLOOP                                   */
+/******************************************************************************/
+/* This subroutine is used to add a listvar to  listvarindoloop               */
+/******************************************************************************/
+void ajoutevarindoloop (char *name)
+{
+  listvar *newvar;
+  listvar *tmpvar;
+  int out;
+  
+  if ( !listvarindoloop )
+  {
+      newvar=(listvar *)malloc(sizeof(listvar));
+      newvar->var=(variable *)malloc(sizeof(variable));
+      newvar->suiv = NULL;
+      strcpy(newvar->var->oldname,"");
+      strcpy(newvar->var->nomvar,name);
+      strcpy(newvar->var->modulename,subroutinename);
+      newvar->var->pointedvar=pointedvar;
+      newvar->var->indicetabvars=0;
+      listvarindoloop = newvar ;
+  }
+  else
+  {
+      /* We should verify that this variable did not added                    */
+      tmpvar = listvarindoloop;
+      out = 0 ;
+      while (tmpvar && out == 0 )
+      {
+         if ( !strcasecmp(tmpvar->var->nomvar,name) && 
+              !strcasecmp(tmpvar->var->modulename,subroutinename)) out  = 1 ; 
+         else tmpvar = tmpvar->suiv;
+      }
+      if ( out == 0 ) 
+      {
+         newvar=(listvar *)malloc(sizeof(listvar));
+         newvar->var=(variable *)malloc(sizeof(variable));
+         strcpy(newvar->var->oldname,"");
+         strcpy(newvar->var->nomvar,name);
+         strcpy(newvar->var->modulename,subroutinename);
+         newvar->var->pointedvar=pointedvar;
+         newvar->var->indicetabvars=0;
+         newvar->suiv = listvarindoloop;
+         listvarindoloop = newvar;
+      }
+  }
+}
+
+/******************************************************************************/
+/*                        AJOUTEVARINDOLOOP_DEFINEDIMENSION                   */
+/******************************************************************************/
+/* This subroutine is used to add a listvar to  listvarindoloop               */
+/******************************************************************************/
+void ajoutevarindoloop_definedimension (char *name)
+{
+  listvar *newvar;
+  listvar *tmpvar;
+  listvar *tmpvarprec;
+  int out;
+  int tablemeet;
+  
+  if ( !listvarindoloop )
+  {
+      newvar=(listvar *)malloc(sizeof(listvar));
+      newvar->var=(variable *)malloc(sizeof(variable));
+      newvar->suiv = NULL;
+      strcpy(newvar->var->oldname,"");
+      strcpy(newvar->var->nomvar,name);
+      strcpy(newvar->var->modulename,subroutinename);
+      newvar->var->indicetabvars=0;
+      newvar->var->pointedvar=pointedvar;
+      listvarindoloop = newvar ;
+  }
+  else
+  {
+      /* We should verify that this variable did not added                    */
+      tmpvarprec = (listvar *)NULL;
+      tmpvar = listvarindoloop;
+      out = 0 ;
+      tablemeet = 0 ;
+      while (tmpvar && out == 0 )
+      {
+         if ( tablemeet == 0 && tmpvar->var->nbdim != 0 ) tablemeet = 1 ;
+         /*                                                                   */
+         if ( !strcasecmp(tmpvar->var->nomvar,name) && 
+              !strcasecmp(tmpvar->var->modulename,subroutinename)) 
+         {
+            out  = 1 ;
+            /* if this variable has been define before a table we doi nothing */
+            /*    else we should remove it                                    */
+            if ( tablemeet == 1 )
+            {
+               tmpvarprec->suiv = tmpvar -> suiv;
+               out = 2;
+            }
+         }
+         else 
+         {
+            tmpvarprec = tmpvar;
+            tmpvar = tmpvar->suiv;
+         }
+      }
+      if ( out == 2 || out == 0 ) 
+      {
+         newvar=(listvar *)malloc(sizeof(listvar));
+         newvar->var=(variable *)malloc(sizeof(variable));
+         strcpy(newvar->var->nomvar,name);
+         strcpy(newvar->var->oldname,"");
+         newvar->var->indicetabvars=0;
+         strcpy(newvar->var->modulename,subroutinename);
+         newvar->var->pointedvar=pointedvar;
+         /* we should find this new variable to know the tabvars indice       */
+         if ( variableisglobal(newvar, globliste) == 1 )
+         {
+            newvar->suiv = listvarindoloop;
+            listvarindoloop = newvar;
+         }
+         else if ( variableisglobal(newvar, globalvarofusefile) == 1 )
+         {
+            newvar->suiv = listvarindoloop;
+            listvarindoloop = newvar;
+         }
+         else
+         {
+            free(newvar);
+         }
+     }
+  }
+}
+
+/******************************************************************************/
+/*        CleanFromThelistvarindoloopTheAgrifSubArguments                     */
+/******************************************************************************/
+/* This subroutine is to remove from the listvarindoloop all variables        */
+/* which has been used in Agrif argument in order to avoid the                */
+/* optimization code on Agrif function or subroutines                         */
+/******************************************************************************/
+void  CleanFromThelistvarindoloopTheAgrifSubArguments()
+{
+   listnom *parcours;
+   listvar *parcoursvar;
+   listvar *parcoursvarprec;
+   
+   parcoursvarprec = (listvar *)NULL;
+   parcoursvar = listvarindoloop;
+   while ( parcoursvar )
+   {
+      if ( !strcasecmp(parcoursvar->var->modulename,subroutinename) )
+      {
+         parcours = Listofvariableinagriffunction;
+         while (parcours && strcasecmp(parcoursvar->var->nomvar,parcours->nom) )
+         {
+            parcours = parcours->suiv;
+         }
+         if ( parcours )
+         {
+            /* if we found the name in the listvarindoloop and                */
+            /* Listofvariableinagriffunction we should remove it from         */
+            /* listvarindoloop                                                */
+            if ( parcoursvar == listvarindoloop )
+            {
+               listvarindoloop = listvarindoloop -> suiv;
+               parcoursvar = listvarindoloop;
+            }
+            else
+            {
+               parcoursvarprec->suiv = parcoursvar->suiv;
+               parcoursvar = parcoursvar->suiv;
+            }
+         }
+         else
+         {
+            parcoursvarprec = parcoursvar;
+            parcoursvar = parcoursvar ->suiv;
+         }
+      }
+      else
+      {
+         parcoursvarprec = parcoursvar;
+         parcoursvar = parcoursvar ->suiv;
+      }
+   }
+   
+}
+
+
+/******************************************************************************/
+/*                      CleanThelistvarindoloop                               */
+/******************************************************************************/
+/* This subroutine is to remove from the listvarindoloop all variables        */
+/* which has not been declared as table in the globliste                      */
+/******************************************************************************/
+void CleanThelistvarindoloop ()
+{
+  listvar *newvar;
+  listvar *newvarPrec;
+  listvar *tmpglobvar;
+  listallocate *parcoursallocate;
+  listnamelist *newnamelist;
+  int not_remove;
+
+  RecordUseModulesVariables();
+  RecordUseModulesUseModulesVariables();
+  /*                                                                          */
+  not_remove = 0 ;
+  newvarPrec = (listvar *)NULL;
+  newvar = listvarindoloop;
+  while ( newvar )
+  {
+  if ( !strcasecmp(newvar->var->modulename,subroutinename))
+  {
+     not_remove = 0;
+     if ( Variableshouldberemove(newvar->var->nomvar) == 0 )
+     {
+/******************************************************************************/
+/*                      look in the globliste                                 */
+/******************************************************************************/
+/******************************************************************************/
+/*                      look in the varofsubroutineliste                      */
+/******************************************************************************/
+        tmpglobvar = varofsubroutineliste;
+        while ( tmpglobvar && not_remove == 0 )
+        {
+           if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) &&
+                !strcasecmp
+                   (tmpglobvar->var->modulename,newvar->var->modulename)
+              )
+               not_remove = 2;
+          else tmpglobvar = tmpglobvar->suiv;
+       }
+
+     if (not_remove == 0 ) tmpglobvar = globliste;
+     else tmpglobvar = (listvar *)NULL;
+
+     while ( tmpglobvar && not_remove == 0 )
+     {
+        if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) )
+        {
+           not_remove = 1;
+           /* Now we should give the definition of the variable in the        */
+           /*    table listvarindoloop                                        */
+           strcpy(newvar->var->typevar,tmpglobvar->var->typevar);
+           strcpy(newvar->var->dimchar,tmpglobvar->var->dimchar);
+           newvar->var->nbdim = tmpglobvar->var->nbdim;
+           newvar->var->dimensiongiven = tmpglobvar->var->dimensiongiven;
+           newvar->var->typegiven = tmpglobvar->var->typegiven;
+           newvar->var->allocatable = tmpglobvar->var->allocatable;
+           newvar->var->pointerdeclare = tmpglobvar->var->pointerdeclare;
+           newvar->var->indicetabvars = tmpglobvar->var->indicetabvars;
+           strcpy(newvar->var->precision,tmpglobvar->var->precision);
+           strcpy(newvar->var->readedlistdimension,
+                                          tmpglobvar->var->readedlistdimension);
+           DecomposeTheName(newvar->var->readedlistdimension);
+        }
+        else tmpglobvar = tmpglobvar->suiv;
+     }
+     
+/******************************************************************************/
+/*                      look in the globparam                                 */
+/******************************************************************************/
+     if ( not_remove == 0 )
+     {
+        tmpglobvar = globparam;
+        while ( tmpglobvar && not_remove == 0 )
+        {
+           if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) &&
+                !strcasecmp(tmpglobvar->var->subroutinename,
+                                                newvar->var->modulename) 
+               ) not_remove = 2;
+           else tmpglobvar = tmpglobvar->suiv;
+        }
+     }
+     
+     if ( not_remove == 0 )
+     {
+/******************************************************************************/
+/*                      look in the listenamelist                             */
+/******************************************************************************/
+        newnamelist = listenamelist;
+        while ( newnamelist && not_remove == 0 )
+        {
+           if ( !strcasecmp(newnamelist->name,newvar->var->nomvar)) not_remove = 2;
+           else newnamelist = newnamelist->suiv;
+        }
+     }
+
+     if ( not_remove == 0 )
+     {
+/******************************************************************************/
+/*                      look in the varofsubroutineliste                      */
+/******************************************************************************/
+        tmpglobvar = varofsubroutineliste;
+        while ( tmpglobvar && not_remove == 0 )
+        {
+           if ( !strcasecmp(tmpglobvar->var->nomvar,newvar->var->nomvar) &&
+                !strcasecmp(tmpglobvar->var->modulename,
+                                                newvar->var->modulename)
+              ) not_remove = 2;
+          else tmpglobvar = tmpglobvar->suiv;
+       }
+     }
+/******************************************************************************/
+/*            look in the .dependfile and .dependparameterfile                */
+/******************************************************************************/
+     if ( not_remove == 0 && not_remove == 0 )
+     {
+        /* la liste des use de cette subroutine                               */
+        not_remove = 0 ;
+
+        if ( variableisparameterglobal(newvar,tmpparameterlocallist) == 1 )
+        {
+           not_remove = 2 ;
+        }
+        else if ( variableisglobal(newvar,globalvarofusefile) == 1 )
+        {
+           not_remove = 1 ;
+           DecomposeTheName(newvar->var->readedlistdimension);
+        }
+
+/******************************************************************************/
+/*    look in the .dependfile and .dependparameterfile of USE modules         */
+/******************************************************************************/
+        if ( not_remove == 0 )
+        {
+           if ( variableisparameterglobal(newvar,tmpparameterlocallist2) == 1 )
+           {
+              not_remove = 2 ;
+           }
+           else if ( variableisglobal(newvar, globalvarofusefile2) == 1 )
+           {
+              not_remove = 1 ;
+              DecomposeTheName(newvar->var->readedlistdimension);
+           }
+        }
+     }
+/******************************************************************************/
+/*                          look if pointer variable                          */
+/******************************************************************************/
+     /* if this variable is a pointer we should remove it                     */
+     if ( not_remove == 1 && newvar->var->pointerdeclare == 1 )
+     {
+        not_remove = 2;
+     }
+     /* if this variable is an allocatable var we should remove it            */
+     if ( not_remove == 1 && newvar->var->allocatable == 1 )
+     {
+        not_remove = 2;
+     }
+/******************************************************************************/
+/*                          look in the AllocateList                          */
+/******************************************************************************/
+     /* if this variable has been used in a allocate we should remove it      */
+     if ( not_remove == 1 && newvar->var->nbdim != 0 )
+     {
+        parcoursallocate = AllocateList;
+        while ( parcoursallocate && not_remove == 1 )
+        {
+           if ( !strcasecmp(parcoursallocate->nomvar,newvar->var->nomvar) &&
+                !strcasecmp(parcoursallocate->subroutine,subroutinename)
+           ) not_remove = 2;
+           else parcoursallocate = parcoursallocate->suiv;
+        }
+     }
+     /*                                                                       */
+     } /* end of strcasecmp(newvar->var->nomvar,"") */
+     else
+     {
+        not_remove = 2;
+     }
+/******************************************************************************/
+/*                          REMOVE                                            */
+/******************************************************************************/
+     if ( (   not_remove == 0 || not_remove == 2 ) && 
+              newvar->var->pointedvar == 0 
+        )
+     {
+        if ( newvar == listvarindoloop )
+        {
+           listvarindoloop = listvarindoloop->suiv;
+           newvar = listvarindoloop;
+        }
+        else
+        {
+           newvarPrec->suiv = newvar->suiv;
+           newvar = newvarPrec->suiv;
+        }
+     }
+     else
+     {        
+        /*                                                                    */
+        newvarPrec = newvar;
+        newvar = newvar->suiv ;
+     }
+  }
+  else
+  {
+     newvarPrec = newvar;
+     newvar = newvar->suiv;
+  }
+  }
+}
+
+
+/******************************************************************************/
+/*                        ModifyThelistvarindoloop                            */
+/******************************************************************************/
+/* This subroutine is to give the old name to the which has been              */
+/* declared as USE MOD, U => V in this case we should replace in the          */
+/* name V by the old name U in the listvarindoloop                            */
+/******************************************************************************/
+void  ModifyThelistvarindoloop()
+{
+  listvar *newvar;
+      
+  newvar = listvarindoloop;
+  while ( newvar )
+  {
+     if ( strcasecmp(newvar->var->oldname,"") )
+     {
+        strcpy(newvar->var->nomvar,newvar->var->oldname);
+     }
+     newvar = newvar->suiv;
+  }
+}
+
+/******************************************************************************/
+/*                          CompleteThelistvarindoloop                        */
+/******************************************************************************/
+/* This subroutine is to add to the listvarindoloop all variables which       */
+/* has been declared as USE MOD, U => V in this case we should replace        */
+/* in the listvarindoloop the word U by the word V                            */
+/******************************************************************************/
+void  CompleteThelistvarindoloop()
+{
+  listvar *newvar;
+  listvarpointtovar *pointtmplist;
+  listcouple *coupletmp;
+  int outvar;
+      
+  pointtmplist = Listofvarpointtovar;
+  
+  while ( pointtmplist )
+  {
+      coupletmp = pointtmplist->couple;
+      while ( coupletmp )
+      {
+         newvar = listvarindoloop;
+         outvar = 0 ;
+         while ( newvar && outvar == 0)
+         {
+           /* we should find the same variable name in the same subroutine    */
+           if ( !strcasecmp(newvar->var->nomvar,coupletmp->namevar) &&
+                !strcasecmp(newvar->var->modulename,
+                                       pointtmplist->cursubroutine) &&
+                 strcasecmp(coupletmp->namepointedvar,"") 
+              )
+           {
+              outvar = 1;
+              strcpy(newvar->var->oldname,newvar->var->nomvar);
+              strcpy(newvar->var->nomvar,coupletmp->namepointedvar);
+           }
+           else
+           {      
+              newvar = newvar->suiv;
+           }
+         }
+         coupletmp = coupletmp->suiv;     
+     }
+     pointtmplist = pointtmplist->suiv;
+  }
+}
Index: /trunk/AGRIF/LIB/WorkWithvarofsubroutineliste.c
===================================================================
--- /trunk/AGRIF/LIB/WorkWithvarofsubroutineliste.c	(revision 396)
+++ /trunk/AGRIF/LIB/WorkWithvarofsubroutineliste.c	(revision 396)
@@ -0,0 +1,261 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                    OPTI_1_ajoutvarofsubroutine                             */
+/******************************************************************************/
+/* Firstpass 1                                                                */
+/* We should complete the listvarofsubroutine                                 */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void OPTI_1_ajoutvarofsubroutine(listvar *listtoadd)
+{
+   listvar *tmplist;
+   
+   tmplist = (listvar *)NULL;
+   if ( firstpass == 1 && VariableIsParameter == 0 && SaveDeclare == 0)
+   {
+      tmplist = duplicatelistvar(listtoadd);
+      varofsubroutineliste = AddListvarToListvar
+                                               (tmplist,varofsubroutineliste,1);
+   }
+}
+
+/******************************************************************************/
+/*                 CleanThelistvarofsubroutineliste                           */
+/******************************************************************************/
+/* This subroutine is to remove from the varofsubroutineliste                 */
+/* all variables which are not located in the subroutine argument             */
+/******************************************************************************/
+void CleanThelistvarofsubroutineliste()
+{
+  listvar *newvar;
+  listvar *newvarprec;
+  listvar *tmpglobvar;
+  int out;
+
+  newvarprec = (listvar *)NULL;
+  newvar = varofsubroutineliste;
+  while ( newvar )
+  {
+
+     out = 0;
+     tmpglobvar = listargsubroutine;
+     while ( tmpglobvar && out == 0 )
+     {
+        if ( !strcasecmp(newvar->var->nomvar,tmpglobvar->var->nomvar) &&
+             !strcasecmp(newvar->var->modulename,subroutinename) )
+        {
+           out = 1;
+	}
+	else
+	{
+           tmpglobvar = tmpglobvar->suiv;	
+	}	
+     }
+     /*  if the variable has not be found we should remove it                 */
+     if ( out == 0 && !strcasecmp(newvar->var->modulename,subroutinename) )
+     {
+        /* remove the variable in the  varofsubroutineliste                   */
+	if ( newvar == varofsubroutineliste )
+	{
+	   varofsubroutineliste = varofsubroutineliste->suiv;
+	   newvar = varofsubroutineliste;
+	}
+	else
+	{
+	   newvarprec->suiv = newvar->suiv;
+	   newvar = newvarprec->suiv;
+	}
+     }
+     else
+     {
+         newvarprec= newvar;
+	 newvar = newvar->suiv;
+     }
+  }
+}
+
+
+/******************************************************************************/
+/*             UpdatevarofsubroutinelisteWithcommonlist                       */
+/******************************************************************************/
+/*  This subroutines is used to add the variable defined in common in the     */
+/*    varofsubroutineliste                                                    */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void UpdatevarofsubroutinelisteWithcommonlist()
+{
+   listvarcommon *parcours;
+   listvar *parcours2;
+   listvar *parcoursvar;
+   listvar *parcoursvarprec;
+   int out;
+   
+   parcoursvar = varofsubroutineliste;
+   parcoursvarprec = (listvar *)NULL;
+   while ( parcoursvar )
+   {
+      /* We should look in the commonlist if this variable is present         */
+      parcours=commonlist;
+      out=0;
+      while( parcours && out == 0 )
+      {
+         if ( !strcasecmp(parcoursvar->var->nomvar,parcours->nomvar) &&
+              !strcasecmp(parcoursvar->var->subroutinename,
+                                           parcours->subroutinename)
+            )
+         {
+            out = 1 ;
+         }
+         else
+         {
+            parcours = parcours->suiv;
+         }
+      }
+      if ( out == 1 )
+      {
+         /* we found it                                                       */
+         /* we should remove the variable from the varofsubroutineliste       */
+         if ( parcoursvar == varofsubroutineliste )
+         {
+            varofsubroutineliste = varofsubroutineliste->suiv;
+            parcoursvar = varofsubroutineliste ;
+         }
+         else
+         {
+            parcoursvarprec->suiv = parcoursvar->suiv;
+            parcoursvar = parcoursvarprec->suiv;
+         }
+      }
+      else
+      {
+         parcoursvarprec = parcoursvar;
+         parcoursvar = parcoursvar->suiv;
+      }
+   }
+   
+   /* now we should remove all parameters                                     */
+   parcoursvar = varofsubroutineliste;
+   while ( parcoursvar )
+   {
+      /* We should look in the commonlist if this variable is present         */
+      parcours2=parameterlist;
+      out=0;
+      while( parcours2 && out == 0 )
+      {
+         if ( !strcasecmp(parcoursvar->var->nomvar,parcours2->var->nomvar) &&
+              !strcasecmp(parcoursvar->var->subroutinename,
+                                           parcours2->var->subroutinename) 
+            )
+         {
+            out = 1 ;
+            /*                                                                */
+         }
+         else
+         {
+            parcours2 = parcours2->suiv;
+         }
+      }
+      if ( out == 1 )
+      {
+         /* we did find it                                                    */
+         /* we should remove the variable from the varofsubroutineliste       */
+         if ( parcoursvar == varofsubroutineliste )
+         {
+            varofsubroutineliste = varofsubroutineliste->suiv;
+            parcoursvar = varofsubroutineliste;
+         }
+         else
+         {
+            parcoursvarprec->suiv = parcoursvar->suiv;
+            parcoursvar = parcoursvarprec->suiv;
+         }
+      }
+      else
+      {
+         parcoursvarprec = parcoursvar;
+         parcoursvar = parcoursvar->suiv;
+      }
+   }
+}
+
+
+/******************************************************************************/
+/*                COM_1_UpdatevarsubroutineWithvarofsubroutinelist            */
+/******************************************************************************/
+/*  This subroutines is used to add the variable defined in common in the     */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void COM_1_UpdatevarsubroutineWithvarofsubroutinelist()
+{
+   listvar *parcours;
+   listvar *parcours2;
+   listvar *parcoursprec;
+   int out;
+   
+   parcours = varsubroutine;
+   while ( parcours )
+   {
+      /* We should look in the varofsubroutineliste if this variable is       */
+      /*    present                                                           */
+      parcours2=varofsubroutineliste;
+      out=0;
+      while( parcours2 && out == 0 )
+      {
+         if ( !strcasecmp(parcours->var->nomvar,parcours2->var->nomvar) &&
+              !strcasecmp(parcours->var->subroutinename,
+                                            parcours2->var->modulename) 
+            )
+         {
+            out = 1 ;
+         }
+         else
+         {
+            parcours2 = parcours2->suiv;
+         }
+      }
+      if ( out == 1 )
+      {
+         /* we did not find it                                                */
+         /* we should remove the variable from the varsubroutine              */
+         if ( parcours ==  varsubroutine)
+         {
+            varsubroutine = varsubroutine->suiv;
+            parcours = varsubroutine;
+         }
+         else
+         {
+            parcoursprec->suiv = parcours->suiv;
+            parcours = parcoursprec->suiv;
+         }
+      }
+      else
+      {
+         parcoursprec = parcours;
+         parcours = parcours->suiv;
+      }
+   }
+}
Index: /trunk/AGRIF/LIB/WriteInFile.c
===================================================================
--- /trunk/AGRIF/LIB/WriteInFile.c	(revision 396)
+++ /trunk/AGRIF/LIB/WriteInFile.c	(revision 396)
@@ -0,0 +1,188 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+/******************************************************************************/
+/*                            tofich_reste                                    */
+/******************************************************************************/
+/* This subroutine is used to write the string s into the fileout             */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void tofich_reste (FILE * filout, char *s,int returnlineornot)	
+{
+  char temp[61];
+  char *tmp;
+  int size;
+
+
+  if (strlen (s) <= 60)
+    {
+      if ( returnlineornot == 0 ) fprintf (filout, "     & %s", s);
+      else fprintf (filout, "     & %s\n", s);
+      if ( returnlineornot == 0 ) colnum=colnum+strlen(s)+6;
+      else colnum=0;
+    }
+  else
+    {
+      strncpy (temp, s, 60);
+      strcpy (&temp[60], "\0");
+
+      tmp = strrchr(temp, '+');
+
+      if ( !tmp || strlen(tmp) == 60 ) tmp = strrchr(temp, '-');
+      if ( !tmp || strlen(tmp) == 60  ) tmp = strrchr(temp, '/');
+      if ( !tmp || strlen(tmp) == 60  ) tmp = strrchr(temp, '*');
+      if ( !tmp || strlen(tmp) == 60  ) tmp = strrchr(temp, '%');
+      if ( !tmp || strlen(tmp) == 60  ) tmp = strrchr(temp, ':');
+      if ( !tmp || strlen(tmp) == 60  ) tmp = strrchr(temp, ')');
+      if ( tmp )
+      {
+         size = strlen(tmp);
+      }
+      else
+      {
+         size = 0 ;
+      }
+
+      strcpy (&temp[60-size], "\0");
+
+      if ( fortran77 == 0 ) fprintf (filout, "     & %s  &\n", temp);
+      else fprintf (filout, "     & %s  \n", temp);
+      colnum=0;
+      tofich_reste (filout, (char *) &s[60-size],returnlineornot);
+    }
+}
+
+/******************************************************************************/
+/*                            tofich                                          */
+/******************************************************************************/
+/* This subroutine is used to write the string s into the fileout             */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void tofich (FILE * filout, char *s, int returnlineornot)	
+{
+  char temp[61];
+  char *tmp;
+  int size;
+  
+  if (strlen (s) <= 60)
+    {
+      if ( returnlineornot == 0 ) fprintf (filout, "      %s", s);
+      else fprintf (filout, "      %s\n", s);
+      if ( returnlineornot == 0 ) colnum=colnum+strlen(s)+6;
+      else colnum=0;
+    }
+  else
+    {
+      strncpy (temp, s, 60);
+      strcpy (&temp[60], "\0");
+
+      tmp = strrchr(temp, ',');
+      if ( !tmp  || strlen(tmp) == strlen(temp) ) tmp = strrchr(temp, '+');
+      if ( !tmp  || strlen(tmp) == strlen(temp)  ) tmp = strrchr(temp, '-');
+      if ( !tmp  || strlen(tmp) == strlen(temp)  ) tmp = strrchr(temp, '/');
+      if ( !tmp  || strlen(tmp) == strlen(temp)  ) tmp = strrchr(temp, '*');
+      if ( !tmp  || strlen(tmp) == strlen(temp)  ) tmp = strrchr(temp, '%');
+      if ( !tmp  || strlen(tmp) == strlen(temp)  ) tmp = strrchr(temp, ':');
+      if ( !tmp  || strlen(tmp) == strlen(temp)  ) tmp = strrchr(temp, ')');
+      if ( tmp )
+      {
+         size = strlen(tmp);
+      }
+      else
+      {
+         size = 0 ;
+      }
+
+      strcpy (&temp[60-size], "\0");
+
+      if ( fortran77 == 0 ) fprintf (filout, "      %s  &\n", temp);
+      else fprintf (filout, "      %s  \n", temp);
+      colnum=0;
+      tofich_reste (filout, (char *) &s[60-size], returnlineornot);
+    }
+}
+
+/******************************************************************************/
+/*                       tofich_blanc                                         */
+/******************************************************************************/
+/* This subroutine is used to write size blank into the fileout               */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void tofich_blanc (FILE * filout, int size)
+{
+  int i;
+  
+  if (size <= 65)
+    {
+      fprintf (filout, "%*s\n",size,EmptyChar);
+    }
+  else
+    {
+      i=0;
+      do
+      {
+         fprintf (filout, "%*s\n",65,EmptyChar);
+         i = i+1;
+      } while ( i <= size / 65 );
+         fprintf (filout, "%*s\n",size%65,EmptyChar);
+    }
+}
+
+
+/******************************************************************************/
+/*                         RemoveWord                                         */
+/******************************************************************************/
+/* This subroutine is used to remove a sentence in the file filout            */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void RemoveWordSET(FILE * filout, long int position, long int sizetoremove)
+{
+   fseek(filout,position,SEEK_SET);
+   tofich_blanc(filout,sizetoremove);
+}
+
+
+/******************************************************************************/
+/*                         RemoveWord                                         */
+/******************************************************************************/
+/* This subroutine is used to remove a sentence in the file filout            */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void RemoveWordCUR(FILE * filout, long int position, long int sizetoremove)
+{
+   fseek(filout,position,SEEK_CUR);
+   tofich_blanc(filout,sizetoremove);
+}
Index: /trunk/AGRIF/LIB/Writedeclarations.c
===================================================================
--- /trunk/AGRIF/LIB/Writedeclarations.c	(revision 396)
+++ /trunk/AGRIF/LIB/Writedeclarations.c	(revision 396)
@@ -0,0 +1,595 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "decl.h"
+
+/******************************************************************************/
+/*                         WriteBeginDeclaration                              */
+/******************************************************************************/
+/* This subroutine is used to write the begin of a declaration                */
+/* taken in a variable record                                                 */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/*       integer variable ----------->   INTEGER                              */
+/*                                                                            */
+/******************************************************************************/
+void WriteBeginDeclaration(variable *v,char ligne[LONGLIGNE])
+{
+  char tmpligne[LONGLIGNE];
+
+  sprintf (ligne, "%s", v->typevar);
+  if ( v->c_star == 1 ) strcat(ligne,"*");
+  /* We should give the precision of the variable if it has been given        */
+  if ( strcasecmp(v->precision,"") )
+  {
+     sprintf(tmpligne,"(%s)",v->precision);
+     strcat(ligne,tmpligne);
+  }
+  if (strcasecmp(v->dimchar,""))
+  {
+     sprintf(tmpligne,"(%s)",v->dimchar);
+     strcat(ligne,tmpligne);
+  }
+  if ( strcasecmp(v->nameinttypename,"") )
+  {
+     sprintf(tmpligne,"*%s",v->nameinttypename);
+     strcat(ligne,tmpligne);
+  }
+  if (strcasecmp (v->IntentSpec, ""))
+  {
+     sprintf(tmpligne,",INTENT(%s)",v->IntentSpec);
+     strcat(ligne,tmpligne);
+  }   
+  if ( v->VariableIsParameter == 1 ) strcat(ligne, ", PARAMETER");
+  if ( v->PublicDeclare       == 1 ) strcat(ligne, ", PUBLIC");  
+  if ( v->PrivateDeclare      == 1 ) strcat(ligne, ", PRIVATE"); 
+  if ( v->ExternalDeclare     == 1 ) strcat(ligne, ", EXTERNAL");  
+  if ( v->allocatable == 1 && v->save ==0 ) strcat(ligne,", ALLOCATABLE");
+  if ( v->optionaldeclare == 1 ) strcat(ligne,", OPTIONAL");
+  if ( v->pointerdeclare == 1 ) strcat(ligne,", POINTER");
+}
+
+
+/******************************************************************************/
+/*                         WriteScalarDeclaration                             */
+/******************************************************************************/
+/* This subroutine is used to write a scalar declaration                      */
+/* taken in a variable record                                                 */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/*       integer variable ----------->   INTEGER :: VARIABLE                  */
+/*                                                                            */
+/******************************************************************************/
+void  WriteScalarDeclaration(variable *v,char ligne[LONGLIGNE])
+{
+
+  strcat (ligne, " :: ");
+  strcat (ligne, v->nomvar);
+  if ( v->lengspecgiven == 1 ) strcat(ligne,v->vallengspec);
+  if ( v->VariableIsParameter == 1 ) 
+  {
+     strcat(ligne," = ");
+     strcat(ligne,v->initialvalue);
+  }
+}
+
+
+/******************************************************************************/
+/*                         WriteTableDeclaration                              */
+/******************************************************************************/
+/* This subroutine is used to write a Table declaration                       */
+/* taken in a variable record                                                 */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/*  integer variable(nb) ----------->                                         */
+/*                      INTEGER, DIMENSION(1:nb) :: variable                  */
+/*                                                                            */
+/******************************************************************************/
+void  WriteTableDeclaration(variable * v,char ligne[LONGLIGNE],int tmpok)
+{
+  char newname[LONGNOM];
+
+  strcat (ligne, ", Dimension(");
+  if ( v->dimensiongiven == 1 && tmpok == 1 )
+                                           strcat(ligne,v->readedlistdimension);
+  if ( v->dimensiongiven == 1 && tmpok == 0 )
+  {
+     strcpy(newname,ChangeTheInitalvaluebyTabvarsName
+                                          (v->readedlistdimension,globliste,0));
+     if ( !strcasecmp(newname,v->readedlistdimension) )
+     {
+        strcpy(newname,"");     
+        /* la liste des use de cette subroutine                               */
+        strcpy(newname,ChangeTheInitalvaluebyTabvarsName
+                                 (v->readedlistdimension,globalvarofusefile,0));
+        if ( !strcasecmp(newname,"") ) strcat(newname,v->readedlistdimension);
+     }
+     strcat(ligne,newname);
+  }
+  strcat (ligne, ")");
+  strcat (ligne, " :: ");
+  strcat (ligne, v->nomvar);  
+  if ( v->lengspecgiven == 1 ) strcat(ligne,v->vallengspec);
+  if ( !strcasecmp (v->typevar, "character") ) strcat(ligne,vargridparam(v,0));
+}
+
+
+/******************************************************************************/
+/*                         ModifTableDeclaration                              */
+/******************************************************************************/
+/* This subroutine is used to write a Table declaration                       */
+/* taken in a variable record                                                 */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/*  integer variable(nb) ----------->                                         */
+/*                      INTEGER, DIMENSION(:),Pointer :: variable             */
+/*                                                                            */
+/******************************************************************************/
+void  ModifTableDeclaration(variable * v,char ligne[LONGLIGNE])
+{
+
+  if ( strcasecmp (v->typevar, "character") )
+  {
+     if ( v->nbdim == 0 )
+     {
+        strcat (ligne, ", Dimension");
+        strcat (ligne, vargridparam (v,0));
+     }
+     else if ((v->nbdim) == 1) strcat (ligne, ", Dimension(:)");
+     else if ((v->nbdim) == 2) strcat (ligne, ", Dimension(:,:)");
+     else if ((v->nbdim) == 3) strcat (ligne, ", Dimension(:,:,:)");
+     else if ((v->nbdim) == 4) strcat (ligne, ", Dimension(:,:,:,:)");
+     else if ((v->nbdim) == 5) strcat (ligne, ", Dimension(:,:,:,:,:)");
+     else if ((v->nbdim) == 6) strcat (ligne, ", Dimension(:,:,:,:,:,:)"); 
+
+     if ( v->nbdim >=  1 ) strcat (ligne, ", pointer");
+  }
+  strcat (ligne, " :: ");
+  strcat (ligne, v->nomvar);  
+  if ( v->lengspecgiven == 1 ) strcat(ligne,v->vallengspec);
+  if ( !strcasecmp (v->typevar, "character") ) strcat(ligne,vargridparam(v,0));  
+}
+
+/******************************************************************************/
+/*                        writevardeclaration                                 */
+/******************************************************************************/
+/* This subroutine is used to write the initial declaration in the file       */
+/* fileout of a variable                                                      */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/*  integer variable(nb) ----------->                                         */
+/*                      INTEGER, DIMENSION(1:nb),Pointer :: variable          */
+/*                                                                            */
+/******************************************************************************/
+void writevardeclaration (listvar * var_record, FILE *fileout)
+{
+  FILE *filecommon;
+  listvar *newvar;
+  variable *v;
+  char ligne[LONGNOM];
+
+  filecommon=fileout;
+  newvar = var_record;
+
+  if ( newvar->var->save == 0 || inmodulemeet == 0 )
+  {
+     v = newvar->var;
+     WriteBeginDeclaration(v,ligne);
+     if ( v->nbdim == 0 ) WriteScalarDeclaration(v,ligne);
+     else WriteTableDeclaration(v,ligne,0);
+
+     if ( strcasecmp(v->initialvalue,"") )
+     {
+        strcat(ligne," = ");
+        strcat(ligne,v->initialvalue);
+     }  
+     tofich (filecommon, ligne,1);
+  }
+}
+
+
+/******************************************************************************/
+/*                      NonGridDepDeclaration                                 */
+/******************************************************************************/
+/* This subroutine is used to change the variables declaration                */
+/*                                                                            */
+/******************************************************************************/
+/*                                                                            */
+/*  integer variable(nb) ----------->                                         */
+/*                      INTEGER, DIMENSION(:),Pointer :: variable             */
+/*                                                                            */
+/******************************************************************************/
+void NonGridDepDeclaration(listvar * deb_common)
+{
+  listvar *newvar;
+
+  if ( ( SaveDeclare == 0 || aftercontainsdeclare == 0 ) && listenotgriddepend ) 
+  {
+     newvar = deb_common;
+     while (newvar)
+     {
+        if ( VarIsNonGridDepend(newvar->var->nomvar) == 1 ) 
+                                       writevardeclaration (newvar, fortranout);
+        newvar = newvar->suiv;
+     }
+  }
+}
+
+
+/******************************************************************************/
+/*                       writedeclaration                                     */
+/******************************************************************************/
+/* This subroutine is used to write the declaration if variable present in    */
+/*    the deb_common and also in the presentinthislist list file              */
+/******************************************************************************/
+/*                                                                            */
+/*  integer variable(nb) ----------->                                         */
+/*                      INTEGER, DIMENSION(1:nb),Pointer :: variable          */
+/*                                                                            */
+/******************************************************************************/
+void writedeclaration (listvar * deb_common, FILE *fileout, listvar *presentinthislist)
+{
+  FILE *filecommon;
+  listvar *newvar;
+  listvar *parcours;
+  variable *v;
+  char ligne[LONGLIGNE];
+  int out;
+
+  filecommon=fileout;
+
+  newvar = deb_common;
+  while (newvar)
+  {
+     if ( newvar->var->save == 0 || inmodulemeet == 0 )
+     {
+        parcours = presentinthislist;
+        /* we should write declaration of variable present in the list        */
+        /* presentinthislist                                                  */
+        /* if presentinthislist is empty we should write all declarations     */
+        out = 0 ;
+        while ( parcours && out == 0 )
+        {
+            /* if we find this variable in the presentinthislist, we          */
+            /* could write it                                                 */
+           if ( !strcasecmp(parcours->var->nomvar,newvar->var->nomvar) &&
+                !strcasecmp(parcours->var->subroutinename,
+                                          newvar->var->subroutinename) 
+               ) out = 1;
+           else parcours =parcours ->suiv;
+        }
+        if ( out == 0 || !presentinthislist)
+        {
+           /* if the variable has not been found or if the                    */
+           /* presentinthislist is empty, we do not write the declaration     */
+        }
+        else
+        {
+           /* else we could write it                                          */
+           v = newvar->var;
+           WriteBeginDeclaration(v,ligne);
+           if ( v->nbdim == 0 ) WriteScalarDeclaration(v,ligne);
+           else WriteTableDeclaration(v,ligne,0);
+            
+           if ( strcasecmp(v->initialvalue,"") )
+           {
+              strcat(ligne, "=");
+              strcat(ligne, v->initialvalue);
+           }
+           tofich (filecommon, ligne,1);
+        }
+     }
+     newvar = newvar->suiv;
+  }
+}
+
+/******************************************************************************/
+/*                       writesub_loopdeclaration                             */
+/******************************************************************************/
+/* This subroutine is used to write the declaration part of subloop           */
+/*    subroutines                                                             */
+/******************************************************************************/
+/*                                                                            */
+/*  integer variable(nb) ----------->                                         */
+/*                                                                            */
+/*          INTEGER, DIMENSION(1:nb)         :: variable                      */
+/*                                                                            */
+/******************************************************************************/
+void writesub_loopdeclaration (listvar * deb_common, FILE *fileout)
+{
+  listvar *newvar;
+  variable *v;
+  char ligne[LONGLIGNE];
+  int changeval;
+
+  tofich (fileout, "",1);
+  newvar = deb_common;
+  while (newvar)
+  {
+     if ( !strcasecmp(newvar->var->modulename,subroutinename) )
+     {
+        changeval = 0;
+        v = newvar->var;
+        if ( v->allocatable == 1 && fortran77 == 0 ) 
+        {
+           changeval = 1;
+           v->allocatable = 0; 
+        }
+        WriteBeginDeclaration(v,ligne);
+        if ( v->nbdim == 0 ) WriteScalarDeclaration(v,ligne);
+        else WriteTableDeclaration(v,ligne,1);
+
+        tofich (fileout, ligne,1);
+        if ( changeval == 1 ) 
+        {
+           v->allocatable = 1;
+        }
+     }
+     newvar = newvar->suiv;
+  }
+}
+
+/******************************************************************************/
+/*                      writedeclarationintoamr                               */
+/******************************************************************************/
+/* This subroutine is used to write the declaration of parameters needed in   */
+/*    allocation subroutines creates in toamr.c                               */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void writedeclarationintoamr (listvar * deb_common, FILE *fileout,
+                              listvar *listin , char commonname[LONGNOM])
+{
+  listvar *newvar;
+  variable *v;
+  char ligne[LONGLIGNE];
+  int changeval;
+  char firstmodule[LONGNOM];
+  int out;
+  listnom *neededparameter;
+  int writeit;
+  listnom *parcours;
+  listnom *parcoursprec;
+  
+  neededparameter = (listnom * )NULL;
+  /* we should list the needed parameter                                      */
+  newvar = listin;
+  out = 0 ;
+  while ( newvar && out == 0 )
+  {
+     if ( strcmp(newvar->var->commonname,commonname) ) out = 1;
+     else 
+     {
+        /* add the name to the list of needed parameter                       */
+        neededparameter = DecomposeTheNameinlistnom(
+                 newvar->var->readedlistdimension,
+                 neededparameter );
+        newvar = newvar->suiv;
+     }
+  }
+  /*                                                                          */
+  parcours = neededparameter;
+  while (parcours)
+  {
+     newvar = deb_common;
+     out = 0 ;
+     while ( newvar && out == 0 )
+     {
+        if ( !strcasecmp(parcours->nom,newvar->var->nomvar) ) 
+        {
+           out=1; 
+        /* add the name to the list of needed parameter                       */
+           neededparameter = DecomposeTheNameinlistnom(
+                 newvar->var->initialvalue,
+                 neededparameter );
+        }
+        else newvar=newvar->suiv;
+     }
+     parcours=parcours->suiv;
+   }     
+  /*                                                                          */
+  parcours = neededparameter;
+  while (parcours)
+  {
+     newvar = deb_common;
+     out = 0 ;
+     while ( newvar && out == 0 )
+     {
+        if ( !strcasecmp(parcours->nom,newvar->var->nomvar) ) 
+        {
+           out=1; 
+        /* add the name to the list of needed parameter                       */
+           neededparameter = DecomposeTheNameinlistnom(
+                 newvar->var->initialvalue,
+                 neededparameter );
+        }
+        else newvar=newvar->suiv;
+     }
+     parcours=parcours->suiv;
+   }     
+  /*                                                                          */
+  strcpy(firstmodule,"");
+  tofich (fileout, "",1);
+  newvar = deb_common;
+  while (newvar)
+  {
+     writeit = 0;
+     parcours = neededparameter;
+     while ( parcours && writeit == 0 )
+     {
+        if ( !strcasecmp(parcours->nom,newvar->var->nomvar) )
+        {
+           writeit=1;
+           if ( parcours == neededparameter )
+           {
+              neededparameter = neededparameter->suiv;
+           }
+           else
+           {
+              parcoursprec->suiv= parcours->suiv;           
+           }
+        }
+        else
+        {
+           parcoursprec=parcours;
+           parcours=parcours->suiv;
+        }
+     }
+     
+     if ( writeit == 1  )
+     {
+        changeval = 0;
+        v = newvar->var;
+        if ( v->allocatable == 1 && fortran77 == 0 ) 
+        {
+           changeval = 1;
+           v->allocatable = 0; 
+        }
+        WriteBeginDeclaration(v,ligne);
+        if ( v->nbdim == 0 ) WriteScalarDeclaration(v,ligne);
+        else WriteTableDeclaration(v,ligne,1);
+
+        tofich (fileout, ligne,1);
+        if ( changeval == 1 ) 
+        {
+           v->allocatable = 1;
+        }
+     }
+     newvar = newvar->suiv;
+  }
+}
+
+
+
+/******************************************************************************/
+/*                     writedeclarationsubroutinedeclaration                  */
+/******************************************************************************/
+/* This subroutine is used to write the declaration of parameters needed in   */
+/*    in the table definition. This subroutine is used for the declaration    */
+/*    part of original subroutines                                            */
+/******************************************************************************/
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void  writedeclarationsubroutinedeclaration(listvar * deb_common, FILE *fileout,
+                              listvar *listin)
+{
+  listvar *newvar;
+  variable *v;
+  char ligne[LONGLIGNE];
+  int changeval;
+  char firstmodule[LONGNOM];
+  int out;
+  listnom *neededparameter;
+  int writeit;
+  listnom *parcours;
+  listnom *parcoursprec;
+  
+  neededparameter = (listnom * )NULL;
+  /* we should list the needed parameter                                      */
+  newvar = listin;
+  while ( newvar )
+  {
+     if ( !strcmp(newvar->var->subroutinename,subroutinename) )
+     {
+        /* add the name to the list of needed parameter                       */
+        neededparameter = DecomposeTheNameinlistnom(
+                 newvar->var->readedlistdimension,
+                 neededparameter );
+     }
+     newvar = newvar->suiv;
+  }
+  /*                                                                          */
+  parcours = neededparameter;
+  while (parcours)
+  {
+     newvar = deb_common;
+     out = 0 ;
+     while ( newvar && out == 0 )
+     {
+        if ( !strcasecmp(parcours->nom,newvar->var->nomvar) ) 
+        {
+           out=1; 
+        /* add the name to the list of needed parameter                       */
+           neededparameter = DecomposeTheNameinlistnom(
+                 newvar->var->initialvalue,
+                 neededparameter );
+        }
+        else newvar=newvar->suiv;
+     }
+     parcours=parcours->suiv;
+   }     
+   /*                                                                         */
+  strcpy(firstmodule,"");
+  tofich (fileout, "",1);
+  newvar = deb_common;
+  while (newvar)
+  {
+     writeit = 0;
+     parcours = neededparameter;
+     while ( parcours && writeit == 0 )
+     {
+        if ( !strcasecmp(parcours->nom,newvar->var->nomvar) )
+        {
+           writeit=1;
+           if ( parcours == neededparameter )
+           {
+              neededparameter = neededparameter->suiv;
+           }
+           else
+           {
+              parcoursprec->suiv= parcours->suiv;           
+           }
+        }
+        else
+        {
+           parcoursprec=parcours;
+           parcours=parcours->suiv;
+        }
+     }
+     
+     if ( writeit == 1  )
+     {
+        changeval = 0;
+        v = newvar->var;
+        if ( v->allocatable == 1 && fortran77 == 0 ) 
+        {
+           changeval = 1;
+           v->allocatable = 0; 
+        }
+        WriteBeginDeclaration(v,ligne);
+        if ( v->nbdim == 0 ) WriteScalarDeclaration(v,ligne);
+        else WriteTableDeclaration(v,ligne,1);
+
+        tofich (fileout, ligne,1);
+        if ( changeval == 1 ) 
+        {
+           v->allocatable = 1;
+        }
+     }
+     newvar = newvar->suiv;
+  }
+}
Index: /trunk/AGRIF/LIB/convert.lex
===================================================================
--- /trunk/AGRIF/LIB/convert.lex	(revision 396)
+++ /trunk/AGRIF/LIB/convert.lex	(revision 396)
@@ -0,0 +1,87 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+%s character
+%{
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+int line_num=1;
+extern FILE * yyin;
+#define MAX_INCLUDE_DEPTH 30
+YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+%}
+
+COMMENT "%"  
+SEPARATEUR "::"
+NIMPORTEQUOI .
+COMMENTAIRES1 {COMMENT}{NIMPORTEQUOI}*{COMMENT}
+PROBTYPE "1D"|"2D"|"3D"
+USEITEM "FIXED_GRIDS"|"ONLY_FIXED_GRIDS"|"DEBUG"
+NAME [a-zA-Z\_][a-zA-Z0-9\_]*
+DIGIT [0-9]+
+NUM {DIGIT}
+NEXTLINE \n+[ \t]+"$"|\n+[ \t]+"&"
+FILENAME {NAME}"."{NAME}
+%%
+regridding  return TOK_REGRIDDING; /* period of regridding                    */
+coeffrefx   return TOK_COEFFRAFX;  /* space refinement in the x direction     */
+coeffrefy   return TOK_COEFFRAFY;  /* space refinement in the y direction     */
+coeffrefz   return TOK_COEFFRAFZ;  /* space refinement in the z direction     */
+coeffreftx  return TOK_COEFFRAFTX; /* time refinement in the x direction      */
+coeffrefty  return TOK_COEFFRAFTY; /* time refinement in the y direction      */
+coeffreftz  return TOK_COEFFRAFTZ; /* time refinement in the z direction      */
+parammodule return TOK_MODULEMAIN; /* name of the module                      */
+efficiency  return TOK_EFFICIENCY; /* efficiency for the adaptive refinement  */
+rafmax      return TOK_RAFMAX;     /* minimum size in all directions          */
+rafmaxx     return TOK_RAFMAXX;    /* minimum size in x direction             */
+rafmaxy     return TOK_RAFMAXY;    /* minimum size in y direction             */
+rafmaxz     return TOK_RAFMAXZ;    /* minimum size in z direction             */
+notgriddep  return TOK_NOTGRIDDEP; /* variable which are not grid dependent   */
+use         return TOK_USE;
+minwidth    return TOK_MINWIDTH;   /* minimum width of rectangles for the     */
+                                   /*    adaptive refinement                  */
+{COMMENTAIRES1}    {}
+{SEPARATEUR}        return TOK_SEP;
+{FILENAME}         {strcpy(yylval.na,yytext); return TOK_FILENAME;}
+{USEITEM}          {strcpy(yylval.na,yytext); return TOK_USEITEM;}
+{PROBTYPE}         {strcpy(yylval.na,yytext); return TOK_PROBTYPE;}
+                                   /* dimension of the problem                */
+{NAME}             {strcpy(yylval.na,yytext); return TOK_NAME;}
+{NUM}              {yylval.ival=atoi(yytext); return TOK_NUM;}
+;|\,|\(|\)|:|\[|\] {return (int) *yytext;}
+\n                 {line_num++;return (int) *yytext;}
+[ \t]+ ;
+%%
+
+
+int yywrap()
+{
+}
+
+
+yyerror(char *s)
+{
+if (!strcasecmp(curfile,mainfile))
+{
+   printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile);
+}
+else
+{
+   printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile);
+}
+exit(0);
+}
Index: /trunk/AGRIF/LIB/convert.y
===================================================================
--- /trunk/AGRIF/LIB/convert.y	(revision 396)
+++ /trunk/AGRIF/LIB/convert.y	(revision 396)
@@ -0,0 +1,371 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+%{
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "decl.h"
+%}
+
+%union {
+       int ival;
+       char na[LONGNOM];
+       listnom * ln;
+       }
+
+%token TOK_SEP
+%token TOK_USE
+%token TOK_MINWIDTH        /* minimum width for the adaptive refinement       */
+%token TOK_REGRIDDING
+%token TOK_COEFFRAFX       /* space refinement factor in the x direction      */
+%token TOK_COEFFRAFY       /* space refinement factor in the y direction      */
+%token TOK_COEFFRAFZ       /* space refinement factor in the z direction      */
+%token TOK_COEFFRAFTX      /* time refinement factor in the x direction       */
+%token TOK_COEFFRAFTY      /* time refinement factor in the y direction       */
+%token TOK_COEFFRAFTZ      /* time refinement factor in the z direction       */
+%token TOK_MODULEMAIN      /* name of the module                              */
+%token TOK_NOTGRIDDEP      /* Variable which are not grid dependent           */
+%token <ival> TOK_NUM
+%token <na> TOK_FILENAME
+%token <na> TOK_USEITEM
+%token <na> TOK_NAME
+%token <na> TOK_PROBTYPE   /* dimension of the problem                        */
+%token <na> TOK_EFFICIENCY /* efficiency for the adaptive refinement          */
+%token <na> TOK_RAFMAX
+%token <na> TOK_RAFMAXX
+%token <na> TOK_RAFMAXY
+%token <na> TOK_RAFMAXZ
+%token ','
+%token ';'
+%token ':'
+%token '('
+%token ')'   
+%token '['
+%token ']'
+%%
+input :
+      | input line
+;
+line :'\n'
+      | TOK_PROBTYPE TOK_NAME ';'                  {initdimprob(1,$2,"0","0");}
+      | TOK_PROBTYPE TOK_NAME ',' TOK_NAME ';'     {initdimprob(2,$2, $4,"0");} 
+      | TOK_PROBTYPE TOK_NAME ',' TOK_NAME ',' TOK_NAME ';'
+                                                   {initdimprob(3,$2, $4, $6);}
+      | TOK_COEFFRAFX TOK_NUM ';'                              {coeffrafx =$2;}
+      | TOK_REGRIDDING TOK_NUM ';'                             {regridding=$2;}
+      | TOK_COEFFRAFY TOK_NUM ';'                              {coeffrafy =$2;}
+      | TOK_COEFFRAFZ TOK_NUM ';'                              {coeffrafz =$2;}
+      | TOK_COEFFRAFTX TOK_NUM ';'                             {coeffraftx=$2;}
+      | TOK_COEFFRAFTY TOK_NUM ';'                             {coeffrafty=$2;}
+      | TOK_COEFFRAFTZ TOK_NUM ';'                             {coeffraftz=$2;}
+      | TOK_MODULEMAIN TOK_NAME ';'            {Add_ModuleTo_listofmodules($2);
+                                                       Addmoduletothelist($2);}
+      | TOK_NOTGRIDDEP TOK_SEP TOK_NAME ';'             {ajoutenotgriddep($3);}
+      | TOK_EFFICIENCY TOK_NUM ';'            {userefficiency=1;efficiency=$2;}
+      | TOK_RAFMAX TOK_NUM ';'              {rafmaxx=$2,rafmaxy=$2,rafmaxz=$2;}
+      | TOK_RAFMAXX TOK_NUM ';'                                {rafmaxx  =$2;}
+      | TOK_RAFMAXY TOK_NUM ';'                                {rafmaxy  =$2;}
+      | TOK_RAFMAXZ TOK_NUM ';'                                {rafmaxz  =$2;}
+      | TOK_MINWIDTH TOK_NUM ';'                               {minwidth =$2;}
+      | TOK_USE TOK_USEITEM ';'  {
+                                    if (!strcasecmp($2,"FIXED_GRIDS"))
+                                                                 fixedgrids=1;
+                                    if (!strcasecmp($2,"ONLY_FIXED_GRIDS"))
+                                                             onlyfixedgrids=1;
+                                    if (!strcasecmp($2,"DEBUG"))    todebug=1;
+                                 }
+      ;
+%%
+
+int main(int argc,char *argv[])
+{
+   extern FILE * yyin ;
+   FILE *dependglobaloutput;
+   char *tmp;
+   int i;
+   listnom *parcours;
+
+/******************************************************************************/
+/*  1-  Variables initialization                                              */
+/******************************************************************************/
+   globliste=(listvar *)NULL;
+   listenamelist=(listnamelist *)NULL;
+   globparam=(listvar *)NULL;
+   globvarforcommon=(listvar *)NULL;
+   AllocateList=(listallocate *)NULL;
+   commonlist=(listvarcommon *)NULL;
+   listofsubroutinewhereagrifisused=(listnom *)NULL;
+   listofincludebysubroutine=(listusemodule *)NULL;
+   listofmodulebysubroutine=(listusemodule *)NULL;
+   listofmoduletmp=(listusemodule *)NULL;
+   listmoduleinfile=(listmodule *)NULL;
+   varofsubroutineliste=(listvar *)NULL;
+   varsubroutine=(listvar *)NULL;
+   listvarindoloop=(listvar *)NULL;
+   listenotgriddepend=(listvar *)NULL;
+   Listofavailableindices=(listindice *)NULL;
+   Listofvarpointtovar=(listvarpointtovar *)NULL;
+   globalvarofusefile = (listvar *)NULL;
+   globalvarofusefile2 = (listvar *)NULL;
+   
+   strcpy(mainfile,argv[1]);    
+   strcpy(nomdir,"AGRIF_INC");
+   strcpy(commondirin,".");
+   strcpy(commondirout,".");
+   strcpy(filetoparse," "); 
+   strcpy(subofagrifinitgrids,""); 
+   strcpy(meetagrifinitgrids,"");
+   strcpy(meetmpiinit,"");
+   strcpy(mpiinitvar,"");
+
+   listofvarofusemodulecreated=0;
+   checkexistcommon=1;
+   fortran77 = 0 ;
+   Did_filetoparse_treated = 0 ;
+   userefficiency=0;
+   todebug=0;
+   onlyfixedgrids=0;
+   fixedgrids=0;
+   InAgrifParentDef = 0;
+   rafmaxx=0;
+   rafmaxy=0;
+   rafmaxz=0;
+   IntegerIShouldBeAdd=0;
+   IndicenbmaillesX=0;
+   IndicenbmaillesY=0;
+   IndicenbmaillesZ=0;
+   minwidth=1;
+   coeffrafx=0;
+   coeffrafy=0;
+   coeffrafz=0;
+   indicemaxtabvars = 0;   /* current indice in the table tabvars             */
+   oldindicemaxtabvars = 0;/* current indice in the table tabvars             */
+   SubloopScalar = 0;
+/******************************************************************************/
+/*  2-  Program arguments                                                     */
+/******************************************************************************/
+   if (argc < 2) 
+   {
+       printf("usage : conv <file> [-rm] [-incdir <directory>] \n");
+       printf(" [-comdirin   <directory>] [-comdirout <directory>]\n");
+       printf(" [-convfile  <FILENAME >] -SubloopScalar -SubloopScalar1 \n"); 
+       printf(" -f77\n"); 
+       exit(0);
+   }
+
+
+   if ((yyin=fopen(argv[1],"r"))==NULL) 
+   {
+      printf("the file %s doesn't exist \n",argv[1]);
+      exit(0);    
+   }
+
+   i=2;
+   while (i<argc)
+   {
+      if (!strcasecmp(argv[i],"-incdir")) 
+      {
+         strcpy(nomdir,argv[i+1]);
+         i++;
+      }
+      else if (!strcasecmp(argv[i],"-comdirin")) /* input directory           */
+      {     
+         strcpy(commondirin,argv[i+1]);
+         i++;
+      }
+      else if (!strcasecmp(argv[i],"-comdirout")) /* output directory         */
+      {
+         strcpy(commondirout,argv[i+1]);
+         i++;
+      }      
+      else if (!strcasecmp(argv[i],"-convfile")) /* file to parse             */
+      {     
+         strcpy(filetoparse,argv[i+1]);
+         i++;
+      }   
+      else if (!strcasecmp(argv[i],"-f77")) /* fortran 77 file to parse       */
+      {     
+         fortran77 = 1 ;
+      }   
+      else if (!strcasecmp(argv[i],"-SubloopScalar")) /* file to parse        */
+      {     
+         SubloopScalar = 1 ;
+      }   
+      else if (!strcasecmp(argv[i],"-SubloopScalar1")) /* file to parse       */
+      {     
+         SubloopScalar = 2 ;
+      }   
+      else if (!strcasecmp(argv[i],"-rm")) 
+      {     
+         checkexistcommon=0;
+      }
+      else 
+      {
+         printf("Unkwon option : %s\n",argv[i]);
+         exit(0);
+      }
+      i++;       
+   }  
+
+/******************************************************************************/
+/*  3-  Parsing of the  conv file <name>.in                                   */
+/******************************************************************************/
+
+   if ((yyin=fopen(argv[1],"r"))==NULL) 
+   {
+       printf("the file %s doesn't exist \n",argv[1]);
+       exit(0);    
+   }
+   strcpy(mainfile,argv[1]);    
+
+   yyparse();
+
+/******************************************************************************/
+/*  4-  Preparation of the file parsing                                       */
+/******************************************************************************/
+   if ((yyin=fopen(filetoparse,"r"))==NULL) /* Is the file to parse exist ?   */
+   {
+      printf("the file %s doesn't exist \n",filetoparse);
+      exit(0);    
+   }
+   /* NameTamponfile : the name of the model file extract from the name       */
+   /*    of agrif_module_<NameTamponfile>                                     */
+   tmp = strchr(filetoparse, '.');
+   NameTamponfile=(char *)malloc(
+                              (strlen(filetoparse)-strlen(tmp)+1)*sizeof(char));
+   strncpy(NameTamponfile,filetoparse,strlen(filetoparse)-strlen(tmp)+1);
+   strcpy (&NameTamponfile[strlen(filetoparse)-strlen(tmp)], "\0");
+   /* mainfile : the name of the file to parse                                */
+   strcpy(mainfile,filetoparse);    
+   /* We should verify that this file has not been read before                */
+   /* if it is the case we record the old globliste in the tmplocallist       */
+   tmplocallist = NULL;
+   tmpuselocallist = NULL;
+   Did_filetoparse_treated = Did_filetoparse_readed(NameTamponfile);
+   /* if  Did_filetoparse_treated = 1 then the file to parse has been treated */
+   if ( Did_filetoparse_treated == 0 ) 
+   {
+     /* if the filetoparse has not been treated, we should know the last      */
+     /*    tabvars indices which has been used                                */
+     if ((dependglobaloutput=fopen(".dependglobal","r"))!=NULL) 
+     {
+        fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars);
+        fclose(dependglobaloutput);
+        oldindicemaxtabvars = indicemaxtabvars;
+     }
+   }   
+   /* Write the .dependnbxnby file which contains indices of nbmaillsX,       */
+   /*    nbmailleY and nbmailleZ                                              */
+   Readthedependnbxnbyfile();
+
+/******************************************************************************/
+/*  4-  Parsing of the input file (2 times)                                   */
+/******************************************************************************/
+
+   firstpass = 1; 
+   processfortran(filetoparse); 
+   firstpass = 0; 
+   processfortran(filetoparse);
+
+/******************************************************************************/
+/*  5-  Write informations in output files                                    */
+/******************************************************************************/
+
+   if ( Did_filetoparse_treated == 0 ) /* if the file has never been treated  */
+   {
+      /* Write the .dependglobal file which contain the max indice            */
+      /*    of the tabvars table                                              */
+      dependglobaloutput = fopen(".dependglobal","w");
+      fprintf(dependglobaloutput,"%d\n",indicemaxtabvars);
+      fclose(dependglobaloutput);
+      /* Write the .depend<namefile> file which contain general informations  */
+      /*    about variable of this file                                       */
+      parcours = modulelist;
+      while( parcours )
+      {
+         Writethedependfile(parcours->nom,globliste);
+         parcours=parcours->suiv;
+      }
+   }
+
+/******************************************************************************/
+/*  7-  Remove the non grid dependent variables                               */
+/******************************************************************************/
+
+   /* we should remove from the globliste the non grid dependent variables    */
+   RemoveNotgriddependFromGlobliste();
+
+/******************************************************************************/
+/*  8-  Write informations in output files                                    */
+/******************************************************************************/
+
+   /* if this file has been treated in past called,                           */
+   /*    we should compare the old parsing (record in the tmplocallist)       */
+   /*    and the new one contained in the globliste                           */
+   if ( Did_filetoparse_treated == 1 ) 
+   {
+      parcours = modulelist;
+      while( parcours )
+      {
+         Recordtmplocallist(parcours->nom);
+         parcours=parcours->suiv;
+      }
+      /* if the filetoparse has not been treated, we should know              */
+      /*    the last tabvars indices which has been used                      */
+     if ((dependglobaloutput=fopen(".dependglobal","r"))!=NULL) 
+     {
+        fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars);
+        fclose(dependglobaloutput);
+        oldindicemaxtabvars = indicemaxtabvars;
+     }
+     /* Read the list of available indice                                     */
+     Readthedependavailablefile();
+     /* the old treatement has been recorded in the tmplocallist              */
+     /* Now we should compare the old treatement with the new one             */
+/*mazauric for each module */
+     CompareNewparsingandoldone();
+     /* Write the .dependglobal file which contain general informations       */
+     /*    about globlist                                                     */
+     dependglobaloutput = fopen(".dependglobal","w");
+     fprintf(dependglobaloutput,"%d\n",indicemaxtabvars);
+     fclose(dependglobaloutput);
+     /* Write the list of available indice                                    */
+     Writethedependavailablefile();  
+     /* Write the .depend<namefile> file which contain general                */
+     /*    informations about variable of this file                           */
+     parcours = modulelist;
+     while( parcours )
+     {
+        Writethedependfile(parcours->nom,globliste);
+        parcours=parcours->suiv;
+     }
+     /* Write the .dependnbxnby file which contains indices of nbmaillsX,     */
+     /*    nbmailleY and nbmailleZ                                            */
+     Writethedependnbxnbyfile();
+   }
+   /* Write the .dependnbxnby file which contains indices of nbmaillsX,       */
+   /*    nbmailleY and nbmailleZ                                              */
+   Writethedependnbxnbyfile();
+   /* Write the list of module used in this file                              */
+   Writethedependlistofmoduleused(NameTamponfile);
+   WritedependParameterList(NameTamponfile);
+/******************************************************************************/
+/*  8-  Create files in AGRIF_INC directory                                   */
+/******************************************************************************/
+   creefichieramr(NameTamponfile);
+   return 0;
+}
Index: /trunk/AGRIF/LIB/decl.h
===================================================================
--- /trunk/AGRIF/LIB/decl.h	(revision 396)
+++ /trunk/AGRIF/LIB/decl.h	(revision 396)
@@ -0,0 +1,652 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#define LONGNOM 800
+#define LONGLIGNE 800
+
+/******************************************************************************/
+/*********** Declaration of structures used in conv ***************************/
+/******************************************************************************/
+
+typedef struct 
+{
+   char first[LONGNOM];
+   char last[LONGNOM];
+} typedim ;                /* fortran dimension as 'ndeb:nfin'                */
+
+typedef struct listdim 
+{   
+   typedim dim;
+   struct listdim *suiv;
+} listdim;                 /* list of the dimensions of a variable            */
+      
+typedef struct variable 
+{
+   char typevar[LONGNOM];
+   char nomvar[LONGNOM] ;
+   char oldname[LONGNOM] ;
+   char dimchar[LONGNOM];
+   listdim *dimension;
+   int nbdim;
+   struct variable *vinit;
+   int common;
+   int positioninblock;
+   int module; 
+   int save;
+   int VariableIsParameter;
+   int PublicDeclare;
+   int PrivateDeclare;
+   int ExternalDeclare;
+   char modulename[LONGNOM]; 
+   char commonname[LONGNOM];
+   char vallengspec[LONGNOM];
+   char nameinttypename[LONGNOM];
+   int lengspecgiven;
+   int pointedvar;
+   char commoninfile[LONGNOM];
+   char subroutinename[LONGNOM];
+   int dimensiongiven;
+   int c_star;
+   int typegiven;
+   int isparameter;
+   char precision[LONGNOM]; 
+   char initialvalue[LONGNOM]; 
+   int indicetabvars; 
+   int pointerdeclare; 
+   int optionaldeclare;
+   int allocatable; 
+   char IntentSpec[LONGNOM];    
+   int dimsempty;
+   char readedlistdimension[LONGNOM];    
+} variable ;               /* type of a variable                              */
+                           /* typevar : type (integer, real, ...)             */
+                           /* nomvar : name of the variable                   */
+                           /* dimension : list of dimensions of the variable  */ 
+                           /* nbdim: 1 if the variable is 1d, etc ...         */
+                           /* precision : Name of the variable which          */
+                           /* determine the precision. example : wp in the    */
+                           /* case where REAL(wp)                             */
+         
+typedef struct listvar
+{
+   variable *var ;
+   struct listvar * suiv;
+} listvar ;                /* list of variables                               */
+  
+
+typedef struct listvarcommon
+{
+   char nomvar[LONGNOM] ;
+   char commonname[LONGNOM];
+   char commoninfile[LONGNOM];
+   char subroutinename[LONGNOM];
+   int dimensiongiven;
+   int nbdim;
+   int indicetabvars;
+   int positioninblock;
+   listdim *dimension;
+   char readedlistdimension[LONGNOM];    
+   struct listvarcommon * suiv;
+} listvarcommon ;          /* list of variables in common block               */
+  
+
+typedef struct listusemodule 
+{
+   char usemodule[LONGNOM];
+   char charusemodule[LONGNOM];
+   char cursubroutine[LONGNOM];
+   int firstuse;
+   struct listusemodule * suiv;
+} listusemodule;           /* list of names                                   */
+
+typedef struct listparameter
+{
+   char name[LONGNOM];
+   char modulename[LONGNOM];
+   struct listparameter * suiv;
+} listparameter ;           /* list of names                                  */
+
+typedef struct listnamelist
+{
+   char name[LONGNOM];
+   struct listnamelist * suiv;
+} listnamelist ;            /* list of names                                  */
+
+typedef struct listname
+{
+   char name[LONGNOM];
+   struct  listname* suiv;
+} listname ;            /* list of names                                  */
+
+listname *listimplicitnone;
+
+typedef struct listmodule 
+{
+   char module[LONGNOM];
+   int InstanceShouldMade;
+   int Instance;
+   struct listmodule * suiv;
+} listmodule;              /* list of names                                   */
+
+
+
+typedef struct listcouple 
+{
+   char namevar[LONGNOM];
+   char namepointedvar[LONGNOM];
+   struct listcouple * suiv;
+} listcouple;              /* list of names                                   */
+
+
+typedef struct listnom 
+{
+   char nom[LONGNOM];
+   listcouple *couple;
+   struct listnom * suiv;
+} listnom;                 /* list of names                                   */
+
+
+typedef struct listallocate 
+{
+   char nomvar[LONGNOM];
+   char subroutine[LONGNOM];
+   char module[LONGNOM];
+   struct listallocate * suiv;
+} listallocate ;
+
+ 
+typedef struct listvarpointtovar 
+{
+   char usemodule[LONGNOM];
+   char cursubroutine[LONGNOM];
+   listcouple *couple;
+   struct  listvarpointtovar* suiv;
+}listvarpointtovar ;       /* list of names                                   */
+
+
+typedef struct listindice 
+{
+   int indice;
+   struct  listindice * suiv;
+} listindice;              /* list of indiced                                 */
+ 
+
+typedef struct listparameters 
+{
+   char initial[LONGNOM];
+   char nom[LONGNOM];
+   char subroutinename[LONGNOM];
+   struct listparameters * suiv;
+ } listparameters;         /* list of parameters                              */
+
+typedef struct 
+{
+   char name[LONGNOM];
+   char filename[LONGNOM];
+   int inclcommon;
+   listvar *lvar;
+} common;
+
+typedef struct listcommons
+{
+ common *curcommon ;
+ struct listcommons *suiv;
+} listcommons ;
+
+
+typedef struct listcommonsname
+{
+ char nom[LONGNOM] ;
+ listnom *subroutine;
+ struct listcommonsname *suiv;
+} listcommonsname ;
+
+
+
+ int fortran77;            /* = 1; the code has been writen in                */
+                           /*    fortran77 else in fortran 90                 */
+/******************************************************************************/
+/****************   *** COMMON Variables ***  *********************************/
+/******************************************************************************/
+
+ int positioninblock;
+ char commonvar[LONGNOM];
+ char commonblockname[LONGNOM];
+ listdim *commondim;
+
+/******************************************************************************/
+/****************   *** AGRIF Variables ***   *********************************/
+/******************************************************************************/
+ int inagrifcallargument;
+ int adduseagrifutil;
+
+ int InAgrifParentDef;
+
+/******************************************************************************/
+/****************   *** VAR DEF Variables ***   *******************************/
+/******************************************************************************/
+ int oldindicemaxtabvars;  /* Number of variables in the model i.e. last      */
+ int indicemaxtabvars;     /* Number of variables in the model i.e. last      */
+                           /*    indice used in  the tabvars table            */
+ int PublicDeclare;        /* Variable has been declared as PUBLIC */ 
+ int PrivateDeclare;       /* Variable has been declared as PRIVATE */ 
+ int ExternalDeclare;      /* Variable has been declared as EXTERNAL */ 
+ int PrecisionGiven;       /* A precision has been given for the variable */ 
+ int CharacterSizeGiven;   /* A size for the character has been given */ 
+ int InitialValueGiven;    /* An initial value has been given */ 
+ int formatdeclare;
+ int inttypename;
+ int Allocatabledeclare;
+ int lengspecgiven;
+ int SaveDeclare;
+ int pointerdeclare;
+ int optionaldeclare;
+ int VariableIsParameter; 
+ int dimsgiven;
+ int IntentDeclare;
+ int c_star;
+ char DeclType[LONGNOM]; 
+ char nameinttypename[LONGNOM]; 
+ char InitValue[LONGNOM*2]; 
+ char IntentSpec[LONGNOM];
+ char NamePrecision[LONGNOM]; 
+ char CharacterSize[LONGNOM]; 
+ char curmodulename[LONGNOM];
+ char vallengspec[LONGNOM];
+ char subroutinename[LONGNOM];
+
+/******************************************************************************/
+/****************   *** TOAMR Variables ***   *********************************/
+/******************************************************************************/
+ char Alloctreatedname[LONGNOM];
+
+/******************************************************************************/
+/****************   *** CONV Variables ***   **********************************/
+/******************************************************************************/
+ int coeffrafx;            /* space refinement factor in the x                */
+ int coeffrafy;            /* space refinement factor in the y                */ 
+ int coeffrafz;            /* space refinement factor in the z                */
+ int coeffraftx;           /* time refinement factor in the x                 */
+ int coeffrafty;           /* time refinement factor in the y                 */
+ int coeffraftz;           /* time refinement factor in the z                 */
+ int regridding;           /* number of time steps between two regridding     */
+ int dimprob ;             /* dimension of the problem : 1 for 1D,2 for 2D,   */
+                           /*    3 for 3D                                     */
+ int rafmaxx;
+ int rafmaxy;
+ int rafmaxz;
+ int userefficiency;       /* = 1 efficiency is given in the input            */
+ int minwidth;             /* minimum width of the rectangles in the          */
+                           /*    clustering algorithm                         */
+ int onlyfixedgrids;       /* = 1 if onlyfixedgrids is true                   */
+ int todebug;
+ int fixedgrids;           /* = 1 if fixedgrids is true                       */
+ int efficiency;           /* efficacity of the clustering algorithm          */
+                           /*    (by percent)                                 */
+ char nbmaillesX[LONGNOM]; /* number of cells in the x direction              */
+ char nbmaillesY[LONGNOM]; /* number of cells in the y direction              */
+ char nbmaillesZ[LONGNOM]; /* number of cells in the z direction              */
+ int IndicenbmaillesX;
+ int IndicenbmaillesY;
+ int IndicenbmaillesZ;
+
+ listvar *listvartempo;
+ variable *variabletempo;
+
+ listdim *curdim;
+ variable *curvar;
+ listvar *globliste;
+ listvar *globvarforcommon;
+ listvar *globparam;
+ listvar *listdatavariable;
+ listvar *listargsubroutine;
+ listvar *varofsubroutineliste;
+ listvar *varsubroutine;
+ listvar *listvarindoloop;
+ listvar *finglobliste;
+ listvar *tmplocallist;
+ listvar *parameterlist;
+ listvar *globalvarofusefile2;
+ listvar *globalvarofusefile;
+ listvar *functionlistvar;
+ listvar *listenotgriddepend; /* List of the variables which are not grid dependent */
+ listvarcommon *commonlist;
+ listusemodule *listofmodulebysubroutine;
+ listusemodule *listofincludebysubroutine;
+ listusemodule *listofmoduletmp;
+ listusemodule *tmpuselocallist;
+ listparameter *tmpparameterlocallist2;
+ listparameter *tmpparameterlocallist;
+ listmodule *listmoduleinfile;
+ listnamelist *listenamelist;
+ listnom *NewModuleList;
+ listnom *listofmodules;
+ listnom *modulelist;
+ listnom *Listofvariableinagriffunction;
+ listnom *listofsubroutinewhereagrifisused;
+ listallocate *AllocateList;
+ listvarpointtovar *Listofvarpointtovar; 
+                           /*  variables which are pointed to an other one    */
+ listindice *Listofavailableindices; 
+                           /* List of available indices in the tabvars table  */
+ int indeclarationvar;
+ int inmodulemeet;
+ int incalldeclare;
+ int Did_filetoparse_treated;
+ int aftercontainsdeclare; /* Signale si l'on vient d'un contains ou non */
+ int colnum;
+ int callagrifinitgrids;
+ int callmpiinit;
+ int firstpass;
+ int listofvarofusemodulecreated;
+ int couldaddvariable;
+ int Savemeet;
+ int pointedvar;
+ int agrif_parentcall;
+ int didvariableadded;
+ int infunctiondeclare;
+ int SubloopScalar;        /* =1 we should put in argument of sub_loop        */
+                           /*    only                                         */
+                           /*    scalar and not table u(1,1,1) in place of u  */
+ int checkexistcommon;
+ int insubroutinedeclare;
+ int tmpdeclaration_everdone;
+ char meetagrifinitgrids[LONGNOM];
+ char meetmpiinit[LONGNOM];
+ char mpiinitvar[LONGNOM];
+ int paramdeclaration_everdone;
+ int inmoduledeclare;
+ int IntegerIShouldBeAdd;
+ int AllocEmpty;
+ int dimsempty;
+ char *NameTamponfile;
+ char toprintglob[LONGNOM];
+ char recorddimension[LONGNOM];
+ char tmpvargridname[LONGLIGNE];
+ char curdimchar[10];
+ char OriginalFileName[LONGNOM]; /* Name of the parsing file*/ 
+ char EmptyChar[LONGNOM];        /* An empty char */ 
+ char commonfile[LONGNOM];
+ char curfilename[LONGNOM];
+ char commonfile_main[LONGNOM];  /* name of the common file */
+ char nomfileoutput[LONGNOM];
+ char curbuf[100*LONGNOM];
+ char motparse[LONGNOM];
+ char charusemodule[LONGNOM];
+ char subofagrifinitgrids[LONGNOM];
+ char motparse1[LONGNOM];
+ char curfile[LONGNOM];         /* name of the current file */
+ char mainfile[LONGNOM];        /* name of the configuration file */
+ char nomdir[LONGNOM];          /* name of the directory where include files are put */
+ char commondirout[LONGNOM];    /* name of the directory where comon files are put */
+ char commondirin[LONGNOM];     /* name of the directory containing the common files */
+ char filetoparse[LONGNOM];     /* name of the file where all the module file are listed */ 
+
+ FILE *fortranout; /* Output File */
+ FILE *fortranin; /* Input File */
+ FILE *oldfortranout;
+ FILE *subloop;
+ FILE *commontomoduleout;
+ FILE *paramtomoduleout;
+ FILE *inputmodule;
+ FILE *allocationagrif;
+
+ long int pos_cur;         /* current position in the output file             */
+ long int pos_curagrifparent;
+                           /* current position in the output file             */
+ long int pos_curcall;     /* current position in the output file             */
+ long int pos_curuse;      /* current position in the output file             */
+ long int pos_cur_decl;    /* current position in the output file             */
+ long int pos_curdata;     /* current position in the output file             */
+ long int pos_curparameter;/* current position in the output file             */
+ long int pos_curcommon;   /* current position in the output file             */
+ long int pos_curinit;     /* current position in the output file             */
+ long int pos_curinclude;  /* final position of a line in file                */
+ long int pos_end;         /* final position of a line in file                */
+
+
+/******************************************************************************/
+/*********** Declaration of externals subroutines *****************************/
+/***************************************************** ************************/
+
+/******************************************************************************/
+/*********** UtilNotGridDep.c *************************************************/
+/******************************************************************************/
+extern void ajoutenotgriddep (char *name);
+extern void RemoveNotgriddependFromGlobliste();
+extern int VarIsNonGridDepend(char *name);
+extern void DECL_0_NonGridDepDeclaration(listvar *listtomodify);
+/******************************************************************************/
+/*********** WriteInFile.c ****************************************************/
+/******************************************************************************/
+extern void tofich_reste (FILE * filout, char *s,int returnlineornot);
+extern void tofich (FILE * filout, char *s,int returnlineornot);
+extern void tofich_blanc (FILE * filout, int size);
+extern void RemoveWordCUR(FILE * filout, long int position, 
+                                         long int sizetoremove);
+extern void RemoveWordSET(FILE * filout, long int position, 
+                                         long int sizetoremove);
+/******************************************************************************/
+/*********** Writedeclarations.c **********************************************/
+/******************************************************************************/
+extern void WriteBeginDeclaration(variable *v,char ligne[LONGLIGNE]);
+extern void WriteScalarDeclaration(variable *v,char ligne[LONGLIGNE]);
+extern void WriteTableDeclaration(variable * v,char ligne[LONGLIGNE],int tmpok);
+extern void ModifTableDeclaration(variable * v,char ligne[LONGLIGNE]);
+extern void writevardeclaration (listvar * var_record, FILE *fileout);
+extern void NonGridDepDeclaration(listvar * deb_common);
+extern void writedeclaration (listvar * deb_common, FILE *fileout, 
+                                                    listvar *presentinthislist);
+extern void writesub_loopdeclaration (listvar * deb_common, FILE *fileout);
+extern void writedeclarationintoamr (listvar * deb_common, FILE *fileout,
+                                    listvar *listin , char commonname[LONGNOM]);
+extern void  writedeclarationsubroutinedeclaration(listvar * deb_common,
+                                                 FILE *fileout,listvar *listin);
+/******************************************************************************/
+/*********** WorkWithvarofsubroutineliste.c ***********************************/
+/******************************************************************************/
+extern void CleanThelistvarofsubroutineliste();
+extern void UpdatevarofsubroutinelisteWithcommonlist();
+extern void OPTI_1_ajoutvarofsubroutine(listvar *listtoadd);
+extern void COM_1_UpdatevarsubroutineWithvarofsubroutinelist();
+/******************************************************************************/
+/*********** toamr.c **********************************************************/
+/******************************************************************************/
+extern char *variablenameroottabvars (variable * var);
+extern char *variablenametabvars (variable * var, int iorindice);
+extern char *variablecurgridtabvars (variable * var,int ParentOrCurgrid);
+extern char *vargridnametabvars (variable * var,int iorindice);
+extern char *vargridcurgridtabvars (variable * var,int ParentOrCurgrid);
+extern char *vargridparam (variable * v, int whichone);
+extern void write_probdimagrif_file();
+extern void write_includeagrif_file();
+extern void write_keysagrif_file();
+extern void write_clusteringagrif_file();
+extern void write_modtypeagrif_file();
+extern void write_createvarnameagrif_file(variable *v,FILE *createvarname,
+                                                                int *InitEmpty);
+extern void write_Setnumberofcells_file();
+extern void write_Getnumberofcells_file();
+extern void write_initialisationsagrif_file(variable *v,FILE *initproc,
+                                     int *VarnameEmpty);
+extern listnom *write_allocation(listvar *newvar,variable *v,
+                          listnom *listedesnoms,
+                          FILE *alloccalls,
+                          FILE *instanceUSE,
+                          FILE *modulealloc,
+                          int *IndiceMax);
+extern void creefichieramr (char *NameTampon);
+/******************************************************************************/
+/*********** dependfile.c *****************************************************/
+/******************************************************************************/
+extern void Writethedependnbxnbyfile_fromgloliste();
+extern void Readthedependnbxnbyfile_fromgloliste();
+extern void Writethedependlistofmoduleused(char *NameTampon );
+extern void Readthedependlistofmoduleused(char *NameTampon);
+extern void WritedependParameterList(char *NameTampon );
+extern listparameter *ReaddependParameterList(char *NameTampon, 
+                                                        listparameter *listout);
+extern void Writethedependfile(char *NameTampon, listvar *input );
+extern void Recordtmplocallist( char *NameTampon);
+extern listvar *Recordglobalvarofusefile( char *NameTampon , listvar *listout);
+extern void Writethedependavailablefile();
+extern void Readthedependavailablefile();
+extern int Did_filetoparse_readed(char *NameTampon);
+/******************************************************************************/
+/*********** SubLoopCreation.c ************************************************/
+/******************************************************************************/
+extern void OPTI_0_writeheadnewsubforsub();
+extern void OPTI_0_writeheadnewsubforfunc();
+extern void OPTI_0_writesubroutinedeclaration(listvar *listtomodify);
+extern void  WriteVariablelist_subloop(FILE *outputfile);
+extern void  WriteVariablelist_subloop_Call(FILE *outputfile);
+extern void  WriteVariablelist_subloop_Def(FILE *outputfile);
+extern void  WriteHeadofSubroutineLoop();
+extern void OPTI_0_closeandcallsubloopandincludeit(int suborfun, 
+                                   char endsub[LONGNOM], char optname[LONGNOM]);
+/******************************************************************************/
+/*********** WorkWithglobliste.c **********************************************/
+/******************************************************************************/
+extern void CompareNewparsingandoldone();
+extern void decl_1_ajoutevar(listvar *listtoadd);
+extern void decl_1_ajoutevarsave(listvar *listtoadd);
+extern void UpdateIndiceTabvarsofGlobliste();
+extern void UpdateIndiceTabvarsofGloblisteFromCommon();
+extern void COM_1_UpdateGloblisteWithcommonlist();
+/******************************************************************************/
+/*********** WorkWithlistvarindoloop.c ****************************************/
+/******************************************************************************/
+extern void OPTI_1_cleanlistvarfordoloop(int endsuborfunc);
+extern void OPTI_1_ajoutevarindoloop(char *ident);
+extern void ajoutevarindoloop (char *name);
+extern void ajoutevarindoloop_definedimension (char *name);
+extern void CleanFromThelistvarindoloopTheAgrifSubArguments();
+extern void CleanThelistvarindoloop ();
+extern void ModifyThelistvarindoloop();
+extern void CompleteThelistvarindoloop();
+/******************************************************************************/
+/*********** test.c ***********************************************************/
+/******************************************************************************/
+extern int tests_entrees();
+/******************************************************************************/
+/*********** WorkWithlistdatavariable.c ***************************************/
+/******************************************************************************/
+extern void DATA_n_CompleteDataList (char *name,char *values);
+extern void DATA_1_CompleteGlobListeWithDatalist ();
+/******************************************************************************/
+/*********** UtilAgrif.c ******************************************************/
+/******************************************************************************/
+extern int AGRIF_n_Vartonumber(char *tokname);
+extern int AGRIF_n_Agrif_in_Tok_NAME(char *tokname);
+extern void AGRIF_1_completeListofvariableinagriffunction(char *ident);
+extern void AGRIF_0_ModifyTheVariableName(char *ident);
+extern void AGRIF_n_AddsubroutineTolistsubwhereagrifused();
+extern void AGRIF_n_AddUseAgrifUtil();
+extern void AGRIF_0_NotifyAgrifFunction(char *ident);
+extern void AGRIF_0_ModifyTheAgrifFunction(char *ident);
+extern void AGRIF_0_AgriffunctionModify(char *ident,int whichone);
+extern void AGRIF_0_AddUseAgrifInModuleDeclaration();
+/******************************************************************************/
+/*********** WorkWithParameterlist.c ******************************************/
+/******************************************************************************/
+extern void COM_1_AddvartoParamlist(listvar *listin);
+extern void COM_1_UpdateparameterlistWithlistvarindoloop();
+/******************************************************************************/
+/*********** WorkWithAllocatelist.c *******************************************/
+/******************************************************************************/
+extern void OPTI_1_AddIdentToTheAllocateList(char *nom);
+extern int OPTI_0_IsAllocateInThisSubroutine();
+extern int OPTI_0_IsVarAllocatable(char *ident);
+extern int OPTI_0_varisallocatable(char *ident);
+/******************************************************************************/
+/*********** UtilCharacter.c **************************************************/
+/******************************************************************************/
+extern void FindAndChangeNameToTabvars(char name[LONGNOM],
+                char toprint[LONGNOM],listvar * listtosee, int ParentOrCurgrid);
+extern char *ChangeTheInitalvaluebyTabvarsName(char *nom,listvar *listtoread,
+                                                                  int whichone);
+extern void IsVarInUseFile(char *nom);
+extern listnom *DecomposeTheNameinlistnom(char *nom, listnom * listout);
+extern void DecomposeTheName(char *nom);
+/******************************************************************************/
+/*********** UtilListe.c ******************************************************/
+/******************************************************************************/
+extern listvar *AddListvarToListvar(listvar *l,listvar *glob,
+                                                            int ValueFirstpass);
+extern void CreateAndFillin_Curvar(char *type,char *tokname,
+                                                listdim *dims,variable *curvar);
+extern listvar *duplicatelistvar(listvar * orig);
+extern listdim *insertdim(listdim *lin,typedim nom);
+extern listdim *reverse(listdim *lin);
+extern void change_dim_char(listdim *lin,listvar * l);
+extern int num_dims(listdim *d);
+extern variable *createvar(char *nom,listdim *d);
+extern listvar *insertvar(listvar *lin,variable *v);
+extern listvar *settype(char *nom,listvar *lin);
+/******************************************************************************/
+/*********** UtilFile.c *******************************************************/
+/******************************************************************************/
+extern FILE * associate (char *filename);
+extern FILE * associateaplus (char *filename);
+extern long int setposcur();
+extern long int setposcurinoldfortranout();
+extern void decl_0_modifdeclarationssave(listvar *listtomodify);
+extern void OPTI_0_copyuse(char *namemodule);
+extern void OPTI_0_copyuseonly(char *namemodule);
+/******************************************************************************/
+/*********** WorkWithlistofmodulebysubroutine.c *******************************/
+/******************************************************************************/
+extern void RecordUseModulesVariables();
+extern void  RecordUseModulesUseModulesVariables();
+extern void Addmoduletothelist(char *name);
+extern void WriteUsemoduleDeclaration();
+/******************************************************************************/
+/*********** WorkWithlistmoduleinfile.c ***************************************/
+/******************************************************************************/
+extern void MOD_1_FillInlistmodule();
+extern void MOD_1_InstanceShouldMadeTo0InModule();
+extern void MOD_1_InstanceShouldMadeTo1InModule();
+extern void MOD_1_InstanceTo1InModule();
+extern int MOD_n_InstanceShouldMadeInModule();
+extern int MOD_n_InstanceInModule();
+/******************************************************************************/
+/*********** UtilFortran.c ****************************************************/
+/******************************************************************************/
+extern void initdimprob(int dimprobmod, char * nx, char * ny,char* nz);
+extern int Variableshouldberemove(char *nom);
+extern int variableisglobal(listvar *curvar, listvar *listin);
+extern int variableisparameterglobal(listvar *curvar, listparameter *listin);
+extern void addi_0_addsubroutine_inst_back_alloc(int moduleorcontains);
+extern int OPTI_0_IsTabvarsUseInArgument();
+extern int ImplicitNoneInSubroutine();
+extern int OPTI_0_varispointer(char *ident);
+/******************************************************************************/
+/*********** DiversListe.c ****************************************************/
+/******************************************************************************/
+extern void COM_1_AddCommonvartolist();
+extern listnom *Addtolistnom(char *nom, listnom *listin);
+extern listname *Add_listname(char *nom,listname *input);
+extern void Add_ModuleTo_listofmodules(char *nom);
+extern int ModuleIsDefineInInputFile(char *name);
+extern void AddNameToListNamelist(char * name);
+extern void Addmoduletothelisttmp(char *name);
+extern void Add_ModuleTo_Modulelist(char *nom);
+extern void OPTI_1_completelistvarpointtovar(char *namemodule,
+                                                            listcouple *couple);
+extern void Addincludetothelist(char *name);
+extern void WriteIncludeDeclaration();
+/******************************************************************************/
+extern void processfortran(char *fichier_entree);
Index: /trunk/AGRIF/LIB/dependfile.c
===================================================================
--- /trunk/AGRIF/LIB/dependfile.c	(revision 396)
+++ /trunk/AGRIF/LIB/dependfile.c	(revision 396)
@@ -0,0 +1,720 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decl.h"
+
+
+/******************************************************************************/
+/*            Creation and modification of .dependfile                        */
+/******************************************************************************/
+/*  .dependnbxnby            : this file contains tabvars indices of variables*/
+/*                                given in agrif.in as number of cells        */
+/*  .dependuse<module>       : this file contains all modules used in the     */
+/*                                current file                                */
+/*  .dependparameter<module> : this file contains all parmeters defined in    */
+/*                                the current file                            */
+/*  .depend<module name>     : this file contains all globals variables       */
+/*                                informations (name, dim, etc ...)           */
+/*  .dependavailable         : this file contains all tabvars indices which   */
+/*                                are not used.                               */
+/******************************************************************************/
+
+
+/******************************************************************************/
+/*                 Writethedependnbxnbyfile                                   */
+/******************************************************************************/
+/* This subroutine is used to create the .dependnbxnby                        */
+/******************************************************************************/
+/*                                                                            */
+/*                     .dependnbxnby                                          */
+/*                                                                            */
+/*                     nbmaillesX                                             */
+/*                     nbmaillesY                                             */
+/*                     nbmaillesZ                                             */
+/*                                                                            */
+/******************************************************************************/
+void Writethedependnbxnbyfile()
+{
+  FILE *dependfileoutput;
+  listvar *parcours;
+  int out;
+   
+  /* We are looking for all the variable of the current filetoparse file      */
+  /*    in the globliste                                                      */
+  parcours =globliste;
+  out = 0;
+  while (parcours && out == 0 )
+  {
+     if ( !strcasecmp(parcours->var->nomvar,nbmaillesX) ) out = 1;
+     else parcours = parcours->suiv;
+  }
+  if ( out == 1 ) 
+  {
+     dependfileoutput = fopen(".dependnbxnby","w");
+     fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
+     IndicenbmaillesX = parcours->var->indicetabvars;
+
+     if ( dimprob > 1 )
+     {
+        parcours =globliste;
+        out = 0;
+        while (parcours && out == 0 )
+        {
+           if ( !strcasecmp(parcours->var->nomvar,nbmaillesY) ) out = 1;
+           else parcours = parcours->suiv;
+        }
+        if ( out == 1 ) 
+        {
+           fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
+           IndicenbmaillesY = parcours->var->indicetabvars;
+        }
+     }
+
+     if ( dimprob > 2 )
+     {
+        parcours =globliste;
+        out = 0;
+        while (parcours && out == 0 )
+        {
+           if ( !strcasecmp(parcours->var->nomvar,nbmaillesZ) ) out = 1;
+           else parcours = parcours->suiv;
+        }
+        if ( out == 1 ) 
+        {
+           fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
+           IndicenbmaillesZ = parcours->var->indicetabvars;
+        }
+     }
+
+     if ( out == 1 ) fclose(dependfileoutput);
+   }
+}
+
+/******************************************************************************/
+/*                 Readthedependnbxnbyfile                                    */
+/******************************************************************************/
+/* This subroutine is used to create the .dependnbxnby                        */
+/******************************************************************************/
+/*                                                                            */
+/*                     .dependnbxnby                                          */
+/*                                                                            */
+/*                     nbmaillesX                                             */
+/*                     nbmaillesY                                             */
+/*                     nbmaillesZ                                             */
+/*                                                                            */
+/******************************************************************************/
+void Readthedependnbxnbyfile()
+{
+  FILE *dependfileoutput;
+   
+  if ((dependfileoutput = fopen(".dependnbxnby","r"))!=NULL) 
+  {
+     fscanf(dependfileoutput,"%d\n",&IndicenbmaillesX);
+     if ( dimprob > 1 ) fscanf(dependfileoutput,"%d\n",&IndicenbmaillesY);
+     if ( dimprob > 2 ) fscanf(dependfileoutput,"%d\n",&IndicenbmaillesZ);
+     fclose(dependfileoutput);
+  }
+}
+
+/******************************************************************************/
+/*                     Writethedependlistofmoduleused                         */
+/******************************************************************************/
+/* This subroutine is used to create the .dependuse<module>                   */
+/******************************************************************************/
+/*                                                                            */
+/*               .dependuse<name>                                             */
+/*                                                                            */
+/*               mod1                                                         */
+/*               mod2                                                         */
+/*                                                                            */
+/******************************************************************************/
+void Writethedependlistofmoduleused(char *NameTampon )
+{
+  FILE *dependfileoutput;
+  listusemodule *parcours;
+  char ligne[LONGNOM];
+   
+  if ( listofmodulebysubroutine )
+  {
+     sprintf(ligne,".dependuse%s",NameTampon);
+     dependfileoutput = fopen(ligne,"w");
+     /* We are looking for all the variable of the current filetoparse file   */
+     /*    in the globliste                                                   */
+     parcours = listofmodulebysubroutine;
+     while (parcours)
+     {
+        fprintf(dependfileoutput,"%s\n",parcours->usemodule);
+        parcours = parcours->suiv;
+     }
+     fclose(dependfileoutput);
+  }
+}
+
+/******************************************************************************/
+/*                    Readthedependlistofmoduleused                           */
+/******************************************************************************/
+/* This subroutine is used to create the .dependuse<module>                   */
+/******************************************************************************/
+/*                                                                            */
+/*               .dependuse<name>                                             */
+/*                                                                            */
+/*               mod1                                                         */
+/*               mod2                                                         */
+/*                                                                            */
+/******************************************************************************/
+void Readthedependlistofmoduleused(char *NameTampon)
+{
+  FILE *dependfileoutput;
+  listusemodule *parcours;
+  char ligne[LONGNOM];
+
+  sprintf(ligne,".dependuse%s",NameTampon);
+  
+  tmpuselocallist = (listusemodule *)NULL;
+  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
+  {
+  }
+  else
+  {
+    /* if the file exist we should verify that this file has changed          */
+      while (!feof(dependfileoutput))
+      {
+         parcours=(listusemodule *)malloc(sizeof(listusemodule));
+         fscanf(dependfileoutput,"%s\n",parcours->usemodule);
+
+         parcours->suiv = tmpuselocallist;
+         tmpuselocallist = parcours;
+
+         parcours = NULL;
+      }
+      fclose(dependfileoutput);
+  }
+}
+
+
+/******************************************************************************/
+/*                        WritedependParameterList                            */
+/******************************************************************************/
+/* This subroutine is used to create the .dependparameter<name>               */
+/******************************************************************************/
+/*                                                                            */
+/*               .dependparameter<name>                                       */
+/*                                                                            */
+/*               mod1                                                         */
+/*               mod2                                                         */
+/*                                                                            */
+/******************************************************************************/
+void WritedependParameterList(char *NameTampon )
+{
+  FILE *dependfileoutput;
+  listvar *parcours;
+  char ligne[LONGNOM];
+   
+  if ( globparam )
+  {
+  sprintf(ligne,".dependparameter%s",NameTampon);
+  dependfileoutput = fopen(ligne,"w");
+
+  parcours =globparam;
+  while (parcours)
+  {
+     fprintf(dependfileoutput,"%s\n",parcours->var->nomvar);
+     fprintf(dependfileoutput,"%s\n",parcours->var->modulename);
+     parcours = parcours->suiv;
+  }
+  fclose(dependfileoutput);
+  }
+}
+
+
+/******************************************************************************/
+/*                         ReaddependParameterList                            */
+/******************************************************************************/
+/* This subroutine is used to create the .dependparameter<name>               */
+/******************************************************************************/
+/*                                                                            */
+/*               .dependparameter<name>                                       */
+/*                                                                            */
+/*               mod1                                                         */
+/*               mod2                                                         */
+/*                                                                            */
+/******************************************************************************/
+listparameter *ReaddependParameterList(char *NameTampon,listparameter *listout)
+{
+  FILE *dependfileoutput;
+  listparameter *parcours;
+  char ligne[LONGNOM];
+
+  sprintf(ligne,".dependparameter%s",NameTampon);
+
+  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
+  {
+  }
+  else
+  {
+    /* if the file exist we should verify that this file has changed          */
+      while (!feof(dependfileoutput))
+      {
+         parcours=(listparameter *)malloc(sizeof(listparameter));
+         fscanf(dependfileoutput,"%s\n",parcours->name);
+         fscanf(dependfileoutput,"%s\n",parcours->modulename);
+
+         parcours->suiv = listout;
+         listout = parcours;
+
+         parcours = NULL;
+      }
+      fclose(dependfileoutput);
+  }
+  return listout;
+}
+
+/******************************************************************************/
+/*                   Writethedependfile                                       */
+/******************************************************************************/
+/* This subroutine is used to create the .depend<name>                        */
+/******************************************************************************/
+/*                                                                            */
+/*                     .depend<name>                                          */
+/*                                                                            */
+/*                      REAL                                                  */
+/*                      Variable                                              */
+/*                      char dimension or T                                   */
+/*                      table dimension                                       */
+/*                      is type given                                         */
+/*                      precision or T                                        */
+/*                      initial value or T                                    */
+/*                      indice in the tabvars                                 */
+/*                      listdimension or T                                    */
+/*                      -------------------------                             */
+/*                                                                            */
+/******************************************************************************/
+void Writethedependfile(char *NameTampon, listvar *input )
+{
+  FILE *dependfileoutput;
+  listvar *parcours;
+  listdim *dims;
+  char ligne[LONGNOM];
+  char listdimension[LONGNOM];
+  char curname[LONGNOM];
+  int out;
+   
+  if ( input )
+  {
+  sprintf(ligne,".depend%s",NameTampon);
+  dependfileoutput = fopen(ligne,"w");
+  /* We are looking for all the variable of the current filetoparse file      */
+  /*    in the input                                                          */
+  parcours =input;
+  out = 0;
+  strcpy(curname,"");
+  while (parcours && out == 0 )
+  {
+     if ( !strcasecmp(parcours->var->modulename,NameTampon) ||
+          !strcasecmp(parcours->var->commonname,NameTampon) )
+     {
+        /*                                                                    */
+        if ( strcmp(curname,"") && 
+             !strcmp(curname,parcours->var->nomvar) ) out = 1 ;
+        if ( !strcmp(curname,"") ) strcpy(curname,parcours->var->nomvar);
+        /*                                                                    */
+        if ( out == 0 )
+        {
+           fprintf(dependfileoutput,"%s\n",parcours->var->typevar);
+           fprintf(dependfileoutput,"%s\n",parcours->var->nomvar);
+           if ( strcasecmp(parcours->var->dimchar,"") )
+           {
+              fprintf(dependfileoutput,"%s\n",parcours->var->dimchar);
+           }
+           else
+           {
+              fprintf(dependfileoutput,"T\n");
+           }
+           if ( strcasecmp(parcours->var->commoninfile,"") )
+           {
+              fprintf(dependfileoutput,"%s\n",parcours->var->commoninfile);
+           }
+           else
+           {
+              fprintf(dependfileoutput,"T\n");
+           }
+           if ( strcasecmp(parcours->var->commonname,"") )
+           {
+              fprintf(dependfileoutput,"%s\n",parcours->var->commonname);
+           }
+           else
+           {
+              fprintf(dependfileoutput,"T\n");
+           }
+           fprintf(dependfileoutput,"%d\n",parcours->var->nbdim);
+           fprintf(dependfileoutput,"%d\n",parcours->var->dimensiongiven);
+           fprintf(dependfileoutput,"%d\n",parcours->var->typegiven);
+           fprintf(dependfileoutput,"%d\n",parcours->var->allocatable);
+           fprintf(dependfileoutput,"%d\n",parcours->var->pointerdeclare);
+           if ( strcasecmp(parcours->var->precision,"") )
+           {
+              fprintf(dependfileoutput,"%s\n",parcours->var->precision); 
+           }
+           else
+           {
+              fprintf(dependfileoutput,"T\n");
+           }
+           if ( strcasecmp(parcours->var->initialvalue,"") )
+           {
+              fprintf(dependfileoutput,"%s\n",parcours->var->initialvalue); 
+           }
+           else
+           {
+              fprintf(dependfileoutput,"T\n");
+           }
+           fprintf(dependfileoutput,"%d\n",parcours->var->indicetabvars);
+           if ( parcours->var->dimensiongiven == 1 )
+           {
+              dims = parcours->var->dimension;
+              strcpy(listdimension,"");
+              while (dims)
+              {
+                 sprintf(ligne,"%s:%s",dims->dim.first,dims->dim.last);
+                 strcat(listdimension,ligne);
+                 if ( dims->suiv )
+                 {
+                    strcat(listdimension,",");     
+                 }
+                 dims = dims->suiv;
+              }
+              fprintf(dependfileoutput,"%s\n",listdimension);    
+           }
+           else
+           {
+              fprintf(dependfileoutput,"T\n");
+           }
+           fprintf(dependfileoutput,"------------------------\n");
+        }
+     }
+     parcours = parcours->suiv;
+  }
+  fclose(dependfileoutput);
+  }
+}
+
+/******************************************************************************/
+/*                        Recordtmplocallist                                  */
+/******************************************************************************/
+/* This subroutine is used to read the .depend<name> if the                   */
+/* filetoparse has been read before                                           */
+/* if it is the case we record the .depend<name> in the tmplocallist          */
+/******************************************************************************/
+/*                                                                            */
+/*           .depend<name> -------->  tmplocallist = list of var              */
+/*                                                                            */
+/*        not.depend<name> -------->  tmplocallist = NULL                     */
+/*                                                                            */
+/******************************************************************************/
+void Recordtmplocallist( char *NameTampon)
+{
+  FILE *dependfileoutput;
+  listvar *parcours;
+  listvar *parcoursprec;
+  char ligne[LONGNOM];
+  char nothing[LONGNOM];
+
+  parcoursprec = (listvar *)NULL;
+  sprintf(ligne,".depend%s",NameTampon);
+  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
+  {
+    /* if the file doesn't exist it means that it is the first time           */
+    /*    we tried to parse this file                                         */
+  }
+  else
+  {
+    /* if the file exist we should verify that this file has changed          */
+      while (!feof(dependfileoutput))
+      {
+         parcours=(listvar *)malloc(sizeof(listvar));
+         parcours->var=(variable *)malloc(sizeof(variable));
+         fscanf(dependfileoutput,"%s\n",parcours->var->typevar);
+         fscanf(dependfileoutput,"%s\n",parcours->var->nomvar);
+         fscanf(dependfileoutput,"%s\n",parcours->var->dimchar);
+         if ( !strcasecmp(parcours->var->dimchar,"T") )
+         { 
+            strcpy(parcours->var->dimchar,"");
+         }
+         fscanf(dependfileoutput,"%s\n",parcours->var->commoninfile);
+         if ( !strcasecmp(parcours->var->commoninfile,"T") )
+         { 
+            strcpy(parcours->var->commoninfile,"");
+         }
+         fscanf(dependfileoutput,"%s\n",parcours->var->commonname);
+         if ( !strcasecmp(parcours->var->commonname,"T") )
+         { 
+            strcpy(parcours->var->commonname,"");
+         }
+         fscanf(dependfileoutput,"%d\n",&parcours->var->nbdim);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->dimensiongiven);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->typegiven);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->allocatable);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->pointerdeclare);
+         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->precision);
+         if ( !strcasecmp(parcours->var->precision,"T") )
+         {
+            strcpy(parcours->var->precision,"");
+         }
+         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->initialvalue);
+         if ( !strcasecmp(parcours->var->initialvalue,"T") )
+         {
+            strcpy(parcours->var->initialvalue,"");
+         }
+         fscanf(dependfileoutput,"%d\n",&parcours->var->indicetabvars);
+         fscanf(dependfileoutput,"%s\n",parcours->var->readedlistdimension);
+         if ( !strcasecmp(parcours->var->readedlistdimension,"T") )
+         {
+            strcpy(parcours->var->readedlistdimension,"");
+         }
+         fscanf(dependfileoutput,"%s\n",nothing);
+         parcours->suiv = NULL; 
+         if ( !tmplocallist )
+         { 
+            tmplocallist = parcours;
+            parcoursprec = parcours;
+         }
+         else
+         {
+            parcoursprec->suiv = parcours;
+            parcoursprec = parcours;
+         }
+         parcours = NULL;
+      }
+      fclose(dependfileoutput);
+  }
+}
+
+
+/******************************************************************************/
+/*                     Recordglobalvarofusefile                              */
+/******************************************************************************/
+/* This subroutine is used to read the .dependfile<name> and to insert new    */
+/*    information in the listout list.                                        */
+/******************************************************************************/
+/*                                                                            */
+/*           .dependmodule -------->  globalvarofusefile = list of var        */
+/*                                                                            */
+/*        not.dependmodule -------->                                          */
+/*                                                                            */
+/******************************************************************************/
+listvar *Recordglobalvarofusefile( char *NameTampon , listvar *listout)
+{
+  char ligne[LONGNOM];
+  FILE *dependfileoutput;
+  listvar *parcours0;
+  listvar *parcours;
+  listvar *parcoursprec;
+  char nothing[LONGNOM];
+
+  parcoursprec = (listvar *)NULL;
+  /* we should free the listvar globalvarofusefile                            */
+  sprintf(ligne,".depend%s",NameTampon);
+  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
+  {
+    /* if the file doesn't exist it means that it is the first time           */
+    /*    we tried to parse this file                                         */
+  }
+  else
+  {
+    /* if the file exist we should verify that this file has changed          */
+      while (!feof(dependfileoutput))
+      {
+         parcours=(listvar *)malloc(sizeof(listvar));
+         parcours->var=(variable *)malloc(sizeof(variable));
+         fscanf(dependfileoutput,"%s\n",parcours->var->typevar);
+         fscanf(dependfileoutput,"%s\n",parcours->var->nomvar);
+         fscanf(dependfileoutput,"%s\n",parcours->var->dimchar);
+         if ( !strcasecmp(parcours->var->dimchar,"T") )
+         { 
+            strcpy(parcours->var->dimchar,"");
+         }
+         fscanf(dependfileoutput,"%s\n",parcours->var->commoninfile);
+         if ( !strcasecmp(parcours->var->commoninfile,"T") )
+         { 
+            strcpy(parcours->var->commoninfile,"");
+         }
+         fscanf(dependfileoutput,"%s\n",parcours->var->commonname);
+         if ( !strcasecmp(parcours->var->commonname,"T") )
+         { 
+            strcpy(parcours->var->commonname,"");
+         }
+         fscanf(dependfileoutput,"%d\n",&parcours->var->nbdim);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->dimensiongiven);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->typegiven);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->allocatable);
+         fscanf(dependfileoutput,"%d\n",&parcours->var->pointerdeclare);
+         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->precision);
+         if ( !strcasecmp(parcours->var->precision,"T") )
+         {
+            strcpy(parcours->var->precision,"");
+         }
+         fscanf(dependfileoutput,"%[^\n] \n",parcours->var->initialvalue);
+         if ( !strcasecmp(parcours->var->initialvalue,"T") )
+         {
+            strcpy(parcours->var->initialvalue,"");
+         }
+         fscanf(dependfileoutput,"%d\n",&parcours->var->indicetabvars);
+         fscanf(dependfileoutput,"%s\n",parcours->var->readedlistdimension);
+         if ( !strcasecmp(parcours->var->readedlistdimension,"T") )
+         {
+            strcpy(parcours->var->readedlistdimension,"");
+         }
+         fscanf(dependfileoutput,"%s\n",nothing);
+         parcours->suiv = NULL; 
+         if ( !listout )
+         { 
+            listout = parcours;
+            parcoursprec = parcours;
+         }
+         else
+         {
+            if ( parcoursprec )
+            {
+               parcoursprec->suiv = parcours;
+               parcoursprec = parcours;
+            }
+            else
+            {
+               parcours0 = listout;
+               while ( parcours0->suiv ) parcours0=parcours0->suiv;
+               parcours0->suiv = parcours;
+               parcoursprec = parcours0->suiv;
+            }
+         }
+         parcours = NULL;
+      }
+      fclose(dependfileoutput);
+  }
+  return listout;
+}
+
+/******************************************************************************/
+/*                        Writethedependavailablefile                         */
+/******************************************************************************/
+/* This subroutine is used to write the .dependfileavailable file             */
+/******************************************************************************/
+/*                                                                            */
+/*                                  .dependavailable                          */
+/*     tabvars(1) = var1                                                      */
+/*     tabvars(3) = var1                  2                                   */
+/*     tabvars(4) = var1         =====>   5                                   */
+/*     tabvars(6) = var1                                                      */
+/*     tabvars(7) = var1                                                      */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void Writethedependavailablefile()
+{
+  FILE *dependfileoutput;
+  listindice *parcours;
+
+  if ( Listofavailableindices )
+  {
+  if ((dependfileoutput=fopen(".dependavailable","w"))!=NULL) 
+  {
+     /* We are looking for all the indices of the Listofavailableindices      */
+     parcours = Listofavailableindices;
+     while (parcours)
+     {
+        if ( parcours->indice != 0 )
+        {
+           fprintf(dependfileoutput,"%d\n",parcours->indice);
+        }
+        parcours = parcours->suiv;
+     }
+     fclose(dependfileoutput);
+  }
+  }
+}
+
+/******************************************************************************/
+/*                        Readthedependavailablefile                          */
+/******************************************************************************/
+/* This subroutine is used to read the .dependfileavailable file              */
+/******************************************************************************/
+/*                                                                            */
+/*                                  .dependavailable                          */
+/*     tabvars(1) = var1                                                      */
+/*     tabvars(3) = var1                  2                                   */
+/*     tabvars(4) = var1         =====>   5  ==> Listofavailableindices       */
+/*     tabvars(6) = var1                                                      */
+/*     tabvars(7) = var1                                                      */
+/*                                                                            */
+/*                                                                            */
+/*                                                                            */
+/******************************************************************************/
+void Readthedependavailablefile()
+{
+  FILE *dependfileoutput;
+  listindice *parcours;
+
+  if ((dependfileoutput=fopen(".dependavailable","r"))!=NULL) 
+  {
+     /* We are looking for all the indices of the Listofavailableindices      */
+     Listofavailableindices = (listindice *)NULL;
+     while (!feof(dependfileoutput))
+     {
+        parcours=(listindice *)malloc(sizeof(listindice));
+        fscanf(dependfileoutput,"%d\n",&parcours->indice);
+        if ( parcours->indice != 0 && parcours->indice < 10000000 )
+        {
+           parcours -> suiv = Listofavailableindices;
+           Listofavailableindices = parcours;
+        }
+        else
+        {
+           free(parcours);
+        }
+     }
+     fclose(dependfileoutput);
+  }
+}
+
+
+/******************************************************************************/
+/*                      Did_filetoparse_readed                                */
+/******************************************************************************/
+/* This subroutine is used to know if the .depend<NameTampon> exist           */
+/*    it means if the file has been ever parsed                               */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+int Did_filetoparse_readed(char *NameTampon)
+{
+  FILE *dependfileoutput;
+  char ligne[LONGNOM];
+  int out;
+
+  sprintf(ligne,".depend%s",NameTampon);
+  if ((dependfileoutput = fopen(ligne,"r"))==NULL) 
+  {
+      out = 0;
+  }
+  else
+  {
+      out = 1;
+      fclose(dependfileoutput);
+  }
+  return out;
+}
Index: /trunk/AGRIF/LIB/fortran.c
===================================================================
--- /trunk/AGRIF/LIB/fortran.c	(revision 396)
+++ /trunk/AGRIF/LIB/fortran.c	(revision 396)
@@ -0,0 +1,11416 @@
+#ifndef lint
+static char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
+#endif
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define yyclearin (yychar=(-1))
+#define yyerrok (yyerrflag=0)
+#define YYRECOVERING (yyerrflag!=0)
+#define yyparse fortranparse
+#define yylex fortranlex
+#define yyerror fortranerror
+#define yychar fortranchar
+#define yyval fortranval
+#define yylval fortranlval
+#define yydebug fortrandebug
+#define yynerrs fortrannerrs
+#define yyerrflag fortranerrflag
+#define yyss fortranss
+#define yyssp fortranssp
+#define yyvs fortranvs
+#define yyvsp fortranvsp
+#define yylhs fortranlhs
+#define yylen fortranlen
+#define yydefred fortrandefred
+#define yydgoto fortrandgoto
+#define yysindex fortransindex
+#define yyrindex fortranrindex
+#define yygindex fortrangindex
+#define yytable fortrantable
+#define yycheck fortrancheck
+#define yyname fortranname
+#define yyrule fortranrule
+#define YYPREFIX "fortran"
+#line 18 "fortran.y"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "decl.h"
+extern int line_num_fortran;
+extern int line_num_fortran_common;
+char *tmp;
+char c_selectorname[LONGNOM];
+char ligne[LONGNOM];
+char identcopy[LONGNOM];
+int c_selectorgiven=0;
+int incom;
+listvar *curlistvar;
+typedim c_selectordim;
+listcouple *coupletmp;
+int removeline=0;
+#line 36 "fortran.y"
+typedef union {
+       char      na[LONGNOM];
+       listdim  *d;
+       listvar  *l;
+       listvarcommon *lcom;
+       listnom  *ln;
+       listvarpointtovar  *lp;
+       listcouple  *lc;
+       typedim   dim1;
+       variable *v;
+       } YYSTYPE;
+#line 65 "y.tab.c"
+#define TOK_BINARY_OP 257
+#define EQV 258
+#define NEQV 259
+#define TOK_OR 260
+#define TOK_XOR 261
+#define TOK_AND 262
+#define TOK_NOT 263
+#define TOK_LT 264
+#define TOK_GT 265
+#define TOK_LE 266
+#define TOK_GE 267
+#define TOK_EQ 268
+#define TOK_NE 269
+#define TOK_UNARY_OP 270
+#define TOK_DSLASH 271
+#define TOK_SLASH 272
+#define TOK_DASTER 273
+#define TOK_SEP 274
+#define TOK_NEXTLINE 275
+#define TOK_PARAMETER 276
+#define TOK_KIND 277
+#define TOK_RESULT 278
+#define TOK_ONLY 279
+#define TOK_INCLUDE 280
+#define TOK_SUBROUTINE 281
+#define TOK_PROGRAM 282
+#define TOK_FUNCTION 283
+#define TOK_OMP 284
+#define TOK_DOLLAR 285
+#define TOK_FORMAT 286
+#define TOK_MAX 287
+#define TOK_TANH 288
+#define TOK_WHERE 289
+#define TOK_ELSEWHERE 290
+#define TOK_ENDWHERE 291
+#define TOK_MAXVAL 292
+#define TOK_TRIM 293
+#define TOK_SUM 294
+#define TOK_SQRT 295
+#define TOK_CASE 296
+#define TOK_SELECTCASE 297
+#define TOK_FILE 298
+#define TOK_DONOTTREAT 299
+#define TOK_ENDDONOTTREAT 300
+#define TOK_EXIST 301
+#define TOK_MIN 302
+#define TOK_INT 303
+#define TOK_FLOAT 304
+#define TOK_EXP 305
+#define TOK_COS 306
+#define TOK_COSH 307
+#define TOK_ACOS 308
+#define TOK_NINT 309
+#define TOK_SIN 310
+#define TOK_SINH 311
+#define TOK_ASIN 312
+#define TOK_EQUIVALENCE 313
+#define TOK_LOG 314
+#define TOK_TAN 315
+#define TOK_ATAN 316
+#define TOK_ABS 317
+#define TOK_MOD 318
+#define TOK_SIGN 319
+#define TOK_MINLOC 320
+#define TOK_MAXLOC 321
+#define TOK_EXIT 322
+#define TOK_MINVAL 323
+#define TOK_PUBLIC 324
+#define TOK_PRIVATE 325
+#define TOK_ALLOCATABLE 326
+#define TOK_IN 327
+#define TOK_RETURN 328
+#define TOK_THEN 329
+#define TOK_ELSEIF 330
+#define TOK_ELSE 331
+#define TOK_ENDIF 332
+#define TOK_PRINT 333
+#define TOK_PLAINGOTO 334
+#define TOK_CONSTRUCTID 335
+#define TOK_LOGICALIF 336
+#define TOK_PLAINDO 337
+#define TOK_CONTAINS 338
+#define TOK_ENDDO 339
+#define TOK_MODULE 340
+#define TOK_ENDMODULE 341
+#define TOK_DOWHILE 342
+#define TOK_ALLOCATE 343
+#define TOK_OPEN 344
+#define TOK_CLOSE 345
+#define TOK_INQUIRE 346
+#define TOK_WRITE 347
+#define TOK_READ 348
+#define TOK_REWIND 349
+#define TOK_DEALLOCATE 350
+#define TOK_NULLIFY 351
+#define TOK_FIN 352
+#define TOK_DEBUT 353
+#define TOK_OUT 354
+#define TOK_INOUT 355
+#define TOK_DIMENSION 356
+#define TOK_ENDSELECT 357
+#define TOK_EXTERNAL 358
+#define TOK_INTENT 359
+#define TOK_INTRINSIC 360
+#define TOK_NAMELIST 361
+#define TOK_CASEDEFAULT 362
+#define TOK_OPTIONAL 363
+#define TOK_POINTER 364
+#define TOK_CONTINUE 365
+#define TOK_SAVE 366
+#define TOK_TARGET 367
+#define TOK_USE 368
+#define TOK_POINT 369
+#define TOK_DATA 370
+#define TOK_QUOTE 371
+#define TOK_IMPLICIT 372
+#define TOK_NONE 373
+#define TOK_CALL 374
+#define TOK_STAT 375
+#define TOK_POINT_TO 376
+#define TOK_COMMON 377
+#define TOK_INTERFACE 378
+#define TOK_ENDINTERFACE 379
+#define TOK_LEFTAB 380
+#define TOK_RIGHTAB 381
+#define TOK_PAUSE 382
+#define TOK_PROCEDURE 383
+#define TOK_STOP 384
+#define TOK_NAMEEQ 385
+#define TOK_TRUE 386
+#define TOK_FALSE 387
+#define TOK_LABEL 388
+#define TOK_TYPE 389
+#define TOK_ENDTYPE 390
+#define TOK_REAL 391
+#define TOK_INTEGER 392
+#define TOK_LOGICAL 393
+#define TOK_DOUBLEPRECISION 394
+#define TOK_DOUBLEREAL 395
+#define TOK_ENDSUBROUTINE 396
+#define TOK_ENDFUNCTION 397
+#define TOK_ENDPROGRAM 398
+#define TOK_ENDUNIT 399
+#define TOK_CHARACTER 400
+#define TOK_CHAR_CONSTANT 401
+#define TOK_CHAR_CUT 402
+#define TOK_CHAR_INT 403
+#define TOK_CHAR_MESSAGE 404
+#define TOK_CSTREAL 405
+#define TOK_CSTREALDP 406
+#define TOK_CSTREALQP 407
+#define TOK_SFREAL 408
+#define TOK_COMPLEX 409
+#define TOK_DOUBLECOMPLEX 410
+#define TOK_NAME 411
+#define TOK_NAME_CHAR 412
+#define TOK_PROBTYPE 413
+#define TOK_INTERPTYPE 414
+#define TOK_VARTYPE 415
+#define TOK_BC 416
+#define TOK_OP 417
+#define TOK_CSTINT 418
+#define TOK_COMMENT 419
+#define TOK_FILENAME 420
+#define YYERRCODE 256
+short fortranlhs[] = {                                        -1,
+    0,    0,   63,   63,   63,   63,   63,   66,   66,   66,
+   66,   66,   76,   72,   67,   67,   67,   67,   64,   65,
+   65,   68,   68,   77,   70,   71,   71,   71,   71,   71,
+   71,   12,   69,   74,   57,   78,   78,   78,   79,   79,
+   79,    3,    3,   18,   18,   73,   73,   73,   73,   73,
+   73,   73,   73,   73,   73,   73,   73,   73,   73,   73,
+   73,   73,   73,   81,   81,   94,   94,   92,   92,   80,
+   80,   82,   95,   96,   96,   45,   45,   31,   31,   31,
+   31,   31,   55,   55,   91,   99,   99,   99,   99,  100,
+   90,   90,   85,   85,   87,   87,   86,   86,   93,   93,
+    8,    8,    8,  102,   10,   10,    9,   11,   11,   83,
+   83,   83,   83,  103,  103,   98,   98,    2,    2,   62,
+   89,  104,  104,   84,  105,    1,    1,   97,   17,   17,
+   17,  110,  110,  110,  110,  111,  111,  111,  109,   20,
+   19,   19,   19,   19,   19,   19,   19,  101,  101,   58,
+   58,  108,  108,  108,  113,  113,  114,  114,  114,   16,
+   16,  112,  112,  106,  106,  106,  115,  115,  116,  116,
+  116,  116,  116,  116,  116,  116,  116,  116,  116,   51,
+   51,   51,  117,  117,   59,   59,   60,   60,   61,   61,
+   61,   61,   61,   52,   52,   50,   50,   50,   50,   48,
+   48,   48,   48,   48,   48,   48,   48,   48,   48,   48,
+   48,   48,   48,   48,   48,   48,   48,   48,   48,   48,
+   48,   48,   48,   48,   48,   48,   22,   22,   21,   21,
+   21,   21,   21,   21,   54,   54,   56,   56,   56,   56,
+   56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
+   56,   56,   56,   56,   56,   46,   46,   46,   47,   47,
+   24,   24,   24,   32,   35,   35,   35,   35,   13,   34,
+   26,   36,   36,   38,   38,   37,   37,   39,   39,   39,
+   39,   39,   39,   39,   33,   25,   25,   25,   25,   25,
+   25,   25,   25,   41,   41,   41,   41,   42,   42,   40,
+   44,   44,   43,   43,  107,  107,  118,   23,   88,   88,
+   88,   88,  119,   14,    6,    6,    7,    4,    4,    5,
+    5,   75,   75,   75,   75,   75,   75,   75,   75,   75,
+   75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
+   75,   75,   75,   75,  127,  127,  127,  125,  125,  125,
+  125,   15,   15,  130,  130,  128,  129,  131,  131,  120,
+  120,  120,  120,  120,  120,  120,  120,  120,   53,   53,
+  134,  137,  137,  138,  138,  136,  140,  139,  139,  141,
+  141,  135,  135,  133,  133,  133,  133,  133,  133,  154,
+  149,  149,  149,  155,  155,  156,  156,  158,  158,  158,
+  158,  158,  159,  159,  157,  157,  148,  148,  148,  153,
+  153,  160,  160,  146,  146,  150,  150,  163,  163,  144,
+  144,  151,  151,  164,  164,  166,  166,  166,  166,  166,
+  166,  166,  143,  167,  167,  167,  162,  162,  145,  147,
+  152,  152,  165,  165,  168,  168,  168,  168,  168,  168,
+  168,  168,  168,  168,  168,  169,  169,  161,  161,  170,
+  170,   27,   27,   28,   28,   28,   28,   28,   28,   28,
+   28,   29,   29,   29,   29,   29,   30,   30,  171,  171,
+  142,  132,  121,  121,  172,  172,  172,  173,  174,  174,
+  123,  123,  122,  122,  124,  124,  175,  175,  176,  176,
+  126,   49,
+};
+short fortranlen[] = {                                         2,
+    0,    2,    2,    2,    1,    3,    3,    2,    2,    3,
+    3,    2,    2,    2,    1,    1,    1,    1,    0,    0,
+    2,    0,    1,    0,    0,    0,    3,    2,    5,    3,
+    2,    1,    0,    1,    1,    0,    2,    3,    0,    2,
+    3,    1,    3,    1,    1,    2,    2,    2,    2,    4,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    3,    4,    3,    3,    5,    1,    3,    0,    2,    2,
+    3,    1,    1,    4,    6,    1,    3,    2,    3,    3,
+    3,    3,    0,    1,    2,    2,    3,    5,    3,    0,
+    2,    2,    5,    5,    2,    2,    2,    2,    1,    3,
+    2,    3,    5,    1,    1,    3,    2,    1,    3,    2,
+    3,    5,    3,    0,    2,    0,    1,    1,    3,    3,
+    2,    1,    3,    2,    0,    6,    7,    0,    2,    2,
+    3,    0,    2,    4,    3,    3,    4,    2,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    0,    2,    1,
+    3,    0,    2,    3,    1,    3,    2,    3,    1,    1,
+    1,    0,    3,    0,    2,    4,    1,    3,    1,    1,
+    1,    2,    1,    4,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    0,    3,    1,    3,    1,    1,
+    2,    2,    3,    1,    1,    1,    3,    1,    1,    3,
+    4,    4,    4,    3,    4,    4,    4,    4,    4,    4,
+    4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
+    4,    4,    4,    4,    4,    4,    1,    3,    1,    1,
+    1,    2,    2,    2,    1,    1,    2,    2,    2,    2,
+    2,    2,    2,    2,    2,    2,    3,    2,    3,    2,
+    2,    2,    2,    2,    2,    1,    2,    2,    2,    1,
+    1,    1,    1,    0,    1,    2,    4,    5,    4,    3,
+    3,    1,    2,    1,    3,    1,    1,    3,    5,    4,
+    3,    2,    2,    1,    1,    1,    1,    1,    1,    1,
+    1,    2,    2,    1,    2,    1,    1,    0,    1,    5,
+    0,    1,    1,    1,    0,    3,    0,    5,    2,    4,
+    6,    6,    1,    1,    1,    3,    3,    1,    3,    3,
+    1,    1,    5,    5,    4,    1,    2,    2,    2,    2,
+    1,    2,    5,    1,    1,    2,    5,    1,    1,    4,
+    4,    1,    1,    1,    1,    3,    3,    6,    8,    2,
+    2,    1,    1,    0,    1,    1,    1,    0,    1,    1,
+    4,    2,    1,    1,    1,    2,    2,    2,    2,    2,
+    2,    0,    3,    0,    1,    2,    1,    1,    3,    1,
+    2,    1,    1,    2,    2,    6,    2,    2,    4,    1,
+    0,    2,    2,    2,    1,    1,    3,    1,    2,    4,
+    2,    1,    0,    2,    3,    1,    1,    1,    1,    0,
+    2,    0,    1,    2,    2,    0,    1,    0,    2,    3,
+    3,    3,    1,    1,    3,    1,    1,    1,    2,    4,
+    2,    2,    1,    1,    1,    1,    1,    1,    1,    1,
+    2,    2,    1,    3,    1,    1,    3,    3,    3,    3,
+    2,    3,    2,    2,    3,    1,    1,    1,    3,    1,
+    5,    1,    1,    3,    3,    3,    3,    3,    3,    1,
+    1,    1,    3,    5,    5,    5,    5,    7,    1,    3,
+    1,    2,    1,    3,    1,    1,    1,    4,    1,    3,
+    1,    3,    0,    4,    1,    3,    0,    1,    0,    2,
+    4,    1,
+};
+short fortrandefred[] = {                                      1,
+    0,   33,   17,   18,   15,   16,   25,    5,   19,    2,
+    0,    0,   25,   21,    3,   72,   34,    0,    0,    0,
+  390,    0,  334,  335,    0,    0,    0,    0,    0,    0,
+    0,    0,  338,  339,    0,    0,    0,  356,  344,    0,
+    0,    0,  357,    0,  435,  436,  434,  440,  439,    0,
+    0,    0,    0,  343,    0,    0,  342,    0,  360,    0,
+  313,   73,    0,  377,  104,    0,    0,  382,    0,  383,
+    0,    0,  142,  141,  146,  144,    0,    0,    0,  326,
+  139,  143,  145,  285,    0,    0,    0,    0,    0,    0,
+    0,    0,  263,    4,   19,   19,    0,    0,   19,    0,
+    0,   53,    0,   55,   56,   57,   58,   59,   60,    0,
+    0,    0,    0,    0,  322,  331,    0,    0,    0,  363,
+  364,  365,    0,    0,    0,    0,    0,    0,    0,    0,
+  433,   23,   33,    7,   32,    0,   28,    0,    0,    0,
+    0,    0,  353,  352,  366,   99,   97,    0,   95,    0,
+    0,  235,  236,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  286,  287,    0,  294,  297,  296,  289,  290,  291,  288,
+    0,  196,  198,    0,    0,  231,    0,    0,    0,  367,
+  199,    0,    0,    0,  456,  457,  442,    0,    0,    0,
+    0,    0,    0,    0,  443,    0,  481,  482,    0,  355,
+  351,   31,  330,    0,  423,    0,  387,    0,    0,  117,
+    0,    0,    0,  108,    0,    0,   86,    0,    0,    0,
+    0,  110,  124,   91,   92,  122,    0,   47,   48,  328,
+  329,  327,    0,    0,  266,    0,    0,    0,    0,   46,
+  125,    0,    0,    0,  129,    0,   13,    0,    0,    0,
+    0,  264,  362,    0,    8,    9,   35,   19,   33,   12,
+    0,    0,    0,    0,    0,    0,    0,    0,   85,    0,
+  105,    0,    0,    0,    0,  130,  314,    0,  336,    0,
+  332,  502,    0,    0,  303,  368,    0,    0,  371,  376,
+    0,  384,  438,    0,    0,  385,    0,    0,    0,    0,
+    0,  388,    0,  395,    0,    6,    0,   27,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  198,    0,    0,    0,
+    0,    0,    0,    0,    0,  292,  264,  295,  299,  293,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  232,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  483,  487,    0,    0,  491,  495,
+    0,    0,   69,    0,    0,   87,    0,    0,    0,  115,
+  111,    0,    0,    0,  169,  183,  184,  171,    0,  173,
+    0,  175,  176,  177,  178,  179,    0,  167,  170,  165,
+    0,  125,   70,    0,  131,    0,    0,  153,    0,    0,
+    0,    0,  194,    0,    0,    0,  189,    0,  187,    0,
+    0,    0,    0,   14,   10,   11,    0,    0,  118,  113,
+    0,    0,    0,   63,    0,   89,    0,  107,    0,    0,
+  133,    0,  161,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  378,  427,  428,    0,    0,    0,  424,
+    0,    0,    0,  414,    0,  458,    0,  415,  407,  408,
+  409,    0,  411,  394,    0,  402,    0,    0,    0,  396,
+   45,   44,   37,    0,   42,    0,    0,    0,    0,  340,
+  341,    0,   62,  100,    0,    0,    0,    0,    0,  200,
+    0,  204,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  271,    0,    0,    0,
+    0,  197,    0,  255,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  254,
+    0,    0,    0,    0,    0,    0,    0,    0,  444,    0,
+    0,    0,    0,    0,  501,    0,    0,    0,  422,    0,
+    0,    0,  325,    0,  109,   64,    0,  123,    0,    0,
+  172,    0,    0,    0,   71,    0,    0,    0,    0,  157,
+  154,    0,    0,  274,    0,  277,    0,  269,    0,    0,
+  186,  361,    0,    0,    0,   50,    0,    0,    0,    0,
+   84,    0,    0,    0,  106,    0,    0,    0,    0,  138,
+  135,    0,    0,    0,  315,    0,  381,  373,    0,  431,
+  432,    0,    0,    0,  420,  421,    0,    0,    0,    0,
+    0,    0,    0,  401,  399,    0,    0,  406,    0,  389,
+    0,   38,    0,   29,  333,    0,    0,    0,  201,  202,
+  203,  206,    0,  207,  209,  211,  212,  213,  214,  215,
+  210,  216,  217,  218,  219,  220,  221,  222,  223,  224,
+  225,  226,  205,    0,    0,    0,  197,  465,    0,  469,
+    0,  467,    0,  208,    0,    0,    0,    0,    0,    0,
+  337,    0,    0,  484,  323,  492,  324,  496,    0,   93,
+    0,    0,    0,  180,  181,  182,    0,  168,  166,    0,
+    0,  156,  158,    0,    0,    0,    0,    0,  193,  188,
+  268,    0,  119,  112,   94,    0,    0,    0,    0,    0,
+   74,    0,    0,   88,  134,    0,  136,    0,    0,    0,
+    0,    0,  379,    0,    0,    0,  425,    0,  459,  393,
+    0,    0,  404,    0,  397,    0,   43,   40,    0,    0,
+    0,    0,    0,  308,  488,    0,    0,    0,  149,   65,
+  300,  174,    0,    0,    0,    0,  275,    0,   77,    0,
+    0,    0,    0,    0,  137,  163,    0,  311,    0,  318,
+  317,  316,    0,  430,    0,    0,  417,  386,  400,  405,
+   41,    0,  474,  476,  475,  494,    0,    0,  126,    0,
+    0,    0,   75,    0,    0,    0,  461,    0,  151,  127,
+    0,    0,  320,  319,    0,    0,    0,    0,    0,    0,
+};
+short fortrandgoto[] = {                                       1,
+  259,  478,  534,  849,  850,  674,  675,   85,  291,  292,
+  236,  136,   86,  298,  145,  495,   87,  535,   88,   89,
+  192,  342,  193,  194,  195,  196,  368,  369,  370,  821,
+  659,  464,  197,  198,   93,  465,  644,  645,  646,  255,
+  199,  380,  306,  200,  660,  600,  584,  201,  303,  343,
+  767,  467,  273,  203,  662,  398,  278,  829,  269,  468,
+  469,  479,   10,  274,   11,   94,   12,  133,   13,   14,
+   95,  275,   96,   97,   98,   99,    0,  328,  704,  260,
+  239,  100,  101,  102,  103,  104,  105,  106,  107,  108,
+  109,  233,  148,  335,  110,  286,  453,  699,  111,  289,
+  760,  112,  242,  247,  454,  261,  869,  265,  113,  296,
+  497,  670,  458,  460,  447,  448,  449,  870,  114,  115,
+  414,  618,  418,  421,  116,  117,  332,  118,  119,  221,
+    0,  120,  121,  122,  123,  124,  309,  502,  503,  125,
+  504,  218,  126,  312,  127,  316,  128,  522,  692,  858,
+  227,  129,  322,  130,  325,  529,  700,  530,  694,  514,
+  515,  317,  518,  508,  214,  510,  131,  215,  216,  516,
+    0,  415,  416,    0,    0,    0,
+};
+short fortransindex[] = {                                      0,
+    7,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+21942, -347,    0,    0,    0,    0,    0, -333, -333, -333,
+    0,   50,    0,    0,  121,  147,  181,   -2,    1,    5,
+20945,  191,    0,    0, 1955, -265,  196,    0,    0, -205,
+ -169,   -2,    0,  208,    0,    0,    0,    0,    0,   -3,
+  221,  239,  243,    0,  247, -186,    0,  257,    0, -178,
+    0,    0,  -44,    0,    0,   -2,   -2,    0,  -75,    0,
+   -2,   -2,    0,    0,    0,    0,   -2,   -2,   -2,    0,
+    0,    0,    0,    0,  243,  337,   -8,  345,  129,  370,
+   58,   20,    0,    0,    0,    0,   33, -347,    0,  414,
+  411,    0,  425,    0,    0,    0,    0,    0,    0,   64,
+  439, -176,  442,   83,    0,    0, 2562,   93,20945,    0,
+    0,    0, 1008,  455,   94,  474, 2445,  475,  444,  -13,
+    0,    0,    0,    0,    0,  476,    0,  476,20945,20945,
+20945,20945,    0,    0,    0,    0,    0,  465,    0,  465,
+20945,    0,    0,  484,  488,  492,  499,20945,  503,20945,
+  504,  517,  518,  525,  531,  547,  548,  557,  570,  575,
+  604,  614,  622,  632,  652,  668,  671,  672,  673,20982,
+    0,    0,  674,    0,    0,    0,    0,    0,    0,    0,
+20945,    0,    0,  370,  158,    0,  675,  678,  -17,    0,
+    0, 2652,20945,20945,    0,    0,    0,20945,20945,  472,
+  330,  370,  158,  258,    0,  330,    0,    0,20945,    0,
+    0,    0,    0,   93,    0,   93,    0,   93,   93,    0,
+  209,  587,  252,    0,  262,   93,    0,20945,  635,  680,
+  316,    0,    0,    0,    0,    0,  689,    0,    0,    0,
+    0,    0, -165,20945,    0,  426,  681,  327,  696,    0,
+    0,  326,21109,  336,    0,   93,    0,19204,  680,20945,
+20945,    0,    0, -347,    0,    0,    0,    0,    0,    0,
+  342,  316, -165,  344,  491,   57,   93, -165,    0,  680,
+    0,  724,  358,  -36,19867,    0,    0,  726,    0,  733,
+    0,    0,  713, 2652,    0,    0, 2652,20002,    0,    0,
+ 1414,    0,    0, 1414,   11,    0,  731,  258,    0,   -1,
+20982,    0,  243,    0,19364,    0,   13,    0,  498, 3171,
+ 2652,   78, 3690, 2652,  156,  372,  493,20945,20945,20945,
+20945,  186, 2652,20945,  254,20945,20945,20945,20945,20945,
+20945,20945,20945,20945,20945,20945,20945,20945,20945,20945,
+20945,20945,20945,20945,20982,  743,    0,  407,  747,  750,
+    0, 2652,20945,  751, 3863,    0,    0,    0,    0,    0,
+20149,20945,20945,20945,20945,20945,20945,20945,20945,20945,
+20945,20945,20945,19414,20945,20199,20320,    0, 2652, 4209,
+ 2652, 2652,20945,  214,  330,  330,  330,  330,  330,  524,
+ 8151,  758,  678,  755,    0,    0,  765,  763,    0,    0,
+  297,  680,    0,  465,  536,    0,  303,  772,19204,    0,
+    0,  409,  243,  766,    0,    0,    0,    0,  680,    0,
+  783,    0,    0,    0,    0,    0,   84,    0,    0,    0,
+  476,    0,    0,  415,    0,20357, 2652,    0,19535,  786,
+  370,20945,    0,20494,  787, 2307,    0,  448,    0,  -37,
+ 2652, 2652,  789,    0,    0,    0,  771,  469,    0,    0,
+  243,  680,   54,    0,  424,    0,  243,    0,  358,  724,
+    0,19867,    0,19696,  792, 2652,  796, -237,20945, -265,
+ 2652,  797,  795,    0,    0,    0,19082,  479,  225,    0,
+  417,   11,  370,    0,  798,    0,   11,    0,    0,    0,
+    0,  800,    0,    0,  422,    0,   40,    0,  481,    0,
+    0,    0,    0,  496,    0,  806, 1008,20945,20945,    0,
+    0,20945,    0,    0,  510,  515,  522, 8679,20945,    0,
+ 9042,    0,19171,19299,19600,19844,19935,20078,20731,21423,
+21437,21461,21559,21590,21675,21697,  529,  534,  535,  539,
+  540,  803,  813,  815,21711,20982,    0,20982,20982,21725,
+20945,    0,20945,    0, 2652,  457,  457,  493,  166,  166,
+  166,  166,  166,  166,  218,  218,   67,20945,20945,    0,
+ 2652,   67,20945,  166,20945,  166,  537, 2652,    0,  269,
+  524,  524,  524,   60,    0,20494, -307,  826,    0, -307,
+  827,   93,    0,  828,    0,    0,20945,    0,  358,20945,
+    0, -210,  426,  811,    0,  460,  680,  831,20531,    0,
+    0, 2652,20652,    0,  830,    0, 4236,    0,20787,19204,
+    0,    0,  337,20945,  342,    0,  316,  828,  207,  603,
+    0,  447,  606,   93,    0,  835,20531,  792,  471,    0,
+    0,  825,  508,  841,    0,21753,    0,    0,20002,    0,
+    0,20494, 2652, 1414,    0,    0,    0,  842,   11,  798,
+ 1567,  846,  477,    0,    0,19364,19364,    0,  509,    0,
+  -23,    0,   16,    0,    0, 2652, 2652, 2652,    0,    0,
+    0,    0, 2652,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,21238,21238,21238,    0,    0, 2652,    0,
+ 2652,    0, 2652,    0,  850,  166,  166,   67,  166,  166,
+    0,  554,  847,    0,    0,    0,    0,    0,21275,    0,
+  561,  724,  851,    0,    0,    0,  855,    0,    0,  680,
+  828,    0,    0,20945,19700,20494,20945, 2652,    0,    0,
+    0, 2652,    0,    0,    0,   54,   54,   54,   54,   54,
+    0,  158,   54,    0,    0,  792,    0,20531,    8,  500,
+  514,20945,    0,  862, 2825,  258,    0,   12,    0,    0,
+  863,20982,    0,  481,    0,  243,    0,    0,  562,  859,
+  869,  880,  885,    0,    0,   93,20824, 2652,    0,    0,
+    0,    0,  828,    0, 2652,20945,    0,21822,    0,  143,
+  143,  881,  171,  659,    0,    0,  551,    0,  890,    0,
+    0,    0,21843,    0,  894,19364,    0,    0,    0,    0,
+    0,20945,    0,    0,    0,    0,  897,    0,    0,  878,
+ 2652,20945,    0,  532,  533,20945,    0,21857,    0,    0,
+20945, 2652,    0,    0, 2652,20945, 2652,21871,20945, 2652,
+};
+short fortranrindex[] = {                                      0,
+ 2057,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  115,18939,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+18662,    0,    0,    0,    0,    0,    0,    0,    0,18400,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  541,    0,  542,    0,    0,    0,    0,14765,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+   47,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,10949,  633,  543,  -14,   19,    0,
+   42,  903,    0,    0,    0,    0,    0,18939,    0,    0,
+11098,    0,14896,    0,    0,    0,    0,    0,    0,    0,
+11243,    0,   25,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,15042,    0,    0,    0,    0,15188,    0,
+    0,    0,    0,    0,    0,15334,    0,13385,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,15480,    0,15626,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0, 2264, 2420,    0,  819, 1204, 1901,    0,
+    0,11392,    0,    0,    0,    0,    0,    0,    0, 4485,
+    0, 7562, 8109,13549,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,15772,10033,
+11551,    0,    0,    0,    0,    0,15918,    0,    0,    0,
+    0,    0,    0,  887,    0,    0,    0,    0,16064,    0,
+    0,    0,    0,    0,    0,    0,    0,  909,  -30,    0,
+    0,    0,    0,18939,    0,    0,    0,    0,    0,    0,
+    0,11551,    0,    0,    0,  541, -148,    0,    0,10033,
+    0,11696,    0,    0,    0,    0,    0,16210,    0,   42,
+    0,    0,    0,16356,    0,    0,16502,  910,    0,    0,
+    0,    0,    0,    0,18531,    0,16648,    0, 8274,    0,
+    0,    0,19746,    0,    0,    0,    0,    0,16794,    0,
+  118,    0,    0,  563,    0,    0, 4742,    0,    0,    0,
+    0,    0,  573,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0, 3821,    0,    0,13694,13841,
+ 2783,    0,    0, 3344,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0, 9363,    0,
+10183,10344,    0,    0,    0,    0,    0,    0,    0, 8472,
+    0,   89,  142,  915,    0,    0,    0,  915,    0,    0,
+    0,11861,    0,16940,    0,    0,    0,    0,    0,    0,
+    0,    0,  541,    0,    0,    0,    0,    0,  110,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+15334,    0,    0,    0,    0,    0,   26,    0,  918,    0,
+ 1360,  580,    0,  919,    0,  581,    0,    0,    0,    0,
+17086,17232,    0,    0,    0,    0,    0,    0,    0,    0,
+12006,11861,  849,    0,    0,    0,  541,    0,    0,12155,
+    0,    0,    0, 1076,  921,  585,    0,    0,    0,    0,
+  586,    0,  927,    0,    0,    0,   77,    0,  941,    0,
+  941,    0,14002,    0,17378,    0,    0,    0,    0,    0,
+    0,  945,    0,    0,  -12,    0, 1016, 4382,  607,    0,
+    0,    0,    0,    0,    0,17524,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,21739,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0, 9509, 7707, 7964, 4887, 5144, 5289,
+ 5546, 5691, 5948, 6093, 3977, 4340, 2939,    0,    0,    0,
+ 9674, 3302,    0, 6350,    0, 6495,    0,10494,    0,10655,
+ 8637, 8835, 9000, 9872,    0,  909,    0,    0,    0,    0,
+    0,    0,    0,14149,    0,    0,    0,    0,    0,  946,
+    0,    0,    0,    0,    0,    0,10804,    0,    0,    0,
+    0,  591,  605,    0,  951,    0,  609,    0,  611,    0,
+    0,    0, 1745,    0,    0,    0,11551,14149,  721,    0,
+    0,    0,    0,    0,    0,    0,    0,  921,    0,    0,
+    0,    0,    0,17670,    0,    0,    0,    0,    0,    0,
+    0,    0,  615,    0,    0,    0, 9198,    0,    0,17816,
+    0,    0,    0,    0,    0,    0,  619,    0,    0,    0,
+    0,    0,    0,    0,    0,  122,  123,  617,    0,    0,
+    0,    0,  623,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,12314,    0,
+12463,    0,12622,    0,21985, 6752, 6897, 3458, 7154, 7299,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,12767,    0,    0,    0,    0,    0,    0,    0,10804,
+12932,    0,    0,    0,  627,    0,  639,  581,    0,    0,
+    0,  643,    0,    0,    0,  849,  849,  849,  849,  849,
+    0,   96,  849,    0,    0,  921,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  655,    0,    0,    0,    0,
+  955,18808,    0,  607,    0,13078,    0,    0,    0,  549,
+    0,    0,    0,    0,    0,    0,    0,14310,    0,    0,
+    0,    0,12932,13240,  656,    0,    0,  657,    0,  113,
+  229,  160,  -10,    0,    0,    0,14457,    0,17962,    0,
+    0,    0,18108,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,13240,    0,    0,
+  665,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  666,    0,    0,18254,    0,14618,  961,    0,  963,
+};
+short fortrangindex[] = {                                      0,
+    0,    0,  305,    0,  131,    0,  212,    0,  530, -255,
+  489,  112,    0,    0,  870, -420,    0,  319,    0,    0,
+ -170,  440, -174,   65,  -15,    0, -319,  663, -294, -671,
+ -323,    0,   17,   -4,    0,  762,  259,  420,  355, -196,
+    0,    0,  501, -241, -711,    0,    0, -171,    0,  -31,
+    0,  390,  571, -337,    0,    0,    0,    0, -224,    0,
+  395,  385,    0, 1037,    0,    0,    0,  -45,  -86, 1034,
+    0,  -56,    0,    0,    0,    0,    0, -116,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,   32, -226,    0,    0,    0,  -52,    0,    0,
+ -623,    0, -236,    0,  597,    0,  182,    0,    0,    0,
+  564, -607,    0,    0,    0,  421,    0,    0,    0,  938,
+    0,  644,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  384,  565,    0,  937,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  544, -526,  253, -672,    0,    0,
+ -300,    0,    0,    0,   72,  382,    0,  942, -166, -633,
+    0, -214,    0,    0,    0,    0,
+};
+#define YYTABLESIZE 22353
+short fortrantable[] = {                                     202,
+  231,  523,  379,  492,  431,  367,   92,  144,  371,  366,
+  147,  427,  434,  419,  149,  430,    9,  848,  531,  213,
+  374,  329,  254,  270,  815,  140,  324,   91,  403,  140,
+  185,  403,  253,   82,  785,  256,  226,  490,  640,  276,
+  519,  672,  280,  140,  470,  480,  326,  409,  283,  257,
+  512,  512,  279,  533,  531,  809,  818,  531,  288,  272,
+  797,  150,  152,  822,  823,  488,  484,  753,  132,  155,
+  574,  132,  237,  668,  839,   90,  152,  135,  261,  324,
+  270,  844,  132,  155,  234,  235,  147,  304,  147,  139,
+  147,  307,  234,  235,  234,  235,  152,  268,  153,  212,
+  230,  406,  185,   84,  147,  234,  235,  330,  331,  333,
+  334,  213,   92,  285,   26,  267,  764,  285,  540,  337,
+  285,  538,  117,  117,   26,  261,  396,  633,  397,  485,
+  137,  138,  485,  300,  302,  539,  855,   78,   78,   78,
+   78,  634,   78,  765,  766,  661,  367,  834,  372,  371,
+  366,  409,  217,  185,  528,   79,   79,   79,  345,  375,
+  140,  345,  346,  347,  811,  346,  347,  185,  264,  814,
+  263,  399,  400,  673,  809,  345,  401,  402,  262,  346,
+  347,   90,  486,  815,  789,  486,  141,  411,  845,  790,
+  367,  212,  476,  371,  572,  213,  543,  624,  318,  542,
+  213,   81,   81,   81,   81,  220,  334,  393,  391,  868,
+  392,  688,  789,  787,  631,  788,  690,  790,  773,  413,
+  142,  475,  202,  413,   84,  396,  550,  397,  474,  549,
+  204,  457,  240,  485,  290,  219,  466,  409,  471,  472,
+  412,  222,  417,  409,  412,  420,  796,  224,  789,  787,
+  786,  788,  426,  790,  609,  406,  205,  658,  206,  393,
+  228,   82,    2,  496,  424,  686,  406,  205,  140,  206,
+  524,   80,   80,   80,  258,  212,  501,  396,  229,  397,
+  212,  738,  404,  740,  742,  374,  230,  410,   90,  372,
+    3,    4,   90,  372,  552,  213,  238,  549,  213,  406,
+  205,  152,  206,  486,  232,    5,    6,  132,  155,  548,
+  406,  205,  551,  206,  553,  554,  555,  556,  557,  558,
+  559,  560,  561,  562,  563,  564,  565,  566,  243,  147,
+  461,  407,  408,  575,  635,  246,  521,  623,  271,  395,
+  622,  580,  409,  626,  409,  185,  542,  285,  285,  585,
+  586,  587,  588,  589,  590,  591,  592,  593,  594,  595,
+  596,  597,  601,  602,  604,  606,  323,   78,  403,  211,
+   26,  608,  205,  762,  206,  212,  254,  846,  212,  513,
+  629,  491,  509,  378,   79,  511,  262,  532,  763,  213,
+  213,  213,  213,  213,    7,  271,  140,  466,   26,   26,
+  761,  367,  754,  367,  367,  756,  266,  225,  143,   84,
+  745,  146,  771,   26,   26,  146,  520,  185,  847,  323,
+  784,   84,  820,  532,  375,    8,  532,  496,  657,  152,
+  642,   81,  647,  277,  664,  132,  155,  394,  395,  738,
+  740,  742,  695,  409,  409,  409,  409,  409,  661,  661,
+  661,  661,  661,  281,  282,  661,  781,  687,  406,  205,
+  496,  206,  496,  840,  841,  842,  843,  676,  284,  212,
+  212,  212,  212,  212,  285,  683,  610,  611,  612,  613,
+  614,  295,  287,  294,  405,  407,  408,  321,  651,  394,
+  395,  650,  857,  297,  308,  405,  407,  408,  393,  391,
+   80,  392,   26,   84,  310,  307,  706,  707,  336,  656,
+  708,  374,  655,  311,  320,  327,  396,  713,  397,  685,
+  528,  698,  684,  338,  697,  528,  528,  339,  405,  407,
+  408,  340,  403,   26,  393,  391,  702,  392,  341,  701,
+  407,  408,  344,  346,  739,  833,  741,  743,  241,  372,
+  709,  746,  396,  549,  397,  710,  347,  348,  549,  367,
+  367,  367,  711,  745,  349,  549,  747,  748,  376,  729,
+  350,  749,  549,  750,  730,  731,  513,  549,  549,  732,
+  733,  513,  549,  549,  647,  285,  351,  352,  285,  285,
+  285,  285,  285,  285,  825,  334,  353,  776,  202,  345,
+  293,  830,  861,   66,  542,  701,   66,  496,  285,  354,
+  285,  775,  413,  227,  355,  413,  227,  778,  466,  422,
+  190,  195,  782,  190,  195,  160,  380,  208,  160,  380,
+  209,  192,  265,  412,  192,  496,  412,  367,  758,  409,
+  371,  366,  265,  356,  423,  284,  792,  501,  284,  276,
+  805,  191,  276,  357,  191,  429,  374,   67,  429,  372,
+   67,  358,  146,  228,  372,  372,  228,  282,  213,  265,
+  282,  359,  425,  265,  265,  265,  265,  265,  428,  283,
+  794,   90,  283,  120,   90,  528,  120,  405,  407,  408,
+  265,  360,  265,  265,  265,  426,  281,  278,  426,  281,
+  278,  435,  739,  741,  743,  280,  279,  361,  280,  279,
+  362,  363,  364,  373,  377,  181,  182,  272,  384,  429,
+  385,  386,  387,  388,  389,  390,  240,  828,  394,  395,
+  184,  185,  432,  186,  187,  188,  189,  451,  450,  452,
+  210,  433,  835,  455,  647,  838,  459,  190,  212,  436,
+  437,  438,  477,  513,  482,  806,  385,  386,  387,  388,
+  389,  390,  483,  860,  394,  395,  496,  489,  290,  498,
+  853,  481,  268,  499,  517,  536,  487,  545,  546,  547,
+  372,  439,  544,  440,  441,  442,  576,  577,  443,  444,
+  578,  445,  446,  579,  581,  375,  408,  616,  617,  567,
+  568,  569,  570,  571,  871,  619,  620,  625,  285,  285,
+  285,  627,  285,  285,  285,  285,  285,  285,  261,  628,
+  285,  285,  632,  630,  372,  637,  641,  648,  261,  653,
+  878,  654,  181,  182,  663,  669,  671,  678,  679,  693,
+  882,  689,  866,  691,  885,  703,  734,  184,  185,  887,
+  186,  187,  188,  189,  888,  261,  735,  890,  736,  261,
+  261,  261,  261,  261,  190,  751,  755,  757,  769,  759,
+  770,  772,  513,  776,  791,  795,  261,  793,  261,  261,
+  261,  798,  799,  800,  801,  808,  812,  813,  265,  816,
+  824,  831,  265,  265,  265,  832,  265,  265,  265,  265,
+  265,  265,  854,  265,  265,  265,  856,  826,  265,  863,
+  851,  223,  265,  265,  265,  265,  265,  265,  265,  862,
+  864,  265,  265,  265,  673,  865,  874,  790,  265,  265,
+  873,  265,  265,  875,  877,  244,  245,  879,  881,  262,
+  248,  249,  883,  847,  301,  265,  250,  251,  252,  264,
+  374,  116,   68,  164,  265,  493,  265,  265,  159,  272,
+  265,  162,  265,  265,  265,  265,  265,  375,  265,  265,
+  265,  265,  265,  265,  265,  265,  265,  265,  265,  265,
+  265,  265,  265,  265,  426,  391,  301,  116,  265,  265,
+  265,  273,   76,  265,  265,  392,  265,  265,  265,  117,
+  265,  477,  265,  478,  265,  884,  265,  819,  265,  265,
+  265,  265,  852,  265,  265,  265,  265,  305,  665,  817,
+  265,  265,  265,  265,  265,  265,  265,  573,  265,  265,
+  265,  265,  265,  473,  837,  752,  804,  705,  779,  783,
+  652,  265,  265,  265,  780,   15,  134,  191,  636,  880,
+  152,  265,  153,  768,  301,  666,  288,  288,  288,  288,
+  288,  621,  803,  315,  677,  807,  859,    0,  319,    0,
+  696,    0,    0,    0,  261,  288,  288,  288,  261,  261,
+  261,    0,  261,  261,  261,  261,  261,  261,    0,  261,
+  261,  261,    0,    0,  261,    0,    0,    0,  261,  261,
+  261,  261,  261,  261,  261,    0,    0,  261,  261,  261,
+    0,    0,  285,    0,  261,  261,  285,  261,  261,  285,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  261,    0,    0,    0,  285,    0,  285,    0,    0,
+  261,    0,  261,  261,    0,    0,  261,    0,  261,  261,
+  261,  261,  261,    0,  261,  261,  261,  261,  261,  261,
+  261,  261,  261,  261,  261,  261,  261,  261,  261,  261,
+    0,    0,    0,    0,  261,  261,  261,    0,    0,  261,
+  261,    0,  261,  261,  261,    0,  261,    0,  261,    0,
+  261,    0,  261,    0,  261,  261,  261,  261,    0,  261,
+  261,  261,  261,  262,    0,    0,  261,  261,  261,  261,
+  261,  261,  261,  262,  261,  261,  261,  261,  261,    0,
+    0,    0,    0,    0,    0,    0,    0,  261,  261,  261,
+    0,    0,    0,    0,   83,   83,    0,  261,    0,    0,
+  262,    0,    0,    0,  262,  262,  262,  262,  262,   83,
+   83,    0,   83,   83,   83,   83,    0,    0,    0,    0,
+    0,  262,    0,  262,  262,  262,   83,    0,    0,    0,
+  151,    0,    0,    0,    0,  288,  288,  288,    0,  288,
+  288,  288,  288,  288,  288,    0,    0,  288,  288,    0,
+    0,    0,    0,    0,  154,  155,    0,    0,    0,  156,
+  157,  158,  159,    0,    0,    0,    0,    0,    0,  160,
+  161,  162,  163,  164,  165,  166,  167,  168,  169,  170,
+    0,  171,  172,  173,  174,  175,  176,  177,  178,    0,
+  179,    0,    0,    0,    0,  285,  285,  285,    0,  285,
+  285,  285,  285,  285,  285,    0,    0,  285,  285,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  270,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  270,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  180,    0,    0,
+    0,    0,    0,  181,  182,    0,  288,    0,  183,  270,
+  270,  270,  270,  270,  270,    0,    0,    0,  184,  185,
+    0,  186,  187,  188,  189,    0,    0,  270,   84,  270,
+  270,  270,    0,    0,    0,  190,  288,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  211,    0,  505,  205,    0,  206,  262,
+    0,    0,    0,  262,  262,  262,    0,  262,  262,  262,
+  262,  262,  262,    0,  262,  262,  262,    0,    0,  262,
+    0,    0,    0,  262,  262,  262,  262,  262,  262,  262,
+    0,    0,  262,  262,  262,    0,    0,    0,    0,  262,
+  262,    0,  262,  262,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  262,    0,    0,    0,
+    0,    0,    0,    0,    0,  262,    0,  262,  262,    0,
+    0,  262,    0,  262,  262,  262,  262,  262,    0,  262,
+  262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+  262,  262,  262,  262,  262,    0,    0,    0,    0,  262,
+  262,  262,    0,    0,  262,  262,    0,  262,  262,  262,
+    0,  262,    0,  262,    0,  262,    0,  262,    0,  262,
+  262,  262,  262,    0,  262,  262,  262,  262,    0,    0,
+    0,  262,  262,  262,  262,  262,  262,  262,    0,  262,
+  262,  262,  262,  262,    0,    0,  191,    0,  810,  152,
+    0,  153,  262,  262,  262,  270,    0,    0,    0,  270,
+  270,  270,  262,  270,  270,  270,  270,  270,  270,    0,
+  270,  270,  270,    0,    0,  270,    0,    0,    0,  270,
+  270,  270,  270,  270,  270,  270,    0,    0,  270,  270,
+  270,    0,    0,    0,    0,  270,  270,    0,  270,  270,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  270,    0,    0,    0,    0,    0,    0,    0,
+    0,  270,    0,  270,  270,    0,  506,  270,    0,  270,
+  270,  270,  270,  270,    0,  270,  270,  270,  270,  270,
+  270,  270,  270,  270,  270,  270,  270,  270,  270,  270,
+  270,  208,    0,    0,  209,  270,  270,  270,    0,    0,
+  270,  270,    0,  270,  270,  270,    0,  270,    0,  270,
+    0,  270,    0,  270,    0,  270,  270,  270,  270,    0,
+  270,  270,  270,  270,  267,    0,    0,  270,  270,  270,
+  270,  270,  270,  270,  267,  270,  270,  270,  270,  270,
+    0,    0,    0,    0,    0,    0,    0,    0,  270,  270,
+  270,    0,    0,    0,    0,    0,    0,    0,  270,    0,
+    0,  267,    0,    0,    0,  267,  267,  267,  267,  267,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  181,
+  182,    0,  267,    0,  267,  267,  267,    0,    0,    0,
+    0,    0,    0,    0,  184,  185,    0,  186,  187,  188,
+  189,    0,    0,    0,  507,    0,    0,    0,    0,  151,
+    0,  190,    0,    0,    0,    0,    0,    0,  525,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  154,  155,    0,    0,    0,  156,  157,
+  158,  159,    0,    0,    0,    0,    0,    0,  160,  161,
+  162,  163,  164,  165,  166,  167,  168,  169,  170,    0,
+  171,  172,  173,  174,  175,  176,  177,  178,    0,  179,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  298,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  298,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  298,  298,  298,  298,  298,  180,  298,    0,    0,
+    0,    0,  181,  182,    0,    0,    0,  183,  298,    0,
+  298,  298,  298,    0,    0,    0,    0,  184,  185,  526,
+  186,  187,  188,  189,    0,    0,    0,   84,    0,    0,
+    0,    0,    0,    0,  527,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  211,    0,  207,  205,    0,  206,
+  267,    0,    0,    0,  267,  267,  267,    0,  267,  267,
+  267,  267,  267,  267,    0,  267,  267,  267,    0,    0,
+  267,    0,    0,    0,  267,  267,  267,  267,  267,  267,
+  267,    0,    0,  267,  267,  267,    0,    0,    0,    0,
+  267,  267,    0,  267,  267,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,   20,  267,    0,    0,
+    0,    0,    0,    0,    0,    0,  267,    0,  267,  267,
+    0,    0,  267,    0,  267,  267,  267,  267,  267,    0,
+  267,  267,  267,  267,  267,  267,  267,  267,  267,  267,
+  267,  267,  267,  267,  267,  267,    0,    0,    0,    0,
+  267,  267,  267,    0,    0,  267,  267,    0,  267,  267,
+  267,    0,  267,    0,  267,    0,  267,    0,  267,    0,
+  267,  267,  267,  267,    0,  267,  267,  267,  267,    0,
+    0,    0,  267,  267,  267,  267,  267,  267,  267,    0,
+  267,  267,  267,  267,  267,    0,    0,    0,    0,    0,
+    0,    0,    0,  267,  267,  267,  298,    0,    0,    0,
+  298,  298,  298,  267,  298,  298,  298,  298,  298,  298,
+    0,  298,  298,  298,    0,    0,  298,    0,    0,    0,
+  298,  298,  298,  298,  298,  298,  298,    0,    0,  298,
+  298,  298,    0,    0,    0,    0,  298,  298,    0,  298,
+  298,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  298,    0,    0,    0,    0,    0,    0,
+    0,    0,  298,    0,  298,  298,    0,    0,  298,    0,
+  298,  298,  298,  298,  298,    0,  298,  298,  298,  298,
+  298,  298,  298,  298,  298,  298,  298,  298,  298,  298,
+  298,  298,  208,    0,    0,  209,  298,  298,  298,    0,
+    0,  298,  298,  229,  298,  298,  298,    0,  298,    0,
+  298,    0,  298,  229,  298,    0,    0,  298,  298,  298,
+    0,  298,  298,  298,  298,    0,    0,    0,  298,  298,
+  298,  298,  298,  298,  298,    0,  298,  298,  298,  298,
+  298,    0,    0,    0,  229,  229,  229,  229,  229,  298,
+  298,  298,    0,    0,    0,    0,    0,    0,    0,  298,
+    0,  229,    0,  229,  229,  229,    0,    0,    0,    0,
+    0,    0,   20,    0,    0,    0,   20,   20,   20,   20,
+  181,  182,   20,    0,    0,   20,   20,   20,  393,  391,
+    0,  392,   20,   20,    0,  184,  185,    0,  186,  187,
+  188,  189,    0,    0,  649,  210,  396,  381,  397,   20,
+    0,    0,  190,    0,    0,    0,    0,    0,   20,    0,
+   20,   20,    0,    0,   20,    0,   20,   20,   20,   20,
+   20,    0,   20,   20,   20,   20,   20,   20,   20,   20,
+   20,   20,   20,   20,   20,   20,   20,   20,    0,    0,
+    0,    0,   20,   20,   20,    0,    0,   20,   20,  230,
+   20,   20,   20,    0,   20,    0,   20,    0,   20,  230,
+   20,    0,    0,   20,   20,   20,    0,    0,   20,   20,
+   20,    0,    0,    0,    0,   20,   20,   20,   20,   20,
+   20,    0,   20,   20,   20,   20,   20,    0,    0,    0,
+  230,  230,  230,  230,  230,   20,   20,   20,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  230,    0,  230,
+  230,  230,    0,    0,  314,    0,  313,  205,    0,  206,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  229,
+    0,    0,    0,  229,  229,  229,    0,  229,  229,  229,
+  229,  229,  229,    0,  229,  229,  229,    0,    0,  229,
+    0,    0,    0,  229,  229,  229,  229,  229,  229,  229,
+    0,    0,  229,  229,  229,    0,    0,    0,    0,  229,
+  229,    0,  229,  229,    0,    0,  382,  383,  384,    0,
+  385,  386,  387,  388,  389,  390,  229,    0,  394,  395,
+    0,    0,    0,    0,    0,  229,    0,  229,  229,    0,
+    0,  229,    0,  229,  229,  229,  229,  229,    0,  229,
+  229,  229,  229,  229,  229,  229,  229,  229,  229,  229,
+  229,  229,  229,  229,  229,    0,    0,    0,    0,  229,
+  229,  229,    0,    0,  229,  229,    0,  229,  229,  229,
+    0,  229,    0,  229,    0,  229,    0,  229,    0,    0,
+  229,  229,  229,    0,  229,  229,  229,  229,    0,    0,
+    0,  229,  229,  229,  229,  229,  229,  229,    0,  229,
+  229,  229,  229,  229,    0,    0,    0,    0,    0,    0,
+    0,    0,  229,  229,  229,  230,    0,    0,    0,  230,
+  230,  230,  229,  230,  230,  230,  230,  230,  230,    0,
+  230,  230,  230,  393,  391,  230,  392,    0,    0,  230,
+  230,  230,  230,  230,  230,  230,    0,    0,  230,  230,
+  230,  396,  381,  397,    0,  230,  230,    0,  230,  230,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  230,    0,    0,    0,    0,    0,    0,    0,
+    0,  230,  208,  230,  230,  209,    0,  230,    0,  230,
+  230,  230,  230,  230,    0,  230,  230,  230,  230,  230,
+  230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
+  230,    0,    0,    0,    0,  230,  230,  230,    0,    0,
+  230,  230,  471,  230,  230,  230,    0,  230,    0,  230,
+    0,  230,  471,  230,    0,    0,  230,  230,  230,    0,
+  230,  230,  230,  230,    0,    0,    0,  230,  230,  230,
+  230,  230,  230,  230,    0,  230,  230,  230,  230,  230,
+    0,    0,    0,  199,  199,  199,  471,  199,  230,  230,
+  181,  182,    0,    0,    0,    0,    0,    0,  230,    0,
+    0,    0,  199,  199,  199,  184,  185,   21,  186,  187,
+  188,  189,    0,    0,    0,  210,    0,    0,    0,    0,
+    0,    0,  190,    0,    0,  582,  393,  391,    0,  392,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  777,   28,  396,  381,  397,    0,    0,   31,
+  299,    0,    0,    0,   35,   36,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,   45,   46,   47,   48,   49,
+   50,  382,  383,  384,    0,  385,  386,  387,  388,  389,
+  390,    0,    0,  394,  395,    0,   59,    0,    0,    0,
+    0,    0,    0,    0,    0,   64,    0,    0,  239,    0,
+    0,    0,    0,   68,    0,   70,    0,    0,  239,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,   84,    0,    0,    0,    0,    0,    0,  239,
+  239,  239,  239,  239,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  239,    0,    0,  239,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  471,    0,
+    0,    0,  199,  199,  199,    0,  199,  199,  199,  199,
+  199,  199,    0,    0,  199,  199,    0,    0,  471,    0,
+    0,    0,  471,  471,  471,  471,  471,  471,  471,    0,
+    0,  471,  471,  471,    0,    0,    0,    0,  471,  471,
+    0,  471,  471,    0,  382,  383,  384,    0,  385,  386,
+  387,  388,  389,  390,    0,  471,  394,  395,    0,    0,
+    0,    0,    0,    0,  471,    0,  471,  471,    0,    0,
+  471,    0,  471,  471,  471,  471,  471,    0,  471,  471,
+  471,  471,  471,  471,  471,  471,  471,  471,  471,  471,
+  471,  471,  471,  471,    0,    0,    0,    0,  471,  471,
+  471,    0,    0,  471,  471,    0,  471,  471,  471,    0,
+  471,    0,  471,    0,  471,    0,  471,    0,    0,  471,
+  471,  471,    0,  471,  471,  471,  471,    0,    0,    0,
+  471,  471,  471,  471,  471,  471,  471,    0,  471,  471,
+  471,  471,  471,    0,    0,    0,    0,    0,    0,    0,
+    0,  471,  471,  471,  239,    0,    0,    0,  239,  239,
+  239,  471,  239,  239,  239,  239,  239,  239,    0,  239,
+  239,  537,  393,  391,  239,  392,    0,    0,  239,  239,
+  239,  239,  239,  239,  239,    0,    0,  239,  239,  239,
+  396,  381,  397,    0,  239,  239,    0,  239,  239,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  239,    0,    0,    0,    0,    0,    0,    0,    0,
+  239,    0,  239,  239,    0,    0,  239,    0,  239,  239,
+  239,  239,  239,    0,  239,  239,  239,  239,  239,  239,
+  239,  239,  239,  239,  239,  239,  239,  239,  239,  239,
+    0,    0,    0,    0,  239,  239,  239,    0,    0,  239,
+  239,  240,  239,  239,  239,    0,  239,    0,  239,    0,
+  239,  240,  239,    0,    0,  239,  239,  239,    0,  239,
+  239,  239,  239,    0,    0,    0,  239,  239,  239,  239,
+  239,  239,  239,    0,  239,  239,  239,  239,  239,    0,
+    0,    0,  240,  240,  240,  240,  240,  239,  239,  239,
+    0,    0,    0,    0,    0,    0,    0,  239,    0,  240,
+    0,    0,  240,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  196,  196,  196,    0,  196,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  196,    0,  196,  196,  196,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  382,  383,  384,    0,  385,  386,  387,  388,  389,  390,
+    0,    0,  394,  395,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  258,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  258,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  258,  258,
+  258,  258,  258,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  258,    0,    0,  258,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  240,    0,    0,
+    0,  240,  240,  240,    0,  240,  240,  240,  240,  240,
+  240,    0,  240,  240,    0,    0,    0,  240,    0,    0,
+    0,  240,  240,  240,  240,  240,  240,  240,    0,    0,
+  240,  240,  240,    0,    0,    0,    0,  240,  240,    0,
+  240,  240,    0,  196,  196,  196,    0,  196,  196,  196,
+  196,  196,  196,    0,  240,  196,  196,    0,    0,    0,
+    0,    0,    0,  240,    0,  240,  240,    0,    0,  240,
+    0,  240,  240,  240,  240,  240,    0,  240,  240,  240,
+  240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+  240,  240,  240,    0,    0,    0,    0,  240,  240,  240,
+    0,    0,  240,  240,    0,  240,  240,  240,    0,  240,
+    0,  240,    0,  240,    0,  240,    0,    0,  240,  240,
+  240,    0,  240,  240,  240,  240,    0,    0,    0,  240,
+  240,  240,  240,  240,  240,  240,    0,  240,  240,  240,
+  240,  240,    0,    0,    0,    0,    0,    0,    0,    0,
+  240,  240,  240,  258,    0,    0,    0,  258,  258,  258,
+  240,  258,  258,  258,  258,  258,  258,    0,  258,  258,
+  541,  393,  391,  258,  392,    0,    0,  258,  258,  258,
+  258,  258,  258,  258,    0,    0,  258,  258,  258,  396,
+  381,  397,    0,  258,  258,    0,  258,  258,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  258,    0,    0,    0,    0,    0,    0,    0,    0,  258,
+    0,  258,  258,    0,    0,  258,    0,  258,  258,  258,
+  258,  258,    0,  258,  258,  258,  258,  258,  258,  258,
+  258,  258,  258,  258,  258,  258,  258,  258,  258,    0,
+    0,    0,    0,  258,  258,  258,    0,    0,  258,  258,
+  470,  258,  258,  258,    0,  258,    0,  258,    0,  258,
+  470,  258,    0,    0,  258,  258,  258,    0,  258,  258,
+  258,  258,    0,    0,    0,  258,  258,  258,  258,  258,
+  258,  258,    0,  258,  258,  258,  258,  258,    0,    0,
+    0,    0,  196,  196,    0,  196,  258,  258,  258,    0,
+    0,    0,    0,    0,    0,    0,  258,    0,    0,    0,
+  196,  196,  196,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  582,  393,  391,    0,  392,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  396,  381,  397,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  382,
+  383,  384,    0,  385,  386,  387,  388,  389,  390,    0,
+    0,  394,  395,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  237,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  237,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  237,    0,  237,
+  237,  237,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  237,    0,    0,  237,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  470,    0,    0,    0,
+  196,  196,  196,    0,  196,  196,  196,  196,  196,  196,
+    0,    0,  196,  196,    0,    0,  470,    0,    0,    0,
+  470,  470,  470,  470,  470,  470,  470,    0,    0,  470,
+  470,  470,    0,    0,    0,    0,  470,  470,    0,  470,
+  470,    0,  382,  383,  384,    0,  385,  386,  387,  388,
+  389,  390,    0,  470,  394,  395,    0,    0,    0,    0,
+    0,    0,  470,    0,  470,  470,    0,    0,  470,    0,
+  470,  470,  470,  470,  470,    0,  470,  470,  470,  470,
+  470,  470,  470,  470,  470,  470,  470,  470,  470,  470,
+  470,  470,    0,    0,    0,    0,  470,  470,  470,    0,
+    0,  470,  470,    0,  470,  470,  470,    0,  470,    0,
+  470,    0,  470,    0,  470,    0,    0,  470,  470,  470,
+    0,  470,  470,  470,  470,    0,    0,    0,  470,  470,
+  470,  470,  470,  470,  470,    0,  470,  470,  470,  470,
+  470,    0,    0,    0,    0,    0,    0,    0,    0,  470,
+  470,  470,  237,    0,    0,    0,  237,  237,  237,  470,
+  237,  237,  237,  237,  237,  237,    0,  237,    0,  607,
+  393,  391,  237,  392,    0,    0,  237,  237,  237,  237,
+  237,  237,  237,    0,    0,  237,  237,  237,  396,  381,
+  397,    0,  237,  237,    0,  237,  237,  393,  391,    0,
+  392,    0,    0,    0,    0,    0,    0,    0,    0,  237,
+    0,    0,    0,  777,    0,  396,  381,  397,  237,    0,
+  237,  237,    0,    0,  237,    0,  237,  237,  237,  237,
+  237,    0,  237,  237,  237,  237,  237,  237,  237,  237,
+  237,  237,  237,  237,  237,  237,  237,  237,    0,    0,
+    0,    0,  237,  237,  237,    0,    0,  237,  237,  238,
+  237,  237,  237,    0,  237,    0,  237,    0,  237,  238,
+  237,    0,    0,  237,  237,  237,    0,  237,  237,  237,
+  237,    0,    0,    0,  237,  237,  237,  237,  237,  237,
+  237,    0,  237,  237,  237,  237,  237,    0,    0,    0,
+  238,    0,  238,  238,  238,  237,  237,  237,    0,    0,
+    0,    0,    0,    0,    0,  237,    0,  238,    0,    0,
+  238,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  398,  196,  196,  398,  196,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  196,  196,  196,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  382,  383,
+  384,    0,  385,  386,  387,  388,  389,  390,    0,    0,
+  394,  395,    0,    0,  285,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  285,  382,  383,  384,    0,  385,
+  386,  387,  388,  389,  390,    0,    0,  394,  395,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  285,    0,    0,  285,  285,  285,  285,  285,  285,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  238,    0,    0,    0,  238,
+  238,  238,    0,  238,  238,  238,  238,  238,  238,    0,
+  238,    0,    0,    0,    0,  238,    0,    0,    0,  238,
+  238,  238,  238,  238,  238,  238,    0,    0,  238,  238,
+  238,    0,    0,    0,    0,  238,  238,    0,  238,  238,
+    0,  196,  196,  196,    0,  196,  196,  196,  196,  196,
+  196,    0,  238,  196,  196,    0,    0,    0,    0,    0,
+    0,  238,    0,  238,  238,    0,    0,  238,    0,  238,
+  238,  238,  238,  238,    0,  238,  238,  238,  238,  238,
+  238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
+  238,    0,    0,    0,    0,  238,  238,  238,    0,    0,
+  238,  238,    0,  238,  238,  238,    0,  238,    0,  238,
+    0,  238,    0,  238,    0,    0,  238,  238,  238,    0,
+  238,  238,  238,  238,    0,    0,    0,  238,  238,  238,
+  238,  238,  238,  238,    0,  238,  238,  238,  238,  238,
+  285,  234,    0,    0,    0,    0,    0,    0,  238,  238,
+  238,  234,    0,    0,    0,  285,  285,  285,  238,    0,
+  285,    0,  398,    0,  285,  285,  285,  285,  285,  285,
+  285,    0,    0,  285,  285,  285,    0,    0,    0,    0,
+  285,  285,  234,  285,  285,  234,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  285,    0,  234,
+    0,    0,  234,    0,    0,    0,  285,    0,  285,  285,
+    0,    0,  285,    0,  285,  285,  285,  285,  285,    0,
+  285,  285,  285,  285,  285,  285,  285,  285,  285,  285,
+  285,  285,  285,  285,  285,  285,    0,    0,    0,    0,
+  285,  285,  285,    0,    0,  285,  285,    0,  285,  285,
+  285,    0,  285,    0,  285,    0,  285,    0,  285,    0,
+    0,  285,  285,  285,    0,    0,  285,  285,  285,    0,
+    0,    0,  285,  285,  285,  285,  285,  285,  285,    0,
+  285,  285,  285,  285,  285,    0,  253,    0,    0,    0,
+    0,    0,    0,  285,  285,  285,  253,    0,    0,    0,
+    0,    0,    0,  285,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  253,    0,    0,
+  253,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  253,    0,    0,  253,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  234,    0,    0,
+    0,  234,  234,  234,    0,    0,    0,    0,    0,    0,
+    0,    0,  234,    0,    0,    0,    0,  234,    0,    0,
+    0,  234,  234,  234,  234,  234,  234,  234,    0,    0,
+  234,  234,  234,    0,    0,    0,    0,  234,  234,    0,
+  234,  234,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  234,    0,    0,    0,    0,    0,
+    0,    0,    0,  234,    0,  234,  234,    0,    0,  234,
+    0,  234,  234,  234,  234,  234,    0,  234,  234,  234,
+  234,  234,  234,  234,  234,  234,  234,  234,  234,  234,
+  234,  234,  234,    0,    0,    0,    0,  234,  234,  234,
+    0,    0,  234,  234,    0,  234,  234,  234,    0,  234,
+    0,  234,    0,  234,    0,  234,    0,    0,  234,  234,
+  234,    0,  234,  234,  234,  234,    0,    0,    0,  234,
+  234,  234,  234,  234,  234,  234,    0,  234,  234,  234,
+  234,  234,  253,  244,    0,    0,  253,  253,  253,    0,
+  234,  234,  234,  244,    0,    0,    0,  253,    0,    0,
+  234,    0,  253,    0,    0,    0,  253,  253,  253,  253,
+  253,  253,  253,    0,    0,  253,  253,  253,    0,    0,
+    0,    0,  253,  253,  244,  253,  253,  244,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  253,
+    0,  244,    0,    0,  244,    0,    0,    0,  253,    0,
+  253,  253,    0,    0,  253,    0,  253,  253,  253,  253,
+  253,    0,  253,  253,  253,  253,  253,  253,  253,  253,
+  253,  253,  253,  253,  253,  253,  253,  253,    0,    0,
+    0,    0,  253,  253,  253,    0,    0,  253,  253,    0,
+  253,  253,  253,    0,  253,    0,  253,    0,  253,    0,
+  253,    0,    0,  253,  253,  253,    0,  253,  253,  253,
+  253,    0,    0,    0,  253,  253,  253,  253,  253,  253,
+  253,    0,  253,  253,  253,  253,  253,    0,  242,    0,
+    0,    0,    0,    0,    0,  253,  253,  253,  242,    0,
+    0,    0,    0,    0,    0,  253,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  242,
+    0,    0,  242,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  242,    0,    0,  242,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  244,
+    0,    0,    0,  244,  244,  244,    0,    0,    0,    0,
+    0,    0,    0,    0,  244,    0,    0,    0,    0,  244,
+    0,    0,    0,  244,  244,  244,  244,  244,  244,  244,
+    0,    0,  244,  244,  244,    0,    0,    0,    0,  244,
+  244,    0,  244,  244,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  244,    0,    0,    0,
+    0,    0,    0,    0,    0,  244,    0,  244,  244,    0,
+    0,  244,    0,  244,  244,  244,  244,  244,    0,  244,
+  244,  244,  244,  244,  244,  244,  244,  244,  244,  244,
+  244,  244,  244,  244,  244,    0,    0,    0,    0,  244,
+  244,  244,    0,    0,  244,  244,    0,  244,  244,  244,
+    0,  244,    0,  244,    0,  244,    0,  244,    0,    0,
+  244,  244,  244,    0,  244,  244,  244,  244,    0,    0,
+    0,  244,  244,  244,  244,  244,  244,  244,    0,  244,
+  244,  244,  244,  244,  242,  248,    0,    0,  242,  242,
+  242,    0,  244,  244,  244,  248,    0,    0,    0,  242,
+    0,    0,  244,    0,  242,    0,    0,    0,  242,  242,
+  242,  242,  242,  242,  242,    0,    0,  242,  242,  242,
+    0,    0,    0,    0,  242,  242,  248,  242,  242,  248,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  242,    0,  248,    0,    0,  248,    0,    0,    0,
+  242,    0,  242,  242,    0,    0,  242,    0,  242,  242,
+  242,  242,  242,    0,  242,  242,  242,  242,  242,  242,
+  242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
+    0,    0,    0,    0,  242,  242,  242,    0,    0,  242,
+  242,    0,  242,  242,  242,    0,  242,    0,  242,    0,
+  242,    0,  242,    0,    0,  242,  242,  242,    0,  242,
+  242,  242,  242,    0,    0,    0,  242,  242,  242,  242,
+  242,  242,  242,    0,  242,  242,  242,  242,  242,    0,
+  246,    0,    0,    0,    0,    0,    0,  242,  242,  242,
+  246,    0,    0,    0,    0,    0,    0,  242,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  246,    0,    0,  246,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  246,    0,
+    0,  246,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  248,    0,    0,    0,  248,  248,  248,    0,    0,
+    0,    0,    0,    0,    0,    0,  248,    0,    0,    0,
+    0,  248,    0,    0,    0,  248,  248,  248,  248,  248,
+  248,  248,    0,    0,  248,  248,  248,    0,    0,    0,
+    0,  248,  248,    0,  248,  248,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  248,    0,
+    0,    0,    0,    0,    0,    0,    0,  248,    0,  248,
+  248,    0,    0,  248,    0,  248,  248,  248,  248,  248,
+    0,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+  248,  248,  248,  248,  248,  248,  248,    0,    0,    0,
+    0,  248,  248,  248,    0,    0,  248,  248,    0,  248,
+  248,  248,    0,  248,    0,  248,    0,  248,    0,  248,
+    0,    0,  248,  248,  248,    0,  248,  248,  248,  248,
+    0,    0,    0,  248,  248,  248,  248,  248,  248,  248,
+    0,  248,  248,  248,  248,  248,  246,  241,    0,    0,
+  246,  246,  246,    0,  248,  248,  248,  241,    0,    0,
+    0,  246,    0,    0,  248,    0,  246,    0,    0,    0,
+  246,  246,  246,  246,  246,  246,  246,    0,    0,  246,
+  246,  246,    0,    0,    0,    0,  246,  246,  241,  246,
+  246,  241,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  246,    0,  241,    0,    0,  241,    0,
+    0,    0,  246,    0,  246,  246,    0,    0,  246,    0,
+  246,  246,  246,  246,  246,    0,  246,  246,  246,  246,
+  246,  246,  246,  246,  246,  246,  246,  246,  246,  246,
+  246,  246,    0,    0,    0,    0,  246,  246,  246,    0,
+    0,  246,  246,    0,  246,  246,  246,    0,  246,    0,
+  246,    0,  246,    0,  246,    0,    0,  246,  246,  246,
+    0,  246,  246,  246,  246,    0,    0,    0,  246,  246,
+  246,  246,  246,  246,  246,    0,  246,  246,  246,  246,
+  246,    0,  250,    0,    0,    0,    0,    0,    0,  246,
+  246,  246,  250,    0,    0,    0,    0,    0,    0,  246,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  250,    0,    0,  250,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  250,    0,    0,  250,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  241,    0,    0,    0,  241,  241,  241,
+    0,    0,    0,    0,    0,    0,    0,    0,  241,    0,
+    0,    0,    0,  241,    0,    0,    0,  241,  241,  241,
+  241,  241,  241,  241,    0,    0,  241,  241,  241,    0,
+    0,    0,    0,  241,  241,    0,  241,  241,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  241,    0,    0,    0,    0,    0,    0,    0,    0,  241,
+    0,  241,  241,    0,    0,  241,    0,  241,  241,  241,
+  241,  241,    0,  241,  241,  241,  241,  241,  241,  241,
+  241,  241,  241,  241,  241,  241,  241,  241,  241,    0,
+    0,    0,    0,  241,  241,  241,    0,    0,  241,  241,
+    0,  241,  241,  241,    0,  241,    0,  241,    0,  241,
+    0,  241,    0,    0,  241,  241,  241,    0,  241,  241,
+  241,  241,    0,    0,    0,  241,  241,  241,  241,  241,
+  241,  241,    0,  241,  241,  241,  241,  241,  250,  245,
+    0,    0,  250,  250,  250,    0,  241,  241,  241,  245,
+    0,    0,    0,  250,    0,    0,  241,    0,  250,    0,
+    0,    0,  250,  250,  250,  250,  250,  250,  250,    0,
+    0,  250,  250,  250,    0,    0,    0,    0,  250,  250,
+  245,  250,  250,  245,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  250,    0,  245,    0,    0,
+  245,    0,    0,    0,  250,    0,  250,  250,    0,    0,
+  250,    0,  250,  250,  250,  250,  250,    0,  250,  250,
+  250,  250,  250,  250,  250,  250,  250,  250,  250,  250,
+  250,  250,  250,  250,    0,    0,    0,    0,  250,  250,
+  250,    0,    0,  250,  250,    0,  250,  250,  250,    0,
+  250,    0,  250,    0,  250,    0,  250,    0,    0,  250,
+  250,  250,    0,  250,  250,  250,  250,    0,    0,    0,
+  250,  250,  250,  250,  250,  250,  250,    0,  250,  250,
+  250,  250,  250,    0,  243,    0,    0,    0,    0,    0,
+    0,  250,  250,  250,  243,    0,    0,    0,    0,    0,
+    0,  250,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  243,    0,    0,  243,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  243,    0,    0,  243,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  245,    0,    0,    0,  245,
+  245,  245,    0,    0,    0,    0,    0,    0,    0,    0,
+  245,    0,    0,    0,    0,  245,    0,    0,    0,  245,
+  245,  245,  245,  245,  245,  245,    0,    0,  245,  245,
+  245,    0,    0,    0,    0,  245,  245,    0,  245,  245,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  245,    0,    0,    0,    0,    0,    0,    0,
+    0,  245,    0,  245,  245,    0,    0,  245,    0,  245,
+  245,  245,  245,  245,    0,  245,  245,  245,  245,  245,
+  245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
+  245,    0,    0,    0,    0,  245,  245,  245,    0,    0,
+  245,  245,    0,  245,  245,  245,    0,  245,    0,  245,
+    0,  245,    0,  245,    0,    0,  245,  245,  245,    0,
+  245,  245,  245,  245,    0,    0,    0,  245,  245,  245,
+  245,  245,  245,  245,    0,  245,  245,  245,  245,  245,
+  243,  259,    0,    0,  243,  243,  243,    0,  245,  245,
+  245,  259,    0,    0,    0,  243,    0,    0,  245,    0,
+  243,    0,    0,    0,  243,  243,  243,  243,  243,  243,
+  243,    0,    0,  243,  243,  243,    0,    0,    0,    0,
+  243,  243,  259,  243,  243,  259,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  243,    0,  259,
+    0,    0,  259,    0,    0,    0,  243,    0,  243,  243,
+    0,    0,  243,    0,  243,  243,  243,  243,  243,    0,
+  243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+  243,  243,  243,  243,  243,  243,    0,    0,    0,    0,
+  243,  243,  243,    0,    0,  243,  243,    0,  243,  243,
+  243,    0,  243,    0,  243,    0,  243,    0,  243,    0,
+    0,  243,  243,  243,    0,  243,  243,  243,  243,    0,
+    0,    0,  243,  243,  243,  243,  243,  243,  243,    0,
+  243,  243,  243,  243,  243,    0,  257,    0,    0,    0,
+    0,    0,    0,  243,  243,  243,  257,    0,    0,    0,
+    0,    0,    0,  243,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  257,    0,    0,
+  257,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  257,    0,    0,  257,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  259,    0,    0,
+    0,  259,  259,  259,    0,    0,    0,    0,    0,    0,
+    0,    0,  259,    0,    0,    0,    0,  259,    0,    0,
+    0,  259,  259,  259,  259,  259,  259,  259,    0,    0,
+  259,  259,  259,    0,    0,    0,    0,  259,  259,    0,
+  259,  259,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  259,    0,    0,    0,    0,    0,
+    0,    0,    0,  259,    0,  259,  259,    0,    0,  259,
+    0,  259,  259,  259,  259,  259,    0,  259,  259,  259,
+  259,  259,  259,  259,  259,  259,  259,  259,  259,  259,
+  259,  259,  259,    0,    0,    0,    0,  259,  259,  259,
+    0,    0,  259,  259,    0,  259,  259,  259,    0,  259,
+    0,  259,    0,  259,    0,  259,    0,    0,  259,  259,
+  259,    0,  259,  259,  259,  259,    0,    0,    0,  259,
+  259,  259,  259,  259,  259,  259,    0,  259,  259,  259,
+  259,  259,  257,  249,    0,    0,  257,  257,  257,    0,
+  259,  259,  259,  249,    0,    0,    0,  257,    0,    0,
+  259,    0,  257,    0,    0,    0,  257,  257,  257,  257,
+  257,  257,  257,    0,    0,  257,  257,  257,    0,    0,
+    0,    0,  257,  257,  249,  257,  257,  249,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  257,
+    0,  249,    0,    0,  249,    0,    0,    0,  257,    0,
+  257,  257,    0,    0,  257,    0,  257,  257,  257,  257,
+  257,    0,  257,  257,  257,  257,  257,  257,  257,  257,
+  257,  257,  257,  257,  257,  257,  257,  257,    0,    0,
+    0,    0,  257,  257,  257,    0,    0,  257,  257,    0,
+  257,  257,  257,    0,  257,    0,  257,    0,  257,    0,
+  257,    0,    0,  257,  257,  257,    0,  257,  257,  257,
+  257,    0,    0,    0,  257,  257,  257,  257,  257,  257,
+  257,    0,  257,  257,  257,  257,  257,    0,  247,    0,
+    0,    0,    0,    0,    0,  257,  257,  257,  247,    0,
+    0,    0,    0,    0,    0,  257,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  247,
+    0,    0,  247,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  247,    0,    0,  247,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  249,
+    0,    0,    0,  249,  249,  249,    0,    0,    0,    0,
+    0,    0,    0,    0,  249,    0,    0,    0,    0,  249,
+    0,    0,    0,  249,  249,  249,  249,  249,  249,  249,
+    0,    0,  249,  249,  249,    0,    0,    0,    0,  249,
+  249,    0,  249,  249,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  249,    0,    0,    0,
+    0,    0,    0,    0,    0,  249,    0,  249,  249,    0,
+    0,  249,    0,  249,  249,  249,  249,  249,    0,  249,
+  249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
+  249,  249,  249,  249,  249,    0,    0,    0,    0,  249,
+  249,  249,    0,    0,  249,  249,    0,  249,  249,  249,
+    0,  249,    0,  249,    0,  249,    0,  249,    0,    0,
+  249,  249,  249,    0,  249,  249,  249,  249,    0,    0,
+    0,  249,  249,  249,  249,  249,  249,  249,    0,  249,
+  249,  249,  249,  249,  247,    0,    0,    0,  247,  247,
+  247,  445,  249,  249,  249,    0,    0,    0,    0,  247,
+    0,  445,  249,    0,  247,    0,    0,    0,  247,  247,
+  247,  247,  247,  247,  247,    0,    0,  247,  247,  247,
+    0,    0,    0,    0,  247,  247,    0,  247,  247,    0,
+    0,    0,  445,  445,  445,  445,  445,    0,    0,    0,
+    0,  247,    0,    0,    0,    0,    0,    0,    0,    0,
+  247,    0,  247,  247,    0,    0,  247,    0,  247,  247,
+  247,  247,  247,    0,  247,  247,  247,  247,  247,  247,
+  247,  247,  247,  247,  247,  247,  247,  247,  247,  247,
+    0,    0,    0,    0,  247,  247,  247,    0,    0,  247,
+  247,    0,  247,  247,  247,    0,  247,    0,  247,    0,
+  247,    0,  247,    0,    0,  247,  247,  247,    0,  247,
+  247,  247,  247,    0,    0,    0,  247,  247,  247,  247,
+  247,  247,  247,    0,  247,  247,  247,  247,  247,    0,
+    0,    0,    0,    0,    0,    0,  252,  247,  247,  247,
+    0,    0,    0,    0,    0,    0,  252,  247,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  252,    0,    0,
+  252,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  252,    0,    0,  252,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  445,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  445,  445,  445,    0,    0,  445,    0,    0,
+    0,  445,  445,  445,  445,  445,  445,  445,    0,    0,
+  445,  445,  445,    0,    0,    0,    0,  445,  445,    0,
+  445,  445,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  445,    0,    0,    0,    0,    0,
+    0,    0,    0,  445,    0,  445,  445,    0,    0,  445,
+    0,  445,  445,  445,  445,  445,    0,  445,  445,  445,
+  445,  445,  445,  445,  445,  445,  445,  445,  445,  445,
+  445,  445,  445,    0,    0,    0,    0,  445,  445,  445,
+    0,    0,  445,  445,    0,  445,  445,  445,    0,  445,
+    0,  445,    0,  445,    0,  445,    0,    0,  445,  445,
+  445,    0,    0,  445,  445,  445,    0,    0,    0,  445,
+  445,  445,  445,  445,  445,  445,    0,  445,  445,  445,
+  445,  445,  252,  251,    0,    0,  252,  252,    0,    0,
+  445,  445,  445,  251,    0,    0,    0,  252,    0,    0,
+  445,    0,  252,    0,    0,    0,  252,  252,  252,  252,
+  252,  252,  252,    0,    0,  252,  252,  252,    0,    0,
+    0,    0,  252,  252,  251,  252,  252,  251,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  252,
+    0,  251,    0,    0,  251,    0,    0,    0,  252,    0,
+  252,  252,    0,    0,  252,    0,  252,  252,  252,  252,
+  252,    0,  252,  252,  252,  252,  252,  252,  252,  252,
+  252,  252,  252,  252,  252,  252,  252,  252,    0,    0,
+    0,    0,  252,  252,  252,    0,    0,  252,  252,    0,
+  252,  252,  252,    0,  252,    0,  252,    0,  252,    0,
+  252,    0,    0,  252,  252,  252,    0,  252,  252,  252,
+  252,    0,    0,    0,  252,  252,  252,  252,  252,  252,
+  252,    0,  252,  252,  252,  252,  252,    0,  446,    0,
+    0,    0,    0,    0,    0,  252,  252,  252,  446,    0,
+    0,    0,    0,    0,    0,  252,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  446,
+  446,  446,  446,  446,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  615,  393,  391,    0,  392,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  396,  381,  397,    0,    0,    0,    0,    0,    0,  251,
+    0,    0,    0,  251,  251,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  251,    0,    0,    0,    0,  251,
+    0,    0,    0,  251,  251,  251,  251,  251,  251,  251,
+    0,    0,  251,  251,  251,    0,    0,    0,    0,  251,
+  251,    0,  251,  251,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  437,    0,    0,  251,    0,    0,    0,
+    0,    0,    0,  437,    0,  251,    0,  251,  251,    0,
+    0,  251,    0,  251,  251,  251,  251,  251,    0,  251,
+  251,  251,  251,  251,  251,  251,  251,  251,  251,  251,
+  251,  251,  251,  251,  251,  443,  443,  437,  443,  251,
+  251,  251,    0,    0,  251,  251,    0,  251,  251,  251,
+    0,  251,    0,  251,    0,  251,    0,  251,    0,    0,
+  251,  251,  251,    0,  251,  251,  251,  251,    0,    0,
+    0,  251,  251,  251,  251,  251,  251,  251,    0,  251,
+  251,  251,  251,  251,  446,    0,    0,    0,    0,    0,
+    0,    0,  251,  251,  251,    0,    0,    0,    0,  446,
+  446,  446,  251,    0,  446,    0,    0,    0,  446,  446,
+  446,  446,  446,  446,  446,    0,    0,  446,  446,  446,
+    0,    0,    0,    0,  446,  446,    0,  446,  446,    0,
+  382,  383,  384,    0,  385,  386,  387,  388,  389,  390,
+    0,  446,  394,  395,    0,    0,    0,    0,    0,    0,
+  446,    0,  446,  446,    0,    0,  446,    0,  446,  446,
+  446,  446,  446,    0,  446,  446,  446,  446,  446,  446,
+  446,  446,  446,  446,  446,  446,  446,  446,  446,  446,
+    0,    0,    0,    0,  446,  446,  446,    0,    0,  446,
+  446,  451,  446,  446,  446,    0,  446,    0,  446,    0,
+  446,  451,  446,    0,    0,  446,  446,  446,    0,    0,
+  446,  446,  446,    0,    0,    0,  446,  446,  446,  446,
+  446,  446,  446,    0,  446,  446,  446,  446,  446,    0,
+    0,    0,  451,  451,  451,  451,  451,  446,  446,    0,
+    0,    0,    0,    0,    0,    0,    0,  446,    0,  437,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  443,  443,  443,    0,    0,  437,
+    0,    0,    0,  437,  437,  437,  437,  437,  437,  437,
+    0,    0,  437,  437,  437,    0,    0,    0,    0,  437,
+  437,    0,  437,  437,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  437,    0,    0,    0,
+    0,    0,    0,    0,    0,  437,    0,  437,  437,    0,
+    0,  437,    0,  437,  437,  437,  437,  437,    0,  437,
+  437,  437,  437,  437,  437,  437,  437,  437,  437,  437,
+  437,  437,  437,  437,  437,    0,    0,    0,    0,  437,
+  437,  437,    0,    0,  437,  437,  448,  437,  437,  437,
+    0,  437,    0,  437,    0,  437,  448,  437,    0,    0,
+  437,  437,  437,    0,    0,  437,  437,  437,    0,    0,
+    0,  437,  437,  437,  437,  437,  437,  437,    0,  437,
+  437,  437,  437,  437,    0,    0,    0,  448,  448,  448,
+  448,  448,  437,  437,  437,    0,    0,    0,    0,    0,
+    0,    0,  437,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  712,
+  393,  391,    0,  392,    0,    0,    0,  451,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  396,  381,
+  397,    0,  451,  451,    0,    0,    0,  451,    0,    0,
+    0,  451,  451,  451,  451,  451,  451,  451,    0,    0,
+  451,  451,  451,    0,    0,    0,    0,  451,  451,    0,
+  451,  451,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  451,    0,    0,    0,    0,    0,
+    0,    0,    0,  451,    0,  451,  451,    0,    0,  451,
+    0,  451,  451,  451,  451,  451,    0,  451,  451,  451,
+  451,  451,  451,  451,  451,  451,  451,  451,  451,  451,
+  451,  451,  451,    0,    0,    0,    0,  451,  451,  451,
+    0,    0,  451,  451,  449,  451,  451,  451,    0,  451,
+    0,  451,    0,  451,  449,  451,    0,    0,  451,  451,
+  451,    0,    0,  451,  451,  451,    0,    0,    0,  451,
+  451,  451,  451,  451,  451,  451,    0,  451,  451,  451,
+  451,  451,    0,    0,    0,  449,  449,  449,  449,  449,
+  451,  451,  451,    0,    0,    0,    0,    0,    0,    0,
+  451,    0,  448,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  448,  448,    0,
+    0,    0,  448,    0,    0,    0,  448,  448,  448,  448,
+  448,  448,  448,    0,    0,  448,  448,  448,    0,    0,
+    0,    0,  448,  448,    0,  448,  448,    0,  382,  383,
+  384,    0,  385,  386,  387,  388,  389,  390,    0,  448,
+  394,  395,    0,    0,    0,    0,    0,    0,  448,    0,
+  448,  448,    0,    0,  448,    0,  448,  448,  448,  448,
+  448,    0,  448,  448,  448,  448,  448,  448,  448,  448,
+  448,  448,  448,  448,  448,  448,  448,  448,    0,    0,
+    0,    0,  448,  448,  448,    0,    0,  448,  448,  450,
+  448,  448,  448,    0,  448,    0,  448,    0,  448,  450,
+  448,    0,    0,  448,  448,  448,    0,    0,  448,  448,
+  448,    0,    0,    0,  448,  448,  448,  448,  448,  448,
+  448,    0,  448,  448,  448,  448,  448,    0,    0,    0,
+  450,  450,  450,  450,  450,  448,  448,  448,    0,    0,
+    0,    0,    0,    0,    0,  448,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  714,  393,  391,    0,  392,    0,    0,    0,
+  449,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  396,  381,  397,    0,  449,  449,    0,    0,    0,
+  449,    0,    0,    0,  449,  449,  449,  449,  449,  449,
+  449,    0,    0,  449,  449,  449,    0,    0,    0,    0,
+  449,  449,    0,  449,  449,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  449,    0,    0,
+    0,    0,    0,    0,    0,    0,  449,    0,  449,  449,
+    0,    0,  449,    0,  449,  449,  449,  449,  449,    0,
+  449,  449,  449,  449,  449,  449,  449,  449,  449,  449,
+  449,  449,  449,  449,  449,  449,    0,    0,    0,    0,
+  449,  449,  449,    0,    0,  449,  449,  421,  449,  449,
+  449,    0,  449,    0,  449,    0,  449,  421,  449,    0,
+    0,  449,  449,  449,    0,    0,  449,  449,  449,    0,
+    0,    0,  449,  449,  449,  449,  449,  449,  449,    0,
+  449,  449,  449,  449,  449,    0,    0,  421,    0,  444,
+  444,    0,  444,  449,  449,  449,    0,    0,    0,    0,
+    0,    0,    0,  449,    0,  450,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  450,  450,    0,    0,    0,  450,    0,    0,    0,  450,
+  450,  450,  450,  450,  450,  450,    0,    0,  450,  450,
+  450,    0,    0,    0,    0,  450,  450,    0,  450,  450,
+    0,  382,  383,  384,    0,  385,  386,  387,  388,  389,
+  390,    0,  450,  394,  395,    0,    0,    0,    0,    0,
+    0,  450,    0,  450,  450,    0,    0,  450,    0,  450,
+  450,  450,  450,  450,    0,  450,  450,  450,  450,  450,
+  450,  450,  450,  450,  450,  450,  450,  450,  450,  450,
+  450,    0,    0,    0,    0,  450,  450,  450,    0,    0,
+  450,  450,  233,  450,  450,  450,    0,  450,    0,  450,
+    0,  450,  233,  450,    0,    0,  450,  450,  450,    0,
+    0,  450,  450,  450,    0,    0,    0,  450,  450,  450,
+  450,  450,  450,  450,    0,  450,  450,  450,  450,  450,
+    0,    0,    0,  233,    0,    0,  233,    0,  450,  450,
+  450,    0,    0,    0,    0,    0,    0,    0,  450,    0,
+  233,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  421,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  444,  444,
+  444,    0,    0,  421,    0,    0,    0,  421,  421,  421,
+  421,  421,  421,  421,    0,    0,  421,  421,  421,    0,
+    0,    0,    0,  421,  421,    0,  421,  421,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  260,    0,
+  421,    0,    0,    0,    0,    0,    0,    0,  260,  421,
+    0,  421,  421,    0,    0,  421,    0,  421,  421,  421,
+  421,  421,    0,  421,  421,  421,  421,  421,  421,  421,
+  421,  421,  421,  421,  421,  421,  421,  421,  421,  260,
+    0,    0,  260,  421,  421,  421,    0,    0,  421,  421,
+    0,  421,  421,  421,    0,  421,  260,  421,    0,  421,
+    0,  421,    0,    0,  421,  421,  421,    0,    0,  421,
+  421,  421,    0,    0,    0,  421,  421,  421,  421,  421,
+  421,  421,    0,  421,  421,  421,  421,  421,    0,    0,
+    0,    0,    0,    0,    0,    0,  421,  421,  421,    0,
+    0,    0,    0,    0,    0,    0,  421,    0,  233,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  233,    0,    0,    0,    0,  233,    0,
+    0,    0,  233,  233,  233,  233,  233,  233,  233,    0,
+    0,  233,  233,  233,    0,    0,    0,    0,  233,  233,
+    0,  233,  233,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  256,    0,  233,    0,    0,    0,    0,
+    0,    0,    0,  256,  233,    0,  233,  233,    0,    0,
+  233,    0,  233,  233,  233,  233,  233,    0,  233,  233,
+  233,  233,  233,  233,  233,  233,  233,  233,  233,  233,
+  233,  233,  233,  233,  256,    0,    0,  256,  233,  233,
+  233,    0,    0,  233,  233,    0,  233,  233,  233,    0,
+  233,  256,  233,    0,  233,    0,  233,    0,    0,  233,
+  233,  233,    0,  233,  233,  233,  233,    0,    0,    0,
+  233,  233,  233,  233,  233,  233,  233,    0,  233,  233,
+  233,  233,  233,    0,  260,    0,    0,    0,    0,    0,
+    0,  233,  233,  233,    0,    0,    0,    0,    0,  260,
+    0,  233,    0,    0,  260,    0,    0,    0,  260,  260,
+  260,  260,  260,  260,  260,    0,    0,  260,  260,  260,
+    0,    0,    0,    0,  260,  260,    0,  260,  260,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  260,    0,    0,    0,    0,    0,    0,    0,    0,
+  260,    0,  260,  260,    0,    0,  260,    0,  260,  260,
+  260,  260,  260,    0,  260,  260,  260,  260,  260,  260,
+  260,  260,  260,  260,  260,  260,  260,  260,  260,  260,
+    0,    0,    0,    0,  260,  260,  260,    0,    0,  260,
+  260,  447,  260,  260,  260,    0,  260,    0,  260,    0,
+  260,  447,  260,    0,    0,  260,  260,  260,    0,  260,
+  260,  260,  260,    0,    0,    0,  260,  260,  260,  260,
+  260,  260,  260,    0,  260,  260,  260,  260,  260,    0,
+    0,    0,  447,    0,  447,  447,  447,  260,  260,  260,
+    0,    0,    0,    0,    0,    0,    0,  260,    0,  256,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  256,    0,    0,    0,    0,  256,
+    0,    0,    0,  256,  256,  256,  256,  256,  256,  256,
+    0,    0,  256,  256,  256,    0,    0,    0,    0,  256,
+  256,    0,  256,  256,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  256,    0,    0,    0,
+    0,    0,    0,    0,    0,  256,    0,  256,  256,    0,
+    0,  256,    0,  256,  256,  256,  256,  256,    0,  256,
+  256,  256,  256,  256,  256,  256,  256,  256,  256,  256,
+  256,  256,  256,  256,  256,    0,    0,    0,    0,  256,
+  256,  256,  185,    0,  256,  256,    0,  256,  256,  256,
+    0,  256,  185,  256,    0,  256,    0,  256,    0,    0,
+  256,  256,  256,    0,  256,  256,  256,  256,    0,    0,
+    0,  256,  256,  256,  256,  256,  256,  256,    0,  256,
+  256,  256,  256,  256,    0,    0,  185,    0,    0,    0,
+    0,    0,  256,  256,  256,    0,    0,    0,    0,    0,
+    0,    0,  256,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  447,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  447,    0,    0,    0,    0,  447,    0,    0,
+    0,  447,  447,  447,  447,  447,  447,  447,    0,    0,
+  447,  447,  447,    0,    0,    0,    0,  447,  447,    0,
+  447,  447,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  453,    0,  447,    0,    0,    0,    0,    0,
+    0,    0,  453,  447,    0,  447,  447,    0,    0,  447,
+    0,  447,  447,  447,  447,  447,    0,  447,  447,  447,
+  447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
+  447,  447,  447,  453,    0,    0,  453,  447,  447,  447,
+    0,    0,  447,  447,    0,  447,  447,  447,    0,  447,
+    0,  447,    0,  447,    0,  447,    0,    0,  447,  447,
+  447,    0,    0,  447,  447,  447,    0,    0,    0,  447,
+  447,  447,  447,  447,  447,  447,    0,  447,  447,  447,
+  447,  447,    0,    0,    0,    0,    0,    0,    0,    0,
+  447,  447,  447,    0,    0,    0,    0,    0,  185,    0,
+  447,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  185,  185,    0,    0,    0,  185,    0,
+    0,    0,  185,  185,  185,  185,  185,  185,  185,    0,
+    0,  185,  185,  185,    0,    0,    0,    0,  185,  185,
+    0,  185,  185,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  454,    0,  185,    0,    0,    0,    0,
+    0,    0,    0,  454,  185,    0,  185,  185,    0,    0,
+  185,    0,  185,  185,  185,  185,  185,    0,  185,  185,
+  185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+  185,  185,  185,  185,  454,    0,    0,  454,  185,  185,
+  185,    0,    0,  185,  185,    0,  185,  185,  185,    0,
+  185,    0,  185,    0,  185,    0,  185,    0,    0,  185,
+  185,  185,    0,    0,  185,  185,  185,    0,    0,    0,
+  185,  185,  185,  185,  185,  185,  185,    0,  185,  185,
+  185,  185,  185,    0,    0,    0,    0,    0,  453,    0,
+    0,  185,  185,  185,    0,    0,    0,    0,    0,    0,
+    0,  185,    0,  453,    0,    0,    0,    0,  453,    0,
+    0,    0,  453,  453,  453,  453,  453,  453,  453,    0,
+    0,  453,  453,  453,    0,    0,    0,    0,  453,  453,
+    0,  453,  453,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  455,    0,  453,    0,    0,    0,    0,
+    0,    0,    0,  455,  453,    0,  453,  453,    0,    0,
+  453,    0,  453,  453,  453,  453,  453,    0,  453,  453,
+  453,  453,  453,  453,  453,  453,  453,  453,  453,  453,
+  453,  453,  453,  453,  455,    0,    0,  455,  453,  453,
+  453,    0,    0,  453,  453,    0,  453,  453,  453,    0,
+  453,    0,  453,    0,  453,    0,  453,    0,    0,  453,
+  453,  453,    0,    0,  453,  453,  453,    0,    0,    0,
+  453,  453,  453,  453,  453,  453,  453,    0,  453,  453,
+  453,  453,  453,    0,    0,    0,    0,    0,    0,    0,
+    0,  453,  453,  453,    0,    0,    0,    0,    0,  454,
+    0,  453,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  454,    0,    0,    0,    0,  454,
+    0,    0,    0,  454,  454,  454,  454,  454,  454,  454,
+    0,    0,  454,  454,  454,    0,    0,    0,    0,  454,
+  454,    0,  454,  454,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  452,    0,  454,    0,    0,    0,
+    0,    0,    0,    0,  452,  454,    0,  454,  454,    0,
+    0,  454,    0,  454,  454,  454,  454,  454,    0,  454,
+  454,  454,  454,  454,  454,  454,  454,  454,  454,  454,
+  454,  454,  454,  454,  454,  452,    0,    0,  452,  454,
+  454,  454,    0,    0,  454,  454,    0,  454,  454,  454,
+    0,  454,    0,  454,    0,  454,    0,  454,    0,    0,
+  454,  454,  454,    0,    0,  454,  454,  454,    0,    0,
+    0,  454,  454,  454,  454,  454,  454,  454,    0,  454,
+  454,  454,  454,  454,    0,    0,    0,    0,    0,  455,
+    0,    0,  454,  454,  454,    0,    0,    0,    0,    0,
+    0,    0,  454,    0,  455,    0,    0,    0,    0,  455,
+    0,    0,    0,  455,  455,  455,  455,  455,  455,  455,
+    0,    0,  455,  455,  455,    0,    0,    0,    0,  455,
+  455,    0,  455,  455,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  185,    0,    0,  455,    0,    0,    0,
+    0,    0,    0,  185,    0,  455,    0,  455,  455,    0,
+    0,  455,    0,  455,  455,  455,  455,  455,    0,  455,
+  455,  455,  455,  455,  455,  455,  455,  455,  455,  455,
+  455,  455,  455,  455,  455,  185,    0,  185,    0,  455,
+  455,  455,    0,    0,  455,  455,    0,  455,  455,  455,
+    0,  455,    0,  455,  185,  455,    0,  455,    0,    0,
+  455,  455,  455,    0,    0,  455,  455,  455,    0,    0,
+    0,  455,  455,  455,  455,  455,  455,  455,    0,  455,
+  455,  455,  455,  455,    0,    0,    0,    0,    0,    0,
+    0,    0,  455,  455,  455,    0,    0,    0,    0,    0,
+  452,    0,  455,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  452,    0,    0,    0,    0,
+  452,    0,    0,    0,  452,  452,  452,  452,  452,  452,
+  452,    0,    0,  452,  452,  452,    0,    0,   51,    0,
+  452,  452,    0,  452,  452,    0,    0,    0,   51,    0,
+    0,    0,    0,    0,    0,    0,    0,  452,    0,    0,
+    0,    0,    0,    0,    0,    0,  452,    0,  452,  452,
+    0,    0,  452,    0,  452,  452,  452,  452,  452,    0,
+  452,  452,  452,  452,  452,  452,  452,  452,  452,  452,
+  452,  452,  452,  452,  452,  452,    0,    0,    0,    0,
+  452,  452,  452,    0,    0,  452,  452,    0,  452,  452,
+  452,    0,  452,    0,  452,    0,  452,    0,  452,    0,
+    0,  452,  452,  452,    0,    0,  452,  452,  452,    0,
+    0,    0,  452,  452,  452,  452,  452,  452,  452,    0,
+  452,  452,  452,  452,  452,    0,    0,    0,    0,  185,
+    0,    0,    0,  452,  452,  452,    0,    0,    0,    0,
+    0,    0,    0,  452,    0,    0,    0,    0,    0,  185,
+    0,    0,    0,  185,  185,  185,  185,  185,  185,  185,
+    0,    0,  185,  185,  185,    0,    0,   52,    0,  185,
+  185,    0,  185,  185,    0,    0,    0,   52,    0,    0,
+    0,    0,    0,    0,    0,    0,  185,    0,    0,    0,
+    0,    0,    0,    0,    0,  185,    0,  185,  185,    0,
+    0,  185,    0,  185,  185,  185,  185,  185,    0,  185,
+  185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+  185,  185,  185,  185,  185,    0,    0,    0,    0,  185,
+  185,  185,    0,    0,  185,  185,    0,  185,  185,  185,
+    0,  185,    0,  185,    0,  185,    0,  185,    0,    0,
+  185,  185,  185,    0,    0,  185,  185,  185,    0,    0,
+    0,  185,  185,  185,  185,  185,  185,  185,    0,  185,
+  185,  185,  185,  185,   51,    0,    0,    0,    0,    0,
+    0,    0,  185,  185,  185,    0,    0,    0,    0,  116,
+  116,    0,  185,    0,   51,    0,    0,    0,   51,   51,
+   51,   51,   51,   51,   51,    0,    0,   51,   51,   51,
+    0,    0,   90,    0,   51,   51,    0,   51,   51,    0,
+    0,    0,   90,    0,    0,    0,    0,    0,    0,    0,
+    0,   51,    0,    0,    0,    0,    0,    0,    0,    0,
+   51,    0,   51,   51,    0,    0,   51,    0,   51,   51,
+   51,   51,   51,    0,   51,   51,   51,   51,   51,   51,
+   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
+    0,    0,    0,    0,   51,   51,   51,    0,    0,   51,
+   51,    0,   51,   51,   51,    0,   51,    0,   51,    0,
+   51,    0,   51,    0,    0,   51,   51,   51,    0,    0,
+   51,   51,   51,    0,    0,    0,   51,   51,   51,   51,
+   51,   51,   51,    0,   51,   51,   51,   51,   51,    0,
+    0,    0,    0,   52,    0,    0,    0,   51,   51,   51,
+    0,    0,    0,    0,    0,    0,    0,   51,  116,  116,
+    0,    0,    0,   52,    0,    0,    0,   52,   52,   52,
+   52,   52,   52,   52,    0,    0,   52,   52,   52,    0,
+    0,  302,    0,   52,   52,    0,   52,   52,    0,    0,
+    0,  302,    0,    0,    0,    0,    0,    0,    0,    0,
+   52,    0,    0,    0,    0,    0,    0,    0,    0,   52,
+    0,   52,   52,    0,    0,   52,    0,   52,   52,   52,
+   52,   52,  302,   52,   52,   52,   52,   52,   52,   52,
+   52,   52,   52,   52,   52,   52,   52,   52,   52,  302,
+    0,    0,    0,   52,   52,   52,    0,    0,   52,   52,
+    0,   52,   52,   52,    0,   52,    0,   52,    0,   52,
+    0,   52,    0,    0,   52,   52,   52,    0,    0,   52,
+   52,   52,    0,    0,    0,   52,   52,   52,   52,   52,
+   52,   52,    0,   52,   52,   52,   52,   52,   90,    0,
+    0,    0,    0,    0,    0,    0,   52,   52,   52,    0,
+    0,    0,    0,  116,  116,    0,   52,    0,   90,    0,
+    0,    0,   90,   90,   90,   90,   90,   90,   90,    0,
+    0,   90,   90,   90,    0,    0,    0,    0,   90,   90,
+    0,   90,   90,    0,    0,    0,    0,    0,    0,    0,
+  114,    0,    0,    0,    0,   90,    0,    0,    0,    0,
+  114,    0,    0,    0,   90,    0,   90,   90,    0,    0,
+   90,    0,   90,   90,   90,   90,   90,    0,   90,   90,
+   90,   90,   90,   90,   90,   90,   90,   90,   90,   90,
+   90,   90,   90,   90,  114,    0,    0,    0,   90,   90,
+   90,    0,    0,   90,   90,    0,   90,   90,   90,    0,
+   90,    0,   90,    0,   90,    0,   90,    0,    0,   90,
+   90,   90,    0,    0,   90,   90,   90,    0,    0,    0,
+   90,   90,   90,   90,   90,   90,   90,    0,   90,   90,
+   90,   90,   90,    0,    0,    0,    0,  302,    0,    0,
+    0,   90,   90,   90,    0,    0,    0,    0,    0,    0,
+    0,   90,    0,    0,    0,    0,    0,  302,    0,    0,
+    0,  302,  302,  302,  302,  302,  302,  302,    0,    0,
+  302,  302,  302,    0,    0,    0,    0,  302,  302,    0,
+  302,  302,    0,    0,    0,  101,    0,    0,    0,    0,
+    0,    0,    0,    0,  302,  101,    0,    0,    0,    0,
+    0,    0,    0,  302,    0,  302,  302,    0,    0,  302,
+    0,  302,  302,  302,  302,  302,    0,  302,  302,  302,
+  302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
+  302,  302,  302,    0,    0,    0,    0,  302,  302,  302,
+    0,    0,  302,  302,    0,  302,  302,  302,    0,  302,
+    0,  302,    0,  302,    0,  302,    0,    0,  302,  302,
+  302,    0,    0,  302,  302,  302,    0,    0,    0,  302,
+  302,  302,  302,  302,  302,  302,    0,  302,  302,  302,
+  302,  302,    0,    0,    0,    0,    0,    0,    0,    0,
+  302,  302,  302,    0,    0,    0,  114,    0,    0,    0,
+  302,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  114,  114,    0,    0,    0,  114,    0,    0,    0,
+  114,  114,  114,  114,  114,  114,  114,    0,    0,  114,
+  114,  114,    0,    0,    0,    0,  114,  114,    0,  114,
+  114,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  185,    0,    0,  114,    0,    0,    0,    0,    0,    0,
+  185,    0,  114,    0,  114,  114,    0,    0,  114,    0,
+  114,  114,  114,  114,  114,    0,  114,  114,  114,  114,
+  114,  114,  114,  114,  114,  114,  114,  114,  114,  114,
+  114,  114,  185,    0,  185,    0,  114,  114,  114,    0,
+    0,  114,  114,    0,  114,  114,  114,    0,  114,    0,
+  114,    0,  114,    0,  114,    0,    0,  114,  114,  114,
+    0,    0,  114,  114,  114,    0,    0,    0,  114,  114,
+  114,  114,  114,  114,  114,    0,  114,  114,  114,  114,
+  114,  101,    0,    0,    0,    0,    0,    0,    0,  114,
+  114,    0,    0,    0,    0,    0,  101,  101,    0,  114,
+    0,  101,    0,    0,    0,  101,  101,  101,  101,  101,
+  101,  101,    0,    0,  101,  101,  101,    0,    0,    0,
+    0,  101,  101,    0,  101,  101,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  116,    0,    0,  101,    0,
+    0,    0,    0,    0,    0,  116,    0,  101,    0,  101,
+  101,    0,    0,  101,    0,  101,  101,  101,  101,  101,
+    0,  101,  101,  101,  101,  101,  101,  101,  101,  101,
+  101,  101,  101,  101,  101,  101,  101,    0,    0,    0,
+    0,  101,  101,  101,    0,    0,  101,  101,    0,  101,
+  101,  101,    0,  101,    0,  101,    0,  101,    0,  101,
+    0,    0,  101,  101,  101,    0,    0,  101,  101,  101,
+    0,    0,    0,  101,  101,  101,  101,  101,  101,  101,
+    0,  101,  101,  101,  101,  101,    0,    0,    0,    0,
+    0,    0,    0,    0,  101,  101,  101,    0,    0,    0,
+    0,    0,    0,    0,  101,    0,  185,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  185,    0,    0,    0,
+  185,  185,  185,  185,  185,  185,  185,    0,    0,  185,
+  185,  185,    0,    0,  102,    0,  185,  185,    0,  185,
+  185,    0,    0,    0,  102,    0,    0,    0,    0,    0,
+    0,    0,    0,  185,    0,    0,    0,    0,    0,    0,
+    0,    0,  185,    0,  185,  185,    0,    0,  185,    0,
+  185,  185,  185,  185,  185,    0,  185,  185,  185,  185,
+  185,  185,  185,  185,  185,  185,  185,  185,  185,  185,
+  185,  185,    0,    0,    0,    0,  185,  185,  185,    0,
+    0,  185,  185,    0,  185,  185,  185,    0,  185,    0,
+  185,    0,  185,    0,  185,    0,    0,  185,  185,  185,
+    0,    0,  185,  185,  185,    0,    0,    0,  185,  185,
+  185,  185,  185,  185,  185,    0,  185,  185,  185,  185,
+  185,  116,    0,    0,    0,    0,    0,    0,    0,  185,
+  185,  185,    0,    0,    0,    0,  116,  116,    0,  185,
+    0,  116,    0,    0,    0,  116,  116,  116,  116,  116,
+  116,  116,    0,    0,  116,  116,  116,    0,    0,    0,
+    0,  116,  116,    0,  116,  116,    0,    0,    0,    0,
+    0,    0,    0,  464,    0,    0,    0,    0,  116,    0,
+    0,    0,    0,  464,    0,    0,    0,  116,    0,  116,
+  116,    0,    0,  116,    0,  116,  116,  116,  116,  116,
+    0,  116,  116,  116,  116,  116,  116,  116,  116,  116,
+  116,  116,  116,  116,  116,  116,  116,  464,    0,    0,
+    0,  116,  116,  116,    0,    0,  116,  116,    0,  116,
+  116,  116,    0,  116,    0,  116,    0,  116,    0,  116,
+    0,    0,  116,  116,  116,    0,    0,  116,  116,  116,
+    0,    0,    0,  116,  116,  116,  116,  116,  116,  116,
+    0,  116,  116,  116,  116,  116,    0,    0,    0,    0,
+  102,    0,    0,    0,  116,  116,  116,    0,    0,    0,
+    0,    0,    0,    0,  116,  102,  102,    0,    0,    0,
+  102,    0,    0,    0,  102,  102,  102,  102,  102,  102,
+  102,    0,    0,  102,  102,  102,    0,    0,    0,    0,
+  102,  102,    0,  102,  102,    0,    0,    0,    0,    0,
+    0,    0,  468,    0,    0,    0,    0,  102,    0,    0,
+    0,    0,  468,    0,    0,    0,  102,    0,  102,  102,
+    0,    0,  102,    0,  102,  102,  102,  102,  102,    0,
+  102,  102,  102,  102,  102,  102,  102,  102,  102,  102,
+  102,  102,  102,  102,  102,  102,  468,    0,    0,    0,
+  102,  102,  102,    0,    0,  102,  102,    0,  102,  102,
+  102,    0,  102,    0,  102,    0,  102,    0,  102,    0,
+    0,  102,  102,  102,    0,    0,  102,  102,  102,    0,
+    0,    0,  102,  102,  102,  102,  102,  102,  102,    0,
+  102,  102,  102,  102,  102,    0,    0,    0,    0,    0,
+    0,    0,    0,  102,  102,  102,    0,    0,    0,  464,
+    0,    0,    0,  102,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  464,
+    0,    0,    0,  464,  464,  464,  464,  464,  464,  464,
+    0,    0,  464,  464,  464,    0,    0,    0,    0,  464,
+  464,    0,  464,  464,    0,    0,    0,    0,    0,    0,
+    0,  466,    0,    0,    0,    0,  464,    0,    0,    0,
+    0,  466,    0,    0,    0,  464,    0,  464,  464,    0,
+    0,  464,    0,  464,  464,  464,  464,  464,    0,  464,
+  464,  464,  464,  464,  464,  464,  464,  464,  464,  464,
+  464,  464,  464,  464,  464,  466,    0,    0,    0,  464,
+  464,  464,    0,    0,  464,  464,    0,  464,  464,  464,
+    0,  464,    0,  464,    0,  464,    0,  464,    0,    0,
+  464,  464,  464,    0,  464,  464,  464,  464,    0,    0,
+    0,  464,  464,  464,  464,  464,  464,  464,    0,  464,
+  464,  464,  464,  464,    0,    0,    0,    0,  468,    0,
+    0,    0,  464,  464,  464,    0,    0,    0,    0,    0,
+    0,    0,  464,    0,    0,    0,    0,    0,  468,    0,
+    0,    0,  468,  468,  468,  468,  468,  468,  468,    0,
+    0,  468,  468,  468,    0,    0,    0,    0,  468,  468,
+    0,  468,  468,    0,    0,    0,  103,    0,    0,    0,
+    0,    0,    0,    0,    0,  468,  103,    0,    0,    0,
+    0,    0,    0,    0,  468,    0,  468,  468,    0,    0,
+  468,    0,  468,  468,  468,  468,  468,    0,  468,  468,
+  468,  468,  468,  468,  468,  468,  468,  468,  468,  468,
+  468,  468,  468,  468,    0,    0,    0,    0,  468,  468,
+  468,    0,    0,  468,  468,    0,  468,  468,  468,    0,
+  468,    0,  468,    0,  468,    0,  468,    0,    0,  468,
+  468,  468,    0,  468,  468,  468,  468,    0,    0,    0,
+  468,  468,  468,  468,  468,  468,  468,    0,  468,  468,
+  468,  468,  468,    0,    0,    0,    0,    0,    0,    0,
+    0,  468,  468,  468,    0,    0,    0,  466,    0,    0,
+    0,  468,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  466,    0,    0,
+    0,  466,  466,  466,  466,  466,  466,  466,    0,    0,
+  466,  466,  466,    0,    0,    0,    0,  466,  466,    0,
+  466,  466,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  148,    0,    0,  466,    0,    0,    0,    0,    0,
+    0,  148,    0,  466,    0,  466,  466,    0,    0,  466,
+    0,  466,  466,  466,  466,  466,    0,  466,  466,  466,
+  466,  466,  466,  466,  466,  466,  466,  466,  466,  466,
+  466,  466,  466,    0,    0,  148,    0,  466,  466,  466,
+    0,    0,  466,  466,    0,  466,  466,  466,    0,  466,
+    0,  466,  148,  466,    0,  466,    0,    0,  466,  466,
+  466,    0,  466,  466,  466,  466,    0,    0,    0,  466,
+  466,  466,  466,  466,  466,  466,    0,  466,  466,  466,
+  466,  466,  103,    0,    0,    0,    0,    0,    0,    0,
+  466,  466,  466,    0,    0,    0,    0,  103,  103,    0,
+  466,    0,  103,    0,    0,    0,  103,  103,  103,  103,
+  103,  103,  103,    0,    0,  103,  103,  103,    0,    0,
+    0,    0,  103,  103,    0,  103,  103,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  116,    0,  103,
+    0,    0,    0,    0,    0,    0,    0,  116,  103,    0,
+  103,  103,    0,    0,  103,    0,  103,  103,  103,  103,
+  103,    0,  103,  103,  103,  103,  103,  103,  103,  103,
+  103,  103,  103,  103,  103,  103,  103,  103,  116,    0,
+    0,    0,  103,  103,  103,    0,    0,  103,  103,    0,
+  103,  103,  103,    0,  103,    0,  103,    0,  103,    0,
+  103,    0,    0,  103,  103,  103,    0,    0,  103,  103,
+  103,    0,    0,    0,  103,  103,  103,  103,  103,  103,
+  103,    0,  103,  103,  103,  103,  103,    0,    0,    0,
+    0,    0,    0,    0,    0,  103,  103,  103,    0,    0,
+    0,    0,    0,    0,    0,  103,    0,  148,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  148,    0,    0,
+    0,  148,  148,  148,  148,  148,  148,  148,    0,    0,
+  148,  148,  148,    0,    0,    0,    0,  148,  148,    0,
+  148,  148,    0,    0,    0,    0,    0,    0,    0,  305,
+    0,    0,    0,    0,  148,    0,    0,    0,    0,  305,
+    0,    0,    0,  148,    0,  148,  148,    0,    0,  148,
+    0,  148,  148,  148,  148,  148,    0,  148,  148,  148,
+  148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
+  148,  148,  148,  305,    0,    0,    0,  148,  148,  148,
+    0,    0,  148,  148,    0,  148,  148,  148,    0,  148,
+  307,  148,    0,  148,    0,  148,    0,    0,  148,  148,
+  148,    0,    0,  148,  148,  148,    0,    0,    0,  148,
+  148,  148,  148,  148,  148,  148,    0,  148,  148,  148,
+  148,  148,    0,  116,    0,    0,    0,    0,    0,    0,
+  148,  148,  148,    0,    0,    0,    0,    0,    0,    0,
+  148,    0,    0,  116,    0,    0,    0,  116,  116,  116,
+  116,  116,  116,  116,    0,    0,  116,  116,  116,    0,
+    0,    0,    0,  116,  116,    0,  116,  116,    0,    0,
+    0,    0,    0,    0,   36,    0,    0,    0,    0,    0,
+  116,    0,    0,    0,   36,    0,    0,    0,    0,  116,
+    0,  116,  116,    0,    0,  116,    0,  116,  116,  116,
+  116,  116,    0,  116,  116,  116,  116,  116,  116,  116,
+  116,  116,  116,  116,  116,  116,  116,  116,  116,    0,
+    0,    0,    0,  116,  116,  116,    0,    0,  116,  116,
+    0,  116,  116,  116,    0,  116,    0,  116,    0,  116,
+    0,  116,    0,    0,  116,  116,  116,    0,  116,  116,
+  116,  116,    0,    0,    0,  116,  116,  116,  116,  116,
+  116,  116,    0,  116,  116,  116,  116,  116,    0,    0,
+    0,    0,    0,    0,    0,    0,  116,  116,  116,    0,
+    0,    0,    0,    0,    0,  305,  116,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  305,    0,    0,    0,  305,
+  305,  305,  305,  305,  305,  305,    0,    0,  305,  305,
+  305,    0,    0,    0,    0,  305,  305,    0,  305,  305,
+    0,    0,    0,    0,    0,    0,    0,    0,  441,    0,
+    0,    0,  305,    0,    0,    0,    0,    0,  441,    0,
+    0,  305,    0,  305,  305,    0,    0,  305,    0,  305,
+  305,  305,  305,  305,    0,  305,  305,  305,  305,  305,
+  305,  305,  305,  305,  305,  305,  305,  305,  305,  305,
+  305,    0,  441,    0,    0,  305,  305,  305,    0,    0,
+  305,  305,    0,  305,  305,  305,    0,  305,    0,  305,
+    0,  305,    0,  305,    0,    0,  305,  305,  305,    0,
+    0,  305,  305,  305,    0,    0,    0,  305,  305,  305,
+  305,  305,  305,  305,    0,  305,  305,  305,  305,  305,
+   36,    0,    0,    0,    0,    0,    0,    0,  305,  305,
+  305,    0,    0,    0,    0,    0,    0,    0,  305,    0,
+   36,    0,   36,    0,   36,   36,   36,   36,   36,   36,
+   36,    0,    0,   36,   36,   36,    0,    0,    0,    0,
+   36,   36,    0,   36,   36,    0,    0,    0,    0,    0,
+    0,    0,    0,  463,    0,    0,    0,   36,    0,    0,
+    0,    0,    0,  463,    0,    0,   36,    0,   36,   36,
+    0,    0,   36,    0,   36,   36,   36,   36,   36,    0,
+   36,   36,   36,   36,   36,   36,   36,   36,   36,   36,
+   36,   36,   36,   36,   36,   36,    0,    0,    0,    0,
+   36,   36,   36,    0,    0,   36,   36,    0,   36,   36,
+   36,    0,   36,    0,   36,    0,   36,    0,   36,    0,
+    0,   36,   36,   36,    0,    0,   36,   36,   36,    0,
+    0,    0,   36,   36,   36,   36,   36,   36,   36,    0,
+   36,   36,   36,   36,   36,    0,    0,    0,    0,    0,
+    0,    0,    0,   36,   36,   36,    0,    0,    0,    0,
+    0,    0,    0,   36,  441,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  441,    0,    0,    0,  441,  441,
+  441,  441,  441,  441,  441,    0,    0,  441,  441,  441,
+  462,    0,    0,    0,  441,  441,    0,  441,  441,    0,
+  462,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  441,    0,    0,    0,    0,    0,    0,    0,    0,
+  441,    0,  441,  441,    0,    0,  441,    0,  441,  441,
+  441,  441,  441,    0,  441,  441,  441,  441,  441,  441,
+  441,  441,  441,  441,  441,  441,  441,  441,  441,  441,
+    0,    0,    0,    0,  441,  441,  441,    0,    0,  441,
+  441,    0,  441,  441,  441,    0,  441,    0,  441,    0,
+  441,    0,  441,    0,    0,  441,  441,  441,    0,    0,
+  441,  441,  441,    0,    0,    0,  441,  441,  441,  441,
+  441,  441,  441,    0,  441,  441,  441,  441,  441,  463,
+    0,    0,    0,    0,    0,    0,    0,  441,  441,  441,
+    0,    0,    0,    0,    0,    0,    0,  441,    0,  463,
+    0,    0,    0,  463,  463,  463,  463,  463,  463,  463,
+    0,    0,  463,  463,  463,    0,    0,    0,    0,  463,
+  463,    0,  463,  463,    0,    0,    0,    0,    0,    0,
+    0,  460,    0,    0,    0,    0,  463,    0,    0,    0,
+    0,  460,    0,    0,    0,  463,    0,  463,  463,    0,
+    0,  463,    0,  463,  463,  463,  463,  463,    0,  463,
+  463,  463,  463,  463,  463,  463,  463,  463,  463,  463,
+  463,  463,  463,  463,  463,  460,    0,    0,    0,  463,
+  463,  463,    0,    0,  463,  463,    0,  463,  463,  463,
+    0,  463,    0,  463,    0,  463,    0,  463,    0,    0,
+  463,  463,  463,    0,  463,  463,  463,  463,    0,    0,
+    0,  463,  463,  463,  463,  463,  463,  463,    0,  463,
+  463,  463,  463,  463,    0,    0,  462,    0,    0,    0,
+    0,    0,  463,  463,  463,    0,    0,    0,    0,    0,
+    0,    0,  463,    0,    0,    0,  462,    0,    0,    0,
+  462,  462,  462,  462,  462,  462,  462,    0,    0,  462,
+  462,  462,    0,    0,    0,    0,  462,  462,    0,  462,
+  462,    0,    0,    0,    0,    0,    0,    0,  148,    0,
+    0,    0,    0,  462,    0,    0,    0,    0,  148,    0,
+    0,    0,  462,    0,  462,  462,    0,    0,  462,    0,
+  462,  462,  462,  462,  462,    0,  462,  462,  462,  462,
+  462,  462,  462,  462,  462,  462,  462,  462,  462,  462,
+  462,  462,  148,    0,    0,    0,  462,  462,  462,    0,
+    0,  462,  462,    0,  462,  462,  462,    0,  462,    0,
+  462,    0,  462,    0,  462,    0,    0,  462,  462,  462,
+    0,  462,  462,  462,  462,    0,    0,    0,  462,  462,
+  462,  462,  462,  462,  462,    0,  462,  462,  462,  462,
+  462,    0,    0,    0,    0,    0,    0,    0,    0,  462,
+  462,  462,    0,    0,    0,    0,    0,  460,    0,  462,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  460,    0,    0,
+    0,  460,  460,  460,  460,  460,  460,  460,    0,    0,
+  460,  460,  460,    0,    0,    0,    0,  460,  460,    0,
+  460,  460,    0,    0,    0,    0,    0,    0,    0,  150,
+    0,    0,    0,    0,  460,    0,    0,    0,    0,  150,
+    0,    0,    0,  460,    0,  460,  460,    0,    0,  460,
+    0,  460,  460,  460,  460,  460,    0,  460,  460,  460,
+  460,  460,  460,  460,  460,  460,  460,  460,  460,  460,
+  460,  460,  460,  150,    0,    0,    0,  460,  460,  460,
+    0,    0,  460,  460,    0,  460,  460,  460,    0,  460,
+    0,  460,    0,  460,    0,  460,    0,    0,  460,  460,
+  460,    0,    0,  460,  460,  460,    0,    0,    0,  460,
+  460,  460,  460,  460,  460,  460,    0,  460,  460,  460,
+  460,  460,    0,    0,  148,    0,    0,    0,    0,    0,
+  460,  460,  460,    0,    0,    0,    0,    0,    0,    0,
+  460,    0,    0,    0,  148,    0,    0,    0,  148,  148,
+  148,  148,  148,  148,  148,    0,    0,  148,  148,  148,
+    0,    0,    0,    0,  148,  148,    0,  148,  148,    0,
+    0,    0,    0,    0,    0,    0,  321,    0,    0,    0,
+    0,  148,    0,    0,    0,    0,  321,    0,    0,    0,
+  148,    0,  148,  148,    0,    0,  148,    0,  148,  148,
+  148,  148,  148,    0,  148,  148,  148,  148,  148,  148,
+  148,  148,  148,  148,  148,  148,  148,  148,  148,  148,
+  321,    0,    0,    0,  148,  148,  148,    0,    0,  148,
+  148,    0,  148,  148,  148,    0,  148,    0,  148,    0,
+  148,    0,  148,    0,    0,  148,  148,  148,    0,    0,
+  148,  148,  148,    0,    0,    0,  148,  148,  148,  148,
+  148,  148,  148,    0,  148,  148,  148,  148,  148,    0,
+    0,    0,    0,    0,    0,    0,    0,  148,  148,  148,
+    0,    0,    0,    0,    0,  150,    0,  148,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  150,    0,    0,    0,  150,
+  150,  150,  150,  150,  150,  150,    0,    0,  150,  150,
+  150,    0,    0,    0,    0,  150,  150,    0,  150,  150,
+    0,    0,    0,    0,    0,    0,    0,  306,    0,    0,
+    0,    0,  150,    0,    0,    0,    0,  306,    0,    0,
+    0,  150,    0,  150,  150,    0,    0,  150,    0,  150,
+  150,  150,  150,  150,    0,  150,  150,  150,  150,  150,
+  150,  150,  150,  150,  150,  150,  150,  150,  150,  150,
+  150,  306,    0,    0,    0,  150,  150,  150,    0,    0,
+  150,  150,    0,  150,  150,  150,    0,  150,    0,  150,
+    0,  150,    0,  150,    0,    0,  150,  150,  150,    0,
+    0,  150,  150,  150,    0,    0,    0,  150,  150,  150,
+  150,  150,  150,  150,    0,  150,  150,  150,  150,  150,
+    0,    0,  321,    0,    0,    0,    0,    0,  150,  150,
+  150,    0,    0,    0,    0,    0,    0,    0,  150,    0,
+    0,    0,  321,    0,    0,    0,  321,  321,  321,  321,
+  321,  321,  321,    0,    0,  321,  321,  321,    0,    0,
+    0,    0,  321,  321,    0,  321,  321,    0,    0,    0,
+    0,    0,    0,    0,  114,    0,    0,    0,    0,  321,
+    0,    0,    0,    0,  114,    0,    0,    0,  321,    0,
+  321,  321,    0,    0,  321,    0,  321,  321,  321,  321,
+  321,    0,  321,  321,  321,  321,  321,  321,  321,  321,
+  321,  321,  321,  321,  321,  321,  321,  321,  114,    0,
+    0,    0,  321,  321,  321,    0,    0,  321,  321,    0,
+  321,  321,  321,    0,  321,    0,  321,    0,  321,    0,
+  321,    0,    0,  321,  321,  321,    0,    0,  321,  321,
+  321,    0,    0,    0,  321,  321,  321,  321,  321,  321,
+  321,    0,  321,  321,  321,  321,  321,    0,    0,    0,
+    0,    0,    0,    0,    0,  321,  321,  321,    0,    0,
+    0,    0,    0,  306,    0,  321,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  306,    0,   54,    0,  306,  306,  306,
+  306,  306,  306,  306,    0,   54,  306,  306,  306,    0,
+    0,    0,    0,  306,  306,    0,  306,  306,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  306,    0,    0,    0,    0,    0,    0,    0,    0,  306,
+    0,  306,  306,    0,    0,  306,    0,  306,  306,  306,
+  306,  306,    0,  306,  306,  306,  306,  306,  306,  306,
+  306,  306,  306,  306,  306,  306,  306,  306,  306,    0,
+    0,    0,    0,  306,  306,  306,    0,    0,  306,  306,
+    0,  306,  306,  306,    0,  306,    0,  306,    0,  306,
+    0,  306,    0,    0,  306,  306,  306,    0,    0,  306,
+  306,  306,    0,    0,    0,  306,  306,  306,  306,  306,
+  306,  306,    0,  306,  306,  306,  306,  306,    0,    0,
+  114,    0,    0,    0,    0,    0,  306,  306,  306,    0,
+    0,    0,    0,    0,    0,    0,  306,    0,    0,    0,
+  114,  372,    0,    0,  114,  114,  114,  114,  114,  114,
+  114,  372,    0,  114,  114,  114,    0,    0,    0,    0,
+  114,  114,    0,  114,  114,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  114,    0,    0,
+    0,    0,    0,    0,    0,    0,  114,    0,  114,  114,
+    0,    0,  114,    0,  114,  114,  114,  114,  114,    0,
+  114,  114,  114,  114,  114,  114,  114,  114,  114,  114,
+  114,  114,  114,  114,  114,  114,    0,    0,    0,    0,
+  114,  114,  114,    0,    0,  114,  114,    0,  114,  114,
+  114,    0,  114,    0,  114,    0,  114,    0,  114,    0,
+    0,  114,  114,  114,    0,    0,  114,  114,  114,    0,
+    0,   54,  114,  114,  114,  114,  114,  114,  114,    0,
+  114,  114,  114,  114,  114,    0,    0,    0,    0,    0,
+    0,   54,    0,  114,  114,   54,   54,   54,   54,   54,
+   54,   54,    0,  114,   54,   54,   54,  410,    0,    0,
+    0,   54,   54,    0,   54,   54,    0,  410,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,   54,    0,
+    0,    0,    0,    0,    0,    0,    0,   54,    0,   54,
+   54,    0,    0,   54,    0,   54,   54,   54,   54,   54,
+    0,   54,   54,   54,   54,   54,   54,   54,   54,   54,
+   54,   54,   54,   54,   54,   54,   54,    0,    0,    0,
+    0,   54,   54,   54,    0,    0,   54,   54,    0,   54,
+   54,   54,    0,   54,    0,   54,    0,   54,    0,   54,
+    0,    0,   54,   54,   54,    0,    0,   54,   54,   54,
+    0,    0,    0,   54,   54,   54,   54,   54,   54,   54,
+    0,   54,   54,   54,   54,   54,    0,  372,    0,    0,
+    0,    0,    0,    0,   54,   54,   54,    0,    0,    0,
+    0,    0,    0,    0,   54,    0,    0,  372,    0,    0,
+    0,  372,  372,  372,  372,  372,  372,  372,    0,    0,
+  372,  372,  372,   36,    0,    0,    0,  372,  372,    0,
+  372,  372,    0,   36,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  372,    0,    0,    0,    0,    0,
+    0,    0,    0,  372,    0,  372,  372,    0,    0,  372,
+    0,  372,  372,  372,  372,  372,    0,  372,  372,  372,
+  372,  372,  372,  372,  372,  372,  372,  372,  372,  372,
+  372,  372,  372,    0,    0,    0,    0,  372,  372,  372,
+    0,    0,  372,  372,    0,  372,  372,  372,    0,  372,
+    0,  372,    0,  372,    0,  372,    0,    0,  372,  372,
+  372,    0,    0,  372,  372,  372,    0,    0,    0,  372,
+  372,  372,  372,  372,  372,  372,    0,  372,  372,  372,
+  372,  372,    0,  410,    0,    0,    0,    0,    0,    0,
+  372,  372,  372,    0,    0,    0,    0,    0,    0,    0,
+  372,    0,    0,  410,    0,    0,    0,  410,  410,  410,
+  410,  410,  410,  410,    0,    0,  410,  410,  410,   98,
+    0,    0,    0,  410,  410,    0,  410,  410,    0,   98,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  410,    0,    0,    0,    0,    0,    0,    0,    0,  410,
+    0,  410,  410,    0,    0,  410,    0,  410,  410,  410,
+  410,  410,    0,  410,  410,  410,  410,  410,  410,  410,
+  410,  410,  410,  410,  410,  410,  410,  410,  410,    0,
+    0,    0,    0,  410,  410,  410,    0,    0,  410,  410,
+    0,  410,  410,  410,    0,  410,    0,  410,    0,  410,
+    0,  410,    0,    0,  410,  410,  410,    0,    0,  410,
+  410,  410,    0,    0,    0,  410,  410,  410,  410,  410,
+  410,  410,    0,  410,  410,  410,  410,  410,    0,   36,
+    0,    0,    0,    0,    0,    0,  410,  410,  410,    0,
+    0,    0,    0,    0,    0,    0,  410,    0,    0,   36,
+    0,    0,    0,   36,   36,   36,   36,   36,   36,   36,
+    0,    0,   36,   36,   36,   96,    0,    0,    0,   36,
+   36,    0,   36,   36,    0,   96,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,   36,    0,    0,    0,
+    0,    0,    0,    0,    0,   36,    0,   36,   36,    0,
+    0,   36,    0,   36,   36,   36,   36,   36,    0,   36,
+   36,   36,   36,   36,   36,   36,   36,   36,   36,   36,
+   36,   36,   36,   36,   36,    0,    0,    0,    0,   36,
+   36,   36,    0,    0,   36,   36,    0,   36,   36,   36,
+    0,   36,    0,   36,    0,   36,    0,   36,    0,    0,
+   36,   36,   36,    0,    0,   36,   36,   36,    0,    0,
+    0,   36,   36,   36,   36,   36,   36,   36,    0,   36,
+   36,   36,   36,   36,    0,   98,    0,    0,    0,    0,
+    0,    0,   36,   36,   36,    0,    0,    0,    0,    0,
+    0,    0,   36,    0,    0,   98,    0,    0,    0,   98,
+   98,   98,   98,   98,   98,   98,    0,    0,   98,   98,
+   98,   49,    0,    0,    0,   98,   98,    0,   98,   98,
+    0,   49,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,   98,    0,    0,    0,    0,    0,    0,    0,
+    0,   98,    0,   98,   98,    0,    0,   98,    0,   98,
+   98,   98,   98,   98,    0,   98,   98,   98,   98,   98,
+   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,
+   98,    0,    0,    0,    0,   98,   98,   98,    0,    0,
+   98,   98,    0,   98,   98,   98,    0,   98,    0,   98,
+    0,   98,    0,   98,    0,    0,   98,   98,   98,    0,
+    0,   98,   98,   98,    0,    0,    0,   98,   98,   98,
+   98,   98,   98,   98,    0,   98,   98,   98,   98,   98,
+    0,   96,    0,    0,    0,    0,    0,    0,   98,   98,
+   98,    0,    0,    0,    0,    0,    0,    0,   98,    0,
+    0,   96,    0,    0,    0,   96,   96,   96,   96,   96,
+   96,   96,    0,    0,   96,   96,   96,  121,    0,    0,
+    0,   96,   96,    0,   96,   96,    0,  121,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,   96,    0,
+    0,    0,    0,    0,    0,    0,    0,   96,    0,   96,
+   96,    0,    0,   96,    0,   96,   96,   96,   96,   96,
+    0,   96,   96,   96,   96,   96,   96,   96,   96,   96,
+   96,   96,   96,   96,   96,   96,   96,    0,    0,    0,
+    0,   96,   96,   96,    0,    0,   96,   96,    0,   96,
+   96,   96,    0,   96,    0,   96,    0,   96,    0,   96,
+    0,    0,   96,   96,   96,    0,    0,   96,   96,   96,
+    0,    0,    0,   96,   96,   96,   96,   96,   96,   96,
+    0,   96,   96,   96,   96,   96,    0,   49,    0,    0,
+    0,    0,    0,    0,   96,   96,   96,    0,    0,    0,
+    0,    0,    0,    0,   96,    0,    0,   49,    0,    0,
+    0,   49,   49,   49,   49,   49,   49,   49,    0,    0,
+   49,   49,   49,  128,    0,    0,    0,   49,   49,    0,
+   49,   49,    0,  128,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,   49,    0,    0,    0,    0,    0,
+    0,    0,    0,   49,    0,   49,   49,    0,    0,   49,
+    0,   49,   49,   49,   49,   49,    0,   49,   49,   49,
+   49,   49,   49,   49,   49,   49,   49,   49,   49,   49,
+   49,   49,   49,    0,    0,    0,    0,   49,   49,   49,
+    0,    0,   49,   49,    0,   49,   49,   49,    0,   49,
+    0,   49,    0,   49,    0,   49,    0,    0,   49,   49,
+   49,    0,    0,   49,   49,   49,    0,    0,    0,   49,
+   49,   49,   49,   49,   49,   49,    0,   49,   49,   49,
+   49,   49,    0,  121,    0,    0,    0,    0,    0,    0,
+   49,   49,   49,    0,    0,    0,    0,    0,    0,    0,
+   49,    0,    0,  121,    0,    0,    0,  121,  121,  121,
+  121,  121,  121,  121,    0,    0,  121,  121,  121,  309,
+    0,    0,    0,  121,  121,    0,  121,  121,    0,  309,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  121,    0,    0,    0,    0,    0,    0,    0,    0,  121,
+    0,  121,  121,    0,    0,  121,    0,  121,  121,  121,
+  121,  121,    0,  121,  121,  121,  121,  121,  121,  121,
+  121,  121,  121,  121,  121,  121,  121,  121,  121,    0,
+    0,    0,    0,  121,  121,  121,    0,    0,  121,  121,
+    0,  121,  121,  121,    0,  121,    0,  121,    0,  121,
+    0,  121,    0,    0,  121,  121,  121,    0,    0,  121,
+  121,  121,    0,    0,    0,  121,  121,  121,  121,  121,
+  121,  121,    0,  121,  121,  121,  121,  121,    0,  128,
+    0,    0,    0,    0,    0,    0,  121,  121,  121,    0,
+    0,    0,    0,    0,    0,    0,  121,    0,    0,  128,
+    0,    0,    0,  128,  128,  128,  128,  128,  128,  128,
+    0,    0,  128,  128,  128,  350,    0,    0,    0,  128,
+  128,    0,  128,  128,    0,  350,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  128,    0,    0,    0,
+    0,    0,    0,    0,    0,  128,    0,  128,  128,    0,
+    0,  128,    0,  128,  128,  128,  128,  128,    0,  128,
+  128,  128,  128,  128,  128,  128,  128,  128,  128,  128,
+  128,  128,  128,  128,  128,    0,    0,    0,    0,  128,
+  128,  128,    0,    0,  128,  128,    0,  128,  128,  128,
+    0,  128,    0,  128,    0,  128,    0,  128,    0,    0,
+  128,  128,  128,    0,    0,  128,  128,  128,    0,    0,
+    0,  128,  128,  128,  128,  128,  128,  128,    0,  128,
+  128,  128,  128,  128,    0,  309,    0,    0,    0,    0,
+    0,    0,  128,  128,  128,    0,    0,    0,    0,    0,
+    0,    0,  128,    0,    0,  309,    0,    0,    0,  309,
+  309,  309,  309,  309,  309,  309,    0,    0,  309,  309,
+  309,  304,    0,    0,    0,  309,  309,    0,  309,  309,
+    0,  304,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  309,    0,    0,    0,    0,    0,    0,    0,
+    0,  309,    0,  309,  309,    0,    0,  309,    0,  309,
+  309,  309,  309,  309,    0,  309,  309,  309,  309,  309,
+  309,  309,  309,  309,  309,  309,  309,  309,  309,  309,
+  309,    0,    0,    0,    0,  309,  309,  309,    0,    0,
+  309,  309,    0,  309,  309,  309,    0,  309,    0,  309,
+    0,  309,    0,  309,    0,    0,  309,  309,  309,    0,
+    0,  309,  309,  309,    0,    0,    0,  309,  309,  309,
+  309,  309,  309,  309,    0,  309,  309,  309,  309,  309,
+    0,  350,    0,    0,    0,    0,    0,    0,  309,  309,
+  309,    0,    0,    0,    0,    0,    0,    0,  309,    0,
+    0,  350,    0,    0,    0,  350,  350,  350,  350,  350,
+  350,  350,    0,    0,  350,  350,  350,  418,    0,    0,
+    0,  350,  350,    0,  350,  350,    0,  418,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  350,    0,
+    0,    0,    0,    0,    0,    0,    0,  350,    0,  350,
+  350,    0,    0,  350,    0,  350,  350,  350,  350,  350,
+    0,  350,  350,  350,  350,  350,  350,  350,  350,  350,
+  350,  350,  350,  350,  350,  350,  350,    0,    0,    0,
+    0,  350,  350,  350,    0,    0,  350,  350,    0,  350,
+  350,  350,    0,  350,    0,  350,    0,  350,    0,  350,
+    0,    0,  350,  350,  350,    0,    0,  350,  350,  350,
+    0,    0,    0,  350,  350,  350,  350,  350,  350,  350,
+    0,  350,  350,  350,  350,  350,    0,  304,    0,    0,
+    0,    0,    0,    0,  350,  350,  350,    0,    0,    0,
+    0,    0,    0,    0,  350,    0,    0,  304,    0,    0,
+    0,  304,  304,  304,  304,  304,  304,  304,    0,    0,
+  304,  304,  304,   30,    0,    0,    0,  304,  304,    0,
+  304,  304,    0,   30,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  304,    0,    0,    0,    0,    0,
+    0,    0,    0,  304,    0,  304,  304,    0,    0,  304,
+    0,  304,  304,  304,  304,  304,    0,  304,  304,  304,
+  304,  304,  304,  304,  304,  304,  304,  304,  304,  304,
+  304,  304,  304,    0,    0,    0,    0,  304,  304,  304,
+    0,    0,  304,  304,    0,  304,  304,  304,    0,  304,
+    0,  304,    0,  304,    0,  304,    0,    0,  304,  304,
+  304,    0,    0,  304,  304,  304,    0,    0,    0,  304,
+  304,  304,  304,  304,  304,  304,    0,  304,  304,  304,
+  304,  304,    0,  418,    0,    0,    0,    0,    0,    0,
+  304,  304,  304,    0,    0,    0,    0,    0,    0,    0,
+  304,    0,    0,  418,    0,    0,    0,  418,  418,  418,
+  418,  418,  418,  418,    0,    0,  418,  418,  418,   61,
+    0,    0,    0,  418,  418,    0,  418,  418,    0,   61,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  418,    0,    0,    0,    0,    0,    0,    0,    0,  418,
+    0,  418,  418,    0,    0,  418,    0,  418,  418,  418,
+  418,  418,    0,  418,  418,  418,  418,  418,  418,  418,
+  418,  418,  418,  418,  418,  418,  418,  418,  418,    0,
+    0,    0,    0,  418,  418,  418,    0,    0,  418,  418,
+    0,  418,  418,  418,    0,  418,    0,  418,    0,  418,
+    0,  418,    0,    0,  418,  418,  418,    0,    0,  418,
+  418,  418,    0,    0,    0,  418,  418,  418,  418,  418,
+  418,  418,    0,  418,  418,  418,  418,  418,    0,   30,
+    0,    0,    0,    0,    0,    0,  418,  418,  418,    0,
+    0,    0,    0,    0,    0,    0,  418,    0,    0,   30,
+    0,    0,    0,   30,   30,   30,   30,   30,   30,   30,
+    0,    0,   30,   30,   30,  369,    0,    0,    0,   30,
+   30,    0,   30,   30,    0,  369,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,   30,    0,    0,    0,
+    0,    0,    0,    0,    0,   30,    0,   30,   30,    0,
+    0,   30,    0,   30,   30,   30,   30,   30,    0,   30,
+   30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
+   30,   30,   30,   30,   30,    0,    0,    0,    0,   30,
+   30,   30,    0,    0,   30,   30,    0,   30,   30,   30,
+    0,   30,    0,   30,    0,   30,    0,   30,    0,    0,
+   30,   30,   30,    0,    0,   30,   30,   30,    0,    0,
+    0,   30,   30,   30,   30,   30,   30,   30,    0,   30,
+   30,   30,   30,   30,    0,   61,    0,    0,    0,    0,
+    0,    0,   30,   30,   30,    0,    0,    0,    0,    0,
+    0,    0,   30,    0,    0,   61,    0,    0,    0,   61,
+   61,   61,   61,   61,   61,   61,    0,    0,   61,   61,
+   61,  370,    0,    0,    0,   61,   61,    0,   61,   61,
+    0,  370,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,   61,    0,    0,    0,    0,    0,    0,    0,
+    0,   61,    0,   61,   61,    0,    0,   61,    0,   61,
+   61,   61,   61,   61,    0,   61,   61,   61,   61,   61,
+   61,   61,   61,   61,   61,   61,   61,   61,   61,   61,
+   61,    0,    0,    0,    0,   61,   61,   61,    0,    0,
+   61,   61,    0,   61,   61,   61,    0,   61,    0,   61,
+    0,   61,    0,   61,    0,    0,   61,   61,   61,    0,
+    0,   61,   61,   61,    0,    0,    0,   61,   61,   61,
+   61,   61,   61,   61,    0,   61,   61,   61,   61,   61,
+    0,  369,    0,    0,    0,    0,    0,    0,   61,   61,
+   61,    0,    0,    0,    0,    0,    0,    0,   61,    0,
+    0,  369,    0,    0,    0,  369,  369,  369,  369,  369,
+  369,  369,    0,    0,  369,  369,  369,  413,    0,    0,
+    0,  369,  369,    0,  369,  369,    0,  413,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  369,    0,
+    0,    0,    0,    0,    0,    0,    0,  369,    0,  369,
+  369,    0,    0,  369,    0,  369,  369,  369,  369,  369,
+    0,  369,  369,  369,  369,  369,  369,  369,  369,  369,
+  369,  369,  369,  369,  369,  369,  369,    0,    0,    0,
+    0,  369,  369,  369,    0,    0,  369,  369,    0,  369,
+  369,  369,    0,  369,    0,  369,    0,  369,    0,  369,
+    0,    0,  369,  369,  369,    0,    0,  369,  369,  369,
+    0,    0,    0,  369,  369,  369,  369,  369,  369,  369,
+    0,  369,  369,  369,  369,  369,    0,  370,    0,    0,
+    0,    0,    0,    0,  369,  369,  369,    0,    0,    0,
+    0,    0,    0,    0,  369,    0,    0,  370,    0,    0,
+    0,  370,  370,  370,  370,  370,  370,  370,    0,    0,
+  370,  370,  370,   39,    0,    0,    0,  370,  370,    0,
+  370,  370,    0,   39,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  370,    0,    0,    0,    0,    0,
+    0,    0,    0,  370,    0,  370,  370,    0,    0,  370,
+    0,  370,  370,  370,  370,  370,    0,  370,  370,  370,
+  370,  370,  370,  370,  370,  370,  370,  370,  370,  370,
+  370,  370,  370,    0,    0,    0,    0,  370,  370,  370,
+    0,    0,  370,  370,    0,  370,  370,  370,    0,  370,
+    0,  370,    0,  370,    0,  370,    0,    0,  370,  370,
+  370,    0,    0,  370,  370,  370,    0,    0,    0,  370,
+  370,  370,  370,  370,  370,  370,    0,  370,  370,  370,
+  370,  370,    0,  413,    0,    0,    0,    0,    0,    0,
+  370,  370,  370,    0,    0,    0,    0,    0,    0,    0,
+  370,    0,    0,  413,    0,    0,    0,  413,  413,  413,
+  413,  413,  413,  413,    0,    0,  413,  413,  413,  310,
+    0,    0,    0,  413,  413,    0,  413,  413,    0,  310,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  413,    0,    0,    0,    0,    0,    0,    0,    0,  413,
+    0,  413,  413,    0,    0,  413,    0,  413,  413,  413,
+  413,  413,    0,  413,  413,  413,  413,  413,  413,  413,
+  413,  413,  413,  413,  413,  413,  413,  413,  413,    0,
+    0,    0,    0,  413,  413,  413,    0,    0,  413,  413,
+    0,  413,  413,  413,    0,  413,    0,  413,    0,  413,
+    0,  413,    0,    0,  413,  413,  413,    0,    0,  413,
+  413,  413,    0,    0,    0,  413,  413,  413,  413,  413,
+  413,  413,    0,  413,  413,  413,  413,  413,    0,   39,
+    0,    0,    0,    0,    0,    0,  413,  413,  413,    0,
+    0,    0,    0,    0,    0,    0,  413,    0,    0,   39,
+    0,    0,    0,   39,   39,   39,   39,   39,   39,   39,
+    0,    0,   39,   39,   39,  419,    0,    0,    0,   39,
+   39,    0,   39,   39,    0,  419,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,   39,    0,    0,    0,
+    0,    0,    0,    0,    0,   39,    0,   39,   39,    0,
+    0,   39,    0,   39,   39,   39,   39,   39,    0,   39,
+   39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
+   39,   39,   39,   39,   39,    0,    0,    0,    0,   39,
+   39,   39,    0,    0,   39,   39,    0,   39,   39,   39,
+    0,   39,    0,   39,    0,   39,    0,   39,    0,    0,
+   39,   39,   39,    0,    0,   39,   39,   39,    0,    0,
+    0,   39,   39,   39,   39,   39,   39,   39,    0,   39,
+   39,   39,   39,   39,    0,  310,    0,    0,    0,    0,
+    0,    0,   39,   39,   39,    0,    0,    0,    0,    0,
+    0,    0,   39,    0,    0,  310,    0,    0,    0,  310,
+  310,  310,  310,  310,  310,  310,    0,    0,  310,  310,
+  310,  312,    0,    0,    0,  310,  310,    0,  310,  310,
+    0,  312,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  310,    0,    0,    0,    0,    0,    0,    0,
+    0,  310,    0,  310,  310,    0,    0,  310,    0,  310,
+  310,  310,  310,  310,    0,  310,  310,  310,  310,  310,
+  310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
+  310,    0,    0,    0,    0,  310,  310,  310,    0,    0,
+  310,  310,    0,  310,  310,  310,    0,  310,    0,  310,
+    0,  310,    0,  310,    0,    0,  310,  310,  310,    0,
+    0,  310,  310,  310,    0,    0,    0,  310,  310,  310,
+  310,  310,  310,  310,    0,  310,  310,  310,  310,  310,
+    0,  419,    0,    0,    0,    0,    0,    0,  310,  310,
+  310,    0,    0,    0,    0,    0,    0,    0,  310,    0,
+    0,  419,    0,    0,    0,  419,  419,  419,  419,  419,
+  419,  419,    0,    0,  419,  419,  419,  348,    0,    0,
+    0,  419,  419,    0,  419,  419,    0,  348,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  419,    0,
+    0,    0,    0,    0,    0,    0,    0,  419,    0,  419,
+  419,    0,    0,  419,    0,  419,  419,  419,  419,  419,
+    0,  419,  419,  419,  419,  419,  419,  419,  419,  419,
+  419,  419,  419,  419,  419,  419,  419,    0,    0,    0,
+    0,  419,  419,  419,    0,    0,  419,  419,    0,  419,
+  419,  419,    0,  419,    0,  419,    0,  419,    0,  419,
+    0,    0,  419,  419,  419,    0,    0,  419,  419,  419,
+    0,    0,    0,  419,  419,  419,  419,  419,  419,  419,
+    0,  419,  419,  419,  419,  419,    0,  312,    0,    0,
+    0,    0,    0,    0,  419,  419,  419,    0,    0,    0,
+    0,    0,    0,    0,  419,    0,    0,  312,    0,    0,
+    0,  312,  312,  312,  312,  312,  312,  312,    0,    0,
+  312,  312,  312,  349,    0,    0,    0,  312,  312,    0,
+  312,  312,    0,  349,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  312,    0,    0,    0,    0,    0,
+    0,    0,    0,  312,    0,  312,  312,    0,    0,  312,
+    0,  312,  312,  312,  312,  312,    0,  312,  312,  312,
+  312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+  312,  312,  312,    0,    0,    0,    0,  312,  312,  312,
+    0,    0,  312,  312,    0,  312,  312,  312,    0,  312,
+    0,  312,    0,  312,    0,  312,    0,    0,  312,  312,
+  312,    0,    0,  312,  312,  312,    0,    0,    0,  312,
+  312,  312,  312,  312,  312,  312,    0,  312,  312,  312,
+  312,  312,    0,  348,    0,    0,    0,    0,    0,    0,
+  312,  312,  312,    0,    0,    0,    0,    0,    0,    0,
+  312,    0,    0,  348,    0,    0,    0,  348,  348,  348,
+  348,  348,  348,  348,    0,    0,  348,  348,  348,  354,
+    0,    0,    0,  348,  348,    0,  348,  348,    0,  354,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  348,    0,    0,    0,    0,    0,    0,    0,    0,  348,
+    0,  348,  348,    0,    0,  348,    0,  348,  348,  348,
+  348,  348,    0,  348,  348,  348,  348,  348,  348,  348,
+  348,  348,  348,  348,  348,  348,  348,  348,  348,    0,
+    0,    0,    0,  348,  348,  348,    0,    0,  348,  348,
+    0,  348,  348,  348,    0,  348,    0,  348,    0,  348,
+    0,  348,    0,    0,  348,  348,  348,    0,    0,  348,
+  348,  348,    0,    0,    0,  348,  348,  348,  348,  348,
+  348,  348,    0,  348,  348,  348,  348,  348,    0,  349,
+    0,    0,    0,    0,    0,    0,  348,  348,  348,    0,
+    0,    0,    0,    0,    0,    0,  348,    0,    0,  349,
+  412,    0,    0,  349,  349,  349,  349,  349,  349,  349,
+  412,    0,  349,  349,  349,    0,    0,    0,    0,  349,
+  349,    0,  349,  349,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  349,    0,    0,    0,
+    0,    0,    0,    0,    0,  349,    0,  349,  349,    0,
+    0,  349,    0,  349,  349,  349,  349,  349,    0,  349,
+  349,  349,  349,  349,  349,  349,  349,  349,  349,  349,
+  349,  349,  349,  349,  349,    0,    0,    0,    0,  349,
+  349,  349,    0,    0,  349,  349,    0,  349,  349,  349,
+    0,  349,    0,  349,    0,  349,    0,  349,    0,    0,
+  349,  349,  349,    0,    0,  349,  349,  349,    0,    0,
+    0,  349,  349,  349,  349,  349,  349,  349,    0,  349,
+  349,  349,  349,  349,    0,  354,    0,    0,    0,    0,
+    0,  301,  349,  349,  349,    0,    0,    0,    0,    0,
+    0,  301,  349,    0,    0,  354,    0,    0,    0,  354,
+  354,  354,  354,  354,  354,  354,    0,    0,  354,  354,
+  354,    0,    0,    0,    0,  354,  354,    0,  354,  354,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  354,    0,    0,    0,    0,    0,    0,    0,
+    0,  354,    0,  354,  354,    0,    0,  354,    0,  354,
+  354,  354,  354,  354,    0,  354,  354,  354,  354,  354,
+  354,  354,  354,  354,  354,  354,  354,  354,  354,  354,
+  354,    0,    0,    0,    0,  354,  354,  354,    0,    0,
+  354,  354,    0,  354,  354,  354,    0,  354,    0,  354,
+    0,  354,    0,  354,    0,    0,  354,  354,  354,    0,
+    0,  354,  354,  354,    0,    0,  412,  354,  354,  354,
+  354,  354,  354,  354,    0,  354,  354,  354,  354,  354,
+    0,    0,    0,    0,    0,    0,  412,  416,  354,  354,
+  412,  412,  412,  412,  412,  412,  412,  416,  354,  412,
+  412,  412,    0,    0,    0,    0,  412,  412,    0,  412,
+  412,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  412,    0,    0,    0,    0,    0,    0,
+    0,    0,  412,    0,  412,  412,    0,    0,  412,    0,
+  412,  412,  412,  412,  412,    0,  412,  412,  412,  412,
+  412,  412,  412,  412,  412,  412,  412,  412,  412,  412,
+  412,  412,    0,    0,    0,    0,  412,  412,  412,    0,
+    0,  412,  412,    0,  412,  412,  412,    0,  412,    0,
+  412,    0,  412,    0,  412,    0,    0,  412,  412,  412,
+    0,    0,  412,  412,  412,    0,    0,  301,  412,  412,
+  412,  412,  412,  412,  412,    0,  412,  412,  412,  412,
+  412,    0,    0,    0,    0,    0,    0,  301,   22,  412,
+  412,  301,  301,  301,  301,  301,  301,  301,   22,  412,
+  301,  301,  301,    0,    0,    0,    0,  301,  301,    0,
+  301,  301,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  301,    0,    0,    0,    0,    0,
+    0,    0,    0,  301,    0,  301,  301,    0,    0,  301,
+    0,  301,  301,  301,  301,  301,    0,  301,  301,  301,
+  301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+  301,  301,  301,    0,    0,    0,    0,  301,  301,  301,
+    0,    0,  301,  301,    0,  301,  301,  301,    0,  301,
+    0,  301,    0,  301,    0,  301,    0,    0,  301,  301,
+  301,    0,    0,  301,  301,  301,    0,    0,    0,  301,
+  301,  301,    0,  301,  301,  301,    0,  301,  301,  301,
+  301,  301,    0,  416,    0,    0,    0,    0,    0,    0,
+  301,  301,    0,    0,    0,    0,    0,    0,    0,    0,
+  301,    0,    0,  416,    0,    0,    0,  416,  416,  416,
+  416,  416,  416,  416,    0,    0,  416,  416,  416,    0,
+    0,    0,    0,  416,  416,    0,  416,  416,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  416,  682,    0,  680,  152,    0,  153,    0,    0,  416,
+    0,  416,  416,    0,    0,  416,    0,  416,  416,  416,
+  416,  416,  403,  416,  416,  416,  416,  416,  416,  416,
+  416,  416,  416,  416,  416,  416,  416,  416,  416,    0,
+    0,    0,    0,  416,  416,  416,    0,    0,  416,  416,
+    0,  416,  416,  416,    0,  416,    0,  416,    0,  416,
+    0,  416,    0,    0,  416,  416,  416,    0,    0,  416,
+  416,  416,    0,    0,   22,  416,  416,  416,    0,  416,
+  416,  416,    0,  416,  416,  416,  416,  416,    0,    0,
+    0,  715,  393,  391,   22,  392,  416,  416,   22,   22,
+   22,   22,   22,   22,   22,    0,  416,   22,   22,   22,
+  396,  381,  397,    0,   22,   22,    0,   22,   22,    0,
+    0,    0,    0,  191,    0,  463,  152,    0,  153,    0,
+    0,   22,    0,    0,    0,    0,    0,    0,    0,    0,
+   22,  462,   22,   22,    0,    0,   22,    0,   22,   22,
+   22,   22,   22,    0,   22,   22,   22,   22,   22,   22,
+   22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
+    0,    0,    0,    0,   22,   22,   22,    0,    0,   22,
+   22,    0,   22,   22,   22,    0,   22,    0,   22,    0,
+   22,    0,   22,    0,    0,   22,   22,   22,    0,    0,
+   22,   22,   22,    0,    0,    0,   22,   22,   22,   22,
+   22,   22,   22,    0,   22,   22,   22,   22,   22,  716,
+  393,  391,    0,  392,  151,    0,    0,   22,   22,   22,
+    0,    0,    0,    0,  681,    0,    0,    0,  396,  381,
+  397,    0,    0,    0,    0,    0,    0,    0,  154,  155,
+    0,    0,    0,  156,  157,  158,  159,    0,    0,    0,
+    0,    0,    0,  160,  161,  162,  163,  164,  165,  166,
+  167,  168,  169,  170,    0,  171,  172,  173,  174,  175,
+  176,  177,  178,  191,  179,    0,  152,    0,  153,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  382,  383,  384,    0,  385,  386,  387,  388,  389,  390,
+    0,    0,  394,  395,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  191,    0,    0,  152,    0,  153,    0,
+    0,  180,    0,    0,    0,    0,  151,  181,  182,    0,
+    0,    0,  183,    0,  598,    0,    0,    0,    0,    0,
+    0,    0,  184,  185,    0,  186,  187,  188,  189,    0,
+  154,  155,   84,    0,    0,  156,  157,  158,  159,  190,
+    0,    0,    0,    0,    0,  160,  161,  162,  163,  164,
+  165,  166,  167,  168,  169,  170,    0,  171,  172,  173,
+  174,  175,  176,  177,  178,    0,  179,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  382,  383,
+  384,    0,  385,  386,  387,  388,  389,  390,    0,    0,
+  394,  395,    0,    0,  191,    0,  493,  152,    0,  153,
+    0,    0,    0,  180,    0,    0,    0,    0,    0,  181,
+  182,    0,    0,    0,  183,  639,    0,    0,    0,    0,
+    0,    0,    0,    0,  184,  185,    0,  186,  187,  188,
+  189,    0,    0,    0,   84,    0,    0,    0,    0,    0,
+    0,  190,    0,    0,    0,    0,  151,    0,    0,    0,
+    0,    0,    0,    0,    0,  525,    0,    0,    0,    0,
+  717,  393,  391,    0,  392,    0,    0,    0,    0,    0,
+  154,  155,    0,    0,    0,  156,  157,  158,  159,  396,
+  381,  397,    0,    0,    0,  160,  161,  162,  163,  164,
+  165,  166,  167,  168,  169,  170,  151,  171,  172,  173,
+  174,  175,  176,  177,  178,  599,  179,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  154,  155,    0,    0,    0,  156,  157,  158,  159,    0,
+    0,    0,    0,    0,    0,  160,  161,  162,  163,  164,
+  165,  166,  167,  168,  169,  170,    0,  171,  172,  173,
+  174,  175,  176,  177,  178,  191,  179,  493,  152,    0,
+  153,  393,  391,  180,  392,    0,    0,    0,    0,  181,
+  182,    0,    0,    0,  183,    0,  667,  836,    0,  396,
+  381,  397,    0,    0,  184,  185,  526,  186,  187,  188,
+  189,    0,    0,    0,   84,    0,    0,    0,    0,    0,
+    0,  527,    0,    0,    0,  116,    0,    0,  116,    0,
+  116,    0,    0,  180,    0,    0,    0,  151,    0,  181,
+  182,    0,    0,    0,  183,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  184,  185,    0,  186,  187,  188,
+  189,  154,  155,    0,   84,    0,  156,  157,  158,  159,
+    0,  190,    0,    0,    0,    0,  160,  161,  162,  163,
+  164,  165,  166,  167,  168,  169,  170,    0,  171,  172,
+  173,  174,  175,  176,  177,  178,    0,  179,    0,  382,
+  383,  384,    0,  385,  386,  387,  388,  389,  390,    0,
+    0,  394,  395,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  718,  393,  391,    0,  392,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  396,  381,  397,  191,    0,  493,  152,
+    0,  153,    0,    0,  180,    0,    0,    0,    0,    0,
+  181,  182,    0,    0,    0,  183,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  184,  185,    0,  186,  187,
+  188,  189,    0,    0,    0,   84,    0,    0,    0,    0,
+    0,    0,  190,    0,    0,    0,    0,    0,  151,  382,
+  383,  384,    0,  385,  386,  387,  388,  389,  390,    0,
+    0,  394,  395,    0,    0,  719,  393,  391,    0,  392,
+    0,    0,  154,  155,    0,    0,    0,  156,  157,  158,
+  159,    0,    0,    0,  396,  381,  397,  160,  161,  162,
+  163,  164,  165,  166,  167,  168,  169,  170,  116,  171,
+  172,  173,  174,  175,  176,  177,  178,  116,  179,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  116,  116,    0,    0,    0,  116,  116,  116,
+  116,  191,    0,  500,  152,    0,  153,  116,  116,  116,
+  116,  116,  116,  116,  116,  116,  116,  116,    0,  116,
+  116,  116,  116,  116,  116,  116,  116,    0,  116,    0,
+    0,    0,    0,    0,    0,  180,    0,    0,    0,    0,
+    0,  181,  182,    0,    0,    0,  183,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  184,  185,    0,  186,
+  187,  188,  189,  382,  383,  384,   84,  385,  386,  387,
+  388,  389,  390,  190,    0,  394,  395,    0,  720,  393,
+  391,    0,  392,    0,    0,  116,    0,    0,    0,  151,
+    0,  116,  116,    0,    0,    0,  116,  396,  381,  397,
+    0,    0,    0,    0,    0,    0,  116,  116,  116,  116,
+  116,  116,  116,  154,  155,    0,  116,    0,  156,  157,
+  158,  159,    0,  116,    0,    0,    0,    0,  160,  161,
+  162,  163,  164,  165,  166,  167,  168,  169,  170,    0,
+  171,  172,  173,  174,  175,  176,  177,  178,  191,  179,
+    0,  152,    0,  153,  382,  383,  384,    0,  385,  386,
+  387,  388,  389,  390,    0,    0,  394,  395,    0,  583,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  191,    0,
+    0,  152,    0,  153,    0,    0,  180,    0,    0,    0,
+    0,    0,  181,  182,    0,    0,    0,  183,    0,  603,
+    0,    0,    0,    0,  151,    0,    0,  184,  185,    0,
+  186,  187,  188,  189,    0,    0,    0,  494,    0,    0,
+    0,    0,    0,    0,  190,    0,    0,    0,  154,  155,
+    0,    0,    0,  156,  157,  158,  159,    0,    0,    0,
+    0,    0,    0,  160,  161,  162,  163,  164,  165,  166,
+  167,  168,  169,  170,    0,  171,  172,  173,  174,  175,
+  176,  177,  178,    0,  179,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  382,  383,  384,
+    0,  385,  386,  387,  388,  389,  390,    0,    0,  394,
+  395,    0,    0,    0,    0,    0,    0,    0,    0,  191,
+    0,    0,  152,    0,  153,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  605,  180,    0,    0,    0,    0,    0,  181,  182,    0,
+    0,    0,  183,    0,    0,    0,  191,    0,  638,  152,
+    0,  153,  184,  185,    0,  186,  187,  188,  189,    0,
+    0,  151,   84,    0,    0,    0,    0,    0,    0,  190,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  154,  155,    0,    0,    0,
+  156,  157,  158,  159,    0,    0,    0,    0,    0,    0,
+  160,  161,  162,  163,  164,  165,  166,  167,  168,  169,
+  170,  151,  171,  172,  173,  174,  175,  176,  177,  178,
+    0,  179,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  154,  155,    0,    0,    0,
+  156,  157,  158,  159,    0,    0,    0,    0,    0,    0,
+  160,  161,  162,  163,  164,  165,  166,  167,  168,  169,
+  170,    0,  171,  172,  173,  174,  175,  176,  177,  178,
+    0,  179,    0,    0,    0,    0,    0,    0,  180,    0,
+    0,    0,    0,  191,  181,  182,  152,    0,  153,  183,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  184,
+  185,  643,  186,  187,  188,  189,    0,    0,    0,   84,
+    0,    0,    0,    0,    0,    0,  190,    0,    0,    0,
+  191,    0,  493,  152,    0,  153,    0,    0,  180,    0,
+    0,    0,  151,    0,  181,  182,    0,    0,    0,  183,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  184,
+  185,    0,  186,  187,  188,  189,  154,  155,    0,   84,
+    0,  156,  157,  158,  159,    0,  190,    0,    0,  151,
+    0,  160,  161,  162,  163,  164,  165,  166,  167,  168,
+  169,  170,    0,  171,  172,  173,  174,  175,  176,  177,
+  178,    0,  179,  154,  155,    0,    0,    0,  156,  157,
+  158,  159,    0,    0,    0,    0,    0,    0,  160,  161,
+  162,  163,  164,  165,  166,  167,  168,  169,  170,    0,
+  171,  172,  173,  174,  175,  176,  177,  178,    0,  179,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  191,    0,    0,  152,    0,  153,    0,    0,  180,
+    0,    0,    0,    0,    0,  181,  182,    0,    0,  774,
+  183,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  184,  185,    0,  186,  187,  188,  189,    0,    0,    0,
+   84,    0,    0,    0,    0,    0,  180,  190,    0,    0,
+    0,    0,  181,  182,    0,    0,    0,  183,    0,    0,
+    0,    0,    0,    0,    0,    0,  151,  184,  185,    0,
+  186,  187,  188,  189,    0,    0,    0,   84,    0,    0,
+    0,  721,  393,  391,  190,  392,    0,    0,    0,    0,
+  154,  155,    0,    0,    0,  156,  157,  158,  159,    0,
+  396,  381,  397,  151,    0,  160,  161,  162,  163,  164,
+  165,  166,  167,  168,  169,  170,    0,  171,  172,  173,
+  174,  175,  176,  177,  178,    0,  179,  154,  155,    0,
+    0,    0,  156,  157,  158,  159,  191,    0,  463,  152,
+    0,  153,  160,  161,  162,  163,  164,  165,  166,  167,
+  168,  169,  170,    0,  171,  172,  173,  174,  175,  176,
+  177,  178,    0,  179,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  191,    0,  867,  152,    0,  153,    0,
+    0,    0,    0,  180,    0,    0,    0,    0,    0,  181,
+  182,    0,    0,    0,  183,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  184,  185,    0,  186,  187,  188,
+  189,    0,    0,    0,   84,    0,    0,    0,    0,    0,
+  180,  190,    0,    0,  151,    0,  181,  182,    0,    0,
+    0,  183,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  184,  185,    0,  186,  187,  188,  189,  154,  155,
+    0,   84,    0,  156,  157,  158,  159,    0,  190,    0,
+    0,    0,    0,  160,  161,  162,  163,  164,  165,  166,
+  167,  168,  169,  170,    0,  171,  172,  173,  174,  175,
+  176,  177,  178,    0,  179,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  191,    0,    0,  152,    0,  153,
+  382,  383,  384,    0,  385,  386,  387,  388,  389,  390,
+    0,    0,  394,  395,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  365,    0,    0,  152,    0,  153,    0,    0,    0,
+    0,  180,    0,    0,    0,    0,    0,  181,  182,    0,
+    0,    0,  183,    0,    0,    0,    0,    0,    0,  151,
+    0,    0,  184,  185,    0,  186,  187,  188,  189,    0,
+    0,    0,   84,    0,    0,    0,    0,    0,    0,  190,
+    0,    0,    0,  154,  155,    0,    0,    0,  156,  157,
+  158,  159,    0,    0,    0,    0,  151,    0,  160,  161,
+  162,  163,  164,  165,  166,  167,  168,  169,  170,    0,
+  171,  172,  173,  174,  175,  176,  177,  178,    0,  179,
+  154,  155,    0,    0,    0,  156,  157,  158,  159,    0,
+    0,    0,    0,    0,    0,  160,  161,  162,  163,  164,
+  165,  166,  167,  168,  169,  170,    0,  171,  172,  173,
+  174,  175,  176,  177,  178,    0,  179,    0,  456,    0,
+    0,  152,    0,  153,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,  180,    0,    0,    0,
+    0,    0,  181,  182,    0,    0,    0,  183,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  184,  185,    0,
+  186,  187,  188,  189,    0,    0,    0,   84,    0,    0,
+    0,    0,    0,  180,  190,    0,    0,  151,    0,  181,
+  182,    0,    0,    0,  183,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  184,  185,    0,  186,  187,  188,
+  189,  154,  155,    0,   84,    0,  156,  157,  158,  159,
+    0,  190,    0,    0,  151,    0,  160,  161,  162,  163,
+  164,  165,  166,  167,  168,  169,  170,    0,  171,  172,
+  173,  174,  175,  176,  177,  178,    0,  179,  154,  155,
+    0,    0,    0,  156,  157,  158,  159,  365,    0,    0,
+  152,    0,  153,  160,  161,  162,  163,  164,  165,  166,
+  167,  168,  169,  170,    0,  171,  172,  173,  174,  175,
+  176,  177,  178,    0,  179,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  827,    0,    0,  152,    0,  153,
+    0,    0,    0,    0,  180,    0,    0,    0,    0,    0,
+  181,  182,    0,    0,    0,  183,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  184,  185,    0,  186,  187,
+  188,  189,    0,    0,    0,   84,    0,    0,    0,    0,
+    0,  180,  190,    0,    0,    0,    0,  181,  182,    0,
+    0,  151,  183,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  184,  185,    0,  186,  187,  188,  189,    0,
+    0,    0,   84,    0,    0,  154,  155,    0,    0,  190,
+  156,  157,  158,  159,    0,    0,    0,    0,    0,    0,
+  160,  161,  162,  163,  164,  165,  166,  167,  168,  169,
+  170,    0,  171,  172,  173,  174,  175,  176,  177,  178,
+    0,  179,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,  722,  393,  391,    0,  392,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  723,  393,  391,
+    0,  392,  396,  381,  397,    0,    0,    0,  180,    0,
+    0,    0,    0,    0,  181,  182,  396,  381,  397,  183,
+  151,  724,  393,  391,    0,  392,    0,    0,    0,  184,
+  185,    0,  186,  187,  188,  189,    0,    0,    0,   84,
+  396,  381,  397,    0,  154,  155,  190,    0,    0,  156,
+  157,  158,  159,    0,    0,    0,    0,  151,    0,  160,
+  161,  162,  163,  164,  165,  166,  167,  168,  169,  170,
+    0,  171,  172,  173,  174,  175,  176,  177,  178,    0,
+  179,  154,  155,    0,    0,    0,  156,  157,  158,  159,
+    0,    0,    0,    0,    0,    0,  160,  161,  162,  163,
+  164,  165,  166,  167,  168,  169,  170,    0,  171,  172,
+  173,  174,  175,  176,  177,  178,    0,  179,    0,  725,
+  393,  391,    0,  392,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  180,  396,  381,
+  397,    0,    0,  181,  182,    0,    0,    0,  183,    0,
+  726,  393,  391,    0,  392,    0,    0,    0,  184,  185,
+    0,  186,  187,  188,  189,    0,    0,    0,  820,  396,
+  381,  397,    0,    0,  180,  190,    0,    0,    0,    0,
+  181,  182,    0,    0,    0,  183,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,  184,  185,    0,  186,  187,
+  188,  189,  382,  383,  384,   84,  385,  386,  387,  388,
+  389,  390,  190,    0,  394,  395,  382,  383,  384,    0,
+  385,  386,  387,  388,  389,  390,    0,    0,  394,  395,
+    0,    0,    0,    0,    0,  727,  393,  391,    0,  392,
+  382,  383,  384,    0,  385,  386,  387,  388,  389,  390,
+    0,    0,  394,  395,  396,  381,  397,  728,  393,  391,
+    0,  392,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  737,  393,  391,    0,  392,  396,  381,  397,    0,
+    0,    0,    0,    0,    0,  744,  393,  391,    0,  392,
+  396,  381,  397,    0,    0,    0,    0,    0,    0,  196,
+  196,  196,    0,  196,  396,  381,  397,    0,    0,    0,
+    0,    0,    0,    0,  393,  391,  802,  392,  196,  196,
+  196,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,  396,  381,  397,    0,    0,    0,  382,  383,
+  384,    0,  385,  386,  387,  388,  389,  390,    0,    0,
+  394,  395,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  382,
+  383,  384,    0,  385,  386,  387,  388,  389,  390,    0,
+    0,  394,  395,  393,  391,    0,  392,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,  872,
+    0,  396,  381,  397,  393,  391,  876,  392,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,  393,  391,
+  886,  392,  396,  381,  397,    0,    0,    0,    0,    0,
+    0,    0,  393,  391,  889,  392,  396,  381,  397,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+  396,  381,  397,    0,  382,  383,  384,    0,  385,  386,
+  387,  388,  389,  390,    0,    0,  394,  395,    0,    0,
+    0,    0,    0,    0,    0,    0,  382,  383,  384,    0,
+  385,  386,  387,  388,  389,  390,    0,    0,  394,  395,
+  382,  383,  384,    0,  385,  386,  387,  388,  389,  390,
+    0,    0,  394,  395,  382,  383,  384,    0,  385,  386,
+  387,  388,  389,  390,    0,    0,  394,  395,  196,  196,
+  196,    0,  196,  196,  196,  196,  196,  196,    0,    0,
+  196,  196,  382,  383,  384,    0,  385,  386,  387,  388,
+  389,  390,    0,    0,  394,  395,  196,  196,  196,  196,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,  196,  196,  196,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  382,  383,  384,    0,  385,  386,  387,  388,  389,
+  390,    0,    0,  394,  395,    0,    0,    0,    0,    0,
+    0,    0,  382,  383,  384,    0,  385,  386,  387,  388,
+  389,  390,    0,    0,  394,  395,  382,  383,  384,    0,
+  385,  386,  387,  388,  389,  390,    0,    0,  394,  395,
+  382,  383,  384,    0,  385,  386,  387,  388,  389,  390,
+    0,    0,  394,  395,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,   16,    0,    0,
+    0,   17,   18,   19,   20,    0,    0,   21,    0,    0,
+   22,   23,   24,    0,    0,    0,    0,   25,   26,    0,
+    0,    0,    0,    0,  196,  196,  196,    0,  196,  196,
+  196,  196,  196,  196,   27,    0,  196,  196,    0,    0,
+    0,    0,    0,   28,    0,   29,   30,    0,    0,   31,
+    0,   32,   33,   34,   35,   36,    0,   37,   38,   39,
+   40,   41,   42,   43,   44,   45,   46,   47,   48,   49,
+   50,   51,   52,    0,    0,    0,    0,   53,   54,   55,
+    0,    0,   56,   57,    0,   58,   59,   60,    0,   61,
+    0,   62,    0,   63,    0,   64,    0,    0,   65,   66,
+   67,    0,    0,   68,   69,   70,    0,    0,    0,    0,
+   71,   72,   73,   74,   75,   76,    0,   77,   78,   79,
+   80,   81,    0,    0,    0,    0,    0,    0,    0,    0,
+   82,   83,   84,
+};
+short fortrancheck[] = {                                      31,
+   53,  321,  199,   40,  241,  180,   11,   10,  180,  180,
+   10,  238,  254,  228,   10,  240,   10,   10,   42,   35,
+  191,  138,   40,   61,  697,   40,   40,   11,   41,   44,
+   61,   44,   85,   44,  658,   44,   40,  293,  459,   96,
+   42,  279,   99,   58,  269,  282,  133,  214,  101,   58,
+   40,   40,   98,   41,   42,  689,   41,   42,  111,   40,
+  668,   30,   44,  735,  736,  290,   10,  375,   44,   44,
+  365,  419,   56,  494,  786,   11,   58,  411,   37,   40,
+   61,  793,   58,   58,  271,  272,   40,  119,   42,   40,
+   44,  123,  271,  272,  271,  272,   43,   40,   45,   35,
+   44,   42,   61,  411,   58,  271,  272,  139,  140,  141,
+  142,  127,  117,   37,    0,   58,  327,   41,   41,  151,
+   44,   44,  271,  272,   10,   37,   60,   44,   62,   41,
+   19,   20,   44,  117,  118,   58,  808,   42,   43,   44,
+   45,   58,   47,  354,  355,  483,  321,  771,  180,  321,
+  321,  318,  418,   44,  325,   43,   44,   45,   41,  191,
+   40,   44,   41,   41,  691,   44,   44,   58,   40,  696,
+   42,  203,  204,  411,  808,   58,  208,  209,   37,   58,
+   58,  117,   41,  856,   42,   44,   40,  219,  796,   47,
+  365,  127,  279,  365,  365,  211,   41,  422,  127,   44,
+  216,   42,   43,   44,   45,  411,  238,   42,   43,  833,
+   45,  512,   42,   43,  439,   45,  517,   47,  639,  224,
+   40,  278,  254,  228,  411,   60,   41,   62,  274,   44,
+   40,  263,  411,  286,  411,   40,  268,  404,  270,  271,
+  224,  411,  226,  410,  228,  229,  667,   40,   42,   43,
+   44,   45,  236,   47,   41,   42,   43,  482,   45,   42,
+   40,  272,  256,  295,  233,   41,   42,   43,  283,   45,
+  323,   43,   44,   45,  283,  211,  308,   60,   40,   62,
+  216,  576,  211,  578,  579,  456,   44,  216,  224,  321,
+  284,  285,  228,  325,   41,  311,   40,   44,  314,   42,
+   43,  283,   45,  287,   58,  299,  300,  283,  283,  341,
+   42,   43,  344,   45,  346,  347,  348,  349,  350,  351,
+  352,  353,  354,  355,  356,  357,  358,  359,  373,  283,
+  266,  272,  273,  365,  451,  411,  320,   41,  376,  273,
+   44,  373,  509,   41,  511,  376,   44,  271,  272,  381,
+  382,  383,  384,  385,  386,  387,  388,  389,  390,  391,
+  392,  393,  394,  395,  396,  397,  380,  272,  381,   40,
+  256,  403,   43,  629,   45,  311,   40,  798,  314,  315,
+  433,  418,  311,  401,  272,  314,   42,  411,  630,  405,
+  406,  407,  408,  409,  388,  376,  411,  429,  284,  285,
+  627,  576,  617,  578,  579,  620,   37,  411,  411,  411,
+  581,  411,  637,  299,  300,  411,  418,  376,  411,  380,
+  657,  411,  411,  411,  456,  419,  411,  459,  481,  411,
+  462,  272,  464,  401,  487,  411,  411,  272,  273,  734,
+  735,  736,  403,  610,  611,  612,  613,  614,  786,  787,
+  788,  789,  790,   40,   44,  793,  653,   41,   42,   43,
+  492,   45,  494,  787,  788,  789,  790,  499,   44,  405,
+  406,  407,  408,  409,  411,  507,  405,  406,  407,  408,
+  409,   40,   44,   42,  271,  272,  273,   44,   41,  272,
+  273,   44,  812,  411,   40,  271,  272,  273,   42,   43,
+  272,   45,  388,  411,  411,  537,  538,  539,   44,   41,
+  542,  682,   44,   40,   40,   40,   60,  549,   62,   41,
+  691,   41,   44,   40,   44,  696,  697,   40,  271,  272,
+  273,   40,   61,  419,   42,   43,   41,   45,   40,   44,
+  272,  273,   40,   40,  576,  770,  578,  579,   60,  581,
+   41,  583,   60,   44,   62,   41,   40,   40,   44,  734,
+  735,  736,   41,  734,   40,   44,  598,  599,  411,   41,
+   40,  603,   44,  605,   41,   41,  512,   44,   44,   41,
+   41,  517,   44,   44,  616,   37,   40,   40,   40,   41,
+   42,   43,   44,   45,   41,  627,   40,   44,  630,  160,
+  112,   41,   41,   41,   44,   44,   44,  639,   60,   40,
+   62,  643,  617,   41,   40,  620,   44,  649,  650,  411,
+   41,   41,  654,   44,   44,   41,   41,  298,   44,   44,
+  301,   41,    0,  617,   44,  667,  620,  812,  622,  806,
+  812,  812,   10,   40,   58,   41,  662,  679,   44,   41,
+  682,   41,   44,   40,   44,   41,  827,   41,   44,  691,
+   44,   40,  411,   41,  696,  697,   44,   41,  684,   37,
+   44,   40,  411,   41,   42,   43,   44,   45,   44,   41,
+  664,  617,   44,   41,  620,  856,   44,  271,  272,  273,
+   58,   40,   60,   61,   62,   41,   41,   41,   44,   44,
+   44,  276,  734,  735,  736,   41,   41,   40,   44,   44,
+   40,   40,   40,   40,   40,  386,  387,   40,  262,   40,
+  264,  265,  266,  267,  268,  269,  411,  759,  272,  273,
+  401,  402,   44,  404,  405,  406,  407,  411,   58,   44,
+  411,  253,  774,  418,  776,  777,  411,  418,  684,  324,
+  325,  326,  411,  689,  411,  684,  264,  265,  266,  267,
+  268,  269,  272,  816,  272,  273,  798,   44,  411,   44,
+  802,  283,   40,   61,   44,  278,  288,  338,  339,  340,
+  812,  356,  411,  358,  359,  360,   44,  381,  363,  364,
+   44,  366,  367,   44,   44,  827,  273,   40,   44,  360,
+  361,  362,  363,  364,  836,   41,   44,  272,  260,  261,
+  262,   40,  264,  265,  266,  267,  268,  269,    0,  411,
+  272,  273,   40,   58,  856,  411,   41,   41,   10,   41,
+  862,   61,  386,  387,  411,   44,   41,   41,   44,  418,
+  872,   44,  826,   44,  876,   40,   44,  401,  402,  881,
+  404,  405,  406,  407,  886,   37,   44,  889,   44,   41,
+   42,   43,   44,   45,  418,  329,   41,   41,   58,   42,
+  411,   41,  808,   44,  272,   41,   58,  272,   60,   61,
+   62,  411,   58,  376,   44,   44,   41,  411,  256,  381,
+   41,   41,  260,  261,  262,   41,  264,  265,  266,  267,
+  268,  269,   41,  271,  272,  273,   44,   61,  276,   41,
+  411,   42,  280,  281,  282,  283,  284,  285,  286,   61,
+   41,  289,  290,  291,  411,   41,  376,   47,  296,  297,
+  272,  299,  300,   44,   41,   66,   67,   41,   61,   37,
+   71,   72,  411,  411,   58,  313,   77,   78,   79,   41,
+   41,  411,  411,  411,  322,   41,  324,  325,   41,   41,
+  328,   41,  330,  331,  332,  333,  334,   41,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   44,   41,   41,  381,  356,  357,
+  358,   41,  272,  361,  362,   41,  364,  365,  366,  381,
+  368,   41,  370,   41,  372,  875,  374,  703,  376,  377,
+  378,  379,  801,  381,  382,  383,  384,   10,  489,  701,
+  388,  389,  390,  391,  392,  393,  394,  365,  396,  397,
+  398,  399,  400,  272,  776,  616,  682,  537,  649,  655,
+  470,  409,  410,  411,  650,    9,   13,   40,  452,  868,
+   43,  419,   45,  633,  117,  492,   41,   42,   43,   44,
+   45,  418,  679,  127,  500,  684,  814,   -1,  127,   -1,
+  527,   -1,   -1,   -1,  256,   60,   61,   62,  260,  261,
+  262,   -1,  264,  265,  266,  267,  268,  269,   -1,  271,
+  272,  273,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   -1,   -1,   37,   -1,  296,  297,   41,  299,  300,   44,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  313,   -1,   -1,   -1,   60,   -1,   62,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   -1,  374,   -1,  376,  377,  378,  379,   -1,  381,
+  382,  383,  384,    0,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   10,  396,  397,  398,  399,  400,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,
+   -1,   -1,   -1,   -1,  386,  387,   -1,  419,   -1,   -1,
+   37,   -1,   -1,   -1,   41,   42,   43,   44,   45,  401,
+  402,   -1,  404,  405,  406,  407,   -1,   -1,   -1,   -1,
+   -1,   58,   -1,   60,   61,   62,  418,   -1,   -1,   -1,
+  263,   -1,   -1,   -1,   -1,  260,  261,  262,   -1,  264,
+  265,  266,  267,  268,  269,   -1,   -1,  272,  273,   -1,
+   -1,   -1,   -1,   -1,  287,  288,   -1,   -1,   -1,  292,
+  293,  294,  295,   -1,   -1,   -1,   -1,   -1,   -1,  302,
+  303,  304,  305,  306,  307,  308,  309,  310,  311,  312,
+   -1,  314,  315,  316,  317,  318,  319,  320,  321,   -1,
+  323,   -1,   -1,   -1,   -1,  260,  261,  262,   -1,  264,
+  265,  266,  267,  268,  269,   -1,   -1,  272,  273,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   10,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  380,   -1,   -1,
+   -1,   -1,   -1,  386,  387,   -1,  381,   -1,  391,   40,
+   41,   42,   43,   44,   45,   -1,   -1,   -1,  401,  402,
+   -1,  404,  405,  406,  407,   -1,   -1,   58,  411,   60,
+   61,   62,   -1,   -1,   -1,  418,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   40,   -1,   42,   43,   -1,   45,  256,
+   -1,   -1,   -1,  260,  261,  262,   -1,  264,  265,  266,
+  267,  268,  269,   -1,  271,  272,  273,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,  376,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,   40,   -1,   42,   43,
+   -1,   45,  409,  410,  411,  256,   -1,   -1,   -1,  260,
+  261,  262,  419,  264,  265,  266,  267,  268,  269,   -1,
+  271,  272,  273,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,  273,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,  298,   -1,   -1,  301,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,  376,  377,  378,  379,   -1,
+  381,  382,  383,  384,    0,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   10,  396,  397,  398,  399,  400,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   -1,   37,   -1,   -1,   -1,   41,   42,   43,   44,   45,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  386,
+  387,   -1,   58,   -1,   60,   61,   62,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,  406,
+  407,   -1,   -1,   -1,  411,   -1,   -1,   -1,   -1,  263,
+   -1,  418,   -1,   -1,   -1,   -1,   -1,   -1,  272,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  287,  288,   -1,   -1,   -1,  292,  293,
+  294,  295,   -1,   -1,   -1,   -1,   -1,   -1,  302,  303,
+  304,  305,  306,  307,  308,  309,  310,  311,  312,   -1,
+  314,  315,  316,  317,  318,  319,  320,  321,   -1,  323,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+    0,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   41,   42,   43,   44,   45,  380,   47,   -1,   -1,
+   -1,   -1,  386,  387,   -1,   -1,   -1,  391,   58,   -1,
+   60,   61,   62,   -1,   -1,   -1,   -1,  401,  402,  403,
+  404,  405,  406,  407,   -1,   -1,   -1,  411,   -1,   -1,
+   -1,   -1,   -1,   -1,  418,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   40,   -1,   42,   43,   -1,   45,
+  256,   -1,   -1,   -1,  260,  261,  262,   -1,  264,  265,
+  266,  267,  268,  269,   -1,  271,  272,  273,   -1,   -1,
+  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,
+  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,
+  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,    0,  313,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,
+  376,  377,  378,  379,   -1,  381,  382,  383,  384,   -1,
+   -1,   -1,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  409,  410,  411,  256,   -1,   -1,   -1,
+  260,  261,  262,  419,  264,  265,  266,  267,  268,  269,
+   -1,  271,  272,  273,   -1,   -1,  276,   -1,   -1,   -1,
+  280,  281,  282,  283,  284,  285,  286,   -1,   -1,  289,
+  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,
+  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,
+  330,  331,  332,  333,  334,   -1,  336,  337,  338,  339,
+  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,
+  350,  351,  298,   -1,   -1,  301,  356,  357,  358,   -1,
+   -1,  361,  362,    0,  364,  365,  366,   -1,  368,   -1,
+  370,   -1,  372,   10,  374,   -1,   -1,  377,  378,  379,
+   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,  389,
+  390,  391,  392,  393,  394,   -1,  396,  397,  398,  399,
+  400,   -1,   -1,   -1,   41,   42,   43,   44,   45,  409,
+  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,
+   -1,   58,   -1,   60,   61,   62,   -1,   -1,   -1,   -1,
+   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,
+  386,  387,  286,   -1,   -1,  289,  290,  291,   42,   43,
+   -1,   45,  296,  297,   -1,  401,  402,   -1,  404,  405,
+  406,  407,   -1,   -1,   58,  411,   60,   61,   62,  313,
+   -1,   -1,  418,   -1,   -1,   -1,   -1,   -1,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   -1,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,    0,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   10,
+  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,
+  384,   -1,   -1,   -1,   -1,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,   -1,
+   41,   42,   43,   44,   45,  409,  410,  411,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,   -1,   60,
+   61,   62,   -1,   -1,   40,   -1,   42,   43,   -1,   45,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,
+   -1,   -1,   -1,  260,  261,  262,   -1,  264,  265,  266,
+  267,  268,  269,   -1,  271,  272,  273,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,  260,  261,  262,   -1,
+  264,  265,  266,  267,  268,  269,  313,   -1,  272,  273,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,  256,   -1,   -1,   -1,  260,
+  261,  262,  419,  264,  265,  266,  267,  268,  269,   -1,
+  271,  272,  273,   42,   43,  276,   45,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   60,   61,   62,   -1,  296,  297,   -1,  299,  300,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,  298,  324,  325,  301,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,    0,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   10,  374,   -1,   -1,  377,  378,  379,   -1,
+  381,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,   -1,   -1,   41,   42,   43,   44,   45,  409,  410,
+  386,  387,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   -1,   -1,   60,   61,   62,  401,  402,  286,  404,  405,
+  406,  407,   -1,   -1,   -1,  411,   -1,   -1,   -1,   -1,
+   -1,   -1,  418,   -1,   -1,   41,   42,   43,   -1,   45,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   58,  322,   60,   61,   62,   -1,   -1,  328,
+  329,   -1,   -1,   -1,  333,  334,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  344,  345,  346,  347,  348,
+  349,  260,  261,  262,   -1,  264,  265,  266,  267,  268,
+  269,   -1,   -1,  272,  273,   -1,  365,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  374,   -1,   -1,    0,   -1,
+   -1,   -1,   -1,  382,   -1,  384,   -1,   -1,   10,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  411,   -1,   -1,   -1,   -1,   -1,   -1,   41,
+   42,   43,   44,   45,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,
+   -1,   -1,  260,  261,  262,   -1,  264,  265,  266,  267,
+  268,  269,   -1,   -1,  272,  273,   -1,   -1,  276,   -1,
+   -1,   -1,  280,  281,  282,  283,  284,  285,  286,   -1,
+   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,
+   -1,  299,  300,   -1,  260,  261,  262,   -1,  264,  265,
+  266,  267,  268,  269,   -1,  313,  272,  273,   -1,   -1,
+   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,
+  328,   -1,  330,  331,  332,  333,  334,   -1,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,
+  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,
+  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,
+  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,
+  388,  389,  390,  391,  392,  393,  394,   -1,  396,  397,
+  398,  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  409,  410,  411,  256,   -1,   -1,   -1,  260,  261,
+  262,  419,  264,  265,  266,  267,  268,  269,   -1,  271,
+  272,   41,   42,   43,  276,   45,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   60,   61,   62,   -1,  296,  297,   -1,  299,  300,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,    0,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   10,  374,   -1,   -1,  377,  378,  379,   -1,  381,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   -1,
+   -1,   -1,   41,   42,   43,   44,   45,  409,  410,  411,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   58,
+   -1,   -1,   61,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   41,   42,   43,   -1,   45,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   58,   -1,   60,   61,   62,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,   -1,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   10,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,   42,
+   43,   44,   45,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,  260,  261,  262,   -1,  264,  265,  266,  267,  268,
+  269,   -1,  271,  272,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,  260,  261,  262,   -1,  264,  265,  266,
+  267,  268,  269,   -1,  313,  272,  273,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,  256,   -1,   -1,   -1,  260,  261,  262,
+  419,  264,  265,  266,  267,  268,  269,   -1,  271,  272,
+   41,   42,   43,  276,   45,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,   60,
+   61,   62,   -1,  296,  297,   -1,  299,  300,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+    0,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   10,  374,   -1,   -1,  377,  378,  379,   -1,  381,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,
+   -1,   -1,   42,   43,   -1,   45,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,   -1,
+   60,   61,   62,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   41,   42,   43,   -1,   45,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   60,   61,   62,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  260,
+  261,  262,   -1,  264,  265,  266,  267,  268,  269,   -1,
+   -1,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   10,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,   -1,   43,
+   44,   45,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,   -1,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,   -1,  272,  273,   -1,   -1,  276,   -1,   -1,   -1,
+  280,  281,  282,  283,  284,  285,  286,   -1,   -1,  289,
+  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,
+  300,   -1,  260,  261,  262,   -1,  264,  265,  266,  267,
+  268,  269,   -1,  313,  272,  273,   -1,   -1,   -1,   -1,
+   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,
+  330,  331,  332,  333,  334,   -1,  336,  337,  338,  339,
+  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,
+  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,
+   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,
+  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,
+   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,  389,
+  390,  391,  392,  393,  394,   -1,  396,  397,  398,  399,
+  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,
+  410,  411,  256,   -1,   -1,   -1,  260,  261,  262,  419,
+  264,  265,  266,  267,  268,  269,   -1,  271,   -1,   41,
+   42,   43,  276,   45,   -1,   -1,  280,  281,  282,  283,
+  284,  285,  286,   -1,   -1,  289,  290,  291,   60,   61,
+   62,   -1,  296,  297,   -1,  299,  300,   42,   43,   -1,
+   45,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,
+   -1,   -1,   -1,   58,   -1,   60,   61,   62,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   -1,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,    0,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   10,
+  374,   -1,   -1,  377,  378,  379,   -1,  381,  382,  383,
+  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,   -1,
+   41,   -1,   43,   44,   45,  409,  410,  411,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  419,   -1,   58,   -1,   -1,
+   61,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   41,   42,   43,   44,   45,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   60,   61,   62,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  260,  261,
+  262,   -1,  264,  265,  266,  267,  268,  269,   -1,   -1,
+  272,  273,   -1,   -1,    0,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   10,  260,  261,  262,   -1,  264,
+  265,  266,  267,  268,  269,   -1,   -1,  272,  273,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   37,   -1,   -1,   40,   41,   42,   43,   44,   45,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,   -1,  260,
+  261,  262,   -1,  264,  265,  266,  267,  268,  269,   -1,
+  271,   -1,   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,  260,  261,  262,   -1,  264,  265,  266,  267,  268,
+  269,   -1,  313,  272,  273,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+  381,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+  256,    0,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   10,   -1,   -1,   -1,  271,  272,  273,  419,   -1,
+  276,   -1,  381,   -1,  280,  281,  282,  283,  284,  285,
+  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,
+  296,  297,   41,  299,  300,   44,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   58,
+   -1,   -1,   61,   -1,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,
+   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,
+   -1,   -1,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,    0,   -1,   -1,   -1,
+   -1,   -1,   -1,  409,  410,  411,   10,   -1,   -1,   -1,
+   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,   -1,   -1,
+   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,  260,  261,  262,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,  256,    0,   -1,   -1,  260,  261,  262,   -1,
+  409,  410,  411,   10,   -1,   -1,   -1,  271,   -1,   -1,
+  419,   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,
+  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,
+   -1,   -1,  296,  297,   41,  299,  300,   44,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,
+   -1,   58,   -1,   -1,   61,   -1,   -1,   -1,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   -1,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,
+  374,   -1,   -1,  377,  378,  379,   -1,  381,  382,  383,
+  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,    0,   -1,
+   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   10,   -1,
+   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,
+   -1,   -1,   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,
+   -1,   -1,   -1,  260,  261,  262,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,  256,    0,   -1,   -1,  260,  261,
+  262,   -1,  409,  410,  411,   10,   -1,   -1,   -1,  271,
+   -1,   -1,  419,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   -1,   -1,   -1,   -1,  296,  297,   41,  299,  300,   44,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  313,   -1,   58,   -1,   -1,   61,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,  381,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   -1,
+    0,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,
+   10,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   41,   -1,   -1,   44,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,   -1,
+   -1,   61,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  256,   -1,   -1,   -1,  260,  261,  262,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  271,   -1,   -1,   -1,
+   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,
+  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,  381,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,  256,    0,   -1,   -1,
+  260,  261,  262,   -1,  409,  410,  411,   10,   -1,   -1,
+   -1,  271,   -1,   -1,  419,   -1,  276,   -1,   -1,   -1,
+  280,  281,  282,  283,  284,  285,  286,   -1,   -1,  289,
+  290,  291,   -1,   -1,   -1,   -1,  296,  297,   41,  299,
+  300,   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  313,   -1,   58,   -1,   -1,   61,   -1,
+   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,
+  330,  331,  332,  333,  334,   -1,  336,  337,  338,  339,
+  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,
+  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,
+   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,
+  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,
+   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,  389,
+  390,  391,  392,  393,  394,   -1,  396,  397,  398,  399,
+  400,   -1,    0,   -1,   -1,   -1,   -1,   -1,   -1,  409,
+  410,  411,   10,   -1,   -1,   -1,   -1,   -1,   -1,  419,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   41,   -1,   -1,   44,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   58,   -1,   -1,   61,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  256,   -1,   -1,   -1,  260,  261,  262,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  271,   -1,
+   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,  381,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,  256,    0,
+   -1,   -1,  260,  261,  262,   -1,  409,  410,  411,   10,
+   -1,   -1,   -1,  271,   -1,   -1,  419,   -1,  276,   -1,
+   -1,   -1,  280,  281,  282,  283,  284,  285,  286,   -1,
+   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,
+   41,  299,  300,   44,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  313,   -1,   58,   -1,   -1,
+   61,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,
+  328,   -1,  330,  331,  332,  333,  334,   -1,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,
+  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,
+  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,
+  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,
+  388,  389,  390,  391,  392,  393,  394,   -1,  396,  397,
+  398,  399,  400,   -1,    0,   -1,   -1,   -1,   -1,   -1,
+   -1,  409,  410,  411,   10,   -1,   -1,   -1,   -1,   -1,
+   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   41,   -1,   -1,   44,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   58,   -1,   -1,   61,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,   -1,  260,
+  261,  262,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  271,   -1,   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+  381,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+  256,    0,   -1,   -1,  260,  261,  262,   -1,  409,  410,
+  411,   10,   -1,   -1,   -1,  271,   -1,   -1,  419,   -1,
+  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,
+  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,
+  296,  297,   41,  299,  300,   44,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   58,
+   -1,   -1,   61,   -1,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,
+   -1,  377,  378,  379,   -1,  381,  382,  383,  384,   -1,
+   -1,   -1,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,    0,   -1,   -1,   -1,
+   -1,   -1,   -1,  409,  410,  411,   10,   -1,   -1,   -1,
+   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,   -1,   -1,
+   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,  260,  261,  262,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,  256,    0,   -1,   -1,  260,  261,  262,   -1,
+  409,  410,  411,   10,   -1,   -1,   -1,  271,   -1,   -1,
+  419,   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,
+  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,
+   -1,   -1,  296,  297,   41,  299,  300,   44,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,
+   -1,   58,   -1,   -1,   61,   -1,   -1,   -1,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   -1,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,
+  374,   -1,   -1,  377,  378,  379,   -1,  381,  382,  383,
+  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,    0,   -1,
+   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   10,   -1,
+   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,
+   -1,   -1,   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,
+   -1,   -1,   -1,  260,  261,  262,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,  256,   -1,   -1,   -1,  260,  261,
+  262,    0,  409,  410,  411,   -1,   -1,   -1,   -1,  271,
+   -1,   10,  419,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,
+   -1,   -1,   41,   42,   43,   44,   45,   -1,   -1,   -1,
+   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,  381,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,    0,  409,  410,  411,
+   -1,   -1,   -1,   -1,   -1,   -1,   10,  419,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,   -1,   -1,
+   44,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   58,   -1,   -1,   61,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  271,  272,  273,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,  256,    0,   -1,   -1,  260,  261,   -1,   -1,
+  409,  410,  411,   10,   -1,   -1,   -1,  271,   -1,   -1,
+  419,   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,
+  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,
+   -1,   -1,  296,  297,   41,  299,  300,   44,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,
+   -1,   58,   -1,   -1,   61,   -1,   -1,   -1,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   -1,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,
+  374,   -1,   -1,  377,  378,  379,   -1,  381,  382,  383,
+  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,    0,   -1,
+   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   10,   -1,
+   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,
+   42,   43,   44,   45,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   41,   42,   43,   -1,   45,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   60,   61,   62,   -1,   -1,   -1,   -1,   -1,   -1,  256,
+   -1,   -1,   -1,  260,  261,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,    0,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   10,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   42,   43,   44,   45,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,  256,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,  271,
+  272,  273,  419,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,  313,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,    0,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   10,  374,   -1,   -1,  377,  378,  379,   -1,   -1,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   -1,
+   -1,   -1,   41,   42,   43,   44,   45,  409,  410,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  271,  272,  273,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,    0,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   10,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,   -1,   41,   42,   43,
+   44,   45,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,
+   42,   43,   -1,   45,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   60,   61,
+   62,   -1,  271,  272,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,    0,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   10,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,   -1,   -1,   41,   42,   43,   44,   45,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  271,  272,   -1,
+   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,
+  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,
+   -1,   -1,  296,  297,   -1,  299,  300,   -1,  260,  261,
+  262,   -1,  264,  265,  266,  267,  268,  269,   -1,  313,
+  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   -1,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,    0,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   10,
+  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,
+  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,   -1,
+   41,   42,   43,   44,   45,  409,  410,  411,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   41,   42,   43,   -1,   45,   -1,   -1,   -1,
+  256,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   60,   61,   62,   -1,  271,  272,   -1,   -1,   -1,
+  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,
+  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,
+  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,    0,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   10,  374,   -1,
+   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,
+   -1,   -1,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,   -1,   40,   -1,   42,
+   43,   -1,   45,  409,  410,  411,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  419,   -1,  256,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  271,  272,   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,  260,  261,  262,   -1,  264,  265,  266,  267,  268,
+  269,   -1,  313,  272,  273,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,    0,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   10,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,   -1,   -1,   41,   -1,   -1,   44,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   58,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  271,  272,
+  273,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   10,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   41,
+   -1,   -1,   44,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   58,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,  256,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,   -1,
+   -1,   -1,  280,  281,  282,  283,  284,  285,  286,   -1,
+   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,
+   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,    0,   -1,  313,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   10,  322,   -1,  324,  325,   -1,   -1,
+  328,   -1,  330,  331,  332,  333,  334,   -1,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   41,   -1,   -1,   44,  356,  357,
+  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,
+  368,   58,  370,   -1,  372,   -1,  374,   -1,   -1,  377,
+  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,
+  388,  389,  390,  391,  392,  393,  394,   -1,  396,  397,
+  398,  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,
+   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,  271,
+   -1,  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,    0,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   10,  374,   -1,   -1,  377,  378,  379,   -1,  381,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   -1,
+   -1,   -1,   41,   -1,   43,   44,   45,  409,  410,  411,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,    0,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   10,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,   44,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,    0,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   10,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   41,   -1,   -1,   44,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,  256,   -1,
+  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  271,  272,   -1,   -1,   -1,  276,   -1,
+   -1,   -1,  280,  281,  282,  283,  284,  285,  286,   -1,
+   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,
+   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,    0,   -1,  313,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   10,  322,   -1,  324,  325,   -1,   -1,
+  328,   -1,  330,  331,  332,  333,  334,   -1,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   41,   -1,   -1,   44,  356,  357,
+  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,
+  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,
+  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,
+  388,  389,  390,  391,  392,  393,  394,   -1,  396,  397,
+  398,  399,  400,   -1,   -1,   -1,   -1,   -1,  256,   -1,
+   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  419,   -1,  271,   -1,   -1,   -1,   -1,  276,   -1,
+   -1,   -1,  280,  281,  282,  283,  284,  285,  286,   -1,
+   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,
+   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,    0,   -1,  313,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   10,  322,   -1,  324,  325,   -1,   -1,
+  328,   -1,  330,  331,  332,  333,  334,   -1,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   41,   -1,   -1,   44,  356,  357,
+  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,
+  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,
+  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,
+  388,  389,  390,  391,  392,  393,  394,   -1,  396,  397,
+  398,  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,  256,
+   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  271,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,    0,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   10,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   41,   -1,   -1,   44,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,   -1,   -1,   -1,  256,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,  271,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,    0,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   10,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   42,   -1,   44,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   61,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+  256,   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  271,   -1,   -1,   -1,   -1,
+  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,
+  286,   -1,   -1,  289,  290,  291,   -1,   -1,    0,   -1,
+  296,  297,   -1,  299,  300,   -1,   -1,   -1,   10,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,
+   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,
+   -1,   -1,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,   -1,   -1,   -1,  256,
+   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,    0,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   10,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,  256,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,  271,
+  272,   -1,  419,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   -1,   -1,    0,   -1,  296,  297,   -1,  299,  300,   -1,
+   -1,   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   -1,
+   -1,   -1,   -1,  256,   -1,   -1,   -1,  409,  410,  411,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,  271,  272,
+   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,
+   -1,    0,   -1,  296,  297,   -1,  299,  300,   -1,   -1,
+   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   41,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   58,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,  256,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,  271,  272,   -1,  419,   -1,  276,   -1,
+   -1,   -1,  280,  281,  282,  283,  284,  285,  286,   -1,
+   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,
+   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+    0,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,
+   10,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,
+  328,   -1,  330,  331,  332,  333,  334,   -1,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   44,   -1,   -1,   -1,  356,  357,
+  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,
+  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,
+  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,
+  388,  389,  390,  391,  392,  393,  394,   -1,  396,  397,
+  398,  399,  400,   -1,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  419,   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   10,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,  256,   -1,   -1,   -1,
+  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  271,  272,   -1,   -1,   -1,  276,   -1,   -1,   -1,
+  280,  281,  282,  283,  284,  285,  286,   -1,   -1,  289,
+  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,
+  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+    0,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,
+   10,   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,
+  330,  331,  332,  333,  334,   -1,  336,  337,  338,  339,
+  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,
+  350,  351,   42,   -1,   44,   -1,  356,  357,  358,   -1,
+   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,
+  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,
+   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,
+  390,  391,  392,  393,  394,   -1,  396,  397,  398,  399,
+  400,  256,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,
+  410,   -1,   -1,   -1,   -1,   -1,  271,  272,   -1,  419,
+   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,
+  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   -1,   -1,   10,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  419,   -1,  256,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,   -1,
+  280,  281,  282,  283,  284,  285,  286,   -1,   -1,  289,
+  290,  291,   -1,   -1,    0,   -1,  296,  297,   -1,  299,
+  300,   -1,   -1,   -1,   10,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,
+  330,  331,  332,  333,  334,   -1,  336,  337,  338,  339,
+  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,
+  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,
+   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,
+  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,
+   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,
+  390,  391,  392,  393,  394,   -1,  396,  397,  398,  399,
+  400,  256,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,
+  410,  411,   -1,   -1,   -1,   -1,  271,  272,   -1,  419,
+   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,
+  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   10,   -1,   -1,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   44,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,   -1,   -1,   -1,   -1,
+  256,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  419,  271,  272,   -1,   -1,   -1,
+  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,
+  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,
+  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,    0,   -1,   -1,   -1,   -1,  313,   -1,   -1,
+   -1,   -1,   10,   -1,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   44,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,
+   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,
+   -1,   -1,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,  256,
+   -1,   -1,   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,    0,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   10,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   44,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,   -1,   -1,  256,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,   -1,   -1,   -1,  276,   -1,
+   -1,   -1,  280,  281,  282,  283,  284,  285,  286,   -1,
+   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,
+   -1,  299,  300,   -1,   -1,   -1,    0,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  313,   10,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,
+  328,   -1,  330,  331,  332,  333,  334,   -1,  336,  337,
+  338,  339,  340,  341,  342,  343,  344,  345,  346,  347,
+  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,
+  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,
+  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,
+  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,
+  388,  389,  390,  391,  392,  393,  394,   -1,  396,  397,
+  398,  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  409,  410,  411,   -1,   -1,   -1,  256,   -1,   -1,
+   -1,  419,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,    0,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   10,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   44,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   61,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,  256,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,  271,  272,   -1,
+  419,   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,
+  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,
+   -1,   -1,  296,  297,   -1,  299,  300,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,  313,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   10,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   41,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,
+  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,
+  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  419,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   10,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   44,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   61,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   -1,
+   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   10,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,  381,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,  256,  419,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   10,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   44,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+  256,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+  276,   -1,  278,   -1,  280,  281,  282,  283,  284,  285,
+  286,   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,
+  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,    0,   -1,   -1,   -1,  313,   -1,   -1,
+   -1,   -1,   -1,   10,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,
+   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,
+   -1,   -1,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  419,  256,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+    0,   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,
+   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,    0,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   10,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   44,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,  381,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,   -1,  256,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,   -1,  276,   -1,   -1,   -1,
+  280,  281,  282,  283,  284,  285,  286,   -1,   -1,  289,
+  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,
+  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,
+   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   10,   -1,
+   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,
+  330,  331,  332,  333,  334,   -1,  336,  337,  338,  339,
+  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,
+  350,  351,   44,   -1,   -1,   -1,  356,  357,  358,   -1,
+   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,
+  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,
+   -1,  381,  382,  383,  384,   -1,   -1,   -1,  388,  389,
+  390,  391,  392,  393,  394,   -1,  396,  397,  398,  399,
+  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,
+  410,  411,   -1,   -1,   -1,   -1,   -1,  256,   -1,  419,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   10,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   44,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,   -1,  256,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,
+  282,  283,  284,  285,  286,   -1,   -1,  289,  290,  291,
+   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,
+   -1,  313,   -1,   -1,   -1,   -1,   10,   -1,   -1,   -1,
+  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   44,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,
+   -1,   -1,   -1,   -1,   -1,  256,   -1,  419,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   10,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   44,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,   -1,  256,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,
+  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,   -1,
+   -1,   -1,  296,  297,   -1,  299,  300,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,   -1,  313,
+   -1,   -1,   -1,   -1,   10,   -1,   -1,   -1,  322,   -1,
+  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,
+  334,   -1,  336,  337,  338,  339,  340,  341,  342,  343,
+  344,  345,  346,  347,  348,  349,  350,  351,   44,   -1,
+   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,
+  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,
+  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,
+  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,
+  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,
+   -1,   -1,   -1,  256,   -1,  419,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  276,   -1,    0,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   10,  289,  290,  291,   -1,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,
+  256,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,   -1,
+  276,    0,   -1,   -1,  280,  281,  282,  283,  284,  285,
+  286,   10,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,
+  296,  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,
+   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,
+  336,  337,  338,  339,  340,  341,  342,  343,  344,  345,
+  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,
+  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,
+  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,
+   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,
+   -1,  256,  388,  389,  390,  391,  392,  393,  394,   -1,
+  396,  397,  398,  399,  400,   -1,   -1,   -1,   -1,   -1,
+   -1,  276,   -1,  409,  410,  280,  281,  282,  283,  284,
+  285,  286,   -1,  419,  289,  290,  291,    0,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   10,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,    0,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,    0,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   10,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,    0,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   10,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,  256,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,    0,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,
+  285,  286,   -1,   -1,  289,  290,  291,    0,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   10,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,    0,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,    0,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   10,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,    0,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   10,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,  256,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,    0,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,
+  285,  286,   -1,   -1,  289,  290,  291,    0,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   10,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,    0,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,    0,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   10,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,    0,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   10,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,  256,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,    0,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,
+  285,  286,   -1,   -1,  289,  290,  291,    0,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   10,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,    0,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,    0,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   10,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,
+   -1,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   -1,   -1,  289,  290,  291,    0,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   10,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,  256,   -1,   -1,   -1,   -1,
+   -1,   -1,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,    0,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,
+  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,
+   -1,  276,   -1,   -1,   -1,  280,  281,  282,  283,  284,
+  285,  286,   -1,   -1,  289,  290,  291,    0,   -1,   -1,
+   -1,  296,  297,   -1,  299,  300,   -1,   10,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,
+  325,   -1,   -1,  328,   -1,  330,  331,  332,  333,  334,
+   -1,  336,  337,  338,  339,  340,  341,  342,  343,  344,
+  345,  346,  347,  348,  349,  350,  351,   -1,   -1,   -1,
+   -1,  356,  357,  358,   -1,   -1,  361,  362,   -1,  364,
+  365,  366,   -1,  368,   -1,  370,   -1,  372,   -1,  374,
+   -1,   -1,  377,  378,  379,   -1,   -1,  382,  383,  384,
+   -1,   -1,   -1,  388,  389,  390,  391,  392,  393,  394,
+   -1,  396,  397,  398,  399,  400,   -1,  256,   -1,   -1,
+   -1,   -1,   -1,   -1,  409,  410,  411,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,  284,  285,  286,   -1,   -1,
+  289,  290,  291,    0,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   10,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,    0,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   10,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   -1,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,  256,
+   -1,   -1,   -1,   -1,   -1,   -1,  409,  410,  411,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  419,   -1,   -1,  276,
+    0,   -1,   -1,  280,  281,  282,  283,  284,  285,  286,
+   10,   -1,  289,  290,  291,   -1,   -1,   -1,   -1,  296,
+  297,   -1,  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  322,   -1,  324,  325,   -1,
+   -1,  328,   -1,  330,  331,  332,  333,  334,   -1,  336,
+  337,  338,  339,  340,  341,  342,  343,  344,  345,  346,
+  347,  348,  349,  350,  351,   -1,   -1,   -1,   -1,  356,
+  357,  358,   -1,   -1,  361,  362,   -1,  364,  365,  366,
+   -1,  368,   -1,  370,   -1,  372,   -1,  374,   -1,   -1,
+  377,  378,  379,   -1,   -1,  382,  383,  384,   -1,   -1,
+   -1,  388,  389,  390,  391,  392,  393,  394,   -1,  396,
+  397,  398,  399,  400,   -1,  256,   -1,   -1,   -1,   -1,
+   -1,    0,  409,  410,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,   10,  419,   -1,   -1,  276,   -1,   -1,   -1,  280,
+  281,  282,  283,  284,  285,  286,   -1,   -1,  289,  290,
+  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,  300,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,  330,
+  331,  332,  333,  334,   -1,  336,  337,  338,  339,  340,
+  341,  342,  343,  344,  345,  346,  347,  348,  349,  350,
+  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,
+  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,
+   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,
+   -1,  382,  383,  384,   -1,   -1,  256,  388,  389,  390,
+  391,  392,  393,  394,   -1,  396,  397,  398,  399,  400,
+   -1,   -1,   -1,   -1,   -1,   -1,  276,    0,  409,  410,
+  280,  281,  282,  283,  284,  285,  286,   10,  419,  289,
+  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,  299,
+  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,   -1,
+  330,  331,  332,  333,  334,   -1,  336,  337,  338,  339,
+  340,  341,  342,  343,  344,  345,  346,  347,  348,  349,
+  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,   -1,
+   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,   -1,
+  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,  379,
+   -1,   -1,  382,  383,  384,   -1,   -1,  256,  388,  389,
+  390,  391,  392,  393,  394,   -1,  396,  397,  398,  399,
+  400,   -1,   -1,   -1,   -1,   -1,   -1,  276,    0,  409,
+  410,  280,  281,  282,  283,  284,  285,  286,   10,  419,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+  299,  300,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  313,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,  388,
+  389,  390,   -1,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,  256,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  419,   -1,   -1,  276,   -1,   -1,   -1,  280,  281,  282,
+  283,  284,  285,  286,   -1,   -1,  289,  290,  291,   -1,
+   -1,   -1,   -1,  296,  297,   -1,  299,  300,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  313,   40,   -1,   42,   43,   -1,   45,   -1,   -1,  322,
+   -1,  324,  325,   -1,   -1,  328,   -1,  330,  331,  332,
+  333,  334,   61,  336,  337,  338,  339,  340,  341,  342,
+  343,  344,  345,  346,  347,  348,  349,  350,  351,   -1,
+   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,  362,
+   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,  372,
+   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,  382,
+  383,  384,   -1,   -1,  256,  388,  389,  390,   -1,  392,
+  393,  394,   -1,  396,  397,  398,  399,  400,   -1,   -1,
+   -1,   41,   42,   43,  276,   45,  409,  410,  280,  281,
+  282,  283,  284,  285,  286,   -1,  419,  289,  290,  291,
+   60,   61,   62,   -1,  296,  297,   -1,  299,  300,   -1,
+   -1,   -1,   -1,   40,   -1,   42,   43,   -1,   45,   -1,
+   -1,  313,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  322,   58,  324,  325,   -1,   -1,  328,   -1,  330,  331,
+  332,  333,  334,   -1,  336,  337,  338,  339,  340,  341,
+  342,  343,  344,  345,  346,  347,  348,  349,  350,  351,
+   -1,   -1,   -1,   -1,  356,  357,  358,   -1,   -1,  361,
+  362,   -1,  364,  365,  366,   -1,  368,   -1,  370,   -1,
+  372,   -1,  374,   -1,   -1,  377,  378,  379,   -1,   -1,
+  382,  383,  384,   -1,   -1,   -1,  388,  389,  390,  391,
+  392,  393,  394,   -1,  396,  397,  398,  399,  400,   41,
+   42,   43,   -1,   45,  263,   -1,   -1,  409,  410,  411,
+   -1,   -1,   -1,   -1,  273,   -1,   -1,   -1,   60,   61,
+   62,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  287,  288,
+   -1,   -1,   -1,  292,  293,  294,  295,   -1,   -1,   -1,
+   -1,   -1,   -1,  302,  303,  304,  305,  306,  307,  308,
+  309,  310,  311,  312,   -1,  314,  315,  316,  317,  318,
+  319,  320,  321,   40,  323,   -1,   43,   -1,   45,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,   -1,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   40,   -1,   -1,   43,   -1,   45,   -1,
+   -1,  380,   -1,   -1,   -1,   -1,  263,  386,  387,   -1,
+   -1,   -1,  391,   -1,   61,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  401,  402,   -1,  404,  405,  406,  407,   -1,
+  287,  288,  411,   -1,   -1,  292,  293,  294,  295,  418,
+   -1,   -1,   -1,   -1,   -1,  302,  303,  304,  305,  306,
+  307,  308,  309,  310,  311,  312,   -1,  314,  315,  316,
+  317,  318,  319,  320,  321,   -1,  323,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  260,  261,
+  262,   -1,  264,  265,  266,  267,  268,  269,   -1,   -1,
+  272,  273,   -1,   -1,   40,   -1,   42,   43,   -1,   45,
+   -1,   -1,   -1,  380,   -1,   -1,   -1,   -1,   -1,  386,
+  387,   -1,   -1,   -1,  391,   61,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,  406,
+  407,   -1,   -1,   -1,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,  418,   -1,   -1,   -1,   -1,  263,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  272,   -1,   -1,   -1,   -1,
+   41,   42,   43,   -1,   45,   -1,   -1,   -1,   -1,   -1,
+  287,  288,   -1,   -1,   -1,  292,  293,  294,  295,   60,
+   61,   62,   -1,   -1,   -1,  302,  303,  304,  305,  306,
+  307,  308,  309,  310,  311,  312,  263,  314,  315,  316,
+  317,  318,  319,  320,  321,  272,  323,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  287,  288,   -1,   -1,   -1,  292,  293,  294,  295,   -1,
+   -1,   -1,   -1,   -1,   -1,  302,  303,  304,  305,  306,
+  307,  308,  309,  310,  311,  312,   -1,  314,  315,  316,
+  317,  318,  319,  320,  321,   40,  323,   42,   43,   -1,
+   45,   42,   43,  380,   45,   -1,   -1,   -1,   -1,  386,
+  387,   -1,   -1,   -1,  391,   -1,   61,   58,   -1,   60,
+   61,   62,   -1,   -1,  401,  402,  403,  404,  405,  406,
+  407,   -1,   -1,   -1,  411,   -1,   -1,   -1,   -1,   -1,
+   -1,  418,   -1,   -1,   -1,   40,   -1,   -1,   43,   -1,
+   45,   -1,   -1,  380,   -1,   -1,   -1,  263,   -1,  386,
+  387,   -1,   -1,   -1,  391,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,  406,
+  407,  287,  288,   -1,  411,   -1,  292,  293,  294,  295,
+   -1,  418,   -1,   -1,   -1,   -1,  302,  303,  304,  305,
+  306,  307,  308,  309,  310,  311,  312,   -1,  314,  315,
+  316,  317,  318,  319,  320,  321,   -1,  323,   -1,  260,
+  261,  262,   -1,  264,  265,  266,  267,  268,  269,   -1,
+   -1,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   41,   42,   43,   -1,   45,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   60,   61,   62,   40,   -1,   42,   43,
+   -1,   45,   -1,   -1,  380,   -1,   -1,   -1,   -1,   -1,
+  386,  387,   -1,   -1,   -1,  391,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,
+  406,  407,   -1,   -1,   -1,  411,   -1,   -1,   -1,   -1,
+   -1,   -1,  418,   -1,   -1,   -1,   -1,   -1,  263,  260,
+  261,  262,   -1,  264,  265,  266,  267,  268,  269,   -1,
+   -1,  272,  273,   -1,   -1,   41,   42,   43,   -1,   45,
+   -1,   -1,  287,  288,   -1,   -1,   -1,  292,  293,  294,
+  295,   -1,   -1,   -1,   60,   61,   62,  302,  303,  304,
+  305,  306,  307,  308,  309,  310,  311,  312,  263,  314,
+  315,  316,  317,  318,  319,  320,  321,  272,  323,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  287,  288,   -1,   -1,   -1,  292,  293,  294,
+  295,   40,   -1,   42,   43,   -1,   45,  302,  303,  304,
+  305,  306,  307,  308,  309,  310,  311,  312,   -1,  314,
+  315,  316,  317,  318,  319,  320,  321,   -1,  323,   -1,
+   -1,   -1,   -1,   -1,   -1,  380,   -1,   -1,   -1,   -1,
+   -1,  386,  387,   -1,   -1,   -1,  391,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  401,  402,   -1,  404,
+  405,  406,  407,  260,  261,  262,  411,  264,  265,  266,
+  267,  268,  269,  418,   -1,  272,  273,   -1,   41,   42,
+   43,   -1,   45,   -1,   -1,  380,   -1,   -1,   -1,  263,
+   -1,  386,  387,   -1,   -1,   -1,  391,   60,   61,   62,
+   -1,   -1,   -1,   -1,   -1,   -1,  401,  402,  403,  404,
+  405,  406,  407,  287,  288,   -1,  411,   -1,  292,  293,
+  294,  295,   -1,  418,   -1,   -1,   -1,   -1,  302,  303,
+  304,  305,  306,  307,  308,  309,  310,  311,  312,   -1,
+  314,  315,  316,  317,  318,  319,  320,  321,   40,  323,
+   -1,   43,   -1,   45,  260,  261,  262,   -1,  264,  265,
+  266,  267,  268,  269,   -1,   -1,  272,  273,   -1,   61,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   40,   -1,
+   -1,   43,   -1,   45,   -1,   -1,  380,   -1,   -1,   -1,
+   -1,   -1,  386,  387,   -1,   -1,   -1,  391,   -1,   61,
+   -1,   -1,   -1,   -1,  263,   -1,   -1,  401,  402,   -1,
+  404,  405,  406,  407,   -1,   -1,   -1,  411,   -1,   -1,
+   -1,   -1,   -1,   -1,  418,   -1,   -1,   -1,  287,  288,
+   -1,   -1,   -1,  292,  293,  294,  295,   -1,   -1,   -1,
+   -1,   -1,   -1,  302,  303,  304,  305,  306,  307,  308,
+  309,  310,  311,  312,   -1,  314,  315,  316,  317,  318,
+  319,  320,  321,   -1,  323,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  260,  261,  262,
+   -1,  264,  265,  266,  267,  268,  269,   -1,   -1,  272,
+  273,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   40,
+   -1,   -1,   43,   -1,   45,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   61,  380,   -1,   -1,   -1,   -1,   -1,  386,  387,   -1,
+   -1,   -1,  391,   -1,   -1,   -1,   40,   -1,   42,   43,
+   -1,   45,  401,  402,   -1,  404,  405,  406,  407,   -1,
+   -1,  263,  411,   -1,   -1,   -1,   -1,   -1,   -1,  418,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  287,  288,   -1,   -1,   -1,
+  292,  293,  294,  295,   -1,   -1,   -1,   -1,   -1,   -1,
+  302,  303,  304,  305,  306,  307,  308,  309,  310,  311,
+  312,  263,  314,  315,  316,  317,  318,  319,  320,  321,
+   -1,  323,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  287,  288,   -1,   -1,   -1,
+  292,  293,  294,  295,   -1,   -1,   -1,   -1,   -1,   -1,
+  302,  303,  304,  305,  306,  307,  308,  309,  310,  311,
+  312,   -1,  314,  315,  316,  317,  318,  319,  320,  321,
+   -1,  323,   -1,   -1,   -1,   -1,   -1,   -1,  380,   -1,
+   -1,   -1,   -1,   40,  386,  387,   43,   -1,   45,  391,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  401,
+  402,   58,  404,  405,  406,  407,   -1,   -1,   -1,  411,
+   -1,   -1,   -1,   -1,   -1,   -1,  418,   -1,   -1,   -1,
+   40,   -1,   42,   43,   -1,   45,   -1,   -1,  380,   -1,
+   -1,   -1,  263,   -1,  386,  387,   -1,   -1,   -1,  391,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  401,
+  402,   -1,  404,  405,  406,  407,  287,  288,   -1,  411,
+   -1,  292,  293,  294,  295,   -1,  418,   -1,   -1,  263,
+   -1,  302,  303,  304,  305,  306,  307,  308,  309,  310,
+  311,  312,   -1,  314,  315,  316,  317,  318,  319,  320,
+  321,   -1,  323,  287,  288,   -1,   -1,   -1,  292,  293,
+  294,  295,   -1,   -1,   -1,   -1,   -1,   -1,  302,  303,
+  304,  305,  306,  307,  308,  309,  310,  311,  312,   -1,
+  314,  315,  316,  317,  318,  319,  320,  321,   -1,  323,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   40,   -1,   -1,   43,   -1,   45,   -1,   -1,  380,
+   -1,   -1,   -1,   -1,   -1,  386,  387,   -1,   -1,   58,
+  391,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  401,  402,   -1,  404,  405,  406,  407,   -1,   -1,   -1,
+  411,   -1,   -1,   -1,   -1,   -1,  380,  418,   -1,   -1,
+   -1,   -1,  386,  387,   -1,   -1,   -1,  391,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  263,  401,  402,   -1,
+  404,  405,  406,  407,   -1,   -1,   -1,  411,   -1,   -1,
+   -1,   41,   42,   43,  418,   45,   -1,   -1,   -1,   -1,
+  287,  288,   -1,   -1,   -1,  292,  293,  294,  295,   -1,
+   60,   61,   62,  263,   -1,  302,  303,  304,  305,  306,
+  307,  308,  309,  310,  311,  312,   -1,  314,  315,  316,
+  317,  318,  319,  320,  321,   -1,  323,  287,  288,   -1,
+   -1,   -1,  292,  293,  294,  295,   40,   -1,   42,   43,
+   -1,   45,  302,  303,  304,  305,  306,  307,  308,  309,
+  310,  311,  312,   -1,  314,  315,  316,  317,  318,  319,
+  320,  321,   -1,  323,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   40,   -1,   42,   43,   -1,   45,   -1,
+   -1,   -1,   -1,  380,   -1,   -1,   -1,   -1,   -1,  386,
+  387,   -1,   -1,   -1,  391,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,  406,
+  407,   -1,   -1,   -1,  411,   -1,   -1,   -1,   -1,   -1,
+  380,  418,   -1,   -1,  263,   -1,  386,  387,   -1,   -1,
+   -1,  391,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  401,  402,   -1,  404,  405,  406,  407,  287,  288,
+   -1,  411,   -1,  292,  293,  294,  295,   -1,  418,   -1,
+   -1,   -1,   -1,  302,  303,  304,  305,  306,  307,  308,
+  309,  310,  311,  312,   -1,  314,  315,  316,  317,  318,
+  319,  320,  321,   -1,  323,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   40,   -1,   -1,   43,   -1,   45,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,   -1,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   40,   -1,   -1,   43,   -1,   45,   -1,   -1,   -1,
+   -1,  380,   -1,   -1,   -1,   -1,   -1,  386,  387,   -1,
+   -1,   -1,  391,   -1,   -1,   -1,   -1,   -1,   -1,  263,
+   -1,   -1,  401,  402,   -1,  404,  405,  406,  407,   -1,
+   -1,   -1,  411,   -1,   -1,   -1,   -1,   -1,   -1,  418,
+   -1,   -1,   -1,  287,  288,   -1,   -1,   -1,  292,  293,
+  294,  295,   -1,   -1,   -1,   -1,  263,   -1,  302,  303,
+  304,  305,  306,  307,  308,  309,  310,  311,  312,   -1,
+  314,  315,  316,  317,  318,  319,  320,  321,   -1,  323,
+  287,  288,   -1,   -1,   -1,  292,  293,  294,  295,   -1,
+   -1,   -1,   -1,   -1,   -1,  302,  303,  304,  305,  306,
+  307,  308,  309,  310,  311,  312,   -1,  314,  315,  316,
+  317,  318,  319,  320,  321,   -1,  323,   -1,   40,   -1,
+   -1,   43,   -1,   45,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  380,   -1,   -1,   -1,
+   -1,   -1,  386,  387,   -1,   -1,   -1,  391,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  401,  402,   -1,
+  404,  405,  406,  407,   -1,   -1,   -1,  411,   -1,   -1,
+   -1,   -1,   -1,  380,  418,   -1,   -1,  263,   -1,  386,
+  387,   -1,   -1,   -1,  391,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,  406,
+  407,  287,  288,   -1,  411,   -1,  292,  293,  294,  295,
+   -1,  418,   -1,   -1,  263,   -1,  302,  303,  304,  305,
+  306,  307,  308,  309,  310,  311,  312,   -1,  314,  315,
+  316,  317,  318,  319,  320,  321,   -1,  323,  287,  288,
+   -1,   -1,   -1,  292,  293,  294,  295,   40,   -1,   -1,
+   43,   -1,   45,  302,  303,  304,  305,  306,  307,  308,
+  309,  310,  311,  312,   -1,  314,  315,  316,  317,  318,
+  319,  320,  321,   -1,  323,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   40,   -1,   -1,   43,   -1,   45,
+   -1,   -1,   -1,   -1,  380,   -1,   -1,   -1,   -1,   -1,
+  386,  387,   -1,   -1,   -1,  391,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,
+  406,  407,   -1,   -1,   -1,  411,   -1,   -1,   -1,   -1,
+   -1,  380,  418,   -1,   -1,   -1,   -1,  386,  387,   -1,
+   -1,  263,  391,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  401,  402,   -1,  404,  405,  406,  407,   -1,
+   -1,   -1,  411,   -1,   -1,  287,  288,   -1,   -1,  418,
+  292,  293,  294,  295,   -1,   -1,   -1,   -1,   -1,   -1,
+  302,  303,  304,  305,  306,  307,  308,  309,  310,  311,
+  312,   -1,  314,  315,  316,  317,  318,  319,  320,  321,
+   -1,  323,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   41,   42,   43,   -1,   45,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   41,   42,   43,
+   -1,   45,   60,   61,   62,   -1,   -1,   -1,  380,   -1,
+   -1,   -1,   -1,   -1,  386,  387,   60,   61,   62,  391,
+  263,   41,   42,   43,   -1,   45,   -1,   -1,   -1,  401,
+  402,   -1,  404,  405,  406,  407,   -1,   -1,   -1,  411,
+   60,   61,   62,   -1,  287,  288,  418,   -1,   -1,  292,
+  293,  294,  295,   -1,   -1,   -1,   -1,  263,   -1,  302,
+  303,  304,  305,  306,  307,  308,  309,  310,  311,  312,
+   -1,  314,  315,  316,  317,  318,  319,  320,  321,   -1,
+  323,  287,  288,   -1,   -1,   -1,  292,  293,  294,  295,
+   -1,   -1,   -1,   -1,   -1,   -1,  302,  303,  304,  305,
+  306,  307,  308,  309,  310,  311,  312,   -1,  314,  315,
+  316,  317,  318,  319,  320,  321,   -1,  323,   -1,   41,
+   42,   43,   -1,   45,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  380,   60,   61,
+   62,   -1,   -1,  386,  387,   -1,   -1,   -1,  391,   -1,
+   41,   42,   43,   -1,   45,   -1,   -1,   -1,  401,  402,
+   -1,  404,  405,  406,  407,   -1,   -1,   -1,  411,   60,
+   61,   62,   -1,   -1,  380,  418,   -1,   -1,   -1,   -1,
+  386,  387,   -1,   -1,   -1,  391,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,  401,  402,   -1,  404,  405,
+  406,  407,  260,  261,  262,  411,  264,  265,  266,  267,
+  268,  269,  418,   -1,  272,  273,  260,  261,  262,   -1,
+  264,  265,  266,  267,  268,  269,   -1,   -1,  272,  273,
+   -1,   -1,   -1,   -1,   -1,   41,   42,   43,   -1,   45,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,   -1,  272,  273,   60,   61,   62,   41,   42,   43,
+   -1,   45,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   41,   42,   43,   -1,   45,   60,   61,   62,   -1,
+   -1,   -1,   -1,   -1,   -1,   41,   42,   43,   -1,   45,
+   60,   61,   62,   -1,   -1,   -1,   -1,   -1,   -1,   41,
+   42,   43,   -1,   45,   60,   61,   62,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   42,   43,   44,   45,   60,   61,
+   62,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   60,   61,   62,   -1,   -1,   -1,  260,  261,
+  262,   -1,  264,  265,  266,  267,  268,  269,   -1,   -1,
+  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  260,
+  261,  262,   -1,  264,  265,  266,  267,  268,  269,   -1,
+   -1,  272,  273,   42,   43,   -1,   45,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,
+   -1,   60,   61,   62,   42,   43,   44,   45,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   42,   43,
+   44,   45,   60,   61,   62,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   42,   43,   44,   45,   60,   61,   62,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   60,   61,   62,   -1,  260,  261,  262,   -1,  264,  265,
+  266,  267,  268,  269,   -1,   -1,  272,  273,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,  260,  261,  262,   -1,
+  264,  265,  266,  267,  268,  269,   -1,   -1,  272,  273,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,   -1,  272,  273,  260,  261,  262,   -1,  264,  265,
+  266,  267,  268,  269,   -1,   -1,  272,  273,  260,  261,
+  262,   -1,  264,  265,  266,  267,  268,  269,   -1,   -1,
+  272,  273,  260,  261,  262,   -1,  264,  265,  266,  267,
+  268,  269,   -1,   -1,  272,  273,   42,   43,   44,   45,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   60,   61,   62,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,  260,  261,  262,   -1,  264,  265,  266,  267,  268,
+  269,   -1,   -1,  272,  273,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,  260,  261,  262,   -1,  264,  265,  266,  267,
+  268,  269,   -1,   -1,  272,  273,  260,  261,  262,   -1,
+  264,  265,  266,  267,  268,  269,   -1,   -1,  272,  273,
+  260,  261,  262,   -1,  264,  265,  266,  267,  268,  269,
+   -1,   -1,  272,  273,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  276,   -1,   -1,
+   -1,  280,  281,  282,  283,   -1,   -1,  286,   -1,   -1,
+  289,  290,  291,   -1,   -1,   -1,   -1,  296,  297,   -1,
+   -1,   -1,   -1,   -1,  260,  261,  262,   -1,  264,  265,
+  266,  267,  268,  269,  313,   -1,  272,  273,   -1,   -1,
+   -1,   -1,   -1,  322,   -1,  324,  325,   -1,   -1,  328,
+   -1,  330,  331,  332,  333,  334,   -1,  336,  337,  338,
+  339,  340,  341,  342,  343,  344,  345,  346,  347,  348,
+  349,  350,  351,   -1,   -1,   -1,   -1,  356,  357,  358,
+   -1,   -1,  361,  362,   -1,  364,  365,  366,   -1,  368,
+   -1,  370,   -1,  372,   -1,  374,   -1,   -1,  377,  378,
+  379,   -1,   -1,  382,  383,  384,   -1,   -1,   -1,   -1,
+  389,  390,  391,  392,  393,  394,   -1,  396,  397,  398,
+  399,  400,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+  409,  410,  411,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 1
+#endif
+#define YYMAXTOKEN 421
+#if YYDEBUG
+char *fortranname[] = {
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"'!'",0,0,0,"'%'",0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,
+0,0,0,0,0,"':'","';'","'<'","'='","'>'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,"'['",0,"']'",0,"'_'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"TOK_BINARY_OP","EQV","NEQV","TOK_OR",
+"TOK_XOR","TOK_AND","TOK_NOT","TOK_LT","TOK_GT","TOK_LE","TOK_GE","TOK_EQ",
+"TOK_NE","TOK_UNARY_OP","TOK_DSLASH","TOK_SLASH","TOK_DASTER","TOK_SEP",
+"TOK_NEXTLINE","TOK_PARAMETER","TOK_KIND","TOK_RESULT","TOK_ONLY","TOK_INCLUDE",
+"TOK_SUBROUTINE","TOK_PROGRAM","TOK_FUNCTION","TOK_OMP","TOK_DOLLAR",
+"TOK_FORMAT","TOK_MAX","TOK_TANH","TOK_WHERE","TOK_ELSEWHERE","TOK_ENDWHERE",
+"TOK_MAXVAL","TOK_TRIM","TOK_SUM","TOK_SQRT","TOK_CASE","TOK_SELECTCASE",
+"TOK_FILE","TOK_DONOTTREAT","TOK_ENDDONOTTREAT","TOK_EXIST","TOK_MIN","TOK_INT",
+"TOK_FLOAT","TOK_EXP","TOK_COS","TOK_COSH","TOK_ACOS","TOK_NINT","TOK_SIN",
+"TOK_SINH","TOK_ASIN","TOK_EQUIVALENCE","TOK_LOG","TOK_TAN","TOK_ATAN",
+"TOK_ABS","TOK_MOD","TOK_SIGN","TOK_MINLOC","TOK_MAXLOC","TOK_EXIT",
+"TOK_MINVAL","TOK_PUBLIC","TOK_PRIVATE","TOK_ALLOCATABLE","TOK_IN","TOK_RETURN",
+"TOK_THEN","TOK_ELSEIF","TOK_ELSE","TOK_ENDIF","TOK_PRINT","TOK_PLAINGOTO",
+"TOK_CONSTRUCTID","TOK_LOGICALIF","TOK_PLAINDO","TOK_CONTAINS","TOK_ENDDO",
+"TOK_MODULE","TOK_ENDMODULE","TOK_DOWHILE","TOK_ALLOCATE","TOK_OPEN",
+"TOK_CLOSE","TOK_INQUIRE","TOK_WRITE","TOK_READ","TOK_REWIND","TOK_DEALLOCATE",
+"TOK_NULLIFY","TOK_FIN","TOK_DEBUT","TOK_OUT","TOK_INOUT","TOK_DIMENSION",
+"TOK_ENDSELECT","TOK_EXTERNAL","TOK_INTENT","TOK_INTRINSIC","TOK_NAMELIST",
+"TOK_CASEDEFAULT","TOK_OPTIONAL","TOK_POINTER","TOK_CONTINUE","TOK_SAVE",
+"TOK_TARGET","TOK_USE","TOK_POINT","TOK_DATA","TOK_QUOTE","TOK_IMPLICIT",
+"TOK_NONE","TOK_CALL","TOK_STAT","TOK_POINT_TO","TOK_COMMON","TOK_INTERFACE",
+"TOK_ENDINTERFACE","TOK_LEFTAB","TOK_RIGHTAB","TOK_PAUSE","TOK_PROCEDURE",
+"TOK_STOP","TOK_NAMEEQ","TOK_TRUE","TOK_FALSE","TOK_LABEL","TOK_TYPE",
+"TOK_ENDTYPE","TOK_REAL","TOK_INTEGER","TOK_LOGICAL","TOK_DOUBLEPRECISION",
+"TOK_DOUBLEREAL","TOK_ENDSUBROUTINE","TOK_ENDFUNCTION","TOK_ENDPROGRAM",
+"TOK_ENDUNIT","TOK_CHARACTER","TOK_CHAR_CONSTANT","TOK_CHAR_CUT","TOK_CHAR_INT",
+"TOK_CHAR_MESSAGE","TOK_CSTREAL","TOK_CSTREALDP","TOK_CSTREALQP","TOK_SFREAL",
+"TOK_COMPLEX","TOK_DOUBLECOMPLEX","TOK_NAME","TOK_NAME_CHAR","TOK_PROBTYPE",
+"TOK_INTERPTYPE","TOK_VARTYPE","TOK_BC","TOK_OP","TOK_CSTINT","TOK_COMMENT",
+"TOK_FILENAME","\"* \"",
+};
+char *fortranrule[] = {
+"$accept : input",
+"input :",
+"input : input line",
+"line : '\\n' position",
+"line : thislabel suite_line",
+"line : TOK_COMMENT",
+"line : keyword cmnt writedeclar",
+"line : error writedeclar nulcurbuf",
+"suite_line : entry fin_line",
+"suite_line : spec fin_line",
+"suite_line : before_include filename fin_line",
+"suite_line : exec cmnt writedeclar",
+"suite_line : instr fin_line",
+"instr : ident ':'",
+"fin_line : position cmnt",
+"keyword : TOK_DONOTTREAT",
+"keyword : TOK_ENDDONOTTREAT",
+"keyword : TOK_OMP",
+"keyword : TOK_DOLLAR",
+"position :",
+"thislabel :",
+"thislabel : TOK_LABEL nulcurbuf",
+"cmnt :",
+"cmnt : TOK_COMMENT",
+"incomment :",
+"nulcurbuf :",
+"entry :",
+"entry : TOK_SUBROUTINE name_routine arglist",
+"entry : TOK_PROGRAM name_routine",
+"entry : TOK_FUNCTION name_routine arglist TOK_RESULT arglist1",
+"entry : TOK_FUNCTION name_routine arglist",
+"entry : TOK_MODULE TOK_NAME",
+"name_routine : TOK_NAME",
+"writedeclar :",
+"before_include : TOK_INCLUDE",
+"filename : TOK_CHAR_CONSTANT",
+"arglist :",
+"arglist : '(' ')'",
+"arglist : '(' args ')'",
+"arglist1 :",
+"arglist1 : '(' ')'",
+"arglist1 : '(' args ')'",
+"args : arg",
+"args : args ',' arg",
+"arg : TOK_NAME",
+"arg : '*'",
+"spec : type after_type",
+"spec : TOK_TYPE opt_name",
+"spec : TOK_ENDTYPE opt_name",
+"spec : TOK_POINTER list_couple",
+"spec : before_parameter '(' paramlist ')'",
+"spec : common",
+"spec : save",
+"spec : implicit",
+"spec : dimension",
+"spec : public",
+"spec : private",
+"spec : use_stat",
+"spec : module_proc_stmt",
+"spec : interface",
+"spec : namelist",
+"spec : TOK_EXTERNAL opt_sep use_name_list",
+"spec : TOK_EQUIVALENCE '(' list_expr ')'",
+"spec : before_data data '\\n'",
+"list_couple : '(' list_expr ')'",
+"list_couple : list_couple ',' '(' list_expr ')'",
+"list_expr : expr",
+"list_expr : list_expr ',' expr",
+"opt_sep :",
+"opt_sep : ':' ':'",
+"after_type : dcl nodimsgiven",
+"after_type : TOK_FUNCTION TOK_NAME arglist",
+"before_parameter : TOK_PARAMETER",
+"before_data : TOK_DATA",
+"data : TOK_NAME TOK_SLASH datavallist TOK_SLASH",
+"data : data opt_comma TOK_NAME TOK_SLASH datavallist TOK_SLASH",
+"datavallist : expr_data",
+"datavallist : expr_data ',' datavallist",
+"expr_data : opt_signe simple_const",
+"expr_data : expr_data '+' expr_data",
+"expr_data : expr_data '-' expr_data",
+"expr_data : expr_data '*' expr_data",
+"expr_data : expr_data '/' expr_data",
+"opt_signe :",
+"opt_signe : signe",
+"namelist : namelist_action after_namelist",
+"namelist_action : TOK_NAMELIST ident",
+"namelist_action : TOK_NAMELIST comblock ident",
+"namelist_action : namelist_action opt_comma comblock opt_comma ident",
+"namelist_action : namelist_action ',' ident",
+"after_namelist :",
+"interface : TOK_INTERFACE opt_name",
+"interface : TOK_ENDINTERFACE opt_name",
+"dimension : TOK_DIMENSION opt_comma TOK_NAME dims lengspec",
+"dimension : dimension ',' TOK_NAME dims lengspec",
+"private : TOK_PRIVATE '\\n'",
+"private : TOK_PRIVATE use_name_list",
+"public : TOK_PUBLIC '\\n'",
+"public : TOK_PUBLIC use_name_list",
+"use_name_list : TOK_NAME",
+"use_name_list : use_name_list ',' TOK_NAME",
+"common : before_common var_common_list",
+"common : before_common comblock var_common_list",
+"common : common opt_comma comblock opt_comma var_common_list",
+"before_common : TOK_COMMON",
+"var_common_list : var_common",
+"var_common_list : var_common_list ',' var_common",
+"var_common : TOK_NAME dims",
+"comblock : TOK_DSLASH",
+"comblock : TOK_SLASH TOK_NAME TOK_SLASH",
+"save : TOK_SAVE varsave",
+"save : TOK_SAVE comblock varsave",
+"save : save opt_comma comblock opt_comma varsave",
+"save : save ',' varsave",
+"varsave :",
+"varsave : TOK_NAME dims",
+"opt_comma :",
+"opt_comma : ','",
+"paramlist : paramitem",
+"paramlist : paramlist ',' paramitem",
+"paramitem : TOK_NAME '=' expr",
+"module_proc_stmt : TOK_PROCEDURE proc_name_list",
+"proc_name_list : TOK_NAME",
+"proc_name_list : proc_name_list ',' TOK_NAME",
+"implicit : TOK_IMPLICIT TOK_NONE",
+"opt_retour :",
+"dcl : options opt_retour TOK_NAME dims lengspec initial_value",
+"dcl : dcl ',' opt_retour TOK_NAME dims lengspec initial_value",
+"nodimsgiven :",
+"type : typespec selector",
+"type : before_character c_selector",
+"type : typename '*' TOK_CSTINT",
+"c_selector :",
+"c_selector : '*' TOK_CSTINT",
+"c_selector : '*' '(' c_attribute ')'",
+"c_selector : '(' c_attribute ')'",
+"c_attribute : TOK_NAME clause opt_clause",
+"c_attribute : TOK_NAME '=' clause opt_clause",
+"c_attribute : clause opt_clause",
+"before_character : TOK_CHARACTER",
+"typespec : typename",
+"typename : TOK_INTEGER",
+"typename : TOK_REAL",
+"typename : TOK_COMPLEX",
+"typename : TOK_DOUBLEPRECISION",
+"typename : TOK_DOUBLECOMPLEX",
+"typename : TOK_LOGICAL",
+"typename : TOK_TYPE",
+"lengspec :",
+"lengspec : '*' proper_lengspec",
+"proper_lengspec : expr",
+"proper_lengspec : '(' '*' ')'",
+"selector :",
+"selector : '*' proper_selector",
+"selector : '(' attribute ')'",
+"proper_selector : expr",
+"proper_selector : '(' '*' ')'",
+"attribute : TOK_NAME clause",
+"attribute : TOK_NAME '=' clause",
+"attribute : TOK_NAME",
+"clause : expr",
+"clause : '*'",
+"opt_clause :",
+"opt_clause : ',' TOK_NAME clause",
+"options :",
+"options : ':' ':'",
+"options : ',' attr_spec_list ':' ':'",
+"attr_spec_list : attr_spec",
+"attr_spec_list : attr_spec_list ',' attr_spec",
+"attr_spec : TOK_PARAMETER",
+"attr_spec : access_spec",
+"attr_spec : TOK_ALLOCATABLE",
+"attr_spec : TOK_DIMENSION dims",
+"attr_spec : TOK_EXTERNAL",
+"attr_spec : TOK_INTENT '(' intent_spec ')'",
+"attr_spec : TOK_INTRINSIC",
+"attr_spec : TOK_OPTIONAL",
+"attr_spec : TOK_POINTER",
+"attr_spec : TOK_SAVE",
+"attr_spec : TOK_TARGET",
+"intent_spec : TOK_IN",
+"intent_spec : TOK_OUT",
+"intent_spec : TOK_INOUT",
+"access_spec : TOK_PUBLIC",
+"access_spec : TOK_PRIVATE",
+"dims :",
+"dims : '(' dimlist ')'",
+"dimlist : dim",
+"dimlist : dimlist ',' dim",
+"dim : ubound",
+"dim : ':'",
+"dim : expr ':'",
+"dim : ':' expr",
+"dim : expr ':' ubound",
+"ubound : '*'",
+"ubound : expr",
+"expr : uexpr",
+"expr : '(' expr ')'",
+"expr : complex_const",
+"expr : predefinedfunction",
+"predefinedfunction : TOK_SUM minmaxlist ')'",
+"predefinedfunction : TOK_MAX '(' minmaxlist ')'",
+"predefinedfunction : TOK_TANH '(' minmaxlist ')'",
+"predefinedfunction : TOK_MAXVAL '(' minmaxlist ')'",
+"predefinedfunction : TOK_MIN minmaxlist ')'",
+"predefinedfunction : TOK_MINVAL '(' minmaxlist ')'",
+"predefinedfunction : TOK_TRIM '(' expr ')'",
+"predefinedfunction : TOK_SQRT '(' expr ')'",
+"predefinedfunction : TOK_REAL '(' expr ')'",
+"predefinedfunction : TOK_INT '(' expr ')'",
+"predefinedfunction : TOK_NINT '(' expr ')'",
+"predefinedfunction : TOK_FLOAT '(' expr ')'",
+"predefinedfunction : TOK_EXP '(' expr ')'",
+"predefinedfunction : TOK_COS '(' expr ')'",
+"predefinedfunction : TOK_COSH '(' expr ')'",
+"predefinedfunction : TOK_ACOS '(' expr ')'",
+"predefinedfunction : TOK_SIN '(' expr ')'",
+"predefinedfunction : TOK_SINH '(' expr ')'",
+"predefinedfunction : TOK_ASIN '(' expr ')'",
+"predefinedfunction : TOK_LOG '(' expr ')'",
+"predefinedfunction : TOK_TAN '(' expr ')'",
+"predefinedfunction : TOK_ATAN '(' expr ')'",
+"predefinedfunction : TOK_ABS '(' expr ')'",
+"predefinedfunction : TOK_MOD '(' minmaxlist ')'",
+"predefinedfunction : TOK_SIGN '(' minmaxlist ')'",
+"predefinedfunction : TOK_MINLOC '(' minmaxlist ')'",
+"predefinedfunction : TOK_MAXLOC '(' minmaxlist ')'",
+"minmaxlist : expr",
+"minmaxlist : minmaxlist ',' expr",
+"uexpr : lhs",
+"uexpr : simple_const",
+"uexpr : vec",
+"uexpr : expr operation",
+"uexpr : signe expr",
+"uexpr : TOK_NOT expr",
+"signe : '+'",
+"signe : '-'",
+"operation : '+' expr",
+"operation : '-' expr",
+"operation : '*' expr",
+"operation : TOK_DASTER expr",
+"operation : TOK_EQ expr",
+"operation : TOK_GT expr",
+"operation : '>' expr",
+"operation : TOK_LT expr",
+"operation : '<' expr",
+"operation : TOK_GE expr",
+"operation : '>' '=' expr",
+"operation : TOK_LE expr",
+"operation : '<' '=' expr",
+"operation : TOK_NE expr",
+"operation : TOK_XOR expr",
+"operation : TOK_OR expr",
+"operation : TOK_AND expr",
+"operation : TOK_SLASH after_slash",
+"operation : '=' after_equal",
+"after_slash : expr",
+"after_slash : '=' expr",
+"after_slash : TOK_SLASH expr",
+"after_equal : '=' expr",
+"after_equal : expr",
+"lhs : ident",
+"lhs : structure_component",
+"lhs : array_ele_substring_func_ref",
+"beforefunctionuse :",
+"array_ele_substring_func_ref : begin_array",
+"array_ele_substring_func_ref : begin_array substring",
+"array_ele_substring_func_ref : structure_component '(' funarglist ')'",
+"array_ele_substring_func_ref : structure_component '(' funarglist ')' substring",
+"begin_array : ident '(' funarglist ')'",
+"structure_component : lhs '%' lhs",
+"vec : TOK_LEFTAB outlist TOK_RIGHTAB",
+"funarglist : beforefunctionuse",
+"funarglist : beforefunctionuse funargs",
+"funargs : funarg",
+"funargs : funargs ',' funarg",
+"funarg : expr",
+"funarg : triplet",
+"triplet : expr ':' expr",
+"triplet : expr ':' expr ':' expr",
+"triplet : ':' expr ':' expr",
+"triplet : ':' ':' expr",
+"triplet : ':' expr",
+"triplet : expr ':'",
+"triplet : ':'",
+"ident : TOK_NAME",
+"simple_const : TOK_TRUE",
+"simple_const : TOK_FALSE",
+"simple_const : TOK_CSTINT",
+"simple_const : TOK_CSTREAL",
+"simple_const : TOK_CSTREALDP",
+"simple_const : TOK_CSTREALQP",
+"simple_const : simple_const TOK_NAME",
+"simple_const : string_constant opt_substring",
+"string_constant : TOK_CHAR_CONSTANT",
+"string_constant : string_constant TOK_CHAR_CONSTANT",
+"string_constant : TOK_CHAR_MESSAGE",
+"string_constant : TOK_CHAR_CUT",
+"opt_substring :",
+"opt_substring : substring",
+"substring : '(' optexpr ':' optexpr ')'",
+"optexpr :",
+"optexpr : expr",
+"opt_expr : '\\n'",
+"opt_expr : expr",
+"initial_value :",
+"initial_value : before_initial '=' expr",
+"before_initial :",
+"complex_const : '(' uexpr ',' uexpr ')'",
+"use_stat : word_use module_name",
+"use_stat : word_use module_name ',' rename_list",
+"use_stat : word_use module_name ',' TOK_ONLY ':' '\\n'",
+"use_stat : word_use module_name ',' TOK_ONLY ':' only_list",
+"word_use : TOK_USE",
+"module_name : TOK_NAME",
+"rename_list : rename_name",
+"rename_list : rename_list ',' rename_name",
+"rename_name : TOK_NAME TOK_POINT_TO TOK_NAME",
+"only_list : only_name",
+"only_list : only_list ',' only_name",
+"only_name : TOK_NAME TOK_POINT_TO TOK_NAME",
+"only_name : TOK_NAME",
+"exec : iffable",
+"exec : TOK_ALLOCATE '(' allocation_list opt_stat_spec ')'",
+"exec : TOK_DEALLOCATE '(' allocate_object_list opt_stat_spec ')'",
+"exec : TOK_NULLIFY '(' pointer_name_list ')'",
+"exec : TOK_ENDUNIT",
+"exec : TOK_ENDPROGRAM opt_name",
+"exec : TOK_ENDSUBROUTINE opt_name",
+"exec : TOK_ENDFUNCTION opt_name",
+"exec : TOK_ENDMODULE opt_name",
+"exec : boucledo",
+"exec : logif iffable",
+"exec : TOK_WHERE '(' expr ')' opt_expr",
+"exec : TOK_ELSEWHERE",
+"exec : TOK_ENDWHERE",
+"exec : logif TOK_THEN",
+"exec : TOK_ELSEIF '(' expr ')' TOK_THEN",
+"exec : TOK_ELSE",
+"exec : TOK_ENDIF",
+"exec : TOK_CASE '(' caselist ')'",
+"exec : TOK_SELECTCASE '(' expr ')'",
+"exec : TOK_CASEDEFAULT",
+"exec : TOK_ENDSELECT",
+"exec : TOK_CONTAINS",
+"caselist : expr",
+"caselist : caselist ',' expr",
+"caselist : caselist ':' expr",
+"boucledo : worddo do_var '=' expr ',' expr",
+"boucledo : worddo do_var '=' expr ',' expr ',' expr",
+"boucledo : wordwhile expr",
+"boucledo : TOK_ENDDO optname",
+"opt_name : '\\n'",
+"opt_name : TOK_NAME",
+"optname :",
+"optname : TOK_NAME",
+"worddo : TOK_PLAINDO",
+"wordwhile : TOK_DOWHILE",
+"dotarget :",
+"dotarget : TOK_CSTINT",
+"iffable : TOK_CONTINUE",
+"iffable : ident dims dims after_ident_dims",
+"iffable : structure_component after_ident_dims",
+"iffable : goto",
+"iffable : io",
+"iffable : call",
+"iffable : TOK_EXIT opt_name",
+"iffable : TOK_RETURN optexpr",
+"iffable : stop opt_expr",
+"after_ident_dims : '=' expr",
+"after_ident_dims : TOK_POINT_TO expr",
+"call : keywordcall opt_call",
+"opt_call :",
+"opt_call : '(' opt_callarglist ')'",
+"opt_callarglist :",
+"opt_callarglist : callarglist",
+"keywordcall : before_call TOK_NAME",
+"before_call : TOK_CALL",
+"callarglist : callarg",
+"callarglist : callarglist ',' callarg",
+"callarg : expr",
+"callarg : '*' label",
+"stop : TOK_PAUSE",
+"stop : TOK_STOP",
+"io : iofctl ioctl",
+"io : read option_read",
+"io : write '(' idfile opt_ioctl_format ')' opt_outlist",
+"io : TOK_REWIND after_rewind",
+"io : print option_print",
+"io : wordformat debut_format ioctl_format fin_format",
+"wordformat : TOK_FORMAT",
+"opt_ioctl_format :",
+"opt_ioctl_format : ',' ioctl_format",
+"opt_ioctl_format : ',' '*'",
+"debut_format : TOK_LEFTAB opt_comma",
+"debut_format : '('",
+"ioctl_format : format_expr",
+"ioctl_format : ioctl_format ',' format_expr",
+"format_expr : uexpr",
+"format_expr : TOK_CSTINT TOK_CHAR_INT",
+"format_expr : TOK_CSTINT debut_format ioctl_format fin_format",
+"format_expr : TOK_SLASH opt_CHAR_INT",
+"format_expr : TOK_CHAR_INT",
+"opt_CHAR_INT :",
+"opt_CHAR_INT : TOK_CSTINT TOK_NAME",
+"fin_format : opt_comma TOK_RIGHTAB opt_comma",
+"fin_format : ')'",
+"idfile : '*'",
+"idfile : TOK_CSTINT",
+"idfile : ident",
+"option_print :",
+"option_print : ',' outlist",
+"option_inlist :",
+"option_inlist : inlist",
+"option_read : ioctl option_inlist",
+"option_read : infmt opt_inlist",
+"opt_outlist :",
+"opt_outlist : outlist",
+"opt_inlist :",
+"opt_inlist : ',' inlist",
+"ioctl : '(' ctllist ')'",
+"ioctl : '(' fexpr ')'",
+"after_rewind : '(' ident ')'",
+"after_rewind : TOK_NAME",
+"ctllist : ioclause",
+"ctllist : ctllist ',' ioclause",
+"ioclause : fexpr",
+"ioclause : '*'",
+"ioclause : TOK_DASTER",
+"ioclause : TOK_NAME expr",
+"ioclause : TOK_NAME '(' triplet ')'",
+"ioclause : TOK_NAME '*'",
+"ioclause : TOK_NAME TOK_DASTER",
+"iofctl : ctlkwd",
+"ctlkwd : TOK_INQUIRE",
+"ctlkwd : TOK_OPEN",
+"ctlkwd : TOK_CLOSE",
+"infmt : unpar_fexpr",
+"infmt : '*'",
+"read : TOK_READ",
+"write : TOK_WRITE",
+"print : TOK_PRINT fexpr",
+"print : TOK_PRINT '*'",
+"fexpr : unpar_fexpr",
+"fexpr : '(' fexpr ')'",
+"unpar_fexpr : lhs",
+"unpar_fexpr : simple_const",
+"unpar_fexpr : fexpr addop fexpr",
+"unpar_fexpr : fexpr '*' fexpr",
+"unpar_fexpr : fexpr TOK_SLASH fexpr",
+"unpar_fexpr : fexpr TOK_DASTER fexpr",
+"unpar_fexpr : addop fexpr",
+"unpar_fexpr : fexpr TOK_DSLASH fexpr",
+"unpar_fexpr : TOK_FILE expr",
+"unpar_fexpr : TOK_EXIST expr",
+"unpar_fexpr : TOK_NAME '=' expr",
+"addop : '+'",
+"addop : '-'",
+"inlist : inelt",
+"inlist : inlist ',' inelt",
+"inelt : lhs",
+"inelt : '(' inlist ',' dospec ')'",
+"outlist : other",
+"outlist : out2",
+"out2 : uexpr ',' expr",
+"out2 : uexpr ',' other",
+"out2 : other ',' expr",
+"out2 : other ',' other",
+"out2 : out2 ',' expr",
+"out2 : out2 ',' other",
+"out2 : uexpr",
+"out2 : predefinedfunction",
+"other : complex_const",
+"other : '(' expr ')'",
+"other : '(' uexpr ',' dospec ')'",
+"other : '(' other ',' dospec ')'",
+"other : '(' out2 ',' dospec ')'",
+"dospec : TOK_NAME '=' expr ',' expr",
+"dospec : TOK_NAME '=' expr ',' expr ',' expr",
+"labellist : label",
+"labellist : labellist ',' label",
+"label : TOK_CSTINT",
+"goto : TOK_PLAINGOTO label",
+"allocation_list : allocate_object",
+"allocation_list : allocation_list ',' allocate_object",
+"allocate_object : ident",
+"allocate_object : structure_component",
+"allocate_object : array_element",
+"array_element : ident '(' funargs ')'",
+"subscript_list : expr",
+"subscript_list : subscript_list ',' expr",
+"allocate_object_list : allocate_object",
+"allocate_object_list : allocate_object_list ',' allocate_object",
+"opt_stat_spec :",
+"opt_stat_spec : ',' TOK_STAT '=' ident",
+"pointer_name_list : ident",
+"pointer_name_list : pointer_name_list ',' ident",
+"opt_construct_name :",
+"opt_construct_name : TOK_NAME",
+"opt_construct_name_colon :",
+"opt_construct_name_colon : TOK_CONSTRUCTID ':'",
+"logif : TOK_LOGICALIF '(' expr ')'",
+"do_var : ident",
+};
+#endif
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+int yydebug;
+int yynerrs;
+int yyerrflag;
+int yychar;
+short *yyssp;
+YYSTYPE *yyvsp;
+YYSTYPE yyval;
+YYSTYPE yylval;
+short yyss[YYSTACKSIZE];
+YYSTYPE yyvs[YYSTACKSIZE];
+#define yystacksize YYSTACKSIZE
+#line 2143 "fortran.y"
+
+void processfortran(char *fichier_entree)
+{
+   extern FILE *fortranin;
+   extern FILE *fortranout;
+   char nomfile[LONGNOM];
+   int c;
+   int confirmyes;
+
+   /*fortrandebug = 1;*/
+/******************************************************************************/
+/*  1-  Open input and output files                                           */
+/******************************************************************************/
+   strcpy(OriginalFileName,fichier_entree); 
+   strcpy(nomfile,commondirin);
+   strcat(nomfile,"/");
+   strcat(nomfile,fichier_entree);
+   fortranin=fopen( nomfile,"r");
+   if (! fortranin) 
+   {
+      printf("Error : File %s does not exist\n",nomfile);
+      exit(1);
+   }
+   
+   strcpy(curfile,nomfile);
+   strcpy(nomfile,commondirout);
+   strcat(nomfile,"/");  
+   strcat(nomfile,fichier_entree);
+   strcpy(nomfileoutput,nomfile);
+   if (firstpass == 1) 
+   {
+      if (checkexistcommon == 1) 
+      {
+         if (fopen(nomfile,"r")) 
+         {
+            printf("Warning : file %s already exist\n",nomfile);
+            confirmyes = 0;
+            while (confirmyes==0) 
+            {
+               printf("Override file %s ? [Y/N]\n",nomfile);
+               c=getchar();
+               getchar();    
+               if (c==79 || c==110) 
+               {
+                  printf("We stop\n");
+                  exit(1);
+               }
+               if (c==89 || c==121) 
+               {
+                  confirmyes=1;
+               }
+            }
+         }
+      }
+   }  
+   strcpy(commonfile,fichier_entree);
+
+/******************************************************************************/
+/*  2-  Variables initialization                                              */
+/******************************************************************************/
+
+   line_num_fortran_common=1; 
+   line_num_fortran=1;
+   PublicDeclare = 0;  
+   PrivateDeclare = 0; 
+   formatdeclare = 0;
+   ExternalDeclare = 0; 
+   SaveDeclare = 0;
+   indeclarationvar=0;
+   pointerdeclare = 0;
+   optionaldeclare = 0;
+   incalldeclare = 0;
+   infunctiondeclare = 0 ;
+   Allocatabledeclare = 0 ;
+   strcpy(NamePrecision," "); 
+   VariableIsParameter =  0 ; 
+   PrecisionGiven = 0 ; 
+   lengspecgiven =0;
+   c_star = 0 ; 
+   insubroutinedeclare = 0 ;
+   strcpy(subroutinename," "); 
+   CharacterSizeGiven = 0 ; 
+   InitialValueGiven = 0 ; 
+   strcpy(EmptyChar," "); 
+   inmoduledeclare = 0;
+   colnum=0;
+   incom=0;
+   couldaddvariable=1;
+   aftercontainsdeclare = 1;
+   /* Name of the file without format                                         */
+   tmp = strchr(fichier_entree, '.');
+   strncpy(curfilename,fichier_entree,strlen(fichier_entree)-strlen(tmp)); 
+/******************************************************************************/
+/*  2-  Parsing of the input file (1 time)                                    */
+/******************************************************************************/
+   if (firstpass == 0 ) fortranout=fopen(nomfileoutput,"w");
+   /* we should add the new module comes from common block                    */
+   if (firstpass == 0 && fortran77 == 1 ) fprintf
+                      (fortranout,"#include \"NewModule_%s.h\" \n",curfilename);
+
+   fortranparse();
+
+   strcpy(curfile,mainfile);
+
+   if (firstpass ==0) fclose(fortranout);
+}
+#line 5807 "y.tab.c"
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+int
+yyparse()
+{
+    register int yym, yyn, yystate;
+#if YYDEBUG
+    register char *yys;
+    extern char *getenv();
+
+    if (yys = getenv("YYDEBUG"))
+    {
+        yyn = *yys;
+        if (yyn >= '0' && yyn <= '9')
+            yydebug = yyn - '0';
+    }
+#endif
+
+    yynerrs = 0;
+    yyerrflag = 0;
+    yychar = (-1);
+
+    yyssp = yyss;
+    yyvsp = yyvs;
+    *yyssp = yystate = 0;
+
+yyloop:
+    if (yyn = yydefred[yystate]) goto yyreduce;
+    if (yychar < 0)
+    {
+        if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+        if (yydebug)
+        {
+            yys = 0;
+            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+            if (!yys) yys = "illegal-symbol";
+            printf("%sdebug: state %d, reading %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
+        }
+#endif
+    }
+    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+    {
+#if YYDEBUG
+        if (yydebug)
+            printf("%sdebug: state %d, shifting to state %d\n",
+                    YYPREFIX, yystate, yytable[yyn]);
+#endif
+        if (yyssp >= yyss + yystacksize - 1)
+        {
+            goto yyoverflow;
+        }
+        *++yyssp = yystate = yytable[yyn];
+        *++yyvsp = yylval;
+        yychar = (-1);
+        if (yyerrflag > 0)  --yyerrflag;
+        goto yyloop;
+    }
+    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
+            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+    {
+        yyn = yytable[yyn];
+        goto yyreduce;
+    }
+    if (yyerrflag) goto yyinrecovery;
+#ifdef lint
+    goto yynewerror;
+#endif
+yynewerror:
+    yyerror("syntax error");
+#ifdef lint
+    goto yyerrlab;
+#endif
+yyerrlab:
+    ++yynerrs;
+yyinrecovery:
+    if (yyerrflag < 3)
+    {
+        yyerrflag = 3;
+        for (;;)
+        {
+            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
+            {
+#if YYDEBUG
+                if (yydebug)
+                    printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+#endif
+                if (yyssp >= yyss + yystacksize - 1)
+                {
+                    goto yyoverflow;
+                }
+                *++yyssp = yystate = yytable[yyn];
+                *++yyvsp = yylval;
+                goto yyloop;
+            }
+            else
+            {
+#if YYDEBUG
+                if (yydebug)
+                    printf("%sdebug: error recovery discarding state %d\n",
+                            YYPREFIX, *yyssp);
+#endif
+                if (yyssp <= yyss) goto yyabort;
+                --yyssp;
+                --yyvsp;
+            }
+        }
+    }
+    else
+    {
+        if (yychar == 0) goto yyabort;
+#if YYDEBUG
+        if (yydebug)
+        {
+            yys = 0;
+            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+            if (!yys) yys = "illegal-symbol";
+            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
+        }
+#endif
+        yychar = (-1);
+        goto yyloop;
+    }
+yyreduce:
+#if YYDEBUG
+    if (yydebug)
+        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+                YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+    yym = yylen[yyn];
+    yyval = yyvsp[1-yym];
+    switch (yyn)
+    {
+case 7:
+#line 309 "fortran.y"
+{yyerrok;yyclearin;}
+break;
+case 10:
+#line 314 "fortran.y"
+{
+                     if (firstpass == 0 && 
+                         inmoduledeclare == 0 && 
+                         couldaddvariable == 1 )
+                     {
+                        pos_end = setposcur();
+                        RemoveWordSET(fortranout,pos_curinclude,
+                                              pos_end-pos_curinclude);
+                     }
+                  }
+break;
+case 15:
+#line 332 "fortran.y"
+{
+            /* we should ignore the declaration until the keyword   */
+            /*    TOK_ENDDONOTTREAT                                 */
+            couldaddvariable = 0 ;
+            if ( firstpass == 0 ) 
+            {
+               RemoveWordCUR(fortranout,-20,20);
+            }
+         }
+break;
+case 16:
+#line 342 "fortran.y"
+{
+             couldaddvariable = 1 ;
+             if ( firstpass == 0 ) 
+             {
+                 RemoveWordCUR(fortranout,-24,24);
+             }
+          }
+break;
+case 19:
+#line 352 "fortran.y"
+{if ( firstpass == 0 ) pos_cur = setposcur();}
+break;
+case 24:
+#line 361 "fortran.y"
+{incom = 1;}
+break;
+case 25:
+#line 364 "fortran.y"
+{if (incom !=1) {strcpy(curbuf,"");incom=0;}}
+break;
+case 27:
+#line 368 "fortran.y"
+{
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,yyvsp[-1].na);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforsub();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                            tmpdeclaration_everdone = 0;
+                            paramdeclaration_everdone = 0;
+                            insubroutinedeclare = 1;
+                            if ( firstpass == 0 ) 
+                            {
+                               adduseagrifutil = 0 ;
+                               AGRIF_n_AddUseAgrifUtil();
+                            }
+                            OPTI_0_writeheadnewsubforsub();
+                            adduseagrifutil = 0 ; 
+                      }
+                   }
+break;
+case 28:
+#line 401 "fortran.y"
+{
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,yyvsp[0].na);
+                      /* Common case                                          */
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforsub();
+                         adduseagrifutil = 0 ;                       
+                   }
+break;
+case 29:
+#line 419 "fortran.y"
+{
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,yyvsp[-3].na);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar(yyvsp[-3].na,NULL);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar(curlistvar,listargsubroutine,1);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                            tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                            insubroutinedeclare = 1;
+                            if ( firstpass == 0 ) 
+                            {
+                               adduseagrifutil = 0 ;
+                               AGRIF_n_AddUseAgrifUtil();
+                            }
+                            /* we should to list of the subroutine argument   */
+                            /* name of the function which has to be defined   */
+                            if ( firstpass == 1 ) 
+                            {
+                               curvar=createvar(yyvsp[-3].na,NULL);
+                               curlistvar=insertvar(NULL,curvar);
+                               listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            }
+                            OPTI_0_writeheadnewsubforfunc();
+                            adduseagrifutil = 0 ; 
+                      }
+                   }
+break;
+case 30:
+#line 469 "fortran.y"
+{
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,yyvsp[-1].na);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar(yyvsp[-1].na,NULL);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                            tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                            insubroutinedeclare = 1;
+                            if ( firstpass == 0 ) 
+                            {
+                               adduseagrifutil = 0 ;
+                               AGRIF_n_AddUseAgrifUtil();
+                            }
+                            /* we should to list of the subroutine argument   */
+                            /* name of the function which has to be defined   */
+                            if ( firstpass == 1 ) 
+                            {
+                               curvar=createvar(yyvsp[-1].na,NULL);
+                               curlistvar=insertvar(NULL,curvar);
+                               listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            }
+                            OPTI_0_writeheadnewsubforfunc();
+                            adduseagrifutil = 0 ; 
+                      }
+                   }
+break;
+case 31:
+#line 520 "fortran.y"
+{
+                      strcpy(curmodulename,yyvsp[0].na);
+                      if ( firstpass == 1 ) Add_ModuleTo_Modulelist(yyvsp[0].na);
+                      if ( inmoduledeclare == 0 )
+                      { 
+                         /* instance and back instance should be create ?     */
+                         MOD_1_FillInlistmodule();   
+                         /* To know if there are in the module declaration    */
+                         inmoduledeclare = 1;
+                         /* to know if a module has been met                  */
+                         inmodulemeet = 1;
+                         /* to know if we are after the keyword contains      */
+                         aftercontainsdeclare = 0 ;
+                      }      
+                      /* WE should use Agrif_Util if it is necessary          */
+                      AGRIF_0_AddUseAgrifInModuleDeclaration();
+                   }
+break;
+case 32:
+#line 538 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);strcpy(subroutinename,yyvsp[0].na);}
+break;
+case 34:
+#line 542 "fortran.y"
+{
+                      if (firstpass == 0 )
+                      {
+                         pos_curinclude = setposcur()-9;
+                      }
+                   }
+break;
+case 35:
+#line 549 "fortran.y"
+{
+                      if ( firstpass == 1 && couldaddvariable == 1 )
+                      {
+                         Addincludetothelist(yyvsp[0].na);
+                      }                   
+                   }
+break;
+case 37:
+#line 557 "fortran.y"
+{
+                      if ( firstpass == 1 ) listargsubroutine=NULL;
+                   }
+break;
+case 38:
+#line 561 "fortran.y"
+{
+                       if ( firstpass == 1 ) listargsubroutine=yyvsp[-1].l;
+                   }
+break;
+case 41:
+#line 568 "fortran.y"
+{
+                       listargsubroutine = AddListvarToListvar
+                                                       (yyvsp[-1].l,listargsubroutine,1);
+                   }
+break;
+case 42:
+#line 573 "fortran.y"
+{
+                      if ( firstpass == 1 )
+                      {
+                         curvar=createvar(yyvsp[0].na,curdim);
+                         curlistvar=insertvar(NULL,curvar);
+                         yyval.l=settype(yyvsp[0].na,curlistvar);
+                      }
+                   }
+break;
+case 43:
+#line 582 "fortran.y"
+{
+                      if ( firstpass == 1 )
+                      {
+                         curvar=createvar(yyvsp[0].na,curdim);
+                         yyval.l=insertvar(yyvsp[-2].l,curvar);
+                      }
+                   }
+break;
+case 44:
+#line 590 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 45:
+#line 591 "fortran.y"
+{strcpy(yyval.na,"*");}
+break;
+case 46:
+#line 594 "fortran.y"
+{
+                      /* remove declaration                                   */
+                      if ( fortran77 == 1                       && 
+                           firstpass == 0                       && 
+                           infunctiondeclare == 0               && 
+                           commonlist                           && 
+                           OPTI_0_IsTabvarsUseInArgument() == 1 &&
+                           couldaddvariable == 1 ) 
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_cur_decl,
+                                               pos_end-pos_cur_decl);
+                      }
+                      infunctiondeclare = 0 ;
+                   }
+break;
+case 50:
+#line 613 "fortran.y"
+{
+                      COM_1_AddvartoParamlist(yyvsp[-1].l);
+                      if ( fortran77 == 1  && 
+                           firstpass == 0  && 
+                           commonlist      && 
+                           listvarindoloop && 
+                           OPTI_0_IsTabvarsUseInArgument() == 1 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curparameter,
+                                               pos_end-pos_curparameter);
+                      }
+                   }
+break;
+case 63:
+#line 639 "fortran.y"
+{
+                      /* we should remove the data declaration                */
+                     if (firstpass == 0 && aftercontainsdeclare == 0 )
+                     {
+                        pos_end = setposcur();
+                        RemoveWordSET(fortranout,pos_curdata,
+                                              pos_end-pos_curdata);
+                     }
+                  }
+break;
+case 70:
+#line 657 "fortran.y"
+{
+                   /* if the variable is a parameter we can suppose that is   */
+                   /*    value is the same on each grid. It is not useless to */
+                   /*    create a copy of it on each grid                     */
+                      if ( couldaddvariable == 1 )
+                      {
+                         decl_1_ajoutevar(yyvsp[-1].l);
+                         if ( VariableIsParameter == 1 ) globparam =
+                                            AddListvarToListvar(yyvsp[-1].l,globparam,1);
+                         DECL_0_NonGridDepDeclaration(yyvsp[-1].l);
+                         /* if variables has been declared in a subroutine    */
+                         if ( insubroutinedeclare == 1 )
+                         {
+                           OPTI_1_ajoutvarofsubroutine(yyvsp[-1].l);
+                           OPTI_0_writesubroutinedeclaration(yyvsp[-1].l);
+                         }
+                         /* If there are a SAVE declarations in module's      */
+                         /*    subroutines we should remove it from the       */
+                         /*    subroutines declaration and add it in the      */
+                         /*    global declarations                            */
+                         if ( aftercontainsdeclare == 1 ) 
+                         {
+                            decl_1_ajoutevarsave(yyvsp[-1].l);
+                            decl_0_modifdeclarationssave(yyvsp[-1].l);
+                         }
+                      }
+                      /* Case of common block                                 */
+                      indeclarationvar=0;
+                      PublicDeclare = 0;  
+                      PrivateDeclare = 0; 
+                      ExternalDeclare = 0; 
+                      lengspecgiven=0;
+                      PrecisionGiven = 0; 
+                      c_star = 0;
+                      CharacterSizeGiven = 0 ; 
+                      InitialValueGiven = 0 ;
+                      IntentDeclare = 0; 
+                      VariableIsParameter =  0 ; 
+                      Allocatabledeclare = 0 ;
+                      SaveDeclare = 0;
+                      pointerdeclare = 0;
+                      optionaldeclare = 0 ;
+                      dimsgiven=0;
+                      c_selectorgiven=0;
+                      inttypename=0;
+                   }
+break;
+case 71:
+#line 704 "fortran.y"
+{
+                      infunctiondeclare = 1 ;
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,yyvsp[-1].na);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar(yyvsp[-1].na,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            curvar=createvar(yyvsp[-1].na,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            strcpy(curvar->modulename,subroutinename);
+                            curlistvar=insertvar(NULL,curvar);        
+                            varofsubroutineliste = AddListvarToListvar
+                                            (curlistvar,varofsubroutineliste,1);
+                         }
+                         if ( firstpass == 0 )
+                         {
+                            curvar=createvar(yyvsp[-1].na,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            functionlistvar=insertvar(NULL,curvar);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar(yyvsp[-1].na,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            curvar=createvar(yyvsp[-1].na,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            strcpy(curvar->modulename,subroutinename);
+                            curlistvar=insertvar(NULL,curvar);        
+                            varofsubroutineliste = AddListvarToListvar
+                                            (curlistvar,varofsubroutineliste,1);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                   }
+break;
+case 72:
+#line 779 "fortran.y"
+{
+                      if (firstpass == 0 )
+                      {
+                         pos_curparameter = setposcur()-9;
+                      }
+                   }
+break;
+case 73:
+#line 786 "fortran.y"
+{
+                      if (firstpass == 0 ) pos_curdata = setposcur()-4;
+                   }
+break;
+case 74:
+#line 790 "fortran.y"
+{
+                      sprintf(ligne,"(/ %s /)",yyvsp[-1].na);
+                      DATA_n_CompleteDataList(yyvsp[-3].na,ligne);
+                   }
+break;
+case 75:
+#line 795 "fortran.y"
+{
+                      sprintf(ligne,"(/ %s /)",yyvsp[-1].na);
+                      DATA_n_CompleteDataList(yyvsp[-3].na,ligne);
+                   }
+break;
+case 76:
+#line 801 "fortran.y"
+{
+                      strcpy(yyval.na,yyvsp[0].na);
+                   }
+break;
+case 77:
+#line 805 "fortran.y"
+{
+                      sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);
+                   }
+break;
+case 78:
+#line 810 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 79:
+#line 812 "fortran.y"
+{sprintf(yyval.na,"%s+%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 80:
+#line 814 "fortran.y"
+{sprintf(yyval.na,"%s+%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 81:
+#line 816 "fortran.y"
+{sprintf(yyval.na,"%s+%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 82:
+#line 818 "fortran.y"
+{sprintf(yyval.na,"%s+%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 83:
+#line 821 "fortran.y"
+{strcpy(yyval.na,"");}
+break;
+case 84:
+#line 823 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 87:
+#line 829 "fortran.y"
+{
+         if ( firstpass == 1 ) AddNameToListNamelist(yyvsp[-1].na);
+      }
+break;
+case 88:
+#line 833 "fortran.y"
+{
+         if ( firstpass == 1 ) AddNameToListNamelist(yyvsp[-2].na);
+      }
+break;
+case 101:
+#line 856 "fortran.y"
+{
+                         if (firstpass == 0 && fortran77 == 1 &&
+                             couldaddvariable == 1 )
+                         {
+                            pos_end = setposcur();
+                            RemoveWordSET(fortranout,pos_curcommon,
+                                                  pos_end-pos_curcommon);
+                         }
+                   }
+break;
+case 102:
+#line 866 "fortran.y"
+{
+                         if ( couldaddvariable == 1 )
+                         {
+                            if (firstpass == 1 ) 
+                            {
+                               sprintf(charusemodule,"%s",yyvsp[-1].na);
+                               Add_ModuleTo_Modulelist(yyvsp[-1].na);
+                            }
+                            if (firstpass == 0 && fortran77 == 1 )
+                            {
+                               pos_end = setposcur();
+                               RemoveWordSET(fortranout,pos_curcommon,
+                                                     pos_end-pos_curcommon);
+                            }
+                         }
+                   }
+break;
+case 103:
+#line 883 "fortran.y"
+{
+                         if ( couldaddvariable == 1 )
+                         {
+                            if (firstpass == 1 ) 
+                            {
+                               sprintf(charusemodule,"%s",yyvsp[-2].na);
+                               Add_ModuleTo_Modulelist(yyvsp[-2].na);
+                            }
+                            if (firstpass == 0 && fortran77 == 1 )
+                            {
+                               pos_end = setposcur();
+                               RemoveWordSET(fortranout,pos_curcommon,
+                                                     pos_end-pos_curcommon);
+                            }
+                         }
+                   }
+break;
+case 104:
+#line 901 "fortran.y"
+{
+                      positioninblock=0;
+                      if (firstpass == 0 ) pos_curcommon = setposcur()-6;
+                   }
+break;
+case 105:
+#line 906 "fortran.y"
+{
+                      if ( couldaddvariable == 1 ) COM_1_AddCommonvartolist();
+                   }
+break;
+case 106:
+#line 911 "fortran.y"
+{
+                      if ( couldaddvariable == 1 ) COM_1_AddCommonvartolist();
+                   }
+break;
+case 107:
+#line 915 "fortran.y"
+{
+                      if ( couldaddvariable == 1 ) 
+                      {
+                         positioninblock = positioninblock + 1 ;
+                         strcpy(commonvar,yyvsp[-1].na);
+                         commondim = yyvsp[0].d;
+                      }
+                   }
+break;
+case 108:
+#line 925 "fortran.y"
+{
+                      if ( couldaddvariable == 1 ) 
+                      {
+                         strcpy(yyval.na,"");
+                         positioninblock=0;
+                         strcpy(commonblockname,"");
+                      }
+                   }
+break;
+case 109:
+#line 934 "fortran.y"
+{
+                      if ( couldaddvariable == 1 ) 
+                      {
+                         strcpy(yyval.na,yyvsp[-1].na);
+                         positioninblock=0;
+                         strcpy(commonblockname,yyvsp[-1].na);
+                      }
+                   }
+break;
+case 118:
+#line 956 "fortran.y"
+{
+                      if ( firstpass == 1 ) yyval.l=insertvar(NULL,yyvsp[0].v);
+                   }
+break;
+case 119:
+#line 960 "fortran.y"
+{
+                      if ( firstpass == 1 ) yyval.l=insertvar(yyvsp[-2].l,yyvsp[0].v);
+                   }
+break;
+case 120:
+#line 965 "fortran.y"
+{
+                      if ( firstpass == 1 )
+                      {
+                         curvar=(variable *) malloc(sizeof(variable));
+                         strcpy(curvar->nomvar,yyvsp[-2].na);
+                         strcpy(curvar->subroutinename,subroutinename);
+                         strcpy(curvar->modulename,subroutinename);
+                         curvar->isparameter=1;
+                         strcpy(curvar->initialvalue,yyvsp[0].na);
+                         yyval.v=curvar;
+                      }
+                   }
+break;
+case 124:
+#line 984 "fortran.y"
+{
+                       if ( firstpass == 1 && insubroutinedeclare == 1 )
+                       {
+                           listimplicitnone = Add_listname
+                                              (subroutinename,listimplicitnone);
+                       }
+                       if ( firstpass == 0               && 
+                            tmpdeclaration_everdone == 1 && 
+                            inmoduledeclare == 0 )
+                       {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_end-13,
+                                               13);
+                       }
+                    }
+break;
+case 126:
+#line 1003 "fortran.y"
+{
+                      if ( couldaddvariable == 1 )
+                      {
+                         if ( inmoduledeclare == 1 || SaveDeclare == 1 )
+                         {
+                            if ( MOD_n_InstanceShouldMadeInModule() == 1 ) 
+                            {
+                               MOD_1_InstanceTo1InModule();
+                            }
+                         }      
+                         /*                                                   */
+                         if (dimsgiven == 1) 
+                         {
+                            curvar=createvar(yyvsp[-3].na,curdim);
+                         }
+                         else
+                         {
+                            curvar=createvar(yyvsp[-3].na,yyvsp[-2].d);
+                         }
+                         /*                                                   */
+                         CreateAndFillin_Curvar(DeclType,yyvsp[-3].na,yyvsp[-2].d,curvar);
+                         /*                                                   */
+                         curlistvar=insertvar(NULL,curvar);
+                         if (!strcasecmp(DeclType,"character")) 
+                         {
+                            if (c_selectorgiven == 1) 
+                            {
+                               strcpy(c_selectordim.first,"1");
+                               strcpy(c_selectordim.last,c_selectorname);
+                               change_dim_char
+                                     (insertdim(NULL,c_selectordim),curlistvar);
+                            }
+                         }
+                         yyval.l=settype(DeclType,curlistvar);
+                      }
+                      lengspecgiven=0;
+                      strcpy(vallengspec,"");
+                   }
+break;
+case 127:
+#line 1042 "fortran.y"
+{
+                      if ( couldaddvariable == 1 )
+                      {
+                         if (dimsgiven == 1) 
+                         {
+                            curvar=createvar(yyvsp[-3].na,curdim);
+                         }
+                         else
+                         {
+                            curvar=createvar(yyvsp[-3].na,yyvsp[-2].d);
+                         }
+                         /*                                                   */ 
+                         CreateAndFillin_Curvar(yyvsp[-6].l->var->typevar,yyvsp[-3].na,yyvsp[-2].d,curvar);
+                         /*                                                   */
+                         curvar->typegiven=1;
+                         strcpy(curvar->typevar,(yyvsp[-6].l->var->typevar));
+                         /*                                                   */
+                         curlistvar=insertvar(yyvsp[-6].l,curvar);
+                         if (!strcasecmp(DeclType,"character")) 
+                         {
+                            if (c_selectorgiven == 1) 
+                            {
+                               strcpy(c_selectordim.first,"1");
+                               strcpy(c_selectordim.last,c_selectorname);
+                               change_dim_char
+                                     (insertdim(NULL,c_selectordim),curlistvar);
+                            }
+                         }
+                         yyval.l=curlistvar;
+                      }
+                      lengspecgiven=0;
+                      strcpy(vallengspec,"");
+                   }
+break;
+case 128:
+#line 1076 "fortran.y"
+{dimsgiven=0;}
+break;
+case 129:
+#line 1079 "fortran.y"
+{strcpy(DeclType,yyvsp[-1].na);indeclarationvar=1;}
+break;
+case 130:
+#line 1081 "fortran.y"
+{
+                      indeclarationvar=1;
+                      strcpy(DeclType,"CHARACTER");
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                      }
+                   }
+break;
+case 131:
+#line 1090 "fortran.y"
+{
+                      indeclarationvar=1;
+                      strcpy(DeclType,yyvsp[-2].na);
+                      inttypename=1;
+                      strcpy(nameinttypename,yyvsp[0].na);
+                   }
+break;
+case 133:
+#line 1099 "fortran.y"
+{c_selectorgiven=1;strcpy(c_selectorname,yyvsp[0].na);}
+break;
+case 134:
+#line 1100 "fortran.y"
+{c_star = 1;}
+break;
+case 139:
+#line 1108 "fortran.y"
+{
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-9;
+                      }
+                   }
+break;
+case 140:
+#line 1116 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 141:
+#line 1119 "fortran.y"
+{
+                      strcpy(yyval.na,"INTEGER");
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-7;
+                      }
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                       }
+                   }
+break;
+case 142:
+#line 1131 "fortran.y"
+{
+                      strcpy(yyval.na,"REAL"); 
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-4;
+                      }
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                      }
+                   }
+break;
+case 143:
+#line 1144 "fortran.y"
+{strcpy(yyval.na,"COMPLEX");}
+break;
+case 144:
+#line 1146 "fortran.y"
+{strcpy(yyval.na,"DOUBLE PRECISION");}
+break;
+case 145:
+#line 1148 "fortran.y"
+{strcpy(yyval.na,"DOUBLE COMPLEX");}
+break;
+case 146:
+#line 1150 "fortran.y"
+{
+                      strcpy(yyval.na,"LOGICAL");
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-7;
+                      }
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                      }
+                   }
+break;
+case 147:
+#line 1163 "fortran.y"
+{
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-5;
+                      }
+                      strcpy(yyval.na,"TYPE");
+                   }
+break;
+case 149:
+#line 1173 "fortran.y"
+{lengspecgiven=1;strcpy(vallengspec,yyvsp[0].na);}
+break;
+case 150:
+#line 1175 "fortran.y"
+{sprintf(yyval.na,"*%s",yyvsp[0].na);}
+break;
+case 151:
+#line 1176 "fortran.y"
+{strcpy(yyval.na,"*(*)");}
+break;
+case 158:
+#line 1187 "fortran.y"
+{
+                      PrecisionGiven = 1; 
+                      sprintf(NamePrecision,"%s = %s",yyvsp[-2].na,yyvsp[0].na);  
+                   }
+break;
+case 159:
+#line 1192 "fortran.y"
+{
+                      PrecisionGiven = 1; 
+                      strcpy(NamePrecision,yyvsp[0].na);  
+                   }
+break;
+case 160:
+#line 1197 "fortran.y"
+{strcpy(CharacterSize,yyvsp[0].na);
+                    CharacterSizeGiven = 1;strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 161:
+#line 1199 "fortran.y"
+{strcpy(CharacterSize,"*");
+                    CharacterSizeGiven = 1;strcpy(yyval.na,"*");}
+break;
+case 169:
+#line 1213 "fortran.y"
+{
+                      VariableIsParameter = 1;
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo0InModule();
+                      }
+                   }
+break;
+case 171:
+#line 1222 "fortran.y"
+{Allocatabledeclare = 1;}
+break;
+case 172:
+#line 1224 "fortran.y"
+{
+                      dimsgiven=1; 
+                      curdim=yyvsp[0].d;
+                   }
+break;
+case 173:
+#line 1229 "fortran.y"
+{ExternalDeclare = 1;}
+break;
+case 174:
+#line 1231 "fortran.y"
+{IntentDeclare = 1; strcpy(IntentSpec,yyvsp[-1].na);}
+break;
+case 176:
+#line 1233 "fortran.y"
+{optionaldeclare = 1 ;}
+break;
+case 177:
+#line 1234 "fortran.y"
+{pointerdeclare = 1 ;}
+break;
+case 178:
+#line 1235 "fortran.y"
+{
+                       if ( inmodulemeet == 1 )
+                       {
+                          SaveDeclare = 1 ;
+                          Savemeet = 1;
+                          MOD_1_InstanceShouldMadeTo1InModule();
+                       }
+                    }
+break;
+case 180:
+#line 1245 "fortran.y"
+{sprintf(yyval.na,"in");}
+break;
+case 181:
+#line 1246 "fortran.y"
+{sprintf(yyval.na,"out");}
+break;
+case 182:
+#line 1247 "fortran.y"
+{sprintf(yyval.na,"inout");}
+break;
+case 183:
+#line 1250 "fortran.y"
+{PublicDeclare = 1;}
+break;
+case 184:
+#line 1252 "fortran.y"
+{PrivateDeclare = 1;}
+break;
+case 185:
+#line 1254 "fortran.y"
+{yyval.d=(listdim *)NULL;}
+break;
+case 186:
+#line 1256 "fortran.y"
+{yyval.d=reverse(yyvsp[-1].d);}
+break;
+case 187:
+#line 1258 "fortran.y"
+{yyval.d=insertdim(NULL,yyvsp[0].dim1);}
+break;
+case 188:
+#line 1260 "fortran.y"
+{yyval.d=insertdim(yyvsp[-2].d,yyvsp[0].dim1);}
+break;
+case 189:
+#line 1262 "fortran.y"
+{strcpy(yyval.dim1.first,"1");strcpy(yyval.dim1.last,yyvsp[0].na);}
+break;
+case 190:
+#line 1263 "fortran.y"
+{strcpy(yyval.dim1.first,"");strcpy(yyval.dim1.last,"");}
+break;
+case 191:
+#line 1264 "fortran.y"
+{strcpy(yyval.dim1.first,yyvsp[-1].na);strcpy(yyval.dim1.last,"");}
+break;
+case 192:
+#line 1265 "fortran.y"
+{strcpy(yyval.dim1.first,"");strcpy(yyval.dim1.last,yyvsp[0].na);}
+break;
+case 193:
+#line 1267 "fortran.y"
+{strcpy(yyval.dim1.first,yyvsp[-2].na);strcpy(yyval.dim1.last,yyvsp[0].na);}
+break;
+case 194:
+#line 1269 "fortran.y"
+{strcpy(yyval.na,"*");}
+break;
+case 195:
+#line 1270 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 196:
+#line 1272 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 197:
+#line 1274 "fortran.y"
+{sprintf(yyval.na,"(%s)",yyvsp[-1].na);}
+break;
+case 198:
+#line 1276 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 200:
+#line 1281 "fortran.y"
+{sprintf(yyval.na,"SUM(%s)",yyvsp[-1].na);}
+break;
+case 201:
+#line 1283 "fortran.y"
+{sprintf(yyval.na,"MAX(%s)",yyvsp[-1].na);}
+break;
+case 202:
+#line 1285 "fortran.y"
+{sprintf(yyval.na,"TANH(%s)",yyvsp[-1].na);}
+break;
+case 203:
+#line 1287 "fortran.y"
+{sprintf(yyval.na,"MAXVAL(%s)",yyvsp[-1].na);}
+break;
+case 204:
+#line 1289 "fortran.y"
+{sprintf(yyval.na,"MIN(%s)",yyvsp[-1].na);}
+break;
+case 205:
+#line 1291 "fortran.y"
+{sprintf(yyval.na,"MINVAL(%s)",yyvsp[-1].na);}
+break;
+case 206:
+#line 1293 "fortran.y"
+{sprintf(yyval.na,"TRIM(%s)",yyvsp[-1].na);}
+break;
+case 207:
+#line 1295 "fortran.y"
+{sprintf(yyval.na,"SQRT(%s)",yyvsp[-1].na);}
+break;
+case 208:
+#line 1297 "fortran.y"
+{sprintf(yyval.na,"REAL(%s)",yyvsp[-1].na);}
+break;
+case 209:
+#line 1299 "fortran.y"
+{sprintf(yyval.na,"INT(%s)",yyvsp[-1].na);}
+break;
+case 210:
+#line 1301 "fortran.y"
+{sprintf(yyval.na,"NINT(%s)",yyvsp[-1].na);}
+break;
+case 211:
+#line 1303 "fortran.y"
+{sprintf(yyval.na,"FLOAT(%s)",yyvsp[-1].na);}
+break;
+case 212:
+#line 1305 "fortran.y"
+{sprintf(yyval.na,"EXP(%s)",yyvsp[-1].na);}
+break;
+case 213:
+#line 1307 "fortran.y"
+{sprintf(yyval.na,"COS(%s)",yyvsp[-1].na);}
+break;
+case 214:
+#line 1309 "fortran.y"
+{sprintf(yyval.na,"COSH(%s)",yyvsp[-1].na);}
+break;
+case 215:
+#line 1311 "fortran.y"
+{sprintf(yyval.na,"ACOS(%s)",yyvsp[-1].na);}
+break;
+case 216:
+#line 1313 "fortran.y"
+{sprintf(yyval.na,"SIN(%s)",yyvsp[-1].na);}
+break;
+case 217:
+#line 1315 "fortran.y"
+{sprintf(yyval.na,"SINH(%s)",yyvsp[-1].na);}
+break;
+case 218:
+#line 1317 "fortran.y"
+{sprintf(yyval.na,"ASIN(%s)",yyvsp[-1].na);}
+break;
+case 219:
+#line 1319 "fortran.y"
+{sprintf(yyval.na,"LOG(%s)",yyvsp[-1].na);}
+break;
+case 220:
+#line 1321 "fortran.y"
+{sprintf(yyval.na,"TAN(%s)",yyvsp[-1].na);}
+break;
+case 221:
+#line 1323 "fortran.y"
+{sprintf(yyval.na,"ATAN(%s)",yyvsp[-1].na);}
+break;
+case 222:
+#line 1325 "fortran.y"
+{sprintf(yyval.na,"ABS(%s)",yyvsp[-1].na);}
+break;
+case 223:
+#line 1327 "fortran.y"
+{sprintf(yyval.na,"MOD(%s)",yyvsp[-1].na);}
+break;
+case 224:
+#line 1329 "fortran.y"
+{sprintf(yyval.na,"SIGN(%s)",yyvsp[-1].na);}
+break;
+case 225:
+#line 1331 "fortran.y"
+{sprintf(yyval.na,"MINLOC(%s)",yyvsp[-1].na);}
+break;
+case 226:
+#line 1333 "fortran.y"
+{sprintf(yyval.na,"MAXLOC(%s)",yyvsp[-1].na);}
+break;
+case 227:
+#line 1335 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 228:
+#line 1337 "fortran.y"
+{strcpy(yyval.na,yyvsp[-2].na);strcat(yyval.na,",");strcat(yyval.na,yyvsp[0].na);}
+break;
+case 229:
+#line 1339 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 230:
+#line 1341 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 231:
+#line 1343 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 232:
+#line 1345 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 233:
+#line 1347 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 234:
+#line 1349 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 235:
+#line 1351 "fortran.y"
+{strcpy(yyval.na,"+");}
+break;
+case 236:
+#line 1352 "fortran.y"
+{strcpy(yyval.na,"-");}
+break;
+case 237:
+#line 1355 "fortran.y"
+{sprintf(yyval.na,"+%s",yyvsp[0].na);}
+break;
+case 238:
+#line 1357 "fortran.y"
+{sprintf(yyval.na,"-%s",yyvsp[0].na);}
+break;
+case 239:
+#line 1359 "fortran.y"
+{sprintf(yyval.na,"*%s",yyvsp[0].na);}
+break;
+case 240:
+#line 1361 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 241:
+#line 1363 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 242:
+#line 1365 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 243:
+#line 1367 "fortran.y"
+{sprintf(yyval.na," > %s",yyvsp[0].na);}
+break;
+case 244:
+#line 1369 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 245:
+#line 1371 "fortran.y"
+{sprintf(yyval.na," < %s",yyvsp[0].na);}
+break;
+case 246:
+#line 1373 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 247:
+#line 1375 "fortran.y"
+{sprintf(yyval.na," >= %s",yyvsp[0].na);}
+break;
+case 248:
+#line 1377 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 249:
+#line 1379 "fortran.y"
+{sprintf(yyval.na," <= %s",yyvsp[0].na);}
+break;
+case 250:
+#line 1381 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 251:
+#line 1383 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 252:
+#line 1385 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 253:
+#line 1387 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 254:
+#line 1389 "fortran.y"
+{sprintf(yyval.na,"%s",yyvsp[0].na);}
+break;
+case 255:
+#line 1391 "fortran.y"
+{sprintf(yyval.na,"%s",yyvsp[0].na);}
+break;
+case 256:
+#line 1394 "fortran.y"
+{sprintf(yyval.na,"/%s",yyvsp[0].na);}
+break;
+case 257:
+#line 1396 "fortran.y"
+{sprintf(yyval.na,"== %s",yyvsp[0].na);}
+break;
+case 258:
+#line 1398 "fortran.y"
+{sprintf(yyval.na,"//%s",yyvsp[0].na);}
+break;
+case 259:
+#line 1401 "fortran.y"
+{sprintf(yyval.na,"==%s",yyvsp[0].na);}
+break;
+case 260:
+#line 1403 "fortran.y"
+{sprintf(yyval.na,"= %s",yyvsp[0].na);}
+break;
+case 261:
+#line 1406 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 262:
+#line 1408 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 263:
+#line 1410 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 264:
+#line 1412 "fortran.y"
+{
+                      agrif_parentcall =0;
+                      if (!strcasecmp(identcopy,"Agrif_Parent") )
+                                                            agrif_parentcall =1;
+                      if ( AGRIF_n_Agrif_in_Tok_NAME(identcopy) == 1 )
+                      { 
+                         inagrifcallargument = 1;
+                         AGRIF_n_AddsubroutineTolistsubwhereagrifused();
+                      }
+                   }
+break;
+case 265:
+#line 1424 "fortran.y"
+{
+                     strcpy(yyval.na,yyvsp[0].na);
+                     if ( incalldeclare == 0 ) inagrifcallargument = 0;
+                   }
+break;
+case 266:
+#line 1429 "fortran.y"
+{sprintf(yyval.na," %s %s ",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 267:
+#line 1431 "fortran.y"
+{sprintf(yyval.na," %s ( %s )",yyvsp[-3].na,yyvsp[-1].na);}
+break;
+case 268:
+#line 1433 "fortran.y"
+{sprintf(yyval.na," %s ( %s ) %s ",yyvsp[-4].na,yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 269:
+#line 1436 "fortran.y"
+{
+                      sprintf(yyval.na," %s ( %s )",yyvsp[-3].na,yyvsp[-1].na);
+                      AGRIF_0_ModifyTheAgrifFunction(yyvsp[-1].na);
+                     agrif_parentcall =0; 
+                   }
+break;
+case 270:
+#line 1443 "fortran.y"
+{
+                      sprintf(yyval.na," %s %% %s ",yyvsp[-2].na,yyvsp[0].na);
+                     if ( incalldeclare == 0 ) inagrifcallargument = 0;
+                   }
+break;
+case 271:
+#line 1449 "fortran.y"
+{sprintf(yyval.na,"(/%s/)",yyvsp[-1].na);}
+break;
+case 272:
+#line 1451 "fortran.y"
+{strcpy(yyval.na," ");}
+break;
+case 273:
+#line 1453 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 274:
+#line 1455 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 275:
+#line 1457 "fortran.y"
+{sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 276:
+#line 1459 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 277:
+#line 1460 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 278:
+#line 1463 "fortran.y"
+{sprintf(yyval.na,"%s:%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 279:
+#line 1465 "fortran.y"
+{sprintf(yyval.na,"%s:%s:%s",yyvsp[-4].na,yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 280:
+#line 1467 "fortran.y"
+{sprintf(yyval.na,":%s:%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 281:
+#line 1468 "fortran.y"
+{sprintf(yyval.na,": : %s",yyvsp[0].na);}
+break;
+case 282:
+#line 1469 "fortran.y"
+{sprintf(yyval.na,":%s",yyvsp[0].na);}
+break;
+case 283:
+#line 1470 "fortran.y"
+{sprintf(yyval.na,"%s:",yyvsp[-1].na);}
+break;
+case 284:
+#line 1471 "fortran.y"
+{sprintf(yyval.na,":");}
+break;
+case 285:
+#line 1473 "fortran.y"
+{  
+                       strcpy(identcopy,yyvsp[0].na);
+                       pointedvar=0;
+                       if ( VarIsNonGridDepend(yyvsp[0].na) == 0 &&
+                            formatdeclare == 0 
+                          )
+                       {
+                          if ( inagrifcallargument == 1 ||
+                               OPTI_0_varisallocatable(yyvsp[0].na) == 1 ||
+			       OPTI_0_varispointer(yyvsp[0].na) == 1 )
+                          {
+                             AGRIF_0_ModifyTheVariableName(yyvsp[0].na);
+                          }
+                          if ( inagrifcallargument != 1 )
+                               OPTI_1_ajoutevarindoloop(yyvsp[0].na);
+                       }
+                       AGRIF_0_NotifyAgrifFunction(yyvsp[0].na);
+                    }
+break;
+case 286:
+#line 1493 "fortran.y"
+{strcpy(yyval.na,".TRUE.");}
+break;
+case 287:
+#line 1494 "fortran.y"
+{strcpy(yyval.na,".FALSE.");}
+break;
+case 288:
+#line 1495 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 289:
+#line 1496 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 290:
+#line 1497 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 291:
+#line 1498 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 292:
+#line 1500 "fortran.y"
+{sprintf(yyval.na,"%s%s",yyvsp[-1].na,yyvsp[0].na);}
+break;
+case 294:
+#line 1504 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 296:
+#line 1507 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 297:
+#line 1509 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 298:
+#line 1511 "fortran.y"
+{strcpy(yyval.na," ");}
+break;
+case 299:
+#line 1512 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 300:
+#line 1515 "fortran.y"
+{sprintf(yyval.na,"(%s:%s)",yyvsp[-3].na,yyvsp[-1].na);}
+break;
+case 301:
+#line 1517 "fortran.y"
+{strcpy(yyval.na," ");}
+break;
+case 302:
+#line 1518 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 303:
+#line 1520 "fortran.y"
+{strcpy(yyval.na," ");}
+break;
+case 304:
+#line 1521 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 305:
+#line 1523 "fortran.y"
+{InitialValueGiven = 0;}
+break;
+case 306:
+#line 1525 "fortran.y"
+{
+                       strcpy(InitValue,yyvsp[0].na);
+                       InitialValueGiven = 1;
+                    }
+break;
+case 307:
+#line 1530 "fortran.y"
+{if ( firstpass == 0 ) pos_curinit = setposcur();}
+break;
+case 308:
+#line 1533 "fortran.y"
+{sprintf(yyval.na,"(%s,%s)",yyvsp[-3].na,yyvsp[-1].na);}
+break;
+case 309:
+#line 1536 "fortran.y"
+{
+                      /* if variables has been declared in a subroutine       */
+                      if (insubroutinedeclare == 1)
+                      {
+                         OPTI_0_copyuse(yyvsp[0].na);
+                      }
+                      if (firstpass == 1 ) 
+                      {
+                         sprintf(charusemodule,"%s",yyvsp[0].na);
+                         Addmoduletothelist(yyvsp[0].na);
+                      }
+                      if ( firstpass == 0 && inmoduledeclare == 0 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curuse,
+                                               pos_end-pos_curuse);
+                      }
+                    }
+break;
+case 310:
+#line 1555 "fortran.y"
+{
+                      if (insubroutinedeclare == 1)
+                      {
+                         OPTI_1_completelistvarpointtovar(yyvsp[-2].na,yyvsp[0].lc);
+                      }
+                      if ( firstpass == 1 ) 
+                      {
+                         if ( insubroutinedeclare == 1 )
+                         {
+                            coupletmp = yyvsp[0].lc;
+                            strcpy(ligne,"");
+                            while ( coupletmp )
+                            {
+                               strcat(ligne,coupletmp->namevar);
+                               strcat(ligne," => ");
+                               strcat(ligne,coupletmp->namepointedvar);
+                               coupletmp = coupletmp->suiv;
+                               if ( coupletmp ) strcat(ligne,",");
+                            }
+                            sprintf(charusemodule,"%s",yyvsp[-2].na);
+                         }
+                         Addmoduletothelist(yyvsp[-2].na);
+                      }
+                      if ( firstpass == 0  && inmoduledeclare == 0 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curuse,
+                                               pos_end-pos_curuse);
+                      }
+                    }
+break;
+case 311:
+#line 1586 "fortran.y"
+{
+                      /* if variables has been declared in a subroutine       */
+                      if (insubroutinedeclare == 1)
+                      {
+                         OPTI_0_copyuseonly(yyvsp[-4].na);
+                      }
+                      if (firstpass == 1 ) 
+                      {
+                         sprintf(charusemodule,"%s",yyvsp[-4].na);
+                         Addmoduletothelist(yyvsp[-4].na);
+                      }
+                       if ( firstpass == 0  && inmoduledeclare == 0 )
+                       {
+                          pos_end = setposcur();
+                          RemoveWordSET(fortranout,pos_curuse,
+                                                pos_end-pos_curuse);
+                       }
+                    }
+break;
+case 312:
+#line 1605 "fortran.y"
+{
+                       /* if variables has been declared in a subroutine      */
+                       if (insubroutinedeclare == 1)
+                       {
+                          OPTI_1_completelistvarpointtovar(yyvsp[-4].na,yyvsp[0].lc);
+                       }
+                       if ( firstpass == 1 ) 
+                       {
+                         if ( insubroutinedeclare == 1 )
+                         {
+                             coupletmp = yyvsp[0].lc;
+                             strcpy(ligne,"");
+                             while ( coupletmp )
+                             {
+                                strcat(ligne,coupletmp->namevar);
+                                if ( strcasecmp(coupletmp->namepointedvar,"") )
+                                                           strcat(ligne," => ");
+                                strcat(ligne,coupletmp->namepointedvar);
+                                coupletmp = coupletmp->suiv;
+                                if ( coupletmp ) strcat(ligne,",");
+                             }
+                             sprintf(charusemodule,"%s",yyvsp[-4].na);
+                          }
+                          Addmoduletothelist(yyvsp[-4].na);
+                       }
+                       if ( firstpass == 0  && inmoduledeclare == 0 )
+                       {
+                          pos_end = setposcur();
+                          RemoveWordSET(fortranout,pos_curuse,
+                                                pos_end-pos_curuse);
+                       }
+                    }
+break;
+case 313:
+#line 1639 "fortran.y"
+{
+                      if ( firstpass == 0 ) pos_curuse = setposcur()-3;
+                   }
+break;
+case 314:
+#line 1644 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 315:
+#line 1647 "fortran.y"
+{
+                       yyval.lc = yyvsp[0].lc;
+                    }
+break;
+case 316:
+#line 1651 "fortran.y"
+{
+                        /* insert the variable in the list $1                 */
+                        yyvsp[0].lc->suiv = yyvsp[-2].lc;
+                        yyval.lc = yyvsp[0].lc;
+                    }
+break;
+case 317:
+#line 1658 "fortran.y"
+{
+                       coupletmp =(listcouple *)malloc(sizeof(listcouple));
+                       strcpy(coupletmp->namevar,yyvsp[-2].na);
+                       strcpy(coupletmp->namepointedvar,yyvsp[0].na);
+                       coupletmp->suiv = NULL;
+                       yyval.lc = coupletmp;
+                     }
+break;
+case 318:
+#line 1667 "fortran.y"
+{
+                       yyval.lc = yyvsp[0].lc;
+                    }
+break;
+case 319:
+#line 1671 "fortran.y"
+{
+                        /* insert the variable in the list $1                 */
+                        yyvsp[0].lc->suiv = yyvsp[-2].lc;
+                        yyval.lc = yyvsp[0].lc;
+                    }
+break;
+case 320:
+#line 1678 "fortran.y"
+{
+                       coupletmp =(listcouple *)malloc(sizeof(listcouple));
+                       strcpy(coupletmp->namevar,yyvsp[-2].na);
+                       strcpy(coupletmp->namepointedvar,yyvsp[0].na);
+                       coupletmp->suiv = NULL;
+                       yyval.lc = coupletmp;
+                       pointedvar=1;
+                       OPTI_1_ajoutevarindoloop(yyvsp[-2].na);
+                    }
+break;
+case 321:
+#line 1687 "fortran.y"
+{
+                       coupletmp =(listcouple *)malloc(sizeof(listcouple));
+                       strcpy(coupletmp->namevar,yyvsp[0].na);
+                       strcpy(coupletmp->namepointedvar,"");
+                       coupletmp->suiv = NULL;
+                       yyval.lc = coupletmp;
+                     }
+break;
+case 326:
+#line 1700 "fortran.y"
+{
+                       if ( inmodulemeet == 1 )
+                       {
+                         /* we are in a module                                */
+                         if ( insubroutinedeclare == 1 )
+                         {
+                            /* it is like an end subroutine <name>            */
+                            insubroutinedeclare = 0 ;
+                            paramdeclaration_everdone = 0;
+                            tmpdeclaration_everdone = 0;
+                            /*                                                */
+                            OPTI_0_closeandcallsubloopandincludeit(1,yyvsp[0].na,"");
+                            /* at the end of the firstpass we should remove   */
+                            /*    from the listvarindoloop all variables      */
+                            /*    which has not been declared as table in the */
+                            /*    globliste                                   */
+                            OPTI_1_cleanlistvarfordoloop(1);
+                         }
+                         else
+                         {
+                            /* if we never meet the contains keyword          */
+                            if ( inmoduledeclare == 1 )
+                            {
+                               if ( aftercontainsdeclare == 0 )
+                               {
+                                  if ( firstpass == 1) 
+                                         DATA_1_CompleteGlobListeWithDatalist();
+                                 addi_0_addsubroutine_inst_back_alloc(1);
+                               }
+                            }
+                            /* it is like an end module <name>                */
+                            inmoduledeclare = 0 ; 
+                            inmodulemeet = 0 ; 
+                         }
+                       }
+                       else
+                       {
+                          paramdeclaration_everdone = 0;
+                          tmpdeclaration_everdone = 0;
+                          insubroutinedeclare = 0;
+                          /*                                                  */
+                          OPTI_0_closeandcallsubloopandincludeit(2,yyvsp[0].na,"");
+                          /* it is like end subroutine or end program         */
+                          /*  Common case                                     */
+                          /* at the end of the firstpass we should remove     */
+                          /*    from the listvarindoloop all variables which  */
+                          /*    has not been declared as table in the         */
+                          /*    globliste                                     */
+                          OPTI_1_cleanlistvarfordoloop(1);
+                       }
+                    }
+break;
+case 327:
+#line 1752 "fortran.y"
+{
+                       tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                       insubroutinedeclare = 0;
+                       /*                                                     */
+                       OPTI_0_closeandcallsubloopandincludeit(3,yyvsp[-1].na,yyvsp[0].na);
+                       /*  Common case                                        */
+                       /* at the end of the firstpass we should remove from   */
+                       /*    the listvarindoloop all variables which has not  */
+                       /*    been declared as table in the globliste          */
+                       OPTI_1_cleanlistvarfordoloop(3);
+                    }
+break;
+case 328:
+#line 1765 "fortran.y"
+{
+                       tmpdeclaration_everdone = 0;
+                       paramdeclaration_everdone = 0;
+                       insubroutinedeclare = 0;
+                       /*                                                     */
+                       OPTI_0_closeandcallsubloopandincludeit(1,yyvsp[-1].na,yyvsp[0].na);
+                       /*  Common case                                        */
+                       /* at the end of the firstpass we should remove from   */
+                       /*    the listvarindoloop all variables which has not  */
+                       /*    been declared as table in the globliste          */
+                       OPTI_1_cleanlistvarfordoloop(1);
+                    }
+break;
+case 329:
+#line 1778 "fortran.y"
+{
+                       tmpdeclaration_everdone = 0;
+                       paramdeclaration_everdone = 0;
+                       insubroutinedeclare = 0;
+                       /*                                                     */
+                       OPTI_0_closeandcallsubloopandincludeit(0,yyvsp[-1].na,yyvsp[0].na);
+                       /*  Common case                                        */
+                       /* at the end of the firstpass we should remove from   */
+                       /*    the listvarindoloop all variables which has not  */
+                       /*    been declared as table in the globliste          */
+                       OPTI_1_cleanlistvarfordoloop(0);
+                    }
+break;
+case 330:
+#line 1791 "fortran.y"
+{
+                       /* if we never meet the contains keyword               */
+                       if ( inmoduledeclare == 1 )
+                       {
+                          if ( aftercontainsdeclare == 0 )
+                          {
+                             if ( firstpass == 1) 
+                                         DATA_1_CompleteGlobListeWithDatalist();
+                             addi_0_addsubroutine_inst_back_alloc(1);
+                          }
+                       }
+                       inmoduledeclare = 0 ; 
+                       inmodulemeet = 0 ; 
+                  }
+break;
+case 344:
+#line 1819 "fortran.y"
+{
+                      if (inmoduledeclare == 1 )
+                      {
+                         if ( firstpass == 1) 
+                                         DATA_1_CompleteGlobListeWithDatalist();
+                         addi_0_addsubroutine_inst_back_alloc(0);
+                      }
+                      inmoduledeclare = 0 ; 
+                      aftercontainsdeclare = 1;
+                   }
+break;
+case 352:
+#line 1840 "fortran.y"
+{strcpy(yyval.na,"");}
+break;
+case 353:
+#line 1841 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 369:
+#line 1866 "fortran.y"
+{sprintf(yyval.na,"=%s",yyvsp[0].na);}
+break;
+case 370:
+#line 1868 "fortran.y"
+{sprintf(yyval.na,"=>%s",yyvsp[0].na);}
+break;
+case 371:
+#line 1871 "fortran.y"
+{
+                      inagrifcallargument = 0 ;
+                      incalldeclare=0;
+                      if ( oldfortranout && 
+                           !strcmp(meetagrifinitgrids,subroutinename) && 
+                           firstpass == 0 &&
+                           callmpiinit == 1)
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curcall,
+                                               pos_end-pos_curcall);
+                         fprintf(oldfortranout,"      Call MPI_Init (%s) \n"
+                                                                   ,mpiinitvar);
+                      }
+                      if ( oldfortranout           && 
+                           callagrifinitgrids == 1 && 
+                           firstpass == 0 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curcall,
+                                               pos_end-pos_curcall);
+                         fprintf(oldfortranout,
+                                           "      Call Agrif_Init_Grids () \n");
+                         strcpy(subofagrifinitgrids,subroutinename);
+                      }
+                   }
+break;
+case 376:
+#line 1905 "fortran.y"
+{
+                       if (!strcasecmp(yyvsp[0].na,"MPI_Init") ) 
+                       {
+                          callmpiinit = 1;
+                          strcpy(meetmpiinit,subroutinename);
+                       }
+                       else
+                       {
+                          callmpiinit = 0;
+                       }
+                       if (!strcasecmp(yyvsp[0].na,"Agrif_Init_Grids") ) 
+                       {
+                          callagrifinitgrids = 1;
+                          strcpy(meetagrifinitgrids,subroutinename);
+                       }
+                       else callagrifinitgrids = 0;
+                       if ( AGRIF_n_Vartonumber(yyvsp[0].na) == 1 ) 
+                       {
+                          incalldeclare=1;
+                          inagrifcallargument = 1 ;
+                          AGRIF_n_AddsubroutineTolistsubwhereagrifused();
+                       }
+                    }
+break;
+case 377:
+#line 1930 "fortran.y"
+{if ( firstpass == 0 ) pos_curcall=setposcur()-4;}
+break;
+case 380:
+#line 1935 "fortran.y"
+{
+                  if ( callmpiinit == 1 ) 
+                  {
+                     strcpy(mpiinitvar,yyvsp[0].na);
+                     if ( firstpass == 1 ) 
+                     {
+                        curvar=createvar(yyvsp[0].na,NULL);
+                        curlistvar=insertvar(NULL,curvar);
+                        listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                     }
+                  }
+               }
+break;
+case 386:
+#line 1958 "fortran.y"
+{formatdeclare = 0;}
+break;
+case 389:
+#line 1962 "fortran.y"
+{formatdeclare = 0;}
+break;
+case 390:
+#line 1965 "fortran.y"
+{formatdeclare = 1;}
+break;
+case 462:
+#line 2066 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 463:
+#line 2067 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 464:
+#line 2070 "fortran.y"
+{sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 465:
+#line 2072 "fortran.y"
+{sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 466:
+#line 2074 "fortran.y"
+{sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 467:
+#line 2076 "fortran.y"
+{sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 468:
+#line 2078 "fortran.y"
+{sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 469:
+#line 2080 "fortran.y"
+{sprintf(yyval.na,"%s,%s",yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 470:
+#line 2081 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 471:
+#line 2082 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 472:
+#line 2085 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+case 473:
+#line 2087 "fortran.y"
+{sprintf(yyval.na," (%s)",yyvsp[-1].na);}
+break;
+case 474:
+#line 2089 "fortran.y"
+{sprintf(yyval.na,"(%s,%s)",yyvsp[-3].na,yyvsp[-1].na);}
+break;
+case 475:
+#line 2091 "fortran.y"
+{sprintf(yyval.na,"(%s,%s)",yyvsp[-3].na,yyvsp[-1].na);}
+break;
+case 476:
+#line 2093 "fortran.y"
+{sprintf(yyval.na,"(%s,%s)",yyvsp[-3].na,yyvsp[-1].na);}
+break;
+case 477:
+#line 2097 "fortran.y"
+{sprintf(yyval.na,"%s=%s,%s)",yyvsp[-4].na,yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 478:
+#line 2099 "fortran.y"
+{sprintf(yyval.na,"%s=%s,%s,%s)",yyvsp[-6].na,yyvsp[-4].na,yyvsp[-2].na,yyvsp[0].na);}
+break;
+case 485:
+#line 2112 "fortran.y"
+{OPTI_1_AddIdentToTheAllocateList(yyvsp[0].na);}
+break;
+case 488:
+#line 2117 "fortran.y"
+{OPTI_1_AddIdentToTheAllocateList(yyvsp[-3].na);}
+break;
+case 502:
+#line 2140 "fortran.y"
+{strcpy(yyval.na,yyvsp[0].na);}
+break;
+#line 7962 "y.tab.c"
+    }
+    yyssp -= yym;
+    yystate = *yyssp;
+    yyvsp -= yym;
+    yym = yylhs[yyn];
+    if (yystate == 0 && yym == 0)
+    {
+#if YYDEBUG
+        if (yydebug)
+            printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+        yystate = YYFINAL;
+        *++yyssp = YYFINAL;
+        *++yyvsp = yyval;
+        if (yychar < 0)
+        {
+            if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+            if (yydebug)
+            {
+                yys = 0;
+                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+                if (!yys) yys = "illegal-symbol";
+                printf("%sdebug: state %d, reading %d (%s)\n",
+                        YYPREFIX, YYFINAL, yychar, yys);
+            }
+#endif
+        }
+        if (yychar == 0) goto yyaccept;
+        goto yyloop;
+    }
+    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
+        yystate = yytable[yyn];
+    else
+        yystate = yydgoto[yym];
+#if YYDEBUG
+    if (yydebug)
+        printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yyssp, yystate);
+#endif
+    if (yyssp >= yyss + yystacksize - 1)
+    {
+        goto yyoverflow;
+    }
+    *++yyssp = yystate;
+    *++yyvsp = yyval;
+    goto yyloop;
+yyoverflow:
+    yyerror("yacc stack overflow");
+yyabort:
+    return (1);
+yyaccept:
+    return (0);
+}
+#define yy_create_buffer fortran_create_buffer
+#define yy_delete_buffer fortran_delete_buffer
+#define yy_scan_buffer fortran_scan_buffer
+#define yy_scan_string fortran_scan_string
+#define yy_scan_bytes fortran_scan_bytes
+#define yy_flex_debug fortran_flex_debug
+#define yy_init_buffer fortran_init_buffer
+#define yy_flush_buffer fortran_flush_buffer
+#define yy_load_buffer_state fortran_load_buffer_state
+#define yy_switch_to_buffer fortran_switch_to_buffer
+#define yyin fortranin
+#define yyleng fortranleng
+#define yylex fortranlex
+#define yyout fortranout
+#define yyrestart fortranrestart
+#define yytext fortrantext
+#define yywrap fortranwrap
+
+#line 20 "fortran.yy.c"
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header$
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif	/* __STDC__ */
+#endif	/* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator).  This
+ * avoids problems with code like:
+ *
+ * 	if ( condition_holds )
+ *		yyless( 5 );
+ *	else
+ *		do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		*yy_cp = yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
+		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+	};
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars;		/* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1;		/* whether we need to initialize */
+static int yy_start = 0;	/* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin.  A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	yytext_ptr = yy_bp; \
+	yyleng = (int) (yy_cp - yy_bp); \
+	yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+	yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 164
+#define YY_END_OF_BUFFER 165
+static yyconst short int yy_accept[915] =
+    {   0,
+        0,    0,    0,    0,    0,    0,  165,  164,  157,  153,
+      156,  163,  147,  146,  148,  159,  147,  148,  148,  149,
+      144,  133,  145,  132,  151,  150,  152,  164,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  157,  153,  156,
+      163,  145,  139,  139,  164,    0,    0,  157,  158,    0,
+      160,  156,  163,  163,  163,    0,  137,    0,    0,  159,
+      159,  159,  159,    0,    0,    0,  136,    0,    0,  127,
+       27,    0,  140,    0,    0,    0,    0,    0,    0,    0,
+      128,    0,  145,   26,  161,    0,  139,    1,  139,  139,
+
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,   42,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,   92,  139,   81,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  157,  155,    0,  155,    0,
+        0,  158,  154,  155,    0,  163,  162,  163,  163,  155,
+      145,    7,  139,  139,    0,    0,  163,  163,    0,    0,
+      159,  159,    0,    0,    0,    0,  135,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+
+        0,    0,  143,  140,    0,    0,    0,  161,  138,    0,
+      139,  139,  119,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  110,  139,  139,  139,    0,  139,  139,
+      139,  139,   17,  139,  139,  109,  139,  139,  139,  139,
+      139,    0,  139,  139,  139,  139,  139,  106,  139,  116,
+       94,  139,  120,  139,  139,  139,  139,  139,  139,   85,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  113,  139,  139,  139,  139,  117,  139,
+      139,  139,   19,  139,  139,  157,  155,    0,  158,    0,
+        0,    0,  155,    0,  155,  163,  163,  145,    7,    7,
+
+        7,    7,  139,  139,    0,    0,  163,  163,    0,    0,
+      159,  159,    0,    0,    0,    0,  141,    0,  140,    0,
+      142,    0,   28,   30,   29,   32,   31,   33,    0,   35,
+        0,  140,    0,  141,    0,  140,    0,  142,    0,  138,
+        0,  139,  139,  112,  139,  115,  118,   23,  100,  139,
+      139,  139,  139,  139,  111,   82,  139,  139,    0,  139,
+      139,  139,   90,    0,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,   72,  139,  139,  139,  139,  139,
+        0,   84,  139,  139,  139,  139,  139,  139,   64,  139,
+      139,  139,    0,  105,  139,  139,  139,  139,  107,   22,
+
+       59,   70,  139,  139,  139,  139,  139,  139,  139,  139,
+       75,   43,  139,  139,  139,   67,  139,  121,  114,   98,
+       53,  139,    0,   93,   95,  139,   88,   97,  139,  139,
+      157,  155,  158,    0,    0,  155,    0,  155,  163,  163,
+      145,    7,    7,  139,   68,    0,    0,  163,  163,    0,
+        0,  159,  159,    0,    0,   37,   34,   36,    0,  138,
+        0,  138,  139,  139,  139,    0,  139,  139,   48,  139,
+      139,  139,  139,  139,    0,  139,  139,  139,    0,  139,
+      139,    0,    0,    0,    0,    0,    0,    0,    0,   41,
+      139,   91,  139,  139,  139,  139,  139,  139,  139,  139,
+
+      139,  139,    0,    1,  108,  139,  139,   84,  139,  139,
+       86,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,   51,  139,   73,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,   54,   77,  157,
+      155,  158,    0,   68,  155,    0,  155,  163,  163,  145,
+        7,    6,  139,    0,   24,  163,   24,    0,   24,   24,
+      159,   24,    0,   24,   24,   24,  139,   24,   24,    1,
+       24,  139,    0,  139,  139,   61,  139,  139,  139,  139,
+        0,  139,  139,  134,    0,    0,   89,  139,   41,    0,
+       91,    0,    0,    0,    0,    0,    0,    0,  139,  139,
+
+      139,  139,  139,  139,  139,  139,  139,    0,    1,  139,
+      103,  129,  139,  139,  139,  139,  139,   63,  139,  139,
+      139,  123,   96,  122,  124,   38,  139,  139,  139,  139,
+      139,  139,   79,   12,   71,   20,  139,  139,   78,  157,
+      155,  158,    0,  155,  163,   24,    7,    6,    6,  139,
+       25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
+        1,   25,  139,    0,  139,  139,   57,  139,  139,  139,
+        0,    0,  139,  139,   39,   89,    0,  139,    0,    0,
+        0,    0,    0,    0,    0,    0,  139,  139,  139,  139,
+      139,  139,   69,  139,  139,  104,  139,  139,  139,   18,
+
+       49,   44,  139,  139,   45,    0,  139,  139,  139,  139,
+       65,   80,    9,    0,  139,  139,    0,   25,    7,  139,
+      139,   10,    0,  139,  139,   83,  139,  139,   39,    0,
+        0,  139,  139,    0,  139,    0,    0,    0,    0,    0,
+        0,   69,    0,  139,  139,  139,  139,  139,  139,   55,
+      139,   62,   13,   21,  139,  139,    0,  139,   76,   66,
+      139,    0,  139,  139,    0,    7,   58,  139,    0,  139,
+       46,  139,   50,    0,    0,  139,  139,    0,   56,    0,
+        0,    0,    0,    0,    0,   55,  139,  139,   40,  139,
+      102,  139,  139,  125,   87,    0,  139,   60,    0,  139,
+
+      139,   58,    7,    7,    7,  139,    0,  139,   11,    0,
+        0,  139,  139,   56,    0,    0,   40,    0,  102,    0,
+      139,  139,   15,  139,  139,    0,  139,    0,   99,    8,
+        7,    7,    7,    7,   47,    0,  101,    0,    0,  139,
+      139,    0,    0,   15,    0,   16,  139,  139,   52,    0,
+      139,   99,    7,    7,    7,    5,  101,    0,    0,  139,
+      139,   16,    0,    0,  126,  139,    0,  139,    7,    7,
+        7,    0,    0,  131,  139,  126,    0,   14,    0,  139,
+        4,    7,    7,  131,    0,  139,   14,    0,  139,    7,
+        7,    0,  130,    0,   74,    7,    7,  130,   74,    7,
+
+        7,    7,    7,    7,    7,    7,    7,    2,    7,    7,
+        7,    7,    3,    0
+    } ;
+
+static yyconst int yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    4,    5,    6,    1,    7,    8,    9,   10,   11,
+       12,   13,   14,   15,   16,   17,   18,   19,   19,   19,
+       19,   19,   19,   19,   19,   19,   19,   20,   21,   22,
+       23,   24,    1,    1,   29,   30,   31,   32,   33,   34,
+       35,   36,   37,   38,   39,   40,   41,   42,   43,   44,
+       45,   46,   47,   48,   49,   50,   51,   52,   53,   38,
+       25,    1,   26,   27,   28,    1,   29,   30,   31,   32,
+
+       33,   34,   35,   36,   37,   38,   39,   40,   41,   42,
+       43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
+       53,   38,   54,   54,   54,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst int yy_meta[55] =
+    {   0,
+        1,    1,    2,    1,    1,    3,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    4,    1,    5,    1,
+        1,    1,    5,    1,    1,    1,    1,    5,    4,    5,
+        5,    5,    5,    4,    4,    5,    5,    5,    5,    4,
+        4,    4,    4,    5,    5,    4,    4,    4,    4,    5,
+        5,    5,    5,    3
+    } ;
+
+static yyconst short int yy_base[940] =
+    {   0,
+        0,   53,    0,    0,    0,   57, 2260,   29,   62,   65,
+       66,   31,   65,   39,   41,   75,   82,   63,   69,   46,
+      129,   74,   87,   59,   64,   91,   84,   93,  117,  165,
+      113,  150,  149,  171,  130,  176,  113,  133,  186,  195,
+      199,  210,  104,  218,  229,  235,  245,  240,  200,  290,
+      249,  281,   76,  267, 2926, 2212, 2190,  124,  223,  302,
+     2926,  232,    0, 2180, 2158, 2195, 2192,  123,  224, 2193,
+     2185,  177,  216,  309,  323,  313, 2926,  325,  327, 2926,
+     2926,  283,  320, 2145, 2141,  307,  308,  314, 2126, 2111,
+     2926,  326,  325, 2926,    0, 2134,  343, 2926,  344,  351,
+
+      358,  359,  366,  367,  374,  379,  382,  395,  396,  386,
+      389,  419,  424,  447,  427,  435,  436,  452,  455,  460,
+      467,  468,  485,  491,  468,  236,  476,  481,  496,  478,
+      499,  505,  511,  514,  523,  524,  533,  373,  536,  539,
+      549,  558,  561,  563,  577,  585,  582,  594,  602,  607,
+      608,  610,  624,  626,  623,  660,  671, 2149,   86, 2097,
+      255,  679, 2926,  690,  360, 2131, 2926,  343,  302,  570,
+      681,  675,  681,  659, 2092, 2077, 2078, 2067,  197,  343,
+      117,  265,  385,  722,  731,  453, 2926,  702,  727,  580,
+      729,  730, 2083, 2097, 2084, 2083, 2071, 2067, 2050, 2018,
+
+     2048, 2012, 2926,  591,  736,  737,  743,    0,  407,  461,
+      721,  723,  669,  726,  738,  741,  750,  740,  758,  753,
+      756,  768,  770,  783,  784,  785,  793,  764,  805,  802,
+      807,  810,  857,  808,  820,  825,  833,  838,  851,  835,
+      859,  530,  869,  874,  879,  884,  887,  893,  906,  903,
+      905,  954,  942,  915,  920,  929,  923,  937,  938,  951,
+      963,  965,  973,  981,  989,  990, 1003, 1004, 1012,  953,
+     1021, 1022, 1002, 1027, 1030, 1035, 1036, 1083, 1052, 1055,
+     1049, 1061, 1064, 1067, 1070, 1115, 1121, 1941, 1131, 1989,
+     1936, 1933, 1139,  678,  883,  347,  432, 1112,    0,  507,
+
+     1941, 1934, 1101, 1117, 1916, 1916, 1901, 1912,  410,  455,
+      429,  165,  814, 1150, 1163, 1922, 1921, 1914, 1910, 1907,
+     1878, 1863, 2926, 2926, 2926, 2926, 2926, 2926, 1856, 2926,
+     1851,  951, 1845, 1841, 1818, 1801, 1783, 1778, 1000,  582,
+     1161, 1120, 1141, 1144, 1162, 1146, 1147, 1161, 1198, 1174,
+     1171, 1177, 1187, 1189, 1192, 1195, 1204, 1209, 1758, 1218,
+     1217, 1223, 1270, 1320, 1232, 1240, 1244, 1250, 1253, 1267,
+     1265, 1289, 1286, 1266, 1283, 1295, 1336, 1298, 1318, 1312,
+     1717, 1321, 1326, 1335, 1338, 1344, 1354, 1353, 1362, 1372,
+     1370, 1375,  976, 2926, 1378, 1388, 1387, 1393, 1401, 1402,
+
+     1403, 1411, 1417, 1425, 1419, 1420, 1433, 1442, 1441, 1441,
+     1447, 1455, 1456, 1459, 1467, 1472, 1475, 1473, 1481, 1487,
+     1489, 1495, 1532, 2926, 1504, 1507, 1509, 1510, 1524, 1525,
+     1559, 1570, 1578, 1706, 1717, 1589,  906, 1118,  442,  542,
+     1264, 1698, 1686, 1525, 1540, 1696,    0, 1689,    0,  585,
+     1712,  601, 1696, 1586,  875, 2926, 2926, 2926, 1677, 1674,
+     1621, 1617, 1566, 1637, 1568,  861, 1567, 1586, 1584, 1587,
+     1659, 1589, 1660, 1662, 1590, 1665, 1675, 1677, 1391, 1690,
+     1691, 1582, 1564,  309, 1563, 1556,  505, 1533, 1549, 1693,
+     1696, 1699, 1703, 1711, 1709, 1721, 1719, 1727, 1729, 1739,
+
+     1768, 1739, 1524, 2926, 1744, 1745, 1751, 2926, 1761, 1764,
+     1763, 1768, 1780, 1779, 1784, 1789, 1801, 1798, 1799, 1807,
+     1815, 1821, 1814, 1824, 1836, 1830, 1842, 1839, 1842, 1854,
+     1856, 1855, 1859, 1874, 1870, 1873, 1871, 1886, 1887, 1923,
+     1934, 1942, 1552, 2926, 1953,  925, 1053,  645, 1575, 1933,
+     1539,  712, 1916,    0, 2926,    0,    0, 1559, 1542, 1526,
+     1522, 1517, 1341, 1886, 1958, 2926, 2001, 1493, 1289, 2926,
+     1697, 1922, 1478, 1935, 1937, 1943, 1952, 1949, 2025, 1951,
+     1458, 2055, 2027, 2024, 1463, 1452, 2026, 2043, 2926, 1440,
+     2926, 1432, 1443, 1431, 1432, 1428, 1409, 1411, 2046, 2045,
+
+     2058, 2062, 2063, 2075, 2078, 2077, 2087, 1802, 2926, 2096,
+     2926, 2093, 2101, 2093, 2112, 2113, 2113, 2116, 2134, 2131,
+     2139, 2129, 2147, 2148, 2149, 2163, 2155, 2168, 2169, 2173,
+     2185, 2187, 2179, 2188, 2197, 2200, 2222, 2200, 2201, 2250,
+     2254, 2260, 1406, 2265, 1431, 1426, 1377,    0,  806, 2205,
+     2926,    0, 1402, 1388, 1377, 2269, 2273, 2926, 1358, 1761,
+     2926, 1829, 2270, 1339, 2271, 2278, 2062, 2287, 2295, 2298,
+     1320, 2303, 2306, 2215, 2284, 2926, 1315, 2293, 1314, 1296,
+     1279, 1282, 1272, 1250, 1262, 1245, 2294, 2298, 2308, 2310,
+     2320, 2318, 2323, 2335, 2338, 2926, 2332, 2340, 2339, 2348,
+
+     2351, 2353, 2363, 2354, 2366, 2166, 2370, 2369, 2378, 2386,
+     2383, 2384, 2392, 1374, 2404, 2398, 1240, 1276, 1236, 2406,
+     2407, 2401, 1234, 2419, 2423, 2424, 2427, 2437, 2926, 1216,
+     1210, 2439, 2449, 1204, 2454, 1197, 1196, 1198, 1188, 1197,
+     1180, 2926, 1184, 2449, 2464, 2455, 2465, 2467, 2470, 2473,
+     2481, 2487, 2489, 2490, 2495, 2503, 1170, 2504, 2509, 2517,
+     2518, 1184, 2519, 2527, 1165, 1879, 2532, 2535, 1158, 2544,
+     2541, 2547, 2550, 1160, 1153, 2551, 2560, 1149, 2557, 1139,
+     1137, 1123, 1126, 1103, 1098, 2926, 2563, 2573, 2572, 2578,
+     2581, 2586, 2596, 2587, 2595, 1096, 2605, 2604, 1081, 2613,
+
+     2614, 2926,  721, 1068, 1069, 2622, 1055, 2619, 2627, 1037,
+     1046, 2628, 2636, 2926, 1033, 1039, 2926, 1004, 2926,  994,
+     2639, 2647, 2644, 2650, 2655, 1005, 2658,  999, 2660, 2663,
+      998,  994,  988,  966, 2668,  958, 2673,  958,  952, 2676,
+     2678,  930,  938, 2926,  924, 2686, 2694, 2693, 2694,  887,
+     2709, 2926,  860,  858,  869,    0, 2926,  841,  813, 2708,
+     2708, 2926,  815,  798, 2709, 2725,  802, 2722,  763,  753,
+      747,  695,  702, 2724, 2737, 2926,  687, 2738,  652, 2741,
+        0,  641,  643, 2926,  623, 2742, 2926,  589, 2756,  588,
+      575,  527, 2755,  530, 2757,  509,  508, 2926, 2926,  500,
+
+      474,  473,  425,  431,  375,  352,  241,    0,  214,  224,
+      225,   54,    0, 2926, 2803, 2808, 2813, 2818, 2823, 2825,
+     2830, 2835, 2840, 2845, 2850, 2855, 2860, 2865, 2870, 2875,
+     2880, 2885, 2890, 2895, 2900, 2905, 2910, 2915, 2920
+    } ;
+
+static yyconst short int yy_def[940] =
+    {   0,
+      914,    1,  915,  915,    1,    1,  914,  914,  914,  914,
+      914,  916,  917,  914,  914,  918,  919,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  920,  920,
+       30,   31,   31,   31,   31,   33,   36,   36,   31,   31,
+       36,   31,   36,   42,   42,   36,   36,  914,  914,  914,
+      921,  914,   31,   31,  914,  914,  914,  914,  914,  914,
+      914,  914,  916,  916,  916,  917,  917,  917,  917,  918,
+      914,  918,  918,  919,  922,  919,  914,  919,  919,  914,
+      914,   21,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  923,  914,  914,  924,  914,  920,  914,  920,  920,
+
+      920,  920,  920,  920,  920,  920,  920,  920,  920,   36,
+       36,  920,  920,  920,  920,  920,  920,  920,  920,  920,
+      920,  920,  920,  119,  119,  119,  119,  119,  119,  119,
+      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
+      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
+      119,  119,  119,  119,  119,  914,  914,  925,  914,  914,
+      914,  914,  914,  914,  914,  921,  914,  921,  921,  914,
+      914,  926,   36,  119,  914,  914,  916,  916,  917,  917,
+      918,  918,  922,  922,  922,  922,  914,  919,  919,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+
+      914,  914,  914,  914,  914,  914,  914,  924,  914,  914,
+      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
+      119,  119,  119,  119,  119,  119,  119,  914,  119,  119,
+      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
+      119,  914,  119,  119,  119,  119,  119,  119,  119,  119,
+      119,  114,  114,  119,  119,  119,  119,  119,  119,  119,
+      119,  119,  119,  119,  119,  119,  119,  119,  119,  119,
+      119,  119,  119,  119,  119,  119,  119,  114,  119,  119,
+      119,  119,  119,  119,  119,  914,  914,  914,  914,  925,
+      914,  914,  914,  914,  914,  921,  921,  914,  926,  926,
+
+      926,  926,  119,  119,  914,  914,  916,  916,  917,  917,
+      918,  918,  922,  919,  919,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  119,  119,  119,  119,  119,  119,  119,  114,  119,
+      119,  119,  119,  119,  119,  119,  119,  119,  914,  119,
+      119,  119,  114,  914,  119,  119,   36,  119,  119,  119,
+      119,  119,  119,  119,  119,  119,  114,  119,  119,  119,
+      914,  119,  119,  119,  119,  119,  119,  119,  119,  119,
+      119,  119,  914,  914,  119,  119,  119,  119,  119,  119,
+
+      119,  119,  119,  119,  119,  119,  119,  119,  387,  119,
+      119,  119,  119,  387,  387,  387,  387,  387,  387,  387,
+      387,  387,  914,  914,  387,  387,  387,  387,  387,  387,
+      914,  914,  914,  914,  914,  914,  914,  914,  921,  921,
+      914,  926,  926,  119,  119,  914,  927,  916,  928,  917,
+      929,  918,  930,  919,  931,  914,  914,  914,  914,  914,
+      914,  914,  119,  914,  119,  914,  119,  119,  119,  387,
+      387,  387,  387,  387,  914,  387,  387,  387,  914,  387,
+      387,  914,  914,  914,  914,  914,  914,  914,  914,  387,
+      387,  387,  119,  119,  119,  119,  119,  119,  119,  119,
+
+      114,  387,  914,  914,  387,  119,  119,  914,  119,  119,
+      119,  387,  387,  119,  119,  387,  387,  387,  387,  387,
+      387,  387,  119,  387,  387,  387,  387,  387,  119,  119,
+      119,  119,  387,  387,  119,  119,  119,  119,  119,  914,
+      914,  914,  914,  914,  914,  914,  914,  921,  932,  914,
+      926,  933,  119,  934,  914,  935,  916,  936,  917,  917,
+      937,  918,  938,  919,  919,  914,  914,  914,  920,  914,
+      920,  119,  914,  119,  119,  119,  119,  119,  119,  119,
+      914,  119,  119,  119,  914,  914,  119,  119,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  119,  119,
+
+      119,  387,  387,  387,  387,  387,  387,  914,  914,  387,
+      914,  387,  387,  119,  119,  119,  387,  387,  387,  387,
+      387,  387,  387,  387,  387,  119,  119,  119,  119,  387,
+      387,  387,  387,  387,  387,  387,  114,  119,  119,  914,
+      914,  914,  914,  914,  939,  921,  926,  933,  933,  387,
+      914,  916,  917,  917,  918,  919,  919,  914,  914,  920,
+      914,  920,  920,  914,  920,  920,  920,  920,  920,  920,
+      914,  914,  920,  387,  387,  914,  914,  387,  914,  914,
+      914,  914,  914,  914,  914,  914,  119,  387,  387,  387,
+      387,  387,  387,  387,  387,  914,  387,  387,  119,  119,
+
+      119,  119,  119,  119,  119,  914,  387,  119,  119,  119,
+      119,  119,  119,  914,  119,  119,  914,  921,  926,  119,
+      119,  119,  914,  119,  387,  387,  119,  387,  914,  914,
+      914,  387,  387,  914,  387,  914,  914,  914,  914,  914,
+      914,  914,  914,  119,  119,  119,  119,  119,  119,  119,
+      387,  387,  387,  387,  387,  387,  914,  387,  387,  387,
+      387,  914,  387,  387,  914,  926,  387,  387,  914,  387,
+      387,  387,  387,  914,  914,  119,  119,  914,  119,  914,
+      914,  914,  914,  914,  914,  914,  119,  119,  119,  119,
+      119,  119,  119,  119,  119,  914,  119,  119,  914,  119,
+
+      119,  914,  926,  926,  926,  119,  914,  119,  119,  914,
+      914,  119,  119,  914,  914,  914,  914,  914,  914,  914,
+      387,  387,  387,  119,  119,  914,  119,  914,  119,  119,
+      926,  926,  926,  926,  119,  914,  119,  914,  914,  119,
+      119,  914,  914,  914,  914,  119,  119,  387,  387,  914,
+      387,  914,  926,  926,  926,  926,  914,  914,  914,  387,
+      119,  914,  914,  914,  119,  119,  914,  119,  926,  926,
+      926,  914,  914,  119,  119,  914,  914,  119,  914,  387,
+      926,  926,  926,  914,  914,  387,  914,  914,  387,  926,
+      926,  914,  387,  914,  387,  926,  926,  914,  914,  926,
+
+      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
+      926,  926,  926,    0,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914
+    } ;
+
+static yyconst short int yy_nxt[2981] =
+    {   0,
+        8,    9,   10,   11,   12,   13,   14,   15,   16,   17,
+       18,   15,   19,   15,   20,   15,   21,   22,   23,   15,
+       24,   25,   26,   27,   15,   15,   28,   29,   30,   29,
+       31,   32,   33,   34,   35,   29,   36,   29,   37,   38,
+       39,   40,   41,   42,   29,   43,   44,   45,   46,   29,
+       47,   29,   29,    8,   48,   49,   50,   51,   48,   49,
+       50,   51,   56,   58,   64,   59,   60,   59,   60,   62,
+       67,   52,   56,   61,   56,   52,   57,   71,   65,   56,
+       80,   81,  172,   53,   75,   91,   57,   53,   57,  159,
+       76,   77,   56,   57,  159,   56,   56,   56,   68,   56,
+
+       54,  913,   56,   92,   54,   93,   57,   56,   72,   57,
+       57,   57,   69,   57,   94,   78,   57,   56,  173,   71,
+       56,   57,   73,   95,   56,   58,   56,   59,   67,   79,
+       82,   57,   82,   96,   57,   97,  143,  100,   57,   98,
+       57,  107,   99,   99,   99,   99,  100,   83,  108,  128,
+      100,  179,  109,   99,   99,  110,  311,   84,   99,   99,
+      101,   85,   56,   86,  101,   99,  100,   71,   87,   99,
+       88,   89,  124,   99,   99,  129,   57,   99,  111,   71,
+       90,   96,  112,   97,   99,   99,  113,   98,  116,   99,
+      117,   99,  114,  118,  102,  103,  115,  453,  100,   99,
+
+      119,   60,   67,   60,  104,  181,   99,  120,   61,  125,
+      121,  105,  106,  122,  130,   99,  126,  127,   71,  123,
+       99,   99,  131,  133,   59,   99,   59,   99,  132,   67,
+       99,  134,  100,   59,   99,   62,  309,  135,  139,   99,
+      136,  156,  137,  157,  158,   99,  144,  138,  159,   99,
+      145,  167,  140,  912,  146,  141,  911,  150,  142,  910,
+       99,  182,  147,   99,  151,  148,  149,   71,  100,  180,
+      160,   99,   99,   56,  152,   99,   99,   99,  100,  244,
+      154,  153,  168,   99,  170,   99,   99,  161,  909,  159,
+      155,  162,  163,  164,  158,  150,  169,   92,  159,  171,
+
+      176,  914,  151,   60,  167,   60,   99,  292,  165,   99,
+       61,   75,  152,  312,   56,   75,  914,   76,   77,  174,
+      160,   76,   77,   56,  184,  185,  184,   75,   57,   75,
+      914,  186,  187,   76,   77,   76,   77,  161,   83,  195,
+      197,   92,  591,   93,  204,  167,  199,  297,   67,  167,
+      592,  190,  191,  188,  196,  198,  200,  205,  206,  210,
+       96,   97,   97,  295,  192,   98,   98,   96,  159,   97,
+      207,  296,  189,   98,   96,   96,   97,   97,  294,  211,
+       98,   98,   96,   96,   97,   97,  439,  185,   98,   98,
+       96,  310,   97,  313,  187,   96,   98,   97,   96,  908,
+
+       97,   98,  907,  212,   98,  213,  215,  217,  214,   99,
+      216,   96,   96,   97,   97,   67,   99,   98,   98,   99,
+      260,  218,   99,  220,  212,  209,  222,  223,  219,   99,
+       99,   71,  224,   99,  167,   96,  225,   97,  221,  339,
+       96,   98,   97,   96,  167,   97,   98,  226,  228,   98,
+      228,   96,   96,   97,   97,  185,  450,   98,   98,  906,
+       67,  313,  187,   96,  227,   97,  231,  233,   96,   98,
+       97,   96,  905,   97,   98,  452,   96,   98,   97,  340,
+      440,  232,   98,   96,   96,   97,   97,  451,  548,   98,
+       98,  235,  242,  341,  242,  229,  211,  230,  236,  238,
+
+      234,   96,  237,   97,   99,  904,  245,   98,  300,  239,
+      300,   99,   99,  240,   99,   99,  903,   99,  246,   99,
+      247,   99,  249,  248,   99,   99,  241,   99,   99,  251,
+      250,  242,   99,  242,   99,   99,  253,  595,  243,   99,
+      252,   99,   99,   99,  167,  902,   99,   99,   99,  901,
+       99,  254,   99,  596,   99,  255,  900,   99,   99,   99,
+       99,   99,  899,  257,  256,  258,   99,   99,  898,   99,
+       99,   99,   99,  295,  549,  263,   99,  381,  159,   99,
+      259,  261,   99,   99,  262,  264,   99,  266,  294,  267,
+       67,  265,   99,  316,   99,  316,   99,   99,  317,   99,
+
+      340,   99,  897,   71,   99,   99,   99,  268,  269,  332,
+       99,  270,  271,   99,  339,  896,  272,  558,   99,  273,
+       99,   99,  190,  191,   99,   99,  274,  275,   99,   99,
+       99,  277,   99,  561,  894,  192,  276,   99,   99,  212,
+      281,   99,  278,   99,   99,   99,  282,  167,  279,   99,
+       99,   99,  280,   99,   99,   99,  283,   99,  284,  285,
+       99,  286,   99,  287,  158,  892,   99,   99,  159,   99,
+       99,   99,  289,   99,  287,  158,  300,  645,  300,  159,
+      289,  438,  287,  158,  295,  891,  159,  159,  890,  159,
+      160,  289,  163,  293,  158,   99,  437,   92,  159,  298,
+
+      888,  160,  304,  301,   75,   99,   99,  288,  294,  160,
+       76,   77,   99,  649,   99,  649,   99,  302,  288,  887,
+      160,  222,  303,  184,  185,  184,  288,  224,   99,   75,
+      186,  187,  184,  185,  184,   76,   77,  288,  885,  186,
+      187,  314,  318,  320,  318,  320,  884,  319,  321,  333,
+      335,  333,  335,  831,  334,  336,  337,   99,  337,   99,
+      342,  338,   99,  832,   99,  228,   99,  228,   99,   99,
+       99,  343,  344,   99,   99,  315,   99,   99,  883,  348,
+      345,   99,  346,   99,   99,   99,   99,   99,   99,   99,
+      349,  347,   99,   99,   99,  882,   99,   99,  350,   99,
+
+       99,   99,  351,   99,   99,   99,   99,  649,  352,  649,
+      881,  353,  356,   99,  359,   99,  185,  354,  355,   99,
+       99,   99,  313,  187,  357,  358,   99,   99,   99,   99,
+       99,   99,   99,  879,  360,  362,   99,  361,   99,  877,
+       99,   99,  363,   99,  373,   99,   99,  876,   99,   99,
+       99,   99,   99,   99,   99,   99,   99,   99,  364,  873,
+      364,   99,  466,   99,  466,  376,  374,  375,   99,   99,
+      377,   99,   99,  872,   99,  379,   99,   75,   99,  378,
+       99,   99,   99,  565,  566,   99,  438,   99,  365,  380,
+      366,  159,  573,  367,   99,   99,  871,  368,   99,  870,
+
+      369,  437,   99,  370,  371,   99,   99,  372,  869,  547,
+       99,  382,   99,  383,  159,   99,   99,   99,  384,  867,
+       99,   99,   99,   99,  546,  387,   99,   99,  159,   99,
+       99,   99,  385,  159,   99,  386,   99,  389,  388,  390,
+       99,   99,   99,  914,  391,  914,   99,  398,   99,   99,
+       99,   99,   99,   99,  392,  393,   99,  393,   99,   99,
+      864,  400,   99,   99,  394,   99,   99,  399,  863,  332,
+       99,  862,   99,   99,  403,  401,   99,  393,  402,  393,
+       99,   99,  190,  191,   99,   99,  394,   99,  859,  415,
+      397,  404,   99,  395,   99,  192,   99,  858,   99,   99,
+
+       99,   99,   99,  396,   99,  857,   99,  856,   99,   99,
+       99,  405,   99,  459,  406,  459,   99,   99,  460,  855,
+       99,  854,  407,  409,   99,   99,   99,  853,   99,  410,
+      408,  852,   99,   99,  411,  850,   99,   99,   99,   99,
+       99,  845,  412,  418,  844,   99,   99,   99,   99,   99,
+       99,   99,  413,  416,  417,   99,  159,   99,   99,   99,
+      414,  159,  419,   99,   99,   99,   99,  843,   99,   99,
+       99,   99,   99,   99,   99,  842,  839,  420,  421,   99,
+      838,  422,   99,   99,  423,   99,  423,  425,   99,  426,
+      427,   99,   99,  424,  836,   99,   99,   99,   99,   99,
+
+       99,  428,   99,   99,   99,  834,   99,   99,   99,  833,
+       99,   99,  429,   99,   99,  438,  431,  430,  432,  158,
+      159,  547,  433,  159,  432,  158,  159,  828,   92,  159,
+      441,   99,  433,   99,  432,  158,  546,   99,  826,  159,
+      433,  163,  436,  158,   99,  160,  820,  159,  444,  445,
+      819,  160,   75,   99,  818,  817,   99,  437,   76,   77,
+       99,  160,  288,   99,   99,   75,  463,   99,  288,  160,
+      816,   76,   77,  464,  461,  815,  461,   99,  288,  462,
+       99,  814,   99,   99,   99,  811,  288,   99,   99,   99,
+       99,   99,  465,   99,   99,  455,  454,   99,   99,  466,
+
+      810,  466,  468,  469,   99,   99,  807,   99,   99,   99,
+       99,  802,  799,   99,   99,  796,  786,   99,   99,  470,
+       99,   99,  785,   99,   99,  472,  471,  784,   99,  467,
+       99,   99,   99,  783,   99,   99,   99,  782,   99,   99,
+       99,  781,   99,  473,  780,   99,   99,   99,   99,  778,
+      474,   99,   99,  477,   99,  775,   99,  476,  774,   99,
+       99,   99,  769,  766,   99,   99,   99,  547,   99,  478,
+       99,  479,  159,  479,  490,   99,   99,  492,  167,   99,
+       92,  765,  550,   99,   99,  493,   99,   99,  491,   99,
+      743,   99,  494,   99,  742,  741,   99,   99,  495,  496,
+
+       99,   99,   99,   99,  740,  210,  480,   97,   99,   99,
+       99,   98,   99,  501,   99,  497,  739,  498,   99,   99,
+      481,  364,   99,  364,  499,   99,   99,  738,  737,   99,
+       99,   99,   99,   99,   99,  500,   99,  503,   99,  503,
+      502,   99,   99,   75,  736,  505,  506,  734,   99,  657,
+      658,  482,  729,  483,   99,   99,  484,   99,  504,  507,
+      485,   99,  509,  486,   99,   99,  487,  488,   99,   99,
+      489,   99,  723,   99,   99,  714,  209,  714,   99,   71,
+      512,   99,   99,  510,   99,  511,   99,   99,  513,  516,
+       99,   99,  479,   67,  479,  514,   99,   99,   99,  515,
+
+       99,   99,  517,  519,  762,   99,   99,   67,   99,   99,
+      719,   99,  518,   99,   99,   99,  521,   99,   99,   99,
+      520,   99,   99,   99,   99,   99,  522,  585,  167,   99,
+       99,   99,  523,  167,   99,   99,   99,   99,   99,   99,
+       99,  586,  717,  686,   99,   99,   99,   99,   99,   99,
+       99,  526,  685,   99,   99,   99,   99,  684,   99,  524,
+       99,   99,   99,   99,   99,  525,   99,  527,   99,   99,
+      529,  683,   99,  682,  681,   99,   99,  531,   99,  680,
+      528,  679,   99,   99,   99,   99,  530,  677,   99,   99,
+       99,   99,   99,   99,   99,  532,  676,  671,   99,   99,
+
+       99,   99,   99,   99,  533,  535,   99,   99,  534,   99,
+      664,  209,   99,   99,   99,   99,   99,   99,   99,   71,
+       99,   99,   99,   99,   71,  503,   99,  503,   99,   99,
+       99,   67,   99,  423,   99,  423,   99,  536,   99,  537,
+       99,   99,  424,   99,   99,   99,  611,   67,   99,   99,
+       99,   99,   99,  553,   99,   99,  538,  539,   99,   99,
+      540,  472,  541,  158,  654,   99,   99,  159,   99,   99,
+       99,  542,   99,  541,  158,  647,   99,  167,  159,  542,
+      643,  541,  158,   99,  598,  597,  159,   99,   75,  160,
+      542,  163,  545,  158,   76,   77,  572,  159,  567,  574,
+
+      160,  594,   99,   99,   99,  593,  288,  546,  160,   99,
+       99,   99,  590,   99,   99,   99,  575,  288,  563,  160,
+       99,   99,   99,   99,  589,  288,  581,   99,  576,   99,
+      578,   99,   99,   99,   99,  462,  288,  555,  555,  462,
+      555,  555,  555,  555,  555,  555,  555,  555,  555,  555,
+      555,  555,  555,  568,  555,  569,  555,  555,  555,  570,
+      555,  555,  555,  555,  571,  571,  571,  571,  571,  571,
+      571,  571,  571,  571,  571,  571,  571,  571,  571,  571,
+      571,  571,  571,  571,  571,  571,  571,  571,  571,  571,
+      555,  577,  460,   99,   99,  460,   99,  582,   71,   99,
+
+       99,   99,  579,   99,   99,   99,   99,   99,  580,   99,
+       99,   99,  584,   96,  583,   97,   99,  560,   99,   98,
+       99,  556,   99,  587,   99,   99,  588,   99,  554,  552,
+       99,   99,   99,   99,   99,   99,   99,  599,   99,   99,
+       99,   99,  601,  551,   99,   99,   99,   99,  604,  544,
+      600,  602,   99,  543,   99,   99,   99,   99,   99,  508,
+      603,  606,   99,   99,   99,   99,   99,  607,   99,  608,
+      605,  608,   99,   99,   99,   99,   99,  210,   99,   97,
+      610,   99,   99,   98,   99,   99,   99,  613,   99,   99,
+      609,  614,  612,  475,   99,  615,  338,   99,   99,   99,
+
+       99,  338,   99,  608,   99,  608,   99,   99,   99,   99,
+       99,   99,  617,  616,   99,   99,   99,  619,   99,  336,
+       99,   99,   99,   99,  696,   99,  618,   99,  622,  621,
+      620,   99,   99,   99,   99,   99,  336,  624,  623,   99,
+       99,   99,   99,   99,   99,   96,   99,   97,   99,   99,
+      627,   98,   99,  626,  625,   99,   99,   99,   99,  334,
+       99,   99,   99,  334,   99,  628,   99,  458,  629,   99,
+       99,   99,  457,   99,  630,   99,   99,   99,   99,  456,
+       99,   99,  632,   99,   99,   99,  633,   99,   75,  631,
+       99,   99,   99,   99,   76,   77,  321,   99,   99,   99,
+
+      635,   99,  634,   99,   99,  636,   99,   99,   99,   99,
+      803,  804,  805,   99,   99,   99,   99,  637,  639,   99,
+       99,  638,   99,   99,  640,  321,  641,  158,  319,   99,
+       99,  159,  319,   99,   99,  642,  159,  641,  158,  317,
+      317,  159,  159,  642,  449,  641,  158,  448,  447,   92,
+      159,   93,  650,  160,  642,  163,  644,  158,   99,   99,
+       75,  159,  446,   99,  160,   99,   76,   77,  665,  663,
+      288,   99,  160,   99,  443,  442,  435,  434,   99,   99,
+       99,  288,   99,  160,  666,   99,   99,  670,   99,  288,
+       99,  167,   99,  292,   99,   99,   99,  668,   99,   99,
+
+      288,  651,  651,  667,  651,  651,  651,  651,  651,  651,
+      651,  651,  651,  651,  651,  651,  651,  659,  651,  660,
+      651,  651,  651,  661,  651,  651,  651,  651,  662,  662,
+      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,
+      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,
+      662,  662,  662,  662,  651,  669,  672,  331,  672,  675,
+       99,   99,   99,   99,  330,  329,  328,   99,   99,   99,
+       99,   99,   99,   99,   99,  678,  687,  688,   96,   99,
+       97,   99,   99,  327,   98,  673,   99,  326,   99,   99,
+       99,   99,   99,   99,   99,  691,  690,   99,  674,  325,
+
+      324,   99,   99,   99,   99,   99,  689,   99,   99,   99,
+      693,   99,   99,  323,  322,  308,   99,  307,   99,   99,
+      692,   99,  694,   99,  697,  306,  695,   99,   99,  699,
+       99,  305,   99,  167,   99,   99,   99,   99,   99,  291,
+       99,   99,   99,  698,  700,  701,   99,   99,   99,   99,
+       99,  167,  209,  202,   99,   99,   99,   99,  702,   99,
+       99,   99,  703,   99,  706,   99,  706,  706,   99,  706,
+       99,  201,   99,   99,   99,   99,   99,  704,  705,   99,
+       99,   99,   99,   99,   99,  194,  193,   71,   99,   99,
+       99,   99,   99,   99,   99,   71,  709,   67,   99,   99,
+
+       67,  708,   99,  178,   99,   99,  707,   99,  177,  757,
+       99,   99,   99,   99,   99,   99,  710,  712,  711,   99,
+       99,   99,   99,  714,   99,  714,   99,  713,   99,   99,
+       99,   99,   99,   99,   99,  176,   99,   99,   99,   99,
+      175,   99,   99,   99,   99,   99,  720,  716,   99,   99,
+       99,  640,  715,  642,  158,  642,   99,  641,  158,  914,
+      733,  642,  159,  642,  158,  914,  642,  163,  644,  158,
+       99,   75,   99,  159,  914,   75,  914,   76,   77,  914,
+      160,   76,   77,  914,  160,  914,   96,   96,   97,   97,
+      160,  914,   98,   98,   96,  160,   97,  288,  721,  724,
+
+       98,  288,  722,   96,  672,   97,  672,  288,  914,   98,
+      725,   96,  288,   97,   96,  914,   97,   98,   99,  726,
+       98,  914,   96,  727,   97,   99,  914,   99,   98,   99,
+       99,  914,   99,  730,   99,  914,  914,   99,  735,   99,
+      728,  744,   99,  745,   99,  914,  731,  746,  732,   99,
+      748,   99,   99,   99,   99,  747,  914,   99,  914,   99,
+      749,   99,  914,   99,   99,   99,   99,  750,   99,   99,
+      751,  752,   99,   99,   99,   99,   99,   99,  914,   99,
+       99,  753,   99,   99,   99,   99,  754,   99,  914,   99,
+      756,   99,  914,  755,   99,   99,   99,   99,   99,   99,
+
+       99,   99,   99,  914,   99,   99,   99,  914,  914,   99,
+       99,   99,   99,   99,   99,  758,  759,  760,  761,   99,
+       99,   99,   99,  914,  914,   99,   99,   99,   99,   99,
+       99,   99,  763,   99,  764,   99,  768,   99,  914,   99,
+       99,   99,   99,   99,   99,   99,  914,   99,   99,   99,
+       99,   99,  767,   99,   99,   99,  914,   99,   99,  914,
+      914,  914,   99,   99,   99,   99,   99,  770,  771,   99,
+       99,   99,  914,   99,  772,  914,  914,  914,  773,  776,
+       99,  777,   99,   99,   99,  787,  779,  789,   99,  914,
+       99,   99,   99,  790,   99,   99,   99,  788,   99,   99,
+
+       99,   99,   99,   99,  914,  914,   99,   99,   99,   99,
+       99,   99,   99,   99,  791,   99,   99,   99,  792,  914,
+       99,   99,  793,   99,   99,  914,   99,  794,   99,   99,
+       99,   99,   99,  795,   99,   99,   99,   99,   99,  914,
+       99,  914,  914,   99,   99,   99,  797,  914,   99,   99,
+       99,   99,   99,   99,   99,  914,  914,  914,   99,   99,
+       99,   99,   99,  798,   99,  800,   99,  914,  801,   99,
+      914,  914,   99,   99,  806,   99,   99,   99,   99,  809,
+       99,   99,   99,  808,   99,   99,   99,   99,   99,   99,
+      813,   99,   99,   99,  812,   99,   99,  914,   99,   99,
+
+       99,  822,  914,   99,   99,  821,   99,   99,   99,   99,
+       99,  914,  914,  914,   99,   99,   99,   99,  823,   99,
+       99,   99,   99,   99,   99,   99,  825,  914,   99,   99,
+       99,   99,   99,  824,   99,  827,  914,  914,   99,   99,
+       99,   99,   99,   99,  914,  829,  830,   99,   99,   99,
+       99,   99,   99,  914,  835,   99,   99,   99,   99,  914,
+       99,   99,   99,   99,   99,   99,  837,  840,  914,   99,
+       99,   99,  841,   99,   99,   99,  914,  847,   99,   99,
+      846,   99,  914,   99,   99,   99,  848,  849,   99,   99,
+      851,   99,   99,   99,   99,  914,   99,   99,   99,   99,
+
+      914,   99,   99,   99,   99,   99,   99,   99,  860,   99,
+       99,   99,   99,  914,   99,   99,   99,  914,  914,   99,
+       99,   99,   99,   99,  861,   99,  865,   99,   99,   99,
+       99,  914,  914,   99,  866,   99,  914,   99,   99,   99,
+      868,   99,   99,   99,  875,   99,  914,  914,  914,   99,
+       99,   99,   99,   99,   99,   99,   99,  878,   99,  874,
+       99,   99,  914,  914,  914,   99,  914,   99,   99,   99,
+      880,   99,   99,   99,   99,   99,   99,  914,  914,  886,
+       99,   99,   99,  893,   99,   99,  889,   99,  895,   99,
+       99,   99,  914,  914,  914,  914,   99,   99,   99,  914,
+
+       99,   99,   99,   55,   55,   55,   55,   55,   63,  914,
+       63,   63,   63,   66,  914,   66,   66,   66,   70,   70,
+       70,   70,   70,   74,   74,   74,   74,   74,   99,   99,
+      166,  166,  166,  166,  166,  183,  183,  183,  183,  183,
+      203,  203,  914,  914,  203,  208,  914,  208,  208,  208,
+      290,  290,  290,  290,  290,  299,  914,  299,  299,  299,
+      555,  914,  555,  555,  555,  557,  914,  557,  557,  557,
+      559,  914,  559,  559,  559,  562,  562,  562,  562,  562,
+      564,  564,  564,  564,  564,  646,  646,  646,  646,  646,
+      648,  914,  648,  648,  648,  651,  914,  651,  651,  651,
+
+      652,  914,  652,  652,  652,  653,  914,  653,  653,  653,
+      655,  655,  655,  655,  655,  656,  656,  656,  656,  656,
+      718,  718,  718,  718,  718,    7,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914
+    } ;
+
+static yyconst short int yy_chk[2981] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    2,    2,    2,    2,    6,    6,
+        6,    6,    8,    9,   12,    9,   10,   11,   10,   11,
+       13,    2,   14,   10,   15,    6,    8,   16,   12,   20,
+       18,   19,   53,    2,   17,   22,   14,    6,   15,  159,
+       17,   17,   24,   20,  159,    9,   18,   25,   13,   11,
+
+        2,  912,   19,   23,    6,   23,   24,   22,   16,    9,
+       18,   25,   13,   11,   26,   17,   19,   27,   53,  181,
+       23,   22,   16,   28,   26,   58,   28,   58,   68,   17,
+       21,   27,   21,   29,   23,   29,   43,   43,   26,   29,
+       28,   31,   31,   31,   43,   43,   37,   21,   31,   37,
+       29,   68,   31,   37,   37,   31,  181,   21,   35,   31,
+       31,   21,   21,   21,   29,   35,   38,  312,   21,   35,
+       21,   21,   35,   38,   38,   38,   21,   33,   32,   72,
+       21,   30,   32,   30,   33,   32,   32,   30,   33,   32,
+       33,   33,   32,   33,   30,   30,   32,  312,   30,   34,
+
+       33,   49,  179,   49,   30,   72,   34,   34,   49,   36,
+       34,   30,   30,   34,   39,   36,   36,   36,   73,   34,
+       36,   39,   39,   40,   59,   39,   59,   36,   39,   69,
+       40,   40,   41,   62,   40,   62,  179,   40,   42,   41,
+       41,   48,   41,   48,   48,   42,   44,   41,   48,   42,
+       44,   51,   42,  911,   44,   42,  910,   45,   42,  909,
+       44,   73,   44,   44,   45,   44,   44,  182,   46,   69,
+       48,   45,  126,   48,   45,   46,   46,   45,   47,  126,
+       47,   46,   51,  126,   52,   47,   47,   48,  907,   52,
+       47,   50,   50,   50,   50,   54,   51,   52,   50,   52,
+
+      161,   82,   54,   60,  169,   60,   54,  161,   50,   54,
+       60,   74,   54,  182,   52,   76,   82,   74,   74,   54,
+       50,   76,   76,   50,   75,   75,   75,   78,   52,   79,
+       82,   75,   75,   78,   78,   79,   79,   50,   83,   86,
+       87,   93,  484,   93,   92,  168,   88,  169,  180,  296,
+      484,   83,   83,   78,   86,   87,   88,   92,   92,   97,
+       99,   97,   99,  165,   83,   97,   99,  100,  165,  100,
+       92,  168,   79,  100,  101,  102,  101,  102,  165,  100,
+      101,  102,  103,  104,  103,  104,  296,  183,  103,  104,
+      105,  180,  105,  183,  183,  106,  105,  106,  107,  906,
+
+      107,  106,  905,  101,  107,  102,  104,  106,  103,  138,
+      105,  108,  109,  108,  109,  309,  138,  108,  109,  110,
+      138,  107,  111,  108,  106,  209,  110,  110,  107,  111,
+      111,  311,  110,  110,  297,  112,  111,  112,  109,  209,
+      113,  112,  113,  115,  439,  115,  113,  112,  114,  115,
+      114,  116,  117,  116,  117,  186,  309,  116,  117,  904,
+      310,  186,  186,  114,  113,  114,  115,  117,  118,  114,
+      118,  119,  903,  119,  118,  311,  120,  119,  120,  210,
+      297,  116,  120,  121,  122,  121,  122,  310,  439,  121,
+      122,  119,  124,  210,  124,  114,  125,  114,  119,  120,
+
+      118,  123,  119,  123,  125,  902,  127,  123,  300,  121,
+      300,  125,  127,  122,  130,  125,  901,  128,  127,  127,
+      127,  130,  128,  127,  128,  130,  123,  124,  128,  130,
+      129,  242,  129,  242,  124,  131,  132,  487,  124,  129,
+      131,  132,  131,  129,  440,  900,  131,  133,  132,  897,
+      134,  133,  132,  487,  133,  134,  896,  134,  133,  135,
+      136,  134,  894,  136,  135,  137,  135,  136,  892,  137,
+      135,  136,  139,  170,  440,  140,  137,  242,  170,  139,
+      137,  139,  140,  139,  139,  141,  140,  142,  170,  143,
+      450,  141,  141,  190,  142,  190,  141,  143,  190,  144,
+
+      340,  142,  891,  452,  143,  142,  144,  143,  143,  204,
+      144,  143,  144,  145,  340,  890,  145,  450,  147,  146,
+      145,  146,  204,  204,  145,  147,  146,  147,  146,  147,
+      148,  149,  146,  452,  888,  204,  148,  148,  149,  148,
+      151,  148,  149,  150,  151,  149,  152,  548,  150,  149,
+      150,  151,  150,  152,  150,  151,  153,  152,  154,  155,
+      153,  156,  154,  156,  156,  885,  155,  153,  156,  154,
+      155,  153,  157,  154,  157,  157,  172,  548,  172,  157,
+      162,  294,  162,  162,  171,  883,  294,  162,  882,  171,
+      156,  164,  164,  164,  164,  174,  294,  171,  164,  171,
+
+      879,  157,  174,  172,  188,  213,  174,  156,  164,  162,
+      188,  188,  213,  552,  173,  552,  213,  172,  157,  877,
+      164,  173,  173,  184,  184,  184,  162,  173,  173,  189,
+      184,  184,  185,  185,  185,  189,  189,  164,  873,  185,
+      185,  188,  191,  192,  191,  192,  872,  191,  192,  205,
+      206,  205,  206,  803,  205,  206,  207,  211,  207,  212,
+      211,  207,  214,  803,  211,  228,  212,  228,  211,  214,
+      212,  212,  214,  214,  215,  189,  218,  216,  871,  218,
+      215,  215,  216,  218,  216,  215,  217,  218,  216,  220,
+      219,  217,  221,  217,  219,  870,  220,  217,  220,  221,
+
+      220,  219,  221,  221,  222,  219,  223,  649,  222,  649,
+      869,  222,  225,  223,  228,  222,  313,  223,  224,  224,
+      225,  226,  313,  313,  226,  227,  224,  225,  226,  227,
+      224,  225,  226,  867,  229,  231,  227,  230,  230,  864,
+      227,  229,  232,  231,  234,  230,  232,  863,  229,  230,
+      231,  234,  229,  232,  231,  234,  235,  232,  233,  859,
+      233,  236,  466,  235,  466,  237,  235,  235,  236,  237,
+      238,  240,  236,  858,  238,  240,  237,  455,  240,  239,
+      237,  238,  240,  455,  455,  238,  295,  239,  233,  241,
+      233,  295,  466,  233,  239,  241,  855,  233,  239,  854,
+
+      233,  295,  241,  233,  233,  243,  241,  233,  853,  437,
+      244,  243,  243,  244,  437,  245,  243,  244,  245,  850,
+      246,  244,  245,  247,  437,  248,  245,  246,  546,  248,
+      247,  246,  246,  546,  247,  247,  248,  249,  248,  250,
+      248,  251,  249,  253,  251,  253,  250,  254,  251,  249,
+      250,  254,  251,  249,  251,  252,  255,  252,  254,  257,
+      845,  256,  254,  255,  252,  256,  257,  255,  843,  332,
+      257,  842,  256,  258,  259,  257,  256,  393,  258,  393,
+      258,  259,  332,  332,  258,  259,  393,  260,  839,  270,
+      253,  261,  253,  252,  260,  332,  270,  838,  260,  261,
+
+      270,  262,  252,  252,  252,  836,  261,  834,  262,  263,
+      261,  262,  262,  339,  263,  339,  263,  264,  339,  833,
+      263,  832,  264,  265,  264,  265,  266,  831,  264,  266,
+      264,  828,  265,  266,  267,  826,  265,  266,  273,  267,
+      268,  820,  267,  273,  818,  273,  267,  268,  269,  273,
+      267,  268,  268,  271,  272,  269,  547,  271,  272,  269,
+      269,  547,  274,  274,  271,  272,  275,  816,  271,  272,
+      274,  276,  277,  275,  274,  815,  811,  275,  276,  277,
+      810,  277,  276,  277,  278,  281,  278,  279,  279,  280,
+      281,  280,  281,  278,  807,  279,  281,  282,  280,  279,
+
+      283,  282,  280,  284,  282,  805,  285,  283,  282,  804,
+      284,  283,  284,  285,  284,  298,  286,  285,  286,  286,
+      298,  438,  287,  286,  287,  287,  438,  799,  298,  287,
+      298,  278,  289,  278,  289,  289,  438,  303,  796,  289,
+      293,  293,  293,  293,  303,  286,  785,  293,  303,  304,
+      784,  287,  314,  304,  783,  782,  342,  293,  314,  314,
+      304,  289,  286,  342,  304,  315,  342,  342,  287,  293,
+      781,  315,  315,  343,  341,  780,  341,  343,  289,  341,
+      344,  778,  346,  347,  343,  775,  293,  344,  343,  346,
+      347,  344,  345,  346,  347,  315,  314,  348,  345,  349,
+
+      774,  349,  350,  351,  348,  345,  769,  351,  348,  345,
+      350,  765,  762,  352,  351,  757,  743,  350,  351,  352,
+      352,  350,  741,  353,  352,  354,  353,  740,  355,  349,
+      353,  356,  354,  739,  353,  355,  354,  738,  356,  355,
+      357,  737,  356,  357,  736,  358,  349,  357,  349,  734,
+      358,  357,  358,  361,  360,  731,  358,  360,  730,  362,
+      361,  360,  723,  719,  361,  360,  362,  441,  365,  362,
+      362,  363,  441,  363,  365,  365,  366,  367,  718,  365,
+      441,  717,  441,  366,  367,  367,  368,  366,  366,  369,
+      686,  367,  368,  368,  685,  684,  369,  368,  369,  370,
+
+      369,  371,  374,  370,  683,  569,  363,  569,  371,  374,
+      370,  569,  371,  374,  370,  370,  682,  371,  363,  375,
+      363,  364,  373,  364,  372,  372,  375,  681,  680,  373,
+      375,  376,  372,  373,  378,  373,  372,  377,  376,  377,
+      376,  378,  376,  563,  679,  378,  379,  677,  380,  563,
+      563,  364,  671,  364,  379,  380,  364,  382,  377,  380,
+      364,  379,  383,  364,  382,  379,  364,  364,  382,  383,
+      364,  384,  664,  383,  385,  714,  659,  714,  384,  655,
+      386,  385,  384,  384,  377,  385,  377,  386,  387,  388,
+      387,  386,  479,  654,  479,  387,  388,  387,  389,  387,
+
+      388,  387,  390,  392,  714,  389,  391,  653,  390,  389,
+      647,  392,  391,  391,  395,  390,  396,  391,  392,  390,
+      395,  395,  392,  397,  396,  395,  397,  479,  646,  398,
+      397,  396,  398,  645,  397,  396,  398,  399,  400,  401,
+      398,  479,  643,  598,  399,  400,  401,  402,  399,  400,
+      401,  405,  597,  403,  402,  405,  406,  596,  402,  403,
+      403,  404,  405,  406,  403,  404,  405,  406,  404,  407,
+      408,  595,  404,  594,  593,  409,  407,  410,  408,  592,
+      407,  590,  409,  411,  410,  408,  409,  586,  410,  408,
+      411,  412,  413,  414,  411,  413,  585,  581,  412,  413,
+
+      414,  415,  412,  413,  414,  417,  416,  418,  415,  417,
+      573,  568,  415,  416,  418,  419,  417,  416,  418,  562,
+      417,  420,  419,  421,  561,  503,  419,  503,  420,  422,
+      421,  560,  420,  423,  421,  423,  422,  422,  425,  426,
+      422,  426,  423,  427,  428,  425,  503,  559,  426,  425,
+      427,  428,  426,  444,  427,  428,  429,  430,  429,  430,
+      431,  444,  431,  431,  558,  429,  430,  431,  444,  429,
+      430,  432,  444,  432,  432,  551,  445,  549,  432,  433,
+      543,  433,  433,  445,  489,  488,  433,  445,  454,  431,
+      436,  436,  436,  436,  454,  454,  465,  436,  463,  467,
+
+      432,  486,  463,  467,  465,  485,  431,  436,  433,  463,
+      467,  465,  483,  463,  467,  465,  468,  432,  454,  436,
+      469,  470,  468,  472,  482,  433,  475,  469,  470,  468,
+      472,  469,  470,  468,  472,  462,  436,  464,  464,  461,
+      464,  464,  464,  464,  464,  464,  464,  464,  464,  464,
+      464,  464,  464,  464,  464,  464,  464,  464,  464,  464,
+      464,  464,  464,  464,  464,  464,  464,  464,  464,  464,
+      464,  464,  464,  464,  464,  464,  464,  464,  464,  464,
+      464,  464,  464,  464,  464,  464,  464,  464,  464,  464,
+      464,  471,  460,  471,  473,  459,  474,  476,  453,  476,
+
+      471,  473,  473,  474,  471,  473,  476,  474,  474,  477,
+      476,  478,  478,  571,  477,  571,  477,  451,  478,  571,
+      477,  448,  478,  480,  480,  481,  481,  490,  446,  443,
+      491,  480,  481,  492,  490,  480,  481,  491,  490,  493,
+      492,  491,  494,  442,  492,  495,  493,  494,  497,  435,
+      493,  495,  495,  434,  494,  497,  495,  496,  494,  381,
+      496,  499,  497,  498,  496,  499,  497,  500,  496,  501,
+      498,  501,  499,  502,  498,  500,  499,  660,  505,  660,
+      502,  506,  500,  660,  502,  505,  500,  507,  506,  505,
+      501,  509,  506,  359,  507,  510,  338,  509,  507,  511,
+
+      510,  337,  512,  608,  509,  608,  511,  510,  509,  512,
+      511,  510,  513,  512,  513,  514,  501,  515,  501,  336,
+      515,  513,  514,  516,  608,  513,  514,  515,  518,  517,
+      516,  515,  518,  519,  516,  517,  335,  520,  519,  518,
+      519,  520,  517,  518,  519,  662,  517,  662,  520,  521,
+      523,  662,  520,  522,  521,  522,  521,  523,  524,  334,
+      521,  523,  522,  333,  526,  524,  522,  331,  525,  524,
+      525,  526,  329,  528,  527,  526,  527,  525,  529,  322,
+      528,  525,  530,  527,  528,  529,  531,  527,  564,  529,
+      530,  532,  531,  533,  564,  564,  321,  530,  532,  531,
+
+      533,  530,  532,  531,  533,  534,  535,  537,  534,  536,
+      766,  766,  766,  535,  537,  534,  536,  535,  537,  534,
+      536,  536,  538,  539,  540,  320,  540,  540,  319,  538,
+      539,  540,  318,  538,  539,  541,  550,  541,  541,  317,
+      316,  550,  541,  542,  308,  542,  542,  307,  306,  550,
+      542,  550,  553,  540,  545,  545,  545,  545,  572,  553,
+      565,  545,  305,  553,  541,  572,  565,  565,  574,  572,
+      540,  574,  542,  575,  302,  301,  292,  291,  574,  576,
+      575,  541,  574,  545,  575,  578,  576,  580,  577,  542,
+      576,  290,  578,  288,  580,  577,  578,  578,  580,  577,
+
+      545,  567,  567,  577,  567,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  579,  582,  202,  582,  583,
+      584,  579,  587,  583,  201,  200,  199,  584,  579,  587,
+      583,  584,  579,  587,  583,  588,  599,  600,  667,  588,
+      667,  600,  599,  198,  667,  582,  588,  197,  600,  599,
+      588,  582,  600,  599,  601,  603,  602,  603,  582,  196,
+
+      195,  601,  582,  602,  603,  601,  601,  602,  603,  604,
+      605,  606,  605,  194,  193,  178,  604,  177,  606,  605,
+      604,  607,  606,  605,  610,  176,  607,  612,  607,  614,
+      610,  175,  607,  166,  612,  613,  614,  610,  612,  160,
+      614,  610,  613,  613,  615,  616,  613,  617,  615,  616,
+      618,  158,   96,   90,  617,  615,  616,  618,  617,  615,
+      616,  618,  619,  622,  626,  620,  626,  706,  619,  706,
+      622,   89,  620,  621,  622,  619,  620,  620,  621,  619,
+      621,  623,  624,  625,  621,   85,   84,   71,  623,  624,
+      625,  627,  623,  624,  625,   70,  628,   67,  627,  626,
+
+       66,  627,  627,   65,  628,  629,  626,  630,   64,  706,
+      626,  628,  629,  633,  630,  628,  629,  631,  630,  631,
+      633,  632,  634,  637,  633,  637,  631,  632,  632,  634,
+      631,  635,  632,  634,  636,   57,  638,  639,  635,  650,
+       56,  636,  635,  638,  639,  636,  650,  638,  639,  674,
+      650,  640,  637,  640,  640,  641,  674,  641,  641,    7,
+      674,  642,  641,  642,  642,    0,  644,  644,  644,  644,
+      637,  656,  637,  644,    0,  657,    0,  656,  656,    0,
+      640,  657,  657,    0,  641,    0,  663,  665,  663,  665,
+      642,    0,  663,  665,  666,  644,  666,  640,  663,  665,
+
+      666,  641,  663,  668,  672,  668,  672,  642,    0,  668,
+      666,  669,  644,  669,  670,    0,  670,  669,  675,  668,
+      670,    0,  673,  669,  673,  675,    0,  678,  673,  675,
+      687,    0,  688,  672,  678,    0,    0,  687,  678,  688,
+      670,  687,  689,  688,  690,    0,  672,  689,  673,  689,
+      691,  690,  692,  689,  691,  690,    0,  693,    0,  692,
+      692,  691,    0,  692,  693,  691,  697,  694,  693,  694,
+      695,  697,  695,  697,  698,  699,  694,  697,    0,  695,
+      694,  698,  699,  695,  700,  698,  699,  701,    0,  702,
+      704,  700,    0,  703,  701,  700,  702,  704,  701,  703,
+
+      702,  704,  705,    0,  707,  708,  703,    0,    0,  705,
+      703,  707,  708,  705,  709,  707,  708,  709,  710,  711,
+      712,  709,  710,    0,    0,  709,  711,  712,  713,  710,
+      711,  712,  715,  710,  716,  713,  721,  722,    0,  713,
+      715,  716,  720,  721,  722,  716,    0,  715,  722,  720,
+      721,  715,  720,  720,  721,  724,    0,  725,  726,    0,
+        0,    0,  724,  727,  725,  726,  724,  724,  725,  726,
+      727,  728,    0,  732,  727,    0,    0,    0,  728,  732,
+      732,  733,  728,  733,  732,  744,  735,  746,  735,    0,
+      733,  746,  744,  747,  733,  735,  744,  745,  746,  735,
+
+      745,  747,  746,  748,    0,    0,  749,  745,  747,  750,
+      748,  745,  747,  749,  748,  751,  750,  749,  749,    0,
+      750,  752,  751,  753,  754,    0,  751,  755,  752,  755,
+      753,  754,  752,  756,  753,  754,  755,  756,  758,    0,
+      755,    0,    0,  759,  756,  758,  758,    0,  756,  758,
+      759,  760,  761,  763,  759,    0,    0,    0,  760,  761,
+      763,  764,  760,  761,  763,  763,  767,    0,  764,  768,
+        0,    0,  764,  767,  768,  771,  768,  767,  770,  772,
+      768,  772,  771,  770,  773,  770,  771,  776,  772,  770,
+      777,  773,  772,  779,  776,  773,  777,    0,  776,  787,
+
+      779,  788,    0,  777,  779,  787,  787,  777,  789,  788,
+      787,    0,    0,    0,  790,  789,  788,  791,  790,  789,
+      788,  790,  792,  794,  791,  790,  793,    0,  791,  792,
+      794,  795,  793,  792,  794,  797,    0,    0,  795,  793,
+      798,  797,  795,  793,    0,  800,  801,  798,  797,  800,
+      801,  798,  797,    0,  806,  808,  800,  801,  806,    0,
+      800,  801,  808,  809,  812,  806,  808,  812,    0,  806,
+      809,  812,  813,  821,  809,  812,    0,  822,  823,  813,
+      821,  822,    0,  813,  821,  823,  824,  825,  822,  823,
+      827,  825,  822,  824,  827,    0,  829,  824,  825,  830,
+
+        0,  827,  825,  829,  835,  827,  830,  829,  840,  837,
+      830,  835,  840,    0,  841,  835,  837,    0,    0,  840,
+      837,  841,  846,  840,  841,  841,  847,  848,  849,  846,
+      847,    0,    0,  846,  848,  849,    0,  847,  848,  849,
+      851,  847,  860,  851,  861,  865,    0,    0,    0,  860,
+      851,  861,  865,  860,  851,  861,  865,  866,  868,  860,
+      874,  866,    0,    0,    0,  868,    0,  874,  866,  868,
+      868,  874,  866,  875,  878,  880,  886,    0,    0,  875,
+      875,  878,  880,  886,  875,  878,  880,  886,  889,  893,
+      889,  895,    0,    0,    0,    0,  893,  889,  895,    0,
+
+      893,  889,  895,  915,  915,  915,  915,  915,  916,    0,
+      916,  916,  916,  917,    0,  917,  917,  917,  918,  918,
+      918,  918,  918,  919,  919,  919,  919,  919,  920,  920,
+      921,  921,  921,  921,  921,  922,  922,  922,  922,  922,
+      923,  923,    0,    0,  923,  924,    0,  924,  924,  924,
+      925,  925,  925,  925,  925,  926,    0,  926,  926,  926,
+      927,    0,  927,  927,  927,  928,    0,  928,  928,  928,
+      929,    0,  929,  929,  929,  930,  930,  930,  930,  930,
+      931,  931,  931,  931,  931,  932,  932,  932,  932,  932,
+      933,    0,  933,  933,  933,  934,    0,  934,  934,  934,
+
+      935,    0,  935,  935,  935,  936,    0,  936,  936,  936,
+      937,  937,  937,  937,  937,  938,  938,  938,  938,  938,
+      939,  939,  939,  939,  939,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,  914,  914,  914,  914
+    } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "fortran.lex"
+#define INITIAL 0
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#define parameter 1
+
+#define character 2
+
+#line 20 "fortran.lex"
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+extern FILE * yyin;
+#define MAX_INCLUDE_DEPTH 30
+#define tabsize 6
+YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+int line_num_fortran=1;
+int line_num_fortran_common=1;
+int newlinef90 = 0;
+char *tmp;
+/******************************************************************************/
+/**************PETITS PB NON PREVUS *******************************************/
+/******************************************************************************/
+/* NEXTLINF77 un ligne fortran 77 peut commencer par -      &a=b or on        */
+/*            a prevu seulement       & a=b avec l'espace entre le symbole    */
+/*            de la 7eme et le debut de la ligne de commande                  */
+/*            le ! est aussi interdit comme symbole de la 7 eme colonne       */
+/*            Normalement NEXTLINEF77 \n+[ ]{5}[^ ]                           */
+/******************************************************************************/
+#define YY_USER_ACTION \
+	{\
+	   if (firstpass == 0) \
+           {\
+              strcat(curbuf,yytext); \
+	      strcpy(motparse,yytext);\
+              colnum = colnum + strlen(motparse);\
+	      /*printf("motparse = %s %d\n",motparse,strlen(motparse));*/\
+              ECHO; \
+           }\
+           strcpy(motparse1,yytext);\
+	/*if ( firstpass == 1 ) 
+                      printf("yytext = %s %d\n",yytext,strlen(yytext));*/\
+	}
+#line 1398 "fortran.yy.c"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines.  This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( yy_current_buffer->yy_is_interactive ) \
+		{ \
+		int c = '*', n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+		  && ferror( yyin ) ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	if ( yyleng > 0 ) \
+		yy_current_buffer->yy_at_bol = \
+				(yytext[yyleng - 1] == '\n'); \
+	YY_USER_ACTION
+
+YY_DECL
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+
+#line 82 "fortran.lex"
+
+#line 1554 "fortran.yy.c"
+
+	if ( yy_init )
+		{
+		yy_init = 0;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! yy_start )
+			yy_start = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = stdin;
+
+		if ( ! yyout )
+			yyout = stdout;
+
+		if ( ! yy_current_buffer )
+			yy_current_buffer =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+
+		yy_load_buffer_state();
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = yy_c_buf_p;
+
+		/* Support of yytext. */
+		*yy_cp = yy_hold_char;
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = yy_start;
+		yy_current_state += YY_AT_BOL();
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				yy_last_accepting_state = yy_current_state;
+				yy_last_accepting_cpos = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 915 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 2926 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+
+do_action:	/* This label is used only to access EOF actions. */
+
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = yy_hold_char;
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 83 "fortran.lex"
+{
+		if (firstpass == 0)
+		{
+		fseek(fortranout,-1,1);
+		strcpy(&curbuf[strlen(curbuf)-1],"\0");
+		}
+		yyless(yyleng-1);
+		strcpy(yylval.na,yytext);
+		return TOK_NAME;
+		}
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 93 "fortran.lex"
+{return TOK_DONOTTREAT;}
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 94 "fortran.lex"
+{return TOK_ENDDONOTTREAT;}
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 95 "fortran.lex"
+return TOK_DEBUT;
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 96 "fortran.lex"
+return TOK_FIN;
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 97 "fortran.lex"
+return TOK_OMP;
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 98 "fortran.lex"
+return TOK_DOLLAR;
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 100 "fortran.lex"
+{return TOK_SUBROUTINE;}
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 101 "fortran.lex"
+{return TOK_PROGRAM;}
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 102 "fortran.lex"
+{return TOK_ALLOCATE;}
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 103 "fortran.lex"
+{return TOK_DEALLOCATE;}
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 104 "fortran.lex"
+{return TOK_RESULT;}
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 105 "fortran.lex"
+{return TOK_FUNCTION;}
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 106 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_ENDSUBROUTINE;}
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 107 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_ENDPROGRAM;}
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 108 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_ENDFUNCTION;}
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 109 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_ENDUNIT;}
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 110 "fortran.lex"
+return TOK_INCLUDE;
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 111 "fortran.lex"
+{return TOK_USE;}
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 112 "fortran.lex"
+{return TOK_REWIND;}
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 113 "fortran.lex"
+return TOK_IMPLICIT;
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 114 "fortran.lex"
+return TOK_NONE;
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 115 "fortran.lex"
+return TOK_CALL;
+	YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 116 "fortran.lex"
+return TOK_TRUE;
+	YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 117 "fortran.lex"
+return TOK_FALSE;
+	YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 118 "fortran.lex"
+{return TOK_POINT_TO;}
+	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 119 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_DASTER;}
+	YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 120 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_EQ;}
+	YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 121 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_GT;}
+	YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 122 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_GE;}
+	YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 123 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_LT;}
+	YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 124 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_LE;}
+	YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 125 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_NE;}
+	YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 126 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_NOT;}
+	YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 127 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_OR;}
+	YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 128 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_XOR;}
+	YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 129 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_AND;}
+	YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 130 "fortran.lex"
+{return TOK_MODULE;}
+	YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 131 "fortran.lex"
+{return TOK_DOWHILE;}
+	YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 132 "fortran.lex"
+return TOK_ENDMODULE;
+	YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 133 "fortran.lex"
+return TOK_ENDDO;
+	YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 134 "fortran.lex"
+{return TOK_PLAINDO;}
+	YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 135 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_REAL;}
+	YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 136 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_INTEGER;}
+	YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 137 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_LOGICAL;}
+	YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 138 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CHARACTER;}
+	YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 139 "fortran.lex"
+{return TOK_ALLOCATABLE;}
+	YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 140 "fortran.lex"
+return TOK_CLOSE;
+	YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 141 "fortran.lex"
+return TOK_INQUIRE;
+	YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 142 "fortran.lex"
+{return TOK_DIMENSION;}
+	YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 143 "fortran.lex"
+return TOK_PAUSE;
+	YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 144 "fortran.lex"
+return TOK_EQUIVALENCE;
+	YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 145 "fortran.lex"
+return TOK_STOP;
+	YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 146 "fortran.lex"
+return TOK_WHERE;
+	YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 147 "fortran.lex"
+return TOK_ENDWHERE;
+	YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 148 "fortran.lex"
+return TOK_ELSEWHERE;
+	YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 149 "fortran.lex"
+{return TOK_COMPLEX;}
+	YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 150 "fortran.lex"
+{return TOK_CONTAINS;}
+	YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 151 "fortran.lex"
+{return TOK_ONLY;}
+	YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 152 "fortran.lex"
+{return TOK_PARAMETER;}
+	YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 153 "fortran.lex"
+{return TOK_COMMON;}
+	YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 154 "fortran.lex"
+{return TOK_EXTERNAL;}
+	YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 155 "fortran.lex"
+{return TOK_INTENT;}
+	YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 156 "fortran.lex"
+{return TOK_KIND;}
+	YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 157 "fortran.lex"
+{return TOK_POINTER;}
+	YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 158 "fortran.lex"
+{return TOK_OPTIONAL;}
+	YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 159 "fortran.lex"
+{return TOK_SAVE;}
+	YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 160 "fortran.lex"
+{return TOK_TYPE;}
+	YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 161 "fortran.lex"
+{return TOK_ENDTYPE;}
+	YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 162 "fortran.lex"
+return TOK_OPEN;
+	YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 163 "fortran.lex"
+return TOK_RETURN;
+	YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 164 "fortran.lex"
+return TOK_EXIT;
+	YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 165 "fortran.lex"
+return TOK_PRINT;
+	YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 166 "fortran.lex"
+{return TOK_PROCEDURE;}
+	YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 167 "fortran.lex"
+{return TOK_READ;}
+	YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 168 "fortran.lex"
+{return TOK_NAMELIST;}
+	YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 169 "fortran.lex"
+{return TOK_WRITE;}
+	YY_BREAK
+case 78:
+YY_RULE_SETUP
+#line 170 "fortran.lex"
+{return TOK_TARGET;}
+	YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 171 "fortran.lex"
+{return TOK_PUBLIC;}
+	YY_BREAK
+case 80:
+YY_RULE_SETUP
+#line 172 "fortran.lex"
+{return TOK_PRIVATE;}
+	YY_BREAK
+case 81:
+YY_RULE_SETUP
+#line 173 "fortran.lex"
+{return TOK_IN;}
+	YY_BREAK
+case 82:
+YY_RULE_SETUP
+#line 174 "fortran.lex"
+{return TOK_DATA;} 
+	YY_BREAK
+case 83:
+YY_RULE_SETUP
+#line 175 "fortran.lex"
+return TOK_CONTINUE;
+	YY_BREAK
+case 84:
+YY_RULE_SETUP
+#line 176 "fortran.lex"
+{return TOK_PLAINGOTO;}
+	YY_BREAK
+case 85:
+YY_RULE_SETUP
+#line 177 "fortran.lex"
+{return TOK_OUT;}
+	YY_BREAK
+case 86:
+YY_RULE_SETUP
+#line 178 "fortran.lex"
+{return TOK_INOUT;}
+	YY_BREAK
+case 87:
+YY_RULE_SETUP
+#line 179 "fortran.lex"
+{return TOK_INTRINSIC;}
+	YY_BREAK
+case 88:
+YY_RULE_SETUP
+#line 180 "fortran.lex"
+{return TOK_THEN;}
+	YY_BREAK
+case 89:
+YY_RULE_SETUP
+#line 181 "fortran.lex"
+{return TOK_ELSEIF;}
+	YY_BREAK
+case 90:
+YY_RULE_SETUP
+#line 182 "fortran.lex"
+{return TOK_ELSE;}
+	YY_BREAK
+case 91:
+YY_RULE_SETUP
+#line 183 "fortran.lex"
+{return TOK_ENDIF;}
+	YY_BREAK
+case 92:
+YY_RULE_SETUP
+#line 184 "fortran.lex"
+{return TOK_LOGICALIF;}
+	YY_BREAK
+case 93:
+YY_RULE_SETUP
+#line 185 "fortran.lex"
+{return TOK_SUM;}
+	YY_BREAK
+case 94:
+YY_RULE_SETUP
+#line 186 "fortran.lex"
+{return TOK_MAX;}
+	YY_BREAK
+case 95:
+YY_RULE_SETUP
+#line 187 "fortran.lex"
+{return TOK_TANH;}
+	YY_BREAK
+case 96:
+YY_RULE_SETUP
+#line 188 "fortran.lex"
+{return TOK_MAXVAL;}
+	YY_BREAK
+case 97:
+YY_RULE_SETUP
+#line 189 "fortran.lex"
+{return TOK_TRIM;}
+	YY_BREAK
+case 98:
+YY_RULE_SETUP
+#line 190 "fortran.lex"
+{return TOK_SQRT;}
+	YY_BREAK
+case 99:
+YY_RULE_SETUP
+#line 191 "fortran.lex"
+{return TOK_SELECTCASE;}
+	YY_BREAK
+case 100:
+YY_RULE_SETUP
+#line 192 "fortran.lex"
+{return TOK_CASE;}
+	YY_BREAK
+case 101:
+YY_RULE_SETUP
+#line 193 "fortran.lex"
+{return TOK_CASEDEFAULT;}
+	YY_BREAK
+case 102:
+YY_RULE_SETUP
+#line 194 "fortran.lex"
+{return TOK_ENDSELECT;}
+	YY_BREAK
+case 103:
+YY_RULE_SETUP
+#line 195 "fortran.lex"
+{return TOK_FILE;}
+	YY_BREAK
+case 104:
+YY_RULE_SETUP
+#line 196 "fortran.lex"
+{return TOK_EXIST;}
+	YY_BREAK
+case 105:
+YY_RULE_SETUP
+#line 197 "fortran.lex"
+{return TOK_MIN;}
+	YY_BREAK
+case 106:
+YY_RULE_SETUP
+#line 198 "fortran.lex"
+{return TOK_INT;}
+	YY_BREAK
+case 107:
+YY_RULE_SETUP
+#line 199 "fortran.lex"
+{return TOK_NINT;}
+	YY_BREAK
+case 108:
+YY_RULE_SETUP
+#line 200 "fortran.lex"
+{return TOK_FLOAT;}
+	YY_BREAK
+case 109:
+YY_RULE_SETUP
+#line 201 "fortran.lex"
+{return TOK_EXP;}
+	YY_BREAK
+case 110:
+YY_RULE_SETUP
+#line 202 "fortran.lex"
+{return TOK_COS;}
+	YY_BREAK
+case 111:
+YY_RULE_SETUP
+#line 203 "fortran.lex"
+{return TOK_COSH;}
+	YY_BREAK
+case 112:
+YY_RULE_SETUP
+#line 204 "fortran.lex"
+{return TOK_ACOS;}
+	YY_BREAK
+case 113:
+YY_RULE_SETUP
+#line 205 "fortran.lex"
+{return TOK_SIN;}
+	YY_BREAK
+case 114:
+YY_RULE_SETUP
+#line 206 "fortran.lex"
+{return TOK_SINH;}
+	YY_BREAK
+case 115:
+YY_RULE_SETUP
+#line 207 "fortran.lex"
+{return TOK_ASIN;}
+	YY_BREAK
+case 116:
+YY_RULE_SETUP
+#line 208 "fortran.lex"
+{return TOK_LOG;}
+	YY_BREAK
+case 117:
+YY_RULE_SETUP
+#line 209 "fortran.lex"
+{return TOK_TAN;}
+	YY_BREAK
+case 118:
+YY_RULE_SETUP
+#line 210 "fortran.lex"
+{return TOK_ATAN;}
+	YY_BREAK
+case 119:
+YY_RULE_SETUP
+#line 211 "fortran.lex"
+{return TOK_ABS;}
+	YY_BREAK
+case 120:
+YY_RULE_SETUP
+#line 212 "fortran.lex"
+{return TOK_MOD;}
+	YY_BREAK
+case 121:
+YY_RULE_SETUP
+#line 213 "fortran.lex"
+{return TOK_SIGN;}
+	YY_BREAK
+case 122:
+YY_RULE_SETUP
+#line 214 "fortran.lex"
+{return TOK_MINLOC;}
+	YY_BREAK
+case 123:
+YY_RULE_SETUP
+#line 215 "fortran.lex"
+{return TOK_MAXLOC;}
+	YY_BREAK
+case 124:
+YY_RULE_SETUP
+#line 216 "fortran.lex"
+{return TOK_MINVAL;}
+	YY_BREAK
+case 125:
+YY_RULE_SETUP
+#line 217 "fortran.lex"
+{return TOK_INTERFACE;}
+	YY_BREAK
+case 126:
+YY_RULE_SETUP
+#line 218 "fortran.lex"
+{return TOK_ENDINTERFACE;}
+	YY_BREAK
+case 127:
+YY_RULE_SETUP
+#line 219 "fortran.lex"
+{return TOK_LEFTAB;}
+	YY_BREAK
+case 128:
+YY_RULE_SETUP
+#line 220 "fortran.lex"
+{return TOK_RIGHTAB;}
+	YY_BREAK
+case 129:
+YY_RULE_SETUP
+#line 221 "fortran.lex"
+{return TOK_FORMAT;}
+	YY_BREAK
+case 130:
+YY_RULE_SETUP
+#line 222 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_DOUBLEPRECISION;}
+	YY_BREAK
+case 131:
+YY_RULE_SETUP
+#line 223 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_DOUBLECOMPLEX;}
+	YY_BREAK
+case 132:
+YY_RULE_SETUP
+#line 224 "fortran.lex"
+{return '\n';}
+	YY_BREAK
+case 133:
+YY_RULE_SETUP
+#line 225 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_SLASH;}
+	YY_BREAK
+case 134:
+YY_RULE_SETUP
+#line 226 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_DSLASH;}
+	YY_BREAK
+case 135:
+YY_RULE_SETUP
+#line 227 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CHAR_CUT;}
+	YY_BREAK
+case 136:
+YY_RULE_SETUP
+#line 228 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CHAR_CONSTANT;}
+	YY_BREAK
+case 137:
+YY_RULE_SETUP
+#line 229 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CHAR_MESSAGE;}
+	YY_BREAK
+case 138:
+YY_RULE_SETUP
+#line 230 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CHAR_INT;}
+	YY_BREAK
+case 139:
+YY_RULE_SETUP
+#line 231 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_NAME;}
+	YY_BREAK
+case 140:
+YY_RULE_SETUP
+#line 232 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CSTREAL;}
+	YY_BREAK
+case 141:
+YY_RULE_SETUP
+#line 233 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CSTREALDP;}
+	YY_BREAK
+case 142:
+YY_RULE_SETUP
+#line 234 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CSTREALQP;}
+	YY_BREAK
+case 143:
+*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
+yy_c_buf_p = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 235 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CSTREAL;}
+	YY_BREAK
+case 144:
+YY_RULE_SETUP
+#line 236 "fortran.lex"
+{return TOK_POINT;}
+	YY_BREAK
+case 145:
+YY_RULE_SETUP
+#line 237 "fortran.lex"
+{strcpy(yylval.na,yytext);return TOK_CSTINT;}
+	YY_BREAK
+case 146:
+YY_RULE_SETUP
+#line 238 "fortran.lex"
+{}
+	YY_BREAK
+case 147:
+YY_RULE_SETUP
+#line 239 "fortran.lex"
+{return TOK_QUOTE;}
+	YY_BREAK
+case 148:
+YY_RULE_SETUP
+#line 240 "fortran.lex"
+{strcpy(yylval.na,yytext);return (int) *yytext;} 
+	YY_BREAK
+case 149:
+YY_RULE_SETUP
+#line 241 "fortran.lex"
+{return (int) *yytext;}
+	YY_BREAK
+case 150:
+YY_RULE_SETUP
+#line 242 "fortran.lex"
+{return (int) *yytext;}
+	YY_BREAK
+case 151:
+YY_RULE_SETUP
+#line 243 "fortran.lex"
+{return (int) *yytext;}
+	YY_BREAK
+case 152:
+YY_RULE_SETUP
+#line 244 "fortran.lex"
+{return (int) *yytext;}
+	YY_BREAK
+case 153:
+YY_RULE_SETUP
+#line 245 "fortran.lex"
+{colnum=0;line_num_fortran++;line_num_fortran_common++; return (int) *yytext;}
+	YY_BREAK
+case 154:
+*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
+yy_c_buf_p = yy_cp -= 1;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 246 "fortran.lex"
+
+	YY_BREAK
+case 155:
+YY_RULE_SETUP
+#line 247 "fortran.lex"
+{if (newlinef90 == 0) return TOK_LABEL; else newlinef90 = 0;}
+	YY_BREAK
+case 156:
+YY_RULE_SETUP
+#line 248 "fortran.lex"
+
+	YY_BREAK
+case 157:
+YY_RULE_SETUP
+#line 249 "fortran.lex"
+{colnum=colnum-1+tabsize;}
+	YY_BREAK
+case 158:
+YY_RULE_SETUP
+#line 250 "fortran.lex"
+;
+	YY_BREAK
+case 159:
+YY_RULE_SETUP
+#line 251 "fortran.lex"
+{line_num_fortran++;line_num_fortran_common++;newlinef90=1;colnum=0;}
+	YY_BREAK
+case 160:
+YY_RULE_SETUP
+#line 252 "fortran.lex"
+{line_num_fortran++;line_num_fortran_common++;colnum=0;}
+	YY_BREAK
+case 161:
+YY_RULE_SETUP
+#line 253 "fortran.lex"
+{
+                                       tmp =  strstr(motparse1,"contains");
+                           if ( !tmp ) tmp =  strstr(motparse1,"CONTAINS");
+                           if ( !tmp ) tmp =  strstr(motparse1,"Contains");
+                           if (  tmp ) 
+                           {
+                              if ( strlen(motparse1) == strlen(tmp)+1 ) 
+                              {
+                                 return TOK_CONTAINS;
+                              }
+                              else
+                              {
+                                 colnum=0;line_num_fortran++;line_num_fortran_common++;
+                              }
+                           }
+                           else
+                           {
+                              colnum=0;line_num_fortran++;line_num_fortran_common++;                           
+                           }
+                         }
+	YY_BREAK
+case 162:
+YY_RULE_SETUP
+#line 273 "fortran.lex"
+{
+                             if ( !strcasecmp(motparse1,"!$AGRIF_DO_NOT_TREAT\n")) return TOK_DONOTTREAT; 
+                             if ( !strcasecmp(motparse1,"!$AGRIF_END_DO_NOT_TREAT\n")) return TOK_ENDDONOTTREAT; 
+                          }
+	YY_BREAK
+case 163:
+YY_RULE_SETUP
+#line 277 "fortran.lex"
+{
+                             if ( !strcasecmp(motparse1,"!$AGRIF_DO_NOT_TREAT\n")) return TOK_DONOTTREAT; 
+                             if ( !strcasecmp(motparse1,"!$AGRIF_END_DO_NOT_TREAT\n")) return TOK_ENDDONOTTREAT; 
+                          }
+	YY_BREAK
+case 164:
+YY_RULE_SETUP
+#line 281 "fortran.lex"
+ECHO;
+	YY_BREAK
+#line 2498 "fortran.yy.c"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(parameter):
+case YY_STATE_EOF(character):
+	yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between yy_current_buffer and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			yy_n_chars = yy_current_buffer->yy_n_chars;
+			yy_current_buffer->yy_input_file = yyin;
+			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state();
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++yy_c_buf_p;
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = yy_c_buf_p;
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer() )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				yy_did_buffer_switch_on_eof = 0;
+
+				if ( yywrap() )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				yy_c_buf_p =
+					yytext_ptr + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				yy_c_buf_p =
+				&yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+	} /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+	{
+	register char *dest = yy_current_buffer->yy_ch_buf;
+	register char *source = yytext_ptr;
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( yy_current_buffer->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+	else
+		{
+		int num_to_read =
+			yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+			YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = yy_current_buffer;
+
+			int yy_c_buf_p_offset =
+				(int) (yy_c_buf_p - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					yy_flex_realloc( (void *) b->yy_ch_buf,
+							 b->yy_buf_size + 2 );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = yy_current_buffer->yy_buf_size -
+						number_to_move - 1;
+#endif
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+			yy_n_chars, num_to_read );
+
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	if ( yy_n_chars == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart( yyin );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			yy_current_buffer->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	yy_n_chars += number_to_move;
+	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+	return ret_val;
+	}
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+
+	yy_current_state = yy_start;
+	yy_current_state += YY_AT_BOL();
+
+	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			yy_last_accepting_state = yy_current_state;
+			yy_last_accepting_cpos = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 915 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+	}
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+	{
+	register int yy_is_jam;
+	register char *yy_cp = yy_c_buf_p;
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		yy_last_accepting_state = yy_current_state;
+		yy_last_accepting_cpos = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 915 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 914);
+
+	return yy_is_jam ? 0 : yy_current_state;
+	}
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+	{
+	register char *yy_cp = yy_c_buf_p;
+
+	/* undo effects of setting up yytext */
+	*yy_cp = yy_hold_char;
+
+	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = yy_n_chars + 2;
+		register char *dest = &yy_current_buffer->yy_ch_buf[
+					yy_current_buffer->yy_buf_size + 2];
+		register char *source =
+				&yy_current_buffer->yy_ch_buf[number_to_move];
+
+		while ( source > yy_current_buffer->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		yy_current_buffer->yy_n_chars =
+			yy_n_chars = yy_current_buffer->yy_buf_size;
+
+		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+
+	yytext_ptr = yy_bp;
+	yy_hold_char = *yy_cp;
+	yy_c_buf_p = yy_cp;
+	}
+#endif	/* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+	{
+	int c;
+
+	*yy_c_buf_p = yy_hold_char;
+
+	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			/* This was really a NUL. */
+			*yy_c_buf_p = '\0';
+
+		else
+			{ /* need more input */
+			int offset = yy_c_buf_p - yytext_ptr;
+			++yy_c_buf_p;
+
+			switch ( yy_get_next_buffer() )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart( yyin );
+
+					/* fall through */
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap() )
+						return EOF;
+
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					yy_c_buf_p = yytext_ptr + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
+	*yy_c_buf_p = '\0';	/* preserve yytext */
+	yy_hold_char = *++yy_c_buf_p;
+
+	yy_current_buffer->yy_at_bol = (c == '\n');
+
+	return c;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+	{
+	if ( ! yy_current_buffer )
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+	yy_init_buffer( yy_current_buffer, input_file );
+	yy_load_buffer_state();
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+	{
+	if ( yy_current_buffer == new_buffer )
+		return;
+
+	if ( yy_current_buffer )
+		{
+		/* Flush out information for old buffer. */
+		*yy_c_buf_p = yy_hold_char;
+		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	yy_current_buffer = new_buffer;
+	yy_load_buffer_state();
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	yy_did_buffer_switch_on_eof = 1;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+	{
+	yy_n_chars = yy_current_buffer->yy_n_chars;
+	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+	yyin = yy_current_buffer->yy_input_file;
+	yy_hold_char = *yy_c_buf_p;
+	}
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+	{
+	YY_BUFFER_STATE b;
+
+	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer( b, file );
+
+	return b;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+	{
+	if ( ! b )
+		return;
+
+	if ( b == yy_current_buffer )
+		yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		yy_flex_free( (void *) b->yy_ch_buf );
+
+	yy_flex_free( (void *) b );
+	}
+
+
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+	{
+	yy_flush_buffer( b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+	b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+	b->yy_is_interactive = 0;
+#else
+	b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+	{
+	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == yy_current_buffer )
+		yy_load_buffer_state();
+	}
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+	{
+	YY_BUFFER_STATE b;
+
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	yy_switch_to_buffer( b );
+
+	return b;
+	}
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+	{
+	int len;
+	for ( len = 0; yy_str[len]; ++len )
+		;
+
+	return yy_scan_bytes( yy_str, len );
+	}
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+	{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = len + 2;
+	buf = (char *) yy_flex_alloc( n );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+	for ( i = 0; i < len; ++i )
+		buf[i] = bytes[i];
+
+	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = yy_scan_buffer( buf, n );
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+	}
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+	{
+	if ( yy_start_stack_ptr >= yy_start_stack_depth )
+		{
+		yy_size_t new_size;
+
+		yy_start_stack_depth += YY_START_STACK_INCR;
+		new_size = yy_start_stack_depth * sizeof( int );
+
+		if ( ! yy_start_stack )
+			yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+		else
+			yy_start_stack = (int *) yy_flex_realloc(
+					(void *) yy_start_stack, new_size );
+
+		if ( ! yy_start_stack )
+			YY_FATAL_ERROR(
+			"out of memory expanding start-condition stack" );
+		}
+
+	yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+	BEGIN(new_state);
+	}
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+	{
+	if ( --yy_start_stack_ptr < 0 )
+		YY_FATAL_ERROR( "start-condition stack underflow" );
+
+	BEGIN(yy_start_stack[yy_start_stack_ptr]);
+	}
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+	{
+	return yy_start_stack[yy_start_stack_ptr - 1];
+	}
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+	{
+	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+	}
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		yytext[yyleng] = yy_hold_char; \
+		yy_c_buf_p = yytext + n; \
+		yy_hold_char = *yy_c_buf_p; \
+		*yy_c_buf_p = '\0'; \
+		yyleng = n; \
+		} \
+	while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+	{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+	}
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+	{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+	}
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+	{
+	return (void *) malloc( size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+	{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+	{
+	free( ptr );
+	}
+
+#if YY_MAIN
+int main()
+	{
+	yylex();
+	return 0;
+	}
+#endif
+#line 281 "fortran.lex"
+
+
+fortranerror(char *s)
+{
+   if (!strcasecmp(curfile,mainfile))
+   {
+      printf("%s line %d, fichier %s\n",s,line_num_fortran,curfile);
+   }
+   else
+   {
+      printf("%s line %d, fichier %s\n",s,line_num_fortran_common,curfile);
+   }
+}
+
+int fortranwrap()
+{
+}
Index: /trunk/AGRIF/LIB/fortran.lex
===================================================================
--- /trunk/AGRIF/LIB/fortran.lex	(revision 396)
+++ /trunk/AGRIF/LIB/fortran.lex	(revision 396)
@@ -0,0 +1,297 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+%x parameter
+%s character
+%{
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+extern FILE * yyin;
+#define MAX_INCLUDE_DEPTH 30
+#define tabsize 6
+YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+int line_num_fortran=1;
+int line_num_fortran_common=1;
+int newlinef90 = 0;
+char *tmp;
+/******************************************************************************/
+/**************PETITS PB NON PREVUS *******************************************/
+/******************************************************************************/
+/* NEXTLINF77 un ligne fortran 77 peut commencer par -      &a=b or on        */
+/*            a prevu seulement       & a=b avec l'espace entre le symbole    */
+/*            de la 7eme et le debut de la ligne de commande                  */
+/*            le ! est aussi interdit comme symbole de la 7 eme colonne       */
+/*            Normalement NEXTLINEF77 \n+[ ]{5}[^ ]                           */
+/******************************************************************************/
+#define YY_USER_ACTION \
+	{\
+	   if (firstpass == 0) \
+           {\
+              strcat(curbuf,yytext); \
+	      strcpy(motparse,yytext);\
+              colnum = colnum + strlen(motparse);\
+	      /*printf("motparse = %s %d\n",motparse,strlen(motparse));*/\
+              ECHO; \
+           }\
+           strcpy(motparse1,yytext);\
+	/*if ( firstpass == 1 ) 
+                      printf("yytext = %s %d\n",yytext,strlen(yytext));*/\
+	}
+%}
+AGRIFDEB "Agrif_debut"
+AGRIFFIN "Agrif_fin"
+NOTTREAT Agrif_do_not_treat
+ENDNOTTREAT Agrif_end_do_not_treat
+
+NIMPORTEQUOI .
+SAME_LINE ";"
+SLASH "/"
+DSLASH "/"[ \t]*"/"
+NAME [a-zA-Z\_][a-zA-Z0-9\_]*
+DIGIT [0-9]+
+INT {DIGIT}
+EXPONENT e[-+]?{DIGIT}
+DEXPONENT d[-+]?{DIGIT}
+QEXPONENT q[-+]?{DIGIT}
+REAL (({DIGIT}\.[0-9]+|[0-9]*\.{DIGIT}){EXPONENT}?)|{DIGIT}\.{EXPONENT}
+REALDP (({DIGIT}\.[0-9]+|[0-9]*\.{DIGIT}){DEXPONENT}?)|{DIGIT}\.{DEXPONENT}
+REALQP (({DIGIT}\.[0-9]+|[0-9]*\.{DIGIT}){QEXPONENT}?)|{DIGIT}\.{QEXPONENT}
+ENDFUNCTION end[ \t]*function
+DOUBLEPRECISION double[ \t]*precision
+DOUBLECOMPLEX double[ \t]*complex
+
+COMMENTAIRESFORTRAN77 (^[Cc]{NIMPORTEQUOI}*)
+COMMENTAIRESFORTRAN90 ^([ \t]*!{NIMPORTEQUOI}*\n)
+COMMENTAIRESFORTRAN90_2 (!{NIMPORTEQUOI}*)
+NEXTLINEF90 "&"{NIMPORTEQUOI}*[\n]*
+NEXTLINEF77 \n[ \t]*"&"
+%%
+{NAME}\= {
+		if (firstpass == 0)
+		{
+		fseek(fortranout,-1,1);
+		strcpy(&curbuf[strlen(curbuf)-1],"\0");
+		}
+		yyless(yyleng-1);
+		strcpy(yylval.na,yytext);
+		return TOK_NAME;
+		}
+^C${NOTTREAT}           {return TOK_DONOTTREAT;}
+^C${ENDNOTTREAT}        {return TOK_ENDDONOTTREAT;}
+^C${AGRIFDEB}            return TOK_DEBUT;
+^C${AGRIFFIN}            return TOK_FIN;
+^C$OMP[ \t]*{NIMPORTEQUOI}* return TOK_OMP;
+^C$[ \t]*{NIMPORTEQUOI}* return TOK_DOLLAR;
+
+subroutine              {return TOK_SUBROUTINE;}
+program                 {return TOK_PROGRAM;}
+allocate                {return TOK_ALLOCATE;}
+deallocate              {return TOK_DEALLOCATE;}
+result                  {return TOK_RESULT;}
+function                {return TOK_FUNCTION;}
+end[ \t]*subroutine     {strcpy(yylval.na,yytext);return TOK_ENDSUBROUTINE;}
+end[ \t]*program        {strcpy(yylval.na,yytext);return TOK_ENDPROGRAM;}
+end[ \t]*function       {strcpy(yylval.na,yytext);return TOK_ENDFUNCTION;}
+end                     {strcpy(yylval.na,yytext);return TOK_ENDUNIT;}
+include                  return TOK_INCLUDE;
+use                     {return TOK_USE;}
+rewind                  {return TOK_REWIND;}
+implicit                 return TOK_IMPLICIT;
+none                     return TOK_NONE;
+call                     return TOK_CALL;
+.true.                   return TOK_TRUE;
+.false.                  return TOK_FALSE;
+\=\>                    {return TOK_POINT_TO;}
+\*\*                    {strcpy(yylval.na,yytext);return TOK_DASTER;}
+\.[ \t]*eq\.            {strcpy(yylval.na,yytext);return TOK_EQ;}
+\.[ \t]*gt\.            {strcpy(yylval.na,yytext);return TOK_GT;}
+\.[ \t]*ge\.            {strcpy(yylval.na,yytext);return TOK_GE;}
+\.[ \t]*lt\.            {strcpy(yylval.na,yytext);return TOK_LT;}
+\.[ \t]*le\.            {strcpy(yylval.na,yytext);return TOK_LE;}
+\.[ \t]*ne\.            {strcpy(yylval.na,yytext);return TOK_NE;}
+\.[ \t]*not\.           {strcpy(yylval.na,yytext);return TOK_NOT;}
+\.[ \t]*or\.            {strcpy(yylval.na,yytext);return TOK_OR;}
+\.[ \t]*xor\.           {strcpy(yylval.na,yytext);return TOK_XOR;}
+\.[ \t]*and\.           {strcpy(yylval.na,yytext);return TOK_AND;}
+module                  {return TOK_MODULE;}
+do[ \t]*while           {return TOK_DOWHILE;}
+end[ \t]*module          return TOK_ENDMODULE;
+end[ \t]*do              return TOK_ENDDO;
+do                      {return TOK_PLAINDO;}
+real                    {strcpy(yylval.na,yytext);return TOK_REAL;}
+integer                 {strcpy(yylval.na,yytext);return TOK_INTEGER;}
+logical                 {strcpy(yylval.na,yytext);return TOK_LOGICAL;}
+character               {strcpy(yylval.na,yytext);return TOK_CHARACTER;}
+allocatable             {return TOK_ALLOCATABLE;}
+close                    return TOK_CLOSE;
+inquire                  return TOK_INQUIRE;
+dimension               {return TOK_DIMENSION;}
+pause                    return TOK_PAUSE;
+equivalence              return TOK_EQUIVALENCE;
+stop                     return TOK_STOP;
+where                    return TOK_WHERE;
+end[ \t]*where           return TOK_ENDWHERE;
+else[ \t]*where          return TOK_ELSEWHERE;
+complex                 {return TOK_COMPLEX;}
+^[ \t]*contains         {return TOK_CONTAINS;}
+only                    {return TOK_ONLY;}
+parameter               {return TOK_PARAMETER;}
+common                  {return TOK_COMMON;}
+external                {return TOK_EXTERNAL;}
+intent                  {return TOK_INTENT;}
+kind                    {return TOK_KIND;}
+pointer                 {return TOK_POINTER;}
+optional                {return TOK_OPTIONAL;}
+save                    {return TOK_SAVE;}
+^[ \t]*type              {return TOK_TYPE;}
+end[ \t]*type           {return TOK_ENDTYPE;}
+open                     return TOK_OPEN;
+return                   return TOK_RETURN;
+exit                     return TOK_EXIT;
+print                    return TOK_PRINT;
+module[ \t]*procedure   {return TOK_PROCEDURE;}
+read                    {return TOK_READ;}
+namelist                {return TOK_NAMELIST;}
+write                   {return TOK_WRITE;}
+target                  {return TOK_TARGET;}
+public                  {return TOK_PUBLIC;}
+private                 {return TOK_PRIVATE;}
+in                      {return TOK_IN;}
+data                    {return TOK_DATA;} 
+continue                 return TOK_CONTINUE;
+go[ \t]*to              {return TOK_PLAINGOTO;}
+out                     {return TOK_OUT;}
+inout                   {return TOK_INOUT;}
+intrinsic               {return TOK_INTRINSIC;}
+then                    {return TOK_THEN;}
+else[ \t]*if            {return TOK_ELSEIF;}
+else                    {return TOK_ELSE;}
+end[ \t]*if             {return TOK_ENDIF;}
+if                      {return TOK_LOGICALIF;}
+sum[ \t]*\(              {return TOK_SUM;}
+max                     {return TOK_MAX;}
+tanh                    {return TOK_TANH;}
+maxval                  {return TOK_MAXVAL;}
+trim                    {return TOK_TRIM;}
+sqrt                    {return TOK_SQRT;}
+select[ \t]*case        {return TOK_SELECTCASE;}
+case                    {return TOK_CASE;}
+case[ \t]*default       {return TOK_CASEDEFAULT;}
+end[ \t]*select         {return TOK_ENDSELECT;}
+file[ \t]*\=            {return TOK_FILE;}
+exist[ \t]*\=           {return TOK_EXIST;}
+min[ \t]*\(             {return TOK_MIN;}
+int                     {return TOK_INT;}
+nint                    {return TOK_NINT;}
+float                   {return TOK_FLOAT;}
+exp                     {return TOK_EXP;}
+cos                     {return TOK_COS;}
+cosh                    {return TOK_COSH;}
+acos                    {return TOK_ACOS;}
+sin                     {return TOK_SIN;}
+sinh                    {return TOK_SINH;}
+asin                    {return TOK_ASIN;}
+log                     {return TOK_LOG;}
+tan                     {return TOK_TAN;}
+atan                    {return TOK_ATAN;}
+abs                     {return TOK_ABS;}
+mod                     {return TOK_MOD;}
+sign                    {return TOK_SIGN;}
+minloc                  {return TOK_MINLOC;}
+maxloc                  {return TOK_MAXLOC;}
+minval                  {return TOK_MINVAL;}
+interface               {return TOK_INTERFACE;}
+end[ \t]*interface      {return TOK_ENDINTERFACE;}
+\({SLASH}               {return TOK_LEFTAB;}
+{SLASH}\)               {return TOK_RIGHTAB;}
+format                  {return TOK_FORMAT;}
+{DOUBLEPRECISION}       {strcpy(yylval.na,yytext);return TOK_DOUBLEPRECISION;}
+{DOUBLECOMPLEX}         {strcpy(yylval.na,yytext);return TOK_DOUBLECOMPLEX;}
+{SAME_LINE}             {return '\n';}
+{SLASH}                 {strcpy(yylval.na,yytext);return TOK_SLASH;}
+DSLASH                  {strcpy(yylval.na,yytext);return TOK_DSLASH;}
+(\')[^']*&{0,1}\n[ \t]*&{0,1}[^']*(\')         {strcpy(yylval.na,yytext);return TOK_CHAR_CUT;}
+(\')[^\n']*(\')         {strcpy(yylval.na,yytext);return TOK_CHAR_CONSTANT;}
+(\")[^\n]*(\")          {strcpy(yylval.na,yytext);return TOK_CHAR_MESSAGE;}
+({NAME}{REAL})          {strcpy(yylval.na,yytext);return TOK_CHAR_INT;}
+{NAME}                  {strcpy(yylval.na,yytext);return TOK_NAME;}
+{REAL}                  {strcpy(yylval.na,yytext);return TOK_CSTREAL;}
+{REALDP}                {strcpy(yylval.na,yytext);return TOK_CSTREALDP;}
+{REALQP}                {strcpy(yylval.na,yytext);return TOK_CSTREALQP;}
+({DIGIT}\.)/[^{NAME}|"and."|"false."|"true."|"eq."|"or."|"gt."|"ge."|"lt."|"le."|"not."|"ne."] {strcpy(yylval.na,yytext);return TOK_CSTREAL;}
+\.                      {return TOK_POINT;}
+{INT}                   {strcpy(yylval.na,yytext);return TOK_CSTINT;}
+\$ {}
+\'|\"                   {return TOK_QUOTE;}
+;|\(|\)|:|\[|\]|\+|\-|\*|\% {strcpy(yylval.na,yytext);return (int) *yytext;} 
+\,                      {return (int) *yytext;}
+\=                      {return (int) *yytext;}
+\<                      {return (int) *yytext;}
+\>                      {return (int) *yytext;}
+\n                      {colnum=0;line_num_fortran++;line_num_fortran_common++; return (int) *yytext;}
+^[ ]*$
+^(((" "|[0-9]){1,5})|([ \t]{1,5}))[ &]+ {if (newlinef90 == 0) return TOK_LABEL; else newlinef90 = 0;}
+[ ]+
+[\t]+                   {colnum=colnum-1+tabsize;}
+[ \t]+ ;
+{NEXTLINEF90}           {line_num_fortran++;line_num_fortran_common++;newlinef90=1;colnum=0;}
+{NEXTLINEF77}           {line_num_fortran++;line_num_fortran_common++;colnum=0;}
+{COMMENTAIRESFORTRAN77} {
+                                       tmp =  strstr(motparse1,"contains");
+                           if ( !tmp ) tmp =  strstr(motparse1,"CONTAINS");
+                           if ( !tmp ) tmp =  strstr(motparse1,"Contains");
+                           if (  tmp ) 
+                           {
+                              if ( strlen(motparse1) == strlen(tmp)+1 ) 
+                              {
+                                 return TOK_CONTAINS;
+                              }
+                              else
+                              {
+                                 colnum=0;line_num_fortran++;line_num_fortran_common++;
+                              }
+                           }
+                           else
+                           {
+                              colnum=0;line_num_fortran++;line_num_fortran_common++;                           
+                           }
+                         }
+{COMMENTAIRESFORTRAN90}   {
+                             if ( !strcasecmp(motparse1,"!$AGRIF_DO_NOT_TREAT\n")) return TOK_DONOTTREAT; 
+                             if ( !strcasecmp(motparse1,"!$AGRIF_END_DO_NOT_TREAT\n")) return TOK_ENDDONOTTREAT; 
+                          }
+{COMMENTAIRESFORTRAN90_2} {
+                             if ( !strcasecmp(motparse1,"!$AGRIF_DO_NOT_TREAT\n")) return TOK_DONOTTREAT; 
+                             if ( !strcasecmp(motparse1,"!$AGRIF_END_DO_NOT_TREAT\n")) return TOK_ENDDONOTTREAT; 
+                          }
+%%
+
+fortranerror(char *s)
+{
+   if (!strcasecmp(curfile,mainfile))
+   {
+      printf("%s line %d, fichier %s\n",s,line_num_fortran,curfile);
+   }
+   else
+   {
+      printf("%s line %d, fichier %s\n",s,line_num_fortran_common,curfile);
+   }
+}
+
+int fortranwrap()
+{
+}
Index: /trunk/AGRIF/LIB/fortran.y
===================================================================
--- /trunk/AGRIF/LIB/fortran.y	(revision 396)
+++ /trunk/AGRIF/LIB/fortran.y	(revision 396)
@@ -0,0 +1,2248 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+%{
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "decl.h"
+extern int line_num_fortran;
+extern int line_num_fortran_common;
+char *tmp;
+char c_selectorname[LONGNOM];
+char ligne[LONGNOM];
+char identcopy[LONGNOM];
+int c_selectorgiven=0;
+int incom;
+listvar *curlistvar;
+typedim c_selectordim;
+listcouple *coupletmp;
+int removeline=0;
+%}
+
+%union {
+       char      na[LONGNOM];
+       listdim  *d;
+       listvar  *l;
+       listvarcommon *lcom;
+       listnom  *ln;
+       listvarpointtovar  *lp;
+       listcouple  *lc;
+       typedim   dim1;
+       variable *v;
+       }
+
+%left ','
+%nonassoc ':'
+%right '='
+%left TOK_BINARY_OP
+%left EQV NEQV
+%left TOK_OR TOK_XOR
+%left TOK_AND
+%left TOK_NOT
+%nonassoc TOK_LT TOK_GT TOK_LE TOK_GE TOK_EQ TOK_NE
+%nonassoc TOK_UNARY_OP
+%left TOK_DSLASH
+%left '+' '-'
+%left '*' TOK_SLASH
+%right TOK_DASTER
+
+%token TOK_SEP
+%token TOK_NEXTLINE
+%token TOK_PARAMETER
+%token TOK_KIND
+%token TOK_RESULT
+%token TOK_ONLY
+%token TOK_INCLUDE
+%token TOK_SUBROUTINE
+%token TOK_PROGRAM
+%token TOK_FUNCTION
+%token TOK_OMP
+%token TOK_DOLLAR
+%token TOK_FORMAT
+%token TOK_MAX
+%token TOK_TANH
+%token TOK_WHERE
+%token TOK_ELSEWHERE
+%token TOK_ENDWHERE
+%token TOK_MAXVAL
+%token TOK_TRIM
+%token TOK_SUM
+%token TOK_SQRT
+%token TOK_CASE
+%token TOK_SELECTCASE
+%token TOK_FILE
+%token TOK_DONOTTREAT
+%token TOK_ENDDONOTTREAT
+%token TOK_EXIST
+%token TOK_MIN
+%token TOK_INT
+%token TOK_FLOAT
+%token TOK_EXP
+%token TOK_COS
+%token TOK_COSH
+%token TOK_ACOS
+%token TOK_NINT
+%token TOK_SIN
+%token TOK_SINH
+%token TOK_ASIN
+%token TOK_EQUIVALENCE
+%token TOK_LOG
+%token TOK_TAN
+%token TOK_ATAN
+%token TOK_ABS
+%token TOK_MOD
+%token TOK_SIGN
+%token TOK_MINLOC
+/*%token TOK_REC*/
+%token TOK_MAXLOC
+%token TOK_EXIT
+%token TOK_MINVAL
+%token TOK_PUBLIC
+%token TOK_PRIVATE
+%token TOK_ALLOCATABLE
+%token TOK_IN
+%token TOK_RETURN
+%token TOK_THEN
+%token TOK_ELSEIF
+%token TOK_ELSE
+%token TOK_ENDIF
+%token TOK_PRINT
+%token TOK_PLAINGOTO
+%token TOK_CONSTRUCTID
+%token TOK_LOGICALIF
+%token TOK_PLAINDO
+%token TOK_CONTAINS
+%token TOK_ENDDO
+%token TOK_MODULE
+%token TOK_ENDMODULE
+%token TOK_DOWHILE
+%token TOK_ALLOCATE
+%token TOK_OPEN
+%token TOK_CLOSE
+%token TOK_INQUIRE
+%token TOK_WRITE
+%token TOK_READ
+%token TOK_REWIND
+%token TOK_DEALLOCATE
+%token TOK_NULLIFY
+%token TOK_FIN
+%token TOK_DEBUT
+%token TOK_OUT
+%token TOK_INOUT
+%token TOK_DIMENSION
+%token TOK_ENDSELECT
+%token TOK_EXTERNAL
+%token TOK_INTENT
+%token TOK_INTRINSIC
+%token TOK_NAMELIST 
+%token TOK_CASEDEFAULT 
+%token TOK_OPTIONAL
+%token TOK_POINTER
+%token TOK_CONTINUE
+%token TOK_SAVE
+%token TOK_TARGET
+%token TOK_USE
+%token TOK_POINT
+%token TOK_DATA 
+%token TOK_QUOTE
+%token TOK_IMPLICIT
+%token TOK_NONE
+%token TOK_CALL
+%token TOK_STAT
+%token TOK_POINT_TO
+%token TOK_COMMON
+%token TOK_INTERFACE 
+%token TOK_ENDINTERFACE 
+%token TOK_LEFTAB 
+%token TOK_RIGHTAB 
+%token TOK_PAUSE
+%token TOK_PROCEDURE
+%token TOK_STOP
+%token TOK_NAMEEQ
+%token <na> TOK_DSLASH
+%token <na> TOK_DASTER
+%token <na> TOK_EQ
+%token <na> TOK_GT
+%token <na> TOK_LT
+%token <na> TOK_GE
+%token <na> TOK_NE
+%token <na> TOK_LE
+%token <na> TOK_OR
+%token <na> TOK_XOR
+%token <na> TOK_NOT
+%token <na> TOK_AND
+%token <na> TOK_TRUE 
+%token <na> TOK_FALSE 
+%token <na> TOK_LABEL
+%token <na> TOK_TYPE
+%token <na> TOK_ENDTYPE
+%token <na> TOK_REAL
+%token <na> TOK_INTEGER
+%token <na> TOK_LOGICAL
+%token <na> TOK_DOUBLEPRECISION
+%token <na> TOK_DOUBLEREAL
+%token <na> TOK_ENDSUBROUTINE
+%token <na> TOK_ENDFUNCTION
+%token <na> TOK_ENDPROGRAM
+%token <na> TOK_ENDUNIT
+%token <na> TOK_CHARACTER
+%token <na> TOK_CHAR_CONSTANT
+%token <na> TOK_CHAR_CUT
+%token <na> TOK_CHAR_INT
+%token <na> TOK_CHAR_MESSAGE 
+%token <na> TOK_CSTREAL
+%token <na> TOK_CSTREALDP
+%token <na> TOK_CSTREALQP
+%token <na> TOK_SFREAL 
+%token <na> TOK_COMPLEX
+%token <na> TOK_DOUBLECOMPLEX
+%token <na> TOK_NAME
+%token <na> TOK_NAME_CHAR
+%token <na> TOK_PROBTYPE  /* dimension of the problem                         */
+%token <na> TOK_INTERPTYPE/* kind of interpolation                            */
+%token <na> TOK_VARTYPE   /* posit ion of the grid variable on the cells of   */
+                          /*     the mesh                                     */
+%token <na> TOK_SLASH
+%token <na> TOK_BC        /* calculation of the boundary conditions           */
+%token <na> TOK_OP
+%token <na> TOK_CSTINT
+%token <na> TOK_COMMENT 
+%token <na> TOK_FILENAME
+%token ','
+%token ';'
+%token ':'
+%token '('
+%token ')'   
+%token '['
+%token ']'
+%token '!'
+%token '_' 
+%token '<' 
+%token '>' 
+%type <l> dcl
+%type <l> paramlist
+%type <l> args  
+%type <lc> only_list
+%type <lc> only_name
+%type <lc> rename_list
+%type <lc> rename_name
+%type <lcom> common
+%type <lcom> var_common
+%type <lcom> var_common_list
+%type <na> comblock
+%type <na> name_routine
+%type <na> begin_array
+%type <na> module_name
+%type <na> opt_name
+%type <na> clause
+%type <na> type
+%type <na> arg
+%type <na> typename
+%type <na> typespec
+%type <na> uexpr
+%type <na> minmaxlist
+%type <na> complex_const
+%type <na> lhs
+%type <na> simple_const
+%type <na> vec
+%type <na> outlist 
+%type <na> out2 
+%type <na> other 
+%type <na> dospec 
+%type <na> expr_data 
+%type <na> beforefunctionuse 
+%type <na> ident 
+%type <na> structure_component 
+%type <na> array_ele_substring_func_ref  
+%type <na> funarglist  
+%type <na> funarg  
+%type <na> funargs  
+%type <na> triplet  
+%type <na> substring  
+%type <na> string_constant  
+%type <na> opt_substring  
+%type <na> opt_expr  
+%type <na> optexpr  
+%type <na> datavallist  
+%type <na> after_slash  
+%type <na> after_equal
+%type <na> predefinedfunction
+%type <na> do_var  
+%type <na> expr
+%type <na> intent_spec
+%type <na> ubound
+%type <na> after_ident_dims
+%type <na> signe
+%type <na> opt_signe
+%type <na> operation
+%type <na> filename
+%type <na> proper_lengspec
+%type <d> dims
+%type <d> dimlist
+%type <dim1> dim
+%type <v> paramitem
+
+%left TOK_OP
+%%
+input :
+      | input line
+      ;
+line :  '\n' position
+      | thislabel suite_line
+      | TOK_COMMENT
+      | keyword cmnt writedeclar
+      | error writedeclar nulcurbuf
+                   {yyerrok;yyclearin;}    
+      ;
+suite_line : entry fin_line/* subroutine, function, module                    */
+      | spec fin_line      /* declaration                                     */
+      | before_include filename fin_line
+                  {
+                     if (firstpass == 0 && 
+                         inmoduledeclare == 0 && 
+                         couldaddvariable == 1 )
+                     {
+                        pos_end = setposcur();
+                        RemoveWordSET(fortranout,pos_curinclude,
+                                              pos_end-pos_curinclude);
+                     }
+                  }
+      | exec cmnt writedeclar /* if, do etc ...                               */
+      | instr fin_line    /* instruction ident : do i = 1 ...                 */
+      ;
+instr : ident ':'
+      ;
+fin_line : position cmnt
+      ;
+keyword : TOK_DONOTTREAT 
+         {
+            /* we should ignore the declaration until the keyword   */
+            /*    TOK_ENDDONOTTREAT                                 */
+            couldaddvariable = 0 ;
+            if ( firstpass == 0 ) 
+            {
+               RemoveWordCUR(fortranout,-20,20);
+            }
+         }
+      | TOK_ENDDONOTTREAT 
+         {
+             couldaddvariable = 1 ;
+             if ( firstpass == 0 ) 
+             {
+                 RemoveWordCUR(fortranout,-24,24);
+             }
+          }
+      | TOK_OMP
+      | TOK_DOLLAR
+      ;
+position: {if ( firstpass == 0 ) pos_cur = setposcur();}
+      ;
+thislabel: 
+      | TOK_LABEL nulcurbuf
+      ;
+cmnt:
+      | TOK_COMMENT
+      ;
+incomment:
+                   {incom = 1;}
+      ;
+nulcurbuf:
+                   {if (incom !=1) {strcpy(curbuf,"");incom=0;}}
+      ;
+entry: 
+      | TOK_SUBROUTINE name_routine arglist
+                   {
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,$2);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforsub();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                            tmpdeclaration_everdone = 0;
+                            paramdeclaration_everdone = 0;
+                            insubroutinedeclare = 1;
+                            if ( firstpass == 0 ) 
+                            {
+                               adduseagrifutil = 0 ;
+                               AGRIF_n_AddUseAgrifUtil();
+                            }
+                            OPTI_0_writeheadnewsubforsub();
+                            adduseagrifutil = 0 ; 
+                      }
+                   }
+      | TOK_PROGRAM name_routine
+                   {
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,$2);
+                      /* Common case                                          */
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforsub();
+                         adduseagrifutil = 0 ;                       
+                   }
+      | TOK_FUNCTION name_routine arglist TOK_RESULT arglist1
+                   {
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,$2);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar($2,NULL);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar(curlistvar,listargsubroutine,1);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                            tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                            insubroutinedeclare = 1;
+                            if ( firstpass == 0 ) 
+                            {
+                               adduseagrifutil = 0 ;
+                               AGRIF_n_AddUseAgrifUtil();
+                            }
+                            /* we should to list of the subroutine argument   */
+                            /* name of the function which has to be defined   */
+                            if ( firstpass == 1 ) 
+                            {
+                               curvar=createvar($2,NULL);
+                               curlistvar=insertvar(NULL,curvar);
+                               listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            }
+                            OPTI_0_writeheadnewsubforfunc();
+                            adduseagrifutil = 0 ; 
+                      }
+                   }
+      | TOK_FUNCTION name_routine arglist
+                   {
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,$2);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar($2,NULL);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                            tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                            insubroutinedeclare = 1;
+                            if ( firstpass == 0 ) 
+                            {
+                               adduseagrifutil = 0 ;
+                               AGRIF_n_AddUseAgrifUtil();
+                            }
+                            /* we should to list of the subroutine argument   */
+                            /* name of the function which has to be defined   */
+                            if ( firstpass == 1 ) 
+                            {
+                               curvar=createvar($2,NULL);
+                               curlistvar=insertvar(NULL,curvar);
+                               listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            }
+                            OPTI_0_writeheadnewsubforfunc();
+                            adduseagrifutil = 0 ; 
+                      }
+                   }
+      | TOK_MODULE TOK_NAME
+                   {
+                      strcpy(curmodulename,$2);
+                      if ( firstpass == 1 ) Add_ModuleTo_Modulelist($2);
+                      if ( inmoduledeclare == 0 )
+                      { 
+                         /* instance and back instance should be create ?     */
+                         MOD_1_FillInlistmodule();   
+                         /* To know if there are in the module declaration    */
+                         inmoduledeclare = 1;
+                         /* to know if a module has been met                  */
+                         inmodulemeet = 1;
+                         /* to know if we are after the keyword contains      */
+                         aftercontainsdeclare = 0 ;
+                      }      
+                      /* WE should use Agrif_Util if it is necessary          */
+                      AGRIF_0_AddUseAgrifInModuleDeclaration();
+                   }
+      ;
+name_routine : TOK_NAME {strcpy($$,$1);strcpy(subroutinename,$1);}
+writedeclar :
+      ;
+before_include : TOK_INCLUDE
+                   {
+                      if (firstpass == 0 )
+                      {
+                         pos_curinclude = setposcur()-9;
+                      }
+                   }      
+filename: TOK_CHAR_CONSTANT
+                   {
+                      if ( firstpass == 1 && couldaddvariable == 1 )
+                      {
+                         Addincludetothelist($1);
+                      }                   
+                   }
+      ;
+arglist: 
+      | '(' ')'    {
+                      if ( firstpass == 1 ) listargsubroutine=NULL;
+                   }
+      | '(' args ')'
+                   {
+                       if ( firstpass == 1 ) listargsubroutine=$2;
+                   }
+      ;
+arglist1: 
+      | '(' ')'
+      | '(' args ')'
+                   {
+                       listargsubroutine = AddListvarToListvar
+                                                       ($2,listargsubroutine,1);
+                   }
+      ;
+args:arg           {
+                      if ( firstpass == 1 )
+                      {
+                         curvar=createvar($1,curdim);
+                         curlistvar=insertvar(NULL,curvar);
+                         $$=settype($1,curlistvar);
+                      }
+                   }
+      | args ',' arg 
+                   {
+                      if ( firstpass == 1 )
+                      {
+                         curvar=createvar($3,curdim);
+                         $$=insertvar($1,curvar);
+                      }
+                   }
+      ;
+arg: TOK_NAME      {strcpy($$,$1);}
+      | '*'        {strcpy($$,"*");}
+      ; 
+spec: type after_type
+                   {
+                      /* remove declaration                                   */
+                      if ( fortran77 == 1                       && 
+                           firstpass == 0                       && 
+                           infunctiondeclare == 0               && 
+                           commonlist                           && 
+                           OPTI_0_IsTabvarsUseInArgument() == 1 &&
+                           couldaddvariable == 1 ) 
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_cur_decl,
+                                               pos_end-pos_cur_decl);
+                      }
+                      infunctiondeclare = 0 ;
+                   }
+      | TOK_TYPE opt_name
+      | TOK_ENDTYPE opt_name
+      | TOK_POINTER list_couple
+      | before_parameter  '(' paramlist ')' 
+                   {
+                      COM_1_AddvartoParamlist($3);
+                      if ( fortran77 == 1  && 
+                           firstpass == 0  && 
+                           commonlist      && 
+                           listvarindoloop && 
+                           OPTI_0_IsTabvarsUseInArgument() == 1 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curparameter,
+                                               pos_end-pos_curparameter);
+                      }
+                   }
+      | common
+      | save
+      | implicit
+      | dimension
+      | public
+      | private
+      | use_stat
+      | module_proc_stmt
+      | interface 
+      | namelist
+      | TOK_EXTERNAL opt_sep use_name_list
+      | TOK_EQUIVALENCE '(' list_expr ')'
+      | before_data data '\n'
+                   {
+                      /* we should remove the data declaration                */
+                     if (firstpass == 0 && aftercontainsdeclare == 0 )
+                     {
+                        pos_end = setposcur();
+                        RemoveWordSET(fortranout,pos_curdata,
+                                              pos_end-pos_curdata);
+                     }
+                  }
+      ;
+list_couple : '(' list_expr ')' 
+      | list_couple ',' '(' list_expr ')' 
+list_expr : expr
+      | list_expr ',' expr
+opt_sep :
+      | ':' ':'
+      ;
+after_type : dcl nodimsgiven 
+                   {
+                   /* if the variable is a parameter we can suppose that is   */
+                   /*    value is the same on each grid. It is not useless to */
+                   /*    create a copy of it on each grid                     */
+                      if ( couldaddvariable == 1 )
+                      {
+                         decl_1_ajoutevar($1);
+                         if ( VariableIsParameter == 1 ) globparam =
+                                            AddListvarToListvar($1,globparam,1);
+                         DECL_0_NonGridDepDeclaration($1);
+                         /* if variables has been declared in a subroutine    */
+                         if ( insubroutinedeclare == 1 )
+                         {
+                           OPTI_1_ajoutvarofsubroutine($1);
+                           OPTI_0_writesubroutinedeclaration($1);
+                         }
+                         /* If there are a SAVE declarations in module's      */
+                         /*    subroutines we should remove it from the       */
+                         /*    subroutines declaration and add it in the      */
+                         /*    global declarations                            */
+                         if ( aftercontainsdeclare == 1 ) 
+                         {
+                            decl_1_ajoutevarsave($1);
+                            decl_0_modifdeclarationssave($1);
+                         }
+                      }
+                      /* Case of common block                                 */
+                      indeclarationvar=0;
+                      PublicDeclare = 0;  
+                      PrivateDeclare = 0; 
+                      ExternalDeclare = 0; 
+                      lengspecgiven=0;
+                      PrecisionGiven = 0; 
+                      c_star = 0;
+                      CharacterSizeGiven = 0 ; 
+                      InitialValueGiven = 0 ;
+                      IntentDeclare = 0; 
+                      VariableIsParameter =  0 ; 
+                      Allocatabledeclare = 0 ;
+                      SaveDeclare = 0;
+                      pointerdeclare = 0;
+                      optionaldeclare = 0 ;
+                      dimsgiven=0;
+                      c_selectorgiven=0;
+                      inttypename=0;
+                   }
+      | TOK_FUNCTION TOK_NAME arglist
+                   {
+                      infunctiondeclare = 1 ;
+                      Listofvariableinagriffunction=(listnom *)NULL;
+                      strcpy(subroutinename,$2);
+                      if ( inmodulemeet == 1 )
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar($2,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            curvar=createvar($2,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            strcpy(curvar->modulename,subroutinename);
+                            curlistvar=insertvar(NULL,curvar);        
+                            varofsubroutineliste = AddListvarToListvar
+                                            (curlistvar,varofsubroutineliste,1);
+                         }
+                         if ( firstpass == 0 )
+                         {
+                            curvar=createvar($2,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            functionlistvar=insertvar(NULL,curvar);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                      else
+                      {
+                         tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                         insubroutinedeclare = 1;
+                         if ( firstpass == 0 ) 
+                         {
+                            adduseagrifutil = 0 ;
+                            AGRIF_n_AddUseAgrifUtil();
+                         }
+                         /* we should to list of the subroutine argument the  */
+                         /*    name of the function which has to be defined   */
+                         if ( firstpass == 1 ) 
+                         {
+                            curvar=createvar($2,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            curlistvar=insertvar(NULL,curvar);
+                            listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                            curvar=createvar($2,NULL);
+                            strcpy(curvar->typevar,DeclType);
+                            strcpy(curvar->modulename,subroutinename);
+                            curlistvar=insertvar(NULL,curvar);        
+                            varofsubroutineliste = AddListvarToListvar
+                                            (curlistvar,varofsubroutineliste,1);
+                         }
+                         /* in the second step we should write the head of    */
+                         /*    the subroutine sub_loop_<subroutinename>       */
+                         OPTI_0_writeheadnewsubforfunc();
+                         adduseagrifutil = 0 ; 
+                      }
+                   }
+      ;
+before_parameter : TOK_PARAMETER
+                   {
+                      if (firstpass == 0 )
+                      {
+                         pos_curparameter = setposcur()-9;
+                      }
+                   }      
+before_data : TOK_DATA
+                   {
+                      if (firstpass == 0 ) pos_curdata = setposcur()-4;
+                   }
+data: TOK_NAME TOK_SLASH datavallist TOK_SLASH
+                   {
+                      sprintf(ligne,"(/ %s /)",$3);
+                      DATA_n_CompleteDataList($1,ligne);
+                   }
+      | data opt_comma TOK_NAME TOK_SLASH datavallist TOK_SLASH
+                   {
+                      sprintf(ligne,"(/ %s /)",$5);
+                      DATA_n_CompleteDataList($3,ligne);
+                   }
+      ;
+datavallist : expr_data
+                   {
+                      strcpy($$,$1);
+                   }
+      | expr_data ',' datavallist 
+                   {
+                      sprintf($$,"%s,%s",$1,$3);
+                   }
+      ;
+expr_data : opt_signe simple_const
+                   {sprintf($$,"%s%s",$1,$2);}
+      | expr_data '+' expr_data
+                   {sprintf($$,"%s+%s",$1,$3);}
+      | expr_data '-' expr_data
+                   {sprintf($$,"%s+%s",$1,$3);}
+      | expr_data '*' expr_data
+                   {sprintf($$,"%s+%s",$1,$3);}
+      | expr_data '/' expr_data
+                   {sprintf($$,"%s+%s",$1,$3);}
+      ;
+opt_signe : 
+                   {strcpy($$,"");}
+      | signe
+                   {strcpy($$,$1);}
+      ;
+namelist:  namelist_action after_namelist
+      ;
+namelist_action : TOK_NAMELIST  ident 
+      | TOK_NAMELIST  comblock ident
+      {
+         if ( firstpass == 1 ) AddNameToListNamelist($2);
+      }
+      | namelist_action opt_comma comblock opt_comma ident
+      {
+         if ( firstpass == 1 ) AddNameToListNamelist($3);
+      }
+      | namelist_action ',' ident
+      ;
+after_namelist :
+      ;
+interface: TOK_INTERFACE opt_name
+      | TOK_ENDINTERFACE opt_name
+      ;
+dimension: TOK_DIMENSION  opt_comma TOK_NAME dims lengspec
+      | dimension ',' TOK_NAME dims lengspec
+      ;
+private: TOK_PRIVATE '\n'
+      | TOK_PRIVATE  use_name_list
+      ;
+public: TOK_PUBLIC '\n'
+      | TOK_PUBLIC  use_name_list 
+      ;
+use_name_list: TOK_NAME 
+      | use_name_list ',' TOK_NAME
+      ;
+common: before_common var_common_list
+                   {
+                         if (firstpass == 0 && fortran77 == 1 &&
+                             couldaddvariable == 1 )
+                         {
+                            pos_end = setposcur();
+                            RemoveWordSET(fortranout,pos_curcommon,
+                                                  pos_end-pos_curcommon);
+                         }
+                   }
+      | before_common comblock var_common_list
+                   {
+                         if ( couldaddvariable == 1 )
+                         {
+                            if (firstpass == 1 ) 
+                            {
+                               sprintf(charusemodule,"%s",$2);
+                               Add_ModuleTo_Modulelist($2);
+                            }
+                            if (firstpass == 0 && fortran77 == 1 )
+                            {
+                               pos_end = setposcur();
+                               RemoveWordSET(fortranout,pos_curcommon,
+                                                     pos_end-pos_curcommon);
+                            }
+                         }
+                   }
+      | common opt_comma comblock opt_comma var_common_list
+                   {
+                         if ( couldaddvariable == 1 )
+                         {
+                            if (firstpass == 1 ) 
+                            {
+                               sprintf(charusemodule,"%s",$3);
+                               Add_ModuleTo_Modulelist($3);
+                            }
+                            if (firstpass == 0 && fortran77 == 1 )
+                            {
+                               pos_end = setposcur();
+                               RemoveWordSET(fortranout,pos_curcommon,
+                                                     pos_end-pos_curcommon);
+                            }
+                         }
+                   }
+      ;
+before_common : TOK_COMMON
+                   {
+                      positioninblock=0;
+                      if (firstpass == 0 ) pos_curcommon = setposcur()-6;
+                   }
+var_common_list : var_common
+                   {
+                      if ( couldaddvariable == 1 ) COM_1_AddCommonvartolist();
+                   }
+
+     | var_common_list ',' var_common
+                   {
+                      if ( couldaddvariable == 1 ) COM_1_AddCommonvartolist();
+                   }
+var_common: TOK_NAME dims  
+                   {
+                      if ( couldaddvariable == 1 ) 
+                      {
+                         positioninblock = positioninblock + 1 ;
+                         strcpy(commonvar,$1);
+                         commondim = $2;
+                      }
+                   }
+      ;
+comblock: TOK_DSLASH 
+                   {
+                      if ( couldaddvariable == 1 ) 
+                      {
+                         strcpy($$,"");
+                         positioninblock=0;
+                         strcpy(commonblockname,"");
+                      }
+                   }
+      | TOK_SLASH TOK_NAME TOK_SLASH 
+                   {
+                      if ( couldaddvariable == 1 ) 
+                      {
+                         strcpy($$,$2);
+                         positioninblock=0;
+                         strcpy(commonblockname,$2);
+                      }
+                   }
+      ;
+save: TOK_SAVE varsave
+      | TOK_SAVE  comblock varsave
+      | save opt_comma comblock opt_comma varsave
+      | save ',' varsave
+      ;
+varsave: 
+      | TOK_NAME dims 
+      ;
+      
+opt_comma:
+      | ','
+      ;
+paramlist: paramitem
+                   {
+                      if ( firstpass == 1 ) $$=insertvar(NULL,$1);
+                   }
+      | paramlist ',' paramitem
+                   {
+                      if ( firstpass == 1 ) $$=insertvar($1,$3);
+                   }
+      ;
+paramitem : TOK_NAME '=' expr
+                   {
+                      if ( firstpass == 1 )
+                      {
+                         curvar=(variable *) malloc(sizeof(variable));
+                         strcpy(curvar->nomvar,$1);
+                         strcpy(curvar->subroutinename,subroutinename);
+                         strcpy(curvar->modulename,subroutinename);
+                         curvar->isparameter=1;
+                         strcpy(curvar->initialvalue,$3);
+                         $$=curvar;
+                      }
+                   }
+      ;
+module_proc_stmt: TOK_PROCEDURE proc_name_list
+      ;
+proc_name_list: TOK_NAME
+      | proc_name_list ',' TOK_NAME
+      ;
+implicit: TOK_IMPLICIT TOK_NONE
+                    {
+                       if ( firstpass == 1 && insubroutinedeclare == 1 )
+                       {
+                           listimplicitnone = Add_listname
+                                              (subroutinename,listimplicitnone);
+                       }
+                       if ( firstpass == 0               && 
+                            tmpdeclaration_everdone == 1 && 
+                            inmoduledeclare == 0 )
+                       {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_end-13,
+                                               13);
+                       }
+                    }
+      ;
+opt_retour :
+      ;
+dcl : options opt_retour TOK_NAME dims lengspec initial_value
+                   {
+                      if ( couldaddvariable == 1 )
+                      {
+                         if ( inmoduledeclare == 1 || SaveDeclare == 1 )
+                         {
+                            if ( MOD_n_InstanceShouldMadeInModule() == 1 ) 
+                            {
+                               MOD_1_InstanceTo1InModule();
+                            }
+                         }      
+                         /*                                                   */
+                         if (dimsgiven == 1) 
+                         {
+                            curvar=createvar($3,curdim);
+                         }
+                         else
+                         {
+                            curvar=createvar($3,$4);
+                         }
+                         /*                                                   */
+                         CreateAndFillin_Curvar(DeclType,$3,$4,curvar);
+                         /*                                                   */
+                         curlistvar=insertvar(NULL,curvar);
+                         if (!strcasecmp(DeclType,"character")) 
+                         {
+                            if (c_selectorgiven == 1) 
+                            {
+                               strcpy(c_selectordim.first,"1");
+                               strcpy(c_selectordim.last,c_selectorname);
+                               change_dim_char
+                                     (insertdim(NULL,c_selectordim),curlistvar);
+                            }
+                         }
+                         $$=settype(DeclType,curlistvar);
+                      }
+                      lengspecgiven=0;
+                      strcpy(vallengspec,"");
+                   }
+      | dcl ',' opt_retour TOK_NAME dims lengspec initial_value
+                   {
+                      if ( couldaddvariable == 1 )
+                      {
+                         if (dimsgiven == 1) 
+                         {
+                            curvar=createvar($4,curdim);
+                         }
+                         else
+                         {
+                            curvar=createvar($4,$5);
+                         }
+                         /*                                                   */ 
+                         CreateAndFillin_Curvar($1->var->typevar,$4,$5,curvar);
+                         /*                                                   */
+                         curvar->typegiven=1;
+                         strcpy(curvar->typevar,($1->var->typevar));
+                         /*                                                   */
+                         curlistvar=insertvar($1,curvar);
+                         if (!strcasecmp(DeclType,"character")) 
+                         {
+                            if (c_selectorgiven == 1) 
+                            {
+                               strcpy(c_selectordim.first,"1");
+                               strcpy(c_selectordim.last,c_selectorname);
+                               change_dim_char
+                                     (insertdim(NULL,c_selectordim),curlistvar);
+                            }
+                         }
+                         $$=curlistvar;
+                      }
+                      lengspecgiven=0;
+                      strcpy(vallengspec,"");
+                   }
+      ;      
+nodimsgiven:       {dimsgiven=0;}
+      ;
+type:typespec selector 
+                   {strcpy(DeclType,$1);indeclarationvar=1;}
+      | before_character c_selector 
+                   {
+                      indeclarationvar=1;
+                      strcpy(DeclType,"CHARACTER");
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                      }
+                   }
+      | typename '*' TOK_CSTINT
+                   {
+                      indeclarationvar=1;
+                      strcpy(DeclType,$1);
+                      inttypename=1;
+                      strcpy(nameinttypename,$3);
+                   }
+      ;
+c_selector:
+      | '*' TOK_CSTINT 
+                   {c_selectorgiven=1;strcpy(c_selectorname,$2);}
+      | '*' '(' c_attribute ')' {c_star = 1;}
+      | '(' c_attribute ')' 
+      ;
+c_attribute: TOK_NAME clause opt_clause 
+      | TOK_NAME '=' clause opt_clause 
+      | clause opt_clause 
+      ;
+before_character : TOK_CHARACTER
+                   {
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-9;
+                      }
+                   }
+      ;
+typespec: typename {strcpy($$,$1);}
+      ;
+typename: TOK_INTEGER 
+                   {
+                      strcpy($$,"INTEGER");
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-7;
+                      }
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                       }
+                   }
+      | TOK_REAL   {
+                      strcpy($$,"REAL"); 
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-4;
+                      }
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                      }
+                   }
+      | TOK_COMPLEX      
+                   {strcpy($$,"COMPLEX");}
+      | TOK_DOUBLEPRECISION 
+                   {strcpy($$,"DOUBLE PRECISION");}
+      | TOK_DOUBLECOMPLEX 
+                   {strcpy($$,"DOUBLE COMPLEX");}
+      | TOK_LOGICAL      
+                   {
+                      strcpy($$,"LOGICAL");
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-7;
+                      }
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo1InModule();
+                      }
+                   }
+      | TOK_TYPE      
+                   {
+                      if ( firstpass == 0 ) 
+                      {
+                         pos_cur_decl = setposcur();
+                         pos_cur_decl = pos_cur_decl-5;
+                      }
+                      strcpy($$,"TYPE");
+                   }
+      ;
+lengspec:
+      | '*' proper_lengspec {lengspecgiven=1;strcpy(vallengspec,$2);}
+      ;
+proper_lengspec: expr {sprintf($$,"*%s",$1);}
+      | '(' '*' ')'{strcpy($$,"*(*)");}
+      ;
+selector:
+      | '*' proper_selector
+      | '(' attribute ')' 
+      ;
+proper_selector: expr
+      | '(' '*' ')'
+      ;
+attribute: TOK_NAME clause 
+      | TOK_NAME '=' clause  
+                   {
+                      PrecisionGiven = 1; 
+                      sprintf(NamePrecision,"%s = %s",$1,$3);  
+                   }
+      | TOK_NAME
+                   {
+                      PrecisionGiven = 1; 
+                      strcpy(NamePrecision,$1);  
+                   }
+      ;
+clause: expr       {strcpy(CharacterSize,$1);
+                    CharacterSizeGiven = 1;strcpy($$,$1);}
+      | '*'        {strcpy(CharacterSize,"*");
+                    CharacterSizeGiven = 1;strcpy($$,"*");} 
+      ;
+opt_clause: 
+      | ',' TOK_NAME clause
+      ;
+options:
+      | ':' ':'
+      | ',' attr_spec_list ':' ':'
+      ;
+attr_spec_list: attr_spec
+      | attr_spec_list ',' attr_spec
+      ;
+attr_spec: TOK_PARAMETER 
+                   {
+                      VariableIsParameter = 1;
+                      if (inmoduledeclare == 1 ) 
+                      {
+                         MOD_1_InstanceShouldMadeTo0InModule();
+                      }
+                   }
+      | access_spec
+      | TOK_ALLOCATABLE 
+                   {Allocatabledeclare = 1;}
+      | TOK_DIMENSION dims 
+                   {
+                      dimsgiven=1; 
+                      curdim=$2;
+                   }
+      | TOK_EXTERNAL  
+                   {ExternalDeclare = 1;} 
+      | TOK_INTENT '(' intent_spec ')' 
+                   {IntentDeclare = 1; strcpy(IntentSpec,$3);}
+      | TOK_INTRINSIC
+      | TOK_OPTIONAL{optionaldeclare = 1 ;}
+      | TOK_POINTER {pointerdeclare = 1 ;}
+      | TOK_SAVE    {
+                       if ( inmodulemeet == 1 )
+                       {
+                          SaveDeclare = 1 ;
+                          Savemeet = 1;
+                          MOD_1_InstanceShouldMadeTo1InModule();
+                       }
+                    }
+      | TOK_TARGET
+      ;
+intent_spec: TOK_IN {sprintf($$,"in");}
+      | TOK_OUT     {sprintf($$,"out");}
+      | TOK_INOUT   {sprintf($$,"inout");}
+      ; 
+access_spec: TOK_PUBLIC 
+                   {PublicDeclare = 1;} 
+      | TOK_PRIVATE 
+                   {PrivateDeclare = 1;} 
+      ;
+dims:              {$$=(listdim *)NULL;}
+      | '(' dimlist ')'  
+                   {$$=reverse($2);}
+      ;
+dimlist:   dim     {$$=insertdim(NULL,$1);}
+      | dimlist ',' dim 
+                   {$$=insertdim($1,$3);}
+      ;
+dim:ubound         {strcpy($$.first,"1");strcpy($$.last,$1);}
+      | ':'        {strcpy($$.first,"");strcpy($$.last,"");}
+      | expr ':'   {strcpy($$.first,$1);strcpy($$.last,"");}
+      | ':' expr   {strcpy($$.first,"");strcpy($$.last,$2);}
+      | expr ':' ubound
+                   {strcpy($$.first,$1);strcpy($$.last,$3);}
+      ;
+ubound:  '*'       {strcpy($$,"*");}
+      | expr       {strcpy($$,$1);}
+      ;
+expr:  uexpr       {strcpy($$,$1);}
+      | '(' expr ')' 
+                   {sprintf($$,"(%s)",$2);}
+      | complex_const 
+                   {strcpy($$,$1);}
+      | predefinedfunction
+      ;
+      
+predefinedfunction : TOK_SUM minmaxlist ')' 
+                   {sprintf($$,"SUM(%s)",$2);}
+      | TOK_MAX '(' minmaxlist ')'
+                   {sprintf($$,"MAX(%s)",$3);}
+      | TOK_TANH '(' minmaxlist ')'
+                   {sprintf($$,"TANH(%s)",$3);}
+      | TOK_MAXVAL '(' minmaxlist ')'
+                   {sprintf($$,"MAXVAL(%s)",$3);}
+      | TOK_MIN minmaxlist ')'
+                   {sprintf($$,"MIN(%s)",$2);}
+      | TOK_MINVAL '(' minmaxlist ')'
+                   {sprintf($$,"MINVAL(%s)",$3);}
+      | TOK_TRIM '(' expr ')'
+                   {sprintf($$,"TRIM(%s)",$3);}
+      | TOK_SQRT '(' expr ')'
+                   {sprintf($$,"SQRT(%s)",$3);}
+      | TOK_REAL '(' expr ')'
+                   {sprintf($$,"REAL(%s)",$3);}
+      | TOK_INT '(' expr ')'
+                   {sprintf($$,"INT(%s)",$3);}                   
+      | TOK_NINT '(' expr ')'
+                   {sprintf($$,"NINT(%s)",$3);}                   
+      | TOK_FLOAT '(' expr ')'
+                   {sprintf($$,"FLOAT(%s)",$3);}
+      | TOK_EXP '(' expr ')'
+                   {sprintf($$,"EXP(%s)",$3);}
+      | TOK_COS '(' expr ')'
+                   {sprintf($$,"COS(%s)",$3);}
+      | TOK_COSH '(' expr ')'
+                   {sprintf($$,"COSH(%s)",$3);}
+      | TOK_ACOS '(' expr ')'
+                   {sprintf($$,"ACOS(%s)",$3);}
+      | TOK_SIN '(' expr ')'
+                   {sprintf($$,"SIN(%s)",$3);}
+      | TOK_SINH '(' expr ')'
+                   {sprintf($$,"SINH(%s)",$3);}
+      | TOK_ASIN '(' expr ')'
+                   {sprintf($$,"ASIN(%s)",$3);}
+      | TOK_LOG '(' expr ')'
+                   {sprintf($$,"LOG(%s)",$3);}
+      | TOK_TAN '(' expr ')'
+                   {sprintf($$,"TAN(%s)",$3);}
+      | TOK_ATAN '(' expr ')'
+                   {sprintf($$,"ATAN(%s)",$3);}
+      | TOK_ABS '(' expr ')'
+                   {sprintf($$,"ABS(%s)",$3);}
+      | TOK_MOD '(' minmaxlist ')'
+                   {sprintf($$,"MOD(%s)",$3);}
+      | TOK_SIGN '(' minmaxlist ')'
+                   {sprintf($$,"SIGN(%s)",$3);}
+      | TOK_MINLOC '(' minmaxlist ')'
+                   {sprintf($$,"MINLOC(%s)",$3);}
+      | TOK_MAXLOC '(' minmaxlist ')'
+                   {sprintf($$,"MAXLOC(%s)",$3);}
+      ;
+minmaxlist : expr {strcpy($$,$1);}
+      | minmaxlist ',' expr 
+                   {strcpy($$,$1);strcat($$,",");strcat($$,$3);}
+      ;
+uexpr:  lhs        {strcpy($$,$1);} 
+      | simple_const 
+                   {strcpy($$,$1);} 
+      | vec 
+                   {strcpy($$,$1);} 
+      | expr operation
+                   {sprintf($$,"%s%s",$1,$2);}
+      | signe expr %prec '* ' 
+                   {sprintf($$,"%s%s",$1,$2);}
+      | TOK_NOT expr 
+                   {sprintf($$,"%s%s",$1,$2);}
+      ;
+signe : '+'        {strcpy($$,"+");}
+      | '-'        {strcpy($$,"-");}
+      ;
+operation : '+' expr %prec '+' 
+                   {sprintf($$,"+%s",$2);}
+      |  '-' expr %prec '+' 
+                   {sprintf($$,"-%s",$2);}
+      |  '*' expr 
+                   {sprintf($$,"*%s",$2);}
+      |  TOK_DASTER expr 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  TOK_EQ expr %prec TOK_EQ 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  TOK_GT expr %prec TOK_EQ 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  '>' expr %prec TOK_EQ 
+                   {sprintf($$," > %s",$2);}
+      |  TOK_LT expr %prec TOK_EQ 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  '<' expr %prec TOK_EQ 
+                   {sprintf($$," < %s",$2);}
+      |  TOK_GE expr %prec TOK_EQ 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  '>''=' expr %prec TOK_EQ 
+                   {sprintf($$," >= %s",$3);}
+      |  TOK_LE expr %prec TOK_EQ
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  '<''=' expr %prec TOK_EQ 
+                   {sprintf($$," <= %s",$3);}
+      |  TOK_NE expr %prec TOK_EQ 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  TOK_XOR expr 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  TOK_OR expr 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  TOK_AND expr 
+                   {sprintf($$,"%s%s",$1,$2);}
+      |  TOK_SLASH after_slash
+                   {sprintf($$,"%s",$2);}
+      |  '=' after_equal
+                   {sprintf($$,"%s",$2);}
+
+after_slash : expr 
+                   {sprintf($$,"/%s",$1);}
+      | '=' expr %prec TOK_EQ 
+                   {sprintf($$,"== %s",$2);}
+      | TOK_SLASH expr
+                   {sprintf($$,"//%s",$2);}
+      ;
+after_equal : '=' expr %prec TOK_EQ 
+                   {sprintf($$,"==%s",$2);}
+      | expr
+                   {sprintf($$,"= %s",$1);}
+      ;
+      
+lhs: ident         {strcpy($$,$1);} 
+      | structure_component 
+                   {strcpy($$,$1);} 
+      | array_ele_substring_func_ref 
+                   {strcpy($$,$1);} 
+      ;
+beforefunctionuse : {
+                      agrif_parentcall =0;
+                      if (!strcasecmp(identcopy,"Agrif_Parent") )
+                                                            agrif_parentcall =1;
+                      if ( AGRIF_n_Agrif_in_Tok_NAME(identcopy) == 1 )
+                      { 
+                         inagrifcallargument = 1;
+                         AGRIF_n_AddsubroutineTolistsubwhereagrifused();
+                      }
+                   }
+      ;
+array_ele_substring_func_ref: begin_array
+                   {
+                     strcpy($$,$1);
+                     if ( incalldeclare == 0 ) inagrifcallargument = 0;
+                   }
+      | begin_array substring 
+                   {sprintf($$," %s %s ",$1,$2);}
+      | structure_component '(' funarglist ')' 
+                   {sprintf($$," %s ( %s )",$1,$3);}
+      | structure_component '(' funarglist ')' substring 
+                   {sprintf($$," %s ( %s ) %s ",$1,$3,$5);}
+      ;
+begin_array : ident '(' funarglist ')'
+                   {
+                      sprintf($$," %s ( %s )",$1,$3);
+                      AGRIF_0_ModifyTheAgrifFunction($3);
+                     agrif_parentcall =0; 
+                   }
+      ;
+structure_component: lhs '%' lhs 
+                   {
+                      sprintf($$," %s %% %s ",$1,$3);
+                     if ( incalldeclare == 0 ) inagrifcallargument = 0;
+                   }
+      ;
+vec:  TOK_LEFTAB outlist TOK_RIGHTAB 
+                   {sprintf($$,"(/%s/)",$2);} 
+      ;
+funarglist: beforefunctionuse    {strcpy($$," ");}
+      | beforefunctionuse funargs  
+                   {strcpy($$,$2);}
+      ;
+funargs: funarg     {strcpy($$,$1);}
+      | funargs ',' funarg 
+                    {sprintf($$,"%s,%s",$1,$3);} 
+      ;
+funarg: expr       {strcpy($$,$1);}
+      | triplet    {strcpy($$,$1);}
+      ;
+triplet: expr ':' expr 
+                    {sprintf($$,"%s:%s",$1,$3);} 
+      | expr ':' expr ':' expr 
+                    {sprintf($$,"%s:%s:%s",$1,$3,$5);} 
+      | ':' expr ':' expr 
+                    {sprintf($$,":%s:%s",$2,$4);} 
+      | ':' ':' expr{sprintf($$,": : %s",$3);} 
+      | ':' expr    {sprintf($$,":%s",$2);} 
+      | expr ':'     {sprintf($$,"%s:",$1);} 
+      | ':'         {sprintf($$,":");} 
+      ;
+ident : TOK_NAME    {  
+                       strcpy(identcopy,$1);
+                       pointedvar=0;
+                       if ( VarIsNonGridDepend($1) == 0 &&
+                            formatdeclare == 0 
+                          )
+                       {
+                          if ( inagrifcallargument == 1 ||
+                               OPTI_0_varisallocatable($1) == 1 ||
+			       OPTI_0_varispointer($1) == 1 )
+                          {
+                             AGRIF_0_ModifyTheVariableName($1);
+                          }
+                          if ( inagrifcallargument != 1 )
+                               OPTI_1_ajoutevarindoloop($1);
+                       }
+                       AGRIF_0_NotifyAgrifFunction($1);
+                    }       
+      ;
+simple_const: TOK_TRUE 
+                     {strcpy($$,".TRUE.");}
+      | TOK_FALSE    {strcpy($$,".FALSE.");}
+      | TOK_CSTINT   {strcpy($$,$1);}
+      | TOK_CSTREAL  {strcpy($$,$1);}
+      | TOK_CSTREALDP{strcpy($$,$1);}
+      | TOK_CSTREALQP{strcpy($$,$1);}
+      | simple_const TOK_NAME 
+                     {sprintf($$,"%s%s",$1,$2);}
+      | string_constant opt_substring
+      ;
+string_constant: TOK_CHAR_CONSTANT 
+                     {strcpy($$,$1);}
+      | string_constant TOK_CHAR_CONSTANT 
+      | TOK_CHAR_MESSAGE 
+                     {strcpy($$,$1);}
+      | TOK_CHAR_CUT
+                     {strcpy($$,$1);}
+      ;
+opt_substring:      {strcpy($$," ");}
+      | substring   {strcpy($$,$1);}
+      ;
+substring: '(' optexpr ':' optexpr ')' 
+                    {sprintf($$,"(%s:%s)",$2,$4);} 
+      ;
+optexpr:           {strcpy($$," ");}
+      | expr        {strcpy($$,$1);}
+      ;
+opt_expr: '\n'          {strcpy($$," ");}
+      | expr        {strcpy($$,$1);}
+      ;
+initial_value:      {InitialValueGiven = 0;}
+      | before_initial '=' expr    
+                    {
+                       strcpy(InitValue,$3);
+                       InitialValueGiven = 1;
+                    } 
+      ;
+before_initial : {if ( firstpass == 0 ) pos_curinit = setposcur();}
+      ;
+complex_const: '(' uexpr ',' uexpr ')' 
+                    {sprintf($$,"(%s,%s)",$2,$4);} 
+      ;
+use_stat: word_use  module_name
+                    {
+                      /* if variables has been declared in a subroutine       */
+                      if (insubroutinedeclare == 1)
+                      {
+                         OPTI_0_copyuse($2);
+                      }
+                      if (firstpass == 1 ) 
+                      {
+                         sprintf(charusemodule,"%s",$2);
+                         Addmoduletothelist($2);
+                      }
+                      if ( firstpass == 0 && inmoduledeclare == 0 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curuse,
+                                               pos_end-pos_curuse);
+                      }
+                    }    
+      | word_use  module_name ',' rename_list
+                    {
+                      if (insubroutinedeclare == 1)
+                      {
+                         OPTI_1_completelistvarpointtovar($2,$4);
+                      }
+                      if ( firstpass == 1 ) 
+                      {
+                         if ( insubroutinedeclare == 1 )
+                         {
+                            coupletmp = $4;
+                            strcpy(ligne,"");
+                            while ( coupletmp )
+                            {
+                               strcat(ligne,coupletmp->namevar);
+                               strcat(ligne," => ");
+                               strcat(ligne,coupletmp->namepointedvar);
+                               coupletmp = coupletmp->suiv;
+                               if ( coupletmp ) strcat(ligne,",");
+                            }
+                            sprintf(charusemodule,"%s",$2);
+                         }
+                         Addmoduletothelist($2);
+                      }
+                      if ( firstpass == 0  && inmoduledeclare == 0 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curuse,
+                                               pos_end-pos_curuse);
+                      }
+                    }    
+      | word_use  module_name ',' TOK_ONLY ':' '\n'
+                    {
+                      /* if variables has been declared in a subroutine       */
+                      if (insubroutinedeclare == 1)
+                      {
+                         OPTI_0_copyuseonly($2);
+                      }
+                      if (firstpass == 1 ) 
+                      {
+                         sprintf(charusemodule,"%s",$2);
+                         Addmoduletothelist($2);
+                      }
+                       if ( firstpass == 0  && inmoduledeclare == 0 )
+                       {
+                          pos_end = setposcur();
+                          RemoveWordSET(fortranout,pos_curuse,
+                                                pos_end-pos_curuse);
+                       }
+                    }    
+      | word_use  module_name ',' TOK_ONLY ':' only_list
+                    {
+                       /* if variables has been declared in a subroutine      */
+                       if (insubroutinedeclare == 1)
+                       {
+                          OPTI_1_completelistvarpointtovar($2,$6);
+                       }
+                       if ( firstpass == 1 ) 
+                       {
+                         if ( insubroutinedeclare == 1 )
+                         {
+                             coupletmp = $6;
+                             strcpy(ligne,"");
+                             while ( coupletmp )
+                             {
+                                strcat(ligne,coupletmp->namevar);
+                                if ( strcasecmp(coupletmp->namepointedvar,"") )
+                                                           strcat(ligne," => ");
+                                strcat(ligne,coupletmp->namepointedvar);
+                                coupletmp = coupletmp->suiv;
+                                if ( coupletmp ) strcat(ligne,",");
+                             }
+                             sprintf(charusemodule,"%s",$2);
+                          }
+                          Addmoduletothelist($2);
+                       }
+                       if ( firstpass == 0  && inmoduledeclare == 0 )
+                       {
+                          pos_end = setposcur();
+                          RemoveWordSET(fortranout,pos_curuse,
+                                                pos_end-pos_curuse);
+                       }
+                    }    
+      ;
+word_use : TOK_USE
+                   {
+                      if ( firstpass == 0 ) pos_curuse = setposcur()-3;
+                   }
+      ;
+module_name: TOK_NAME 
+                    {strcpy($$,$1);}
+      ;
+rename_list: rename_name
+                    {
+                       $$ = $1;
+                    }                    
+      | rename_list ',' rename_name
+                    {
+                        /* insert the variable in the list $1                 */
+                        $3->suiv = $1;
+                        $$ = $3;
+                    }
+      ;
+rename_name: TOK_NAME TOK_POINT_TO TOK_NAME
+                    {
+                       coupletmp =(listcouple *)malloc(sizeof(listcouple));
+                       strcpy(coupletmp->namevar,$1);
+                       strcpy(coupletmp->namepointedvar,$3);
+                       coupletmp->suiv = NULL;
+                       $$ = coupletmp;
+                     }
+      ;
+only_list: only_name 
+                    {
+                       $$ = $1;
+                    }                    
+      | only_list ',' only_name
+                    {
+                        /* insert the variable in the list $1                 */
+                        $3->suiv = $1;
+                        $$ = $3;
+                    }
+      ;
+only_name: TOK_NAME TOK_POINT_TO TOK_NAME 
+                    {
+                       coupletmp =(listcouple *)malloc(sizeof(listcouple));
+                       strcpy(coupletmp->namevar,$1);
+                       strcpy(coupletmp->namepointedvar,$3);
+                       coupletmp->suiv = NULL;
+                       $$ = coupletmp;
+                       pointedvar=1;
+                       OPTI_1_ajoutevarindoloop($1);
+                    }
+      | TOK_NAME    {
+                       coupletmp =(listcouple *)malloc(sizeof(listcouple));
+                       strcpy(coupletmp->namevar,$1);
+                       strcpy(coupletmp->namepointedvar,"");
+                       coupletmp->suiv = NULL;
+                       $$ = coupletmp;
+                     }
+      ;
+exec: iffable
+      | TOK_ALLOCATE '(' allocation_list opt_stat_spec ')'
+      | TOK_DEALLOCATE '(' allocate_object_list opt_stat_spec ')'
+      | TOK_NULLIFY '(' pointer_name_list ')'
+      | TOK_ENDUNIT /* end                                                    */
+                    {
+                       if ( inmodulemeet == 1 )
+                       {
+                         /* we are in a module                                */
+                         if ( insubroutinedeclare == 1 )
+                         {
+                            /* it is like an end subroutine <name>            */
+                            insubroutinedeclare = 0 ;
+                            paramdeclaration_everdone = 0;
+                            tmpdeclaration_everdone = 0;
+                            /*                                                */
+                            OPTI_0_closeandcallsubloopandincludeit(1,$1,"");
+                            /* at the end of the firstpass we should remove   */
+                            /*    from the listvarindoloop all variables      */
+                            /*    which has not been declared as table in the */
+                            /*    globliste                                   */
+                            OPTI_1_cleanlistvarfordoloop(1);
+                         }
+                         else
+                         {
+                            /* if we never meet the contains keyword          */
+                            if ( inmoduledeclare == 1 )
+                            {
+                               if ( aftercontainsdeclare == 0 )
+                               {
+                                  if ( firstpass == 1) 
+                                         DATA_1_CompleteGlobListeWithDatalist();
+                                 addi_0_addsubroutine_inst_back_alloc(1);
+                               }
+                            }
+                            /* it is like an end module <name>                */
+                            inmoduledeclare = 0 ; 
+                            inmodulemeet = 0 ; 
+                         }
+                       }
+                       else
+                       {
+                          paramdeclaration_everdone = 0;
+                          tmpdeclaration_everdone = 0;
+                          insubroutinedeclare = 0;
+                          /*                                                  */
+                          OPTI_0_closeandcallsubloopandincludeit(2,$1,"");
+                          /* it is like end subroutine or end program         */
+                          /*  Common case                                     */
+                          /* at the end of the firstpass we should remove     */
+                          /*    from the listvarindoloop all variables which  */
+                          /*    has not been declared as table in the         */
+                          /*    globliste                                     */
+                          OPTI_1_cleanlistvarfordoloop(1);
+                       }
+                    }
+      | TOK_ENDPROGRAM opt_name
+                    {
+                       tmpdeclaration_everdone = 0;
+                         paramdeclaration_everdone = 0;
+                       insubroutinedeclare = 0;
+                       /*                                                     */
+                       OPTI_0_closeandcallsubloopandincludeit(3,$1,$2);
+                       /*  Common case                                        */
+                       /* at the end of the firstpass we should remove from   */
+                       /*    the listvarindoloop all variables which has not  */
+                       /*    been declared as table in the globliste          */
+                       OPTI_1_cleanlistvarfordoloop(3);
+                    }
+      | TOK_ENDSUBROUTINE opt_name
+                    {
+                       tmpdeclaration_everdone = 0;
+                       paramdeclaration_everdone = 0;
+                       insubroutinedeclare = 0;
+                       /*                                                     */
+                       OPTI_0_closeandcallsubloopandincludeit(1,$1,$2);
+                       /*  Common case                                        */
+                       /* at the end of the firstpass we should remove from   */
+                       /*    the listvarindoloop all variables which has not  */
+                       /*    been declared as table in the globliste          */
+                       OPTI_1_cleanlistvarfordoloop(1);
+                    }
+      | TOK_ENDFUNCTION opt_name
+                    {
+                       tmpdeclaration_everdone = 0;
+                       paramdeclaration_everdone = 0;
+                       insubroutinedeclare = 0;
+                       /*                                                     */
+                       OPTI_0_closeandcallsubloopandincludeit(0,$1,$2);
+                       /*  Common case                                        */
+                       /* at the end of the firstpass we should remove from   */
+                       /*    the listvarindoloop all variables which has not  */
+                       /*    been declared as table in the globliste          */
+                       OPTI_1_cleanlistvarfordoloop(0);
+                    }
+      | TOK_ENDMODULE opt_name
+                    {
+                       /* if we never meet the contains keyword               */
+                       if ( inmoduledeclare == 1 )
+                       {
+                          if ( aftercontainsdeclare == 0 )
+                          {
+                             if ( firstpass == 1) 
+                                         DATA_1_CompleteGlobListeWithDatalist();
+                             addi_0_addsubroutine_inst_back_alloc(1);
+                          }
+                       }
+                       inmoduledeclare = 0 ; 
+                       inmodulemeet = 0 ; 
+                  }
+      | boucledo
+      | logif iffable
+      | TOK_WHERE '(' expr ')' opt_expr
+      | TOK_ELSEWHERE
+      | TOK_ENDWHERE
+      | logif TOK_THEN
+      | TOK_ELSEIF  '(' expr ')' TOK_THEN
+      | TOK_ELSE 
+      | TOK_ENDIF
+      | TOK_CASE '(' caselist ')'
+      | TOK_SELECTCASE '(' expr ')'
+      | TOK_CASEDEFAULT
+      | TOK_ENDSELECT
+      | TOK_CONTAINS
+                   {
+                      if (inmoduledeclare == 1 )
+                      {
+                         if ( firstpass == 1) 
+                                         DATA_1_CompleteGlobListeWithDatalist();
+                         addi_0_addsubroutine_inst_back_alloc(0);
+                      }
+                      inmoduledeclare = 0 ; 
+                      aftercontainsdeclare = 1;
+                   }
+      ;
+
+caselist: expr
+      | caselist ',' expr
+      | caselist ':' expr
+      ;
+boucledo : worddo do_var '=' expr ',' expr
+      | worddo do_var '=' expr ',' expr ',' expr
+      | wordwhile expr
+      | TOK_ENDDO optname
+      ;
+opt_name : '\n'  {strcpy($$,"");}
+      | TOK_NAME {strcpy($$,$1);}
+      ;
+optname :
+      | TOK_NAME
+      ;
+worddo :  TOK_PLAINDO
+      ;
+wordwhile :TOK_DOWHILE
+      ;     
+
+dotarget:
+      | TOK_CSTINT
+      ;
+
+iffable: TOK_CONTINUE
+      | ident dims dims after_ident_dims
+      | structure_component after_ident_dims
+      | goto
+      | io
+      | call 
+      | TOK_EXIT opt_name
+      | TOK_RETURN optexpr
+      | stop opt_expr
+      ;
+after_ident_dims : '=' expr 
+                   {sprintf($$,"=%s",$2);}
+      | TOK_POINT_TO expr 
+                   {sprintf($$,"=>%s",$2);}
+      ;
+call: keywordcall opt_call 
+                   {
+                      inagrifcallargument = 0 ;
+                      incalldeclare=0;
+                      if ( oldfortranout && 
+                           !strcmp(meetagrifinitgrids,subroutinename) && 
+                           firstpass == 0 &&
+                           callmpiinit == 1)
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curcall,
+                                               pos_end-pos_curcall);
+                         fprintf(oldfortranout,"      Call MPI_Init (%s) \n"
+                                                                   ,mpiinitvar);
+                      }
+                      if ( oldfortranout           && 
+                           callagrifinitgrids == 1 && 
+                           firstpass == 0 )
+                      {
+                         pos_end = setposcur();
+                         RemoveWordSET(fortranout,pos_curcall,
+                                               pos_end-pos_curcall);
+                         fprintf(oldfortranout,
+                                           "      Call Agrif_Init_Grids () \n");
+                         strcpy(subofagrifinitgrids,subroutinename);
+                      }
+                   }
+      ;
+opt_call : 
+      | '(' opt_callarglist  ')'
+      ;
+opt_callarglist :
+      | callarglist
+      ;
+keywordcall : before_call TOK_NAME 
+                    {
+                       if (!strcasecmp($2,"MPI_Init") ) 
+                       {
+                          callmpiinit = 1;
+                          strcpy(meetmpiinit,subroutinename);
+                       }
+                       else
+                       {
+                          callmpiinit = 0;
+                       }
+                       if (!strcasecmp($2,"Agrif_Init_Grids") ) 
+                       {
+                          callagrifinitgrids = 1;
+                          strcpy(meetagrifinitgrids,subroutinename);
+                       }
+                       else callagrifinitgrids = 0;
+                       if ( AGRIF_n_Vartonumber($2) == 1 ) 
+                       {
+                          incalldeclare=1;
+                          inagrifcallargument = 1 ;
+                          AGRIF_n_AddsubroutineTolistsubwhereagrifused();
+                       }
+                    }
+      ;
+before_call : TOK_CALL
+                    {if ( firstpass == 0 ) pos_curcall=setposcur()-4;}
+callarglist:  callarg
+      | callarglist ',' callarg
+      ;
+
+callarg:  expr {
+                  if ( callmpiinit == 1 ) 
+                  {
+                     strcpy(mpiinitvar,$1);
+                     if ( firstpass == 1 ) 
+                     {
+                        curvar=createvar($1,NULL);
+                        curlistvar=insertvar(NULL,curvar);
+                        listargsubroutine = AddListvarToListvar
+                                               (curlistvar,listargsubroutine,1);
+                     }
+                  }
+               }
+      | '*' label
+      ;
+
+stop: TOK_PAUSE
+      | TOK_STOP
+      ;
+
+io: iofctl ioctl
+      | read option_read
+      | write '(' idfile  opt_ioctl_format ')' opt_outlist
+                    {formatdeclare = 0;}
+      | TOK_REWIND after_rewind
+      | print option_print
+      | wordformat debut_format ioctl_format fin_format
+                    {formatdeclare = 0;}
+      ;
+wordformat : TOK_FORMAT
+                    {formatdeclare = 1;}
+opt_ioctl_format : 
+      | ',' ioctl_format
+      | ',' '*'
+      ;
+debut_format : TOK_LEFTAB opt_comma
+      | '('
+      ;
+ioctl_format : format_expr
+      |   ioctl_format ',' format_expr
+      ;
+format_expr : uexpr
+      | TOK_CSTINT TOK_CHAR_INT
+      | TOK_CSTINT debut_format ioctl_format fin_format
+      | TOK_SLASH opt_CHAR_INT
+      | TOK_CHAR_INT
+      ;
+opt_CHAR_INT : 
+      | TOK_CSTINT TOK_NAME
+      ;
+fin_format : opt_comma TOK_RIGHTAB opt_comma
+      | ')'
+      ;
+idfile : '*'
+      | TOK_CSTINT
+      | ident
+      ;
+option_print :
+      | ',' outlist
+      ;
+option_inlist :
+      | inlist
+      ;
+option_read : ioctl option_inlist
+      | infmt opt_inlist
+      ;
+opt_outlist :
+      | outlist
+      ;
+opt_inlist :
+      | ',' inlist
+      ;
+ioctl:  '(' ctllist ')'
+      | '(' fexpr ')' 
+      ;
+after_rewind:  '(' ident ')'
+      | TOK_NAME
+      ;
+ctllist: ioclause
+      | ctllist ',' ioclause
+      ;
+ioclause: fexpr 
+      | '*'
+      | TOK_DASTER
+      | TOK_NAME expr 
+      | TOK_NAME '(' triplet ')'
+      | TOK_NAME '*' 
+      | TOK_NAME TOK_DASTER 
+/*      | TOK_REC '=' ident*/
+      ;
+iofctl:  ctlkwd
+      ;
+ctlkwd: TOK_INQUIRE
+      | TOK_OPEN
+      | TOK_CLOSE
+      ;
+infmt:  unpar_fexpr
+      | '*'
+      ;
+
+read:TOK_READ
+      ;
+write: TOK_WRITE
+      ;
+print:TOK_PRINT fexpr
+      | TOK_PRINT '*'
+      ;
+fexpr: unpar_fexpr
+      | '(' fexpr ')'
+      ;
+unpar_fexpr: lhs
+      | simple_const
+      | fexpr addop fexpr %prec '+'
+      | fexpr '*' fexpr
+      | fexpr TOK_SLASH fexpr
+      | fexpr TOK_DASTER fexpr
+      | addop fexpr %prec '*'
+      | fexpr TOK_DSLASH fexpr
+      | TOK_FILE expr
+      | TOK_EXIST expr
+      | TOK_NAME '=' expr
+      ;
+addop: '+'
+      | '-'
+      ;
+inlist: inelt
+      | inlist ',' inelt
+      ;
+inelt: lhs
+      | '(' inlist ',' dospec ')'
+      ;
+outlist: other      {strcpy($$,$1);} 
+      | out2       {strcpy($$,$1);} 
+      ;
+out2: uexpr ',' expr
+                   {sprintf($$,"%s,%s",$1,$3);} 
+      | uexpr ',' other 
+                   {sprintf($$,"%s,%s",$1,$3);} 
+      | other ',' expr 
+                   {sprintf($$,"%s,%s",$1,$3);} 
+      | other ',' other 
+                   {sprintf($$,"%s,%s",$1,$3);} 
+      | out2 ',' expr 
+                   {sprintf($$,"%s,%s",$1,$3);} 
+      | out2 ',' other 
+                   {sprintf($$,"%s,%s",$1,$3);} 
+      | uexpr     {strcpy($$,$1);} 
+      | predefinedfunction {strcpy($$,$1);} 
+      ;
+other:  complex_const 
+                   {strcpy($$,$1);} 
+      | '(' expr ')' 
+                   {sprintf($$," (%s)",$2);} 
+      | '(' uexpr ',' dospec ')'
+                   {sprintf($$,"(%s,%s)",$2,$4);} 
+      | '(' other ',' dospec ')'
+                   {sprintf($$,"(%s,%s)",$2,$4);} 
+      | '(' out2 ',' dospec ')'
+                   {sprintf($$,"(%s,%s)",$2,$4);} 
+      ;
+
+dospec: TOK_NAME '=' expr ',' expr 
+                   {sprintf($$,"%s=%s,%s)",$1,$3,$5);} 
+      | TOK_NAME '=' expr ',' expr ',' expr 
+                   {sprintf($$,"%s=%s,%s,%s)",$1,$3,$5,$7);} 
+      ;
+labellist: label
+      | labellist ',' label
+      ;
+label: TOK_CSTINT
+      ;
+goto: TOK_PLAINGOTO label
+      ;
+allocation_list: allocate_object
+      | allocation_list ',' allocate_object
+      ;
+allocate_object: ident
+                   {OPTI_1_AddIdentToTheAllocateList($1);}
+      | structure_component
+      | array_element
+      ;
+array_element: ident '(' funargs ')' 
+                   {OPTI_1_AddIdentToTheAllocateList($1);}
+      ;
+subscript_list: expr 
+      | subscript_list ',' expr 
+      ;
+
+allocate_object_list:allocate_object
+      | allocate_object_list ',' allocate_object
+      ;
+opt_stat_spec:
+      | ',' TOK_STAT '=' ident
+      ;
+pointer_name_list: ident
+      | pointer_name_list ',' ident
+      ;
+opt_construct_name:
+      | TOK_NAME
+      ;
+opt_construct_name_colon:
+      | TOK_CONSTRUCTID ':'
+      ;
+logif: TOK_LOGICALIF '(' expr ')'
+      ;
+do_var: ident {strcpy($$,$1);}
+      ;
+%%
+
+void processfortran(char *fichier_entree)
+{
+   extern FILE *fortranin;
+   extern FILE *fortranout;
+   char nomfile[LONGNOM];
+   int c;
+   int confirmyes;
+
+   /*fortrandebug = 1;*/
+/******************************************************************************/
+/*  1-  Open input and output files                                           */
+/******************************************************************************/
+   strcpy(OriginalFileName,fichier_entree); 
+   strcpy(nomfile,commondirin);
+   strcat(nomfile,"/");
+   strcat(nomfile,fichier_entree);
+   fortranin=fopen( nomfile,"r");
+   if (! fortranin) 
+   {
+      printf("Error : File %s does not exist\n",nomfile);
+      exit(1);
+   }
+   
+   strcpy(curfile,nomfile);
+   strcpy(nomfile,commondirout);
+   strcat(nomfile,"/");  
+   strcat(nomfile,fichier_entree);
+   strcpy(nomfileoutput,nomfile);
+   if (firstpass == 1) 
+   {
+      if (checkexistcommon == 1) 
+      {
+         if (fopen(nomfile,"r")) 
+         {
+            printf("Warning : file %s already exist\n",nomfile);
+            confirmyes = 0;
+            while (confirmyes==0) 
+            {
+               printf("Override file %s ? [Y/N]\n",nomfile);
+               c=getchar();
+               getchar();    
+               if (c==79 || c==110) 
+               {
+                  printf("We stop\n");
+                  exit(1);
+               }
+               if (c==89 || c==121) 
+               {
+                  confirmyes=1;
+               }
+            }
+         }
+      }
+   }  
+   strcpy(commonfile,fichier_entree);
+
+/******************************************************************************/
+/*  2-  Variables initialization                                              */
+/******************************************************************************/
+
+   line_num_fortran_common=1; 
+   line_num_fortran=1;
+   PublicDeclare = 0;  
+   PrivateDeclare = 0; 
+   formatdeclare = 0;
+   ExternalDeclare = 0; 
+   SaveDeclare = 0;
+   indeclarationvar=0;
+   pointerdeclare = 0;
+   optionaldeclare = 0;
+   incalldeclare = 0;
+   infunctiondeclare = 0 ;
+   Allocatabledeclare = 0 ;
+   strcpy(NamePrecision," "); 
+   VariableIsParameter =  0 ; 
+   PrecisionGiven = 0 ; 
+   lengspecgiven =0;
+   c_star = 0 ; 
+   insubroutinedeclare = 0 ;
+   strcpy(subroutinename," "); 
+   CharacterSizeGiven = 0 ; 
+   InitialValueGiven = 0 ; 
+   strcpy(EmptyChar," "); 
+   inmoduledeclare = 0;
+   colnum=0;
+   incom=0;
+   couldaddvariable=1;
+   aftercontainsdeclare = 1;
+   /* Name of the file without format                                         */
+   tmp = strchr(fichier_entree, '.');
+   strncpy(curfilename,fichier_entree,strlen(fichier_entree)-strlen(tmp)); 
+/******************************************************************************/
+/*  2-  Parsing of the input file (1 time)                                    */
+/******************************************************************************/
+   if (firstpass == 0 ) fortranout=fopen(nomfileoutput,"w");
+   /* we should add the new module comes from common block                    */
+   if (firstpass == 0 && fortran77 == 1 ) fprintf
+                      (fortranout,"#include \"NewModule_%s.h\" \n",curfilename);
+
+   fortranparse();
+
+   strcpy(curfile,mainfile);
+
+   if (firstpass ==0) fclose(fortranout);
+}
Index: /trunk/AGRIF/LIB/main.c
===================================================================
--- /trunk/AGRIF/LIB/main.c	(revision 396)
+++ /trunk/AGRIF/LIB/main.c	(revision 396)
@@ -0,0 +1,2555 @@
+#ifndef lint
+static char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
+#endif
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define yyclearin (yychar=(-1))
+#define yyerrok (yyerrflag=0)
+#define YYRECOVERING (yyerrflag!=0)
+#define YYPREFIX "yy"
+#line 18 "convert.y"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "decl.h"
+#line 24 "convert.y"
+typedef union {
+       int ival;
+       char na[LONGNOM];
+       listnom * ln;
+       } YYSTYPE;
+#line 23 "y.tab.c"
+#define TOK_SEP 257
+#define TOK_USE 258
+#define TOK_MINWIDTH 259
+#define TOK_REGRIDDING 260
+#define TOK_COEFFRAFX 261
+#define TOK_COEFFRAFY 262
+#define TOK_COEFFRAFZ 263
+#define TOK_COEFFRAFTX 264
+#define TOK_COEFFRAFTY 265
+#define TOK_COEFFRAFTZ 266
+#define TOK_MODULEMAIN 267
+#define TOK_NOTGRIDDEP 268
+#define TOK_NUM 269
+#define TOK_FILENAME 270
+#define TOK_USEITEM 271
+#define TOK_NAME 272
+#define TOK_PROBTYPE 273
+#define TOK_EFFICIENCY 274
+#define TOK_RAFMAX 275
+#define TOK_RAFMAXX 276
+#define TOK_RAFMAXY 277
+#define TOK_RAFMAXZ 278
+#define YYERRCODE 256
+short yylhs[] = {                                        -1,
+    0,    0,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,
+};
+short yylen[] = {                                         2,
+    0,    2,    1,    3,    5,    7,    3,    3,    3,    3,
+    3,    3,    3,    3,    4,    3,    3,    3,    3,    3,
+    3,    3,
+};
+short yydefred[] = {                                      1,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    3,    2,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,   22,   21,    8,
+    7,    9,   10,   11,   12,   13,   14,    0,    0,    4,
+   16,   17,   18,   19,   20,   15,    0,    0,    5,    0,
+    6,
+};
+short yydgoto[] = {                                       1,
+   20,
+};
+short yysindex[] = {                                      0,
+  -10, -268, -265, -264, -263, -262, -261, -260, -259, -258,
+ -257, -245, -254, -256, -255, -250, -249, -248,    0,    0,
+  -37,  -36,  -35,  -34,  -33,  -32,  -31,  -30,  -29,  -28,
+ -240,  -43,  -26,  -25,  -24,  -23,  -22,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,  -21, -233,    0,
+    0,    0,    0,    0,    0,    0,  -42, -232,    0,  -18,
+    0,
+};
+short yyrindex[] = {                                      0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,
+};
+short yygindex[] = {                                      0,
+    0,
+};
+#define YYTABLESIZE 268
+short yytable[] = {                                      19,
+   49,   58,   21,   22,   23,   24,   25,   26,   27,   28,
+   29,   31,   33,   34,   30,   50,   59,   32,   35,   36,
+   37,   38,   39,   40,   41,   42,   43,   44,   45,   46,
+   47,   48,   51,   52,   53,   54,   55,   56,   57,   60,
+   61,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    2,    3,    4,
+    5,    6,    7,    8,    9,   10,   11,   12,    0,    0,
+    0,    0,   13,   14,   15,   16,   17,   18,
+};
+short yycheck[] = {                                      10,
+   44,   44,  271,  269,  269,  269,  269,  269,  269,  269,
+  269,  257,  269,  269,  272,   59,   59,  272,  269,  269,
+  269,   59,   59,   59,   59,   59,   59,   59,   59,   59,
+   59,  272,   59,   59,   59,   59,   59,   59,  272,  272,
+   59,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,   -1,   -1,   -1,  258,  259,  260,
+  261,  262,  263,  264,  265,  266,  267,  268,   -1,   -1,
+   -1,   -1,  273,  274,  275,  276,  277,  278,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 1
+#endif
+#define YYMAXTOKEN 278
+#if YYDEBUG
+char *yyname[] = {
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,"':'","';'",0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+"TOK_SEP","TOK_USE","TOK_MINWIDTH","TOK_REGRIDDING","TOK_COEFFRAFX",
+"TOK_COEFFRAFY","TOK_COEFFRAFZ","TOK_COEFFRAFTX","TOK_COEFFRAFTY",
+"TOK_COEFFRAFTZ","TOK_MODULEMAIN","TOK_NOTGRIDDEP","TOK_NUM","TOK_FILENAME",
+"TOK_USEITEM","TOK_NAME","TOK_PROBTYPE","TOK_EFFICIENCY","TOK_RAFMAX",
+"TOK_RAFMAXX","TOK_RAFMAXY","TOK_RAFMAXZ",
+};
+char *yyrule[] = {
+"$accept : input",
+"input :",
+"input : input line",
+"line : '\\n'",
+"line : TOK_PROBTYPE TOK_NAME ';'",
+"line : TOK_PROBTYPE TOK_NAME ',' TOK_NAME ';'",
+"line : TOK_PROBTYPE TOK_NAME ',' TOK_NAME ',' TOK_NAME ';'",
+"line : TOK_COEFFRAFX TOK_NUM ';'",
+"line : TOK_REGRIDDING TOK_NUM ';'",
+"line : TOK_COEFFRAFY TOK_NUM ';'",
+"line : TOK_COEFFRAFZ TOK_NUM ';'",
+"line : TOK_COEFFRAFTX TOK_NUM ';'",
+"line : TOK_COEFFRAFTY TOK_NUM ';'",
+"line : TOK_COEFFRAFTZ TOK_NUM ';'",
+"line : TOK_MODULEMAIN TOK_NAME ';'",
+"line : TOK_NOTGRIDDEP TOK_SEP TOK_NAME ';'",
+"line : TOK_EFFICIENCY TOK_NUM ';'",
+"line : TOK_RAFMAX TOK_NUM ';'",
+"line : TOK_RAFMAXX TOK_NUM ';'",
+"line : TOK_RAFMAXY TOK_NUM ';'",
+"line : TOK_RAFMAXZ TOK_NUM ';'",
+"line : TOK_MINWIDTH TOK_NUM ';'",
+"line : TOK_USE TOK_USEITEM ';'",
+};
+#endif
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+int yydebug;
+int yynerrs;
+int yyerrflag;
+int yychar;
+short *yyssp;
+YYSTYPE *yyvsp;
+YYSTYPE yyval;
+YYSTYPE yylval;
+short yyss[YYSTACKSIZE];
+YYSTYPE yyvs[YYSTACKSIZE];
+#define yystacksize YYSTACKSIZE
+#line 93 "convert.y"
+
+int main(int argc,char *argv[])
+{
+   extern FILE * yyin ;
+   FILE *dependglobaloutput;
+   char *tmp;
+   int i;
+   listnom *parcours;
+
+/******************************************************************************/
+/*  1-  Variables initialization                                              */
+/******************************************************************************/
+   globliste=(listvar *)NULL;
+   listenamelist=(listnamelist *)NULL;
+   globparam=(listvar *)NULL;
+   globvarforcommon=(listvar *)NULL;
+   AllocateList=(listallocate *)NULL;
+   commonlist=(listvarcommon *)NULL;
+   listofsubroutinewhereagrifisused=(listnom *)NULL;
+   listofincludebysubroutine=(listusemodule *)NULL;
+   listofmodulebysubroutine=(listusemodule *)NULL;
+   listofmoduletmp=(listusemodule *)NULL;
+   listmoduleinfile=(listmodule *)NULL;
+   varofsubroutineliste=(listvar *)NULL;
+   varsubroutine=(listvar *)NULL;
+   listvarindoloop=(listvar *)NULL;
+   listenotgriddepend=(listvar *)NULL;
+   Listofavailableindices=(listindice *)NULL;
+   Listofvarpointtovar=(listvarpointtovar *)NULL;
+   globalvarofusefile = (listvar *)NULL;
+   globalvarofusefile2 = (listvar *)NULL;
+   
+   strcpy(mainfile,argv[1]);    
+   strcpy(nomdir,"AGRIF_INC");
+   strcpy(commondirin,".");
+   strcpy(commondirout,".");
+   strcpy(filetoparse," "); 
+   strcpy(subofagrifinitgrids,""); 
+   strcpy(meetagrifinitgrids,"");
+   strcpy(meetmpiinit,"");
+   strcpy(mpiinitvar,"");
+
+   listofvarofusemodulecreated=0;
+   checkexistcommon=1;
+   fortran77 = 0 ;
+   Did_filetoparse_treated = 0 ;
+   userefficiency=0;
+   todebug=0;
+   onlyfixedgrids=0;
+   fixedgrids=0;
+   InAgrifParentDef = 0;
+   rafmaxx=0;
+   rafmaxy=0;
+   rafmaxz=0;
+   IntegerIShouldBeAdd=0;
+   IndicenbmaillesX=0;
+   IndicenbmaillesY=0;
+   IndicenbmaillesZ=0;
+   minwidth=1;
+   coeffrafx=0;
+   coeffrafy=0;
+   coeffrafz=0;
+   indicemaxtabvars = 0;   /* current indice in the table tabvars             */
+   oldindicemaxtabvars = 0;/* current indice in the table tabvars             */
+   SubloopScalar = 0;
+/******************************************************************************/
+/*  2-  Program arguments                                                     */
+/******************************************************************************/
+   if (argc < 2) 
+   {
+       printf("usage : conv <file> [-rm] [-incdir <directory>] \n");
+       printf(" [-comdirin   <directory>] [-comdirout <directory>]\n");
+       printf(" [-convfile  <FILENAME >] -SubloopScalar -SubloopScalar1 \n"); 
+       printf(" -f77\n"); 
+       exit(0);
+   }
+
+
+   if ((yyin=fopen(argv[1],"r"))==NULL) 
+   {
+      printf("the file %s doesn't exist \n",argv[1]);
+      exit(0);    
+   }
+
+   i=2;
+   while (i<argc)
+   {
+      if (!strcasecmp(argv[i],"-incdir")) 
+      {
+         strcpy(nomdir,argv[i+1]);
+         i++;
+      }
+      else if (!strcasecmp(argv[i],"-comdirin")) /* input directory           */
+      {     
+         strcpy(commondirin,argv[i+1]);
+         i++;
+      }
+      else if (!strcasecmp(argv[i],"-comdirout")) /* output directory         */
+      {
+         strcpy(commondirout,argv[i+1]);
+         i++;
+      }      
+      else if (!strcasecmp(argv[i],"-convfile")) /* file to parse             */
+      {     
+         strcpy(filetoparse,argv[i+1]);
+         i++;
+      }   
+      else if (!strcasecmp(argv[i],"-f77")) /* fortran 77 file to parse       */
+      {     
+         fortran77 = 1 ;
+      }   
+      else if (!strcasecmp(argv[i],"-SubloopScalar")) /* file to parse        */
+      {     
+         SubloopScalar = 1 ;
+      }   
+      else if (!strcasecmp(argv[i],"-SubloopScalar1")) /* file to parse       */
+      {     
+         SubloopScalar = 2 ;
+      }   
+      else if (!strcasecmp(argv[i],"-rm")) 
+      {     
+         checkexistcommon=0;
+      }
+      else 
+      {
+         printf("Unkwon option : %s\n",argv[i]);
+         exit(0);
+      }
+      i++;       
+   }  
+
+/******************************************************************************/
+/*  3-  Parsing of the  conv file <name>.in                                   */
+/******************************************************************************/
+
+   if ((yyin=fopen(argv[1],"r"))==NULL) 
+   {
+       printf("the file %s doesn't exist \n",argv[1]);
+       exit(0);    
+   }
+   strcpy(mainfile,argv[1]);    
+
+   yyparse();
+
+/******************************************************************************/
+/*  4-  Preparation of the file parsing                                       */
+/******************************************************************************/
+   if ((yyin=fopen(filetoparse,"r"))==NULL) /* Is the file to parse exist ?   */
+   {
+      printf("the file %s doesn't exist \n",filetoparse);
+      exit(0);    
+   }
+   /* NameTamponfile : the name of the model file extract from the name       */
+   /*    of agrif_module_<NameTamponfile>                                     */
+   tmp = strchr(filetoparse, '.');
+   NameTamponfile=(char *)malloc(
+                              (strlen(filetoparse)-strlen(tmp)+1)*sizeof(char));
+   strncpy(NameTamponfile,filetoparse,strlen(filetoparse)-strlen(tmp)+1);
+   strcpy (&NameTamponfile[strlen(filetoparse)-strlen(tmp)], "\0");
+   /* mainfile : the name of the file to parse                                */
+   strcpy(mainfile,filetoparse);    
+   /* We should verify that this file has not been read before                */
+   /* if it is the case we record the old globliste in the tmplocallist       */
+   tmplocallist = NULL;
+   tmpuselocallist = NULL;
+   Did_filetoparse_treated = Did_filetoparse_readed(NameTamponfile);
+   /* if  Did_filetoparse_treated = 1 then the file to parse has been treated */
+   if ( Did_filetoparse_treated == 0 ) 
+   {
+     /* if the filetoparse has not been treated, we should know the last      */
+     /*    tabvars indices which has been used                                */
+     if ((dependglobaloutput=fopen(".dependglobal","r"))!=NULL) 
+     {
+        fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars);
+        fclose(dependglobaloutput);
+        oldindicemaxtabvars = indicemaxtabvars;
+     }
+   }   
+   /* Write the .dependnbxnby file which contains indices of nbmaillsX,       */
+   /*    nbmailleY and nbmailleZ                                              */
+   Readthedependnbxnbyfile();
+
+/******************************************************************************/
+/*  4-  Parsing of the input file (2 times)                                   */
+/******************************************************************************/
+
+   firstpass = 1; 
+   processfortran(filetoparse); 
+   firstpass = 0; 
+   processfortran(filetoparse);
+
+/******************************************************************************/
+/*  5-  Write informations in output files                                    */
+/******************************************************************************/
+
+   if ( Did_filetoparse_treated == 0 ) /* if the file has never been treated  */
+   {
+      /* Write the .dependglobal file which contain the max indice            */
+      /*    of the tabvars table                                              */
+      dependglobaloutput = fopen(".dependglobal","w");
+      fprintf(dependglobaloutput,"%d\n",indicemaxtabvars);
+      fclose(dependglobaloutput);
+      /* Write the .depend<namefile> file which contain general informations  */
+      /*    about variable of this file                                       */
+      parcours = modulelist;
+      while( parcours )
+      {
+         Writethedependfile(parcours->nom,globliste);
+         parcours=parcours->suiv;
+      }
+   }
+
+/******************************************************************************/
+/*  7-  Remove the non grid dependent variables                               */
+/******************************************************************************/
+
+   /* we should remove from the globliste the non grid dependent variables    */
+   RemoveNotgriddependFromGlobliste();
+
+/******************************************************************************/
+/*  8-  Write informations in output files                                    */
+/******************************************************************************/
+
+   /* if this file has been treated in past called,                           */
+   /*    we should compare the old parsing (record in the tmplocallist)       */
+   /*    and the new one contained in the globliste                           */
+   if ( Did_filetoparse_treated == 1 ) 
+   {
+      parcours = modulelist;
+      while( parcours )
+      {
+         Recordtmplocallist(parcours->nom);
+         parcours=parcours->suiv;
+      }
+      /* if the filetoparse has not been treated, we should know              */
+      /*    the last tabvars indices which has been used                      */
+     if ((dependglobaloutput=fopen(".dependglobal","r"))!=NULL) 
+     {
+        fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars);
+        fclose(dependglobaloutput);
+        oldindicemaxtabvars = indicemaxtabvars;
+     }
+     /* Read the list of available indice                                     */
+     Readthedependavailablefile();
+     /* the old treatement has been recorded in the tmplocallist              */
+     /* Now we should compare the old treatement with the new one             */
+/*mazauric for each module */
+     CompareNewparsingandoldone();
+     /* Write the .dependglobal file which contain general informations       */
+     /*    about globlist                                                     */
+     dependglobaloutput = fopen(".dependglobal","w");
+     fprintf(dependglobaloutput,"%d\n",indicemaxtabvars);
+     fclose(dependglobaloutput);
+     /* Write the list of available indice                                    */
+     Writethedependavailablefile();  
+     /* Write the .depend<namefile> file which contain general                */
+     /*    informations about variable of this file                           */
+     parcours = modulelist;
+     while( parcours )
+     {
+        Writethedependfile(parcours->nom,globliste);
+        parcours=parcours->suiv;
+     }
+     /* Write the .dependnbxnby file which contains indices of nbmaillsX,     */
+     /*    nbmailleY and nbmailleZ                                            */
+     Writethedependnbxnbyfile();
+   }
+   /* Write the .dependnbxnby file which contains indices of nbmaillsX,       */
+   /*    nbmailleY and nbmailleZ                                              */
+   Writethedependnbxnbyfile();
+   /* Write the list of module used in this file                              */
+   Writethedependlistofmoduleused(NameTamponfile);
+   WritedependParameterList(NameTamponfile);
+/******************************************************************************/
+/*  8-  Create files in AGRIF_INC directory                                   */
+/******************************************************************************/
+   creefichieramr(NameTamponfile);
+   return 0;
+}
+#line 497 "y.tab.c"
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+int
+yyparse()
+{
+    register int yym, yyn, yystate;
+#if YYDEBUG
+    register char *yys;
+    extern char *getenv();
+
+    if (yys = getenv("YYDEBUG"))
+    {
+        yyn = *yys;
+        if (yyn >= '0' && yyn <= '9')
+            yydebug = yyn - '0';
+    }
+#endif
+
+    yynerrs = 0;
+    yyerrflag = 0;
+    yychar = (-1);
+
+    yyssp = yyss;
+    yyvsp = yyvs;
+    *yyssp = yystate = 0;
+
+yyloop:
+    if (yyn = yydefred[yystate]) goto yyreduce;
+    if (yychar < 0)
+    {
+        if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+        if (yydebug)
+        {
+            yys = 0;
+            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+            if (!yys) yys = "illegal-symbol";
+            printf("%sdebug: state %d, reading %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
+        }
+#endif
+    }
+    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+    {
+#if YYDEBUG
+        if (yydebug)
+            printf("%sdebug: state %d, shifting to state %d\n",
+                    YYPREFIX, yystate, yytable[yyn]);
+#endif
+        if (yyssp >= yyss + yystacksize - 1)
+        {
+            goto yyoverflow;
+        }
+        *++yyssp = yystate = yytable[yyn];
+        *++yyvsp = yylval;
+        yychar = (-1);
+        if (yyerrflag > 0)  --yyerrflag;
+        goto yyloop;
+    }
+    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
+            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+    {
+        yyn = yytable[yyn];
+        goto yyreduce;
+    }
+    if (yyerrflag) goto yyinrecovery;
+#ifdef lint
+    goto yynewerror;
+#endif
+yynewerror:
+    yyerror("syntax error");
+#ifdef lint
+    goto yyerrlab;
+#endif
+yyerrlab:
+    ++yynerrs;
+yyinrecovery:
+    if (yyerrflag < 3)
+    {
+        yyerrflag = 3;
+        for (;;)
+        {
+            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
+            {
+#if YYDEBUG
+                if (yydebug)
+                    printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+#endif
+                if (yyssp >= yyss + yystacksize - 1)
+                {
+                    goto yyoverflow;
+                }
+                *++yyssp = yystate = yytable[yyn];
+                *++yyvsp = yylval;
+                goto yyloop;
+            }
+            else
+            {
+#if YYDEBUG
+                if (yydebug)
+                    printf("%sdebug: error recovery discarding state %d\n",
+                            YYPREFIX, *yyssp);
+#endif
+                if (yyssp <= yyss) goto yyabort;
+                --yyssp;
+                --yyvsp;
+            }
+        }
+    }
+    else
+    {
+        if (yychar == 0) goto yyabort;
+#if YYDEBUG
+        if (yydebug)
+        {
+            yys = 0;
+            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+            if (!yys) yys = "illegal-symbol";
+            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
+        }
+#endif
+        yychar = (-1);
+        goto yyloop;
+    }
+yyreduce:
+#if YYDEBUG
+    if (yydebug)
+        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+                YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+    yym = yylen[yyn];
+    yyval = yyvsp[1-yym];
+    switch (yyn)
+    {
+case 4:
+#line 64 "convert.y"
+{initdimprob(1,yyvsp[-1].na,"0","0");}
+break;
+case 5:
+#line 65 "convert.y"
+{initdimprob(2,yyvsp[-3].na, yyvsp[-1].na,"0");}
+break;
+case 6:
+#line 67 "convert.y"
+{initdimprob(3,yyvsp[-5].na, yyvsp[-3].na, yyvsp[-1].na);}
+break;
+case 7:
+#line 68 "convert.y"
+{coeffrafx =yyvsp[-1].ival;}
+break;
+case 8:
+#line 69 "convert.y"
+{regridding=yyvsp[-1].ival;}
+break;
+case 9:
+#line 70 "convert.y"
+{coeffrafy =yyvsp[-1].ival;}
+break;
+case 10:
+#line 71 "convert.y"
+{coeffrafz =yyvsp[-1].ival;}
+break;
+case 11:
+#line 72 "convert.y"
+{coeffraftx=yyvsp[-1].ival;}
+break;
+case 12:
+#line 73 "convert.y"
+{coeffrafty=yyvsp[-1].ival;}
+break;
+case 13:
+#line 74 "convert.y"
+{coeffraftz=yyvsp[-1].ival;}
+break;
+case 14:
+#line 75 "convert.y"
+{Add_ModuleTo_listofmodules(yyvsp[-1].na);
+                                                       Addmoduletothelist(yyvsp[-1].na);}
+break;
+case 15:
+#line 77 "convert.y"
+{ajoutenotgriddep(yyvsp[-1].na);}
+break;
+case 16:
+#line 78 "convert.y"
+{userefficiency=1;efficiency=yyvsp[-1].ival;}
+break;
+case 17:
+#line 79 "convert.y"
+{rafmaxx=yyvsp[-1].ival,rafmaxy=yyvsp[-1].ival,rafmaxz=yyvsp[-1].ival;}
+break;
+case 18:
+#line 80 "convert.y"
+{rafmaxx  =yyvsp[-1].ival;}
+break;
+case 19:
+#line 81 "convert.y"
+{rafmaxy  =yyvsp[-1].ival;}
+break;
+case 20:
+#line 82 "convert.y"
+{rafmaxz  =yyvsp[-1].ival;}
+break;
+case 21:
+#line 83 "convert.y"
+{minwidth =yyvsp[-1].ival;}
+break;
+case 22:
+#line 84 "convert.y"
+{
+                                    if (!strcasecmp(yyvsp[-1].na,"FIXED_GRIDS"))
+                                                                 fixedgrids=1;
+                                    if (!strcasecmp(yyvsp[-1].na,"ONLY_FIXED_GRIDS"))
+                                                             onlyfixedgrids=1;
+                                    if (!strcasecmp(yyvsp[-1].na,"DEBUG"))    todebug=1;
+                                 }
+break;
+#line 721 "y.tab.c"
+    }
+    yyssp -= yym;
+    yystate = *yyssp;
+    yyvsp -= yym;
+    yym = yylhs[yyn];
+    if (yystate == 0 && yym == 0)
+    {
+#if YYDEBUG
+        if (yydebug)
+            printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+        yystate = YYFINAL;
+        *++yyssp = YYFINAL;
+        *++yyvsp = yyval;
+        if (yychar < 0)
+        {
+            if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+            if (yydebug)
+            {
+                yys = 0;
+                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+                if (!yys) yys = "illegal-symbol";
+                printf("%sdebug: state %d, reading %d (%s)\n",
+                        YYPREFIX, YYFINAL, yychar, yys);
+            }
+#endif
+        }
+        if (yychar == 0) goto yyaccept;
+        goto yyloop;
+    }
+    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
+        yystate = yytable[yyn];
+    else
+        yystate = yydgoto[yym];
+#if YYDEBUG
+    if (yydebug)
+        printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yyssp, yystate);
+#endif
+    if (yyssp >= yyss + yystacksize - 1)
+    {
+        goto yyoverflow;
+    }
+    *++yyssp = yystate;
+    *++yyvsp = yyval;
+    goto yyloop;
+yyoverflow:
+    yyerror("yacc stack overflow");
+yyabort:
+    return (1);
+yyaccept:
+    return (0);
+}
+#line 2 "convert.yy.c"
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header$
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif	/* __STDC__ */
+#endif	/* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator).  This
+ * avoids problems with code like:
+ *
+ * 	if ( condition_holds )
+ *		yyless( 5 );
+ *	else
+ *		do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		*yy_cp = yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
+		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+	};
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars;		/* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1;		/* whether we need to initialize */
+static int yy_start = 0;	/* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin.  A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	yytext_ptr = yy_bp; \
+	yyleng = (int) (yy_cp - yy_bp); \
+	yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+	yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 27
+#define YY_END_OF_BUFFER 28
+static yyconst short int yy_accept[133] =
+    {   0,
+        0,    0,    0,    0,   28,   27,   26,   25,   27,   24,
+       23,   23,   23,   23,   24,   22,   22,   22,   22,   22,
+       22,   22,   22,   22,   22,   22,   26,    0,   17,   23,
+       21,   18,    0,   22,   22,   22,   22,   22,   22,   22,
+       22,   22,   22,   22,   22,   19,   22,   22,   22,   22,
+       22,   22,   22,   22,   22,   22,   15,   19,   22,   22,
+       22,   22,   22,   22,   22,   22,   22,   22,   22,   20,
+       22,   22,   22,   22,   22,   22,   22,   22,   22,   22,
+       22,   22,   22,   22,   22,   10,   22,   22,   22,   22,
+       22,   22,   22,   22,   11,   12,   13,   22,   22,   22,
+
+       22,   16,   22,   22,   22,   22,   22,    2,    3,    4,
+       22,   22,   22,   22,   22,   22,    5,    6,    7,    9,
+       22,   14,   22,   22,    1,   22,    8,   22,   22,   22,
+       22,    0
+    } ;
+
+static yyconst int yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    1,    1,    1,    1,    4,    1,    1,    5,
+        6,    1,    1,    7,    1,    8,    1,    9,   10,   11,
+       12,    9,    9,    9,    9,    9,    9,   13,   14,    1,
+        1,    1,    1,    1,   18,   19,   20,   21,   22,   23,
+       24,   25,   26,   27,   27,   28,   29,   30,   31,   32,
+       27,   33,   34,   35,   36,   27,   37,   38,   39,   40,
+       15,    1,   16,    1,   17,    1,   18,   19,   20,   21,
+
+       22,   23,   24,   25,   26,   27,   27,   28,   29,   30,
+       31,   32,   27,   33,   34,   35,   36,   27,   37,   38,
+       39,   40,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst int yy_meta[41] =
+    {   0,
+        1,    1,    2,    1,    1,    1,    1,    3,    4,    4,
+        4,    4,    1,    1,    1,    1,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    5
+    } ;
+
+static yyconst short int yy_base[137] =
+    {   0,
+        0,    0,    0,    0,  284,  285,  281,  285,  278,  285,
+       32,   36,   40,   44,  268,  272,   50,   51,   52,   54,
+       56,   55,   58,   59,   61,   60,  277,  274,  273,   80,
+      285,  285,    0,  268,   62,   66,   64,   63,   68,   70,
+       85,   87,   88,   91,   92,    0,   89,   94,   95,   96,
+       98,   99,  100,  101,  102,  108,  267,    0,  109,  114,
+      116,  119,  117,  118,  120,  121,  126,  134,  125,  266,
+      137,  138,  140,  139,  141,  144,  145,  146,  148,  149,
+      151,  154,  158,  160,  161,  164,  166,  168,  169,  172,
+      170,  173,  174,  176,  265,  264,  263,  180,  182,  188,
+
+      185,  262,  192,  193,  177,  199,  201,  253,  250,  249,
+      208,  202,  210,  211,  216,  219,  248,  247,  246,  242,
+      217,  240,  218,  223,  230,  222,  229,  220,  226,  228,
+      225,  285,  259,  262,  193,  264
+    } ;
+
+static yyconst short int yy_def[137] =
+    {   0,
+      132,    1,    1,    1,  132,  132,  132,  132,  133,  132,
+      132,  132,  132,  132,  132,  134,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  134,  132,  133,  133,  132,
+      132,  132,  135,  134,  134,  134,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  136,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  134,  134,  136,  134,  134,
+      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
+
+      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
+      134,  134,  134,  134,  134,  134,  134,  134,  134,  134,
+      134,    0,  132,  132,  132,  132
+    } ;
+
+static yyconst short int yy_nxt[326] =
+    {   0,
+        6,    7,    8,    9,   10,   10,   10,    6,   11,   12,
+       13,   14,   15,   10,   10,   10,   16,   16,   16,   17,
+       18,   19,   20,   16,   16,   16,   16,   16,   21,   22,
+       23,   24,   25,   16,   16,   26,   16,   16,   16,   16,
+       30,   30,   30,   30,   30,   30,   30,   30,   30,   30,
+       30,   30,   30,   30,   30,   30,   31,   33,   33,   33,
+       31,   33,   33,   33,   31,   33,   33,   33,   33,   33,
+       33,   33,   36,   33,   37,   33,   42,   33,   43,   38,
+       35,   39,   44,   47,   48,   40,   49,   41,   30,   30,
+       30,   30,   33,   45,   33,   33,   33,   51,   33,   33,
+
+       50,   33,   33,   33,   52,   33,   33,   33,   33,   33,
+       55,   59,   53,   57,   56,   33,   33,   62,   66,   54,
+       61,   33,   64,   33,   33,   33,   33,   33,   33,   60,
+       67,   69,   33,   33,   63,   71,   75,   70,   65,   72,
+       68,   33,   73,   77,   33,   33,   33,   33,   33,   76,
+       74,   33,   33,   33,   81,   33,   33,   79,   33,   78,
+       82,   33,   80,   84,   83,   33,   87,   33,   33,   88,
+       89,   33,   85,   33,   90,   33,   33,   33,   92,   33,
+       33,   33,   86,   33,   33,   93,   98,   33,   91,   33,
+       99,   94,   33,  103,  102,   33,  105,   46,  100,   33,
+
+       33,   95,   96,   97,  101,  106,   33,  111,   33,   33,
+      112,  104,  115,  113,  114,   33,  107,   33,   33,  108,
+      109,  110,  121,   33,   33,   33,   33,   33,  116,   33,
+       33,  123,   33,   33,  126,   33,   33,   33,  117,  118,
+      119,  122,  125,  124,  127,  128,  120,   33,  131,   33,
+       70,  130,  129,   33,   33,   33,   33,   33,   70,   28,
+       33,   28,   28,   28,   34,   34,   34,   58,   58,   33,
+       33,   33,   33,   33,   33,   33,   29,   29,   27,   33,
+       32,   29,   27,  132,    5,  132,  132,  132,  132,  132,
+      132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
+
+      132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
+      132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
+      132,  132,  132,  132,  132
+    } ;
+
+static yyconst short int yy_chk[326] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+       11,   11,   11,   11,   12,   12,   12,   12,   13,   13,
+       13,   13,   14,   14,   14,   14,   12,   17,   18,   19,
+       13,   20,   22,   21,   14,   23,   24,   26,   25,   35,
+       38,   37,   18,   36,   19,   39,   24,   40,   25,   20,
+       17,   21,   25,   35,   36,   22,   37,   23,   30,   30,
+       30,   30,   41,   26,   42,   43,   47,   39,   44,   45,
+
+       38,   48,   49,   50,   40,   51,   52,   53,   54,   55,
+       43,   47,   41,   45,   44,   56,   59,   50,   54,   42,
+       49,   60,   52,   61,   63,   64,   62,   65,   66,   48,
+       55,   59,   69,   67,   51,   61,   65,   60,   53,   62,
+       56,   68,   63,   67,   71,   72,   74,   73,   75,   66,
+       64,   76,   77,   78,   72,   79,   80,   69,   81,   68,
+       73,   82,   71,   75,   74,   83,   78,   84,   85,   79,
+       80,   86,   76,   87,   81,   88,   89,   91,   83,   90,
+       92,   93,   77,   94,  105,   84,   87,   98,   82,   99,
+       88,   85,  101,   92,   91,  100,   94,  135,   89,  103,
+
+      104,   86,   86,   86,   90,   98,  106,  100,  107,  112,
+      101,   93,  105,  103,  104,  111,   99,  113,  114,   99,
+       99,   99,  112,  115,  121,  123,  116,  128,  106,  126,
+      124,  114,  131,  129,  123,  130,  127,  125,  107,  107,
+      107,  113,  116,  115,  124,  126,  111,  122,  130,  120,
+      121,  129,  128,  119,  118,  117,  110,  109,  131,  133,
+      108,  133,  133,  133,  134,  134,  134,  136,  136,  102,
+       97,   96,   95,   70,   57,   34,   29,   28,   27,   16,
+       15,    9,    7,    5,  132,  132,  132,  132,  132,  132,
+      132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
+
+      132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
+      132,  132,  132,  132,  132,  132,  132,  132,  132,  132,
+      132,  132,  132,  132,  132
+    } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "convert.lex"
+#define INITIAL 0
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#define character 1
+
+#line 19 "convert.lex"
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+int line_num=1;
+extern FILE * yyin;
+#define MAX_INCLUDE_DEPTH 30
+YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+#line 505 "convert.yy.c"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines.  This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( yy_current_buffer->yy_is_interactive ) \
+		{ \
+		int c = '*', n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+		  && ferror( yyin ) ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+YY_DECL
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+
+#line 39 "convert.lex"
+
+#line 658 "convert.yy.c"
+
+	if ( yy_init )
+		{
+		yy_init = 0;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! yy_start )
+			yy_start = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = stdin;
+
+		if ( ! yyout )
+			yyout = stdout;
+
+		if ( ! yy_current_buffer )
+			yy_current_buffer =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+
+		yy_load_buffer_state();
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = yy_c_buf_p;
+
+		/* Support of yytext. */
+		*yy_cp = yy_hold_char;
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = yy_start;
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				yy_last_accepting_state = yy_current_state;
+				yy_last_accepting_cpos = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 133 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 285 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+
+do_action:	/* This label is used only to access EOF actions. */
+
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = yy_hold_char;
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 40 "convert.lex"
+return TOK_REGRIDDING; /* period of regridding                    */
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 41 "convert.lex"
+return TOK_COEFFRAFX;  /* space refinement in the x direction     */
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 42 "convert.lex"
+return TOK_COEFFRAFY;  /* space refinement in the y direction     */
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 43 "convert.lex"
+return TOK_COEFFRAFZ;  /* space refinement in the z direction     */
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 44 "convert.lex"
+return TOK_COEFFRAFTX; /* time refinement in the x direction      */
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 45 "convert.lex"
+return TOK_COEFFRAFTY; /* time refinement in the y direction      */
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 46 "convert.lex"
+return TOK_COEFFRAFTZ; /* time refinement in the z direction      */
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 47 "convert.lex"
+return TOK_MODULEMAIN; /* name of the module                      */
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 48 "convert.lex"
+return TOK_EFFICIENCY; /* efficiency for the adaptive refinement  */
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 49 "convert.lex"
+return TOK_RAFMAX;     /* minimum size in all directions          */
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 50 "convert.lex"
+return TOK_RAFMAXX;    /* minimum size in x direction             */
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 51 "convert.lex"
+return TOK_RAFMAXY;    /* minimum size in y direction             */
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 52 "convert.lex"
+return TOK_RAFMAXZ;    /* minimum size in z direction             */
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 53 "convert.lex"
+return TOK_NOTGRIDDEP; /* variable which are not grid dependent   */
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 54 "convert.lex"
+return TOK_USE;
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 55 "convert.lex"
+return TOK_MINWIDTH;   /* minimum width of rectangles for the     */
+	YY_BREAK
+/*    adaptive refinement                  */
+case 17:
+YY_RULE_SETUP
+#line 57 "convert.lex"
+{}
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 58 "convert.lex"
+return TOK_SEP;
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 59 "convert.lex"
+{strcpy(yylval.na,yytext); return TOK_FILENAME;}
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 60 "convert.lex"
+{strcpy(yylval.na,yytext); return TOK_USEITEM;}
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 61 "convert.lex"
+{strcpy(yylval.na,yytext); return TOK_PROBTYPE;}
+	YY_BREAK
+/* dimension of the problem                */
+case 22:
+YY_RULE_SETUP
+#line 63 "convert.lex"
+{strcpy(yylval.na,yytext); return TOK_NAME;}
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 64 "convert.lex"
+{yylval.ival=atoi(yytext); return TOK_NUM;}
+	YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 65 "convert.lex"
+{return (int) *yytext;}
+	YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 66 "convert.lex"
+{line_num++;return (int) *yytext;}
+	YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 67 "convert.lex"
+;
+	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 68 "convert.lex"
+ECHO;
+	YY_BREAK
+#line 878 "convert.yy.c"
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(character):
+	yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between yy_current_buffer and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			yy_n_chars = yy_current_buffer->yy_n_chars;
+			yy_current_buffer->yy_input_file = yyin;
+			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state();
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++yy_c_buf_p;
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = yy_c_buf_p;
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer() )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				yy_did_buffer_switch_on_eof = 0;
+
+				if ( yywrap() )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				yy_c_buf_p =
+					yytext_ptr + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				yy_c_buf_p =
+				&yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+	} /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+	{
+	register char *dest = yy_current_buffer->yy_ch_buf;
+	register char *source = yytext_ptr;
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( yy_current_buffer->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+	else
+		{
+		int num_to_read =
+			yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+			YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = yy_current_buffer;
+
+			int yy_c_buf_p_offset =
+				(int) (yy_c_buf_p - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					yy_flex_realloc( (void *) b->yy_ch_buf,
+							 b->yy_buf_size + 2 );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = yy_current_buffer->yy_buf_size -
+						number_to_move - 1;
+#endif
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+			yy_n_chars, num_to_read );
+
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	if ( yy_n_chars == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart( yyin );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			yy_current_buffer->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	yy_n_chars += number_to_move;
+	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+	return ret_val;
+	}
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+
+	yy_current_state = yy_start;
+
+	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			yy_last_accepting_state = yy_current_state;
+			yy_last_accepting_cpos = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 133 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+	}
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+	{
+	register int yy_is_jam;
+	register char *yy_cp = yy_c_buf_p;
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		yy_last_accepting_state = yy_current_state;
+		yy_last_accepting_cpos = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 133 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 132);
+
+	return yy_is_jam ? 0 : yy_current_state;
+	}
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+	{
+	register char *yy_cp = yy_c_buf_p;
+
+	/* undo effects of setting up yytext */
+	*yy_cp = yy_hold_char;
+
+	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = yy_n_chars + 2;
+		register char *dest = &yy_current_buffer->yy_ch_buf[
+					yy_current_buffer->yy_buf_size + 2];
+		register char *source =
+				&yy_current_buffer->yy_ch_buf[number_to_move];
+
+		while ( source > yy_current_buffer->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		yy_current_buffer->yy_n_chars =
+			yy_n_chars = yy_current_buffer->yy_buf_size;
+
+		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+
+	yytext_ptr = yy_bp;
+	yy_hold_char = *yy_cp;
+	yy_c_buf_p = yy_cp;
+	}
+#endif	/* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+	{
+	int c;
+
+	*yy_c_buf_p = yy_hold_char;
+
+	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			/* This was really a NUL. */
+			*yy_c_buf_p = '\0';
+
+		else
+			{ /* need more input */
+			int offset = yy_c_buf_p - yytext_ptr;
+			++yy_c_buf_p;
+
+			switch ( yy_get_next_buffer() )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart( yyin );
+
+					/* fall through */
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap() )
+						return EOF;
+
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					yy_c_buf_p = yytext_ptr + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
+	*yy_c_buf_p = '\0';	/* preserve yytext */
+	yy_hold_char = *++yy_c_buf_p;
+
+
+	return c;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+	{
+	if ( ! yy_current_buffer )
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+	yy_init_buffer( yy_current_buffer, input_file );
+	yy_load_buffer_state();
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+	{
+	if ( yy_current_buffer == new_buffer )
+		return;
+
+	if ( yy_current_buffer )
+		{
+		/* Flush out information for old buffer. */
+		*yy_c_buf_p = yy_hold_char;
+		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	yy_current_buffer = new_buffer;
+	yy_load_buffer_state();
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	yy_did_buffer_switch_on_eof = 1;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+	{
+	yy_n_chars = yy_current_buffer->yy_n_chars;
+	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+	yyin = yy_current_buffer->yy_input_file;
+	yy_hold_char = *yy_c_buf_p;
+	}
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+	{
+	YY_BUFFER_STATE b;
+
+	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer( b, file );
+
+	return b;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+	{
+	if ( ! b )
+		return;
+
+	if ( b == yy_current_buffer )
+		yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		yy_flex_free( (void *) b->yy_ch_buf );
+
+	yy_flex_free( (void *) b );
+	}
+
+
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+	{
+	yy_flush_buffer( b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+	b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+	b->yy_is_interactive = 0;
+#else
+	b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+	{
+	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == yy_current_buffer )
+		yy_load_buffer_state();
+	}
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+	{
+	YY_BUFFER_STATE b;
+
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	yy_switch_to_buffer( b );
+
+	return b;
+	}
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+	{
+	int len;
+	for ( len = 0; yy_str[len]; ++len )
+		;
+
+	return yy_scan_bytes( yy_str, len );
+	}
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+	{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = len + 2;
+	buf = (char *) yy_flex_alloc( n );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+	for ( i = 0; i < len; ++i )
+		buf[i] = bytes[i];
+
+	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = yy_scan_buffer( buf, n );
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+	}
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+	{
+	if ( yy_start_stack_ptr >= yy_start_stack_depth )
+		{
+		yy_size_t new_size;
+
+		yy_start_stack_depth += YY_START_STACK_INCR;
+		new_size = yy_start_stack_depth * sizeof( int );
+
+		if ( ! yy_start_stack )
+			yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+		else
+			yy_start_stack = (int *) yy_flex_realloc(
+					(void *) yy_start_stack, new_size );
+
+		if ( ! yy_start_stack )
+			YY_FATAL_ERROR(
+			"out of memory expanding start-condition stack" );
+		}
+
+	yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+	BEGIN(new_state);
+	}
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+	{
+	if ( --yy_start_stack_ptr < 0 )
+		YY_FATAL_ERROR( "start-condition stack underflow" );
+
+	BEGIN(yy_start_stack[yy_start_stack_ptr]);
+	}
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+	{
+	return yy_start_stack[yy_start_stack_ptr - 1];
+	}
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+	{
+	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+	}
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		yytext[yyleng] = yy_hold_char; \
+		yy_c_buf_p = yytext + n; \
+		yy_hold_char = *yy_c_buf_p; \
+		*yy_c_buf_p = '\0'; \
+		yyleng = n; \
+		} \
+	while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+	{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+	}
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+	{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+	}
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+	{
+	return (void *) malloc( size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+	{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+	{
+	free( ptr );
+	}
+
+#if YY_MAIN
+int main()
+	{
+	yylex();
+	return 0;
+	}
+#endif
+#line 68 "convert.lex"
+
+
+
+int yywrap()
+{
+}
+
+
+yyerror(char *s)
+{
+if (!strcasecmp(curfile,mainfile))
+{
+   printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile);
+}
+else
+{
+   printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile);
+}
+exit(0);
+}
Index: /trunk/AGRIF/LIB/tests.c
===================================================================
--- /trunk/AGRIF/LIB/tests.c	(revision 396)
+++ /trunk/AGRIF/LIB/tests.c	(revision 396)
@@ -0,0 +1,55 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "decl.h"
+
+/*Tests de correction*/
+
+int tests_entrees() 
+{
+   int erreur=0;
+
+   if (onlyfixedgrids == 0)
+   {
+      if(regridding==0)
+      {
+         printf("ERROR: Regridding interval is missing or equals 0\n");
+         erreur=1;
+      }
+  
+      if (userefficiency==1)  
+      {
+         if ((efficiency>100) || (efficiency < 0)) 
+         {	 
+            printf("ERROR : invalid efficiency (must be between 0 and 100) \n");
+            erreur=1;
+         }
+      }
+      else 
+      {
+         printf("WARNING : clustering efficiency not given: set to 70%% \n");
+         efficiency=70;
+      }  
+   }
+  
+
+   if(erreur) return 1;
+ 
+   return erreur;
+}
Index: /trunk/AGRIF/LIB/toamr.c
===================================================================
--- /trunk/AGRIF/LIB/toamr.c	(revision 396)
+++ /trunk/AGRIF/LIB/toamr.c	(revision 396)
@@ -0,0 +1,1008 @@
+/******************************************************************************/
+/*                                                                            */
+/*     CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran)       */
+/*                                                                            */
+/*     Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr)             */
+/*                        Cyril Mazauric (Cyril.Mazauric@imag.fr)             */
+/*                                                                            */
+/*     This program is free software; you can redistribute it and/or modify   */
+/*    it                                                                      */
+/*                                                                            */
+/*    This program is distributed in the hope that it will be useful,         */
+/*     but WITHOUT ANY WARRANTY; without even the implied warranty of         */
+/*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
+/*    GNU General Public License for more details.                            */
+/*                                                                            */
+/******************************************************************************/
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "decl.h"
+char lvargridname[LONGNOM];
+char lvargridname2[LONGNOM];
+
+
+/******************************************************************************/
+/*                       variablenameroottabvars                              */
+/******************************************************************************/
+/* This subroutine is used to create the string                               */
+/******************************************************************************/
+/*                                                                            */
+/*  ----------->  Agrif_Mygrid % tabvars (i) % var                            */
+/*                                                                            */
+/******************************************************************************/
+char *variablenameroottabvars (variable * var)
+{
+  char *ligne;
+
+  ligne = (char *) malloc (LONGLIGNE * sizeof (char));
+  sprintf (ligne, "Agrif_Mygrid %% tabvars(%d) %% var", var->indicetabvars);
+  return ligne;
+}
+
+
+/******************************************************************************/
+/*                        variablenametabvars                                 */
+/******************************************************************************/
+/* This subroutine is used to create the string                               */
+/******************************************************************************/
+/*                                                                            */
+/*  if iorindice = 0 ---------->  Agrif_Gr % tabvars (i) % var                */
+/*                                                                            */
+/*  if iorindice = 1 ---------->  Agrif_Gr % tabvars (12) % var               */
+/*                                                                            */
+/******************************************************************************/
+char *variablenametabvars (variable * var, int iorindice)
+{
+  char *ligne;
+
+  ligne = (char *) malloc (LONGLIGNE * sizeof (char));
+  if ( iorindice == 0 ) sprintf (ligne, " Agrif_Gr %% tabvars(%d)%% var",
+                                 var->indicetabvars);
+  else sprintf (ligne, " Agrif_Gr %% tabvars(i)%% var");
+  return ligne;
+}
+
+/******************************************************************************/
+/*                        variablecurgridtabvars                              */
+/******************************************************************************/
+/* This subroutine is used to create the string                               */
+/******************************************************************************/
+/*                                                                            */
+/*  ----------->  Agrif_Curgrid % tabvars (i) % var                           */
+/*                                                                            */
+/******************************************************************************/
+char *variablecurgridtabvars (variable * var,int ParentOrCurgrid)
+{
+  char *ligne;
+
+  ligne = (char *) malloc (LONGLIGNE * sizeof (char));
+  if ( ParentOrCurgrid == 0 ) sprintf (ligne, " Agrif_tabvars(%d) %% var",
+                              var->indicetabvars);
+  else if ( ParentOrCurgrid == 1 ) sprintf (ligne, 
+                              " Agrif_tabvars(%d) %% parent_var %% var",
+                               var->indicetabvars);
+  else if ( ParentOrCurgrid == 2 ) sprintf (ligne, 
+                              " Agrif_Gr %% tabvars(%d) %% var",
+                               var->indicetabvars);
+  else sprintf (ligne, " AGRIF_Mygrid %% tabvars(%d) %% var",
+                               var->indicetabvars);
+  return ligne;
+}
+
+/******************************************************************************/
+/*                           vargridnametabvars                               */
+/******************************************************************************/
+/* This subroutine is used to create the string                               */
+/******************************************************************************/
+/*                                                                            */
+/*  if iorindice == 0 ----------->  Agrif_Gr % tabvars (i) % var % array1     */
+/*                                                                            */
+/*  if iorindice == 1 ----------->  Agrif_Gr % tabvars (12) % var % array1    */
+/*                                                                            */
+/******************************************************************************/
+char *vargridnametabvars (variable * var,int iorindice)
+{
+  char *tmp;
+  char tmp1[LONGNOM];
+  
+  tmp = variablenametabvars (var,iorindice);
+  strcpy(tmp1,tmp);
+  free(tmp);
+  
+  sprintf (lvargridname, "%s", tmp1);
+  if (!strcasecmp (var->typevar, "REAL"))
+    {
+      sprintf (lvargridname2, "%% array%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "REAL*8"))
+    {
+      sprintf (lvargridname2, "%% darray%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "INTEGER"))
+    {
+      sprintf (lvargridname2, "%% iarray%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "LOGICAL"))
+    {
+      sprintf (lvargridname2, "%% larray%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "CHARACTER"))
+    {
+      sprintf (lvargridname2, "%% carray%d", var->nbdim);
+    }
+
+  strcat (lvargridname, lvargridname2);
+
+  return lvargridname;
+}
+
+/******************************************************************************/
+/*                           vargridcurgridtabvars                            */
+/******************************************************************************/
+/* This subroutine is used to create the string                               */
+/******************************************************************************/
+/*                                                                            */
+/* if ParentOrCurgrid == 0 -->  Agrif_Curgrid % tabvars (i) % var % array1    */
+/*                                                                            */
+/* if ParentOrCurgrid == 1 -->  Agrif_tabvars (i) % parent_var %var % array1  */
+/*                                                                            */
+/* if ParentOrCurgrid == 2 -->  Agrif_Gr % tabvars (i) % var % array1         */
+/*                                                                            */
+/******************************************************************************/
+char *vargridcurgridtabvars (variable * var,int ParentOrCurgrid)
+{
+  char *tmp;
+  char tmp1[LONGNOM];
+  
+  tmp = variablecurgridtabvars (var,ParentOrCurgrid);
+  strcpy(tmp1,tmp);
+  free(tmp);
+  
+  sprintf (lvargridname, "%s", tmp1);
+  if (!strcasecmp (var->typevar, "REAL"))
+    {
+      sprintf (lvargridname2, "%%array%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "REAL*8"))
+    {
+      sprintf (lvargridname2, "%%darray%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "INTEGER"))
+    {
+      sprintf (lvargridname2, "%%iarray%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "LOGICAL"))
+    {
+      sprintf (lvargridname2, "%%larray%d", var->nbdim);
+    }
+  else if (!strcasecmp (var->typevar, "CHARACTER"))
+    {
+      sprintf (lvargridname2, "%%carray%d", var->nbdim);
+    }
+
+  strcat (lvargridname, lvargridname2);
+
+  return lvargridname;
+}
+
+/******************************************************************************/
+/*                               vargridparam                                 */
+/******************************************************************************/
+/* This subroutine is used to create the string which contains                */
+/* dimension list                                                             */
+/******************************************************************************/
+/*                                                                            */
+/*  DIMENSION(jpi,0:jpj) ----------->"1:jpi,0:jpj"                            */
+/*                                                                            */
+/******************************************************************************/
+char *vargridparam (variable * v, int whichone)
+{
+  typedim dim;
+  listdim *newdim;
+  char newname[LONGNOM];
+    
+  newdim = v->dimension;
+  if (!newdim) return "";
+
+  strcpy (tmpvargridname, "(");
+  while (newdim)
+  {
+     dim = newdim->dim;
+
+     strcpy(newname,"");
+     strcpy(newname, 
+            ChangeTheInitalvaluebyTabvarsName(dim.first,globliste,whichone));   
+     if ( !strcasecmp(newname,dim.first))
+     {
+        strcpy(newname,"");     
+        /* la liste des use de cette subroutine                               */
+        if ( !globalvarofusefile ) RecordUseModulesVariables();
+        strcpy(newname,ChangeTheInitalvaluebyTabvarsName(dim.first,
+                       globalvarofusefile,whichone));
+     }
+     strcat (tmpvargridname, newname);
+     strcat (tmpvargridname, " : ");
+     strcpy(newname,"");
+     strcpy(newname,ChangeTheInitalvaluebyTabvarsName
+                        (dim.last,globliste,whichone));   
+     if ( !strcasecmp(newname,dim.last))
+     {
+        strcpy(newname,"");     
+        /* la liste des use de cette subroutine                               */
+        if ( !globalvarofusefile ) RecordUseModulesVariables();
+        strcpy(newname,ChangeTheInitalvaluebyTabvarsName
+                       (dim.last, globalvarofusefile,whichone));
+     }
+     strcat (tmpvargridname, newname);
+     newdim = newdim->suiv;
+     if (newdim) strcat (tmpvargridname, ",");
+  }
+  strcat (tmpvargridname, ")");
+  strcat (tmpvargridname, "\0");
+  return tmpvargridname;
+}
+
+/******************************************************************************/
+/*                        write_probdimagrif_file                             */
+/******************************************************************************/
+/* This subroutine is used to create the file probdim_agrif.h                 */
+/******************************************************************************/
+/*                                                                            */
+/*               probdim_agrif.h                                              */
+/*                                                                            */
+/*               Agrif_probdim = <number>                                     */
+/*                                                                            */
+/******************************************************************************/
+void write_probdimagrif_file()
+{
+  FILE *probdim;
+  char ligne[LONGLIGNE*100];
+  
+  probdim = associate("probdim_agrif.h");
+  sprintf (ligne, "Agrif_Probdim = %d", dimprob);
+  tofich (probdim, ligne,1);
+  fclose (probdim);
+}
+
+/******************************************************************************/
+/*                            write_includeagrif_file                         */
+/******************************************************************************/
+/* This subroutine is used to create the file include_agrif.h                 */
+/******************************************************************************/
+/*                                                                            */
+/*               include_agrif.h                                              */
+/*                                                                            */
+/*               USE <name of module>                                         */
+/*               ...                                                          */
+/******************************************************************************/
+void write_includeagrif_file()
+{
+  FILE *inclproc;
+  char ligne[LONGLIGNE*100];
+  listnom *newnom;
+
+  inclproc = associate ("include_agrif.h");
+
+  if (strcasecmp(commonfile_main,"") )
+  {
+    strcpy (ligne, "include '");
+    strcat (ligne, commonfile_main);
+    strcat (ligne, "'");
+  }
+  else
+  {
+    if ( listofmodules ) 
+    {
+       newnom = listofmodules;
+       while(newnom)
+       {
+          strcpy (ligne, "USE ");
+          strcat (ligne, newnom->nom);
+          newnom=newnom->suiv;
+          tofich (inclproc, ligne,1);
+       }
+    }
+  }
+  fclose (inclproc);
+}
+
+/******************************************************************************/
+/*                             write_keysagrif_file                           */
+/******************************************************************************/
+/* This subroutine is used to create the file keys_agrif.h                    */
+/******************************************************************************/
+/*                                                                            */
+/*               keys_agrif.h                                                 */
+/*                                                                            */
+/*               AGRIF_USE_FIXED_GRIDS = 0                                    */
+/*               AGRIF_USE_ONLY_FIXED_GRIDS = 0                               */
+/*               AGRIF_USE_(ONLY)_FIXED_GRIDS = 1                             */
+/*                                                                            */
+/******************************************************************************/
+void write_keysagrif_file()
+{
+  FILE *keys;
+
+  keys = associate ("keys_agrif.h");
+  fprintf(keys,"      AGRIF_USE_FIXED_GRIDS = 0\n");
+  fprintf(keys,"      AGRIF_USE_ONLY_FIXED_GRIDS = 0\n");
+  if (fixedgrids     == 1) fprintf(keys,"      AGRIF_USE_FIXED_GRIDS = 1\n");
+  if (onlyfixedgrids == 1) fprintf(keys,"      AGRIF_USE_ONLY_FIXED_GRIDS = 1\n");
+
+  fclose(keys); 
+}
+
+/******************************************************************************/
+/*                       write_clusteringagrif_file                           */
+/******************************************************************************/
+/* This subroutine is used to create the file  clustering_agrif.h             */
+/******************************************************************************/
+/*                                                                            */
+/*               clustering_agrif                                             */
+/*                                                                            */
+/*               Agrif_regridding =                                           */
+/*               Agrif_Minwidth   =                                           */
+/*               Agrif_Efficiency =                                           */
+/*               Agrif_mind(1)    =                                           */
+/*               Agrif_mind(2)    =                                           */
+/*               Agrif_mind(3)    =                                           */
+/*                                                                            */
+/******************************************************************************/
+void write_clusteringagrif_file()
+{
+  FILE *clustering;
+  char ligne[LONGLIGNE*100];
+  int i;
+  float res;
+
+  clustering = associate ("clustering_agrif.h");
+
+  sprintf(ligne,"Agrif_Regridding = %d",regridding);
+  tofich(clustering,ligne,1);
+  sprintf(ligne,"Agrif_Minwidth = %d",minwidth);
+  tofich(clustering,ligne,1);
+  sprintf(ligne,"Agrif_Efficiency = %e",(float) (efficiency)/100.);
+  tofich(clustering,ligne,1);
+  res=1.;
+  for (i=1;i<rafmaxx;i++)
+    res=res*(float)coeffrafx;
+    if (res == 0.) res=1.;
+  sprintf(ligne,"Agrif_mind(1) = %e",1./res);
+  tofich(clustering,ligne,1);
+  
+  res=1.;
+  for (i=1;i<rafmaxy;i++)
+    res=res*(float)coeffrafy; 
+    if (res == 0.) res=1.;     
+  sprintf(ligne,"Agrif_mind(2) = %e",1./res);
+  tofich(clustering,ligne,1);
+
+  res=1.;
+  for (i=1;i<rafmaxz;i++)  
+    res=res*(float)coeffrafz; 
+    if (res == 0.) res=1.;    
+  sprintf(ligne,"Agrif_mind(3) = %e",1./res);
+  tofich(clustering,ligne,1);
+
+  fclose(clustering);
+}
+
+/******************************************************************************/
+/*                      write_modtypeagrif_file                               */
+/******************************************************************************/
+/* This subroutine is used to create the file typedata                        */
+/******************************************************************************/
+/*                                                                            */
+/*               modtype_agrif.h                                              */
+/*                                                                            */
+/*               Agrif_coeffref(i)  =                                         */
+/*               Agrif_coeffreft(i) =                                         */
+/*               Agrif_NbVariables =                                          */
+/*                                                                            */
+/******************************************************************************/
+void write_modtypeagrif_file()
+{
+  char ligne[LONGLIGNE*100];
+  FILE *typedata;
+
+  typedata = associate ("modtype_agrif.h");
+  /* AGRIF_coeffrefx : space refinement factor in the x-direction             */
+  if (coeffrafx == 0) coeffrafx = 1;
+  sprintf (ligne, "AGRIF_coeffref(1) = %d", coeffrafx);
+  tofich (typedata, ligne,1);
+  /* AGRIF_coeffrefy : space refinement factor in the y-direction             */
+  if (coeffrafy == 0) coeffrafy = 1;
+  sprintf (ligne, "AGRIF_coeffref(2) = %d", coeffrafy);
+  tofich (typedata, ligne,1);
+  /* AGRIF_coeffrefz : space refinement factor in the z-direction             */
+  if (coeffrafz == 0) coeffrafz = 1;
+  sprintf (ligne, "AGRIF_coeffref(3) = %d", coeffrafz);
+  tofich (typedata, ligne,1);
+  /* AGRIF_coeffreftx : time refinement factor in the x-direction             */
+  sprintf (ligne, "AGRIF_coeffreft(1) = %d", coeffraftx);
+  tofich (typedata, ligne,1);
+  /* AGRIF_coeffrefty : time refinement factor in the y-direction             */
+  sprintf (ligne, "AGRIF_coeffreft(2) = %d", coeffrafty);
+  tofich (typedata, ligne,1);
+  /* AGRIF_coeffreftz : time refinement factor in the z-direction             */
+  sprintf (ligne, "AGRIF_coeffreft(3) = %d", coeffraftz);
+  tofich (typedata, ligne,1);
+  /* AGRIF_NbVariables : number of variables                                  */
+  sprintf (ligne, "AGRIF_NbVariables = %d",indicemaxtabvars);
+  tofich(typedata,ligne,1);
+  fclose (typedata);
+}
+
+/******************************************************************************/
+/*                   write_createvarnameagrif_file                            */
+/******************************************************************************/
+/* This subroutine is used to create the file  createvarname                  */
+/******************************************************************************/
+/*                                                                            */
+/*    Agrif_Gr % tabvars (i) % var % namevar = "variable"                     */
+/*                                                                            */
+/******************************************************************************/
+void write_createvarnameagrif_file(variable *v,FILE *createvarname,
+                                                       int *InitEmpty)
+{
+  char ligne[LONGLIGNE*100];
+  char *tmp;
+  char temp1[LONGLIGNE];
+  
+  tmp =  variablenametabvars(v,0);
+  strcpy (temp1, tmp);
+  free(tmp);
+
+  *InitEmpty = 0 ;
+  sprintf(ligne, "%s %% namevar = \"%s\"",temp1,v->nomvar);
+  tofich(createvarname,ligne,1);
+}
+
+/******************************************************************************/
+/*                        write_Setnumberofcells_file                         */
+/******************************************************************************/
+/* This subroutine is used to create the file  setnumberofcells               */
+/******************************************************************************/
+/*                                                                            */
+/*              Agrif_Gr % n(i) = nbmailles                                   */
+/*                                                                            */
+/******************************************************************************/
+void write_Setnumberofcells_file()
+{
+  char ligne[LONGLIGNE*100];
+  FILE *setnumberofcells;
+
+  setnumberofcells=associate("SetNumberofcells.h");
+  
+  sprintf (ligne, 
+           "Agrif_Gr %% nb(1) = Agrif_Curgrid %% tabvars(%d) %% var %% iarray0",
+           IndicenbmaillesX);
+  tofich (setnumberofcells, ligne,1);
+  if (dimprob > 1)
+  {
+     sprintf (ligne, 
+           "Agrif_Gr %% nb(2) = Agrif_Curgrid %% tabvars(%d) %% var %% iarray0",
+           IndicenbmaillesY);
+     tofich (setnumberofcells, ligne,1);
+  }
+  if (dimprob > 2)
+  {
+     sprintf (ligne, 
+           "Agrif_Gr %% nb(3) = Agrif_Curgrid %% tabvars(%d) %% var %% iarray0",
+           IndicenbmaillesZ);
+     tofich (setnumberofcells, ligne,1);
+  }
+  fclose (setnumberofcells);
+}
+
+/******************************************************************************/
+/*                       write_Getnumberofcells_file                          */
+/******************************************************************************/
+/* This subroutine is used to create the file  getnumberofcells               */
+/******************************************************************************/
+/*                                                                            */
+/*              nbmailles = Agrif_Gr % n(i)                                   */
+/*                                                                            */
+/******************************************************************************/
+void write_Getnumberofcells_file()
+{
+  char ligne[LONGLIGNE*100];
+  FILE *getnumberofcells;
+
+  getnumberofcells=associate("GetNumberofcells.h");
+  sprintf (ligne, 
+           "Agrif_Curgrid %% tabvars(%d) %% var %% iarray0 = Agrif_Gr %% nb(1)",
+           IndicenbmaillesX);
+  tofich (getnumberofcells, ligne,1);
+  if (dimprob > 1)
+    {
+      sprintf (ligne,
+           "Agrif_Curgrid %% tabvars(%d) %% var %% iarray0 = Agrif_Gr %% nb(2)",
+           IndicenbmaillesY);
+      tofich (getnumberofcells, ligne,1);
+    }
+  if (dimprob > 2)
+    {
+      sprintf (ligne, 
+           "Agrif_Curgrid %% tabvars(%d) %% var %% iarray0 = Agrif_Gr %% nb(3)",
+           IndicenbmaillesZ);
+      tofich (getnumberofcells, ligne,1);
+    }    
+  fclose (getnumberofcells);
+}
+
+/******************************************************************************/
+/*                      write_initialisationsagrif_file                       */
+/******************************************************************************/
+/* This subroutine is used to create the file initproc                        */
+/******************************************************************************/
+/*                                                                            */
+/*              ! variable                                                    */
+/*              Agrif_Gr % tabvars(i) % var % nbdim = 1                       */
+/*                                                                            */
+/******************************************************************************/
+void write_initialisationsagrif_file(variable *v,FILE *initproc,
+                                     int *VarnameEmpty)
+{
+  char ligne[LONGLIGNE*100];
+  char temp1[LONGLIGNE];
+  char *tmp;
+
+  tmp = variablenameroottabvars (v);
+  strcpy (temp1, tmp);
+  free(tmp);
+
+  if ( v->nbdim != 0 ) 
+  {
+     *VarnameEmpty = 0 ;
+     sprintf (ligne, "%s %% nbdim = %d", temp1, v->nbdim);
+     tofich (initproc, ligne,1);
+  }
+}
+
+/******************************************************************************/
+/*                        write_allocation                                    */
+/******************************************************************************/
+/* This subroutine is used to create the file allocationagrif                 */
+/******************************************************************************/
+/*                                                                            */
+/*                 allocations_calls_agrif.h                                  */
+/*                 Call Alloc_agrif_module (Agrif_Gr)                         */
+/*                                                                            */
+/*                 alloc_agrif_module.h                                       */
+/*                 Subroutine Alloc_agrif_module (Agrif_Gr)                   */
+/*                 allocate(Agrif_Gr%tabvars(i)%var%array1(jpi)               */
+/*                 variable =>Agrif_Gr%tabvars(i)%var%array1                  */
+/*                                                                            */
+/******************************************************************************/
+listnom *write_allocation(listvar *newvar,variable *v,
+                          listnom *listedesnoms,
+                          FILE *alloccalls,
+                          FILE *instanceUSE,
+                          FILE *modulealloc,
+                          int *IndiceMax)
+{
+  char ligne[LONGLIGNE*100];
+  char curname[LONGNOM];
+  char initialvalue[LONGNOM];
+  char name1[LONGNOM];
+  listvar *parcours;
+  listnom *parcoursnom;
+  int compteur;
+  int ValeurMax;
+  int donotwrite=0;
+  FILE *IntegerI;
+  
+  ValeurMax = 2;
+  if (v->common == 1) strcpy(curname,v->commonname);     
+  if (v->module == 1) strcpy(curname,v->modulename);  
+  
+  if ( strcasecmp(curname,Alloctreatedname) )
+  {
+     strcpy(Alloctreatedname,curname);     
+
+/******************************************************************************/
+/*                 alloc_agrif_module.h                                       */
+/*                 Subroutine Alloc_agrif_module (Agrif_Gr)                   */
+/******************************************************************************/
+     if ( v->common == 1 ) strcpy(name1,v->commonname);
+     else if ( v->module == 1 )  strcpy(name1,v->modulename);
+     else exit(1);
+
+     sprintf(ligne,"alloc_agrif_%s.h",name1);
+     allocationagrif = associate (ligne);
+
+     *IndiceMax = 0;
+     AllocEmpty = 1;
+     sprintf (ligne, "Subroutine Alloc_agrif_%s(Agrif_Gr)", curname);
+     tofich(allocationagrif,ligne,1);
+     if ( ModuleIsDefineInInputFile(curname) == 1 )
+     {
+        strcpy(ligne,"Use Agrif_Util");
+        tofich(allocationagrif,ligne,1);
+     }
+     else
+     {
+        if ( fortran77 == 1 )
+        {
+           strcpy(ligne,"Use Agrif_Types, ONLY : Agrif_tabvars");
+           tofich(allocationagrif,ligne,1);
+           strcpy(ligne,"Use Agrif_Types, ONLY : Agrif_grid");
+           tofich(allocationagrif,ligne,1);
+        }
+     }
+     strcpy (ligne, "Type(Agrif_grid), Pointer :: Agrif_Gr");
+     tofich(allocationagrif,ligne,1);
+     sprintf (ligne, "#include \"IntegerI_%s.h\"\n",curname);
+     fprintf(allocationagrif,ligne);
+     if ( fortran77 == 1 )
+     {
+        writedeclarationintoamr(parameterlist,allocationagrif,newvar,curname);
+     }
+     if ( ModuleIsDefineInInputFile(curname) == 1 )
+     {
+         /* add the call to initworkspace                                     */
+         tofich(allocationagrif,"if ( .NOT. Agrif_Root() ) then ",1);
+         fprintf(allocationagrif,"#include \"GetNumberofcells.h\" \n");
+         tofich(allocationagrif,"else ",1);
+         fprintf(allocationagrif,"#include \"SetNumberofcells.h\" \n");
+         tofich(allocationagrif,"endif ",1);
+         tofich(allocationagrif,"Call Agrif_InitWorkspace ",1);
+     }
+  }
+  /* body of the file                                                         */
+  if ( !strcasecmp(v->commonname,Alloctreatedname) ||
+       !strcasecmp(v->modulename,Alloctreatedname) )
+  {
+     if (onlyfixedgrids != 1 && v->nbdim!=0) 
+     {
+        strcpy (ligne, "If (.not. associated(");
+        strcat (ligne, vargridnametabvars(v,0));
+        strcat (ligne, "))                       then");
+        tofich (allocationagrif, ligne,1);
+        AllocEmpty = 0;
+     }
+     if ( v->allocatable != 1 && ( v->dimsempty != 1) )
+     {
+        /*                ALLOCATION                                          */
+        if ( v->dimension != 0  )
+        {
+           if ( v->indicetabvars > *IndiceMax )
+           {
+              parcours = newvar;
+              compteur = -1;
+              while ( parcours &&
+                      !strcasecmp(newvar->var->readedlistdimension,
+                                  parcours->var->readedlistdimension) &&
+                      !strcasecmp(newvar->var->typevar,parcours->var->typevar) )
+              {
+                 compteur = compteur +1 ;
+                 parcours=parcours->suiv;
+              }
+              if ( compteur > ValeurMax )
+              {
+                 fprintf(allocationagrif,"      DO i = %d , %d\n", 
+                                          newvar->var->indicetabvars,
+                                          newvar->var->indicetabvars+compteur);
+                *IndiceMax = newvar->var->indicetabvars+compteur;
+                 IntegerIShouldBeAdd = 1;
+                 strcpy (ligne, "allocate ");
+                 strcat (ligne, "(");
+                 strcat (ligne, vargridnametabvars(v,1));
+                 strcat (ligne, vargridparam(v,0));
+                 strcat (ligne, ")");
+                 tofich (allocationagrif, ligne,1);
+                 fprintf(allocationagrif,"      end do\n");           
+                 AllocEmpty = 0;
+              }
+              else
+              {
+                 strcpy (ligne, "allocate ");
+                 strcat (ligne, "(");
+                 strcat (ligne, vargridnametabvars(v,0));
+                 strcat (ligne, vargridparam(v,0));
+                 strcat (ligne, ")");
+                 tofich (allocationagrif, ligne,1); 
+                 AllocEmpty = 0;
+              }
+           }
+        } /* end of the allocation part                                       */
+        /*                INITIALISATION                                      */
+        if ( strcasecmp(v->initialvalue,"") ) 
+        {
+           strcpy (ligne, "");
+           strcat (ligne, vargridnametabvars(v,0));
+           /* We should modify the initialvalue in the case of variable has   */
+           /*    benn defined with others variables                           */
+           strcpy(initialvalue,
+                  ChangeTheInitalvaluebyTabvarsName
+                                      (v->initialvalue,globliste,0));
+           if ( !strcasecmp(initialvalue,v->initialvalue) )
+           {
+              strcpy(initialvalue,"");     
+              /* la liste des use de cette subroutine                         */
+              if ( !globalvarofusefile ) RecordUseModulesVariables();
+              strcpy(initialvalue,ChangeTheInitalvaluebyTabvarsName
+                                      (v->initialvalue,globalvarofusefile,0));
+           }
+           strcat (ligne," = "); 
+           strcat (ligne,initialvalue); 
+           /*                                                                 */
+           tofich (allocationagrif, ligne,1);
+           AllocEmpty = 0;
+        }
+     }
+     if (onlyfixedgrids != 1 && v->nbdim!=0) 
+     {
+        strcpy (ligne, "   End if");
+        tofich (allocationagrif, ligne,1);
+     }     
+  } 
+  /* closing of the file                                                      */
+  if ( newvar->suiv == NULL ||
+       ( v->common == 1 &&
+         strcasecmp(newvar->suiv->var->commonname,Alloctreatedname) ) ||
+       ( v->module == 1 &&
+         strcasecmp(newvar->suiv->var->modulename,Alloctreatedname) ) 
+     )
+  {
+     if ( ModuleIsDefineInInputFile(curname) == 1 )
+     {
+         /* add the call to initworkspace                                     */
+         tofich(allocationagrif,"if ( .NOT. Agrif_Root() ) then ",1);
+         fprintf(allocationagrif,"#include \"GetNumberofcells.h\" \n");
+         tofich(allocationagrif,"else ",1);
+         fprintf(allocationagrif,"#include \"SetNumberofcells.h\" \n");
+         tofich(allocationagrif,"endif ",1);
+         tofich(allocationagrif,"Call Agrif_InitWorkspace ",1);
+     }
+     strcpy (ligne, "Return");
+     tofich(allocationagrif,ligne,1);
+     sprintf (ligne, "End Subroutine Alloc_agrif_%s",curname);
+     tofich(allocationagrif,ligne,1);
+     fclose(allocationagrif);
+     allocationagrif = (FILE *)NULL;
+     /* Add the declaration of I into the allocationagrif file                */
+     sprintf (ligne, "IntegerI_%s.h",curname);
+     IntegerI = associate(ligne);
+     if ( IntegerIShouldBeAdd == 1 )
+     {     
+        strcpy(ligne, "INTEGER :: i");
+        tofich (IntegerI, ligne,1);
+     }
+     fclose (IntegerI);
+/******************************************************************************/
+/*                 NewModule_module.h                                         */
+/*                 module <module> ETC ...                                    */
+/******************************************************************************/
+     if ( fortran77 == 1 )
+     {
+        donotwrite = 0 ;
+        if ( strcmp(v->commoninfile,mainfile)) donotwrite = 1 ;
+        else 
+        {
+           /* we should verify that this module has not been write in this fil*/
+           parcoursnom = listedesnoms;
+           sprintf(ligne,"USE %s",curname);
+           while ( parcoursnom && donotwrite == 0 )
+           {
+              if ( !strcasecmp(parcoursnom->nom,ligne) ) donotwrite = 1;
+              else parcoursnom = parcoursnom ->suiv;
+           }
+        }
+
+        if ( donotwrite == 0 ) 
+        {
+           if ( ModuleIsDefineInInputFile(curname) == 1 ) AllocEmpty = 0;
+           if ( AllocEmpty == 1 )
+           {
+            fprintf(modulealloc,"! empty module alloc %s \n",curname );
+           }
+           else
+           {
+/******************************************************************************/
+/*                 include_use_instance_agrif.h                               */
+/*                 USE mod                                                    */
+/******************************************************************************/
+            sprintf (ligne, "USE %s", curname);
+            tofich (instanceUSE, ligne,1);
+/******************************************************************************/
+/*                 allocations_calls_agrif.h                                  */
+/*                 Call Alloc_agrif_module (Agrif_Gr)                         */
+/******************************************************************************/
+            sprintf (ligne, "Call Alloc_agrif_%s(Agrif_Gr)", curname);
+            tofich (alloccalls, ligne,1);
+/******************************************************************************/
+/******************************************************************************/
+            fprintf(modulealloc,"      module %s \n",curname);
+            fprintf(modulealloc,"      IMPLICIT NONE \n");
+            fprintf(modulealloc,"      PUBLIC Alloc_agrif_%s \n",curname);
+            fprintf(modulealloc,"      CONTAINS \n");
+            fprintf(modulealloc,"#include \"alloc_agrif_%s.h\" \n",curname);
+            fprintf(modulealloc,"      end module %s \n",curname);
+/******************************************************************************/
+/******************************************************************************/
+            sprintf(ligne,"USE %s",curname);
+            listedesnoms = Addtolistnom(ligne,listedesnoms);
+           }
+        }
+     }
+        else
+        {
+           if ( Did_filetoparse_treated == 0 && AllocEmpty == 0 )
+           {
+/******************************************************************************/
+/*                 include_use_instance_agrif.h                               */
+/*                 USE mod                                                    */
+/******************************************************************************/
+              sprintf (ligne, "USE %s", curname);
+              tofich (instanceUSE, ligne,1);
+/******************************************************************************/
+/*                 allocations_calls_agrif.h                                  */
+/*                 Call Alloc_agrif_module (Agrif_Gr)                         */
+/******************************************************************************/
+              sprintf (ligne, "Call Alloc_agrif_%s(Agrif_Gr)", curname);
+              tofich (alloccalls, ligne,1);
+           }
+        }
+  }
+  return listedesnoms;
+}
+
+/******************************************************************************/
+/*                           creefichieramr                                   */
+/******************************************************************************/
+/* This subroutine is the main one to create AGRIF_INC files                  */
+/******************************************************************************/
+/*                                                                            */
+/******************************************************************************/
+void creefichieramr (char *NameTampon)
+{
+  listvar *newvar;
+  variable *v;
+  int erreur;
+  char filefich[LONGNOM];
+  char ligne[LONGNOM];
+  int IndiceMax;
+  int InitEmpty;
+  int VarnameEmpty;
+  int donotwrite;
+  listnom *listedesnoms;
+  
+  FILE *initproc;
+  FILE *initglobal;
+  FILE *createvarname;
+  FILE *createvarnameglobal;
+  FILE *alloccalls;
+  FILE *instanceUSE;
+  FILE *modulealloc;
+  
+  erreur = tests_entrees ();
+  if (erreur)
+    exit (0);
+  else
+
+  strcpy (filefich, "cd ");
+  strcat (filefich, nomdir);
+  erreur = system (filefich);
+  if (erreur)
+    {
+      strcpy (filefich, "mkdir ");
+      strcat (filefich, nomdir);
+      system (filefich);
+      printf ("%s: Directory created\n", nomdir);
+    }
+
+/******************************************************************************/
+/******************** Creation of AGRIF_INC files *****************************/
+/******************************************************************************/
+  write_probdimagrif_file();
+  write_keysagrif_file();
+  write_clusteringagrif_file();
+  write_includeagrif_file();
+  write_modtypeagrif_file();     
+  write_Setnumberofcells_file();
+  write_Getnumberofcells_file();     
+  /*--------------------------------------------------------------------------*/
+  /*   Record the list of module used in the file include_use_instance_agrif  */
+  listedesnoms = (listnom *)NULL;
+
+  strcpy(Alloctreatedname,"");     
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+  if ( todebug == 1 )
+  {
+     strcpy(ligne,"initialisations_agrif_");
+     strcat(ligne,NameTampon);
+     strcat(ligne,".h");
+     initproc = associate (ligne);
+/*----------------------------------------------------------------------------*/
+     strcpy(ligne,"createvarname_agrif_");
+     strcat(ligne,NameTampon);
+     strcat(ligne,".h");
+     createvarname = associate (ligne);
+/*----------------------------------------------------------------------------*/
+     InitEmpty = 1 ;
+     VarnameEmpty = 1 ;
+
+     newvar = globliste;
+     while ( newvar && todebug == 1 )
+     {
+        donotwrite = 0;
+        v = newvar->var;
+
+        if ( fortran77 == 1 )
+        {
+           if ( v->indicetabvars <= oldindicemaxtabvars ) donotwrite = 1;
+        }
+
+        if ( ( v->common == 1 || v->module == 1 ) && donotwrite == 0 )
+        {
+          write_createvarnameagrif_file(v,createvarname,&VarnameEmpty);
+          write_initialisationsagrif_file(v,initproc,&InitEmpty);
+        }
+        newvar = newvar->suiv;
+     }
+  /*                                                                          */
+     fclose (createvarname); 
+     fclose (initproc);
+  /*--------------------------------------------------------------------------*/
+     if ( Did_filetoparse_treated == 0 )  
+     {
+        if ( InitEmpty != 1  )
+        {
+           initglobal = associateaplus("initialisations_agrif.h");
+           strcpy(ligne,"#include \"initialisations_agrif_");
+           strcat(ligne,NameTampon);
+           strcat(ligne,".h\"\n");
+           fprintf(initglobal,ligne);
+           fclose(initglobal);     
+        }
+  /*--------------------------------------------------------------------------*/
+        if ( VarnameEmpty != 1 )
+        {
+           createvarnameglobal= associateaplus("createvarname_agrif.h");
+           strcpy(ligne,"#include \"createvarname_agrif_");
+           strcat(ligne,NameTampon);
+           strcat(ligne,".h\"\n");
+           fprintf(createvarnameglobal,ligne);
+           fclose(createvarnameglobal);     
+        }
+     }
+  }
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------*/
+  instanceUSE= associateaplus("include_use_instance_agrif.h");
+  alloccalls = associateaplus("allocations_calls_agrif.h");
+  sprintf(ligne,"NewModule_%s.h",NameTampon);
+  modulealloc=associate(ligne);
+  /*--------------------------------------------------------------------------*/
+  IndiceMax = 0;
+
+  newvar = globliste;
+  while (newvar)
+  {
+     v = newvar->var;
+     if ( (v->common == 1) || (v->module == 1) )
+     {
+        listedesnoms = write_allocation(newvar,v,
+                                       listedesnoms,
+                                       alloccalls,
+                                       instanceUSE,
+                                       modulealloc,
+                                       &IndiceMax);
+     }
+     newvar = newvar->suiv;
+  }
+  
+  fclose (instanceUSE);
+  fclose (alloccalls);
+  fclose (modulealloc);
+}
Index: /trunk/AGRIF/agrif_opa.in
===================================================================
--- /trunk/AGRIF/agrif_opa.in	(revision 396)
+++ /trunk/AGRIF/agrif_opa.in	(revision 396)
@@ -0,0 +1,12 @@
+% Number of cells in each direction %
+ 2D nbcellsx,nbcellsy;
+% Name of the common file : an include file (paramfile) OR a module (parammodule) %  
+ parammodule par_oce ;
+
+USE ONLY_FIXED_GRIDS;
+
+% Variables which are not grid dependent %
+% notgriddep :: name of the variable; %
+notgriddep :: nstop;
+
+%USE DEBUG;%
Index: /trunk/AGRIF/efface
===================================================================
--- /trunk/AGRIF/efface	(revision 396)
+++ /trunk/AGRIF/efface	(revision 396)
@@ -0,0 +1,9 @@
+rm -f AGRIF_INC/*
+rm -f AGRIF_MODELFILES/*
+rm -f AGRIF_OBJS/*
+rm -f AGRIF_YOURFILES/*
+rm -f SORTIE/*
+
+rm -f .depend*
+rm -f .agrif*
+rm -f LIB/*.o
