Changeset 798


Ignore:
Timestamp:
11/27/15 09:55:05 (5 years ago)
Author:
rlacroix
Message:

Append mode

Location:
XIOS/branchs/xios-1.0/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/config/file_attribute.conf

    r692 r798  
    1414DECLARE_ATTRIBUTE(StdString,      par_access) 
    1515DECLARE_ENUM4(time_counter, centered, instant, record, none) 
     16DECLARE_ATTRIBUTE(bool,      append) 
    1617 
    1718DECLARE_ATTRIBUTE(int,       compression_level) 
  • XIOS/branchs/xios-1.0/src/data_output.hpp

    r501 r798  
    3232            virtual void definition_end(void)   = 0; 
    3333 
     34            //!< Test if the file was opened in append mode 
     35            virtual bool IsInAppendMode() const { return appendMode; }; 
     36 
    3437            virtual ~CDataOutput(void); 
    3538 
     
    5659            /// Propriétés protégées /// 
    5760            EDataOutputType type; 
     61            bool appendMode; //!< If true, we are appending data to an existing file 
    5862 
    5963      }; // class CDataOutput 
  • XIOS/branchs/xios-1.0/src/interface/c_attr/icfile_attr.cpp

    r703 r798  
    1717  typedef xios::CFile*  file_Ptr; 
    1818   
     19  void cxios_set_file_append(file_Ptr file_hdl, bool append) 
     20  { 
     21     CTimer::get("XIOS").resume(); 
     22    file_hdl->append.setValue(append); 
     23    file_hdl->sendAttributToServer(file_hdl->append); 
     24     CTimer::get("XIOS").suspend(); 
     25  } 
     26   
     27  void cxios_get_file_append(file_Ptr file_hdl, bool* append) 
     28  { 
     29    *append = file_hdl->append.getInheritedValue(); 
     30  } 
     31   
     32  bool cxios_is_defined_file_append(file_Ptr file_hdl ) 
     33  { 
     34    CTimer::get("XIOS").resume(); 
     35    bool isDefined = file_hdl->append.hasInheritedValue(); 
     36    CTimer::get("XIOS").suspend(); 
     37    return isDefined; 
     38  } 
     39   
     40   
     41   
    1942  void cxios_set_file_compression_level(file_Ptr file_hdl, int compression_level) 
    2043  { 
  • XIOS/branchs/xios-1.0/src/interface/c_attr/icfilegroup_attr.cpp

    r703 r798  
    1717  typedef xios::CFileGroup*  filegroup_Ptr; 
    1818   
     19  void cxios_set_filegroup_append(filegroup_Ptr filegroup_hdl, bool append) 
     20  { 
     21     CTimer::get("XIOS").resume(); 
     22    filegroup_hdl->append.setValue(append); 
     23    filegroup_hdl->sendAttributToServer(filegroup_hdl->append); 
     24     CTimer::get("XIOS").suspend(); 
     25  } 
     26   
     27  void cxios_get_filegroup_append(filegroup_Ptr filegroup_hdl, bool* append) 
     28  { 
     29    *append = filegroup_hdl->append.getInheritedValue(); 
     30  } 
     31   
     32  bool cxios_is_defined_filegroup_append(filegroup_Ptr filegroup_hdl ) 
     33  { 
     34    CTimer::get("XIOS").resume(); 
     35    bool isDefined = filegroup_hdl->append.hasInheritedValue(); 
     36    CTimer::get("XIOS").suspend(); 
     37    return isDefined; 
     38  } 
     39   
     40   
     41   
    1942  void cxios_set_filegroup_compression_level(filegroup_Ptr filegroup_hdl, int compression_level) 
    2043  { 
  • XIOS/branchs/xios-1.0/src/interface/fortran_attr/file_interface_attr.f90

    r703 r798  
    99     
    1010     
     11    SUBROUTINE cxios_set_file_append(file_hdl, append) BIND(C) 
     12      USE ISO_C_BINDING 
     13      INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 
     14      LOGICAL (KIND=C_BOOL)      , VALUE :: append 
     15    END SUBROUTINE cxios_set_file_append 
     16     
     17    SUBROUTINE cxios_get_file_append(file_hdl, append) BIND(C) 
     18      USE ISO_C_BINDING 
     19      INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 
     20      LOGICAL (KIND=C_BOOL)             :: append 
     21    END SUBROUTINE cxios_get_file_append 
     22     
     23    FUNCTION cxios_is_defined_file_append(file_hdl ) BIND(C) 
     24      USE ISO_C_BINDING 
     25      LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_append 
     26      INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 
     27    END FUNCTION cxios_is_defined_file_append 
     28     
     29     
    1130    SUBROUTINE cxios_set_file_compression_level(file_hdl, compression_level) BIND(C) 
    1231      USE ISO_C_BINDING 
  • XIOS/branchs/xios-1.0/src/interface/fortran_attr/filegroup_interface_attr.f90

    r703 r798  
    99     
    1010     
     11    SUBROUTINE cxios_set_filegroup_append(filegroup_hdl, append) BIND(C) 
     12      USE ISO_C_BINDING 
     13      INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 
     14      LOGICAL (KIND=C_BOOL)      , VALUE :: append 
     15    END SUBROUTINE cxios_set_filegroup_append 
     16     
     17    SUBROUTINE cxios_get_filegroup_append(filegroup_hdl, append) BIND(C) 
     18      USE ISO_C_BINDING 
     19      INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 
     20      LOGICAL (KIND=C_BOOL)             :: append 
     21    END SUBROUTINE cxios_get_filegroup_append 
     22     
     23    FUNCTION cxios_is_defined_filegroup_append(filegroup_hdl ) BIND(C) 
     24      USE ISO_C_BINDING 
     25      LOGICAL(kind=C_BOOL) :: cxios_is_defined_filegroup_append 
     26      INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 
     27    END FUNCTION cxios_is_defined_filegroup_append 
     28     
     29     
    1130    SUBROUTINE cxios_set_filegroup_compression_level(filegroup_hdl, compression_level) BIND(C) 
    1231      USE ISO_C_BINDING 
  • XIOS/branchs/xios-1.0/src/interface/fortran_attr/ifile_attr.F90

    r703 r798  
    1212   
    1313  SUBROUTINE xios(set_file_attr)  & 
    14     ( file_id, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     14    ( file_id, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    1515    , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    1616     
     
    1818      TYPE(txios(file))  :: file_hdl 
    1919      CHARACTER(LEN=*), INTENT(IN) ::file_id 
     20      LOGICAL  , OPTIONAL, INTENT(IN) :: append 
     21      LOGICAL (KIND=C_BOOL) :: append_tmp 
    2022      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    2123      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 
     
    3638      CALL xios(get_file_handle)(file_id,file_hdl) 
    3739      CALL xios(set_file_attr_hdl_)   & 
    38       ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     40      ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    3941      , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    4042     
     
    4244   
    4345  SUBROUTINE xios(set_file_attr_hdl)  & 
    44     ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     46    ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    4547    , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    4648     
    4749    IMPLICIT NONE 
    4850      TYPE(txios(file)) , INTENT(IN) :: file_hdl 
     51      LOGICAL  , OPTIONAL, INTENT(IN) :: append 
     52      LOGICAL (KIND=C_BOOL) :: append_tmp 
    4953      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    5054      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 
     
    6468       
    6569      CALL xios(set_file_attr_hdl_)  & 
    66       ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     70      ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    6771      , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    6872     
     
    7074   
    7175  SUBROUTINE xios(set_file_attr_hdl_)   & 
    72     ( file_hdl, compression_level_, description_, enabled_, min_digits_, name_, name_suffix_, output_freq_  & 
    73     , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, time_counter_, type_  & 
    74     ) 
     76    ( file_hdl, append_, compression_level_, description_, enabled_, min_digits_, name_, name_suffix_  & 
     77    , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, time_counter_  & 
     78    , type_ ) 
    7579     
    7680    IMPLICIT NONE 
    7781      TYPE(txios(file)) , INTENT(IN) :: file_hdl 
     82      LOGICAL  , OPTIONAL, INTENT(IN) :: append_ 
     83      LOGICAL (KIND=C_BOOL) :: append__tmp 
    7884      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level_ 
    7985      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description_ 
     
    9298      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ 
    9399       
     100      IF (PRESENT(append_)) THEN 
     101        append__tmp=append_ 
     102        CALL cxios_set_file_append(file_hdl%daddr, append__tmp) 
     103      ENDIF 
     104       
    94105      IF (PRESENT(compression_level_)) THEN 
    95106        CALL cxios_set_file_compression_level(file_hdl%daddr, compression_level_) 
     
    154165   
    155166  SUBROUTINE xios(get_file_attr)  & 
    156     ( file_id, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     167    ( file_id, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    157168    , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    158169     
     
    160171      TYPE(txios(file))  :: file_hdl 
    161172      CHARACTER(LEN=*), INTENT(IN) ::file_id 
     173      LOGICAL  , OPTIONAL, INTENT(OUT) :: append 
     174      LOGICAL (KIND=C_BOOL) :: append_tmp 
    162175      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    163176      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 
     
    178191      CALL xios(get_file_handle)(file_id,file_hdl) 
    179192      CALL xios(get_file_attr_hdl_)   & 
    180       ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     193      ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    181194      , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    182195     
     
    184197   
    185198  SUBROUTINE xios(get_file_attr_hdl)  & 
    186     ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     199    ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    187200    , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    188201     
    189202    IMPLICIT NONE 
    190203      TYPE(txios(file)) , INTENT(IN) :: file_hdl 
     204      LOGICAL  , OPTIONAL, INTENT(OUT) :: append 
     205      LOGICAL (KIND=C_BOOL) :: append_tmp 
    191206      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    192207      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 
     
    206221       
    207222      CALL xios(get_file_attr_hdl_)  & 
    208       ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     223      ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    209224      , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    210225     
     
    212227   
    213228  SUBROUTINE xios(get_file_attr_hdl_)   & 
    214     ( file_hdl, compression_level_, description_, enabled_, min_digits_, name_, name_suffix_, output_freq_  & 
    215     , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, time_counter_, type_  & 
    216     ) 
     229    ( file_hdl, append_, compression_level_, description_, enabled_, min_digits_, name_, name_suffix_  & 
     230    , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, time_counter_  & 
     231    , type_ ) 
    217232     
    218233    IMPLICIT NONE 
    219234      TYPE(txios(file)) , INTENT(IN) :: file_hdl 
     235      LOGICAL  , OPTIONAL, INTENT(OUT) :: append_ 
     236      LOGICAL (KIND=C_BOOL) :: append__tmp 
    220237      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level_ 
    221238      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description_ 
     
    234251      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ 
    235252       
     253      IF (PRESENT(append_)) THEN 
     254        CALL cxios_get_file_append(file_hdl%daddr, append__tmp) 
     255        append_=append__tmp 
     256      ENDIF 
     257       
    236258      IF (PRESENT(compression_level_)) THEN 
    237259        CALL cxios_get_file_compression_level(file_hdl%daddr, compression_level_) 
     
    296318   
    297319  SUBROUTINE xios(is_defined_file_attr)  & 
    298     ( file_id, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     320    ( file_id, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    299321    , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    300322     
     
    302324      TYPE(txios(file))  :: file_hdl 
    303325      CHARACTER(LEN=*), INTENT(IN) ::file_id 
     326      LOGICAL, OPTIONAL, INTENT(OUT) :: append 
     327      LOGICAL(KIND=C_BOOL) :: append_tmp 
    304328      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    305329      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    333357      CALL xios(get_file_handle)(file_id,file_hdl) 
    334358      CALL xios(is_defined_file_attr_hdl_)   & 
    335       ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     359      ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    336360      , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    337361     
     
    339363   
    340364  SUBROUTINE xios(is_defined_file_attr_hdl)  & 
    341     ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     365    ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    342366    , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    343367     
    344368    IMPLICIT NONE 
    345369      TYPE(txios(file)) , INTENT(IN) :: file_hdl 
     370      LOGICAL, OPTIONAL, INTENT(OUT) :: append 
     371      LOGICAL(KIND=C_BOOL) :: append_tmp 
    346372      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    347373      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    374400       
    375401      CALL xios(is_defined_file_attr_hdl_)  & 
    376       ( file_hdl, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
     402      ( file_hdl, append, compression_level, description, enabled, min_digits, name, name_suffix, output_freq  & 
    377403      , output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter, type ) 
    378404     
     
    380406   
    381407  SUBROUTINE xios(is_defined_file_attr_hdl_)   & 
    382     ( file_hdl, compression_level_, description_, enabled_, min_digits_, name_, name_suffix_, output_freq_  & 
    383     , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, time_counter_, type_  & 
    384     ) 
     408    ( file_hdl, append_, compression_level_, description_, enabled_, min_digits_, name_, name_suffix_  & 
     409    , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, time_counter_  & 
     410    , type_ ) 
    385411     
    386412    IMPLICIT NONE 
    387413      TYPE(txios(file)) , INTENT(IN) :: file_hdl 
     414      LOGICAL, OPTIONAL, INTENT(OUT) :: append_ 
     415      LOGICAL(KIND=C_BOOL) :: append__tmp 
    388416      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ 
    389417      LOGICAL(KIND=C_BOOL) :: compression_level__tmp 
     
    415443      LOGICAL(KIND=C_BOOL) :: type__tmp 
    416444       
     445      IF (PRESENT(append_)) THEN 
     446        append__tmp=cxios_is_defined_file_append(file_hdl%daddr) 
     447        append_=append__tmp 
     448      ENDIF 
     449       
    417450      IF (PRESENT(compression_level_)) THEN 
    418451        compression_level__tmp=cxios_is_defined_file_compression_level(file_hdl%daddr) 
  • XIOS/branchs/xios-1.0/src/interface/fortran_attr/ifilegroup_attr.F90

    r703 r798  
    1212   
    1313  SUBROUTINE xios(set_filegroup_attr)  & 
    14     ( filegroup_id, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    15     , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    16     , type ) 
     14    ( filegroup_id, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     15    , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     16    , time_counter, type ) 
    1717     
    1818    IMPLICIT NONE 
    1919      TYPE(txios(filegroup))  :: filegroup_hdl 
    2020      CHARACTER(LEN=*), INTENT(IN) ::filegroup_id 
     21      LOGICAL  , OPTIONAL, INTENT(IN) :: append 
     22      LOGICAL (KIND=C_BOOL) :: append_tmp 
    2123      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    2224      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 
     
    3840      CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 
    3941      CALL xios(set_filegroup_attr_hdl_)   & 
    40       ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    41       , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    42       , type ) 
     42      ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     43      , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     44      , time_counter, type ) 
    4345     
    4446  END SUBROUTINE xios(set_filegroup_attr) 
    4547   
    4648  SUBROUTINE xios(set_filegroup_attr_hdl)  & 
    47     ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    48     , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    49     , type ) 
     49    ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     50    , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     51    , time_counter, type ) 
    5052     
    5153    IMPLICIT NONE 
    5254      TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 
     55      LOGICAL  , OPTIONAL, INTENT(IN) :: append 
     56      LOGICAL (KIND=C_BOOL) :: append_tmp 
    5357      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level 
    5458      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 
     
    6973       
    7074      CALL xios(set_filegroup_attr_hdl_)  & 
    71       ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    72       , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    73       , type ) 
     75      ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     76      , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     77      , time_counter, type ) 
    7478     
    7579  END SUBROUTINE xios(set_filegroup_attr_hdl) 
    7680   
    7781  SUBROUTINE xios(set_filegroup_attr_hdl_)   & 
    78     ( filegroup_hdl, compression_level_, description_, enabled_, group_ref_, min_digits_, name_  & 
    79     , name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_  & 
    80     , time_counter_, type_ ) 
     82    ( filegroup_hdl, append_, compression_level_, description_, enabled_, group_ref_, min_digits_  & 
     83    , name_, name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_  & 
     84    , sync_freq_, time_counter_, type_ ) 
    8185     
    8286    IMPLICIT NONE 
    8387      TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 
     88      LOGICAL  , OPTIONAL, INTENT(IN) :: append_ 
     89      LOGICAL (KIND=C_BOOL) :: append__tmp 
    8490      INTEGER  , OPTIONAL, INTENT(IN) :: compression_level_ 
    8591      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description_ 
     
    99105      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ 
    100106       
     107      IF (PRESENT(append_)) THEN 
     108        append__tmp=append_ 
     109        CALL cxios_set_filegroup_append(filegroup_hdl%daddr, append__tmp) 
     110      ENDIF 
     111       
    101112      IF (PRESENT(compression_level_)) THEN 
    102113        CALL cxios_set_filegroup_compression_level(filegroup_hdl%daddr, compression_level_) 
     
    165176   
    166177  SUBROUTINE xios(get_filegroup_attr)  & 
    167     ( filegroup_id, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    168     , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    169     , type ) 
     178    ( filegroup_id, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     179    , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     180    , time_counter, type ) 
    170181     
    171182    IMPLICIT NONE 
    172183      TYPE(txios(filegroup))  :: filegroup_hdl 
    173184      CHARACTER(LEN=*), INTENT(IN) ::filegroup_id 
     185      LOGICAL  , OPTIONAL, INTENT(OUT) :: append 
     186      LOGICAL (KIND=C_BOOL) :: append_tmp 
    174187      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    175188      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 
     
    191204      CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 
    192205      CALL xios(get_filegroup_attr_hdl_)   & 
    193       ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    194       , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    195       , type ) 
     206      ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     207      , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     208      , time_counter, type ) 
    196209     
    197210  END SUBROUTINE xios(get_filegroup_attr) 
    198211   
    199212  SUBROUTINE xios(get_filegroup_attr_hdl)  & 
    200     ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    201     , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    202     , type ) 
     213    ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     214    , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     215    , time_counter, type ) 
    203216     
    204217    IMPLICIT NONE 
    205218      TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 
     219      LOGICAL  , OPTIONAL, INTENT(OUT) :: append 
     220      LOGICAL (KIND=C_BOOL) :: append_tmp 
    206221      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level 
    207222      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 
     
    222237       
    223238      CALL xios(get_filegroup_attr_hdl_)  & 
    224       ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    225       , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    226       , type ) 
     239      ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     240      , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     241      , time_counter, type ) 
    227242     
    228243  END SUBROUTINE xios(get_filegroup_attr_hdl) 
    229244   
    230245  SUBROUTINE xios(get_filegroup_attr_hdl_)   & 
    231     ( filegroup_hdl, compression_level_, description_, enabled_, group_ref_, min_digits_, name_  & 
    232     , name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_  & 
    233     , time_counter_, type_ ) 
     246    ( filegroup_hdl, append_, compression_level_, description_, enabled_, group_ref_, min_digits_  & 
     247    , name_, name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_  & 
     248    , sync_freq_, time_counter_, type_ ) 
    234249     
    235250    IMPLICIT NONE 
    236251      TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 
     252      LOGICAL  , OPTIONAL, INTENT(OUT) :: append_ 
     253      LOGICAL (KIND=C_BOOL) :: append__tmp 
    237254      INTEGER  , OPTIONAL, INTENT(OUT) :: compression_level_ 
    238255      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description_ 
     
    252269      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ 
    253270       
     271      IF (PRESENT(append_)) THEN 
     272        CALL cxios_get_filegroup_append(filegroup_hdl%daddr, append__tmp) 
     273        append_=append__tmp 
     274      ENDIF 
     275       
    254276      IF (PRESENT(compression_level_)) THEN 
    255277        CALL cxios_get_filegroup_compression_level(filegroup_hdl%daddr, compression_level_) 
     
    318340   
    319341  SUBROUTINE xios(is_defined_filegroup_attr)  & 
    320     ( filegroup_id, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    321     , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    322     , type ) 
     342    ( filegroup_id, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     343    , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     344    , time_counter, type ) 
    323345     
    324346    IMPLICIT NONE 
    325347      TYPE(txios(filegroup))  :: filegroup_hdl 
    326348      CHARACTER(LEN=*), INTENT(IN) ::filegroup_id 
     349      LOGICAL, OPTIONAL, INTENT(OUT) :: append 
     350      LOGICAL(KIND=C_BOOL) :: append_tmp 
    327351      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    328352      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    358382      CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 
    359383      CALL xios(is_defined_filegroup_attr_hdl_)   & 
    360       ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    361       , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    362       , type ) 
     384      ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     385      , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     386      , time_counter, type ) 
    363387     
    364388  END SUBROUTINE xios(is_defined_filegroup_attr) 
    365389   
    366390  SUBROUTINE xios(is_defined_filegroup_attr_hdl)  & 
    367     ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    368     , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    369     , type ) 
     391    ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     392    , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     393    , time_counter, type ) 
    370394     
    371395    IMPLICIT NONE 
    372396      TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 
     397      LOGICAL, OPTIONAL, INTENT(OUT) :: append 
     398      LOGICAL(KIND=C_BOOL) :: append_tmp 
    373399      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level 
    374400      LOGICAL(KIND=C_BOOL) :: compression_level_tmp 
     
    403429       
    404430      CALL xios(is_defined_filegroup_attr_hdl_)  & 
    405       ( filegroup_hdl, compression_level, description, enabled, group_ref, min_digits, name, name_suffix  & 
    406       , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, time_counter  & 
    407       , type ) 
     431      ( filegroup_hdl, append, compression_level, description, enabled, group_ref, min_digits, name  & 
     432      , name_suffix, output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq  & 
     433      , time_counter, type ) 
    408434     
    409435  END SUBROUTINE xios(is_defined_filegroup_attr_hdl) 
    410436   
    411437  SUBROUTINE xios(is_defined_filegroup_attr_hdl_)   & 
    412     ( filegroup_hdl, compression_level_, description_, enabled_, group_ref_, min_digits_, name_  & 
    413     , name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_  & 
    414     , time_counter_, type_ ) 
     438    ( filegroup_hdl, append_, compression_level_, description_, enabled_, group_ref_, min_digits_  & 
     439    , name_, name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_  & 
     440    , sync_freq_, time_counter_, type_ ) 
    415441     
    416442    IMPLICIT NONE 
    417443      TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 
     444      LOGICAL, OPTIONAL, INTENT(OUT) :: append_ 
     445      LOGICAL(KIND=C_BOOL) :: append__tmp 
    418446      LOGICAL, OPTIONAL, INTENT(OUT) :: compression_level_ 
    419447      LOGICAL(KIND=C_BOOL) :: compression_level__tmp 
     
    447475      LOGICAL(KIND=C_BOOL) :: type__tmp 
    448476       
     477      IF (PRESENT(append_)) THEN 
     478        append__tmp=cxios_is_defined_filegroup_append(filegroup_hdl%daddr) 
     479        append_=append__tmp 
     480      ENDIF 
     481       
    449482      IF (PRESENT(compression_level_)) THEN 
    450483        compression_level__tmp=cxios_is_defined_filegroup_compression_level(filegroup_hdl%daddr) 
  • XIOS/branchs/xios-1.0/src/node/file.cpp

    r692 r798  
    311311         oss << ".nc"; 
    312312 
     313        bool append = !this->append.isEmpty() && this->append.getValue(); 
     314 
    313315         if (isOpen) data_out->closeFile() ; 
    314316         bool isCollective=true ; 
     
    324326           } 
    325327         } 
    326          data_out=shared_ptr<CDataOutput>(new CNc4DataOutput(oss.str(), false, fileComm, multifile, isCollective)); 
    327          isOpen=true ; 
    328  
    329          data_out->writeFile(CFile::get(this)); 
    330          std::vector<CField*>::iterator it, end = this->enabledFields.end(); 
    331          for (it = this->enabledFields.begin() ;it != end; it++) 
    332          { 
     328        data_out = shared_ptr<CDataOutput>(new CNc4DataOutput(oss.str(), append, fileComm, multifile, isCollective)); 
     329        isOpen = true; 
     330 
     331        data_out->writeFile(CFile::get(this)); 
     332 
     333        // Do not recreate the file structure if opening an existing file 
     334        if (!data_out->IsInAppendMode()) 
     335        { 
     336          std::vector<CField*>::iterator it, end = this->enabledFields.end(); 
     337          for (it = this->enabledFields.begin(); it != end; it++) 
     338          { 
    333339            CField* field = *it; 
    334340            this->data_out->writeFieldGrid(field); 
    335          } 
    336          this->data_out->writeTimeDimension(); 
    337           
    338          for (it = this->enabledFields.begin() ;it != end; it++) 
    339          { 
     341          } 
     342          this->data_out->writeTimeDimension(); 
     343 
     344          for (it = this->enabledFields.begin(); it != end; it++) 
     345          { 
    340346            CField* field = *it; 
    341347            this->data_out->writeField(field); 
    342          } 
    343           
    344          vector<CVariable*> listVars = getAllVariables() ; 
    345          for (vector<CVariable*>::iterator it = listVars.begin() ;it != listVars.end(); it++) this-> data_out-> writeAttribute(*it) ; 
    346           
    347          this->data_out->definition_end(); 
     348          } 
     349 
     350          vector<CVariable*> listVars = getAllVariables() ; 
     351          for (vector<CVariable*>::iterator it = listVars.begin(); it != listVars.end(); it++) 
     352            this->data_out->writeAttribute(*it); 
     353 
     354          this->data_out->definition_end(); 
     355        } 
    348356      } 
    349357   } 
  • XIOS/branchs/xios-1.0/src/output/nc4_data_output.cpp

    r713 r798  
    937937                                     this->getTimeStamp()); 
    938938 
    939            SuperClassWriter::addDimension("axis_nbounds", 2); 
     939           if (!appendMode) 
     940             SuperClassWriter::addDimension("axis_nbounds", 2); 
    940941         } 
    941942         catch (CNetCdfException& e) 
  • XIOS/branchs/xios-1.0/src/output/onetcdf4.cpp

    r607 r798  
    1111 
    1212      CONetCDF4::CONetCDF4 
    13          (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile) 
     13         (const StdString & filename, bool append, const MPI_Comm * comm, bool multifile) 
    1414            : path() 
    1515            , wmpi(false) 
    1616      { 
    17          this->initialize(filename, exist, comm,multifile); 
     17         this->initialize(filename, append, comm,multifile); 
    1818      } 
    1919 
     
    2929 
    3030      void CONetCDF4::initialize 
    31          (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile) 
     31         (const StdString & filename, bool append, const MPI_Comm * comm, bool multifile) 
    3232      { 
    3333         // Don't use parallel mode if there is only one process 
     
    4141         wmpi = comm && !multifile; 
    4242 
    43          if (!exist) 
     43         // If the file does not exist, we always create it 
     44         if (!append || !std::ifstream(filename.c_str())) 
    4445         { 
    4546            if (wmpi) 
     
    4748            else 
    4849               CNetCdfInterface::create(filename, NC_NETCDF4, this->ncidp); 
     50 
     51            this->appendMode = false; 
     52            this->recordOffset = 0; 
    4953         } 
    5054         else 
    5155         { 
    5256            if (wmpi) 
    53                CNetCdfInterface::openPar(filename, NC_NETCDF4|NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp); 
     57               CNetCdfInterface::openPar(filename, NC_NETCDF4|NC_MPIIO|NC_WRITE, *comm, MPI_INFO_NULL, this->ncidp); 
    5458            else 
    55                CNetCdfInterface::open(filename, NC_NETCDF4, this->ncidp); 
     59               CNetCdfInterface::open(filename, NC_NETCDF4|NC_WRITE, this->ncidp); 
     60 
     61            this->appendMode = true; 
     62            // Find out how many temporal records have been written already to the file we are opening 
     63            int ncUnlimitedDimId; 
     64            CNetCdfInterface::inqUnLimDim(this->ncidp, ncUnlimitedDimId); 
     65            if (ncUnlimitedDimId != -1) 
     66               CNetCdfInterface::inqDimLen(this->ncidp, ncUnlimitedDimId, this->recordOffset); 
     67            else 
     68               this->recordOffset = 0; 
    5669         } 
    5770      } 
     
    429442         if (iddims.begin()->compare(this->getUnlimitedDimensionName()) == 0) 
    430443         { 
    431             sstart.push_back(record); 
     444            sstart.push_back(record + recordOffset); 
    432445            scount.push_back(1); 
    433446            if ((start == NULL) && 
  • XIOS/branchs/xios-1.0/src/output/onetcdf4.hpp

    r606 r798  
    2626 
    2727            /// Constructeurs /// 
    28             CONetCDF4(const StdString & filename, bool exist, const MPI_Comm * comm = NULL, bool multifile=true); 
     28            CONetCDF4(const StdString & filename, bool append, const MPI_Comm * comm = NULL, bool multifile=true); 
    2929 
    3030            CONetCDF4(const CONetCDF4 & onetcdf4);       // Not implemented. 
     
    3333 
    3434            /// Initialisation /// 
    35             void initialize(const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile); 
     35            void initialize(const StdString & filename, bool append, const MPI_Comm * comm, bool multifile); 
    3636            void close(void) ; 
    3737            void sync(void) ; 
     
    116116            int ncidp; 
    117117            bool wmpi; 
     118            /*! Number of records already written when opening an existing file. 
     119             *  always 0 when creating a new file */ 
     120            size_t recordOffset; 
    118121            map<int,size_t> timeAxis ; 
    119122      }; // class CONetCDF4 
Note: See TracChangeset for help on using the changeset viewer.