From 22544d6978c5bade0f5ea9b52afc773561f57dbf Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 13 Sep 2020 12:43:49 +0200 Subject: [PATCH] systematic naming --- src/CPFEM.f90 | 2 +- src/CPFEM2.f90 | 2 +- src/YAML_parse.f90 | 26 +++++++++++++++++++------- src/YAML_types.f90 | 4 ++-- src/config.f90 | 6 +++--- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/CPFEM.f90 b/src/CPFEM.f90 index 2e8817015..6c820b248 100644 --- a/src/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -82,7 +82,7 @@ subroutine CPFEM_initAll call math_init call rotations_init call YAML_types_init - call YAML_init + call YAML_parse_init call HDF5_utilities_init call results_init(.false.) call discretization_marc_init diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 645fcf59d..ab70acbe8 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -52,7 +52,7 @@ subroutine CPFEM_initAll call math_init call rotations_init call YAML_types_init - call YAML_init + call YAML_parse_init call lattice_init call HDF5_utilities_init call results_init(restart=interface_restartInc>0) diff --git a/src/YAML_parse.f90 b/src/YAML_parse.f90 index 85ec508ab..d655bc2dc 100644 --- a/src/YAML_parse.f90 +++ b/src/YAML_parse.f90 @@ -13,25 +13,37 @@ module YAML_parse private public :: & - YAML_init, & - parse_flow, & - to_flow + YAML_parse_init, & + YAML_parse_file contains !-------------------------------------------------------------------------------------------------- -!> @brief do sanity checks +!> @brief Do sanity checks. !-------------------------------------------------------------------------------------------------- -subroutine YAML_init +subroutine YAML_parse_init call selfTest -end subroutine YAML_init +end subroutine YAML_parse_init + + +!-------------------------------------------------------------------------------------------------- +!> @brief Parse a YAML file into a a structure of nodes. +!-------------------------------------------------------------------------------------------------- +function YAML_parse_file(fname) result(node) + + character(len=*), intent(in) :: fname + class (tNode), pointer :: node + + node => parse_flow(to_flow(IO_read(fname))) + +end function YAML_parse_file !-------------------------------------------------------------------------------------------------- !> @brief reads the flow style string and stores it in the form of dictionaries, lists and scalars. -!> @details A node type pointer can either point to a dictionary, list or scalar type entities. +!> @details A node type pointer can either point to a dictionary, list or scalar type entities. !-------------------------------------------------------------------------------------------------- recursive function parse_flow(YAML_flow) result(node) diff --git a/src/YAML_types.f90 b/src/YAML_types.f90 index eb16ce260..1752474ad 100644 --- a/src/YAML_types.f90 +++ b/src/YAML_types.f90 @@ -185,7 +185,7 @@ module YAML_types contains !-------------------------------------------------------------------------------------------------- -!> @brief do sanity checks +!> @brief Do sanity checks. !-------------------------------------------------------------------------------------------------- subroutine YAML_types_init @@ -197,7 +197,7 @@ end subroutine YAML_types_init !-------------------------------------------------------------------------------------------------- -!> @brief check correctness of some type bound procedures +!> @brief Check correctness of some type bound procedures. !-------------------------------------------------------------------------------------------------- subroutine selfTest diff --git a/src/config.f90 b/src/config.f90 index fab5721c5..11f23ef77 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -60,7 +60,7 @@ subroutine parse_material if(.not. fileExists) call IO_error(100,ext_msg=fname) endif write(6,*) 'reading '//fname; flush(6) - config_material => parse_flow(to_flow(IO_read(fname))) + config_material => YAML_parse_file(fname) end subroutine parse_material @@ -77,7 +77,7 @@ subroutine parse_numerics inquire(file='numerics.yaml', exist=fexist) if (fexist) then write(6,*) 'reading numerics.yaml'; flush(6) - config_numerics => parse_flow(to_flow(IO_read('numerics.yaml'))) + config_numerics => YAML_parse_file('numerics.yaml') endif end subroutine parse_numerics @@ -94,7 +94,7 @@ subroutine parse_debug inquire(file='debug.yaml', exist=fexist) fileExists: if (fexist) then write(6,*) 'reading debug.yaml'; flush(6) - config_debug => parse_flow(to_flow(IO_read('debug.yaml'))) + config_debug => YAML_parse_file('debug.yaml') endif fileExists end subroutine parse_debug