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'
This commit is contained in:
Martin Diehl 2018-08-21 08:14:59 +02:00
parent d146417abe
commit 8de321382f
1 changed files with 39 additions and 39 deletions

View File

@ -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')
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')
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')
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')
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')
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
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