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, public :: tPartitionedStringList
type(tPartitionedString) :: string type(tPartitionedString) :: string
type(tPartitionedStringList), pointer :: next => null() type(tPartitionedStringList), pointer :: next => null()
contains contains
procedure :: add => add procedure :: add => add
procedure :: show => show procedure :: show => show
procedure :: free => free !procedure :: free => free
procedure :: keyExists => keyExists procedure :: keyExists => keyExists
procedure :: countKeys => countKeys procedure :: countKeys => countKeys
@ -36,6 +35,7 @@ module config
procedure :: getFloats => getFloats procedure :: getFloats => getFloats
procedure :: getInts => getInts procedure :: getInts => getInts
procedure :: getStrings => getStrings procedure :: getStrings => getStrings
final :: free
end type tPartitionedStringList end type tPartitionedStringList
@ -244,42 +244,42 @@ subroutine config_deallocate(what)
character(len=*), intent(in) :: what character(len=*), intent(in) :: what
integer(pInt) :: i integer(pInt) :: i
! select case(what) select case(what)
!
! case('material.config/phase') case('material.config/phase')
! do i=1, size(config_phase) !do i=1, size(config_phase)
! call config_phase(i)%free ! call config_phase(i)%free
! enddo !enddo
! deallocate(config_phase) deallocate(config_phase)
!
! case('material.config/microstructure') case('material.config/microstructure')
! do i=1, size(config_microstructure) !do i=1, size(config_microstructure)
! call config_microstructure(i)%free ! call config_microstructure(i)%free
! enddo !enddo
! deallocate(config_microstructure) deallocate(config_microstructure)
!
! case('material.config/crystallite') case('material.config/crystallite')
! do i=1, size(config_crystallite) !do i=1, size(config_crystallite)
! call config_crystallite(i)%free ! call config_crystallite(i)%free
! enddo !enddo
! deallocate(config_crystallite) deallocate(config_crystallite)
!
! case('material.config/homogenization') case('material.config/homogenization')
! do i=1, size(config_homogenization) !do i=1, size(config_homogenization)
! call config_homogenization(i)%free ! call config_homogenization(i)%free
! enddo !enddo
! deallocate(config_homogenization) deallocate(config_homogenization)
!
! case('material.config/texture') case('material.config/texture')
! do i=1, size(config_texture) !do i=1, size(config_texture)
! call config_texture(i)%free ! call config_texture(i)%free
! enddo !enddo
! deallocate(config_texture) deallocate(config_texture)
!
! case default case default
! call IO_error(0_pInt,ext_msg='config_deallocate') call IO_error(0_pInt,ext_msg='config_deallocate')
!
! end select end select
end subroutine config_deallocate end subroutine config_deallocate
@ -348,7 +348,7 @@ end subroutine show
subroutine free(this) subroutine free(this)
implicit none implicit none
class(tPartitionedStringList), target, intent(in) :: this type(tPartitionedStringList), target, intent(in) :: this
type(tPartitionedStringList), pointer :: new, item type(tPartitionedStringList), pointer :: new, item
if (.not. associated(this%next)) return if (.not. associated(this%next)) return