polished for merge

access to array(n+m:) is safe for array of size n with m>1
This commit is contained in:
Martin Diehl 2018-08-04 19:39:50 +02:00
parent 20d1264d07
commit 9360c171a1
1 changed files with 16 additions and 8 deletions

View File

@ -107,13 +107,13 @@ subroutine config_init()
debug_levelBasic debug_levelBasic
implicit none implicit none
integer(pInt) :: myDebug,i integer(pInt) :: myDebug,i
character(len=256) :: & character(len=256) :: &
line, & line, &
part part
character(len=256), dimension(:), allocatable :: fileContent character(len=256), dimension(:), allocatable :: fileContent
logical :: jobSpecificConfig logical :: fileExists
write(6,'(/,a)') ' <<<+- config init -+>>>' write(6,'(/,a)') ' <<<+- config init -+>>>'
write(6,'(a15,a)') ' Current time: ',IO_timeStamp() write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
@ -121,12 +121,12 @@ subroutine config_init()
myDebug = debug_level(debug_material) myDebug = debug_level(debug_material)
inquire(file=trim(getSolverJobName())//'.'//material_localFileExt,exist=jobSpecificConfig) inquire(file=trim(getSolverJobName())//'.'//material_localFileExt,exist=fileExists)
if(jobSpecificConfig) then if(fileExists) then
fileContent = IO_recursiveRead(trim(getSolverJobName())//'.'//material_localFileExt) fileContent = IO_recursiveRead(trim(getSolverJobName())//'.'//material_localFileExt)
else else
inquire(file='material.config',exist=jobSpecificConfig) inquire(file='material.config',exist=fileExists)
if(.not. jobSpecificConfig) call IO_error(0_pInt) if(.not. fileExists) call IO_error(100_pInt,ext_msg='material.config')
fileContent = IO_recursiveRead('material.config') fileContent = IO_recursiveRead('material.config')
endif endif
@ -136,7 +136,7 @@ subroutine config_init()
select case (trim(part)) select case (trim(part))
case (trim(material_partPhase)) case (trim(material_partPhase))
call parseFile(line,phase_name,config_phase,fileContent(i+1:)) !(i+1:) save for empty part at (at end of file)? call parseFile(line,phase_name,config_phase,fileContent(i+1:))
if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Phase parsed'; flush(6) if (iand(myDebug,debug_levelBasic) /= 0_pInt) write(6,'(a)') ' Phase parsed'; flush(6)
case (trim(material_partMicrostructure)) case (trim(material_partMicrostructure))
@ -158,7 +158,6 @@ subroutine config_init()
end select end select
enddo enddo
deallocate(fileContent)
material_Nhomogenization = size(config_homogenization) material_Nhomogenization = size(config_homogenization)
if (material_Nhomogenization < 1_pInt) call IO_error(160_pInt,ext_msg=material_partHomogenization) if (material_Nhomogenization < 1_pInt) call IO_error(160_pInt,ext_msg=material_partHomogenization)
@ -233,6 +232,9 @@ subroutine parseFile(line,&
end subroutine parseFile end subroutine parseFile
!--------------------------------------------------------------------------------------------------
!> @brief deallocates the linked lists that store the content of the configuration files
!--------------------------------------------------------------------------------------------------
subroutine config_deallocate(what) subroutine config_deallocate(what)
use IO, only: & use IO, only: &
IO_error IO_error
@ -281,6 +283,12 @@ subroutine config_deallocate(what)
end subroutine config_deallocate end subroutine config_deallocate
!##################################################################################################
! The folowing functions are part of the tPartitionedStringList object
!##################################################################################################
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief add element !> @brief add element
!> @details Adds a string together with the start/end position of chunks in this string. The new !> @details Adds a string together with the start/end position of chunks in this string. The new