Index: LMDZ5/trunk/libf/phylmd/iophy.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/iophy.F90	(revision 2097)
+++ LMDZ5/trunk/libf/phylmd/iophy.F90	(revision 2114)
@@ -204,4 +204,5 @@
   IMPLICIT NONE
   include 'dimensions.h'
+  include 'clesphys.h'
     
     character*(*), INTENT(IN) :: name
@@ -227,5 +228,7 @@
     IF((.NOT. is_using_mpi) .OR. is_mpi_root) THEN
         ! ug Création du fichier
+      IF (.not. ok_all_xml) THEN
         CALL wxios_add_file(name, ffreq, lev)
+      ENDIF
     END IF
 #endif
@@ -603,10 +606,12 @@
 
 #ifdef CPP_XIOS
-      IF ( var%flag(iff)<=lev_files(iff) ) THEN
-        CALL wxios_add_field_to_file(var%name, 2, iff, phys_out_filenames(iff), &
-        var%description, var%unit, var%flag(iff), typeecrit)
-        IF (prt_level >= 10) THEN
-          WRITE(lunout,*) 'histdef2d: call wxios_add_field_to_file var%name iff: ', &
-                          trim(var%name),iff
+      IF (.not. ok_all_xml) THEN
+        IF ( var%flag(iff)<=lev_files(iff) ) THEN
+          CALL wxios_add_field_to_file(var%name, 2, iff, phys_out_filenames(iff), &
+          var%description, var%unit, var%flag(iff), typeecrit)
+          IF (prt_level >= 10) THEN
+            WRITE(lunout,*) 'histdef2d: call wxios_add_field_to_file var%name iff: ', &
+                            trim(var%name),iff
+          ENDIF
         ENDIF
       ENDIF
@@ -688,12 +693,14 @@
 
 #ifdef CPP_XIOS
-      IF ( var%flag(iff)<=lev_files(iff) ) THEN
-        CALL wxios_add_field_to_file(var%name, 3, iff, phys_out_filenames(iff), &
-        var%description, var%unit, var%flag(iff), typeecrit)
-        IF (prt_level >= 10) THEN
-          WRITE(lunout,*) 'histdef3d: call wxios_add_field_to_file var%name iff: ', &
-                          trim(var%name),iff
-        ENDIF
-      ENDIF
+       IF (.not. ok_all_xml) THEN
+         IF ( var%flag(iff)<=lev_files(iff) ) THEN
+         CALL wxios_add_field_to_file(var%name, 3, iff, phys_out_filenames(iff), &
+         var%description, var%unit, var%flag(iff), typeecrit)
+           IF (prt_level >= 10) THEN
+             WRITE(lunout,*) 'histdef3d: call wxios_add_field_to_file var%name iff: ', &
+                             trim(var%name),iff
+           ENDIF
+         ENDIF
+       ENDIF
 #endif
 #ifndef CPP_IOIPSL_NO_OUTPUT 
@@ -890,4 +897,5 @@
   INCLUDE 'dimensions.h'
   INCLUDE 'iniprint.h'
+  include 'clesphys.h'
 
     TYPE(ctrl_out), INTENT(IN) :: var
@@ -922,4 +930,9 @@
 !$OMP MASTER
       !Si phase de définition.... on définit
+      IF (.not. ok_all_xml) THEN
+      if (prt_level >= 10) then
+      write(lunout,*)"histwrite2d_phy: .not.vars_defined ; time to define ", &
+                     trim(var%name)
+      endif
       DO iff=iff_beg, iff_end
          IF (clef_files(iff)) THEN
@@ -927,4 +940,5 @@
          ENDIF
       ENDDO
+      ENDIF
 !$OMP END MASTER
   ELSE
@@ -944,5 +958,21 @@
 ! La boucle sur les fichiers:
       firstx=.true.
-      DO iff=iff_beg, iff_end
+
+      IF (ok_all_xml) THEN
+#ifdef CPP_XIOS
+          if (prt_level >= 10) then
+             write(lunout,*)'Dans iophy histwrite2D,var%name ',&
+                             trim(var%name)                       
+          endif
+          CALL xios_send_field(var%name, Field2d)
+          if (prt_level >= 10) then
+             write(lunout,*)'Dans iophy histwrite2D,var%name apres xios_send ',&
+                             trim(var%name)                       
+          endif
+#else
+        CALL abort_gcm ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1)
+#endif
+      ELSE  
+        DO iff=iff_beg, iff_end
             IF (var%flag(iff) <= lev_files(iff) .AND. clef_files(iff)) THEN 
 
@@ -1001,5 +1031,6 @@
                 deallocate(fieldok)
             ENDIF !levfiles
-      ENDDO ! of DO iff=iff_beg, iff_end
+        ENDDO ! of DO iff=iff_beg, iff_end
+      ENDIF
 !$OMP END MASTER   
   ENDIF ! vars_defined
@@ -1026,4 +1057,5 @@
   INCLUDE 'dimensions.h'
   INCLUDE 'iniprint.h'
+  include 'clesphys.h'
 
     TYPE(ctrl_out), INTENT(IN) :: var
@@ -1078,4 +1110,18 @@
 ! BOUCLE SUR LES FICHIERS
      firstx=.true.
+
+      IF (ok_all_xml) THEN
+#ifdef CPP_XIOS
+          if (prt_level >= 10) then
+             write(lunout,*)'Dans iophy histwrite3D,var%name ',&
+                             trim(var%name)                       
+          endif
+          CALL xios_send_field(var%name, Field3d)
+#else
+        CALL abort_gcm ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1)
+#endif
+      ELSE  
+
+
      DO iff=iff_beg, iff_end
             IF (var%flag(iff) <= lev_files(iff) .AND. clef_files(iff)) THEN
@@ -1136,4 +1182,5 @@
             ENDIF
       ENDDO
+      ENDIF
 !$OMP END MASTER   
   ENDIF ! vars_defined
