From 8de321382f94c36a66f58189c634aab81fbf35ba Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 21 Aug 2018 08:14:59 +0200 Subject: [PATCH] using final seems to be the better approach http://www.training.prace-ri.eu/uploads/tx_pracetmo/AdvFTN_handout.pdf still needs in-depth analysis, even though I cannot reproduce 'terminally ill' --- src/config.f90 | 78 +++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/config.f90 b/src/config.f90 index 08d1ace5a..05da341d4 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -20,11 +20,10 @@ module config type, public :: tPartitionedStringList type(tPartitionedString) :: string type(tPartitionedStringList), pointer :: next => null() - contains procedure :: add => add procedure :: show => show - procedure :: free => free + !procedure :: free => free procedure :: keyExists => keyExists procedure :: countKeys => countKeys @@ -36,6 +35,7 @@ module config procedure :: getFloats => getFloats procedure :: getInts => getInts procedure :: getStrings => getStrings + final :: free end type tPartitionedStringList @@ -244,42 +244,42 @@ subroutine config_deallocate(what) character(len=*), intent(in) :: what integer(pInt) :: i -! select case(what) -! -! case('material.config/phase') -! do i=1, size(config_phase) -! call config_phase(i)%free -! enddo -! deallocate(config_phase) -! -! case('material.config/microstructure') -! do i=1, size(config_microstructure) -! call config_microstructure(i)%free -! enddo -! deallocate(config_microstructure) -! -! case('material.config/crystallite') -! do i=1, size(config_crystallite) -! call config_crystallite(i)%free -! enddo -! deallocate(config_crystallite) -! -! case('material.config/homogenization') -! do i=1, size(config_homogenization) -! call config_homogenization(i)%free -! enddo -! deallocate(config_homogenization) -! -! case('material.config/texture') -! do i=1, size(config_texture) -! call config_texture(i)%free -! enddo -! deallocate(config_texture) -! -! case default -! call IO_error(0_pInt,ext_msg='config_deallocate') -! -! end select + select case(what) + + case('material.config/phase') + !do i=1, size(config_phase) + ! call config_phase(i)%free + !enddo + deallocate(config_phase) + + case('material.config/microstructure') + !do i=1, size(config_microstructure) + ! call config_microstructure(i)%free + !enddo + deallocate(config_microstructure) + + case('material.config/crystallite') + !do i=1, size(config_crystallite) + ! call config_crystallite(i)%free + !enddo + deallocate(config_crystallite) + + case('material.config/homogenization') + !do i=1, size(config_homogenization) + ! call config_homogenization(i)%free + !enddo + deallocate(config_homogenization) + + case('material.config/texture') + !do i=1, size(config_texture) + ! call config_texture(i)%free + !enddo + deallocate(config_texture) + + case default + call IO_error(0_pInt,ext_msg='config_deallocate') + + end select end subroutine config_deallocate @@ -348,7 +348,7 @@ end subroutine show subroutine free(this) implicit none - class(tPartitionedStringList), target, intent(in) :: this + type(tPartitionedStringList), target, intent(in) :: this type(tPartitionedStringList), pointer :: new, item if (.not. associated(this%next)) return