From f78c422af9cc49eb15666d9300f524625502c956 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 27 Feb 2022 03:12:30 +0100 Subject: [PATCH] easier to understand the condition is there to avoid problems if the dataset is not created because it is empty (e.g. requesting xi_sl for Nslip=[0]) --- src/results.f90 | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/results.f90 b/src/results.f90 index 11728e595..9fccff03e 100644 --- a/src/results.f90 +++ b/src/results.f90 @@ -388,14 +388,11 @@ subroutine results_writeVectorDataset_real(dataset,group,label,description,SIuni integer(HID_T) :: groupHandle - if (present(systems)) then - if (size(systems)*size(dataset,2) == 0 ) return !ToDo: maybe also implement for other results_write (not sure about scalar) - end if - groupHandle = results_openGroup(group) call HDF5_write(dataset,groupHandle,label) call executionStamp(group//'/'//label,description,SIunit) - if (present(systems)) call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) + if (present(systems) .and. HDF5_objectExists(groupHandle,label)) & + call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) call HDF5_closeGroup(groupHandle) end subroutine results_writeVectorDataset_real @@ -454,14 +451,11 @@ subroutine results_writeVectorDataset_int(dataset,group,label,description,SIunit integer(HID_T) :: groupHandle - if (present(systems)) then - if (size(systems) == 0 ) return !ToDo: maybe also implement for other results_write (not sure about scalar) - end if - groupHandle = results_openGroup(group) call HDF5_write(dataset,groupHandle,label) call executionStamp(group//'/'//label,description,SIunit) - if (present(systems)) call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) + if (present(systems) .and. HDF5_objectExists(groupHandle,label)) & + call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) call HDF5_closeGroup(groupHandle) end subroutine results_writeVectorDataset_int