shorter logic for addSetupFile

This commit is contained in:
Philip Eisenlohr 2023-07-11 16:11:59 -04:00
parent 0e7c9f101c
commit 4d8fc08a2f
1 changed files with 10 additions and 15 deletions

View File

@ -226,24 +226,19 @@ subroutine result_addSetupFile(content,fname,description)
character(len=*), intent(in) :: content, fname, description character(len=*), intent(in) :: content, fname, description
integer(HID_T) :: groupHandle integer(HID_T) :: groupHandle
character(len=:), allocatable :: fname_ character(len=:), allocatable :: name,suffix
integer :: i integer :: i
groupHandle = result_openGroup('setup') groupHandle = result_openGroup('setup')
fname_ = fname(scan(fname,'/',.true.)+1:) name = fname(scan(fname,'/',.true.)+1:)
if (.not. HDF5_objectExists(groupHandle,fname_)) then suffix = ''
call result_writeDataset_str(content,'setup',fname_,description) i = 0
else
i = 1 do while (HDF5_objectExists(groupHandle,name//suffix))
do
fname_ = fname(scan(fname,'/',.true.)+1:)//'.'//IO_intAsStr(i)
if (.not. HDF5_objectExists(groupHandle,fname_)) then
call result_writeDataset_str(content,'setup',fname_,description)
exit
i = i+1 i = i+1
end if suffix = '.'//IO_intAsStr(i)
end do end do
end if call result_writeDataset_str(content,'setup',name//suffix,description)
call result_closeGroup(groupHandle) call result_closeGroup(groupHandle)
end subroutine result_addSetupFile end subroutine result_addSetupFile