From 7f66d4e975d9f54dc03ad17590144401dac96231 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 23 Jan 2020 11:21:42 +0100 Subject: [PATCH] avoid fixed string length solved issues with wrong trim and is more robust --- src/DAMASK_marc.f90 | 6 +++--- src/FEsolving.f90 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DAMASK_marc.f90 b/src/DAMASK_marc.f90 index 678d87e60..32ec08e83 100644 --- a/src/DAMASK_marc.f90 +++ b/src/DAMASK_marc.f90 @@ -95,13 +95,13 @@ end subroutine DAMASK_interface_init !-------------------------------------------------------------------------------------------------- !> @brief solver job name (no extension) as combination of geometry and load case name !-------------------------------------------------------------------------------------------------- -function getSolverJobName() +function getSolverJobName - character(1024) :: getSolverJobName, inputName + character(len=:), allocatable :: getSolverJobName + character(1024) :: inputName character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forward and backward slash integer :: extPos - getSolverJobName='' inputName='' inquire(5, name=inputName) ! determine inputfile extPos = len_trim(inputName)-4 diff --git a/src/FEsolving.f90 b/src/FEsolving.f90 index 8057c37e0..070b05a28 100644 --- a/src/FEsolving.f90 +++ b/src/FEsolving.f90 @@ -43,7 +43,7 @@ subroutine FE_init character(len=pStringLen) :: line integer :: myStat,fileUnit integer, allocatable, dimension(:) :: chunkPos - open(newunit=fileUnit, file=trim(getSolverJobName()//INPUTFILEEXTENSION), & + open(newunit=fileUnit, file=getSolverJobName()//INPUTFILEEXTENSION, & status='old', position='rewind', action='read',iostat=myStat) do read (fileUnit,'(A)',END=100) line