Changeset 517
- Timestamp:
- 11/26/14 12:06:21 (9 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/config/file_attribute.conf
r501 r517 12 12 DECLARE_ATTRIBUTE(bool, enabled) 13 13 DECLARE_ENUM2(type,one_file,multiple_file) 14 DECLARE_ENUM2(format, netcdf4, netcdf4_classic) 14 15 DECLARE_ATTRIBUTE(StdString, par_access) 15 16 -
XIOS/trunk/src/interface/c_attr/icfile_attr.cpp
r509 r517 64 64 65 65 66 void cxios_set_file_format(file_Ptr file_hdl, const char * format, int format_size) 67 { 68 std::string format_str; 69 if(!cstr2string(format, format_size, format_str)) return; 70 CTimer::get("XIOS").resume(); 71 file_hdl->format.fromString(format_str); 72 CTimer::get("XIOS").suspend(); 73 } 74 75 void cxios_get_file_format(file_Ptr file_hdl, char * format, int format_size) 76 { 77 CTimer::get("XIOS").resume(); 78 if(!string_copy(file_hdl->format.getInheritedStringValue(),format , format_size)) 79 ERROR("void cxios_get_file_format(file_Ptr file_hdl, char * format, int format_size)", <<"Input string is to short"); 80 CTimer::get("XIOS").suspend(); 81 } 82 83 bool cxios_is_defined_file_format(file_Ptr file_hdl ) 84 { 85 CTimer::get("XIOS").resume(); 86 return file_hdl->format.hasInheritedValue(); 87 CTimer::get("XIOS").suspend(); 88 } 89 90 91 66 92 void cxios_set_file_min_digits(file_Ptr file_hdl, int min_digits) 67 93 { -
XIOS/trunk/src/interface/c_attr/icfilegroup_attr.cpp
r509 r517 64 64 65 65 66 void cxios_set_filegroup_format(filegroup_Ptr filegroup_hdl, const char * format, int format_size) 67 { 68 std::string format_str; 69 if(!cstr2string(format, format_size, format_str)) return; 70 CTimer::get("XIOS").resume(); 71 filegroup_hdl->format.fromString(format_str); 72 CTimer::get("XIOS").suspend(); 73 } 74 75 void cxios_get_filegroup_format(filegroup_Ptr filegroup_hdl, char * format, int format_size) 76 { 77 CTimer::get("XIOS").resume(); 78 if(!string_copy(filegroup_hdl->format.getInheritedStringValue(),format , format_size)) 79 ERROR("void cxios_get_filegroup_format(filegroup_Ptr filegroup_hdl, char * format, int format_size)", <<"Input string is to short"); 80 CTimer::get("XIOS").suspend(); 81 } 82 83 bool cxios_is_defined_filegroup_format(filegroup_Ptr filegroup_hdl ) 84 { 85 CTimer::get("XIOS").resume(); 86 return filegroup_hdl->format.hasInheritedValue(); 87 CTimer::get("XIOS").suspend(); 88 } 89 90 91 66 92 void cxios_set_filegroup_group_ref(filegroup_Ptr filegroup_hdl, const char * group_ref, int group_ref_size) 67 93 { -
XIOS/trunk/src/interface/fortran_attr/file_interface_attr.f90
r501 r517 49 49 50 50 51 SUBROUTINE cxios_set_file_format(file_hdl, format, format_size) BIND(C) 52 USE ISO_C_BINDING 53 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 54 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: format 55 INTEGER (kind = C_INT) , VALUE :: format_size 56 END SUBROUTINE cxios_set_file_format 57 58 SUBROUTINE cxios_get_file_format(file_hdl, format, format_size) BIND(C) 59 USE ISO_C_BINDING 60 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 61 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: format 62 INTEGER (kind = C_INT) , VALUE :: format_size 63 END SUBROUTINE cxios_get_file_format 64 65 FUNCTION cxios_is_defined_file_format(file_hdl ) BIND(C) 66 USE ISO_C_BINDING 67 LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_format 68 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 69 END FUNCTION cxios_is_defined_file_format 70 71 51 72 SUBROUTINE cxios_set_file_min_digits(file_hdl, min_digits) BIND(C) 52 73 USE ISO_C_BINDING -
XIOS/trunk/src/interface/fortran_attr/filegroup_interface_attr.f90
r501 r517 49 49 50 50 51 SUBROUTINE cxios_set_filegroup_format(filegroup_hdl, format, format_size) BIND(C) 52 USE ISO_C_BINDING 53 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 54 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: format 55 INTEGER (kind = C_INT) , VALUE :: format_size 56 END SUBROUTINE cxios_set_filegroup_format 57 58 SUBROUTINE cxios_get_filegroup_format(filegroup_hdl, format, format_size) BIND(C) 59 USE ISO_C_BINDING 60 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 61 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: format 62 INTEGER (kind = C_INT) , VALUE :: format_size 63 END SUBROUTINE cxios_get_filegroup_format 64 65 FUNCTION cxios_is_defined_filegroup_format(filegroup_hdl ) BIND(C) 66 USE ISO_C_BINDING 67 LOGICAL(kind=C_BOOL) :: cxios_is_defined_filegroup_format 68 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 69 END FUNCTION cxios_is_defined_filegroup_format 70 71 51 72 SUBROUTINE cxios_set_filegroup_group_ref(filegroup_hdl, group_ref, group_ref_size) BIND(C) 52 73 USE ISO_C_BINDING -
XIOS/trunk/src/interface/fortran_attr/ifile_attr.F90
r501 r517 12 12 13 13 SUBROUTINE xios(set_file_attr) & 14 ( file_id, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&15 , split_freq, split_freq_format, sync_freq, type )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 ) 16 16 17 17 IMPLICIT NONE … … 21 21 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 22 22 LOGICAL (KIND=C_BOOL) :: enabled_tmp 23 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format 23 24 INTEGER , OPTIONAL, INTENT(IN) :: min_digits 24 25 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name … … 34 35 CALL xios(get_file_handle)(file_id,file_hdl) 35 36 CALL xios(set_file_attr_hdl_) & 36 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&37 , split_freq, split_freq_format, sync_freq, type )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 ) 38 39 39 40 END SUBROUTINE xios(set_file_attr) 40 41 41 42 SUBROUTINE xios(set_file_attr_hdl) & 42 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&43 , split_freq, split_freq_format, sync_freq, type )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 ) 44 45 45 46 IMPLICIT NONE … … 48 49 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 49 50 LOGICAL (KIND=C_BOOL) :: enabled_tmp 51 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format 50 52 INTEGER , OPTIONAL, INTENT(IN) :: min_digits 51 53 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name … … 60 62 61 63 CALL xios(set_file_attr_hdl_) & 62 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&63 , split_freq, split_freq_format, sync_freq, type )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 ) 64 66 65 67 END SUBROUTINE xios(set_file_attr_hdl) 66 68 67 69 SUBROUTINE xios(set_file_attr_hdl_) & 68 ( file_hdl, description_, enabled_, min_digits_, name_, name_suffix_, output_freq_, output_level_ &69 , par_access_, split_freq_, split_freq_format_, sync_freq_, type_ )70 ( file_hdl, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 71 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 70 72 71 73 IMPLICIT NONE … … 74 76 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ 75 77 LOGICAL (KIND=C_BOOL) :: enabled__tmp 78 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format_ 76 79 INTEGER , OPTIONAL, INTENT(IN) :: min_digits_ 77 80 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ … … 94 97 ENDIF 95 98 99 IF (PRESENT(format_)) THEN 100 CALL cxios_set_file_format(file_hdl%daddr, format_, len(format_)) 101 ENDIF 102 96 103 IF (PRESENT(min_digits_)) THEN 97 104 CALL cxios_set_file_min_digits(file_hdl%daddr, min_digits_) … … 139 146 140 147 SUBROUTINE xios(get_file_attr) & 141 ( file_id, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&142 , split_freq, split_freq_format, sync_freq, type )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 ) 143 150 144 151 IMPLICIT NONE … … 148 155 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 149 156 LOGICAL (KIND=C_BOOL) :: enabled_tmp 157 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format 150 158 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits 151 159 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name … … 161 169 CALL xios(get_file_handle)(file_id,file_hdl) 162 170 CALL xios(get_file_attr_hdl_) & 163 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&164 , split_freq, split_freq_format, sync_freq, type )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 ) 165 173 166 174 END SUBROUTINE xios(get_file_attr) 167 175 168 176 SUBROUTINE xios(get_file_attr_hdl) & 169 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&170 , split_freq, split_freq_format, sync_freq, type )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 ) 171 179 172 180 IMPLICIT NONE … … 175 183 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 176 184 LOGICAL (KIND=C_BOOL) :: enabled_tmp 185 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format 177 186 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits 178 187 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name … … 187 196 188 197 CALL xios(get_file_attr_hdl_) & 189 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&190 , split_freq, split_freq_format, sync_freq, type )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 ) 191 200 192 201 END SUBROUTINE xios(get_file_attr_hdl) 193 202 194 203 SUBROUTINE xios(get_file_attr_hdl_) & 195 ( file_hdl, description_, enabled_, min_digits_, name_, name_suffix_, output_freq_, output_level_ &196 , par_access_, split_freq_, split_freq_format_, sync_freq_, type_ )204 ( file_hdl, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 205 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 197 206 198 207 IMPLICIT NONE … … 201 210 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ 202 211 LOGICAL (KIND=C_BOOL) :: enabled__tmp 212 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format_ 203 213 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits_ 204 214 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ … … 221 231 ENDIF 222 232 233 IF (PRESENT(format_)) THEN 234 CALL cxios_get_file_format(file_hdl%daddr, format_, len(format_)) 235 ENDIF 236 223 237 IF (PRESENT(min_digits_)) THEN 224 238 CALL cxios_get_file_min_digits(file_hdl%daddr, min_digits_) … … 266 280 267 281 SUBROUTINE xios(is_defined_file_attr) & 268 ( file_id, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&269 , split_freq, split_freq_format, sync_freq, type )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 ) 270 284 271 285 IMPLICIT NONE … … 276 290 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 277 291 LOGICAL(KIND=C_BOOL) :: enabled_tmp 292 LOGICAL, OPTIONAL, INTENT(OUT) :: format 293 LOGICAL(KIND=C_BOOL) :: format_tmp 278 294 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits 279 295 LOGICAL(KIND=C_BOOL) :: min_digits_tmp … … 299 315 CALL xios(get_file_handle)(file_id,file_hdl) 300 316 CALL xios(is_defined_file_attr_hdl_) & 301 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&302 , split_freq, split_freq_format, sync_freq, type )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 ) 303 319 304 320 END SUBROUTINE xios(is_defined_file_attr) 305 321 306 322 SUBROUTINE xios(is_defined_file_attr_hdl) & 307 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&308 , split_freq, split_freq_format, sync_freq, type )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 ) 309 325 310 326 IMPLICIT NONE … … 314 330 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 315 331 LOGICAL(KIND=C_BOOL) :: enabled_tmp 332 LOGICAL, OPTIONAL, INTENT(OUT) :: format 333 LOGICAL(KIND=C_BOOL) :: format_tmp 316 334 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits 317 335 LOGICAL(KIND=C_BOOL) :: min_digits_tmp … … 336 354 337 355 CALL xios(is_defined_file_attr_hdl_) & 338 ( file_hdl, description, enabled, min_digits, name, name_suffix, output_freq, output_level, par_access&339 , split_freq, split_freq_format, sync_freq, type )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 ) 340 358 341 359 END SUBROUTINE xios(is_defined_file_attr_hdl) 342 360 343 361 SUBROUTINE xios(is_defined_file_attr_hdl_) & 344 ( file_hdl, description_, enabled_, min_digits_, name_, name_suffix_, output_freq_, output_level_ &345 , par_access_, split_freq_, split_freq_format_, sync_freq_, type_ )362 ( file_hdl, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 363 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 346 364 347 365 IMPLICIT NONE … … 351 369 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ 352 370 LOGICAL(KIND=C_BOOL) :: enabled__tmp 371 LOGICAL, OPTIONAL, INTENT(OUT) :: format_ 372 LOGICAL(KIND=C_BOOL) :: format__tmp 353 373 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits_ 354 374 LOGICAL(KIND=C_BOOL) :: min_digits__tmp … … 382 402 ENDIF 383 403 404 IF (PRESENT(format_)) THEN 405 format__tmp=cxios_is_defined_file_format(file_hdl%daddr) 406 format_=format__tmp 407 ENDIF 408 384 409 IF (PRESENT(min_digits_)) THEN 385 410 min_digits__tmp=cxios_is_defined_file_min_digits(file_hdl%daddr) -
XIOS/trunk/src/interface/fortran_attr/ifilegroup_attr.F90
r501 r517 12 12 13 13 SUBROUTINE xios(set_filegroup_attr) & 14 ( filegroup_id, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &14 ( filegroup_id, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 15 15 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 16 16 … … 21 21 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 22 22 LOGICAL (KIND=C_BOOL) :: enabled_tmp 23 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format 23 24 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref 24 25 INTEGER , OPTIONAL, INTENT(IN) :: min_digits … … 35 36 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 36 37 CALL xios(set_filegroup_attr_hdl_) & 37 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &38 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 38 39 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 39 40 … … 41 42 42 43 SUBROUTINE xios(set_filegroup_attr_hdl) & 43 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &44 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 44 45 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 45 46 … … 49 50 LOGICAL , OPTIONAL, INTENT(IN) :: enabled 50 51 LOGICAL (KIND=C_BOOL) :: enabled_tmp 52 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format 51 53 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref 52 54 INTEGER , OPTIONAL, INTENT(IN) :: min_digits … … 62 64 63 65 CALL xios(set_filegroup_attr_hdl_) & 64 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &66 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 65 67 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 66 68 … … 68 70 69 71 SUBROUTINE xios(set_filegroup_attr_hdl_) & 70 ( filegroup_hdl, description_, enabled_, group_ref_, min_digits_, name_, name_suffix_, output_freq_ & 71 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 72 ( filegroup_hdl, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ & 73 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 74 ) 72 75 73 76 IMPLICIT NONE … … 76 79 LOGICAL , OPTIONAL, INTENT(IN) :: enabled_ 77 80 LOGICAL (KIND=C_BOOL) :: enabled__tmp 81 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format_ 78 82 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_ 79 83 INTEGER , OPTIONAL, INTENT(IN) :: min_digits_ … … 97 101 ENDIF 98 102 103 IF (PRESENT(format_)) THEN 104 CALL cxios_set_filegroup_format(filegroup_hdl%daddr, format_, len(format_)) 105 ENDIF 106 99 107 IF (PRESENT(group_ref_)) THEN 100 108 CALL cxios_set_filegroup_group_ref(filegroup_hdl%daddr, group_ref_, len(group_ref_)) … … 146 154 147 155 SUBROUTINE xios(get_filegroup_attr) & 148 ( filegroup_id, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &156 ( filegroup_id, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 149 157 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 150 158 … … 155 163 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 156 164 LOGICAL (KIND=C_BOOL) :: enabled_tmp 165 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format 157 166 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref 158 167 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits … … 169 178 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 170 179 CALL xios(get_filegroup_attr_hdl_) & 171 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &180 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 172 181 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 173 182 … … 175 184 176 185 SUBROUTINE xios(get_filegroup_attr_hdl) & 177 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &186 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 178 187 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 179 188 … … 183 192 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled 184 193 LOGICAL (KIND=C_BOOL) :: enabled_tmp 194 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format 185 195 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref 186 196 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits … … 196 206 197 207 CALL xios(get_filegroup_attr_hdl_) & 198 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &208 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 199 209 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 200 210 … … 202 212 203 213 SUBROUTINE xios(get_filegroup_attr_hdl_) & 204 ( filegroup_hdl, description_, enabled_, group_ref_, min_digits_, name_, name_suffix_, output_freq_ & 205 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 214 ( filegroup_hdl, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ & 215 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 216 ) 206 217 207 218 IMPLICIT NONE … … 210 221 LOGICAL , OPTIONAL, INTENT(OUT) :: enabled_ 211 222 LOGICAL (KIND=C_BOOL) :: enabled__tmp 223 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format_ 212 224 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_ 213 225 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits_ … … 231 243 ENDIF 232 244 245 IF (PRESENT(format_)) THEN 246 CALL cxios_get_filegroup_format(filegroup_hdl%daddr, format_, len(format_)) 247 ENDIF 248 233 249 IF (PRESENT(group_ref_)) THEN 234 250 CALL cxios_get_filegroup_group_ref(filegroup_hdl%daddr, group_ref_, len(group_ref_)) … … 280 296 281 297 SUBROUTINE xios(is_defined_filegroup_attr) & 282 ( filegroup_id, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &298 ( filegroup_id, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 283 299 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 284 300 … … 290 306 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 291 307 LOGICAL(KIND=C_BOOL) :: enabled_tmp 308 LOGICAL, OPTIONAL, INTENT(OUT) :: format 309 LOGICAL(KIND=C_BOOL) :: format_tmp 292 310 LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref 293 311 LOGICAL(KIND=C_BOOL) :: group_ref_tmp … … 315 333 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 316 334 CALL xios(is_defined_filegroup_attr_hdl_) & 317 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &335 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 318 336 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 319 337 … … 321 339 322 340 SUBROUTINE xios(is_defined_filegroup_attr_hdl) & 323 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &341 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 324 342 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 325 343 … … 330 348 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled 331 349 LOGICAL(KIND=C_BOOL) :: enabled_tmp 350 LOGICAL, OPTIONAL, INTENT(OUT) :: format 351 LOGICAL(KIND=C_BOOL) :: format_tmp 332 352 LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref 333 353 LOGICAL(KIND=C_BOOL) :: group_ref_tmp … … 354 374 355 375 CALL xios(is_defined_filegroup_attr_hdl_) & 356 ( filegroup_hdl, description, enabled, group_ref, min_digits, name, name_suffix, output_freq &376 ( filegroup_hdl, description, enabled, format, group_ref, min_digits, name, name_suffix, output_freq & 357 377 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 358 378 … … 360 380 361 381 SUBROUTINE xios(is_defined_filegroup_attr_hdl_) & 362 ( filegroup_hdl, description_, enabled_, group_ref_, min_digits_, name_, name_suffix_, output_freq_ & 363 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 382 ( filegroup_hdl, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ & 383 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 384 ) 364 385 365 386 IMPLICIT NONE … … 369 390 LOGICAL, OPTIONAL, INTENT(OUT) :: enabled_ 370 391 LOGICAL(KIND=C_BOOL) :: enabled__tmp 392 LOGICAL, OPTIONAL, INTENT(OUT) :: format_ 393 LOGICAL(KIND=C_BOOL) :: format__tmp 371 394 LOGICAL, OPTIONAL, INTENT(OUT) :: group_ref_ 372 395 LOGICAL(KIND=C_BOOL) :: group_ref__tmp … … 402 425 ENDIF 403 426 427 IF (PRESENT(format_)) THEN 428 format__tmp=cxios_is_defined_filegroup_format(filegroup_hdl%daddr) 429 format_=format__tmp 430 ENDIF 431 404 432 IF (PRESENT(group_ref_)) THEN 405 433 group_ref__tmp=cxios_is_defined_filegroup_group_ref(filegroup_hdl%daddr) -
XIOS/trunk/src/node/file.cpp
r509 r517 322 322 } 323 323 324 bool useClassicFormat = !format.isEmpty() && format == format_attr::netcdf4_classic; 325 324 326 bool multifile=true ; 325 327 if (!type.isEmpty()) … … 369 371 } 370 372 } 371 data_out=shared_ptr<CDataOutput>(new CNc4DataOutput(oss.str(), false, fileComm, multifile, isCollective)); 373 data_out=shared_ptr<CDataOutput>(new CNc4DataOutput(oss.str(), false, useClassicFormat, 374 fileComm, multifile, isCollective)); 372 375 isOpen=true ; 373 376 -
XIOS/trunk/src/output/nc4_data_output.cpp
r501 r517 29 29 30 30 CNc4DataOutput::CNc4DataOutput 31 (const StdString & filename, bool exist, MPI_Comm comm_file,bool multifile, bool isCollective) 31 (const StdString & filename, bool exist, bool useClassicFormat, 32 MPI_Comm comm_file,bool multifile, bool isCollective) 32 33 : SuperClass() 33 , SuperClassWriter(filename, exist, &comm_file,multifile)34 , SuperClassWriter(filename, exist, useClassicFormat, &comm_file, multifile) 34 35 , comm_file(comm_file) 35 36 , filename(filename) … … 732 733 } 733 734 else 734 { 735 double * default_value = NULL; 736 SuperClassWriter::setDefaultValue(fieldid, default_value); 737 } 735 SuperClassWriter::setDefaultValue(fieldid, (double*)NULL); 738 736 739 737 { // Ecriture des coordonnées -
XIOS/trunk/src/output/nc4_data_output.hpp
r501 r517 25 25 (const StdString & filename, bool exist); 26 26 CNc4DataOutput 27 (const StdString & filename, bool exist, MPI_Comm comm_file, bool multifile, bool isCollective=true); 27 (const StdString & filename, bool exist, bool useClassicFormat, 28 MPI_Comm comm_file, bool multifile, bool isCollective=true); 28 29 29 30 CNc4DataOutput(const CNc4DataOutput & dataoutput); // Not implemented. -
XIOS/trunk/src/output/netCdfInterface.cpp
r505 r517 524 524 } 525 525 526 /*! 527 Set or unset the fill mode for a NetCDF file specified by its file id. 528 \param [in] ncid File id 529 \param [in] fill Define whether the fill mode should be enabled or not 530 \return Status code 531 */ 532 int CNetCdfInterface::setFill(int ncid, bool fill) 533 { 534 int old_fill_mode; 535 int status = nc_set_fill(ncid, fill ? NC_FILL : NC_NOFILL, &old_fill_mode); 536 if (NC_NOERR != status) 537 { 538 StdString errormsg(nc_strerror(status)); 539 StdStringStream sstr; 540 541 sstr << "Error when calling function nc_set_fill(ncid, fill ? NC_FILL : NC_NOFILL, &old_fill_mode)" << std::endl; 542 sstr << errormsg << std::endl; 543 sstr << "Unable to set the fill mode to : " << (fill ? "NC_FILL" : "NC_NOFILL") << std::endl; 544 StdString e = sstr.str(); 545 throw CNetCdfException(e); 546 } 547 548 return status; 549 } 550 526 551 /*! 527 552 This function makes a request to netcdf with a ncid, to set the fill parameters for a variable, -
XIOS/trunk/src/output/netCdfInterface.hpp
r515 r517 85 85 static int defVarChunking(int ncid, int varId, int storage, StdSize chunkSize[]); 86 86 87 //! Set or unset the fill mode 88 static int setFill(int ncid, bool fill); 89 87 90 //! Define variable fill parameters 88 91 static int defVarFill(int ncid, int varId, int noFill, void* fillValue); -
XIOS/trunk/src/output/onetcdf4.cpp
r501 r517 11 11 12 12 CONetCDF4::CONetCDF4 13 (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile)13 (const StdString & filename, bool exist, bool useClassicFormat, const MPI_Comm * comm, bool multifile) 14 14 : path() 15 , useClassicFormat(useClassicFormat) 15 16 { 16 17 this->wmpi = (comm != NULL) && !multifile; 17 this->initialize(filename, exist, comm,multifile);18 this->initialize(filename, exist, useClassicFormat, comm,multifile); 18 19 } 19 20 … … 29 30 30 31 void CONetCDF4::initialize 31 (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile) 32 { 32 (const StdString & filename, bool exist, bool useClassicFormat, const MPI_Comm * comm, bool multifile) 33 { 34 this->useClassicFormat = useClassicFormat; 35 36 int mode = useClassicFormat ? 0 : NC_NETCDF4; 37 if (!multifile) 38 mode |= useClassicFormat ? NC_PNETCDF : NC_MPIIO; 39 33 40 if (!exist) 34 41 { 35 42 if (comm != NULL) 36 43 { 37 if (!multifile) (CNetCdfInterface::createPar(filename, NC_NETCDF4|NC_MPIIO, *comm, MPI_INFO_NULL, (this->ncidp)));38 else (CNetCdfInterface::create(filename, NC_NETCDF4, this->ncidp));44 if (!multifile) CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 45 else CNetCdfInterface::create(filename, mode, this->ncidp); 39 46 } 40 else (CNetCdfInterface::create(filename, NC_NETCDF4, this->ncidp));47 else CNetCdfInterface::create(filename, mode, this->ncidp); 41 48 } 42 49 else … … 44 51 if (comm != NULL) 45 52 { 46 if (!multifile) (CNetCdfInterface::openPar(filename, NC_NETCDF4|NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp));47 else (CNetCdfInterface::open(filename, NC_NETCDF4, this->ncidp));53 if (!multifile) CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 54 else CNetCdfInterface::open(filename, mode, this->ncidp); 48 55 } 49 else (CNetCdfInterface::open(filename, NC_NETCDF4, this->ncidp)); 50 } 56 else CNetCdfInterface::open(filename, mode, this->ncidp); 57 } 58 59 // If the classic NetCDF format is used, we enable the "no-fill mode" globally. 60 // This is done per variable for the NetCDF4 format. 61 if (useClassicFormat) 62 CNetCdfInterface::setFill(this->ncidp, false); 51 63 } 52 64 … … 264 276 } 265 277 266 (CNetCdfInterface::defVar(grpid, name, type, dimids.size(), &(dimids[0]), varid)); 267 268 // set chunksize : size of one record 269 // but must not be > 2GB (netcdf or HDF5 problem) 270 totalSize=1 ; 271 for(vector<StdSize>::reverse_iterator it=dimsizes.rbegin(); it!=dimsizes.rend();++it) 272 { 273 totalSize*= *it ; 274 if (totalSize>=maxSize) *it=1 ; 275 } 276 277 (CNetCdfInterface::defVarChunking(grpid, varid, NC_CHUNKED, &(dimsizes[0]))); 278 (CNetCdfInterface::defVarFill(grpid, varid, true, NULL)); 278 CNetCdfInterface::defVar(grpid, name, type, dimids.size(), &(dimids[0]), varid); 279 280 // The classic NetCDF format does not support chunking nor fill parameters 281 if (!useClassicFormat) 282 { 283 // set chunksize : size of one record 284 // but must not be > 2GB (netcdf or HDF5 problem) 285 totalSize = 1; 286 for (vector<StdSize>::reverse_iterator it = dimsizes.rbegin(); it != dimsizes.rend(); ++it) 287 { 288 totalSize *= *it; 289 if (totalSize >= maxSize) *it = 1; 290 } 291 292 CNetCdfInterface::defVarChunking(grpid, varid, NC_CHUNKED, &dimsizes[0]); 293 CNetCdfInterface::defVarFill(grpid, varid, true, NULL); 294 } 295 279 296 return (varid); 280 297 } -
XIOS/trunk/src/output/onetcdf4.hpp
r501 r517 26 26 27 27 /// Constructeurs /// 28 CONetCDF4(const StdString & filename, bool exist, const MPI_Comm * comm = NULL, bool multifile=true); 28 CONetCDF4(const StdString & filename, bool exist, bool useClassicFormat = false, 29 const MPI_Comm * comm = NULL, bool multifile = true); 29 30 30 31 CONetCDF4(const CONetCDF4 & onetcdf4); // Not implemented. … … 33 34 34 35 /// Initialisation /// 35 void initialize(const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile); 36 void initialize(const StdString & filename, bool exist, bool useClassicFormat, 37 const MPI_Comm * comm, bool multifile); 36 38 void close(void) ; 37 39 void sync(void) ; … … 92 94 bool varExist(const StdString & varname); 93 95 96 bool useClassicFormat; //!< If true, NetCDF4 will use the classic NetCDF3 format 97 94 98 //---------------------------------------------------------------- 95 99 -
XIOS/trunk/src/output/onetcdf4_impl.hpp
r501 r517 46 46 if (value != NULL) 47 47 { 48 CNetCdfInterface::defVarFill(grpid, varid, 0, (void*)value); 48 // nc_def_var_fill will automatically set the _FillValue attribute when 49 // using the NetCDF 4 format but we need to do it manually otherwise 50 if (useClassicFormat) 51 this->addAttribute(StdString("_FillValue"), *value, &varname); 52 else 53 CNetCdfInterface::defVarFill(grpid, varid, 0, (void*)value); 49 54 this->addAttribute(StdString("missing_value"), *value, &varname); 50 55 } 51 else CNetCdfInterface::defVarFill(grpid, varid, 1, NULL); 56 else if (!useClassicFormat) 57 { 58 // The "no-fill mode" is set globally for the classic NetCDF format 59 CNetCdfInterface::defVarFill(grpid, varid, 1, NULL); 60 } 52 61 } 53 62
Note: See TracChangeset
for help on using the changeset viewer.