changed fileopen routines in IO.f90 to use solver dependant functions defined in the interface routines

DID NOT test ABAQUS versions yet, not shure whether (V)GETOUTDIR returns path with or without terminating slash
This commit is contained in:
Franz Roters 2010-05-10 15:02:59 +00:00
parent 0416c9a616
commit e810e5cfa1
4 changed files with 121 additions and 42 deletions

View File

@ -47,16 +47,14 @@ endsubroutine
logical function IO_open_file(unit,relPath) logical function IO_open_file(unit,relPath)
use prec, only: pInt use prec, only: pInt
use cpfem_interface
implicit none implicit none
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! /, \ character(len=*), parameter :: pathSep = achar(47)//achar(92) ! /, \
character(len=*) relPath character(len=*) relPath
integer(pInt) unit integer(pInt) unit
character(1024) path
path='' open(unit,status='old',err=100,file=trim(getWorkingDirectoryName())//relPath)
inquire(6, name=path) ! determine outputfile
open(unit,status='old',err=100,file=path(1:scan(path,pathSep,back=.true.))//relPath)
IO_open_file = .true. IO_open_file = .true.
return return
100 IO_open_file = .false. 100 IO_open_file = .false.
@ -75,26 +73,8 @@ endsubroutine
implicit none implicit none
integer(pInt), intent(in) :: unit integer(pInt), intent(in) :: unit
integer(pInt) extPos
character(1024) outName
character(3) ext
outName='' open(unit,status='old',err=100,file=getInputFileName())
inquire(6, name=outName) ! determine outputfileName
extPos = len_trim(outName)-2
! if(outName(extPos:extPos+2)=='out') then
! ext='dat' ! MARC
! else
! ext='inp' ! ABAQUS
! endif
select case (FEsolver)
case ('Marc')
ext='dat'
case ('Abaqus')
ext='inp'
end select
open(unit,status='old',err=100,file=outName(1:extPos-1)//ext)
IO_open_inputFile = .true. IO_open_inputFile = .true.
return return
100 IO_open_inputFile = .false. 100 IO_open_inputFile = .false.
@ -110,14 +90,13 @@ endsubroutine
logical function IO_open_jobFile(unit,newExt) logical function IO_open_jobFile(unit,newExt)
use prec, only: pReal, pInt use prec, only: pReal, pInt
use cpfem_interface
implicit none implicit none
integer(pInt), intent(in) :: unit integer(pInt), intent(in) :: unit
character(*), intent(in) :: newExt character(*), intent(in) :: newExt
character(256) outName
inquire(6, name=outName) ! determine outputfileName open(unit,status='replace',err=100,file=trim(getFullJobName())//'.'//newExt)
open(unit,status='replace',err=100,file=outName(1:len_trim(outName)-3)//newExt)
IO_open_jobFile = .true. IO_open_jobFile = .true.
return return
100 IO_open_jobFile = .false. 100 IO_open_jobFile = .false.

View File

@ -14,27 +14,58 @@
! !
!******************************************************************** !********************************************************************
include "prec.f90" ! uses nothing else
MODULE cpfem_interface MODULE cpfem_interface
character(len=64), parameter :: FEsolver = 'Abaqus' character(len=64), parameter :: FEsolver = 'Abaqus'
CONTAINS CONTAINS
subroutine mpie_cpfem_init () subroutine mpie_cpfem_init
!$OMP CRITICAL (write2out)
write(6,*) write(6,*)
write(6,*) '<<<+- mpie_cpfem_abaqus_exp init -+>>>' write(6,*) '<<<+- mpie_cpfem_abaqus init -+>>>'
write(6,*) '$Id$' write(6,*) '$Id$'
write(6,*) write(6,*)
call flush(6)
!$OMP END CRITICAL (write2out)
return return
end subroutine end subroutine
function getWorkingDirectoryName
use prec
implicit none
character(1024) getWorkingDirectoryName
integer(pInt) LENOUTDIR
getWorkingDirectoryName=''
CALL VGETOUTDIR( getWorkingDirectoryName, LENOUTDIR )
! write(6,*) 'getWorkingDirectoryName', getWorkingDirectoryName
end function
function getFullJobName
use prec
implicit none
character(1024) getFullJobName, JOBNAME
integer(pInt) LENJOBNAME
getFullJobName=''
CALL VGETJOBNAME(JOBNAME , LENJOBNAME )
getFullJobName=trim(getWorkingDirectoryName())//trim(JOBNAME)
! write(6,*) 'getFullJobName', getFullJobName
end function
function getInputFileName
implicit none
character(1024) getInputFileName
getInputFileName=''
getInputFileName=trim(getFullJobName())//'.inp'
! write(6,*) 'getInputFileName', getInputFileName
end function
END MODULE END MODULE
include "prec.f90" ! uses nothing else
include "IO.f90" ! uses prec include "IO.f90" ! uses prec
include "numerics.f90" ! uses prec, IO include "numerics.f90" ! uses prec, IO
include "math.f90" ! uses prec, numerics include "math.f90" ! uses prec, numerics

View File

@ -14,27 +14,58 @@
! !
!******************************************************************** !********************************************************************
include "prec.f90" ! uses nothing else
MODULE cpfem_interface MODULE cpfem_interface
character(len=64), parameter :: FEsolver = 'Abaqus' character(len=64), parameter :: FEsolver = 'Abaqus'
CONTAINS CONTAINS
subroutine mpie_cpfem_init () subroutine mpie_cpfem_init
!$OMP CRITICAL (write2out)
write(6,*) write(6,*)
write(6,*) '<<<+- mpie_cpfem_abaqus init -+>>>' write(6,*) '<<<+- mpie_cpfem_abaqus init -+>>>'
write(6,*) '$Id$' write(6,*) '$Id$'
write(6,*) write(6,*)
call flush(6)
!$OMP END CRITICAL (write2out)
return return
end subroutine end subroutine
function getWorkingDirectoryName
use prec
implicit none
character(1024) getWorkingDirectoryName
integer(pInt) LENOUTDIR
getWorkingDirectoryName=''
CALL GETOUTDIR( getWorkingDirectoryName, LENOUTDIR )
! write(6,*) 'getWorkingDirectoryName', getWorkingDirectoryName
end function
function getFullJobName
use prec
implicit none
character(1024) getFullJobName, JOBNAME
integer(pInt) LENJOBNAME
getFullJobName=''
CALL GETJOBNAME(JOBNAME , LENJOBNAME )
getFullJobName=trim(getWorkingDirectoryName())//trim(JOBNAME)
! write(6,*) 'getFullJobName', getFullJobName
end function
function getInputFileName
implicit none
character(1024) getInputFileName
getInputFileName=''
getInputFileName=trim(getFullJobName())//'.inp'
! write(6,*) 'getInputFileName', getInputFileName
end function
END MODULE END MODULE
include "prec.f90" ! uses nothing else
include "IO.f90" ! uses prec include "IO.f90" ! uses prec
include "numerics.f90" ! uses prec, IO include "numerics.f90" ! uses prec, IO
include "math.f90" ! uses prec, numerics include "math.f90" ! uses prec, numerics

View File

@ -36,6 +36,9 @@
! - creeps: timinc ! - creeps: timinc
!******************************************************************** !********************************************************************
! !
include "prec.f90" ! uses nothing else
MODULE cpfem_interface MODULE cpfem_interface
character(len=64), parameter :: FEsolver = 'Marc' character(len=64), parameter :: FEsolver = 'Marc'
@ -50,9 +53,44 @@ subroutine mpie_cpfem_init
return return
end subroutine end subroutine
function getWorkingDirectoryName
implicit none
character(1024) getWorkingDirectoryName, outName
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! /, \
getWorkingDirectoryName=''
outName=''
inquire(6, name=outName) ! determine outputfile
getWorkingDirectoryName=outName(1:scan(outName,pathSep,back=.true.))
! write(6,*) 'getWorkingDirectoryName', getWorkingDirectoryName
end function
function getFullJobName
use prec
implicit none
character(1024) getFullJobName, outName
integer(pInt) extPos
getFullJobName=''
outName=''
inquire(6, name=outName) ! determine outputfile
extPos = len_trim(outName)-4
getFullJobName=outName(1:extPos)
! write(6,*) 'getFullJobName', getFullJobName
end function
function getInputFileName
implicit none
character(1024) getInputFileName
getInputFileName=''
getInputFileName=trim(getFullJobName())//'.dat'
! write(6,*) 'getInputFileName', getInputFileName
end function
END MODULE END MODULE
include "prec.f90" ! uses nothing else
include "IO.f90" ! uses prec include "IO.f90" ! uses prec
include "numerics.f90" ! uses prec, IO include "numerics.f90" ! uses prec, IO
include "math.f90" ! uses prec, numerics include "math.f90" ! uses prec, numerics