From 89f9a9499ec086a051235fcdf1d34fd3149b9624 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 15 Dec 2016 17:00:30 +0100
Subject: [PATCH] Philippe 15/12/2016: added IO_WRITE_FIELD_BYNAME_L0 and
 IO_WRITE_FIELD_BYFIELD_L0 subroutines to IO_WRITE_FIELD interface

---
 src/LIB/SURCOUCHE/src/fmwrit_ll.f90 | 52 +++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/src/LIB/SURCOUCHE/src/fmwrit_ll.f90 b/src/LIB/SURCOUCHE/src/fmwrit_ll.f90
index 9141ee8c5..da8e13754 100644
--- a/src/LIB/SURCOUCHE/src/fmwrit_ll.f90
+++ b/src/LIB/SURCOUCHE/src/fmwrit_ll.f90
@@ -181,9 +181,11 @@ MODULE MODE_FMWRIT
   INTERFACE IO_WRITE_FIELD
      MODULE PROCEDURE IO_WRITE_FIELD_BYNAME_X2, IO_WRITE_FIELD_BYNAME_X3,  &
                       IO_WRITE_FIELD_BYNAME_N0,                            &
+                      IO_WRITE_FIELD_BYNAME_L0,                            &
                       IO_WRITE_FIELD_BYNAME_C0,                            &
                       IO_WRITE_FIELD_BYFIELD_X2,IO_WRITE_FIELD_BYFIELD_X3, &
                       IO_WRITE_FIELD_BYFIELD_N0,                           &
+                      IO_WRITE_FIELD_BYFIELD_L0,                           &
                       IO_WRITE_FIELD_BYFIELD_C0
   END INTERFACE
 
@@ -2236,6 +2238,56 @@ CONTAINS
     KRESP = IRESP
   END SUBROUTINE FMWRITL0_ll
 
+  SUBROUTINE IO_WRITE_FIELD_BYNAME_L0(TPFILE,HNAME,HFIPRI,KRESP,OFIELD)
+    !
+    USE MODD_IO_ll, ONLY : TFILEDATA
+    !
+    !*      0.1   Declarations of arguments
+    !
+    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    CHARACTER(LEN=*),            INTENT(IN) :: HNAME    ! name of the field to write
+    CHARACTER(LEN=*),            INTENT(IN) :: HFIPRI   ! output file for error messages
+    INTEGER,                     INTENT(OUT):: KRESP    ! return-code 
+    LOGICAL,                     INTENT(IN) :: OFIELD   ! array containing the data field
+    !
+    !*      0.2   Declarations of local variables
+    !
+    INTEGER :: ID ! Index of the field
+    !
+    CALL FIND_FIELD_ID_FROM_MNHNAME(HNAME,ID,KRESP)
+    !
+    IF(KRESP==0) CALL IO_WRITE_FIELD(TPFILE,TFIELDLIST(ID),HFIPRI,KRESP,OFIELD)
+    !
+  END SUBROUTINE IO_WRITE_FIELD_BYNAME_L0
+
+  SUBROUTINE IO_WRITE_FIELD_BYFIELD_L0(TPFILE,TPFIELD,HFIPRI,KRESP,OFIELD)
+    USE MODD_IO_ll
+    !*      0.    DECLARATIONS
+    !             ------------
+    !
+    !
+    !*      0.1   Declarations of arguments
+    !
+    TYPE(TFILEDATA),             INTENT(IN) :: TPFILE
+    TYPE(TFIELDDATA),            INTENT(IN) :: TPFIELD
+    CHARACTER(LEN=*),            INTENT(IN) :: HFIPRI   ! output file for error messages
+    INTEGER,                     INTENT(OUT):: KRESP    ! return-code 
+    LOGICAL,                     INTENT(IN) :: OFIELD   ! array containing the data field
+    !
+    !*      0.2   Declarations of local variables
+    !
+    INTEGER :: IFIELD
+    !
+    IF (OFIELD) THEN
+      IFIELD = 1
+    ELSE
+      IFIELD = 0
+    END IF
+    !
+    CALL IO_WRITE_FIELD(TPFILE,TPFIELD,HFIPRI,KRESP,IFIELD)
+    !
+  END SUBROUTINE IO_WRITE_FIELD_BYFIELD_L0
+
   SUBROUTINE FMWRITL1_ll(HFILEM,HRECFM,HFIPRI,HDIR,OFIELD,KGRID,&
        KLENCH,HCOMMENT,KRESP)
     USE MODD_IO_ll, ONLY : ISP,GSMONOPROC,LIOCDF4,LLFIOUT
-- 
GitLab