use variable string length

for array, padding is needed to get same length
This commit is contained in:
Martin Diehl 2020-12-06 13:32:20 +01:00
parent 52e3fb50bc
commit bc4361c2ae
4 changed files with 22 additions and 16 deletions

View File

@ -175,7 +175,7 @@ end subroutine HDF5_closeFile
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
integer(HID_T) function HDF5_addGroup(fileHandle,groupName) integer(HID_T) function HDF5_addGroup(fileHandle,groupName)
integer(HID_T), intent(in) :: fileHandle integer(HID_T), intent(in) :: fileHandle
character(len=*), intent(in) :: groupName character(len=*), intent(in) :: groupName
integer :: hdferr integer :: hdferr

View File

@ -454,10 +454,10 @@ end subroutine constitutive_plastic_LpAndItsTangents
module subroutine plastic_results module subroutine plastic_results
integer :: p integer :: p
character(len=pStringLen) :: group character(len=:), allocatable :: group
plasticityLoop: do p=1,size(material_name_phase) plasticityLoop: do p=1,size(material_name_phase)
group = trim('current/phase')//'/'//trim(material_name_phase(p)) group = '/current/phase/'//trim(material_name_phase(p))
call results_closeGroup(results_addGroup(group)) call results_closeGroup(results_addGroup(group))
group = trim(group)//'/plastic' group = trim(group)//'/plastic'

View File

@ -52,7 +52,7 @@ module material
HOMOGENIZATION_RGC_ID HOMOGENIZATION_RGC_ID
end enum end enum
character(len=pStringLen), public, protected, allocatable, dimension(:) :: & character(len=:), public, protected, allocatable, dimension(:) :: &
material_name_phase, & !< name of each phase material_name_phase, & !< name of each phase
material_name_homogenization !< name of each homogenization material_name_homogenization !< name of each homogenization
@ -392,13 +392,21 @@ end subroutine sanityCheck
function getKeys(dict) function getKeys(dict)
class(tNode), intent(in) :: dict class(tNode), intent(in) :: dict
character(len=pStringLen), dimension(:), allocatable :: getKeys character(len=:), dimension(:), allocatable :: getKeys
character(len=pStringLen), dimension(:), allocatable :: temp
integer :: i integer :: i,l
allocate(getKeys(dict%length)) allocate(temp(dict%length))
l = 0
do i=1, dict%length do i=1, dict%length
getKeys(i) = dict%getKey(i) temp(i) = dict%getKey(i)
l = max(len_trim(temp(i)),l)
enddo
allocate(character(l)::getKeys(dict%length))
do i=1, dict%length
getKeys(i) = trim(temp(i))
enddo enddo
end function getKeys end function getKeys

View File

@ -503,8 +503,8 @@ end subroutine results_writeScalarDataset_rotation
subroutine results_mapping_constituent(phaseAt,memberAtLocal,label) subroutine results_mapping_constituent(phaseAt,memberAtLocal,label)
integer, dimension(:,:), intent(in) :: phaseAt !< phase section at (constituent,element) integer, dimension(:,:), intent(in) :: phaseAt !< phase section at (constituent,element)
integer, dimension(:,:,:), intent(in) :: memberAtLocal !< phase member at (constituent,IP,element) integer, dimension(:,:,:), intent(in) :: memberAtLocal !< phase member at (constituent,IP,element)
character(len=pStringLen), dimension(:), intent(in) :: label !< label of each phase section character(len=*), dimension(:), intent(in) :: label !< label of each phase section
integer, dimension(size(memberAtLocal,1),size(memberAtLocal,2),size(memberAtLocal,3)) :: & integer, dimension(size(memberAtLocal,1),size(memberAtLocal,2),size(memberAtLocal,3)) :: &
phaseAtMaterialpoint, & phaseAtMaterialpoint, &
@ -527,7 +527,6 @@ subroutine results_mapping_constituent(phaseAt,memberAtLocal,label)
plist_id, & plist_id, &
dt_id dt_id
integer(SIZE_T) :: type_size_string, type_size_int integer(SIZE_T) :: type_size_string, type_size_int
integer :: hdferr, ierr, i integer :: hdferr, ierr, i
@ -571,10 +570,10 @@ subroutine results_mapping_constituent(phaseAt,memberAtLocal,label)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
memberOffset = 0 memberOffset = 0
do i=1, size(label) do i=1, size(label)
memberOffset(i,worldrank) = count(phaseAt == i)*size(memberAtLocal,2) ! number of points/instance of this process memberOffset(i,worldrank) = count(phaseAt == i)*size(memberAtLocal,2) ! number of points/instance of this process
enddo enddo
writeSize = 0 writeSize = 0
writeSize(worldrank) = size(memberAtLocal(1,:,:)) ! total number of points by this process writeSize(worldrank) = size(memberAtLocal(1,:,:)) ! total number of points by this process
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! MPI settings and communication ! MPI settings and communication
@ -658,8 +657,8 @@ end subroutine results_mapping_constituent
subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label) subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label)
integer, dimension(:), intent(in) :: homogenizationAt !< homogenization section at (element) integer, dimension(:), intent(in) :: homogenizationAt !< homogenization section at (element)
integer, dimension(:,:), intent(in) :: memberAtLocal !< homogenization member at (IP,element) integer, dimension(:,:), intent(in) :: memberAtLocal !< homogenization member at (IP,element)
character(len=pStringLen), dimension(:), intent(in) :: label !< label of each homogenization section character(len=*), dimension(:), intent(in) :: label !< label of each homogenization section
integer, dimension(size(memberAtLocal,1),size(memberAtLocal,2)) :: & integer, dimension(size(memberAtLocal,1),size(memberAtLocal,2)) :: &
homogenizationAtMaterialpoint, & homogenizationAtMaterialpoint, &
@ -682,7 +681,6 @@ subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label)
plist_id, & plist_id, &
dt_id dt_id
integer(SIZE_T) :: type_size_string, type_size_int integer(SIZE_T) :: type_size_string, type_size_int
integer :: hdferr, ierr, i integer :: hdferr, ierr, i