Index: /CONFIG/NEMO_XMLIO_SERVER/EXP00/job_server_brodie
===================================================================
--- /CONFIG/NEMO_XMLIO_SERVER/EXP00/job_server_brodie	(revision 30)
+++ /CONFIG/NEMO_XMLIO_SERVER/EXP00/job_server_brodie	(revision 30)
@@ -0,0 +1,43 @@
+#!/bin/csh
+
+#PBS -N  OPA       # nom de la requete NQS
+#PBS -S /bin/csh
+#PBS -o  OPA.out   # fichier d'output
+#PBS -e  OPA.err   # fichier d'erreur
+#PBS -q multi
+#PBS -l memsz_job=16gb
+#PBS -l cputim_job=1:00:00
+#PBS -l cpunum_job=5
+
+setenv NB_CPU_CLIENT 4
+setenv NB_CPU_SERVER 1
+
+@ NB_CPU = $NB_CPU_CLIENT + $NB_CPU_SERVER
+setenv NB_CPU_CLIENT $NB_CPU_CLIENT
+
+setenv BASE_PATH ../../../bin
+setenv SERVER_NAME ${BASE_PATH}/ioserver
+setenv CLIENT_NAME ${BASE_PATH}/opa
+setenv JOB_REQUEST NEMO
+
+setenv MPIPROGINF ALL_DETAIL
+setenv F_ERRCNT 0
+setenv F_FMTBUF 0
+setenv F_SYSLEN 256
+
+cd $PBS_O_WORKDIR
+
+setenv MPISUSPEND OFF
+
+echo "NB_CPU->${NB_CPU}  NB_CPU_SERVER->${NB_CPU_SERVER} NB_CPU_CLIENT->${NB_CPU_CLIENT}"
+
+rm -f OPA.out
+rm -f OPA.err
+rm -f ORCA2_00000015_restart_ice_*.nc
+rm -f ORCA2_00000015_restart_*.nc
+rm -f  damping.coeff_*.nc
+
+rcp gaya:/u/rech/eee/reee512/NEMO/ORCA2_LIM_nemo_v3.1.tar .
+tar -xvf ORCA2_LIM_nemo_v3.1.tar
+
+mpirun -np $NB_CPU ./launcher_sx
Index: /CONFIG/NEMO_XMLIO_SERVER/EXP00/job_server_mercure
===================================================================
--- /CONFIG/NEMO_XMLIO_SERVER/EXP00/job_server_mercure	(revision 20)
+++ /CONFIG/NEMO_XMLIO_SERVER/EXP00/job_server_mercure	(revision 30)
@@ -19,12 +19,12 @@
 setenv JOB_REQUEST NEMO
 
-export MPIPROGINF=ALL_DETAIL
-export F_ERRCNT=0
-export F_FMTBUF=0
-export F_SYSLEN=256
+setenv MPIPROGINF ALL_DETAIL
+setenv F_ERRCNT=0
+setenv F_FMTBUF=0
+setenv F_SYSLEN=256
 
 cd $PBS_O_WORKDIR 
 
-export MPISUSPEND=OFF
+setenv MPISUSPEND=OFF
 
 echo "NB_CPU->${NB_CPU}  NB_CPU_SERVER->${NB_CPU_SERVER} NB_CPU_CLIENT->${NB_CPU_CLIENT}"
Index: /XMLF90/arch/arch-SX8_BRODIE.fcm
===================================================================
--- /XMLF90/arch/arch-SX8_BRODIE.fcm	(revision 20)
+++ /XMLF90/arch/arch-SX8_BRODIE.fcm	(revision 30)
@@ -11,5 +11,5 @@
 %MPI_FFLAGS
 %OMP_FFLAGS          -P openmp 
-%BASE_LD             -size_t64
+%BASE_LD             
 %MPI_LD
 %OMP_LD              -P openmp
Index: /XMLF90/configure
===================================================================
--- /XMLF90/configure	(revision 20)
+++ /XMLF90/configure	(revision 30)
@@ -105,4 +105,2 @@
 echo "%CPP_KEY       $CPP_KEY"                          >> $config_fcm
 echo "%LD_FFLAGS     $LD_FFLAGS"                        >> $config_fcm
-echo "%INCDIR        -I$NETCDF_INCDIR -I$IOIPSL_INCDIR" >> $config_fcm
-echo "%LIBDIR        -L$NETCDF_LIBDIR -L$IOIPSL_LIBDIR" >> $config_fcm
Index: /XMLIO_SERVER/trunk/arch/arch-IA64_PLATINE.path
===================================================================
--- /XMLIO_SERVER/trunk/arch/arch-IA64_PLATINE.path	(revision 20)
+++ /XMLIO_SERVER/trunk/arch/arch-IA64_PLATINE.path	(revision 30)
@@ -6,6 +6,6 @@
 set IOIPSL_LIB="-lioipsl"
 
-set XMLF90_INCDIR="-I$PWD/../../lib"
-set XMLF90_LIBDIR="-L$PWD/../../lib"
+set XMLF90_INCDIR="-I$PWD/../XMLF90/inc"
+set XMLF90_LIBDIR="-L$PWD/../XMLF90/lib"
 set XMLF90_LIB="-lxmlf90"
 
Index: /XMLIO_SERVER/trunk/arch/arch-SX8_BRODIE.fcm
===================================================================
--- /XMLIO_SERVER/trunk/arch/arch-SX8_BRODIE.fcm	(revision 20)
+++ /XMLIO_SERVER/trunk/arch/arch-SX8_BRODIE.fcm	(revision 30)
@@ -11,5 +11,5 @@
 %MPI_FFLAGS
 %OMP_FFLAGS          -P openmp 
-%BASE_LD             -size_t64
+%BASE_LD             
 %MPI_LD
 %OMP_LD              -P openmp
Index: /XMLIO_SERVER/trunk/bld.cfg
===================================================================
--- /XMLIO_SERVER/trunk/bld.cfg	(revision 20)
+++ /XMLIO_SERVER/trunk/bld.cfg	(revision 30)
@@ -39,4 +39,6 @@
 bld::excl_dep        inc::mpif.h
 bld::excl_dep        use::mpi
+bld::excl_dep        use::mod_prism_get_comm
+bld::excl_dep        use::mod_prism_proto
 
 # Don't generate interface files
Index: /XMLIO_SERVER/trunk/configure
===================================================================
--- /XMLIO_SERVER/trunk/configure	(revision 20)
+++ /XMLIO_SERVER/trunk/configure	(revision 30)
@@ -5,4 +5,5 @@
 set default_compile_flags  = "%PROD_FFLAGS"
 set has_use_vt             = FALSE
+set has_oasis              = FALSE
 
 top:
@@ -47,8 +48,13 @@
         set compile_flags="%DEBUG_FFLAGS"
         shift ; goto top
+
     case -use_vt
         set has_use_vt = TRUE
         shift ; goto top
         
+    case -oasis
+        set has_oasis = TRUE
+        shift ; goto top
+   
    default
         echo "unknown option "$1" , exiting..."
@@ -117,9 +123,16 @@
 set LIB="$LIB $NETCDF_LIBDIR $NETCDF_LIB"
 
+if ( $has_oasis == TRUE ) then
+  set INCDIR="$INCDIR $OASIS_INCDIR"
+  set LIB="$LIB $OASIS_LIBDIR $OASIS_LIB"
+  set CPP_KEY="$CPP_KEY USE_OASIS"
+endif
+
 if ( $has_use_vt == TRUE ) then
-set INCDIR="$INCDIR $VAMPIR_INCDIR"
-set LIB="$LIB $VAMPIR_LIBDIR $VAMPIR_LIB"
-set CPP_KEY="$CPP_KEY USE_VT"
+  set INCDIR="$INCDIR $VAMPIR_INCDIR"
+  set LIB="$LIB $VAMPIR_LIBDIR $VAMPIR_LIB"
+  set CPP_KEY="$CPP_KEY USE_VT"
 endif
+
 
 
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_client.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_client.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_client.f90	(revision 30)
@@ -3,9 +3,25 @@
   USE mod_mpi_buffer_client, ONLY : create_request, finalize_request
   USE mod_event_parameters 
-
-  LOGICAL, SAVE :: using_server
+  USE mod_ioserver_namelist
       
 CONTAINS
 
+  SUBROUTINE event__swap_context(id)
+  USE iomanager
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(IN) :: id
+    
+    IF (using_server) THEN
+      CALL create_request(event_id_swap_context)
+      CALL pack(LEN(TRIM(id)))
+      CALL pack(TRIM(id))
+      CALL Finalize_request
+    ELSE
+      CALL iom__swap_context(TRIM(id))
+    ENDIF
+    
+  END SUBROUTINE  event__swap_context
+  
+  
   SUBROUTINE event__parse_xml_file(filename)
   USE iomanager
@@ -109,4 +125,23 @@
   END SUBROUTINE event__set_grid_type_nemo
   
+  SUBROUTINE event__set_grid_type_lmdz(name,nbp,offset)
+  USE iomanager
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(IN) :: name
+    INTEGER,INTENT(IN)          :: nbp
+    INTEGER,INTENT(IN)          :: offset
+        
+    IF (using_server) THEN
+      CALL create_request(event_id_set_grid_type_lmdz)
+      CALL pack(LEN(TRIM(name)))
+      CALL pack(TRIM(name))
+      CALL pack(nbp)
+      CALL pack(offset)
+      CALL Finalize_request
+    ELSE
+     CALL iom__set_grid_type_lmdz(name,nbp,offset)
+    ENDIF
+      
+  END SUBROUTINE event__set_grid_type_lmdz
   
   SUBROUTINE event__set_time_parameters(itau0,zjulian,zdt)
@@ -162,4 +197,23 @@
   END SUBROUTINE event__disable_field
   
+  SUBROUTINE event__write_field1d(varname,var)
+  USE iomanager
+  IMPLICIT NONE
+    CHARACTER(len=*),INTENT(IN)     :: varname
+    REAL, DIMENSION(:),INTENT(IN) :: var
+
+    IF (using_server) THEN
+      CALL create_request(event_id_write_field1d)
+      CALL pack(len(varname))
+      CALL pack(size(var,1))
+      CALL pack(varname)
+      CALL pack_field(var)
+      CALL Finalize_request 
+    ELSE
+      CALL iom__write_field1d(varname,var)
+    ENDIF
+    
+  END SUBROUTINE event__write_field1d
+
   SUBROUTINE event__write_field2d(varname,var)
   USE iomanager
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_parameters.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_parameters.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_parameters.f90	(revision 30)
@@ -13,4 +13,7 @@
   INTEGER, PARAMETER :: event_id_enable_field          = 111
   INTEGER, PARAMETER :: event_id_disable_field         = 112
+  INTEGER, PARAMETER :: event_id_swap_context          = 113
+  INTEGER, PARAMETER :: event_id_set_grid_type_lmdz    = 114
+  INTEGER, PARAMETER :: event_id_write_field1d         = 115
   INTEGER, PARAMETER :: event_id_stop_ioserver         = 999
 END MODULE mod_event_parameters
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_server.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_server.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_event_server.f90	(revision 30)
@@ -20,4 +20,7 @@
     SELECT CASE (event_id)
     
+      CASE (event_id_swap_context)
+        CALL event__swap_context
+        
       CASE (event_id_parse_xml_file)
         CALL event__parse_xml_file 
@@ -35,4 +38,7 @@
         CALL event__set_grid_type_nemo
 
+      CASE (event_id_set_grid_type_lmdz)
+        CALL event__set_grid_type_lmdz
+
       CASE (event_id_set_time_parameters)
         CALL event__set_time_parameters
@@ -49,4 +55,7 @@
       CASE (event_id_disable_field)
         CALL event__disable_field
+
+      CASE (event_id_write_Field1d)
+        CALL event__write_Field1d
 
       CASE (event_id_write_Field2d)
@@ -67,4 +76,25 @@
    END SUBROUTINE Process_event
    
+  SUBROUTINE event__swap_context
+  IMPLICIT NONE
+    INTEGER :: id_size
+   
+    CALL unpack(id_size)
+    CALL sub_internal(id_size)
+     
+  CONTAINS
+    
+    SUBROUTINE sub_internal(id_size)
+      INTEGER :: id_size
+      CHARACTER(LEN=id_size) :: id     
+     
+       CALL unpack(id)
+     
+       CALL iom__swap_context(id)
+       
+     END SUBROUTINE sub_internal
+  
+  END SUBROUTINE event__swap_context
+  
 
   SUBROUTINE event__parse_xml_file
@@ -172,4 +202,27 @@
   END SUBROUTINE event__set_grid_type_nemo   
 
+  SUBROUTINE event__set_grid_type_lmdz 
+  IMPLICIT NONE    
+    INTEGER :: name_size
+
+    CALL unpack(name_size)
+    CALL sub_internal(name_size)
+     
+  CONTAINS
+    
+    SUBROUTINE sub_internal(name_size)
+      INTEGER :: name_size
+      CHARACTER(LEN=name_size) :: name     
+      INTEGER                  :: nbp
+      INTEGER                  :: offset
+      
+       CALL unpack(name)
+       CALL unpack(nbp)
+       CALL unpack(offset)
+       CALL iom__set_grid_type_lmdz(name,nbp,offset)
+
+     END SUBROUTINE sub_internal
+   
+  END SUBROUTINE event__set_grid_type_lmdz   
 
   SUBROUTINE event__set_vert_axis
@@ -256,4 +309,29 @@
   
       
+  SUBROUTINE event__write_field1D
+  IMPLICIT NONE
+    INTEGER :: lenc
+    INTEGER :: dim1
+      
+    CALL unpack(lenc)
+    CALL unpack(dim1)
+    CALL sub_internal(lenc,dim1)
+  
+  CONTAINS
+    SUBROUTINE sub_internal(lenc,dim1)
+    IMPLICIT NONE
+      INTEGER :: lenc
+      INTEGER :: dim1
+      CHARACTER(len=lenc) :: varname
+      REAL                :: var(dim1)
+      
+      CALL unpack(varname)
+      CALL unpack_field(var)
+      
+      CALL iom__write_Field1d(varname,var)
+
+    END SUBROUTINE sub_internal
+  END SUBROUTINE event__write_field1d
+
   SUBROUTINE event__write_field2D
   IMPLICIT NONE
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_interface_ioipsl.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_interface_ioipsl.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_interface_ioipsl.f90	(revision 30)
@@ -1,18 +1,14 @@
 MODULE mod_interface_ioipsl
 
-  INTEGER,SAVE,PRIVATE  :: ini_timestep
-  REAL,SAVE,PRIVATE     :: zjulian
-  REAL,SAVE,PRIVATE     :: timestep 
-  INTEGER,SAVE,PRIVATE  :: timestep_nb
+ 
+  INTEGER,PARAMETER     :: id_file=1
+
+
+CONTAINS
+
+  SUBROUTINE init_interface_ioipsl
+  USE xmlio
+  IMPLICIT NONE
   
-  INTEGER,PARAMETER     :: id_file=1
-
-
-CONTAINS
-
-  SUBROUTINE init_interface_ioipsl
-  USE xmlio
-  IMPLICIT NONE
-  
     
   END SUBROUTINE init_interface_ioipsl
@@ -20,11 +16,12 @@
 
   SUBROUTINE set_time_parameters(ini_timestep0,zjulian0,timestep0)
+  USE xmlio
   IMPLICIT NONE
     INTEGER :: ini_timestep0
     REAL :: zjulian0, timestep0
 
-    timestep=timestep0
-    ini_timestep=ini_timestep0
-    zjulian=zjulian0
+    timestep_value=timestep0
+    initial_timestep=ini_timestep0
+    initial_date=zjulian0
 
   END SUBROUTINE set_time_parameters
@@ -41,4 +38,5 @@
     TYPE(field),POINTER    :: pt_field
     TYPE(grid),POINTER     :: pt_grid
+    TYPE(zoom),POINTER     :: pt_zoom
     TYPE(axis),POINTER     :: pt_axis
     TYPE(domain),POINTER   :: pt_domain
@@ -51,4 +49,5 @@
     INTEGER :: ioipsl_domain_id
     INTEGER :: i,j
+    CHARACTER(LEN=20) :: direction
      
     CALL xmlio__close_definition 
@@ -64,40 +63,72 @@
       pt_grid=>pt_file_dep%grids%at(1)%pt
       pt_domain=>pt_grid%domain
-      CALL set_ioipsl_domain_id(pt_grid,nb_server,server_rank,ioipsl_domain_id)
-      CALL histbeg(TRIM(pt_file%name),pt_domain%ni,pt_domain%lon, pt_domain%nj, pt_domain%lat,  &
-                    1, pt_domain%ni, 1, pt_domain%nj,ini_timestep, zjulian, timestep,           &
-                   ioipsl_hori_id, ioipsl_file_id,domain_id=ioipsl_domain_id)                                              
-      
-      DO j=1,pt_file_dep%axis%size
-        pt_axis=>pt_file_dep%axis%at(j)%pt
-        CALL sorted_list__find(axis_id,hash(Pt_axis%name),ioipsl_axis_id,found)
-        IF (.NOT. found) THEN
-          IF (TRIM(pt_axis%name) /= "none") THEN
-            CALL histvert(ioipsl_file_id, TRIM(pt_axis%name),TRIM(pt_axis%description),    &
-                         TRIM(pt_axis%unit), pt_axis%size,pt_axis%values, ioipsl_axis_id)
-            CALL sorted_list__add(axis_id,hash(Pt_axis%name),ioipsl_axis_id)
+      pt_zoom=>pt_file_dep%zooms%at(1)%pt
+!      print *,TRIM(pt_file%name),' ',TRIM(pt_zoom%id)
+!      print*,'Global --->',pt_zoom%ni_glo,pt_zoom%nj_glo,pt_zoom%ibegin_glo,pt_zoom%jbegin_glo
+!      print*,'Local  --->',pt_zoom%ni_loc,pt_zoom%nj_loc,pt_zoom%ibegin_loc,pt_zoom%jbegin_loc
+      
+      IF (pt_zoom%ni_loc*pt_zoom%nj_loc > 0) THEN
+        
+        IF ( (pt_zoom%ni_loc == pt_zoom%ni_glo) .AND. (pt_zoom%nj_loc == pt_zoom%nj_glo) ) THEN 
+
+          CALL histbeg(TRIM(pt_file%name),pt_domain%ni,pt_domain%lon, pt_domain%nj, pt_domain%lat,  &
+                     pt_zoom%ibegin_loc, pt_zoom%ni_loc,pt_zoom%jbegin_loc,pt_zoom%nj_loc,        &                                            &
+                     initial_timestep, initial_date, timestep_value,                              &
+                     ioipsl_hori_id, ioipsl_file_id)
+         ELSE                                              
+
+          CALL set_ioipsl_domain_id(pt_grid,nb_server,server_rank,ioipsl_domain_id)
+          CALL histbeg(TRIM(pt_file%name),pt_domain%ni,pt_domain%lon, pt_domain%nj, pt_domain%lat,  &
+                     pt_zoom%ibegin_loc, pt_zoom%ni_loc,pt_zoom%jbegin_loc,pt_zoom%nj_loc,        &                                            &
+                     initial_timestep, initial_date, timestep_value,                              &
+                     ioipsl_hori_id, ioipsl_file_id,domain_id=ioipsl_domain_id)                                              
+       
+         ENDIF
+        
+      
+        DO j=1,pt_file_dep%axis%size
+          pt_axis=>pt_file_dep%axis%at(j)%pt
+          CALL sorted_list__find(axis_id,hash(Pt_axis%name),ioipsl_axis_id,found)
+          IF (.NOT. found) THEN
+            IF (TRIM(pt_axis%name) /= "none") THEN
+              
+              IF (pt_axis%has_positive) THEN 
+                IF (pt_axis%positive) THEN
+                  direction="up"
+                ELSE
+                  direction="down"
+                ENDIF
+              ELSE
+                direction='unknown'
+              ENDIF
+
+              CALL histvert(ioipsl_file_id, TRIM(pt_axis%name),TRIM(pt_axis%description),    &
+                           TRIM(pt_axis%unit), pt_axis%size,pt_axis%values, ioipsl_axis_id,  &
+                           pdirect=direction)
+              CALL sorted_list__add(axis_id,hash(Pt_axis%name),ioipsl_axis_id)
+            ENDIF
           ENDIF
-        ENDIF
-      ENDDO
-      
-      DO j=1,pt_file_dep%fields%size
-        pt_field=>pt_file_dep%fields%at(j)%pt
-        IF (pt_field%axis%name=="none") THEN
-          pt_field%internal(id_file)=ioipsl_file_id
-          CALL histdef(ioipsl_file_id, TRIM(pt_field%name), pt_field%description,            &
-                    &  pt_field%unit, pt_field%grid%domain%ni, pt_field%grid%domain%nj,      &
-                    &  ioipsl_hori_id, 1, 1, 1, -99, 32, pt_field%operation,                 &
-                    &  real(pt_field%freq_op), real(pt_file%output_freq) )
-        ELSE
-          pt_field%internal(id_file)=ioipsl_file_id
-          CALL sorted_list__find(axis_id,hash(Pt_field%axis%name),ioipsl_axis_id,found)
-          CALL histdef(ioipsl_file_id, TRIM(pt_field%name), pt_field%description,          &
-                     & pt_field%unit, pt_field%grid%domain%ni, pt_field%grid%domain%nj,    &
-                     & ioipsl_hori_id, pt_field%axis%size, 1, pt_field%axis%size,          &
-                     & ioipsl_axis_id, 32, pt_field%operation, real(pt_field%freq_op),     &
-                     & real(pt_file%output_freq) )
-        ENDIF
-      ENDDO
-      CALL histend(ioipsl_file_id)
+        ENDDO
+        
+        DO j=1,pt_file_dep%fields%size
+          pt_field=>pt_file_dep%fields%at(j)%pt
+          IF (pt_field%axis%name=="none") THEN
+            pt_field%internal(id_file)=ioipsl_file_id
+            CALL histdef(ioipsl_file_id, TRIM(pt_field%name), pt_field%description,            &
+                      &  pt_field%unit, pt_field%grid%domain%ni, pt_field%grid%domain%nj,      &
+                      &  ioipsl_hori_id, 1, 1, 1, -99, 32, pt_field%operation,                 &
+                      &  real(pt_field%freq_op), real(pt_file%output_freq) )
+          ELSE
+            pt_field%internal(id_file)=ioipsl_file_id
+            CALL sorted_list__find(axis_id,hash(Pt_field%axis%name),ioipsl_axis_id,found)
+            CALL histdef(ioipsl_file_id, TRIM(pt_field%name), pt_field%description,          &
+                       & pt_field%unit, pt_field%grid%domain%ni, pt_field%grid%domain%nj,    &
+                       & ioipsl_hori_id, pt_field%axis%size, 1, pt_field%axis%size,          &
+                       & ioipsl_axis_id, 32, pt_field%operation, real(pt_field%freq_op),     &
+                       & real(pt_file%output_freq) )
+          ENDIF
+        ENDDO
+        CALL histend(ioipsl_file_id)
+      ENDIF
       CALL sorted_list__delete(axis_id)
     ENDDO
@@ -131,6 +162,8 @@
        DO i=1,pt_field_base%field_out%size
          pt_field=>pt_field_base%field_out%at(i)%pt%field
-         ioipsl_file_id=pt_field%internal(id_file)
-         CALL histwrite(ioipsl_file_id, TRIM(pt_field%name), timestep_nb, var, size(var), nindex)
+         IF ( pt_field%zoom%ni_loc * pt_field%zoom%nj_loc > 0) THEN           
+           ioipsl_file_id=pt_field%internal(id_file)
+           CALL histwrite(ioipsl_file_id, TRIM(pt_field%name), timestep_number, var, size(var), nindex)
+         ENDIF
        ENDDO
      ENDIF
@@ -161,6 +194,8 @@
        DO i=1,pt_field_base%field_out%size
          pt_field=>pt_field_base%field_out%at(i)%pt%field
-         ioipsl_file_id=pt_field%internal(id_file)
-         CALL histwrite(ioipsl_file_id, TRIM(pt_field%name), timestep_nb, var, size(var), nindex)
+         IF ( pt_field%zoom%ni_loc * pt_field%zoom%nj_loc > 0) THEN           
+           ioipsl_file_id=pt_field%internal(id_file)
+           CALL histwrite(ioipsl_file_id, TRIM(pt_field%name), timestep_number, var, size(var), nindex)
+         ENDIF
        ENDDO
      ENDIF
@@ -169,8 +204,9 @@
 
   SUBROUTINE set_timestep(timestep_nb0)
+  USE xmlio
   IMPLICIT NONE
     INTEGER,INTENT(IN) :: timestep_nb0
      
-    timestep_nb=timestep_nb0
+    timestep_number=timestep_nb0
 
   END SUBROUTINE set_timestep
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioclient.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioclient.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioclient.f90	(revision 30)
@@ -8,12 +8,47 @@
   USE mod_mpi_buffer_client
   USE mod_wait
+  USE mod_ioserver_namelist
+  USE mod_event_client
+  USE iomanager
   IMPLICIT NONE
-    INTEGER, INTENT(OUT) :: NEW_COMM
-    
-    CALL Init_parallel
-    CALL Init_mpi_buffer
-    CALL Init_wait
-    
-    NEW_COMM=intracomm
+    INTEGER, INTENT(INOUT),OPTIONAL :: NEW_COMM
+
+    INTEGER :: Comm
+    INTEGER :: nb_server
+    INTEGER :: rank
+    INTEGER :: ierr
+    LOGICAL :: init
+    INCLUDE 'mpif.h'
+ 
+    CALL read_namelist
+
+    IF (using_server) THEN
+      CALL Init_parallel
+      CALL Init_mpi_buffer
+      CALL Init_wait
+      IF (PRESENT(NEW_COMM)) THEN
+        NEW_COMM=intracomm
+      ENDIF
+    ELSE
+      CALL MPI_INITIALIZED(init,ierr)
+      IF (init) THEN
+        IF (.NOT. PRESENT(NEW_COMM)) THEN
+           Comm=MPI_COMM_WORLD
+        ELSE
+          Comm=New_Comm
+        ENDIF
+      ELSE
+        CALL MPI_INIT(ierr)
+        Comm=MPI_COMM_WORLD
+        
+        IF (PRESENT(NEW_COMM)) THEN
+          New_Comm=MPI_COMM_WORLD
+        ENDIF
+      ENDIF  
+      CALL MPI_COMM_SIZE(Comm,nb_server,ierr)     
+      CALL MPI_COMM_RANK(Comm,rank,ierr)
+      CALL iom__init(1,nb_server,rank)
+      CALL iom__set_current_rank(1)
+    ENDIF
     
   END SUBROUTINE init_ioclient
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioclient_para.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioclient_para.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioclient_para.f90	(revision 30)
@@ -12,4 +12,8 @@
   SUBROUTINE Init_parallel
   USE mpitrace
+  USE mod_ioserver_namelist
+#ifdef USE_OASIS
+  USE mod_prism_get_comm  
+#endif
   IMPLICIT NONE
     INCLUDE 'mpif.h'
@@ -25,15 +29,25 @@
     INTEGER :: div,remain
     INTEGER :: group_color
+    INTEGER :: Comm_client_server
+    CHARACTER(LEN=6) :: oasis_server_id
     
-!    PRINT *, "on rentre dans MPI_INIT"
-    CALL MPI_INIT(ierr)
-    CALL MPI_COMM_RANK(MPI_COMM_WORLD,global_rank,ierr)
-    CALL MPI_COMM_SIZE(MPI_COMM_WORLD,global_size,ierr)
-    
-    PRINT *,"MPI_init Ok, --> mpi_comm_split"
-    CALL MPI_COMM_SPLIT(MPI_COMM_WORLD,color_client,global_rank,intracomm,ierr)
+    IF (using_oasis) THEN
+      oasis_server_id=server_id
+      PRINT *,'prism_get_intracomm'
+#ifdef USE_OASIS
+      CALL prism_get_intracomm(Comm_client_server,oasis_server_id,ierr)
+#endif
+    ELSE
+      CALL MPI_INIT(ierr)
+      Comm_client_server=MPI_COMM_WORLD
+    ENDIF
+
+    CALL MPI_COMM_RANK(Comm_client_server,global_rank,ierr)
+    CALL MPI_COMM_SIZE(Comm_client_server,global_size,ierr)
+
+    CALL MPI_COMM_SPLIT(Comm_client_server,color_client,global_rank,intracomm,ierr)
     CALL MPI_COMM_SIZE(intracomm,mpi_size,ierr)
     CALL MPI_COMM_RANK(intracomm,mpi_rank,ierr)
-    PRINT *,"MPI_mpi_comm_split ok --> intracomm" 
+
     nb_server_io=global_size-mpi_size
     div=mpi_size/nb_server_io
@@ -45,14 +59,12 @@
       group_color=(nb_server_io-1)-(mpi_size-1-mpi_rank)/div
     ENDIF
-    PRINT *,'group_color',group_color
 
-    CALL MPI_COMM_SPLIT(MPI_COMM_WORLD,group_color,global_rank,iocomm,ierr)
+    CALL MPI_COMM_SPLIT(Comm_client_server,group_color,global_rank,iocomm,ierr)
     
     CALL MPI_COMM_SIZE(iocomm,iosize,ierr)
     CALL MPI_COMM_RANK(iocomm,iorank,ierr)
-    PRINT *,"io_size-> ",iosize,"iorank-> ",iorank
+
     ALLOCATE(proc_color(0:iosize-1))
     CALL MPI_ALLGATHER(color_client,1,MPI_INTEGER,proc_color,1,MPI_INTEGER,iocomm,ierr)
-    print *,"proc_color -> ",proc_color
     
     DO i=0,iosize-1
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_iomanager.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_iomanager.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_iomanager.f90	(revision 30)
@@ -28,4 +28,13 @@
   END SUBROUTINE iom__parse_xml_file
    
+  SUBROUTINE iom__swap_context(id)
+  USE xmlio
+  IMPLICIT NONE
+    CHARACTER(LEN=*) :: id
+    
+    IF (current_rank==nb_client) CALL context__swap(id)
+     
+  END SUBROUTINE iom__swap_context
+
   SUBROUTINE iom__set_current_rank(rank)
   IMPLICIT NONE
@@ -99,4 +108,25 @@
 
   END SUBROUTINE iom__set_grid_type_nemo
+
+  SUBROUTINE iom__set_grid_type_lmdz(name,nbp,offset)
+  USE xmlio
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(IN) :: name
+    INTEGER,INTENT(IN)          :: nbp
+    INTEGER,INTENT(IN)          :: offset
+
+    TYPE(grid),   POINTER :: pt_grid
+    TYPE(domain), POINTER :: pt_domain
+    LOGICAL,ALLOCATABLE   :: mask(:,:)
+      
+      CALL grid__get(name,pt_grid)
+      CALL grid__get_subdomain(pt_grid,current_rank,pt_domain)
+      ALLOCATE(mask(pt_domain%ni,pt_domain%nj))
+      mask(:,:)=.TRUE.
+      mask(1:offset,1)=.FALSE.
+      mask(MOD(offset+nbp-1,pt_domain%ni)+2:pt_domain%ni,pt_domain%nj)=.FALSE.
+      CALL domain__set_type_box(pt_domain,mask)
+
+  END SUBROUTINE iom__set_grid_type_lmdz
       
   SUBROUTINE iom__set_time_parameters(itau0,zjulian,zdt)
@@ -273,5 +303,5 @@
       nj=local_domain%nj
       
-      IF (pt_field%axis%name/="none") THEN
+      IF (pt_field%axis%name=="none") THEN
         CALL write_ioipsl_3d(varname,Field_buffer(1:ni,1:nj,1:nk))
       ELSE 
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioserver_namelist.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioserver_namelist.f90	(revision 30)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioserver_namelist.f90	(revision 30)
@@ -0,0 +1,55 @@
+MODULE mod_ioserver_namelist
+
+  LOGICAL :: using_server
+  LOGICAL :: using_oasis
+  CHARACTER(LEN=100) :: client_id
+  CHARACTER(LEN=100) :: server_id
+  
+  NAMELIST /coupling_param/ using_server,using_oasis,client_id,server_id  
+
+  INTEGER,PARAMETER,PRIVATE :: starting_unit=356
+  
+CONTAINS
+
+  SUBROUTINE set_default_namelist
+  IMPLICIT NONE
+  
+    using_server=.FALSE.
+    using_oasis=.FALSE.
+    client_id='unknown'
+    server_id='unknown'
+  END SUBROUTINE set_default_namelist
+  
+    
+  SUBROUTINE read_namelist
+  IMPLICIT NONE
+    LOGICAL :: opened
+    INTEGER :: unit
+    INTEGER :: ierr
+
+    CALL set_default_namelist   
+    unit=starting_unit
+    opened=.TRUE.
+    DO WHILE (opened) 
+      unit=unit+1
+      INQUIRE(unit,OPENED=opened)
+    ENDDO
+      
+    OPEN(UNIT=unit,FILE='xmlio_server.def',STATUS='old',IOSTAT=ierr)
+    
+    
+    IF (ierr==0) THEN
+      READ(unit,nml=coupling_param)
+      CLOSE(unit)
+    ELSE
+      PRINT *,'WARNING : mod_ioserver::read_namelist : file xmlio_server.def is absent', &
+              ' ---> using default parameter'
+    ENDIF 
+    
+    
+    PRINT *,'namelist read --> ',using_server,using_oasis,client_id,server_id
+    
+  END SUBROUTINE read_namelist
+
+
+END MODULE mod_ioserver_namelist 
Index: /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioserver_para.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioserver_para.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/mod_ioserver_para.f90	(revision 30)
@@ -20,4 +20,8 @@
   SUBROUTINE Init_parallel
   USE mpitrace
+  USE mod_ioserver_namelist
+#ifdef USE_OASIS
+  USE mod_prism_get_comm 
+#endif 
   IMPLICIT NONE
     INCLUDE 'mpif.h'
@@ -28,10 +32,24 @@
     INTEGER :: i
     INTEGER :: group_color
-    
-    CALL MPI_INIT(ierr)
-    CALL MPI_COMM_RANK(MPI_COMM_WORLD,global_rank,ierr)
-    CALL MPI_COMM_SIZE(MPI_COMM_WORLD,global_size,ierr)
-   
-    CALL MPI_COMM_SPLIT(MPI_COMM_WORLD,color_server,global_rank,intracomm,ierr)
+    INTEGER :: Comm_client_server
+    INTEGER :: comp_id
+    CHARACTER(LEN=6) :: oasis_server_id, oasis_client_id
+
+    IF (using_oasis) THEN
+       oasis_server_id=server_id
+       oasis_client_id=client_id
+#ifdef USE_OASIS
+       CALL prism_init_comp_proto (comp_id, oasis_server_id, ierr)
+       CALL prism_get_intracomm(Comm_client_server,oasis_client_id,ierr)
+#endif
+    ELSE
+      CALL MPI_INIT(ierr)
+      Comm_client_server=MPI_COMM_WORLD
+    ENDIF
+        
+    CALL MPI_COMM_RANK(Comm_client_server,global_rank,ierr)
+    CALL MPI_COMM_SIZE(Comm_client_server,global_size,ierr)
+       
+    CALL MPI_COMM_SPLIT(Comm_client_server,color_server,global_rank,intracomm,ierr)
     CALL MPI_COMM_SIZE(intracomm,mpi_size,ierr)
     CALL MPI_COMM_RANK(intracomm,mpi_rank,ierr)
@@ -40,5 +58,5 @@
     PRINT *,'group_color',group_color
 
-    CALL MPI_COMM_SPLIT(MPI_COMM_WORLD,group_color,global_rank,iocomm,ierr)    
+    CALL MPI_COMM_SPLIT(Comm_client_server,group_color,global_rank,iocomm,ierr)    
     
     CALL MPI_COMM_SIZE(iocomm,iosize,ierr)
@@ -64,10 +82,20 @@
   
   SUBROUTINE Finalize_parallel
+  USE mod_ioserver_namelist
+#ifdef USE_OASIS
+  USE mod_prism_proto
+#endif
   IMPLICIT NONE
     include 'mpif.h'
     INTEGER :: ierr
     
-    CALL MPI_FINALIZE(ierr)
-
+    IF (using_oasis) THEN
+#ifdef USE_OASIS
+      CALL prism_terminate_proto(ierr)
+#endif
+    ELSE
+      CALL MPI_FINALIZE(ierr)
+    ENDIF
+    
   END SUBROUTINE Finalize_parallel
 
Index: /XMLIO_SERVER/trunk/src/IOSERVER/server.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/IOSERVER/server.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/IOSERVER/server.f90	(revision 30)
@@ -7,4 +7,5 @@
   USE iomanager
   USE mod_interface_ioipsl
+  USE mod_ioserver_namelist
   IMPLICIT NONE
   INCLUDE 'mpif.h'
@@ -15,4 +16,5 @@
 !  CALL SLEEP(60)
   PRINT *,'je suis un serveur'
+  CALL read_namelist
   CALL init_parallel
   CALL init_mpi_buffer
Index: /XMLIO_SERVER/trunk/src/XMLIO/create_template
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/create_template	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/create_template	(revision 30)
@@ -1,38 +1,25 @@
-sed "s/#TYPE#/field/g" vector_def.template > vector_field_def.inc
-sed "s/#TYPE#/field/g" vector_contains.template > vector_field_contains.inc
+#! /bin/bash
 
-sed "s/#TYPE#/field_group/g" vector_def.template > vector_field_group_def.inc
-sed "s/#TYPE#/field_group/g" vector_contains.template > vector_field_group_contains.inc
+function template() 
+{
+  echo ${1}
+  sed "s/#TYPE#/${1}/g" vector_def.template > vector_${1}_def.inc
+  sed "s/#TYPE#/${1}/g" vector_contains.template > vector_${1}_contains.inc
+}
 
-sed "s/#TYPE#/axis/g" vector_def.template > vector_axis_def.inc
-sed "s/#TYPE#/axis/g" vector_contains.template > vector_axis_contains.inc
 
-sed "s/#TYPE#/axis_group/g" vector_def.template > vector_axis_group_def.inc
-sed "s/#TYPE#/axis_group/g" vector_contains.template > vector_axis_group_contains.inc
-
-sed "s/#TYPE#/node/g" vector_def.template > vector_node_def.inc
-sed "s/#TYPE#/node/g" vector_contains.template > vector_node_contains.inc
-
-sed "s/#TYPE#/domain/g" vector_def.template > vector_domain_def.inc
-sed "s/#TYPE#/domain/g" vector_contains.template > vector_domain_contains.inc
-
-sed "s/#TYPE#/grid/g" vector_def.template > vector_grid_def.inc
-sed "s/#TYPE#/grid/g" vector_contains.template > vector_grid_contains.inc
-
-sed "s/#TYPE#/grid_group/g" vector_def.template > vector_grid_group_def.inc
-sed "s/#TYPE#/grid_group/g" vector_contains.template > vector_grid_group_contains.inc
-
-sed "s/#TYPE#/file/g" vector_def.template > vector_file_def.inc
-sed "s/#TYPE#/file/g" vector_contains.template > vector_file_contains.inc
-
-sed "s/#TYPE#/file_group/g" vector_def.template > vector_file_group_def.inc
-sed "s/#TYPE#/file_group/g" vector_contains.template > vector_file_group_contains.inc
-
-sed "s/#TYPE#/file_dep/g" vector_def.template > vector_file_dep_def.inc
-sed "s/#TYPE#/file_dep/g" vector_contains.template > vector_file_dep_contains.inc
-
-sed "s/#TYPE#/field_dep/g" vector_def.template > vector_field_dep_def.inc
-sed "s/#TYPE#/field_dep/g" vector_contains.template > vector_field_dep_contains.inc
-
-sed "s/#TYPE#/field_out/g" vector_def.template > vector_field_out_def.inc
-sed "s/#TYPE#/field_out/g" vector_contains.template > vector_field_out_contains.inc
+template field
+template field_group
+template axis
+template axis_group
+template node
+template domain
+template grid
+template grid_group
+template file
+template file_group
+template field_dep
+template file_dep
+template field_out
+template context
+template zoom
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_axis.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_axis.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_axis.f90	(revision 30)
@@ -18,4 +18,6 @@
     CHARACTER(len=str_len)      :: unit
     LOGICAL                     :: has_unit
+    LOGICAL                     :: positive
+    LOGICAL                     :: has_positive
     REAL, DIMENSION(:), POINTER :: values
     LOGICAL                     :: has_values
@@ -31,9 +33,16 @@
   INCLUDE 'vector_axis_contains.inc'
 
+  SUBROUTINE axis__swap_context(saved_axis_Ids,saved_Ids)
+  IMPLICIT NONE
+    TYPE(vector_axis),POINTER          :: saved_axis_Ids
+    TYPE(sorted_list),POINTER          :: saved_Ids 
+    
+    axis_ids=>saved_axis_ids
+    ids=>saved_ids
+    
+  END SUBROUTINE axis__swap_context
+
   SUBROUTINE axis__init
   IMPLICIT NONE
-    
-    ALLOCATE(axis_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_axis__new(axis_Ids)
@@ -67,5 +76,5 @@
    INTEGER                       :: Pos
    
-   pt_axis%has_id         = .FALSE.
+   pt_axis%has_id          = .FALSE.
    pt_axis%has_name        = .FALSE.
    pt_axis%has_size        = .FALSE.
@@ -73,5 +82,6 @@
    pt_axis%has_unit        = .FALSE.
    pt_axis%has_values      = .FALSE.
-   
+   pt_axis%has_positive    = .FALSE. 
+     
    IF (PRESENT(Id)) THEN
      Pt_axis%id=TRIM(ADJUSTL(Id))
@@ -83,5 +93,5 @@
  END SUBROUTINE axis__new
 
-  SUBROUTINE axis__set(pt_axis, name, description, unit, a_size, values)
+  SUBROUTINE axis__set(pt_axis, name, description, unit, a_size, values, positive)
   IMPLICIT NONE
     TYPE(axis), POINTER         :: pt_axis
@@ -91,4 +101,5 @@
     INTEGER           ,OPTIONAL :: a_size
     REAL, DIMENSION(:),OPTIONAL :: values
+    LOGICAL           ,OPTIONAL :: positive
 
     IF (PRESENT(name)) THEN
@@ -119,4 +130,9 @@
     ENDIF
 
+    IF (PRESENT(positive)) then
+        pt_axis%positive=positive
+        pt_axis%has_positive = .TRUE.
+    ENDIF
+
   END SUBROUTINE axis__set
 
@@ -160,4 +176,10 @@
     ELSE
       PRINT *,"values undefined"
+    ENDIF
+
+    IF (pt_axis%has_positive) THEN
+      PRINT *,"positive = ",pt_axis%positive
+    ELSE
+      PRINT *,"positive undefined"
     ENDIF
 
@@ -217,4 +239,14 @@
     ELSE
         pt_axis_out%has_values=.FALSE.
+    ENDIF
+
+    IF (pt_axis_in%has_positive) THEN
+        pt_axis_out%positive=pt_axis_in%positive
+        pt_axis_out%has_positive=.TRUE.
+    ELSE IF ( pt_axis_default%has_positive ) THEN
+        pt_axis_out%positive=pt_axis_default%positive
+        pt_axis_out%has_positive=.TRUE.
+    ELSE
+        pt_axis_out%has_positive=.FALSE.
     ENDIF
     
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_axis_definition.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_axis_definition.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_axis_definition.f90	(revision 30)
@@ -6,9 +6,16 @@
 CONTAINS
 
+  SUBROUTINE axis_definition__swap_context(saved_axis_definition)      
+  IMPLICIT NONE
+    TYPE(axis_group),POINTER :: saved_axis_definition
+    
+    axis_definition=>saved_axis_definition
+    
+  END SUBROUTINE axis_definition__swap_context 
+
   SUBROUTINE axis_definition__Init
   USE mod_axis_group
   IMPLICIT NONE
   
-    ALLOCATE(axis_definition)
     CALL axis_group__new(axis_definition,"axis_definition")
     
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_axis_group.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_axis_group.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_axis_group.f90	(revision 30)
@@ -22,9 +22,16 @@
   INCLUDE "vector_axis_group_contains.inc"
 
+  SUBROUTINE axis_group__swap_context(saved_axis_group_Ids,saved_ids)
+  IMPLICIT NONE
+  TYPE(vector_axis_group),POINTER       :: saved_axis_group_Ids
+  TYPE(sorted_list),POINTER             :: saved_Ids 
+   
+   axis_group_ids=>saved_axis_group_ids
+   ids=>saved_ids
+   
+  END SUBROUTINE axis_group__swap_context
+
   SUBROUTINE axis_group__init
   IMPLICIT NONE
-    
-    ALLOCATE(axis_group_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_axis_group__new(axis_group_Ids)
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_context.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_context.f90	(revision 30)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_context.f90	(revision 30)
@@ -0,0 +1,233 @@
+MODULE mod_context
+  USE mod_xmlio_parameters
+  USE mod_sorted_list
+  USE mod_field
+  USE mod_field_group
+  USE mod_field_definition
+  USE mod_file
+  USE mod_file_group
+  USE mod_file_definition
+  USE mod_grid
+  USE mod_zoom
+  USE mod_grid_group
+  USE mod_grid_definition
+  USE mod_axis
+  USE mod_axis_group
+  USE mod_axis_definition
+  USE mod_dependency
+  USE mod_time_parameters
+
+
+  INTERFACE context__swap
+    MODULE PROCEDURE context__swap_id,context__swap_pt
+  END INTERFACE  
+  
+  TYPE, PUBLIC :: context
+    CHARACTER(len=str_len)         :: id
+    INTEGER                        :: number
+  
+    TYPE(vector_field),POINTER        :: field__field_Ids
+    TYPE(sorted_list),POINTER         :: field__Ids
+    TYPE(vector_field_group),POINTER  :: field_group__field_group_ids
+    TYPE(sorted_list),POINTER         :: field_group__Ids
+    TYPE(field_group),POINTER         :: field_definition__field_definition
+    TYPE(vector_file),POINTER         :: file__file_Ids
+    TYPE(sorted_list),POINTER         :: file__Ids
+    TYPE(vector_file_group),POINTER   :: file_group__file_group_Ids
+    TYPE(sorted_list),POINTER         :: file_group__Ids 
+    TYPE(file_group),POINTER          :: file_definition__file_definition 
+    TYPE(vector_grid),POINTER         :: grid__grid_Ids
+    TYPE(sorted_list),POINTER         :: grid__Ids 
+    TYPE(vector_zoom),POINTER         :: zoom__zoom_Ids
+    TYPE(sorted_list),POINTER         :: zoom__Ids 
+    TYPE(vector_grid_group),POINTER   :: grid_group__grid_group_Ids
+    TYPE(sorted_list),POINTER         :: grid_group__Ids 
+    TYPE(grid_group),POINTER          :: grid_definition__grid_definition
+    TYPE(vector_axis),POINTER         :: axis__axis_Ids
+    TYPE(sorted_list),POINTER         :: axis__Ids 
+    TYPE(vector_axis_group),POINTER   :: axis_group__axis_group_Ids
+    TYPE(sorted_list),POINTER         :: axis_group__Ids 
+    TYPE(axis_group),POINTER          :: axis_definition__axis_definition
+    TYPE(vector_file_dep),POINTER     :: dependency__file_enabled
+    TYPE(vector_field_out),POINTER    :: dependency__field_enabled 
+    TYPE(vector_field_dep),POINTER    :: dependency__field_id
+    TYPE(sorted_list),POINTER         :: dependency__sorted_id 
+    INTEGER,POINTER                   :: time_param__initial_timestep
+    REAL,POINTER                      :: time_param__initial_date
+    REAL,POINTER                      :: time_param__timestep_value 
+    INTEGER,POINTER                   :: time_param__timestep_number
+
+  END TYPE context
+  
+  INCLUDE 'vector_context_def.inc'
+  TYPE(vector_context),SAVE,POINTER  :: context_ids
+  TYPE(sorted_list),POINTER,SAVE,PRIVATE :: Ids
+
+ 
+  CONTAINS
+    INCLUDE 'vector_context_contains.inc'
+    
+    SUBROUTINE context__init
+    IMPLICIT NONE
+
+      ALLOCATE(context_Ids)
+      ALLOCATE(Ids)
+
+      CALL vector_context__new(context_Ids)
+      CALL sorted_list__new(ids)
+
+    END SUBROUTINE context__init
+
+    SUBROUTINE context__get(Id,Pt_context)
+      USE string_function
+      IMPLICIT NONE
+      CHARACTER(LEN=*),INTENT(IN)     :: Id
+      TYPE(context),POINTER              :: Pt_context
+
+      INTEGER                         :: Pos
+      LOGICAL                         :: success
+    
+      CALL sorted_list__find(Ids,hash(Id),Pos,success)
+      IF (success) THEN
+        Pt_context=>context_ids%at(Pos)%Pt
+      ELSE
+        Pt_context=>NULL()
+      ENDIF
+    
+    END SUBROUTINE context__get
+
+    SUBROUTINE context__get_new(Id,pt_context)
+    USE string_function
+    IMPLICIT NONE
+      CHARACTER(LEN=*),INTENT(IN)     :: Id
+      TYPE(context),POINTER              :: Pt_context
+
+      INTEGER                         :: Pos
+      LOGICAL                         :: success
+      
+      CALL sorted_list__find(Ids,hash(Id),Pos,success)
+      IF (success) THEN
+        Pt_context=>context_ids%at(Pos)%Pt
+      ELSE
+        CALL vector_context__get_new(context_ids,pt_context,Pos)
+        pt_context%number=Pos
+        Pt_context%id=Id
+        CALL sorted_list__Add(Ids,hash(Id),Pos)
+        
+        ALLOCATE(pt_context%field__field_Ids )
+        ALLOCATE(pt_context%field__Ids )
+        ALLOCATE(pt_context%field_group__field_group_ids )
+        ALLOCATE(pt_context%field_group__field_group_ids )
+        ALLOCATE(pt_context%field_group__Ids )
+        ALLOCATE(pt_context%field_definition__field_definition )
+        ALLOCATE(pt_context%file__file_Ids)
+        ALLOCATE(pt_context%file__Ids)
+        ALLOCATE(pt_context%file_group__file_group_Ids)
+        ALLOCATE(pt_context%file_group__Ids) 
+        ALLOCATE(pt_context%file_definition__file_definition) 
+        ALLOCATE(pt_context%grid__grid_Ids)
+        ALLOCATE(pt_context%grid__Ids) 
+        ALLOCATE(pt_context%zoom__zoom_Ids)
+        ALLOCATE(pt_context%zoom__Ids) 
+        ALLOCATE(pt_context%grid_group__grid_group_Ids)
+        ALLOCATE(pt_context%grid_group__Ids) 
+        ALLOCATE(pt_context%grid_definition__grid_definition)
+        ALLOCATE(pt_context%axis__axis_Ids)
+        ALLOCATE(pt_context%axis__Ids) 
+        ALLOCATE(pt_context%axis_group__axis_group_Ids)
+        ALLOCATE(pt_context%axis_group__Ids) 
+        ALLOCATE(pt_context%axis_definition__axis_definition)
+        ALLOCATE(pt_context%dependency__file_enabled)
+        ALLOCATE(pt_context%dependency__field_enabled) 
+        ALLOCATE(pt_context%dependency__field_id)
+        ALLOCATE(pt_context%dependency__sorted_id)  
+        ALLOCATE(pt_context%time_param__initial_timestep)
+        ALLOCATE(pt_context%time_param__initial_date)
+        ALLOCATE(pt_context%time_param__timestep_value) 
+        ALLOCATE(pt_context%time_param__timestep_number)
+
+        CALL context__swap(pt_context)
+        
+        CALL field__init
+        CALL field_group__Init
+        CALL field_definition__Init
+
+        CALL axis__init
+        CALL axis_group__Init
+        CALL axis_definition__Init
+
+        CALL grid__init
+        CALL grid_group__Init
+        CALL grid_definition__Init
+
+        CALL zoom__init
+
+        CALL file__init
+        CALL file_group__Init
+        CALL file_definition__Init
+
+      ENDIF
+
+    END SUBROUTINE context__get_new
+
+
+    SUBROUTINE context__create(Id)
+    IMPLICIT NONE
+      CHARACTER(LEN=*),INTENT(IN)     :: Id
+      
+      TYPE(context),POINTER              :: Pt_context
+
+      CALL context__get(Id,Pt_context)
+      IF (.NOT. ASSOCIATED(Pt_context)) CALL context__get_new(Id,Pt_context)
+      
+!      CALL field__init
+!      CALL field_group__init
+!      CALL field_definition__init
+      
+     END SUBROUTINE context__create
+
+     
+    SUBROUTINE context__swap_id(Id)
+    USE mod_field
+      IMPLICIT NONE
+      CHARACTER(LEN=*),INTENT(IN)     :: Id
+      TYPE(context),POINTER       :: Pt_context
+
+      INTEGER :: number
+      
+      CALL context__get(Id,Pt_context)
+      IF (.NOT. ASSOCIATED(Pt_context)) THEN
+!!      error message
+      ENDIF
+      
+      CALL context__swap(pt_context)  
+
+    END SUBROUTINE context__swap_id
+
+    SUBROUTINE context__swap_pt(Pt_context)
+    USE mod_field
+      IMPLICIT NONE
+      TYPE(context),POINTER       :: Pt_context
+
+      CALL field__swap_context(Pt_context%field__field_Ids ,Pt_context%field__Ids)
+      CALL field_group__swap_context(Pt_context%field_group__field_group_ids ,Pt_context%field_group__Ids)
+      CALL field_definition__swap_context(Pt_context%field_definition__field_definition)
+      CALL file__swap_context(Pt_context%file__file_Ids,Pt_context%file__Ids)
+      CALL file_group__swap_context(Pt_context%file_group__file_group_Ids,Pt_context%file_group__Ids)
+      CALL file_definition__swap_context(Pt_context%file_definition__file_definition) 
+      CALL grid__swap_context(pt_context%grid__grid_Ids,pt_context%grid__Ids) 
+      CALL zoom__swap_context(pt_context%zoom__zoom_Ids,pt_context%zoom__Ids) 
+      CALL grid_group__swap_context(pt_context%grid_group__grid_group_Ids,pt_context%grid_group__Ids) 
+      CALL grid_definition__swap_context(pt_context%grid_definition__grid_definition)
+      CALL axis__swap_context(pt_context%axis__axis_Ids,pt_context%axis__Ids) 
+      CALL axis_group__swap_context(pt_context%axis_group__axis_group_Ids,pt_context%axis_group__Ids) 
+      CALL axis_definition__swap_context(pt_context%axis_definition__axis_definition)
+      CALL dependency__swap_context(pt_context%dependency__file_enabled,pt_context%dependency__field_enabled,  &
+                                    pt_context%dependency__field_id,pt_context%dependency__sorted_id)
+      CALL time_parameters__swap_context(pt_context%time_param__initial_timestep,pt_context%time_param__initial_date,  &
+                                         pt_context%time_param__timestep_value,pt_context%time_param__timestep_number)
+                                    
+    END SUBROUTINE context__swap_pt
+
+
+END MODULE mod_context
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_dependency.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_dependency.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_dependency.f90	(revision 30)
@@ -5,4 +5,5 @@
 USE mod_axis
 USE mod_sorted_list
+USE mod_zoom
 
 TYPE file_dep
@@ -11,4 +12,5 @@
   TYPE(vector_field),POINTER   :: fields
   TYPE(vector_grid),POINTER    :: grids
+  TYPE(vector_zoom),POINTER    :: zooms
   TYPE(vector_axis),POINTER    :: axis
 END TYPE file_dep
@@ -26,4 +28,5 @@
   TYPE(axis),  POINTER  :: axis
   TYPE(grid),  POINTER  :: grid
+  TYPE(zoom),  POINTER  :: zoom
 END TYPE field_out
 
@@ -32,10 +35,10 @@
 INCLUDE 'vector_field_out_def.inc'
 
-TYPE(vector_file_dep),POINTER      :: file_enabled
-TYPE(vector_field_out),POINTER     :: field_enabled 
-TYPE(vector_field_dep),POINTER     :: field_id
+TYPE(vector_file_dep),POINTER,SAVE      :: file_enabled
+TYPE(vector_field_out),POINTER,SAVE     :: field_enabled 
+TYPE(vector_field_dep),POINTER,SAVE     :: field_id
 
  
-TYPE(sorted_list),POINTER :: sorted_id
+TYPE(sorted_list),POINTER,SAVE :: sorted_id
 
 CONTAINS
@@ -45,4 +48,19 @@
 INCLUDE 'vector_field_out_contains.inc'
 
+  
+  SUBROUTINE dependency__swap_context(saved_file_enabled,saved_field_enabled,save_field_id,saved_sorted_id)  
+  IMPLICIT NONE
+    TYPE(vector_file_dep),POINTER      :: saved_file_enabled
+    TYPE(vector_field_out),POINTER     :: saved_field_enabled 
+    TYPE(vector_field_dep),POINTER     :: save_field_id
+    TYPE(sorted_list),POINTER          :: saved_sorted_id  
+    
+    file_enabled=>saved_file_enabled   
+    field_enabled=>saved_field_enabled
+    field_id=>save_field_id
+    sorted_id=>saved_sorted_id
+      
+  END SUBROUTINE dependency__swap_context
+  
   SUBROUTINE set_dependency
   IMPLICIT NONE
@@ -67,4 +85,5 @@
     TYPE (sorted_list),POINTER         :: sorted_axis
     TYPE (sorted_list),POINTER         :: sorted_grid
+    TYPE (sorted_list),POINTER         :: sorted_zoom
     INTEGER                            :: i
     INTEGER                            :: j
@@ -72,9 +91,9 @@
     ALLOCATE(sorted_axis)
     ALLOCATE(sorted_grid)
+    ALLOCATE(sorted_zoom)
     
     IF (PRESENT(Pt_file_group)) THEN
       Pt_fg=>Pt_file_group
     ELSE
-      ALLOCATE(file_enabled)
       CALL vector_file_dep__new(file_enabled)
       Pt_fg=>file_definition
@@ -92,4 +111,5 @@
         ALLOCATE(Pt_file_dep%fields)
         ALLOCATE(Pt_file_dep%grids)
+        ALLOCATE(Pt_file_dep%zooms)
         ALLOCATE(Pt_file_dep%axis)
         pt_file_dep%file=>pt_file
@@ -97,7 +117,9 @@
         CALL vector_field__new(Pt_file_dep%fields)
         CALL vector_grid__new(Pt_file_dep%grids)
+        CALL vector_zoom__new(Pt_file_dep%zooms)
         CALL vector_axis__new(Pt_file_dep%axis)
         CALL sorted_list__new(sorted_axis)
         CALL sorted_list__new(sorted_grid)
+        CALL sorted_list__new(sorted_zoom)
         
         CALL Treat_field_group(pt_file%field_list)
@@ -105,4 +127,5 @@
         CALL sorted_list__delete(sorted_axis)
         CALL sorted_list__delete(sorted_grid)
+        CALL sorted_list__delete(sorted_zoom)
       ENDIF
     ENDDO
@@ -138,4 +161,12 @@
               CALL vector_grid__set_new(pt_file_dep%grids,Pt_field%grid,pos)
               CALL sorted_list__add(sorted_grid,hash(Pt_field%grid%id),pos)
+            ENDIF
+          ENDIF
+
+          IF (Pt_field%has_zoom) THEN
+            CALL sorted_list__find(sorted_zoom,hash(Pt_field%zoom%id),pos,found)
+            IF (.NOT. found) THEN 
+              CALL vector_zoom__set_new(pt_file_dep%zooms,Pt_field%zoom,pos)
+              CALL sorted_list__add(sorted_zoom,hash(Pt_field%zoom%id),pos)
             ENDIF
           ENDIF
@@ -161,5 +192,4 @@
   INTEGER                  :: j
   
-    ALLOCATE(field_enabled)
     CALL vector_field_out__new(field_enabled)
     
@@ -172,4 +202,5 @@
         pt_field_out%axis=>pt_field_out%field%axis
         pt_field_out%grid=>pt_field_out%field%grid
+        pt_field_out%zoom=>pt_field_out%field%zoom
       ENDDO
     ENDDO
@@ -189,8 +220,5 @@
   INTEGER :: i
   
-    ALLOCATE(field_id)
     CALL vector_field_dep__new(field_id)
-
-    ALLOCATE(sorted_id)
     CALL sorted_list__new(sorted_id)
     
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_domain.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_domain.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_domain.f90	(revision 30)
@@ -1,5 +1,4 @@
 MODULE mod_domain
    USE mod_xmlio_parameters
-
    INTEGER, PARAMETER :: box=1
    INTEGER, PARAMETER :: orange=2
@@ -123,10 +122,15 @@
     ENDIF
 
+    pt_domain%nbp=nbp
     ALLOCATE(pt_domain%i_index(nbp))
     ALLOCATE(pt_domain%j_index(nbp))
+    ALLOCATE(pt_domain%mask(nbp))
         
     DO i=1,nbp
-      Pt_domain%i_index(i)=(index(i)+offset)/pt_domain%nj+1+pt_domain%ibegin-1
-      Pt_domain%j_index(i)=MOD(index(i)+offset,pt_domain%nj)+1+pt_domain%jbegin-1
+!      Pt_domain%i_index(i)=(index(i)+offset)/pt_domain%ni+1+pt_domain%ibegin-1
+!      Pt_domain%j_index(i)=MOD(index(i)+offset,pt_domain%ni)+1+pt_domain%jbegin-1
+      Pt_domain%i_index(i)=MOD(index(i)+offset-1,pt_domain%ni)+1
+      Pt_domain%j_index(i)=(index(i)+offset-1)/pt_domain%ni+1
+      
     ENDDO
 
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_field.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_field.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_field.f90	(revision 30)
@@ -5,5 +5,6 @@
   USE mod_axis
   USE mod_grid
-    
+  USE mod_zoom
+   
   IMPLICIT NONE
 
@@ -25,4 +26,6 @@
     CHARACTER(len=str_len)         :: grid_ref
     LOGICAL                        :: has_grid_ref
+    CHARACTER(len=str_len)         :: zoom_ref
+    LOGICAL                        :: has_zoom_ref
     INTEGER                        :: level
     LOGICAL                        :: has_level
@@ -40,4 +43,6 @@
     TYPE(grid),POINTER             :: grid
     LOGICAL                        :: has_grid
+    TYPE(zoom),POINTER             :: zoom
+    LOGICAL                        :: has_zoom
     INTEGER                        :: internal(internal_field)
     
@@ -47,15 +52,23 @@
   INCLUDE 'vector_field_def.inc'
   
-  TYPE(vector_field),POINTER            :: field_Ids
-  TYPE(sorted_list),POINTER,PRIVATE     :: Ids 
+  TYPE(vector_field),POINTER,SAVE            :: field_Ids
+  TYPE(sorted_list),POINTER,SAVE,PRIVATE     :: Ids
+  
 
 CONTAINS
   INCLUDE 'vector_field_contains.inc'
-  
+
+  SUBROUTINE field__swap_context(saved_field_ids,saved_ids)
+  IMPLICIT NONE
+    TYPE(vector_field),POINTER :: saved_field_ids
+    TYPE(sorted_list),POINTER  :: saved_ids
+    
+    field_Ids=>saved_field_ids
+    Ids=>saved_Ids
+
+  END SUBROUTINE field__swap_context
+
   SUBROUTINE field__init
   IMPLICIT NONE
-    
-    ALLOCATE(field_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_field__new(field_Ids)
@@ -99,4 +112,5 @@
    pt_field%has_axis_ref = .FALSE.
    pt_field%has_grid_ref = .FALSE.
+   pt_field%has_zoom_ref = .FALSE.
    pt_field%has_prec = .FALSE.
    pt_field%has_level = .FALSE. 
@@ -107,4 +121,5 @@
    Pt_field%has_axis=.FALSE.
    Pt_field%has_grid=.FALSE.
+   Pt_field%has_zoom=.FALSE.
       
    IF (PRESENT(Id)) THEN
@@ -118,5 +133,5 @@
 
 
- SUBROUTINE field__set(p_field, name, ref, description, unit, operation, freq_op, axis_ref, grid_ref, prec, level, enabled)
+ SUBROUTINE field__set(p_field, name, ref, description, unit, operation, freq_op, axis_ref, grid_ref, zoom_ref, prec, level, enabled)
 
     TYPE(field), pointer :: p_field
@@ -129,4 +144,5 @@
     CHARACTER(len=*),OPTIONAL :: axis_ref
     CHARACTER(len=*),OPTIONAL :: grid_ref
+    CHARACTER(len=*),OPTIONAL :: zoom_ref
     INTEGER, OPTIONAL :: prec
     INTEGER, OPTIONAL :: level
@@ -166,4 +182,10 @@
         p_field%has_grid_ref = .TRUE.
     ENDIF
+
+    IF (PRESENT(zoom_ref)) THEN
+        p_field%zoom_ref=TRIM(ADJUSTL(zoom_ref))
+        p_field%has_zoom_ref = .TRUE.
+    ENDIF
+
     IF (PRESENT(prec)) then
         p_field%prec=prec
@@ -232,4 +254,10 @@
     ELSE
         PRINT *, 'grid_ref undefined '
+    ENDIF
+
+    IF (pt_field%has_zoom_ref) THEN
+        PRINT *, 'zoom_ref : ',TRIM(pt_field%zoom_ref)
+    ELSE
+        PRINT *, 'zoom_ref undefined '
     ENDIF
     
@@ -370,4 +398,14 @@
     ELSE
         pt_field_out%has_grid_ref=.FALSE.
+    ENDIF
+
+    IF (pt_field_in%has_zoom_ref) THEN
+        pt_field_out%zoom_ref=pt_field_in%zoom_ref
+        pt_field_out%has_zoom_ref=.TRUE.
+    ELSE IF ( pt_field_default%has_zoom_ref ) THEN
+        pt_field_out%zoom_ref=pt_field_default%zoom_ref
+        pt_field_out%has_zoom_ref=.TRUE.
+    ELSE
+        pt_field_out%has_zoom_ref=.FALSE.
     ENDIF
 
@@ -518,4 +556,28 @@
  END SUBROUTINE field__solve_grid_ref
    
+ SUBROUTINE field__solve_zoom_ref(pt_field)
+ USE error_msg
+ IMPLICIT NONE
+   TYPE(field), POINTER :: pt_field
+   
+   IF (.NOT. pt_field%has_zoom_ref) THEN
+     IF (pt_field%has_grid_ref) THEN
+       pt_field%has_zoom_ref=.TRUE.
+       pt_field%zoom_ref=pt_field%grid_ref
+     ENDIF
+   ENDIF
+    
+   IF (pt_field%has_zoom_ref) THEN
+     CALL zoom__get(pt_field%zoom_ref,pt_field%zoom)
+     IF (ASSOCIATED(pt_field%zoom)) THEN
+       pt_field%has_zoom=.TRUE.
+     ELSE
+       WRITE (message,*) "The field : id = ",pt_field%id,"  name = ",Pt_field%name,   &
+                        " has a unknown reference to zoom : id =",pt_field%zoom_ref
+       CALL error("mod_field::field__solve_zoom_ref")
+     ENDIF
+   ENDIF
+   
+ END SUBROUTINE field__solve_zoom_ref
 
    
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_field_definition.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_field_definition.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_field_definition.f90	(revision 30)
@@ -6,12 +6,20 @@
 CONTAINS
 
+  SUBROUTINE field_definition__swap_context(saved_field_definition)
+  IMPLICIT NONE
+    TYPE(field_group),POINTER :: saved_field_definition
+  
+    field_definition=>saved_field_definition
+
+  END SUBROUTINE field_definition__swap_context
+
+
   SUBROUTINE field_definition__Init
-  USE mod_field_group
   IMPLICIT NONE
   
-    ALLOCATE(field_definition)
-    CALL field_group__new(field_definition,"field_definition")
-    
+   CALL field_group__new(field_definition,"field_definition")
+
   END SUBROUTINE field_definition__Init
+  
         
 END MODULE mod_field_definition
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_field_group.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_field_group.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_field_group.f90	(revision 30)
@@ -16,6 +16,6 @@
   INCLUDE "vector_field_group_def.inc"  
 
-  TYPE(vector_field_group),POINTER      :: field_group_Ids
-  TYPE(sorted_list),POINTER,PRIVATE     :: Ids 
+  TYPE(vector_field_group),SAVE,POINTER      :: field_group_Ids
+  TYPE(sorted_list),POINTER,SAVE,PRIVATE     :: Ids 
 
 CONTAINS
@@ -23,9 +23,17 @@
   INCLUDE "vector_field_group_contains.inc"
 
+
+  SUBROUTINE field_group__swap_context(saved_field_group_ids, saved_ids)
+  IMPLICIT NONE
+    TYPE(vector_field_group),POINTER   :: saved_field_group_Ids
+    TYPE(sorted_list),POINTER          :: saved_Ids
+    
+    field_group_ids=>saved_field_group_ids 
+    ids=>saved_ids
+    
+  END SUBROUTINE field_group__swap_context
+
   SUBROUTINE field_group__init
   IMPLICIT NONE
-    
-    ALLOCATE(field_group_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_field_group__new(field_group_Ids)
@@ -150,4 +158,5 @@
     CALL field_group__solve_axis_ref(Pt_fg)
     CALL field_group__solve_grid_ref(Pt_fg)
+    CALL field_group__solve_zoom_ref(Pt_fg)
 
   END SUBROUTINE  field_group__solve_ref
@@ -200,4 +209,20 @@
   
   END SUBROUTINE field_group__solve_grid_ref
+
+  RECURSIVE SUBROUTINE field_group__solve_zoom_ref(Pt_fg)
+  IMPLICIT NONE
+    TYPE(field_group),POINTER  :: Pt_fg
+     
+    INTEGER :: i
+ 
+    DO i=1,Pt_fg%groups%size
+      CALL field_group__solve_zoom_ref(Pt_fg%groups%at(i)%pt)
+    ENDDO
+       
+    DO i=1,Pt_fg%fields%size
+      CALL field__solve_zoom_ref(Pt_fg%fields%at(i)%pt)
+    ENDDO
+  
+  END SUBROUTINE field_group__solve_zoom_ref
   
   RECURSIVE SUBROUTINE field_group__print(Pt_fg)
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_file.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_file.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_file.f90	(revision 30)
@@ -30,9 +30,17 @@
   INCLUDE 'vector_file_contains.inc'
 
+  SUBROUTINE file__swap_context(saved_file_ids,saved_ids)
+  IMPLICIT NONE
+    TYPE(vector_file),POINTER      :: saved_file_Ids
+    TYPE(sorted_list),POINTER      :: saved_Ids
+    
+    file_ids=>saved_file_ids
+    ids=>saved_ids 
+ 
+  END SUBROUTINE file__swap_context
+
+
   SUBROUTINE file__init
   IMPLICIT NONE
-    
-    ALLOCATE(file_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_file__new(file_Ids)
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_file_definition.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_file_definition.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_file_definition.f90	(revision 30)
@@ -6,9 +6,16 @@
 CONTAINS
 
+  SUBROUTINE file_definition__swap_context(saved_file_definition)
+  IMPLICIT NONE
+    TYPE(file_group),POINTER      :: saved_file_definition
+     
+    file_definition=>saved_file_definition
+ 
+  END SUBROUTINE file_definition__swap_context
+
   SUBROUTINE file_definition__Init
   USE mod_file_group
   IMPLICIT NONE
   
-    ALLOCATE(file_definition)
     CALL file_group__new(file_definition,"file_definition")
     
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_file_group.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_file_group.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_file_group.f90	(revision 30)
@@ -15,6 +15,6 @@
   INCLUDE "vector_file_group_def.inc"  
 
-  TYPE(vector_file_group),POINTER       :: file_group_Ids
-  TYPE(sorted_list),POINTER,PRIVATE     :: Ids 
+  TYPE(vector_file_group),POINTER,SAVE       :: file_group_Ids
+  TYPE(sorted_list),POINTER,PRIVATE,SAVE     :: Ids 
 
 CONTAINS
@@ -22,9 +22,16 @@
   INCLUDE "vector_file_group_contains.inc"
 
+  SUBROUTINE file_group__swap_context(saved_file_group_ids,saved_ids)
+  IMPLICIT NONE
+    TYPE(vector_file_group),POINTER      :: saved_file_group_Ids
+    TYPE(sorted_list),POINTER            :: saved_Ids
+    
+    file_group_ids=>saved_file_group_ids
+    ids=>saved_ids 
+ 
+  END SUBROUTINE file_group__swap_context
+
   SUBROUTINE file_group__init
   IMPLICIT NONE
-    
-    ALLOCATE(file_group_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_file_group__new(file_group_Ids)
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_grid.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_grid.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_grid.f90	(revision 30)
@@ -3,4 +3,6 @@
   USE mod_sorted_list
   USE mod_domain
+  USE mod_zoom
+
   IMPLICIT NONE
 
@@ -19,4 +21,6 @@
     INTEGER                     :: nj
     LOGICAL                     :: has_dimension
+    TYPE(vector_zoom),POINTER   :: associated_zoom
+    TYPE(zoom),POINTER          :: global_zoom
   END TYPE grid
 
@@ -29,9 +33,16 @@
   INCLUDE 'vector_grid_contains.inc'
 
+  SUBROUTINE grid__swap_context(saved_grid_Ids,saved_Ids)
+  IMPLICIT NONE
+    TYPE(vector_grid),POINTER          :: saved_grid_Ids
+    TYPE(sorted_list),POINTER          :: saved_Ids 
+    
+    grid_ids=>saved_grid_ids
+    ids=>saved_ids
+  END SUBROUTINE grid__swap_context
+  
+  
   SUBROUTINE grid__init
   IMPLICIT NONE
-    
-    ALLOCATE(grid_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_grid__new(grid_Ids)
@@ -68,7 +79,10 @@
    ALLOCATE(pt_grid%subdomain)
    ALLOCATE(pt_grid%rank_ids)
+   ALLOCATE(pt_grid%associated_zoom)
+   
    CALL domain__new(pt_grid%domain)
    CALL vector_domain__new(pt_grid%subdomain)
    CALL sorted_list__new(pt_grid%rank_ids)
+   CALL vector_zoom__new(pt_grid%associated_zoom)
    
    pt_grid%has_id          = .FALSE.
@@ -83,4 +97,6 @@
      CALL sorted_list__Add(Ids,hash(id),Pos)
    ENDIF
+   
+   CALL grid__get_new_zoom(pt_grid,pt_grid%global_zoom,id)
 
  END SUBROUTINE grid__new
@@ -153,8 +169,9 @@
     TYPE(grid), POINTER  :: pt_grid
     TYPE(domain),POINTER :: subdomain
+    TYPE(zoom),POINTER :: pt_zoom
     
     REAL,ALLOCATABLE :: lon(:,:)
     REAL,ALLOCATABLE :: lat(:,:)
-    INTEGER :: ib,ie,jb,je,ni,nj,ibegin,jbegin
+    INTEGER :: ib,ie,jb,je,ni,nj,ibegin,jbegin,iend,jend
     INTEGER :: i
     
@@ -196,6 +213,28 @@
       
       CALL domain__set(pt_grid%domain,0,ni,nj,ibegin,jbegin,lon,lat)
-
-      
+      iend=ibegin+ni-1
+      jend=jbegin+nj-1
+      
+      
+      pt_grid%global_zoom%ni_glo=pt_grid%ni
+      pt_grid%global_zoom%nj_glo=pt_grid%nj
+      pt_grid%global_zoom%ibegin_glo=1      
+      pt_grid%global_zoom%jbegin_glo=1
+      
+      DO i=1,pt_grid%associated_zoom%size
+        pt_zoom=>pt_grid%associated_zoom%at(i)%pt
+        
+        ib=MAX(pt_zoom%ibegin_glo-ibegin+1,1)
+        ie=MIN(pt_zoom%ibegin_glo+pt_zoom%ni_glo-ibegin,ni)
+        pt_zoom%ni_loc=MAX(ie-ib+1,0)
+        pt_zoom%ibegin_loc=ib
+
+        jb=MAX(pt_zoom%jbegin_glo-jbegin+1,1)
+        je=MIN(pt_zoom%jbegin_glo+pt_zoom%nj_glo-jbegin,nj)
+        pt_zoom%nj_loc=MAX(je-jb+1,0)
+        pt_zoom%jbegin_loc=jb
+      ENDDO
+                 
+            
       DEALLOCATE(lon)
       DEALLOCATE(lat)
@@ -204,5 +243,17 @@
       
             
-        
+  SUBROUTINE grid__get_new_zoom(pt_grid,pt_zoom,zoom_id)
+  USE string_function
+  IMPLICIT NONE
+    TYPE(grid), POINTER                      :: pt_grid
+    TYPE(zoom),POINTER                       :: pt_zoom
+    CHARACTER(LEN=*),INTENT(IN),OPTIONAL     :: zoom_id
+    LOGICAL                                  :: success
+    
+     CALL vector_zoom__get_new(pt_grid%associated_zoom,Pt_zoom)
+     CALL zoom__new(Pt_zoom,zoom_id)
+    
+   END SUBROUTINE grid__get_new_zoom
+     
   SUBROUTINE grid__print(pt_grid)
   IMPLICIT NONE
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_grid_definition.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_grid_definition.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_grid_definition.f90	(revision 30)
@@ -6,12 +6,19 @@
 CONTAINS
 
+  SUBROUTINE grid_definition__swap_context(saved_grid_definition)      
+  IMPLICIT NONE
+    TYPE(grid_group),POINTER :: saved_grid_definition
+    
+    grid_definition=>saved_grid_definition
+    
+  END SUBROUTINE grid_definition__swap_context 
+
   SUBROUTINE grid_definition__Init
   USE mod_grid_group
   IMPLICIT NONE
   
-    ALLOCATE(grid_definition)
     CALL grid_group__new(grid_definition,"grid_definition")
     
   END SUBROUTINE grid_definition__Init
-        
+ 
 END MODULE mod_grid_definition
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_grid_group.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_grid_group.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_grid_group.f90	(revision 30)
@@ -15,6 +15,6 @@
   INCLUDE "vector_grid_group_def.inc"  
 
-  TYPE(vector_grid_group),POINTER       :: grid_group_Ids
-  TYPE(sorted_list),POINTER,PRIVATE     :: Ids 
+  TYPE(vector_grid_group),POINTER,SAVE       :: grid_group_Ids
+  TYPE(sorted_list),POINTER,SAVE,PRIVATE     :: Ids 
 
 CONTAINS
@@ -22,9 +22,16 @@
   INCLUDE "vector_grid_group_contains.inc"
 
+  SUBROUTINE grid_group__swap_context(saved_grid_group_Ids,saved_ids)
+  IMPLICIT NONE
+  TYPE(vector_grid_group),POINTER       :: saved_grid_group_Ids
+  TYPE(sorted_list),POINTER             :: saved_Ids 
+   
+   grid_group_ids=>saved_grid_group_ids
+   ids=>saved_ids
+   
+  END SUBROUTINE grid_group__swap_context
+   
   SUBROUTINE grid_group__init
   IMPLICIT NONE
-    
-    ALLOCATE(grid_group_Ids)
-    ALLOCATE(Ids)
     
     CALL vector_grid_group__new(grid_group_Ids)
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_parse_xml.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_parse_xml.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_parse_xml.f90	(revision 30)
@@ -28,5 +28,5 @@
     CHARACTER(len=100) :: node_name
      
-     IF (hasChildNodes(root)) THEN
+    IF (hasChildNodes(root)) THEN
       child_list => getChildnodes(root)
 
@@ -38,5 +38,5 @@
           
            CASE ('simulation') 
-             CALL parsing_definition(child_node)
+             CALL parsing_simulation(child_node)
 
            CASE DEFAULT
@@ -45,4 +45,36 @@
                CALL Warning("mod_parse_xml:parsing_root")
              ENDIF
+        END SELECT
+      ENDDO
+    ENDIF
+             
+  END SUBROUTINE parsing_root
+
+  SUBROUTINE parsing_simulation(root)
+  IMPLICIT NONE
+    TYPE(fnode), POINTER :: root
+    TYPE(fnode), POINTER :: child_node
+    TYPE(fnodeList), POINTER :: child_list
+
+    INTEGER :: il
+    CHARACTER(len=100) :: node_name
+     
+     IF (hasChildNodes(root)) THEN
+      child_list => getChildnodes(root)
+
+      DO il=0,getLength(child_list)-1
+        child_node => item(child_list,il)
+        node_name=getNodename(child_node)
+          
+        SELECT CASE (TRIM(node_name)) 
+          
+           CASE ('context') 
+             CALL parsing_context(child_node)
+
+           CASE DEFAULT
+             IF (is_bad_node(node_name)) THEN
+               WRITE(message,*) 'Unknown node <<',TRIM(node_name),'>> while parsing simulation'
+               CALL Warning("mod_parse_xml:parsing_simulationt")
+             ENDIF
          END SELECT
        
@@ -50,27 +82,36 @@
     ENDIF
              
-  END SUBROUTINE parsing_root
-
-
-  SUBROUTINE parsing_definition(root)
+  END SUBROUTINE parsing_simulation
+
+  SUBROUTINE parsing_context(node)
+  USE mod_context
   USE mod_axis_definition
   USE mod_grid_definition
   USE mod_field_definition
   USE mod_file_definition
-  
-  IMPLICIT NONE
-    TYPE(fnode), POINTER :: root
-    TYPE(fnode), POINTER :: child_node
+  IMPLICIT NONE  
+    TYPE(fnode), POINTER         :: node
+    
+    TYPE(fnode), POINTER     :: child_node
     TYPE(fnodeList), POINTER :: child_list
-
-    INTEGER :: il
-    CHARACTER(len=100) :: node_name
-
-    IF (hasChildNodes(root)) THEN
-      child_list => getChildnodes(root)
+    TYPE(axis),POINTER       :: attribute
+    LOGICAL                  :: is_root
+    INTEGER :: il
+    CHARACTER(len=100) :: node_name
+    CHARACTER(len=100) :: value
+    
+    IF (is_attribute_exist(node,"id")) THEN
+      value=getAttribute(node,"id")
+      CALL context__create(TRIM(value))  
+      CALL context__swap(TRIM(value))
+    ENDIF
+    
+    IF (hasChildNodes(node)) THEN
+      child_list => getChildnodes(node)
+
       DO il=0,getLength(child_list)-1
         child_node => item(child_list,il)
         node_name=getNodename(child_node)
-          
+        
         SELECT CASE (TRIM(node_name)) 
           
@@ -89,19 +130,15 @@
            CASE DEFAULT
              IF (is_bad_node(node_name)) THEN
-               WRITE(message,*) 'Unknown node <<',TRIM(node_name),'>> while parsing definition'
-               CALL Warning("mod_parse_xml:parsing_definition")
+               WRITE(message,*) 'Unknown node <<',TRIM(node_name),'>> while parsing context'
+               CALL Warning("mod_parse_xml:parsing_context")
              ENDIF   
-         END SELECT
-       
-       ENDDO
-    ENDIF
-    
-  END SUBROUTINE parsing_definition
- 
-
-
-
-
-  
+        END SELECT
+      ENDDO
+
+    ENDIF
+
+  END SUBROUTINE parsing_context
+
+
   RECURSIVE SUBROUTINE parsing_axis_group(node,parent,root)
   USE mod_axis_definition
@@ -218,4 +255,9 @@
       CALL axis__set(pt_axis,a_size=string_to_integer(value))
     ENDIF
+
+    IF (is_attribute_exist(node,"positive")) THEN
+      value =  getAttribute(node,"positive")
+      CALL axis__set(pt_axis,positive=string_to_logical(value))
+    ENDIF
    
   END SUBROUTINE parsing_axis_attribute 
@@ -296,6 +338,7 @@
     TYPE(grid_group),POINTER :: parent
     
-    TYPE(grid),POINTER :: pt_grid
-    TYPE(grid),POINTER       :: attribute
+    TYPE(grid),POINTER       :: pt_grid
+    TYPE(fnode), POINTER     :: child_node
+    TYPE(fnodeList), POINTER :: child_list
     INTEGER :: il
     CHARACTER(len=100) :: node_name
@@ -311,8 +354,29 @@
       
     CALL parsing_grid_attribute(node,pt_grid)
+    
+
+   IF (hasChildNodes(node)) THEN
+      child_list => getChildnodes(node)
+
+      DO il=0,getLength(child_list)-1
+        child_node => item(child_list,il)
+        node_name=getNodename(child_node)
+        
+        SELECT CASE (TRIM(node_name)) 
+        
+          CASE ('zoom') 
+            CALL parsing_zoom(child_node,pt_grid)
+             
+          CASE DEFAULT
+            IF (is_bad_node(node_name)) THEN
+              WRITE(message,*) 'Unknown node <<',TRIM(node_name),'>> while parsing grid'
+              CALL Warning("mod_parse_xml:parsing_grid")
+            ENDIF
+        END SELECT
+      ENDDO
+    ENDIF
   
   END SUBROUTINE parsing_grid
 
-  
   SUBROUTINE parsing_grid_attribute(node,pt_grid)
   USE mod_grid
@@ -335,7 +399,68 @@
   END SUBROUTINE parsing_grid_attribute 
 
-
-
-
+  SUBROUTINE parsing_zoom(node,parent)
+  USE mod_zoom
+  USE mod_grid 
+  IMPLICIT NONE  
+    TYPE(fnode), POINTER     :: node
+    TYPE(grid),POINTER       :: parent
+    
+    TYPE(zoom),POINTER       :: pt_zoom
+    INTEGER :: il
+    CHARACTER(len=100) :: node_name
+    CHARACTER(len=100) :: value
+  
+      
+    IF (is_attribute_exist(node,"id")) THEN
+      value=getAttribute(node,"id")
+      CALL grid__get_new_zoom(parent,pt_zoom,TRIM(value))
+    ELSE
+      CALL grid__get_new_zoom(parent,pt_zoom)
+    ENDIF
+      
+    CALL parsing_zoom_attribute(node,pt_zoom)
+    
+  END SUBROUTINE parsing_zoom
+
+
+  SUBROUTINE parsing_zoom_attribute(node,pt_zoom)
+  USE mod_zoom
+  IMPLICIT NONE
+    TYPE(fnode), POINTER     :: node
+    TYPE(zoom),POINTER       :: pt_zoom
+
+    CHARACTER(len=100) :: value
+   
+    IF (is_attribute_exist(node,"name")) THEN
+      value =  getAttribute(node,"name")
+      CALL zoom__set(pt_zoom,name=TRIM(value))
+    ENDIF
+
+    IF (is_attribute_exist(node,"description")) THEN
+      value =  getAttribute(node,"description")
+      CALL zoom__set(pt_zoom,description=TRIM(value))
+    ENDIF
+
+    IF (is_attribute_exist(node,"ni")) THEN
+      value =  getAttribute(node,"ni")
+      CALL zoom__set(pt_zoom,ni_glo=string_to_integer(value))
+    ENDIF
+
+    IF (is_attribute_exist(node,"nj")) THEN
+      value =  getAttribute(node,"nj")
+      CALL zoom__set(pt_zoom,nj_glo=string_to_integer(value))
+    ENDIF
+
+    IF (is_attribute_exist(node,"ibegin")) THEN
+      value =  getAttribute(node,"ibegin")
+      CALL zoom__set(pt_zoom,ibegin_glo=string_to_integer(value))
+    ENDIF
+
+    IF (is_attribute_exist(node,"jbegin")) THEN
+      value =  getAttribute(node,"jbegin")
+      CALL zoom__set(pt_zoom,jbegin_glo=string_to_integer(value))
+    ENDIF
+        
+  END SUBROUTINE parsing_zoom_attribute 
 
 
@@ -471,4 +596,9 @@
     ENDIF
 
+    IF (is_attribute_exist(node,"zoom_ref")) THEN
+      value =  getAttribute(node,"zoom_ref")
+      CALL field__set(pt_field,zoom_ref=TRIM(value))
+    ENDIF
+
     IF (is_attribute_exist(node,"level")) THEN
       value =  getAttribute(node,"level")
@@ -493,7 +623,4 @@
 
   END SUBROUTINE parsing_field_attribute 
-  
-  
-  
 
 
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_time_parameters.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_time_parameters.f90	(revision 30)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_time_parameters.f90	(revision 30)
@@ -0,0 +1,26 @@
+MODULE mod_time_parameters
+
+  INTEGER,POINTER  :: initial_timestep
+  REAL,POINTER     :: initial_date
+  REAL,POINTER     :: timestep_value 
+  INTEGER,POINTER  :: timestep_number
+
+CONTAINS 
+
+  SUBROUTINE time_parameters__swap_context(saved_initial_timestep,saved_initial_date, &
+                                           saved_timestep_value,saved_timestep_number)
+  IMPLICIT NONE
+    INTEGER,POINTER  :: saved_initial_timestep
+    REAL,POINTER     :: saved_initial_date
+    REAL,POINTER     :: saved_timestep_value 
+    INTEGER,POINTER  :: saved_timestep_number
+   
+    initial_timestep => saved_initial_timestep
+    initial_date     => saved_initial_date
+    timestep_value   => saved_timestep_value 
+    timestep_number  => saved_timestep_number    
+    
+  END SUBROUTINE time_parameters__swap_context  
+    
+                                           
+END MODULE mod_time_parameters
Index: /XMLIO_SERVER/trunk/src/XMLIO/mod_zoom.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/mod_zoom.f90	(revision 30)
+++ /XMLIO_SERVER/trunk/src/XMLIO/mod_zoom.f90	(revision 30)
@@ -0,0 +1,141 @@
+MODULE mod_zoom
+  USE mod_xmlio_parameters
+  USE mod_sorted_list
+
+  IMPLICIT NONE
+
+  TYPE,PUBLIC :: zoom
+    CHARACTER(len=str_len)      :: id
+    LOGICAL                     :: has_id
+    CHARACTER(len=str_len)      :: name
+    LOGICAL                     :: has_name
+    CHARACTER(len=str_len)      :: description
+    LOGICAL                     :: has_description
+    INTEGER                     :: ni_glo
+    LOGICAL                     :: has_ni_glo
+    INTEGER                     :: nj_glo
+    LOGICAL                     :: has_nj_glo
+    INTEGER                     :: ibegin_glo
+    LOGICAL                     :: has_ibegin_glo
+    INTEGER                     :: jbegin_glo
+    LOGICAL                     :: has_jbegin_glo
+    INTEGER                     :: ni_loc
+    INTEGER                     :: nj_loc
+    INTEGER                     :: ibegin_loc
+    INTEGER                     :: jbegin_loc
+  END TYPE zoom    
+
+  INCLUDE 'vector_zoom_def.inc'
+
+  TYPE(vector_zoom),POINTER,SAVE             :: zoom_Ids
+  TYPE(sorted_list),POINTER,SAVE,PRIVATE     :: Ids 
+  
+CONTAINS
+  
+  INCLUDE 'vector_zoom_contains.inc'
+
+  SUBROUTINE zoom__swap_context(saved_zoom_Ids,saved_Ids)
+  IMPLICIT NONE
+    TYPE(vector_zoom),POINTER          :: saved_zoom_Ids
+    TYPE(sorted_list),POINTER          :: saved_Ids 
+    
+    zoom_ids=>saved_zoom_ids
+    ids=>saved_ids
+  END SUBROUTINE zoom__swap_context
+
+
+  SUBROUTINE zoom__init
+  IMPLICIT NONE
+
+    CALL vector_zoom__new(zoom_Ids)
+    CALL sorted_list__new(Ids)
+    
+  END SUBROUTINE zoom__init
+  
+
+  SUBROUTINE zoom__new(pt_zoom,Id)
+  USE string_function
+  IMPLICIT NONE
+    TYPE(zoom),POINTER :: pt_zoom
+    CHARACTER(LEN=*),OPTIONAL     :: Id
+    INTEGER   :: Pos 
+      
+    pt_zoom%has_id=.FALSE.
+    pt_zoom%has_name=.FALSE.
+    pt_zoom%has_description=.FALSE.
+    pt_zoom%has_ni_glo=.FALSE.
+    pt_zoom%has_nj_glo=.FALSE.
+    pt_zoom%has_ibegin_glo=.FALSE.
+    pt_zoom%has_jbegin_glo=.FALSE.
+     
+    IF (PRESENT(Id)) THEN
+      Pt_zoom%id=TRIM(ADJUSTL(Id))
+      Pt_zoom%has_id=.TRUE.
+     CALL vector_zoom__set_new(zoom_Ids,Pt_zoom,Pos)
+     CALL sorted_list__Add(Ids,hash(id),Pos)
+    ENDIF
+   
+  END SUBROUTINE zoom__new
+   
+  SUBROUTINE zoom__set(pt_zoom,name,description,ni_glo,nj_glo,ibegin_glo,jbegin_glo)
+  IMPLICIT NONE
+    TYPE(zoom),POINTER                   :: pt_zoom
+    CHARACTER(len=*),OPTIONAL            :: name
+    CHARACTER(len=*),OPTIONAL            :: description
+    INTEGER,OPTIONAL                     :: ni_glo
+    INTEGER,OPTIONAL                     :: nj_glo
+    INTEGER,OPTIONAL                     :: ibegin_glo
+    INTEGER,OPTIONAL                     :: jbegin_glo
+    
+    IF (PRESENT(name)) THEN
+      pt_zoom%name=TRIM(ADJUSTL(name))
+      pt_zoom%has_name=.TRUE.
+    ENDIF
+    
+    IF (PRESENT(description)) THEN
+      pt_zoom%name=TRIM(ADJUSTL(description))
+      pt_zoom%has_description=.TRUE.
+    ENDIF
+    
+    IF (PRESENT(ni_glo)) THEN
+      pt_zoom%ni_glo=ni_glo
+      pt_zoom%has_ni_glo=.TRUE.
+    ENDIF
+
+    IF (PRESENT(nj_glo)) THEN
+      pt_zoom%nj_glo=nj_glo
+      pt_zoom%has_nj_glo=.TRUE.
+    ENDIF
+
+    IF (PRESENT(ibegin_glo)) THEN
+      pt_zoom%ibegin_glo=ibegin_glo
+      pt_zoom%has_ibegin_glo=.TRUE.
+    ENDIF
+    
+    IF (PRESENT(jbegin_glo)) THEN
+      pt_zoom%jbegin_glo=jbegin_glo
+      pt_zoom%has_ibegin_glo=.TRUE.
+    ENDIF
+               
+   END SUBROUTINE zoom__set   
+
+
+  SUBROUTINE zoom__get(Id,pt_zoom)
+  USE string_function
+  IMPLICIT NONE
+    CHARACTER(LEN=*),INTENT(IN)     :: Id
+    TYPE(zoom),POINTER              :: Pt_zoom
+
+    INTEGER                         :: Pos
+    LOGICAL                         :: success
+    
+    CALL sorted_list__find(Ids,hash(Id),Pos,success)
+    IF (success) THEN
+      Pt_zoom=>zoom_ids%at(Pos)%Pt
+    ELSE
+      Pt_zoom=>NULL()
+    ENDIF
+    
+  END SUBROUTINE zoom__get
+
+END MODULE mod_zoom
Index: /XMLIO_SERVER/trunk/src/XMLIO/vector_context_contains.inc
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/vector_context_contains.inc	(revision 30)
+++ /XMLIO_SERVER/trunk/src/XMLIO/vector_context_contains.inc	(revision 30)
@@ -0,0 +1,89 @@
+
+  SUBROUTINE vector_context__new(vect,vect_size)
+  use mod_xmlio_parameters
+  IMPLICIT NONE
+    TYPE(vector_context), INTENT(INOUT) :: vect
+    INTEGER, OPTIONAL, INTENT(IN) :: vect_size
+     
+    IF (ASSOCIATED(vect%at)) CALL vector_context__delete(vect)
+    
+    IF (PRESENT(vect_size)) THEN 
+      vect%size_max=MAX(1,vect_size)
+    ELSE
+      vect%size_max=default_vector_size
+    ENDIF
+    
+    ALLOCATE(vect%at(vect%size_max))
+    
+    vect%size=0
+    vect%grow_factor=default_vector_grow_factor
+    
+  END SUBROUTINE vector_context__new
+  
+  SUBROUTINE vector_context__delete(vect)
+  IMPLICIT NONE
+    TYPE(vector_context), INTENT(IN OUT) :: vect
+    
+    INTEGER                             :: i
+    
+    DO i=1,vect%size
+      IF (vect%at(i)%owned) DEALLOCATE(vect%at(i)%Pt)
+! doit-on avoir une subroutine du genre : CALL context__delete() ???
+    ENDDO 
+    
+    IF (ASSOCIATED(vect%at)) DEALLOCATE(vect%at)
+    vect%size_max=0
+    
+  END SUBROUTINE vector_context__delete
+  
+  SUBROUTINE vector_context__get_new(vect,pt_value,pos)
+  IMPLICIT NONE
+  
+    TYPE(vector_context), INTENT(INOUT)   :: vect
+    TYPE(context),POINTER                 :: pt_value
+    INTEGER,OPTIONAL,INTENT(OUT)         :: Pos
+    
+    IF (vect%size==vect%size_max) CALL vector_context__increase(vect)
+    
+    vect%size=vect%size+1
+    ALLOCATE(vect%at(vect%size)%pt)
+    vect%at(vect%size)%owned=.TRUE.
+    pt_value=>vect%at(vect%size)%pt
+    IF (PRESENT(pos)) pos=vect%size
+    
+  END SUBROUTINE vector_context__get_new
+
+  SUBROUTINE vector_context__set_new(vect,pt_value,pos)
+  IMPLICIT NONE
+  
+    TYPE(vector_context), INTENT(INOUT)   :: vect
+    TYPE(context),POINTER                 :: pt_value
+    INTEGER,OPTIONAL,INTENT(OUT)         :: Pos
+    
+    IF (vect%size==vect%size_max) CALL vector_context__increase(vect)
+    
+    vect%size=vect%size+1
+    vect%at(vect%size)%pt=>pt_value
+    vect%at(vect%size)%owned=.FALSE.
+    IF (PRESENT(pos)) pos=vect%size
+    
+  END SUBROUTINE vector_context__set_new
+  
+  SUBROUTINE vector_context__increase(vect)
+    TYPE(vector_context), INTENT(INOUT) :: vect
+    TYPE (Pt_context__), POINTER, DIMENSION(:) :: Pt_tmp
+    INTEGER :: new_size
+    INTEGER :: i
+    
+    vect%size_max=MAX(vect%size_max+1,INT(vect%size_max*vect%grow_factor))
+    ALLOCATE(Pt_tmp(vect%size_max))
+    
+    DO i=1,vect%size
+     Pt_tmp(i)%pt=>vect%at(i)%pt
+    ENDDO
+    
+    DEALLOCATE(vect%at)
+    vect%at=>Pt_tmp
+    
+  END SUBROUTINE vector_context__increase 
+    
Index: /XMLIO_SERVER/trunk/src/XMLIO/vector_context_def.inc
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/vector_context_def.inc	(revision 30)
+++ /XMLIO_SERVER/trunk/src/XMLIO/vector_context_def.inc	(revision 30)
@@ -0,0 +1,17 @@
+
+  TYPE Pt_context__ 
+    TYPE (context),POINTER :: Pt
+    LOGICAL               :: owned
+  END TYPE Pt_context__
+
+  TYPE vector_context
+  
+    TYPE (Pt_context__), POINTER, DIMENSION(:) :: at => NULL()
+    INTEGER :: size
+    
+    INTEGER :: size_max
+    REAL    :: grow_factor
+    INTEGER :: chunk
+  
+  END TYPE vector_context
+  
Index: /XMLIO_SERVER/trunk/src/XMLIO/vector_zoom_contains.inc
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/vector_zoom_contains.inc	(revision 30)
+++ /XMLIO_SERVER/trunk/src/XMLIO/vector_zoom_contains.inc	(revision 30)
@@ -0,0 +1,89 @@
+
+  SUBROUTINE vector_zoom__new(vect,vect_size)
+  use mod_xmlio_parameters
+  IMPLICIT NONE
+    TYPE(vector_zoom), INTENT(INOUT) :: vect
+    INTEGER, OPTIONAL, INTENT(IN) :: vect_size
+     
+    IF (ASSOCIATED(vect%at)) CALL vector_zoom__delete(vect)
+    
+    IF (PRESENT(vect_size)) THEN 
+      vect%size_max=MAX(1,vect_size)
+    ELSE
+      vect%size_max=default_vector_size
+    ENDIF
+    
+    ALLOCATE(vect%at(vect%size_max))
+    
+    vect%size=0
+    vect%grow_factor=default_vector_grow_factor
+    
+  END SUBROUTINE vector_zoom__new
+  
+  SUBROUTINE vector_zoom__delete(vect)
+  IMPLICIT NONE
+    TYPE(vector_zoom), INTENT(IN OUT) :: vect
+    
+    INTEGER                             :: i
+    
+    DO i=1,vect%size
+      IF (vect%at(i)%owned) DEALLOCATE(vect%at(i)%Pt)
+! doit-on avoir une subroutine du genre : CALL zoom__delete() ???
+    ENDDO 
+    
+    IF (ASSOCIATED(vect%at)) DEALLOCATE(vect%at)
+    vect%size_max=0
+    
+  END SUBROUTINE vector_zoom__delete
+  
+  SUBROUTINE vector_zoom__get_new(vect,pt_value,pos)
+  IMPLICIT NONE
+  
+    TYPE(vector_zoom), INTENT(INOUT)   :: vect
+    TYPE(zoom),POINTER                 :: pt_value
+    INTEGER,OPTIONAL,INTENT(OUT)         :: Pos
+    
+    IF (vect%size==vect%size_max) CALL vector_zoom__increase(vect)
+    
+    vect%size=vect%size+1
+    ALLOCATE(vect%at(vect%size)%pt)
+    vect%at(vect%size)%owned=.TRUE.
+    pt_value=>vect%at(vect%size)%pt
+    IF (PRESENT(pos)) pos=vect%size
+    
+  END SUBROUTINE vector_zoom__get_new
+
+  SUBROUTINE vector_zoom__set_new(vect,pt_value,pos)
+  IMPLICIT NONE
+  
+    TYPE(vector_zoom), INTENT(INOUT)   :: vect
+    TYPE(zoom),POINTER                 :: pt_value
+    INTEGER,OPTIONAL,INTENT(OUT)         :: Pos
+    
+    IF (vect%size==vect%size_max) CALL vector_zoom__increase(vect)
+    
+    vect%size=vect%size+1
+    vect%at(vect%size)%pt=>pt_value
+    vect%at(vect%size)%owned=.FALSE.
+    IF (PRESENT(pos)) pos=vect%size
+    
+  END SUBROUTINE vector_zoom__set_new
+  
+  SUBROUTINE vector_zoom__increase(vect)
+    TYPE(vector_zoom), INTENT(INOUT) :: vect
+    TYPE (Pt_zoom__), POINTER, DIMENSION(:) :: Pt_tmp
+    INTEGER :: new_size
+    INTEGER :: i
+    
+    vect%size_max=MAX(vect%size_max+1,INT(vect%size_max*vect%grow_factor))
+    ALLOCATE(Pt_tmp(vect%size_max))
+    
+    DO i=1,vect%size
+     Pt_tmp(i)%pt=>vect%at(i)%pt
+    ENDDO
+    
+    DEALLOCATE(vect%at)
+    vect%at=>Pt_tmp
+    
+  END SUBROUTINE vector_zoom__increase 
+    
Index: /XMLIO_SERVER/trunk/src/XMLIO/vector_zoom_def.inc
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/vector_zoom_def.inc	(revision 30)
+++ /XMLIO_SERVER/trunk/src/XMLIO/vector_zoom_def.inc	(revision 30)
@@ -0,0 +1,17 @@
+
+  TYPE Pt_zoom__ 
+    TYPE (zoom),POINTER :: Pt
+    LOGICAL               :: owned
+  END TYPE Pt_zoom__
+
+  TYPE vector_zoom
+  
+    TYPE (Pt_zoom__), POINTER, DIMENSION(:) :: at => NULL()
+    INTEGER :: size
+    
+    INTEGER :: size_max
+    REAL    :: grow_factor
+    INTEGER :: chunk
+  
+  END TYPE vector_zoom
+  
Index: /XMLIO_SERVER/trunk/src/XMLIO/xmlio.f90
===================================================================
--- /XMLIO_SERVER/trunk/src/XMLIO/xmlio.f90	(revision 20)
+++ /XMLIO_SERVER/trunk/src/XMLIO/xmlio.f90	(revision 30)
@@ -16,4 +16,6 @@
   USE string_function
   USE error_msg
+  USE mod_context
+  USE mod_time_parameters
   
 CONTAINS
@@ -24,23 +26,9 @@
     CHARACTER(LEN=*),INTENT(IN) :: xml_file
     
-    CALL field__init
-    CALL field_group__Init
-    CALL field_definition__Init
-
-    CALL axis__init
-    CALL axis_group__Init
-    CALL axis_definition__Init
-
-    CALL grid__init
-    CALL grid_group__Init
-    CALL grid_definition__Init
-
-    CALL file__init
-    CALL file_group__Init
-    CALL file_definition__Init
-    
+    CALL context__init
     CALL parsing_xml_file(xml_file)
     
   END SUBROUTINE xmlio__init
+  
   
   SUBROUTINE xmlio__close_definition
