finalize does not work for gfortran

This commit is contained in:
Martin Diehl 2020-04-28 10:29:13 +02:00
parent f3be26ffa2
commit 20b604a334
3 changed files with 35 additions and 22 deletions

View File

@ -10,7 +10,7 @@ module CPFEM
use FEsolving use FEsolving
use math use math
use rotations use rotations
use types use YAML_types
use discretization_marc use discretization_marc
use material use material
use config use config
@ -84,7 +84,7 @@ subroutine CPFEM_initAll(el,ip)
call config_init call config_init
call math_init call math_init
call rotations_init call rotations_init
call types_init call YAML_types_init
call HDF5_utilities_init call HDF5_utilities_init
call results_init call results_init
call discretization_marc_init(ip, el) call discretization_marc_init(ip, el)

View File

@ -11,7 +11,7 @@ module CPFEM2
use FEsolving use FEsolving
use math use math
use rotations use rotations
use types use YAML_types
use material use material
use lattice use lattice
use IO use IO
@ -51,7 +51,7 @@ subroutine CPFEM_initAll
call config_init call config_init
call math_init call math_init
call rotations_init call rotations_init
call types_init call YAML_types_init
call lattice_init call lattice_init
call HDF5_utilities_init call HDF5_utilities_init
call results_init call results_init

View File

@ -8,7 +8,7 @@
!! functions exist to convert this scalar type to its respective primitive data type. !! functions exist to convert this scalar type to its respective primitive data type.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
module types module YAML_types
use IO use IO
use prec use prec
@ -17,11 +17,12 @@ module types
private private
public tNode public :: &
public tScalar tNode, &
public tDict tScalar, &
public tList tDict, &
public types_init tList, &
YAML_types_init
type, abstract :: tNode type, abstract :: tNode
integer :: length = 0 integer :: length = 0
@ -69,7 +70,7 @@ module types
tNode_get_byKey_asString => tNode_get_byKey_asString tNode_get_byKey_asString => tNode_get_byKey_asString
procedure :: & procedure :: &
tNode_get_byKey_asStrings => tNode_get_byKey_asStrings tNode_get_byKey_asStrings => tNode_get_byKey_asStrings
generic :: & generic :: &
get => tNode_get_byIndex, & get => tNode_get_byIndex, &
tNode_get_byKey tNode_get_byKey
@ -102,7 +103,7 @@ module types
type, extends(tNode) :: tScalar type, extends(tNode) :: tScalar
character(len=:), allocatable, private :: value character(len=:), allocatable, private :: value
contains contains
procedure :: asFormattedString => tScalar_asFormattedString procedure :: asFormattedString => tScalar_asFormattedString
@ -117,7 +118,7 @@ module types
end type tScalar end type tScalar
type, extends(tNode) :: tList type, extends(tNode) :: tList
class(tItem), pointer :: first => null() class(tItem), pointer :: first => null()
contains contains
@ -131,7 +132,9 @@ module types
asBools => tList_asBools asBools => tList_asBools
procedure :: & procedure :: &
asStrings => tList_asStrings asStrings => tList_asStrings
#ifndef __GFORTRAN__
final :: tList_finalize final :: tList_finalize
#endif
end type tList end type tList
type, extends(tList) :: tDict type, extends(tList) :: tDict
@ -168,14 +171,24 @@ module types
contains contains
subroutine types_init !--------------------------------------------------------------------------------------------------
!> @brief do sanity checks
!--------------------------------------------------------------------------------------------------
subroutine YAML_types_init
write(6,'(/,a)') ' <<<+- YAML_types init -+>>>'
call unitTest call unitTest
end subroutine types_init
end subroutine YAML_types_init
!--------------------------------------------------------------------------------------------------
!> @brief check correctness of some type bound procedures
!--------------------------------------------------------------------------------------------------
subroutine unitTest subroutine unitTest
type(tScalar),target :: s1,s2 type(tScalar),target :: s1,s2
s1 = '1' s1 = '1'
if(s1%asInt() /= 1) call IO_error(0,ext_msg='tScalar_asInt') if(s1%asInt() /= 1) call IO_error(0,ext_msg='tScalar_asInt')
@ -213,7 +226,7 @@ subroutine unitTest
call l1%append(s2) call l1%append(s2)
call l2%append(l1) call l2%append(l1)
n=> l1 n=> l1
if(any(l1%asBools() .neqv. [.true., .false.])) call IO_error(0,ext_msg='tList_asBools') if(any(l1%asBools() .neqv. [.true., .false.])) call IO_error(0,ext_msg='tList_asBools')
if(any(l1%asStrings() /= ['True ','False'])) call IO_error(0,ext_msg='tList_asStrings') if(any(l1%asStrings() /= ['True ','False'])) call IO_error(0,ext_msg='tList_asStrings')
if(n%get_asBool(2)) call IO_error(0,ext_msg='byIndex_asBool') if(n%get_asBool(2)) call IO_error(0,ext_msg='byIndex_asBool')
@ -598,7 +611,7 @@ function tNode_get_byKey_asFloats(self,k) result(nodeAsFloats)
class(tNode), pointer :: node class(tNode), pointer :: node
type(tList), pointer :: list type(tList), pointer :: list
node => self%get(k) node => self%get(k)
list => node%asList() list => node%asList()
nodeAsFloats = list%asFloats() nodeAsFloats = list%asFloats()
@ -926,7 +939,7 @@ subroutine tDict_set(self,key,node)
type(tItem), pointer :: item type(tItem), pointer :: item
if (.not.associated(self%first)) then if (.not. associated(self%first)) then
allocate(self%first) allocate(self%first)
item => self%first item => self%first
self%length = 1 self%length = 1
@ -944,7 +957,7 @@ subroutine tDict_set(self,key,node)
end if end if
item%key = key item%key = key
allocate(item%node,source=node) ! ToDo: Discuss ownership (copy vs referencing) allocate(item%node,source=node)
end subroutine tDict_set end subroutine tDict_set
@ -959,7 +972,7 @@ recursive subroutine tList_finalize(self)
type (tItem),pointer :: current, & type (tItem),pointer :: current, &
next next
current => self%first current => self%first
do while (associated(current)) do while (associated(current))
next => current%next next => current%next
@ -970,4 +983,4 @@ recursive subroutine tList_finalize(self)
end subroutine tList_finalize end subroutine tList_finalize
end module types end module YAML_types