Merge branch 'YAML-polishing' into 'development'
polishing See merge request damask/DAMASK!506
This commit is contained in:
commit
fc7c165afb
|
@ -119,7 +119,7 @@ module YAML_types
|
|||
|
||||
type, extends(tNode), public :: tList
|
||||
|
||||
class(tItem), pointer :: first => null()
|
||||
class(tItem), pointer :: first => NULL()
|
||||
|
||||
contains
|
||||
procedure :: asFormattedString => tList_asFormattedString
|
||||
|
@ -146,8 +146,8 @@ module YAML_types
|
|||
|
||||
type :: tItem
|
||||
character(len=:), allocatable :: key
|
||||
class(tNode), pointer :: node => null()
|
||||
class(tItem), pointer :: next => null()
|
||||
class(tNode), pointer :: node => NULL()
|
||||
class(tItem), pointer :: next => NULL()
|
||||
|
||||
contains
|
||||
final :: tItem_finalize
|
||||
|
@ -334,9 +334,12 @@ function tNode_asScalar(self) result(scalar)
|
|||
class(tNode), intent(in), target :: self
|
||||
class(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
select type(self)
|
||||
class is(tScalar)
|
||||
scalar => self
|
||||
class default
|
||||
nullify(scalar)
|
||||
end select
|
||||
|
||||
end function tNode_asScalar
|
||||
|
@ -350,9 +353,12 @@ function tNode_asList(self) result(list)
|
|||
class(tNode), intent(in), target :: self
|
||||
class(tList), pointer :: list
|
||||
|
||||
|
||||
select type(self)
|
||||
class is(tList)
|
||||
list => self
|
||||
class default
|
||||
nullify(list)
|
||||
end select
|
||||
|
||||
end function tNode_asList
|
||||
|
@ -366,9 +372,12 @@ function tNode_asDict(self) result(dict)
|
|||
class(tNode), intent(in), target :: self
|
||||
class(tDict), pointer :: dict
|
||||
|
||||
|
||||
select type(self)
|
||||
class is(tDict)
|
||||
dict => self
|
||||
class default
|
||||
nullify(dict)
|
||||
end select
|
||||
|
||||
end function tNode_asDict
|
||||
|
@ -387,6 +396,7 @@ function tNode_get_byIndex(self,i) result(node)
|
|||
class(tItem), pointer :: item
|
||||
integer :: j
|
||||
|
||||
|
||||
select type(self)
|
||||
class is(tList)
|
||||
self_ => self%asList()
|
||||
|
@ -411,15 +421,14 @@ end function tNode_get_byIndex
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_asFloat(self,i) result(nodeAsFloat)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
real(pReal) :: nodeAsFloat
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsFloat = scalar%asFloat()
|
||||
|
@ -435,15 +444,15 @@ end function tNode_get_byIndex_asFloat
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_asInt(self,i) result(nodeAsInt)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
integer :: nodeAsInt
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsInt = scalar%asInt()
|
||||
|
@ -459,15 +468,14 @@ end function tNode_get_byIndex_asInt
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_asBool(self,i) result(nodeAsBool)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
logical :: nodeAsBool
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsBool = scalar%asBool()
|
||||
|
@ -483,15 +491,14 @@ end function tNode_get_byIndex_asBool
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_asString(self,i) result(nodeAsString)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
character(len=:), allocatable :: nodeAsString
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsString = scalar%asString()
|
||||
|
@ -507,15 +514,14 @@ end function tNode_get_byIndex_asString
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_as1dFloat(self,i) result(nodeAs1dFloat)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
real(pReal), dimension(:), allocatable :: nodeAs1dFloat
|
||||
|
||||
class(tNode), pointer :: node
|
||||
class(tList), pointer :: list
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dFloat = list%as1dFloat()
|
||||
|
@ -531,15 +537,14 @@ end function tNode_get_byIndex_as1dFloat
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_as1dInt(self,i) result(nodeAs1dInt)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
integer, dimension(:), allocatable :: nodeAs1dInt
|
||||
|
||||
class(tNode), pointer :: node
|
||||
class(tList), pointer :: list
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dInt = list%as1dInt()
|
||||
|
@ -555,15 +560,14 @@ end function tNode_get_byIndex_as1dInt
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_as1dBool(self,i) result(nodeAs1dBool)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
logical, dimension(:), allocatable :: nodeAs1dBool
|
||||
|
||||
class(tNode), pointer :: node
|
||||
class(tList), pointer :: list
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dBool = list%as1dBool()
|
||||
|
@ -579,15 +583,14 @@ end function tNode_get_byIndex_as1dBool
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byIndex_as1dString(self,i) result(nodeAs1dString)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
integer, intent(in) :: i
|
||||
character(len=:), allocatable, dimension(:) :: nodeAs1dString
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tList), pointer :: list
|
||||
|
||||
node => self%get(i)
|
||||
select type(node)
|
||||
|
||||
select type(node => self%get(i))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dString = list%as1dString()
|
||||
|
@ -611,6 +614,7 @@ function tNode_get_byIndex_asKey(self,i) result(key)
|
|||
type(tDict), pointer :: dict
|
||||
type(tItem), pointer :: item
|
||||
|
||||
|
||||
select type(self)
|
||||
class is(tDict)
|
||||
dict => self%asDict()
|
||||
|
@ -638,6 +642,7 @@ function tNode_getKeys(self) result(keys)
|
|||
character(len=pStringLen), dimension(:), allocatable :: temp
|
||||
integer :: j, l
|
||||
|
||||
|
||||
allocate(temp(self%length))
|
||||
l = 0
|
||||
do j = 1, self%length
|
||||
|
@ -741,17 +746,16 @@ end function tNode_get_byKey
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_asFloat(self,k,defaultVal) result(nodeAsFloat)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
real(pReal), intent(in), optional :: defaultVal
|
||||
real(pReal) :: nodeAsFloat
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsFloat = scalar%asFloat()
|
||||
|
@ -772,17 +776,16 @@ end function tNode_get_byKey_asFloat
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_asInt(self,k,defaultVal) result(nodeAsInt)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
integer, intent(in), optional :: defaultVal
|
||||
integer :: nodeAsInt
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsInt = scalar%asInt()
|
||||
|
@ -803,17 +806,16 @@ end function tNode_get_byKey_asInt
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_asBool(self,k,defaultVal) result(nodeAsBool)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
logical, intent(in), optional :: defaultVal
|
||||
logical :: nodeAsBool
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsBool = scalar%asBool()
|
||||
|
@ -834,17 +836,16 @@ end function tNode_get_byKey_asBool
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_asString(self,k,defaultVal) result(nodeAsString)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
character(len=*), intent(in), optional :: defaultVal
|
||||
character(len=:), allocatable :: nodeAsString
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tScalar)
|
||||
scalar => node%asScalar()
|
||||
nodeAsString = scalar%asString()
|
||||
|
@ -865,19 +866,18 @@ end function tNode_get_byKey_asString
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_as1dFloat(self,k,defaultVal,requiredSize) result(nodeAs1dFloat)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
real(pReal), intent(in), dimension(:), optional :: defaultVal
|
||||
integer, intent(in), optional :: requiredSize
|
||||
|
||||
real(pReal), dimension(:), allocatable :: nodeAs1dFloat
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tList), pointer :: list
|
||||
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dFloat = list%as1dFloat()
|
||||
|
@ -902,19 +902,18 @@ end function tNode_get_byKey_as1dFloat
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_as2dFloat(self,k,defaultVal,requiredShape) result(nodeAs2dFloat)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
real(pReal), intent(in), dimension(:,:), optional :: defaultVal
|
||||
integer, intent(in), dimension(2), optional :: requiredShape
|
||||
|
||||
real(pReal), dimension(:,:), allocatable :: nodeAs2dFloat
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tList), pointer :: rows
|
||||
|
||||
|
||||
if(self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tList)
|
||||
rows => node%asList()
|
||||
nodeAs2dFloat = rows%as2dFloat()
|
||||
|
@ -939,18 +938,16 @@ end function tNode_get_byKey_as2dFloat
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_as1dInt(self,k,defaultVal,requiredSize) result(nodeAs1dInt)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
integer, dimension(:), intent(in), optional :: defaultVal
|
||||
integer, intent(in), optional :: requiredSize
|
||||
integer, dimension(:), allocatable :: nodeAs1dInt
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tList), pointer :: list
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dInt = list%as1dInt()
|
||||
|
@ -975,17 +972,16 @@ end function tNode_get_byKey_as1dInt
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_as1dBool(self,k,defaultVal) result(nodeAs1dBool)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
logical, dimension(:), intent(in), optional :: defaultVal
|
||||
logical, dimension(:), allocatable :: nodeAs1dBool
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tList), pointer :: list
|
||||
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dBool = list%as1dBool()
|
||||
|
@ -1006,17 +1002,16 @@ end function tNode_get_byKey_as1dBool
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
function tNode_get_byKey_as1dString(self,k,defaultVal) result(nodeAs1dString)
|
||||
|
||||
class(tNode), intent(in), target :: self
|
||||
class(tNode), intent(in) :: self
|
||||
character(len=*), intent(in) :: k
|
||||
character(len=*), intent(in), dimension(:), optional :: defaultVal
|
||||
character(len=:), allocatable, dimension(:) :: nodeAs1dString
|
||||
|
||||
class(tNode), pointer :: node
|
||||
type(tList), pointer :: list
|
||||
|
||||
|
||||
if (self%contains(k)) then
|
||||
node => self%get(k)
|
||||
select type(node)
|
||||
select type(node => self%get(k))
|
||||
class is(tList)
|
||||
list => node%asList()
|
||||
nodeAs1dString = list%as1dString()
|
||||
|
@ -1218,6 +1213,7 @@ function tList_as1dFloat(self)
|
|||
type(tItem), pointer :: item
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
allocate(tList_as1dFloat(self%length))
|
||||
item => self%first
|
||||
do i = 1, self%length
|
||||
|
@ -1241,6 +1237,7 @@ function tList_as2dFloat(self)
|
|||
class(tNode), pointer :: row
|
||||
type(tList), pointer :: row_data
|
||||
|
||||
|
||||
row => self%get(1)
|
||||
row_data => row%asList()
|
||||
allocate(tList_as2dFloat(self%length,row_data%length))
|
||||
|
@ -1267,6 +1264,7 @@ function tList_as1dInt(self)
|
|||
type(tItem), pointer :: item
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
allocate(tList_as1dInt(self%length))
|
||||
item => self%first
|
||||
do i = 1, self%length
|
||||
|
@ -1290,6 +1288,7 @@ function tList_as1dBool(self)
|
|||
type(tItem), pointer :: item
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
allocate(tList_as1dBool(self%length))
|
||||
item => self%first
|
||||
do i = 1, self%length
|
||||
|
@ -1313,6 +1312,7 @@ function tList_as1dString(self)
|
|||
type(tItem), pointer :: item
|
||||
type(tScalar), pointer :: scalar
|
||||
|
||||
|
||||
len_max = 0
|
||||
item => self%first
|
||||
do i = 1, self%length
|
||||
|
|
Loading…
Reference in New Issue