naming scheme as in Python library
This commit is contained in:
parent
30ca657706
commit
883aed9092
|
@ -21,7 +21,7 @@
|
||||||
#include "../misc.f90"
|
#include "../misc.f90"
|
||||||
#include "../IO.f90"
|
#include "../IO.f90"
|
||||||
#include "../types.f90"
|
#include "../types.f90"
|
||||||
#include "../YAML_parse.f90"
|
#include "../YAML.f90"
|
||||||
#include "../HDF5_utilities.f90"
|
#include "../HDF5_utilities.f90"
|
||||||
|
|
||||||
module DAMASK_interface
|
module DAMASK_interface
|
||||||
|
|
|
@ -8,7 +8,7 @@ module materialpoint_Marc
|
||||||
use prec
|
use prec
|
||||||
use IO
|
use IO
|
||||||
use types
|
use types
|
||||||
use YAML_parse
|
use YAML
|
||||||
use HDF5_utilities
|
use HDF5_utilities
|
||||||
use result
|
use result
|
||||||
use config
|
use config
|
||||||
|
@ -71,7 +71,7 @@ subroutine materialpoint_initAll()
|
||||||
call prec_init()
|
call prec_init()
|
||||||
call IO_init()
|
call IO_init()
|
||||||
call types_init()
|
call types_init()
|
||||||
call YAML_parse_init()
|
call YAML_init()
|
||||||
call HDF5_utilities_init()
|
call HDF5_utilities_init()
|
||||||
call result_init(.false.)
|
call result_init(.false.)
|
||||||
call config_init()
|
call config_init()
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
!> @brief Parser for YAML files.
|
!> @brief Parser for YAML files.
|
||||||
!> @details Module converts a YAML input file to an equivalent YAML flow style which is then parsed.
|
!> @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 prec
|
||||||
use misc
|
use misc
|
||||||
use IO
|
use IO
|
||||||
|
@ -17,9 +17,9 @@ module YAML_parse
|
||||||
private
|
private
|
||||||
|
|
||||||
public :: &
|
public :: &
|
||||||
YAML_parse_init, &
|
YAML_init, &
|
||||||
YAML_parse_str_asList, &
|
YAML_str_asList, &
|
||||||
YAML_parse_str_asDict
|
YAML_str_asDict
|
||||||
|
|
||||||
#ifdef FYAML
|
#ifdef FYAML
|
||||||
interface
|
interface
|
||||||
|
@ -42,23 +42,23 @@ contains
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Do sanity checks.
|
!> @brief Do sanity checks.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine YAML_parse_init()
|
subroutine YAML_init()
|
||||||
|
|
||||||
print'(/,1x,a)', '<<<+- YAML_parse init -+>>>'
|
print'(/,1x,a)', '<<<+- YAML init -+>>>'
|
||||||
#ifdef FYAML
|
#ifdef FYAML
|
||||||
print'(/,1x,a)', 'libfyaml powered'
|
print'(/,1x,a)', 'libfyaml powered'
|
||||||
#else
|
#else
|
||||||
call YAML_parse_selfTest()
|
call YAML_selfTest()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end subroutine YAML_parse_init
|
end subroutine YAML_init
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Parse a YAML string with list at root into a structure of nodes.
|
!> @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).
|
!> @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
|
character(len=*), intent(in) :: str
|
||||||
type(tList), pointer :: list
|
type(tList), pointer :: list
|
||||||
|
@ -69,14 +69,14 @@ function YAML_parse_str_asList(str) result(list)
|
||||||
node => parse_flow(to_flow(str))
|
node => parse_flow(to_flow(str))
|
||||||
list => node%asList()
|
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.
|
!> @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).
|
!> @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
|
character(len=*), intent(in) :: str
|
||||||
type(tDict), pointer :: dict
|
type(tDict), pointer :: dict
|
||||||
|
@ -87,7 +87,7 @@ function YAML_parse_str_asDict(str) result(dict)
|
||||||
node => parse_flow(to_flow(str))
|
node => parse_flow(to_flow(str))
|
||||||
dict => node%asDict()
|
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.
|
!> @brief Check correctness of some YAML functions.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine YAML_parse_selfTest()
|
subroutine YAML_selfTest()
|
||||||
|
|
||||||
if (indentDepth(' a') /= 1) error stop 'indentDepth'
|
if (indentDepth(' a') /= 1) error stop 'indentDepth'
|
||||||
if (indentDepth('a') /= 0) error stop 'indentDepth'
|
if (indentDepth('a') /= 0) error stop 'indentDepth'
|
||||||
|
@ -1024,14 +1024,14 @@ subroutine YAML_parse_selfTest()
|
||||||
lst = '[1, 2, 3, 4]', &
|
lst = '[1, 2, 3, 4]', &
|
||||||
dct = '{a: 1, b: 2}'
|
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'
|
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'
|
if (dict%asFormattedStr() /= dct) error stop 'str_asDict'
|
||||||
|
|
||||||
end block parse
|
end block parse
|
||||||
|
|
||||||
end subroutine YAML_parse_selfTest
|
end subroutine YAML_selfTest
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end module YAML_parse
|
end module YAML
|
|
@ -5,7 +5,7 @@
|
||||||
module config
|
module config
|
||||||
use IO
|
use IO
|
||||||
use misc
|
use misc
|
||||||
use YAML_parse
|
use YAML
|
||||||
use types
|
use types
|
||||||
use result
|
use result
|
||||||
use parallelization
|
use parallelization
|
||||||
|
@ -126,7 +126,7 @@ function parse(fname,description)
|
||||||
end if
|
end if
|
||||||
call parallelization_bcast_str(fileContent)
|
call parallelization_bcast_str(fileContent)
|
||||||
|
|
||||||
parse => YAML_parse_str_asDict(fileContent)
|
parse => YAML_str_asDict(fileContent)
|
||||||
|
|
||||||
end function parse
|
end function parse
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ program DAMASK_grid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
call parallelization_bcast_str(fileContent)
|
call parallelization_bcast_str(fileContent)
|
||||||
load => YAML_parse_str_asDict(fileContent)
|
load => YAML_str_asDict(fileContent)
|
||||||
solver => load%get_dict('solver')
|
solver => load%get_dict('solver')
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -12,7 +12,7 @@ module materialpoint
|
||||||
use misc
|
use misc
|
||||||
use IO
|
use IO
|
||||||
use types
|
use types
|
||||||
use YAML_parse
|
use YAML
|
||||||
use HDF5
|
use HDF5
|
||||||
use HDF5_utilities
|
use HDF5_utilities
|
||||||
use result
|
use result
|
||||||
|
@ -58,7 +58,7 @@ subroutine materialpoint_initAll()
|
||||||
call base64_init()
|
call base64_init()
|
||||||
#endif
|
#endif
|
||||||
call types_init()
|
call types_init()
|
||||||
call YAML_parse_init()
|
call YAML_init()
|
||||||
call HDF5_utilities_init()
|
call HDF5_utilities_init()
|
||||||
call result_init(restart=CLI_restartInc>0)
|
call result_init(restart=CLI_restartInc>0)
|
||||||
call config_init()
|
call config_init()
|
||||||
|
|
|
@ -113,7 +113,7 @@ program DAMASK_mesh
|
||||||
end if
|
end if
|
||||||
|
|
||||||
call parallelization_bcast_str(fileContent)
|
call parallelization_bcast_str(fileContent)
|
||||||
load => YAML_parse_str_asDict(fileContent)
|
load => YAML_str_asDict(fileContent)
|
||||||
load_steps => load%get_list('loadstep')
|
load_steps => load%get_list('loadstep')
|
||||||
|
|
||||||
allocate(loadCases(load_steps%length))
|
allocate(loadCases(load_steps%length))
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
module polynomials
|
module polynomials
|
||||||
use prec
|
use prec
|
||||||
use IO
|
use IO
|
||||||
use YAML_parse
|
use YAML
|
||||||
use types
|
use types
|
||||||
|
|
||||||
implicit none(type,external)
|
implicit none(type,external)
|
||||||
|
@ -151,7 +151,7 @@ subroutine polynomials_selfTest()
|
||||||
'C,T^3: '//trim(adjustl(coef_s(4)))//IO_EOL//&
|
'C,T^3: '//trim(adjustl(coef_s(4)))//IO_EOL//&
|
||||||
'C,T^4: '//trim(adjustl(coef_s(5)))//IO_EOL//&
|
'C,T^4: '//trim(adjustl(coef_s(5)))//IO_EOL//&
|
||||||
'T_ref: '//trim(adjustl(x_ref_s))//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')
|
p2 = polynomial(dict,'C','T')
|
||||||
if (dNeq(p1%at(x),p2%at(x),1.0e-6_pREAL)) error stop 'polynomials: init'
|
if (dNeq(p1%at(x),p2%at(x),1.0e-6_pREAL)) error stop 'polynomials: init'
|
||||||
y = coef(1)*(x-x_ref)**0 &
|
y = coef(1)*(x-x_ref)**0 &
|
||||||
|
@ -164,28 +164,28 @@ subroutine polynomials_selfTest()
|
||||||
YAML_s = 'C: 0.0'//IO_EOL//&
|
YAML_s = 'C: 0.0'//IO_EOL//&
|
||||||
'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//&
|
'C,T: '//trim(adjustl(coef_s(2)))//IO_EOL//&
|
||||||
'T_ref: '//trim(adjustl(x_ref_s))//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')
|
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)'
|
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//&
|
YAML_s = 'C: 0.0'//IO_EOL//&
|
||||||
'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//&
|
'C,T^2: '//trim(adjustl(coef_s(3)))//IO_EOL//&
|
||||||
'T_ref: '//trim(adjustl(x_ref_s))//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')
|
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)'
|
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//&
|
YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//&
|
||||||
'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//&
|
'Y,X^3: '//trim(adjustl(coef_s(2)))//IO_EOL//&
|
||||||
'X_ref: '//trim(adjustl(x_ref_s))//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')
|
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)'
|
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//&
|
YAML_s = 'Y: '//trim(adjustl(coef_s(1)))//IO_EOL//&
|
||||||
'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//&
|
'Y,X^4: '//trim(adjustl(coef_s(2)))//IO_EOL//&
|
||||||
'X_ref: '//trim(adjustl(x_ref_s))//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')
|
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)'
|
if (dNeq(p1%at(x_ref+x),p1%at(x_ref-x),1.0e-6_pREAL)) error stop 'polynomials: eval(quartic)'
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
module tables
|
module tables
|
||||||
use prec
|
use prec
|
||||||
use IO
|
use IO
|
||||||
use YAML_parse
|
use YAML
|
||||||
use types
|
use types
|
||||||
|
|
||||||
implicit none(type,external)
|
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'
|
if (dNeq(y_true(i),t%at(x_eval(i)+r),1.0e-9_pREAL)) error stop 'table eval/values'
|
||||||
end do
|
end do
|
||||||
|
|
||||||
l_x => YAML_parse_str_asList('[1, 2, 3, 4]'//IO_EOL)
|
l_x => YAML_str_asList('[1, 2, 3, 4]'//IO_EOL)
|
||||||
l_y => YAML_parse_str_asList('[1, 3, 2,-2]'//IO_EOL)
|
l_y => YAML_str_asList('[1, 3, 2,-2]'//IO_EOL)
|
||||||
allocate(dict)
|
allocate(dict)
|
||||||
call dict%set('t',l_x)
|
call dict%set('t',l_x)
|
||||||
call dict%set('T',l_y)
|
call dict%set('T',l_y)
|
||||||
|
|
Loading…
Reference in New Issue