1 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/HDF5_utilities.f90"
4 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/HDF5_utilities.f90"
93 integer(SIZE_T) :: typeSize
95 write(6,
'(/,a)')
' <<<+- HDF5_Utilities init -+>>>'
100 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_Utilities_init: h5open_f')
102 call h5tget_size_f(h5t_native_integer,typesize, hdferr)
103 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_Utilities_init: h5tget_size_f (int)')
104 if (int(bit_size(0),size_t)/=typesize*8) &
105 call io_error(0,ext_msg=
'Default integer size does not match H5T_NATIVE_INTEGER')
107 call h5tget_size_f(h5t_native_double,typesize, hdferr)
108 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_Utilities_init: h5tget_size_f (double)')
109 if (int(storage_size(0.0_preal),size_t)/=typesize*8) &
110 call io_error(0,ext_msg=
'pReal does not match H5T_NATIVE_DOUBLE')
118 integer(HID_T) function hdf5_openfile(fileName,mode,parallel)
120 character(len=*),
intent(in) :: filename
121 character,
intent(in),
optional :: mode
122 logical,
intent(in),
optional :: parallel
125 integer(HID_T) :: plist_id
128 if (
present(mode))
then
134 call h5pcreate_f(h5p_file_access_f, plist_id, hdferr)
135 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_openFile: h5pcreate_f')
138 if (
present(parallel)) then;
if (parallel)
then
139 call h5pset_fapl_mpio_f(plist_id, petsc_comm_world, mpi_info_null, hdferr)
140 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_openFile: h5pset_fapl_mpio_f')
145 call h5fcreate_f(filename,h5f_acc_trunc_f,
hdf5_openfile,hdferr,access_prp = plist_id)
146 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_openFile: h5fcreate_f (w)')
147 elseif(m ==
'a')
then
148 call h5fopen_f(filename,h5f_acc_rdwr_f,
hdf5_openfile,hdferr,access_prp = plist_id)
149 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_openFile: h5fopen_f (a)')
150 elseif(m ==
'r')
then
151 call h5fopen_f(filename,h5f_acc_rdonly_f,
hdf5_openfile,hdferr,access_prp = plist_id)
152 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_openFile: h5fopen_f (r)')
154 call io_error(1,ext_msg=
'HDF5_openFile: h5fopen_f unknown access mode: '//trim(m))
157 call h5pclose_f(plist_id, hdferr)
158 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_openFile: h5pclose_f')
168 integer(HID_T),
intent(in) :: fileHandle
172 call h5fclose_f(filehandle,hdferr)
173 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_closeFile: h5fclose_f')
183 integer(HID_T),
intent(in) :: filehandle
184 character(len=*),
intent(in) :: groupname
187 integer(HID_T) :: aplist_id
191 call h5pcreate_f(h5p_group_access_f, aplist_id, hdferr)
192 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_addGroup: h5pcreate_f ('//trim(groupname)//
')')
197 call h5pset_all_coll_metadata_ops_f(aplist_id, .true., hdferr)
198 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_addGroup: h5pset_all_coll_metadata_ops_f ('//trim(groupname)//
')')
203 call h5gcreate_f(filehandle, trim(groupname),
hdf5_addgroup, hdferr, object_namelen_default_f,gapl_id = aplist_id)
204 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_addGroup: h5gcreate_f ('//trim(groupname)//
')')
206 call h5pclose_f(aplist_id,hdferr)
216 integer(HID_T),
intent(in) :: filehandle
217 character(len=*),
intent(in) :: groupname
221 integer(HID_T) :: aplist_id
222 logical :: is_collective
227 call h5pcreate_f(h5p_group_access_f, aplist_id, hdferr)
228 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_openGroup: h5pcreate_f ('//trim(groupname)//
')')
233 call h5pget_all_coll_metadata_ops_f(aplist_id, is_collective, hdferr)
234 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_openGroup: h5pset_all_coll_metadata_ops_f ('//trim(groupname)//
')')
239 call h5gopen_f(filehandle, trim(groupname),
hdf5_opengroup, hdferr, gapl_id = aplist_id)
240 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_openGroup: h5gopen_f ('//trim(groupname)//
')')
242 call h5pclose_f(aplist_id,hdferr)
252 integer(HID_T),
intent(in) :: group_id
255 call h5gclose_f(group_id, hdferr)
256 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_closeGroup: h5gclose_f (el is ID)', el = int(group_id))
266 integer(HID_T),
intent(in) :: loc_id
267 character(len=*),
intent(in),
optional :: path
270 character(len=pStringLen) :: p
272 if (
present(path))
then
279 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_objectExists: h5oexists_by_name_f')
283 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_objectExists: h5oexists_by_name_f')
294 integer(HID_T),
intent(in) :: loc_id
295 character(len=*),
intent(in) :: attrLabel, attrValue
296 character(len=*),
intent(in),
optional :: path
299 integer(HID_T) :: attr_id, space_id, type_id
300 logical :: attrExists
301 character(len=pStringLen) :: p
303 if (
present(path))
then
309 call h5screate_f(h5s_scalar_f,space_id,hdferr)
310 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5screate_f')
311 call h5tcopy_f(h5t_native_character, type_id, hdferr)
312 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5tcopy_f')
313 call h5tset_size_f(type_id, int(len_trim(attrvalue),hsize_t), hdferr)
314 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5tset_size_f')
315 call h5aexists_by_name_f(loc_id,trim(p),attrlabel,attrexists,hdferr)
316 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5aexists_by_name_f')
318 call h5adelete_by_name_f(loc_id, trim(p), attrlabel, hdferr)
319 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5adelete_by_name_f')
321 call h5acreate_by_name_f(loc_id,trim(p),trim(attrlabel),type_id,space_id,attr_id,hdferr)
322 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5acreate_f')
323 call h5awrite_f(attr_id, type_id, trim(attrvalue), int([1],hsize_t), hdferr)
324 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5awrite_f')
325 call h5aclose_f(attr_id,hdferr)
326 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5aclose_f')
327 call h5tclose_f(type_id,hdferr)
328 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5tclose_f')
329 call h5sclose_f(space_id,hdferr)
330 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_str: h5sclose_f')
340 integer(HID_T),
intent(in) :: loc_id
341 character(len=*),
intent(in) :: attrLabel
342 integer,
intent(in) :: attrValue
343 character(len=*),
intent(in),
optional :: path
346 integer(HID_T) :: attr_id, space_id
347 logical :: attrExists
348 character(len=pStringLen) :: p
350 if (
present(path))
then
356 call h5screate_f(h5s_scalar_f,space_id,hdferr)
357 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int: h5screate_f')
358 call h5aexists_by_name_f(loc_id,trim(p),attrlabel,attrexists,hdferr)
359 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int: h5aexists_by_name_f')
361 call h5adelete_by_name_f(loc_id, trim(p), attrlabel, hdferr)
362 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int: h5adelete_by_name_f')
364 call h5acreate_by_name_f(loc_id,trim(p),trim(attrlabel),h5t_native_integer,space_id,attr_id,hdferr)
365 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int: h5acreate_f')
366 call h5awrite_f(attr_id, h5t_native_integer, attrvalue, int([1],hsize_t), hdferr)
367 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int: h5awrite_f')
368 call h5aclose_f(attr_id,hdferr)
369 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int: h5tclose_f')
370 call h5sclose_f(space_id,hdferr)
371 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int: h5sclose_f')
381 integer(HID_T),
intent(in) :: loc_id
382 character(len=*),
intent(in) :: attrLabel
383 real(pReal),
intent(in) :: attrValue
384 character(len=*),
intent(in),
optional :: path
387 integer(HID_T) :: attr_id, space_id
388 logical :: attrExists
389 character(len=pStringLen) :: p
391 if (
present(path))
then
397 call h5screate_f(h5s_scalar_f,space_id,hdferr)
398 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_real: h5screate_f')
399 call h5aexists_by_name_f(loc_id,trim(p),attrlabel,attrexists,hdferr)
400 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_real: h5aexists_by_name_f')
402 call h5adelete_by_name_f(loc_id, trim(p), attrlabel, hdferr)
403 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_real: h5adelete_by_name_f')
405 call h5acreate_by_name_f(loc_id,trim(p),trim(attrlabel),h5t_native_double,space_id,attr_id,hdferr)
406 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_real: h5acreate_f')
407 call h5awrite_f(attr_id, h5t_native_double, attrvalue, int([1],hsize_t), hdferr)
408 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_real: h5awrite_f')
409 call h5aclose_f(attr_id,hdferr)
410 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_real: h5tclose_f')
411 call h5sclose_f(space_id,hdferr)
412 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_real: h5sclose_f')
422 integer(HID_T),
intent(in) :: loc_id
423 character(len=*),
intent(in) :: attrLabel
424 integer,
intent(in),
dimension(:) :: attrValue
425 character(len=*),
intent(in),
optional :: path
428 integer(HID_T) :: attr_id, space_id
429 integer(HSIZE_T),
dimension(1) :: array_size
430 logical :: attrExists
431 character(len=pStringLen) :: p
433 if (
present(path))
then
439 array_size =
size(attrvalue,kind=hsize_t)
441 call h5screate_simple_f(1, array_size, space_id, hdferr, array_size)
442 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5screate_f')
443 call h5aexists_by_name_f(loc_id,trim(p),attrlabel,attrexists,hdferr)
444 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5aexists_by_name_f')
446 call h5adelete_by_name_f(loc_id, trim(p), attrlabel, hdferr)
447 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5adelete_by_name_f')
449 call h5acreate_by_name_f(loc_id,trim(p),trim(attrlabel),h5t_native_integer,space_id,attr_id,hdferr)
450 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5acreate_f')
451 call h5awrite_f(attr_id, h5t_native_integer, attrvalue, array_size, hdferr)
452 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5awrite_f')
453 call h5aclose_f(attr_id,hdferr)
454 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5tclose_f')
455 call h5sclose_f(space_id,hdferr)
456 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5sclose_f')
466 integer(HID_T),
intent(in) :: loc_id
467 character(len=*),
intent(in) :: attrLabel
468 real(pReal),
intent(in),
dimension(:) :: attrValue
469 character(len=*),
intent(in),
optional :: path
472 integer(HID_T) :: attr_id, space_id
473 integer(HSIZE_T),
dimension(1) :: array_size
474 logical :: attrExists
475 character(len=pStringLen) :: p
477 if (
present(path))
then
483 array_size =
size(attrvalue,kind=hsize_t)
485 call h5screate_simple_f(1, array_size, space_id, hdferr, array_size)
486 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5screate_f')
487 call h5aexists_by_name_f(loc_id,trim(p),attrlabel,attrexists,hdferr)
488 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5aexists_by_name_f')
490 call h5adelete_by_name_f(loc_id, trim(p), attrlabel, hdferr)
491 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5adelete_by_name_f')
493 call h5acreate_by_name_f(loc_id,trim(p),trim(attrlabel),h5t_native_double,space_id,attr_id,hdferr)
494 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5acreate_f')
495 call h5awrite_f(attr_id, h5t_native_double, attrvalue, array_size, hdferr)
496 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5awrite_f')
497 call h5aclose_f(attr_id,hdferr)
498 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5tclose_f')
499 call h5sclose_f(space_id,hdferr)
500 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_addAttribute_int_array: h5sclose_f')
510 character(len=*),
intent(in) :: target_name, link_name
511 integer(HID_T),
intent(in) :: loc_id
513 logical :: linkExists
515 call h5lexists_f(loc_id, link_name,linkexists, hdferr)
516 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_setLink: h5lexists_soft_f ('//trim(link_name)//
')')
518 call h5ldelete_f(loc_id,link_name, hdferr)
519 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_setLink: h5ldelete_soft_f ('//trim(link_name)//
')')
521 call h5lcreate_soft_f(target_name, loc_id, link_name, hdferr)
522 if (hdferr < 0)
call io_error(1,ext_msg =
'HDF5_setLink: h5lcreate_soft_f ('//trim(target_name)//
' '//trim(link_name)//
')')
532 real(pReal),
intent(out),
dimension(:) :: dataset
533 integer(HID_T),
intent(in) :: loc_id
534 character(len=*),
intent(in) :: datasetName
535 logical,
intent(in),
optional :: parallel
537 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
538 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
540 myShape, & !< shape of the dataset (this process)
546 myshape = int(shape(dataset),hsize_t)
547 if (any(myshape(1:
size(myshape)-1) == 0))
return
551 if (
present(parallel))
then
552 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
553 mystart, totalshape, loc_id,myshape,datasetname,parallel)
555 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
556 mystart, totalshape, loc_id,myshape,datasetname,.false.)
559 call h5dread_f(dset_id, h5t_native_double,dataset,totalshape, hdferr,&
560 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
561 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_real1: h5dread_f')
563 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
572 real(pReal),
intent(out),
dimension(:,:) :: dataset
573 integer(HID_T),
intent(in) :: loc_id
574 character(len=*),
intent(in) :: datasetName
575 logical,
intent(in),
optional :: parallel
577 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
578 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
580 myShape, & !< shape of the dataset (this process)
586 myshape = int(shape(dataset),hsize_t)
587 if (any(myshape(1:
size(myshape)-1) == 0))
return
591 if (
present(parallel))
then
592 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
593 mystart, totalshape, loc_id,myshape,datasetname,parallel)
595 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
596 mystart, totalshape, loc_id,myshape,datasetname,.false.)
599 call h5dread_f(dset_id, h5t_native_double,dataset,totalshape, hdferr,&
600 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
601 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_real2: h5dread_f')
603 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
612 real(pReal),
intent(out),
dimension(:,:,:) :: dataset
613 integer(HID_T),
intent(in) :: loc_id
614 character(len=*),
intent(in) :: datasetName
615 logical,
intent(in),
optional :: parallel
617 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
618 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
620 myShape, & !< shape of the dataset (this process)
626 myshape = int(shape(dataset),hsize_t)
627 if (any(myshape(1:
size(myshape)-1) == 0))
return
631 if (
present(parallel))
then
632 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
633 mystart, totalshape, loc_id,myshape,datasetname,parallel)
635 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
636 mystart, totalshape, loc_id,myshape,datasetname,.false.)
639 call h5dread_f(dset_id, h5t_native_double,dataset,totalshape, hdferr,&
640 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
641 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_real3: h5dread_f')
643 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
652 real(pReal),
intent(out),
dimension(:,:,:,:) :: dataset
653 integer(HID_T),
intent(in) :: loc_id
654 character(len=*),
intent(in) :: datasetName
655 logical,
intent(in),
optional :: parallel
657 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
658 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
660 myShape, & !< shape of the dataset (this process)
666 myshape = int(shape(dataset),hsize_t)
667 if (any(myshape(1:
size(myshape)-1) == 0))
return
671 if (
present(parallel))
then
672 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
673 mystart, totalshape, loc_id,myshape,datasetname,parallel)
675 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
676 mystart, totalshape, loc_id,myshape,datasetname,.false.)
679 call h5dread_f(dset_id, h5t_native_double,dataset,totalshape, hdferr,&
680 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
681 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_real4: h5dread_f')
683 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
692 real(pReal),
intent(out),
dimension(:,:,:,:,:) :: dataset
693 integer(HID_T),
intent(in) :: loc_id
694 character(len=*),
intent(in) :: datasetName
695 logical,
intent(in),
optional :: parallel
697 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
698 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
700 myShape, & !< shape of the dataset (this process)
706 myshape = int(shape(dataset),hsize_t)
707 if (any(myshape(1:
size(myshape)-1) == 0))
return
711 if (
present(parallel))
then
712 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
713 mystart, totalshape, loc_id,myshape,datasetname,parallel)
715 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
716 mystart, totalshape, loc_id,myshape,datasetname,.false.)
719 call h5dread_f(dset_id, h5t_native_double,dataset,totalshape, hdferr,&
720 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
721 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_real5: h5dread_f')
723 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
732 real(pReal),
intent(out),
dimension(:,:,:,:,:,:) :: dataset
733 integer(HID_T),
intent(in) :: loc_id
734 character(len=*),
intent(in) :: datasetName
735 logical,
intent(in),
optional :: parallel
737 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
738 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
740 myShape, & !< shape of the dataset (this process)
746 myshape = int(shape(dataset),hsize_t)
747 if (any(myshape(1:
size(myshape)-1) == 0))
return
751 if (
present(parallel))
then
752 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
753 mystart, totalshape, loc_id,myshape,datasetname,parallel)
755 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
756 mystart, totalshape, loc_id,myshape,datasetname,.false.)
759 call h5dread_f(dset_id, h5t_native_double,dataset,totalshape, hdferr,&
760 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
761 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_real6: h5dread_f')
763 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
772 real(pReal),
intent(out),
dimension(:,:,:,:,:,:,:) :: dataset
773 integer(HID_T),
intent(in) :: loc_id
774 character(len=*),
intent(in) :: datasetName
775 logical,
intent(in),
optional :: parallel
777 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
778 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
780 myShape, & !< shape of the dataset (this process)
786 myshape = int(shape(dataset),hsize_t)
787 if (any(myshape(1:
size(myshape)-1) == 0))
return
791 if (
present(parallel))
then
792 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
793 mystart, totalshape, loc_id,myshape,datasetname,parallel)
795 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
796 mystart, totalshape, loc_id,myshape,datasetname,.false.)
799 call h5dread_f(dset_id, h5t_native_double,dataset,totalshape, hdferr,&
800 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
801 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_real7: h5dread_f')
803 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
813 integer,
intent(out),
dimension(:) :: dataset
814 integer(HID_T),
intent(in) :: loc_id
815 character(len=*),
intent(in) :: datasetName
816 logical,
intent(in),
optional :: parallel
819 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
820 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
822 myShape, & !< shape of the dataset (this process)
828 myshape = int(shape(dataset),hsize_t)
829 if (any(myshape(1:
size(myshape)-1) == 0))
return
833 if (
present(parallel))
then
834 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
835 mystart, totalshape, loc_id,myshape,datasetname,parallel)
837 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
838 mystart, totalshape, loc_id,myshape,datasetname,.false.)
841 call h5dread_f(dset_id, h5t_native_integer,dataset,totalshape, hdferr,&
842 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
843 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_int1: h5dread_f')
845 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
854 integer,
intent(out),
dimension(:,:) :: dataset
855 integer(HID_T),
intent(in) :: loc_id
856 character(len=*),
intent(in) :: datasetName
857 logical,
intent(in),
optional :: parallel
859 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
860 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
862 myShape, & !< shape of the dataset (this process)
868 myshape = int(shape(dataset),hsize_t)
869 if (any(myshape(1:
size(myshape)-1) == 0))
return
873 if (
present(parallel))
then
874 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
875 mystart, totalshape, loc_id,myshape,datasetname,parallel)
877 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
878 mystart, totalshape, loc_id,myshape,datasetname,.false.)
881 call h5dread_f(dset_id, h5t_native_integer,dataset,totalshape, hdferr,&
882 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
883 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_int2: h5dread_f')
885 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
894 integer,
intent(out),
dimension(:,:,:) :: dataset
895 integer(HID_T),
intent(in) :: loc_id
896 character(len=*),
intent(in) :: datasetName
897 logical,
intent(in),
optional :: parallel
899 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
900 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
902 myShape, & !< shape of the dataset (this process)
908 myshape = int(shape(dataset),hsize_t)
909 if (any(myshape(1:
size(myshape)-1) == 0))
return
913 if (
present(parallel))
then
914 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
915 mystart, totalshape, loc_id,myshape,datasetname,parallel)
917 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
918 mystart, totalshape, loc_id,myshape,datasetname,.false.)
921 call h5dread_f(dset_id, h5t_native_integer,dataset,totalshape, hdferr,&
922 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
923 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_int3: h5dread_f')
925 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
934 integer,
intent(out),
dimension(:,:,:,:) :: dataset
935 integer(HID_T),
intent(in) :: loc_id
936 character(len=*),
intent(in) :: datasetName
937 logical,
intent(in),
optional :: parallel
939 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
940 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
942 myShape, & !< shape of the dataset (this process)
948 myshape = int(shape(dataset),hsize_t)
949 if (any(myshape(1:
size(myshape)-1) == 0))
return
953 if (
present(parallel))
then
954 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
955 mystart, totalshape, loc_id,myshape,datasetname,parallel)
957 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
958 mystart, totalshape, loc_id,myshape,datasetname,.false.)
961 call h5dread_f(dset_id, h5t_native_integer,dataset,totalshape, hdferr,&
962 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
963 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_int4: h5dread_f')
965 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
974 integer,
intent(out),
dimension(:,:,:,:,:) :: dataset
975 integer(HID_T),
intent(in) :: loc_id
976 character(len=*),
intent(in) :: datasetName
977 logical,
intent(in),
optional :: parallel
979 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
980 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
982 myShape, & !< shape of the dataset (this process)
988 myshape = int(shape(dataset),hsize_t)
989 if (any(myshape(1:
size(myshape)-1) == 0))
return
993 if (
present(parallel))
then
994 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
995 mystart, totalshape, loc_id,myshape,datasetname,parallel)
997 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
998 mystart, totalshape, loc_id,myshape,datasetname,.false.)
1001 call h5dread_f(dset_id, h5t_native_integer,dataset,totalshape, hdferr,&
1002 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
1003 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_int5: h5dread_f')
1005 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
1014 integer,
intent(out),
dimension(:,:,:,:,:,:) :: dataset
1015 integer(HID_T),
intent(in) :: loc_id
1016 character(len=*),
intent(in) :: datasetName
1017 logical,
intent(in),
optional :: parallel
1019 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
1020 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1022 myShape, & !< shape of the dataset (this process)
1028 myshape = int(shape(dataset),hsize_t)
1029 if (any(myshape(1:
size(myshape)-1) == 0))
return
1033 if (
present(parallel))
then
1034 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
1035 mystart, totalshape, loc_id,myshape,datasetname,parallel)
1037 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
1038 mystart, totalshape, loc_id,myshape,datasetname,.false.)
1041 call h5dread_f(dset_id, h5t_native_integer,dataset,totalshape, hdferr,&
1042 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
1043 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_int6: h5dread_f')
1045 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
1054 integer,
intent(out),
dimension(:,:,:,:,:,:,:) :: dataset
1055 integer(HID_T),
intent(in) :: loc_id
1056 character(len=*),
intent(in) :: datasetName
1057 logical,
intent(in),
optional :: parallel
1059 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
1060 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1062 myShape, & !< shape of the dataset (this process)
1068 myshape = int(shape(dataset),hsize_t)
1069 if (any(myshape(1:
size(myshape)-1) == 0))
return
1073 if (
present(parallel))
then
1074 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
1075 mystart, totalshape, loc_id,myshape,datasetname,parallel)
1077 call initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
1078 mystart, totalshape, loc_id,myshape,datasetname,.false.)
1081 call h5dread_f(dset_id, h5t_native_integer,dataset,totalshape, hdferr,&
1082 file_space_id = filespace_id, xfer_prp = plist_id, mem_space_id = memspace_id)
1083 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_read_int7: h5dread_f')
1085 call finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
1095 real(pReal),
intent(inout),
dimension(:) :: dataset
1096 integer(HID_T),
intent(in) :: loc_id
1097 character(len=*),
intent(in) :: datasetName
1098 logical,
intent(in),
optional :: parallel
1102 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1103 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1105 myShape, & !< shape of the dataset (this process)
1110 myshape = int(shape(dataset),hsize_t)
1111 if (any(myshape(1:
size(myshape)-1) == 0))
return
1113 if (
present(parallel))
then
1115 mystart, totalshape,loc_id,myshape,datasetname,h5t_native_double,parallel)
1118 mystart, totalshape,loc_id,myshape,datasetname,h5t_native_double,.false.)
1121 if (product(totalshape) /= 0)
then
1122 call h5dwrite_f(dset_id, h5t_native_double,dataset,int(totalshape,hsize_t), hdferr,&
1123 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1124 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_real1: h5dwrite_f')
1127 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1136 real(pReal),
intent(inout),
dimension(:,:) :: dataset
1137 integer(HID_T),
intent(in) :: loc_id
1138 character(len=*),
intent(in) :: datasetName
1139 logical,
intent(in),
optional :: parallel
1143 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1144 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1146 myShape, & !< shape of the dataset (this process)
1151 myshape = int(shape(dataset),hsize_t)
1152 if (any(myshape(1:
size(myshape)-1) == 0))
return
1154 if (
present(parallel))
then
1156 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,parallel)
1159 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,.false.)
1162 if (product(totalshape) /= 0)
then
1163 call h5dwrite_f(dset_id, h5t_native_double,dataset,int(totalshape,hsize_t), hdferr,&
1164 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1165 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_real2: h5dwrite_f')
1168 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1177 real(pReal),
intent(inout),
dimension(:,:,:) :: dataset
1178 integer(HID_T),
intent(in) :: loc_id
1179 character(len=*),
intent(in) :: datasetName
1180 logical,
intent(in),
optional :: parallel
1184 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1185 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1187 myShape, & !< shape of the dataset (this process)
1192 myshape = int(shape(dataset),hsize_t)
1193 if (any(myshape(1:
size(myshape)-1) == 0))
return
1195 if (
present(parallel))
then
1197 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,parallel)
1200 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,.false.)
1203 if (product(totalshape) /= 0)
then
1204 call h5dwrite_f(dset_id, h5t_native_double,dataset,int(totalshape,hsize_t), hdferr,&
1205 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1206 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_real3: h5dwrite_f')
1209 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1218 real(pReal),
intent(inout),
dimension(:,:,:,:) :: dataset
1219 integer(HID_T),
intent(in) :: loc_id
1220 character(len=*),
intent(in) :: datasetName
1221 logical,
intent(in),
optional :: parallel
1225 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1226 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1228 myShape, & !< shape of the dataset (this process)
1233 myshape = int(shape(dataset),hsize_t)
1234 if (any(myshape(1:
size(myshape)-1) == 0))
return
1236 if (
present(parallel))
then
1238 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,parallel)
1241 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,.false.)
1244 if (product(totalshape) /= 0)
then
1245 call h5dwrite_f(dset_id, h5t_native_double,dataset,int(totalshape,hsize_t), hdferr,&
1246 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1247 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_real4: h5dwrite_f')
1250 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1260 real(pReal),
intent(inout),
dimension(:,:,:,:,:) :: dataset
1261 integer(HID_T),
intent(in) :: loc_id
1262 character(len=*),
intent(in) :: datasetName
1263 logical,
intent(in),
optional :: parallel
1267 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1268 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1270 myShape, & !< shape of the dataset (this process)
1275 myshape = int(shape(dataset),hsize_t)
1276 if (any(myshape(1:
size(myshape)-1) == 0))
return
1278 if (
present(parallel))
then
1280 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,parallel)
1283 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,.false.)
1286 if (product(totalshape) /= 0)
then
1287 call h5dwrite_f(dset_id, h5t_native_double,dataset,int(totalshape,hsize_t), hdferr,&
1288 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1289 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_real5: h5dwrite_f')
1292 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1301 real(pReal),
intent(inout),
dimension(:,:,:,:,:,:) :: dataset
1302 integer(HID_T),
intent(in) :: loc_id
1303 character(len=*),
intent(in) :: datasetName
1304 logical,
intent(in),
optional :: parallel
1308 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1309 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1311 myShape, & !< shape of the dataset (this process)
1316 myshape = int(shape(dataset),hsize_t)
1317 if (any(myshape(1:
size(myshape)-1) == 0))
return
1319 if (
present(parallel))
then
1321 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,parallel)
1324 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,.false.)
1327 if (product(totalshape) /= 0)
then
1328 call h5dwrite_f(dset_id, h5t_native_double,dataset,int(totalshape,hsize_t), hdferr,&
1329 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1330 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_real6: h5dwrite_f')
1333 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1342 real(pReal),
intent(inout),
dimension(:,:,:,:,:,:,:) :: dataset
1343 integer(HID_T),
intent(in) :: loc_id
1344 character(len=*),
intent(in) :: datasetName
1345 logical,
intent(in),
optional :: parallel
1349 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1350 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1352 myShape, & !< shape of the dataset (this process)
1357 myshape = int(shape(dataset),hsize_t)
1358 if (any(myshape(1:
size(myshape)-1) == 0))
return
1360 if (
present(parallel))
then
1362 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,parallel)
1365 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_double,.false.)
1368 if (product(totalshape) /= 0)
then
1369 call h5dwrite_f(dset_id, h5t_native_double,dataset,int(totalshape,hsize_t), hdferr,&
1370 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1371 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_real7: h5dwrite_f')
1374 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1384 integer,
intent(inout),
dimension(:) :: dataset
1385 integer(HID_T),
intent(in) :: loc_id
1386 character(len=*),
intent(in) :: datasetName
1387 logical,
intent(in),
optional :: parallel
1391 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1392 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1394 myShape, & !< shape of the dataset (this process)
1399 myshape = int(shape(dataset),hsize_t)
1400 if (any(myshape(1:
size(myshape)-1) == 0))
return
1402 if (
present(parallel))
then
1404 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,parallel)
1407 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,.false.)
1410 if (product(totalshape) /= 0)
then
1411 call h5dwrite_f(dset_id, h5t_native_integer,dataset,int(totalshape,hsize_t), hdferr,&
1412 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1413 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_int1: h5dwrite_f')
1416 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1425 integer,
intent(inout),
dimension(:,:) :: dataset
1426 integer(HID_T),
intent(in) :: loc_id
1427 character(len=*),
intent(in) :: datasetName
1428 logical,
intent(in),
optional :: parallel
1432 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1433 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1435 myShape, & !< shape of the dataset (this process)
1440 myshape = int(shape(dataset),hsize_t)
1441 if (any(myshape(1:
size(myshape)-1) == 0))
return
1443 if (
present(parallel))
then
1445 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,parallel)
1448 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,.false.)
1451 if (product(totalshape) /= 0)
then
1452 call h5dwrite_f(dset_id, h5t_native_integer,dataset,int(totalshape,hsize_t), hdferr,&
1453 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1454 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_int2: h5dwrite_f')
1457 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1466 integer,
intent(inout),
dimension(:,:,:) :: dataset
1467 integer(HID_T),
intent(in) :: loc_id
1468 character(len=*),
intent(in) :: datasetName
1469 logical,
intent(in),
optional :: parallel
1473 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1474 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1476 myShape, & !< shape of the dataset (this process)
1481 myshape = int(shape(dataset),hsize_t)
1482 if (any(myshape(1:
size(myshape)-1) == 0))
return
1484 if (
present(parallel))
then
1486 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,parallel)
1489 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,.false.)
1492 if (product(totalshape) /= 0)
then
1493 call h5dwrite_f(dset_id, h5t_native_integer,dataset,int(totalshape,hsize_t), hdferr,&
1494 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1495 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_int3: h5dwrite_f')
1498 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1507 integer,
intent(inout),
dimension(:,:,:,:) :: dataset
1508 integer(HID_T),
intent(in) :: loc_id
1509 character(len=*),
intent(in) :: datasetName
1510 logical,
intent(in),
optional :: parallel
1514 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1515 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1517 myShape, & !< shape of the dataset (this process)
1522 myshape = int(shape(dataset),hsize_t)
1523 if (any(myshape(1:
size(myshape)-1) == 0))
return
1525 if (
present(parallel))
then
1527 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,parallel)
1530 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,.false.)
1533 if (product(totalshape) /= 0)
then
1534 call h5dwrite_f(dset_id, h5t_native_integer,dataset,int(totalshape,hsize_t), hdferr,&
1535 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1536 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_int4: h5dwrite_f')
1539 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1548 integer,
intent(inout),
dimension(:,:,:,:,:) :: dataset
1549 integer(HID_T),
intent(in) :: loc_id
1550 character(len=*),
intent(in) :: datasetName
1551 logical,
intent(in),
optional :: parallel
1555 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1556 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1558 myShape, & !< shape of the dataset (this process)
1563 myshape = int(shape(dataset),hsize_t)
1564 if (any(myshape(1:
size(myshape)-1) == 0))
return
1566 if (
present(parallel))
then
1568 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,parallel)
1571 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,.false.)
1574 if (product(totalshape) /= 0)
then
1575 call h5dwrite_f(dset_id, h5t_native_integer,dataset,int(totalshape,hsize_t), hdferr,&
1576 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1577 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_int5: h5dwrite_f')
1580 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1589 integer,
intent(inout),
dimension(:,:,:,:,:,:) :: dataset
1590 integer(HID_T),
intent(in) :: loc_id
1591 character(len=*),
intent(in) :: datasetName
1592 logical,
intent(in),
optional :: parallel
1596 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1597 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1599 myShape, & !< shape of the dataset (this process)
1604 myshape = int(shape(dataset),hsize_t)
1605 if (any(myshape(1:
size(myshape)-1) == 0))
return
1607 if (
present(parallel))
then
1609 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,parallel)
1612 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,.false.)
1615 if (product(totalshape) /= 0)
then
1616 call h5dwrite_f(dset_id, h5t_native_integer,dataset,int(totalshape,hsize_t), hdferr,&
1617 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1618 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_int6: h5dwrite_f')
1621 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1630 integer,
intent(inout),
dimension(:,:,:,:,:,:,:) :: dataset
1631 integer(HID_T),
intent(in) :: loc_id
1632 character(len=*),
intent(in) :: datasetName
1633 logical,
intent(in),
optional :: parallel
1637 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id
1638 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1640 myShape, & !< shape of the dataset (this process)
1645 myshape = int(shape(dataset),hsize_t)
1646 if (any(myshape(1:
size(myshape)-1) == 0))
return
1648 if (
present(parallel))
then
1650 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,parallel)
1653 mystart, totalshape, loc_id,myshape,datasetname,h5t_native_integer,.false.)
1656 if (product(totalshape) /= 0)
then
1657 call h5dwrite_f(dset_id, h5t_native_integer,dataset,int(totalshape,hsize_t), hdferr,&
1658 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1659 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_int7: h5dwrite_f')
1662 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1674 type(
rotation),
intent(in),
dimension(:) :: dataset
1675 integer(HID_T),
intent(in) :: loc_id
1676 character(len=*),
intent(in) :: datasetName
1677 logical,
intent(in),
optional :: parallel
1680 real(pReal),
dimension(4,size(dataset)) :: dataset_asArray
1681 integer(HID_T) :: dset_id, filespace_id, memspace_id, plist_id,dtype_id,w_id,x_id,y_id,z_id
1682 integer(HSIZE_T),
dimension(size(shape(dataset))) :: &
1684 myShape, & !< shape of the dataset (this process)
1686 integer(SIZE_T) :: type_size_real
1689 do i = 1,
size(dataset)
1690 dataset_asarray(1:4,i) = dataset(i)%asQuaternion()
1695 myshape = int(shape(dataset),hsize_t)
1699 call h5tget_size_f(h5t_native_double, type_size_real, hdferr)
1701 call h5tcreate_f(h5t_compound_f, type_size_real*4_size_t, dtype_id, hdferr)
1702 call h5tinsert_f(dtype_id,
"w", type_size_real*0_size_t, h5t_native_double, hdferr)
1703 call h5tinsert_f(dtype_id,
"x", type_size_real*1_size_t, h5t_native_double, hdferr)
1704 call h5tinsert_f(dtype_id,
"y", type_size_real*2_size_t, h5t_native_double, hdferr)
1705 call h5tinsert_f(dtype_id,
"z", type_size_real*3_size_t, h5t_native_double, hdferr)
1707 if (
present(parallel))
then
1709 mystart, totalshape, loc_id,myshape,datasetname,dtype_id,parallel)
1712 mystart, totalshape, loc_id,myshape,datasetname,dtype_id,.false.)
1715 call h5pset_preserve_f(plist_id, .true., hdferr)
1717 if (product(totalshape) /= 0)
then
1718 call h5tcreate_f(h5t_compound_f, type_size_real, x_id, hdferr)
1719 call h5tinsert_f(x_id,
"x", 0_size_t, h5t_native_double, hdferr)
1720 call h5tcreate_f(h5t_compound_f, type_size_real, w_id, hdferr)
1721 call h5tinsert_f(w_id,
"w", 0_size_t, h5t_native_double, hdferr)
1722 call h5tcreate_f(h5t_compound_f, type_size_real, y_id, hdferr)
1723 call h5tinsert_f(y_id,
"y", 0_size_t, h5t_native_double, hdferr)
1724 call h5tcreate_f(h5t_compound_f, type_size_real, z_id, hdferr)
1725 call h5tinsert_f(z_id,
"z", 0_size_t, h5t_native_double, hdferr)
1727 call h5dwrite_f(dset_id, w_id,dataset_asarray(1,:),int(totalshape,hsize_t), hdferr,&
1728 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1729 call h5dwrite_f(dset_id, x_id,dataset_asarray(2,:),int(totalshape,hsize_t), hdferr,&
1730 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1731 call h5dwrite_f(dset_id, y_id,dataset_asarray(3,:),int(totalshape,hsize_t), hdferr,&
1732 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1733 call h5dwrite_f(dset_id, z_id,dataset_asarray(4,:),int(totalshape,hsize_t), hdferr,&
1734 file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
1735 if (hdferr < 0)
call io_error(1,ext_msg=
'HDF5_write_rotation: h5dwrite_f')
1738 call finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1746 subroutine initialize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id, &
1747 myStart, globalShape, &
1748 loc_id,localShape,datasetName,parallel)
1750 integer(HID_T),
intent(in) :: loc_id
1751 character(len=*),
intent(in) :: datasetName
1752 logical,
intent(in) :: parallel
1753 integer(HSIZE_T),
intent(in),
dimension(:) :: &
1755 integer(HSIZE_T),
intent(out),
dimension(size(localShape,1)):: &
1758 integer(HID_T),
intent(out) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
1760 integer,
dimension(worldsize) :: &
1767 call h5pcreate_f(h5p_dataset_xfer_f, plist_id, hdferr)
1768 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5pcreate_f')
1772 readsize(
worldrank+1) = int(localshape(ubound(localshape,1)))
1775 call h5pset_dxpl_mpio_f(plist_id, h5fd_mpio_collective_f, hdferr)
1776 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5pset_dxpl_mpio_f')
1777 call mpi_allreduce(mpi_in_place,readsize,
worldsize,mpi_int,mpi_sum,petsc_comm_world,ierr)
1778 if (ierr /= 0)
call io_error(894,ext_msg=
'initialize_read: MPI_allreduce')
1781 mystart = int(0,hsize_t)
1782 mystart(ubound(mystart)) = int(sum(readsize(1:
worldrank)),hsize_t)
1783 globalshape = [localshape(1:ubound(localshape,1)-1),int(sum(readsize),hsize_t)]
1787 call h5screate_simple_f(
size(localshape), localshape, memspace_id, hdferr, localshape)
1788 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5screate_simple_f/memspace_id')
1792 call h5pcreate_f(h5p_dataset_access_f, aplist_id, hdferr)
1793 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5pcreate_f')
1795 call h5pset_all_coll_metadata_ops_f(aplist_id, .true., hdferr)
1796 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5pset_all_coll_metadata_ops_f')
1801 call h5dopen_f(loc_id,datasetname,dset_id,hdferr, dapl_id = aplist_id)
1802 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5dopen_f')
1803 call h5dget_space_f(dset_id, filespace_id, hdferr)
1804 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5dget_space_f')
1808 call h5sselect_hyperslab_f(filespace_id, h5s_select_set_f, mystart, localshape, hdferr)
1809 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_read: h5sselect_hyperslab_f')
1817 subroutine finalize_read(dset_id, filespace_id, memspace_id, plist_id, aplist_id)
1819 integer(HID_T),
intent(in) :: dset_id, filespace_id, memspace_id, plist_id, aplist_id
1822 call h5pclose_f(plist_id, hdferr)
1823 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_read: plist_id')
1824 call h5pclose_f(aplist_id, hdferr)
1825 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_read: aplist_id')
1826 call h5dclose_f(dset_id, hdferr)
1827 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_read: h5dclose_f')
1828 call h5sclose_f(filespace_id, hdferr)
1829 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_read: h5sclose_f/filespace_id')
1830 call h5sclose_f(memspace_id, hdferr)
1831 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_read: h5sclose_f/memspace_id')
1839 subroutine initialize_write(dset_id, filespace_id, memspace_id, plist_id, &
1840 myStart, totalShape, &
1841 loc_id,myShape,datasetName,datatype,parallel)
1843 integer(HID_T),
intent(in) :: loc_id
1844 character(len=*),
intent(in) :: datasetName
1845 logical,
intent(in) :: parallel
1846 integer(HID_T),
intent(in) :: datatype
1847 integer(HSIZE_T),
intent(in),
dimension(:) :: &
1849 integer(HSIZE_T),
intent(out),
dimension(size(myShape,1)):: &
1852 integer(HID_T),
intent(out) :: dset_id, filespace_id, memspace_id, plist_id
1854 integer,
dimension(worldsize) :: &
1861 call h5pcreate_f(h5p_dataset_xfer_f, plist_id, hdferr)
1862 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_write: h5pcreate_f')
1865 call h5pset_dxpl_mpio_f(plist_id, h5fd_mpio_collective_f, hdferr)
1866 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_write: h5pset_dxpl_mpio_f')
1873 writesize(
worldrank+1) = int(myshape(ubound(myshape,1)))
1876 call mpi_allreduce(mpi_in_place,writesize,
worldsize,mpi_int,mpi_sum,petsc_comm_world,ierr)
1877 if (ierr /= 0)
call io_error(894,ext_msg=
'initialize_write: MPI_allreduce')
1880 mystart = int(0,hsize_t)
1881 mystart(ubound(mystart)) = int(sum(writesize(1:
worldrank)),hsize_t)
1882 totalshape = [myshape(1:ubound(myshape,1)-1),int(sum(writesize),hsize_t)]
1886 call h5screate_simple_f(
size(myshape), myshape, memspace_id, hdferr, myshape)
1887 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_write: h5dopen_f')
1888 call h5screate_simple_f(
size(totalshape), totalshape, filespace_id, hdferr, totalshape)
1889 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_write: h5dget_space_f')
1893 call h5dcreate_f(loc_id, trim(datasetname), datatype, filespace_id, dset_id, hdferr)
1894 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_write: h5dcreate_f')
1895 call h5sselect_hyperslab_f(filespace_id, h5s_select_set_f, mystart, myshape, hdferr)
1896 if (hdferr < 0)
call io_error(1,ext_msg=
'initialize_write: h5sselect_hyperslab_f')
1904 subroutine finalize_write(plist_id, dset_id, filespace_id, memspace_id)
1906 integer(HID_T),
intent(in) :: dset_id, filespace_id, memspace_id, plist_id
1909 call h5pclose_f(plist_id, hdferr)
1910 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_write: plist_id')
1911 call h5dclose_f(dset_id, hdferr)
1912 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_write: h5dclose_f')
1913 call h5sclose_f(filespace_id, hdferr)
1914 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_write: h5sclose_f/filespace_id')
1915 call h5sclose_f(memspace_id, hdferr)
1916 if (hdferr < 0)
call io_error(1,ext_msg=
'finalize_write: h5sclose_f/memspace_id')