@@ -103,7 +103,7 @@ subroutine result_init(restart)
103103 if (.not. file_exists .or. .not. restart) then
104104 call result_createJobFile()
105105 call result_addAttribute(' DADF5_version_major' ,1 )
106- call result_addAttribute(' DADF5_version_minor' ,3 )
106+ call result_addAttribute(' DADF5_version_minor' ,4 )
107107 call get_command_argument(0 ,commandLine)
108108 call result_addAttribute(' creator' ,trim (commandLine)// ' ' // DAMASK_VERSION)
109109 call result_addAttribute(' created' ,now())
@@ -533,10 +533,11 @@ end subroutine result_writeVectorDataset_int
533533!- -------------------------------------------------------------------------------------------------
534534subroutine result_mapping_phase (ID ,entry ,label )
535535
536- integer , dimension (:,:), intent (in ) :: ID ! < phase ID at (co,ce)
536+ integer , dimension (:,:), intent (in ) :: ID ! < phase ID at (co,ce), 0 for padding
537537 integer , dimension (:,:), intent (in ) :: entry ! < phase entry at (co,ce)
538538 character (len=* ), dimension (:), intent (in ) :: label ! < label of each phase section
539539
540+ character (len= len (label)), dimension (size (ID,1 ),size (ID,2 )) :: labelPadded ! < phase string at (co,ce), padded with '' for empty constituents
540541 integer (pI64), dimension (size (entry ,1 ),size (entry ,2 )) :: entryGlobal
541542 integer (pI64), dimension (size (label),0 :worldsize-1 ) :: entryOffset ! < offset in entry counting per process
542543 integer (MPI_INTEGER_KIND), dimension (0 :worldsize-1 ) :: writeSize ! < amount of data written per process
@@ -580,15 +581,18 @@ subroutine result_mapping_phase(ID,entry,label)
580581 entryOffset = 0_pI64
581582 do co = 1 , size (ID,1 )
582583 do ce = 1 , size (ID,2 )
583- entryOffset(ID(co,ce),worldrank) = entryOffset(ID(co,ce),worldrank) + 1_pI64
584+ if (ID(co,ce) /= 0 ) &
585+ entryOffset(ID(co,ce),worldrank) = entryOffset(ID(co,ce),worldrank) + 1_pI64
584586 end do
585587 end do
586588 call MPI_Allreduce(MPI_IN_PLACE,entryOffset,size (entryOffset),MPI_INTEGER8 ,MPI_SUM,MPI_COMM_WORLD,err_MPI)! get offset at each process
587589 call parallelization_chkerr(err_MPI)
588590 entryOffset(:,worldrank) = sum (entryOffset(:,0 :worldrank-1 ),2 )
591+ entryGlobal = - 1_pI64
589592 do co = 1 , size (ID,1 )
590593 do ce = 1 , size (ID,2 )
591- entryGlobal(co,ce) = int (entry (co,ce),pI64) - 1_pI64 + entryOffset(ID(co,ce),worldrank)
594+ if (ID(co,ce) /= 0 ) &
595+ entryGlobal(co,ce) = int (entry (co,ce),pI64) - 1_pI64 + entryOffset(ID(co,ce),worldrank)
592596 end do
593597 end do
594598#endif
@@ -601,7 +605,7 @@ subroutine result_mapping_phase(ID,entry,label)
601605! compound type: label(ID) + entry
602606 call H5Tcopy_f(H5T_NATIVE_CHARACTER, dt_id, hdferr)
603607 call HDF5_chkerr(hdferr)
604- call H5Tset_size_f(dt_id, int (len (label( 1 ) ),SIZE_T), hdferr)
608+ call H5Tset_size_f(dt_id, int (len (label),SIZE_T), hdferr)
605609 call HDF5_chkerr(hdferr)
606610 call H5Tget_size_f(dt_id, type_size_str, hdferr)
607611 call HDF5_chkerr(hdferr)
@@ -652,10 +656,17 @@ subroutine result_mapping_phase(ID,entry,label)
652656 call H5Dcreate_f(loc_id, ' phase' , dtype_id, filespace_id, dset_id, hdferr)
653657 call HDF5_chkerr(hdferr)
654658
655- call H5Dwrite_f(dset_id, label_id, reshape (label(pack (ID,.true. )),myShape), &
659+ labelPadded = ' '
660+ do co = 1 , size (ID,1 )
661+ do ce = 1 , size (ID,2 )
662+ if (ID(co,ce) > 0 ) &
663+ labelPadded(co,ce) = label(ID(co,ce))
664+ end do
665+ end do
666+ call H5Dwrite_f(dset_id, label_id, labelPadded, &
656667 myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
657668 call HDF5_chkerr(hdferr)
658- call H5Dwrite_f(dset_id, entry_id, reshape ( pack ( entryGlobal, .true. ),myShape) , &
669+ call H5Dwrite_f(dset_id, entry_id, entryGlobal, &
659670 myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
660671 call HDF5_chkerr(hdferr)
661672
@@ -750,7 +761,7 @@ subroutine result_mapping_homogenization(ID,entry,label)
750761! compound type: label(ID) + entry
751762 call H5Tcopy_f(H5T_NATIVE_CHARACTER, dt_id, hdferr)
752763 call HDF5_chkerr(hdferr)
753- call H5Tset_size_f(dt_id, int (len (label( 1 ) ),SIZE_T), hdferr)
764+ call H5Tset_size_f(dt_id, int (len (label),SIZE_T), hdferr)
754765 call HDF5_chkerr(hdferr)
755766 call H5Tget_size_f(dt_id, type_size_str, hdferr)
756767 call HDF5_chkerr(hdferr)
@@ -801,10 +812,10 @@ subroutine result_mapping_homogenization(ID,entry,label)
801812 call H5Dcreate_f(loc_id, ' homogenization' , dtype_id, filespace_id, dset_id, hdferr)
802813 call HDF5_chkerr(hdferr)
803814
804- call H5Dwrite_f(dset_id, label_id, reshape ( label(pack (ID, .true. )),myShape ), &
815+ call H5Dwrite_f(dset_id, label_id, label(ID ), &
805816 myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
806817 call HDF5_chkerr(hdferr)
807- call H5Dwrite_f(dset_id, entry_id, reshape ( pack ( entryGlobal, .true. ),myShape) , &
818+ call H5Dwrite_f(dset_id, entry_id, entryGlobal, &
808819 myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
809820 call HDF5_chkerr(hdferr)
810821
0 commit comments