From 29e55d20fb2f2f55377cdc50a76b0ef29bbd3c7e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 30 Aug 2018 09:42:45 +0200 Subject: [PATCH] message better to understand and giving error instead of SIGSEGV --- src/IO.f90 | 4 +++- src/config.f90 | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/IO.f90 b/src/IO.f90 index 8e1b9e80f..c97dcfa9c 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -1477,6 +1477,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) msg = 'illegal texture transformation specified' case (160_pInt) msg = 'no entries in config part' + case (161_pInt) + msg = 'config part found twice' case (165_pInt) msg = 'homogenization configuration' case (170_pInt) @@ -1574,7 +1576,7 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) case (845_pInt) msg = 'incomplete information in spectral mesh header' case (846_pInt) - msg = 'not a rotation defined for loadcase rotation' + msg = 'rotation for load case rotation ill-defined (R:RT != I)' case (847_pInt) msg = 'update of gamma operator not possible when pre-calculated' case (880_pInt) diff --git a/src/config.f90 b/src/config.f90 index d028eb897..4d5a76432 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -141,23 +141,23 @@ subroutine config_init() select case (trim(part)) case (trim(material_partPhase)) - call parseFile(line,phase_name,config_phase,fileContent(i+1:)) + call parseFile(phase_name,config_phase,line,fileContent(i+1:)) if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Phase parsed'; flush(6) case (trim(material_partMicrostructure)) - call parseFile(line,microstructure_name,config_microstructure,fileContent(i+1:)) + call parseFile(microstructure_name,config_microstructure,line,fileContent(i+1:)) if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Microstructure parsed'; flush(6) case (trim(material_partCrystallite)) - call parseFile(line,crystallite_name,config_crystallite,fileContent(i+1:)) + call parseFile(crystallite_name,config_crystallite,line,fileContent(i+1:)) if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Crystallite parsed'; flush(6) case (trim(material_partHomogenization)) - call parseFile(line,homogenization_name,config_homogenization,fileContent(i+1:)) + call parseFile(homogenization_name,config_homogenization,line,fileContent(i+1:)) if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Homogenization parsed'; flush(6) case (trim(material_partTexture)) - call parseFile(line,texture_name,config_texture,fileContent(i+1:)) + call parseFile(texture_name,config_texture,line,fileContent(i+1:)) if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Texture parsed'; flush(6) end select @@ -180,7 +180,7 @@ end subroutine config_init !-------------------------------------------------------------------------------------------------- !> @brief parses the material.config file !-------------------------------------------------------------------------------------------------- -subroutine parseFile(line,sectionNames,part,& +subroutine parseFile(sectionNames,part,line, & fileContent) use prec, only: & pStringLen @@ -189,16 +189,18 @@ subroutine parseFile(line,sectionNames,part,& IO_getTag implicit none - character(len=pStringLen), intent(out) :: line - character(len=64), allocatable, dimension(:), intent(out) :: sectionNames - type(tPartitionedStringList), allocatable, dimension(:), intent(out) :: part - character(len=pStringLen), dimension(:), intent(in) :: fileContent + character(len=64), allocatable, dimension(:), intent(out) :: sectionNames + type(tPartitionedStringList), allocatable, dimension(:), intent(inout) :: part + character(len=pStringLen), intent(inout) :: line + character(len=pStringLen), dimension(:), intent(in) :: fileContent - integer(pInt), allocatable, dimension(:) :: partPosition ! position of [] tags + last line in section + integer(pInt), allocatable, dimension(:) :: partPosition ! position of [] tags + last line in section integer(pInt) :: i, j logical :: echo echo = .false. + + if (allocated(part)) call IO_error(161_pInt,ext_msg=trim(line)) allocate(partPosition(0)) do i = 1_pInt, size(fileContent)