naming scheme as in Python library

This commit is contained in:
Martin Diehl 2023-12-14 06:09:37 +01:00 committed by achalhp
parent 30ca657706
commit 883aed9092
9 changed files with 35 additions and 35 deletions

View File

@ -21,7 +21,7 @@
#include "../misc.f90"
#include "../IO.f90"
#include "../types.f90"
#include "../YAML_parse.f90"
#include "../YAML.f90"
#include "../HDF5_utilities.f90"
module DAMASK_interface

View File

@ -8,7 +8,7 @@ module materialpoint_Marc
use prec
use IO
use types
use YAML_parse
use YAML
use HDF5_utilities
use result
use config
@ -71,7 +71,7 @@ subroutine materialpoint_initAll()
call prec_init()
call IO_init()
call types_init()
call YAML_parse_init()
call YAML_init()
call HDF5_utilities_init()
call result_init(.false.)
call config_init()

View File

@ -4,7 +4,7 @@
!> @brief Parser for YAML files.
!> @details Module converts a YAML input file to an equivalent YAML flow style which is then parsed.
!----------------------------------------------------------------------------------------------------
module YAML_parse
module YAML
use prec
use misc
use IO
@ -17,9 +17,9 @@ module YAML_parse
private
public :: &
YAML_parse_init, &
YAML_parse_str_asList, &
YAML_parse_str_asDict
YAML_init, &
YAML_str_asList, &
YAML_str_asDict
#ifdef FYAML
interface
@ -42,23 +42,23 @@ contains
!--------------------------------------------------------------------------------------------------
!> @brief Do sanity checks.
!--------------------------------------------------------------------------------------------------
subroutine YAML_parse_init()
subroutine YAML_init()
print'(/,1x,a)', '<<<+- YAML_parse init -+>>>'
print'(/,1x,a)', '<<<+- YAML init -+>>>'
#ifdef FYAML
print'(/,1x,a)', 'libfyaml powered'
#else
call YAML_parse_selfTest()
call YAML_selfTest()
#endif
end subroutine YAML_parse_init
end subroutine YAML_init
!--------------------------------------------------------------------------------------------------
!> @brief Parse a YAML string with list at root into a structure of nodes.
!> @details The string needs to end with a newline (unless using libfyaml).
!--------------------------------------------------------------------------------------------------
function YAML_parse_str_asList(str) result(list)
function YAML_str_asList(str) result(list)
character(len=*), intent(in) :: str
type(tList), pointer :: list
@ -69,14 +69,14 @@ function YAML_parse_str_asList(str) result(list)
node => parse_flow(to_flow(str))
list => node%asList()
end function YAML_parse_str_asList
end function YAML_str_asList
!--------------------------------------------------------------------------------------------------
!> @brief Parse a YAML string with dict at root into a structure of nodes.
!> @details The string needs to end with a newline (unless using libfyaml).
!--------------------------------------------------------------------------------------------------
function YAML_parse_str_asDict(str) result(dict)
function YAML_str_asDict(str) result(dict)
character(len=*), intent(in) :: str
type(tDict), pointer :: dict
@ -87,7 +87,7 @@ function YAML_parse_str_asDict(str) result(dict)
node => parse_flow(to_flow(str))
dict => node%asDict()
end function YAML_parse_str_asDict
end function YAML_str_asDict
!--------------------------------------------------------------------------------------------------
@ -870,7 +870,7 @@ end function to_flow
!--------------------------------------------------------------------------------------------------
!> @brief Check correctness of some YAML functions.
!--------------------------------------------------------------------------------------------------
subroutine YAML_parse_selfTest()
subroutine YAML_selfTest()
if (indentDepth(' a') /= 1) error stop 'indentDepth'
if (indentDepth('a') /= 0) error stop 'indentDepth'
@ -1024,14 +1024,14 @@ subroutine YAML_parse_selfTest()
lst = '[1, 2, 3, 4]', &
dct = '{a: 1, b: 2}'
list => YAML_parse_str_asList(lst//IO_EOL)
list => YAML_str_asList(lst//IO_EOL)
if (list%asFormattedStr() /= lst) error stop 'str_asList'
dict => YAML_parse_str_asDict(dct//IO_EOL)
dict => YAML_str_asDict(dct//IO_EOL)
if (dict%asFormattedStr() /= dct) error stop 'str_asDict'
end block parse
end subroutine YAML_parse_selfTest
end subroutine YAML_selfTest
#endif
end module YAML_parse
end module YAML

View File

@ -5,7 +5,7 @@
module config
use IO
use misc
use YAML_parse
use YAML
use types
use result
use parallelization
@ -126,7 +126,7 @@ function parse(fname,description)
end if
call parallelization_bcast_str(fileContent)
parse => YAML_parse_str_asDict(fileContent)
parse => YAML_str_asDict(fileContent)
end function parse

View File

@ -149,7 +149,7 @@ program DAMASK_grid
end if
call parallelization_bcast_str(fileContent)
load => YAML_parse_str_asDict(fileContent)
load => YAML_str_asDict(fileContent)
solver => load%get_dict('solver')
!--------------------------------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@ module materialpoint
use misc
use IO
use types
use YAML_parse
use YAML
use HDF5
use HDF5_utilities
use result
@ -58,7 +58,7 @@ subroutine materialpoint_initAll()
call base64_init()
#endif
call types_init()
call YAML_parse_init()
call YAML_init()
call HDF5_utilities_init()
call result_init(restart=CLI_restartInc>0)
call config_init()

View File

@ -113,7 +113,7 @@ program DAMASK_mesh
end if
call parallelization_bcast_str(fileContent)
load => YAML_parse_str_asDict(fileContent)
load => YAML_str_asDict(fileContent)
load_steps => load%get_list('loadstep')
allocate(loadCases(load_steps%length))

View File

@ -5,7 +5,7 @@
module polynomials
use prec
use IO
use YAML_parse
use YAML
use types
implicit none(type,external)
@ -151,7 +151,7 @@ subroutine polynomials_selfTest()
'C,T^3: '//trim(adjustl(coef_s(4)))//IO_EOL//&
'C,T^4: '//trim(adjustl(coef_s(5)))//IO_EOL//&
'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL
dict => YAML_parse_str_asDict(trim(YAML_s))
dict => YAML_str_asDict(trim(YAML_s))
p2 = polynomial(dict,'C','T')
if (dNeq(p1%at(x),p2%at(x),1.0e-6_pREAL)) error stop 'polynomials: init'
y = coef(1)*(x-x_ref)**0 &
@ -164,28 +164,28 @@ subroutine polynomials_selfTest()
YAML_s = 'C: 0.0'//IO_EOL//&
'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//&
'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL
dict => YAML_parse_str_asDict(trim(YAML_s))
dict => YAML_str_asDict(trim(YAML_s))
p1 = polynomial(dict,'C','T')
if (dNeq(p1%at(x_ref+x),-p1%at(x_ref-x),1.0e-10_pREAL)) error stop 'polynomials: eval(linear)'
YAML_s = 'C: 0.0'//IO_EOL//&
'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//&
'T_ref: '//trim(adjustl(x_ref_s))//IO_EOL
dict => YAML_parse_str_asDict(trim(YAML_s))
dict => YAML_str_asDict(trim(YAML_s))
p1 = polynomial(dict,'C','T')
if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1e-10_pREAL)) error stop 'polynomials: eval(quadratic)'
YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//&
'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//&
'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL
dict => YAML_parse_str_asDict(trim(YAML_s))
dict => YAML_str_asDict(trim(YAML_s))
p1 = polynomial(dict,'Y','X')
if (dNeq(p1%at(x_ref+x)-coef(1),-(p1%at(x_ref-x)-coef(1)),1.0e-8_pREAL)) error stop 'polynomials: eval(cubic)'
YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//&
'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//&
'X_ref: '//trim(adjustl(x_ref_s))//IO_EOL
dict => YAML_parse_str_asDict(trim(YAML_s))
dict => YAML_str_asDict(trim(YAML_s))
p1 = polynomial(dict,'Y','X')
if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1.0e-6_pREAL)) error stop 'polynomials: eval(quartic)'

View File

@ -6,7 +6,7 @@
module tables
use prec
use IO
use YAML_parse
use YAML
use types
implicit none(type,external)
@ -131,8 +131,8 @@ subroutine tables_selfTest()
if (dNeq(y_true(i),t%at(x_eval(i)+r),1.0e-9_pREAL)) error stop 'table eval/values'
end do
l_x => YAML_parse_str_asList('[1, 2, 3, 4]'//IO_EOL)
l_y => YAML_parse_str_asList('[1, 3, 2,-2]'//IO_EOL)
l_x => YAML_str_asList('[1, 2, 3, 4]'//IO_EOL)
l_y => YAML_str_asList('[1, 3, 2,-2]'//IO_EOL)
allocate(dict)
call dict%set('t',l_x)
call dict%set('T',l_y)