Changeset 528
- Timestamp:
- 12/03/14 17:54:33 (10 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/config/file_attribute.conf
r526 r528 14 14 DECLARE_ENUM2(format, netcdf4, netcdf4_classic) 15 15 DECLARE_ENUM2(par_access, collective, independent) 16 DECLARE_ATTRIBUTE(bool, append) 16 17 17 18 // DECLARE_ATTRIBUTE_DEF(bool, enabled, true) -
XIOS/trunk/src/data_output.hpp
r501 r528 32 32 virtual void definition_end(void) = 0; 33 33 34 //!< Test if the file was opened in append mode 35 virtual bool IsInAppendMode() const { return appendMode; }; 36 34 37 virtual ~CDataOutput(void); 35 38 … … 56 59 /// Propriétés protégées /// 57 60 EDataOutputType type; 61 bool appendMode; //!< If true, we are appending data to an existing file 58 62 59 63 }; // class CDataOutput -
XIOS/trunk/src/interface/c_attr/icfile_attr.cpp
r526 r528 17 17 typedef xios::CFile* file_Ptr; 18 18 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 CTimer::get("XIOS").suspend(); 24 } 25 26 void cxios_get_file_append(file_Ptr file_hdl, bool* append) 27 { 28 *append = file_hdl->append.getInheritedValue(); 29 } 30 31 bool cxios_is_defined_file_append(file_Ptr file_hdl ) 32 { 33 CTimer::get("XIOS").resume(); 34 return file_hdl->append.hasInheritedValue(); 35 CTimer::get("XIOS").suspend(); 36 } 37 38 39 19 40 void cxios_set_file_description(file_Ptr file_hdl, const char * description, int description_size) 20 41 { -
XIOS/trunk/src/interface/c_attr/icfilegroup_attr.cpp
r526 r528 17 17 typedef xios::CFileGroup* filegroup_Ptr; 18 18 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 CTimer::get("XIOS").suspend(); 24 } 25 26 void cxios_get_filegroup_append(filegroup_Ptr filegroup_hdl, bool* append) 27 { 28 *append = filegroup_hdl->append.getInheritedValue(); 29 } 30 31 bool cxios_is_defined_filegroup_append(filegroup_Ptr filegroup_hdl ) 32 { 33 CTimer::get("XIOS").resume(); 34 return filegroup_hdl->append.hasInheritedValue(); 35 CTimer::get("XIOS").suspend(); 36 } 37 38 39 19 40 void cxios_set_filegroup_description(filegroup_Ptr filegroup_hdl, const char * description, int description_size) 20 41 { -
XIOS/trunk/src/interface/fortran_attr/file_interface_attr.f90
r517 r528 9 9 10 10 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 11 30 SUBROUTINE cxios_set_file_description(file_hdl, description, description_size) BIND(C) 12 31 USE ISO_C_BINDING -
XIOS/trunk/src/interface/fortran_attr/filegroup_interface_attr.f90
r517 r528 9 9 10 10 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 11 30 SUBROUTINE cxios_set_filegroup_description(filegroup_hdl, description, description_size) BIND(C) 12 31 USE ISO_C_BINDING -
XIOS/trunk/src/interface/fortran_attr/ifile_attr.F90
r517 r528 12 12 13 13 SUBROUTINE xios(set_file_attr) & 14 ( file_id, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&15 , par_access, split_freq, split_freq_format, sync_freq, type )14 ( file_id, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 15 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 16 16 17 17 IMPLICIT NONE 18 18 TYPE(txios(file)) :: file_hdl 19 19 CHARACTER(LEN=*), INTENT(IN) ::file_id 20 LOGICAL , OPTIONAL, INTENT(IN) :: append 21 LOGICAL (KIND=C_BOOL) :: append_tmp 20 22 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 21 23 LOGICAL , OPTIONAL, INTENT(IN) :: enabled … … 35 37 CALL xios(get_file_handle)(file_id,file_hdl) 36 38 CALL xios(set_file_attr_hdl_) & 37 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&38 , par_access, split_freq, split_freq_format, sync_freq, type )39 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 40 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 39 41 40 42 END SUBROUTINE xios(set_file_attr) 41 43 42 44 SUBROUTINE xios(set_file_attr_hdl) & 43 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level & 44 , par_access, split_freq, split_freq_format, sync_freq, type ) 45 46 IMPLICIT NONE 47 TYPE(txios(file)) , INTENT(IN) :: file_hdl 45 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 46 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 47 48 IMPLICIT NONE 49 TYPE(txios(file)) , INTENT(IN) :: file_hdl 50 LOGICAL , OPTIONAL, INTENT(IN) :: append 51 LOGICAL (KIND=C_BOOL) :: append_tmp 48 52 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 49 53 LOGICAL , OPTIONAL, INTENT(IN) :: enabled … … 62 66 63 67 CALL xios(set_file_attr_hdl_) & 64 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&65 , par_access, split_freq, split_freq_format, sync_freq, type )68 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 69 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 66 70 67 71 END SUBROUTINE xios(set_file_attr_hdl) 68 72 69 73 SUBROUTINE xios(set_file_attr_hdl_) & 70 ( file_hdl, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ &74 ( file_hdl, append_, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 71 75 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 72 76 73 77 IMPLICIT NONE 74 78 TYPE(txios(file)) , INTENT(IN) :: file_hdl 79 LOGICAL , OPTIONAL, INTENT(IN) :: append_ 80 LOGICAL (KIND=C_BOOL) :: append__tmp 75 81 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description_ 76 82 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ … … 88 94 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ 89 95 96 IF (PRESENT(append_)) THEN 97 append__tmp=append_ 98 CALL cxios_set_file_append(file_hdl%daddr, append__tmp) 99 ENDIF 100 90 101 IF (PRESENT(description_)) THEN 91 102 CALL cxios_set_file_description(file_hdl%daddr, description_, len(description_)) … … 146 157 147 158 SUBROUTINE xios(get_file_attr) & 148 ( file_id, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&149 , par_access, split_freq, split_freq_format, sync_freq, type )159 ( file_id, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 160 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 150 161 151 162 IMPLICIT NONE 152 163 TYPE(txios(file)) :: file_hdl 153 164 CHARACTER(LEN=*), INTENT(IN) ::file_id 165 LOGICAL , OPTIONAL, INTENT(OUT) :: append 166 LOGICAL (KIND=C_BOOL) :: append_tmp 154 167 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 155 168 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled … … 169 182 CALL xios(get_file_handle)(file_id,file_hdl) 170 183 CALL xios(get_file_attr_hdl_) & 171 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&172 , par_access, split_freq, split_freq_format, sync_freq, type )184 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 185 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 173 186 174 187 END SUBROUTINE xios(get_file_attr) 175 188 176 189 SUBROUTINE xios(get_file_attr_hdl) & 177 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level & 178 , par_access, split_freq, split_freq_format, sync_freq, type ) 179 180 IMPLICIT NONE 181 TYPE(txios(file)) , INTENT(IN) :: file_hdl 190 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 191 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 192 193 IMPLICIT NONE 194 TYPE(txios(file)) , INTENT(IN) :: file_hdl 195 LOGICAL , OPTIONAL, INTENT(OUT) :: append 196 LOGICAL (KIND=C_BOOL) :: append_tmp 182 197 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 183 198 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled … … 196 211 197 212 CALL xios(get_file_attr_hdl_) & 198 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&199 , par_access, split_freq, split_freq_format, sync_freq, type )213 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 214 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 200 215 201 216 END SUBROUTINE xios(get_file_attr_hdl) 202 217 203 218 SUBROUTINE xios(get_file_attr_hdl_) & 204 ( file_hdl, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ &219 ( file_hdl, append_, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 205 220 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 206 221 207 222 IMPLICIT NONE 208 223 TYPE(txios(file)) , INTENT(IN) :: file_hdl 224 LOGICAL , OPTIONAL, INTENT(OUT) :: append_ 225 LOGICAL (KIND=C_BOOL) :: append__tmp 209 226 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description_ 210 227 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ … … 222 239 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ 223 240 241 IF (PRESENT(append_)) THEN 242 CALL cxios_get_file_append(file_hdl%daddr, append__tmp) 243 append_=append__tmp 244 ENDIF 245 224 246 IF (PRESENT(description_)) THEN 225 247 CALL cxios_get_file_description(file_hdl%daddr, description_, len(description_)) … … 280 302 281 303 SUBROUTINE xios(is_defined_file_attr) & 282 ( file_id, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&283 , par_access, split_freq, split_freq_format, sync_freq, type )304 ( file_id, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 305 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 284 306 285 307 IMPLICIT NONE 286 308 TYPE(txios(file)) :: file_hdl 287 309 CHARACTER(LEN=*), INTENT(IN) ::file_id 310 LOGICAL, OPTIONAL, INTENT(OUT) :: append 311 LOGICAL(KIND=C_BOOL) :: append_tmp 288 312 LOGICAL, OPTIONAL, INTENT(OUT) :: description 289 313 LOGICAL(KIND=C_BOOL) :: description_tmp … … 315 339 CALL xios(get_file_handle)(file_id,file_hdl) 316 340 CALL xios(is_defined_file_attr_hdl_) & 317 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&318 , par_access, split_freq, split_freq_format, sync_freq, type )341 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 342 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 319 343 320 344 END SUBROUTINE xios(is_defined_file_attr) 321 345 322 346 SUBROUTINE xios(is_defined_file_attr_hdl) & 323 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level & 324 , par_access, split_freq, split_freq_format, sync_freq, type ) 325 326 IMPLICIT NONE 327 TYPE(txios(file)) , INTENT(IN) :: file_hdl 347 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 348 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 349 350 IMPLICIT NONE 351 TYPE(txios(file)) , INTENT(IN) :: file_hdl 352 LOGICAL, OPTIONAL, INTENT(OUT) :: append 353 LOGICAL(KIND=C_BOOL) :: append_tmp 328 354 LOGICAL, OPTIONAL, INTENT(OUT) :: description 329 355 LOGICAL(KIND=C_BOOL) :: description_tmp … … 354 380 355 381 CALL xios(is_defined_file_attr_hdl_) & 356 ( file_hdl, description, enabled, format, min_digits, name, name_suffix, output_freq, output_level&357 , par_access, split_freq, split_freq_format, sync_freq, type )382 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq & 383 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 358 384 359 385 END SUBROUTINE xios(is_defined_file_attr_hdl) 360 386 361 387 SUBROUTINE xios(is_defined_file_attr_hdl_) & 362 ( file_hdl, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ &388 ( file_hdl, append_, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 363 389 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 364 390 365 391 IMPLICIT NONE 366 392 TYPE(txios(file)) , INTENT(IN) :: file_hdl 393 LOGICAL, OPTIONAL, INTENT(OUT) :: append_ 394 LOGICAL(KIND=C_BOOL) :: append__tmp 367 395 LOGICAL, OPTIONAL, INTENT(OUT) :: description_ 368 396 LOGICAL(KIND=C_BOOL) :: description__tmp … … 392 420 LOGICAL(KIND=C_BOOL) :: type__tmp 393 421 422 IF (PRESENT(append_)) THEN 423 append__tmp=cxios_is_defined_file_append(file_hdl%daddr) 424 append_=append__tmp 425 ENDIF 426 394 427 IF (PRESENT(description_)) THEN 395 428 description__tmp=cxios_is_defined_file_description(file_hdl%daddr) -
XIOS/trunk/src/interface/fortran_attr/ifilegroup_attr.F90
r517 r528 12 12 13 13 SUBROUTINE xios(set_filegroup_attr) & 14 ( filegroup_id, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&15 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )14 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 15 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 16 16 17 17 IMPLICIT NONE 18 18 TYPE(txios(filegroup)) :: filegroup_hdl 19 19 CHARACTER(LEN=*), INTENT(IN) ::filegroup_id 20 LOGICAL , OPTIONAL, INTENT(IN) :: append 21 LOGICAL (KIND=C_BOOL) :: append_tmp 20 22 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 21 23 LOGICAL , OPTIONAL, INTENT(IN) :: enabled … … 36 38 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 37 39 CALL xios(set_filegroup_attr_hdl_) & 38 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&39 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )40 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 41 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 40 42 41 43 END SUBROUTINE xios(set_filegroup_attr) 42 44 43 45 SUBROUTINE xios(set_filegroup_attr_hdl) & 44 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&45 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )46 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 47 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 46 48 47 49 IMPLICIT NONE 48 50 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 51 LOGICAL , OPTIONAL, INTENT(IN) :: append 52 LOGICAL (KIND=C_BOOL) :: append_tmp 49 53 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description 50 54 LOGICAL , OPTIONAL, INTENT(IN) :: enabled … … 64 68 65 69 CALL xios(set_filegroup_attr_hdl_) & 66 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&67 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )70 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 71 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 68 72 69 73 END SUBROUTINE xios(set_filegroup_attr_hdl) 70 74 71 75 SUBROUTINE xios(set_filegroup_attr_hdl_) & 72 ( filegroup_hdl, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ &76 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ & 73 77 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 74 78 ) … … 76 80 IMPLICIT NONE 77 81 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 82 LOGICAL , OPTIONAL, INTENT(IN) :: append_ 83 LOGICAL (KIND=C_BOOL) :: append__tmp 78 84 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: description_ 79 85 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ … … 92 98 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_ 93 99 100 IF (PRESENT(append_)) THEN 101 append__tmp=append_ 102 CALL cxios_set_filegroup_append(filegroup_hdl%daddr, append__tmp) 103 ENDIF 104 94 105 IF (PRESENT(description_)) THEN 95 106 CALL cxios_set_filegroup_description(filegroup_hdl%daddr, description_, len(description_)) … … 154 165 155 166 SUBROUTINE xios(get_filegroup_attr) & 156 ( filegroup_id, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&157 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )167 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 168 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 158 169 159 170 IMPLICIT NONE 160 171 TYPE(txios(filegroup)) :: filegroup_hdl 161 172 CHARACTER(LEN=*), INTENT(IN) ::filegroup_id 173 LOGICAL , OPTIONAL, INTENT(OUT) :: append 174 LOGICAL (KIND=C_BOOL) :: append_tmp 162 175 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 163 176 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled … … 178 191 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 179 192 CALL xios(get_filegroup_attr_hdl_) & 180 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&181 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )193 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 194 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 182 195 183 196 END SUBROUTINE xios(get_filegroup_attr) 184 197 185 198 SUBROUTINE xios(get_filegroup_attr_hdl) & 186 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&187 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )199 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 200 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 188 201 189 202 IMPLICIT NONE 190 203 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 204 LOGICAL , OPTIONAL, INTENT(OUT) :: append 205 LOGICAL (KIND=C_BOOL) :: append_tmp 191 206 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description 192 207 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled … … 206 221 207 222 CALL xios(get_filegroup_attr_hdl_) & 208 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&209 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )223 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 224 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 210 225 211 226 END SUBROUTINE xios(get_filegroup_attr_hdl) 212 227 213 228 SUBROUTINE xios(get_filegroup_attr_hdl_) & 214 ( filegroup_hdl, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ &229 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ & 215 230 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 216 231 ) … … 218 233 IMPLICIT NONE 219 234 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 235 LOGICAL , OPTIONAL, INTENT(OUT) :: append_ 236 LOGICAL (KIND=C_BOOL) :: append__tmp 220 237 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: description_ 221 238 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ … … 234 251 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_ 235 252 253 IF (PRESENT(append_)) THEN 254 CALL cxios_get_filegroup_append(filegroup_hdl%daddr, append__tmp) 255 append_=append__tmp 256 ENDIF 257 236 258 IF (PRESENT(description_)) THEN 237 259 CALL cxios_get_filegroup_description(filegroup_hdl%daddr, description_, len(description_)) … … 296 318 297 319 SUBROUTINE xios(is_defined_filegroup_attr) & 298 ( filegroup_id, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&299 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )320 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 321 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 300 322 301 323 IMPLICIT NONE 302 324 TYPE(txios(filegroup)) :: filegroup_hdl 303 325 CHARACTER(LEN=*), INTENT(IN) ::filegroup_id 326 LOGICAL, OPTIONAL, INTENT(OUT) :: append 327 LOGICAL(KIND=C_BOOL) :: append_tmp 304 328 LOGICAL, OPTIONAL, INTENT(OUT) :: description 305 329 LOGICAL(KIND=C_BOOL) :: description_tmp … … 333 357 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 334 358 CALL xios(is_defined_filegroup_attr_hdl_) & 335 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&336 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )359 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 360 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 337 361 338 362 END SUBROUTINE xios(is_defined_filegroup_attr) 339 363 340 364 SUBROUTINE xios(is_defined_filegroup_attr_hdl) & 341 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&342 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )365 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 366 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 343 367 344 368 IMPLICIT NONE 345 369 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 370 LOGICAL, OPTIONAL, INTENT(OUT) :: append 371 LOGICAL(KIND=C_BOOL) :: append_tmp 346 372 LOGICAL, OPTIONAL, INTENT(OUT) :: description 347 373 LOGICAL(KIND=C_BOOL) :: description_tmp … … 374 400 375 401 CALL xios(is_defined_filegroup_attr_hdl_) & 376 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq&377 , output_ level, par_access, split_freq, split_freq_format, sync_freq, type )402 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix & 403 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 378 404 379 405 END SUBROUTINE xios(is_defined_filegroup_attr_hdl) 380 406 381 407 SUBROUTINE xios(is_defined_filegroup_attr_hdl_) & 382 ( filegroup_hdl, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ &408 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ & 383 409 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 384 410 ) … … 386 412 IMPLICIT NONE 387 413 TYPE(txios(filegroup)) , INTENT(IN) :: filegroup_hdl 414 LOGICAL, OPTIONAL, INTENT(OUT) :: append_ 415 LOGICAL(KIND=C_BOOL) :: append__tmp 388 416 LOGICAL, OPTIONAL, INTENT(OUT) :: description_ 389 417 LOGICAL(KIND=C_BOOL) :: description__tmp … … 415 443 LOGICAL(KIND=C_BOOL) :: type__tmp 416 444 445 IF (PRESENT(append_)) THEN 446 append__tmp=cxios_is_defined_filegroup_append(filegroup_hdl%daddr) 447 append_=append__tmp 448 ENDIF 449 417 450 IF (PRESENT(description_)) THEN 418 451 description__tmp=cxios_is_defined_filegroup_description(filegroup_hdl%daddr) -
XIOS/trunk/src/node/file.cpp
r526 r528 322 322 } 323 323 324 bool append = !this->append.isEmpty() && this->append.getValue(); 325 324 326 bool useClassicFormat = !format.isEmpty() && format == format_attr::netcdf4_classic; 325 327 … … 362 364 if (isOpen) data_out->closeFile(); 363 365 364 data_out=shared_ptr<CDataOutput>(new CNc4DataOutput(oss.str(), false, useClassicFormat, 365 fileComm, multifile, isCollective)); 366 isOpen=true ; 367 368 data_out->writeFile(CFile::get(this)); 369 std::vector<CField*>::iterator it, end = this->enabledFields.end(); 370 for (it = this->enabledFields.begin() ;it != end; it++) 371 { 366 data_out = shared_ptr<CDataOutput>(new CNc4DataOutput(oss.str(), append, useClassicFormat, 367 fileComm, multifile, isCollective)); 368 isOpen = true; 369 370 data_out->writeFile(CFile::get(this)); 371 372 // Do not recreate the file structure if opening an existing file 373 if (!data_out->IsInAppendMode()) 374 { 375 std::vector<CField*>::iterator it, end = this->enabledFields.end(); 376 for (it = this->enabledFields.begin(); it != end; it++) 377 { 372 378 CField* field = *it; 373 379 this->data_out->writeFieldGrid(field); 374 }375 this->data_out->writeTimeDimension();376 377 for (it = this->enabledFields.begin() ;it != end; it++)378 {380 } 381 this->data_out->writeTimeDimension(); 382 383 for (it = this->enabledFields.begin(); it != end; it++) 384 { 379 385 CField* field = *it; 380 386 this->data_out->writeField(field); 381 } 382 383 vector<CVariable*> listVars = getAllVariables() ; 384 for (vector<CVariable*>::iterator it = listVars.begin() ;it != listVars.end(); it++) this-> data_out-> writeAttribute(*it) ; 385 386 this->data_out->definition_end(); 387 } 388 389 vector<CVariable*> listVars = getAllVariables() ; 390 for (vector<CVariable*>::iterator it = listVars.begin(); it != listVars.end(); it++) 391 this->data_out->writeAttribute(*it); 392 393 this->data_out->definition_end(); 394 } 387 395 } 388 396 } -
XIOS/trunk/src/output/onetcdf4.cpp
r517 r528 1 #include <fstream> 2 1 3 #include "onetcdf4.hpp" 2 4 #include "group_template.hpp" … … 11 13 12 14 CONetCDF4::CONetCDF4 13 (const StdString & filename, bool exist, bool useClassicFormat, const MPI_Comm * comm, bool multifile)15 (const StdString & filename, bool append, bool useClassicFormat, const MPI_Comm * comm, bool multifile) 14 16 : path() 15 17 , useClassicFormat(useClassicFormat) 18 , recordOffset(0) 16 19 { 17 20 this->wmpi = (comm != NULL) && !multifile; 18 this->initialize(filename, exist, useClassicFormat, comm,multifile);21 this->initialize(filename, append, useClassicFormat, comm,multifile); 19 22 } 20 23 … … 30 33 31 34 void CONetCDF4::initialize 32 (const StdString & filename, bool exist, bool useClassicFormat, const MPI_Comm * comm, bool multifile)35 (const StdString & filename, bool append, bool useClassicFormat, const MPI_Comm * comm, bool multifile) 33 36 { 34 37 this->useClassicFormat = useClassicFormat; … … 38 41 mode |= useClassicFormat ? NC_PNETCDF : NC_MPIIO; 39 42 40 if (!exist) 43 // If the file does not exist, we always create it 44 if (!append || !std::ifstream(filename.c_str())) 41 45 { 42 46 if (comm != NULL) … … 46 50 } 47 51 else CNetCdfInterface::create(filename, mode, this->ncidp); 52 53 this->appendMode = false; 54 this->recordOffset = 0; 48 55 } 49 56 else 50 57 { 58 mode |= NC_WRITE; 51 59 if (comm != NULL) 52 60 { … … 55 63 } 56 64 else CNetCdfInterface::open(filename, mode, this->ncidp); 65 66 this->appendMode = true; 67 // Find out how many temporal records have been written already to the file we are opening 68 int ncUnlimitedDimId; 69 CNetCdfInterface::inqUnLimDim(this->ncidp, ncUnlimitedDimId); 70 if (ncUnlimitedDimId != -1) 71 CNetCdfInterface::inqDimLen(this->ncidp, ncUnlimitedDimId, this->recordOffset); 72 else 73 this->recordOffset = 0; 57 74 } 58 75 … … 424 441 if (iddims.begin()->compare(this->getUnlimitedDimensionName()) == 0) 425 442 { 426 sstart.push_back(record );443 sstart.push_back(record + recordOffset); 427 444 scount.push_back(1); 428 445 if ((start == NULL) && -
XIOS/trunk/src/output/onetcdf4.hpp
r517 r528 26 26 27 27 /// Constructeurs /// 28 CONetCDF4(const StdString & filename, bool exist, bool useClassicFormat = false,28 CONetCDF4(const StdString & filename, bool append, bool useClassicFormat = false, 29 29 const MPI_Comm * comm = NULL, bool multifile = true); 30 30 … … 34 34 35 35 /// Initialisation /// 36 void initialize(const StdString & filename, bool exist, bool useClassicFormat,36 void initialize(const StdString & filename, bool append, bool useClassicFormat, 37 37 const MPI_Comm * comm, bool multifile); 38 38 void close(void) ; … … 118 118 int ncidp; 119 119 bool wmpi; 120 /*! Number of records already written when opening an existing file. 121 * always 0 when creating a new file */ 122 size_t recordOffset; 120 123 map<int,size_t> timeAxis ; 121 124 }; // class CONetCDF4
Note: See TracChangeset
for help on using the changeset viewer.