improved version of general I/O functions

renamed module cpfem_interface to mpie_interface
This commit is contained in:
Franz Roters 2010-05-11 06:57:15 +00:00
parent e810e5cfa1
commit 483584ceb3
6 changed files with 49 additions and 72 deletions

View File

@ -130,7 +130,7 @@ subroutine CPFEM_general(mode, ffn, ffn1, Temperature, dt, element, IP, cauchySt
materialpoint_stressAndItsTangent, & materialpoint_stressAndItsTangent, &
materialpoint_postResults materialpoint_postResults
use IO, only: IO_init use IO, only: IO_init
use cpfem_interface use mpie_interface
implicit none implicit none

View File

@ -47,14 +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 use mpie_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
open(unit,status='old',err=100,file=trim(getWorkingDirectoryName())//relPath) open(unit,status='old',err=100,file=trim(getSolverWorkingDirectoryName())//relPath)
IO_open_file = .true. IO_open_file = .true.
return return
100 IO_open_file = .false. 100 IO_open_file = .false.
@ -68,13 +68,14 @@ endsubroutine
!******************************************************************** !********************************************************************
logical function IO_open_inputFile(unit) logical function IO_open_inputFile(unit)
use cpfem_interface
use prec, only: pReal, pInt use prec, only: pReal, pInt
use mpie_interface
implicit none implicit none
integer(pInt), intent(in) :: unit integer(pInt), intent(in) :: unit
open(unit,status='old',err=100,file=getInputFileName()) open(unit,status='old',err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(getSolverJobName())//InputFileExtension)
IO_open_inputFile = .true. IO_open_inputFile = .true.
return return
100 IO_open_inputFile = .false. 100 IO_open_inputFile = .false.
@ -90,13 +91,14 @@ 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 use mpie_interface
implicit none implicit none
integer(pInt), intent(in) :: unit integer(pInt), intent(in) :: unit
character(*), intent(in) :: newExt character(*), intent(in) :: newExt
open(unit,status='replace',err=100,file=trim(getFullJobName())//'.'//newExt) open(unit,status='replace',err=100,file=trim(getSolverWorkingDirectoryName())//&
trim(getSolverJobName())//'.'//newExt)
IO_open_jobFile = .true. IO_open_jobFile = .true.
return return
100 IO_open_jobFile = .false. 100 IO_open_jobFile = .false.
@ -765,7 +767,7 @@ endfunction
!******************************************************************** !********************************************************************
function IO_countContinousIntValues (unit) function IO_countContinousIntValues (unit)
use cpfem_interface use mpie_interface
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none
@ -823,7 +825,7 @@ endfunction
!******************************************************************** !********************************************************************
function IO_continousIntValues (unit,maxN,lookupName,lookupMap,lookupMaxN) function IO_continousIntValues (unit,maxN,lookupName,lookupMap,lookupMaxN)
use cpfem_interface use mpie_interface
use prec, only: pReal,pInt use prec, only: pReal,pInt
implicit none implicit none

View File

@ -211,7 +211,7 @@
!*********************************************************** !***********************************************************
subroutine mesh_init (ip,element) subroutine mesh_init (ip,element)
use cpfem_interface use mpie_interface
use prec, only: pInt use prec, only: pInt
use IO, only: IO_error,IO_open_InputFile use IO, only: IO_error,IO_open_InputFile
use FEsolving, only: parallelExecution, FEsolving_execElem, FEsolving_execIP, calcMode, lastMode use FEsolving, only: parallelExecution, FEsolving_execElem, FEsolving_execIP, calcMode, lastMode

View File

@ -17,9 +17,10 @@
include "prec.f90" ! uses nothing else include "prec.f90" ! uses nothing else
MODULE cpfem_interface MODULE mpie_interface
character(len=64), parameter :: FEsolver = 'Abaqus' character(len=64), parameter :: FEsolver = 'Abaqus'
character(len=4), parameter :: InputFileExtension = '.inp'
CONTAINS CONTAINS
@ -31,37 +32,27 @@ subroutine mpie_cpfem_init
return return
end subroutine end subroutine
function getWorkingDirectoryName function getSolverWorkingDirectoryName
use prec use prec
implicit none implicit none
character(1024) getWorkingDirectoryName character(1024) getSolverWorkingDirectoryName
integer(pInt) LENOUTDIR integer(pInt) LENOUTDIR
getWorkingDirectoryName='' getSolverWorkingDirectoryName=''
CALL VGETOUTDIR( getWorkingDirectoryName, LENOUTDIR ) CALL VGETOUTDIR( getSolverWorkingDirectoryName, LENOUTDIR )
! write(6,*) 'getWorkingDirectoryName', getWorkingDirectoryName ! write(6,*) 'getSolverWorkingDirectoryName', getSolverWorkingDirectoryName
end function end function
function getFullJobName function getSolverJobName
use prec use prec
implicit none implicit none
character(1024) getFullJobName, JOBNAME character(1024) getSolverJobName, JOBNAME
integer(pInt) LENJOBNAME integer(pInt) LENJOBNAME
getFullJobName='' getSolverJobName=''
CALL VGETJOBNAME(JOBNAME , LENJOBNAME ) CALL VGETJOBNAME(getSolverJobName , LENJOBNAME )
getFullJobName=trim(getWorkingDirectoryName())//trim(JOBNAME) ! write(6,*) 'getSolverJobName', getSolverJobName
! 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 function
END MODULE END MODULE

View File

@ -17,9 +17,10 @@
include "prec.f90" ! uses nothing else include "prec.f90" ! uses nothing else
MODULE cpfem_interface MODULE mpie_interface
character(len=64), parameter :: FEsolver = 'Abaqus' character(len=64), parameter :: FEsolver = 'Abaqus'
character(len=4), parameter :: InputFileExtension = '.inp'
CONTAINS CONTAINS
@ -31,37 +32,27 @@ subroutine mpie_cpfem_init
return return
end subroutine end subroutine
function getWorkingDirectoryName function getSolverWorkingDirectoryName
use prec use prec
implicit none implicit none
character(1024) getWorkingDirectoryName character(1024) getSolverWorkingDirectoryName
integer(pInt) LENOUTDIR integer(pInt) LENOUTDIR
getWorkingDirectoryName='' getSolverWorkingDirectoryName=''
CALL GETOUTDIR( getWorkingDirectoryName, LENOUTDIR ) CALL GETOUTDIR( getSolverWorkingDirectoryName, LENOUTDIR )
! write(6,*) 'getWorkingDirectoryName', getWorkingDirectoryName ! write(6,*) 'getSolverWorkingDirectoryName', getSolverWorkingDirectoryName
end function end function
function getFullJobName function getSolverJobName
use prec use prec
implicit none implicit none
character(1024) getFullJobName, JOBNAME character(1024) getSolverJobName, JOBNAME
integer(pInt) LENJOBNAME integer(pInt) LENJOBNAME
getFullJobName='' getSolverJobName=''
CALL GETJOBNAME(JOBNAME , LENJOBNAME ) CALL GETJOBNAME(getSolverJobName , LENJOBNAME )
getFullJobName=trim(getWorkingDirectoryName())//trim(JOBNAME) ! write(6,*) 'getSolverJobName', getSolverJobName
! 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 function
END MODULE END MODULE

View File

@ -39,9 +39,10 @@
include "prec.f90" ! uses nothing else include "prec.f90" ! uses nothing else
MODULE cpfem_interface MODULE mpie_interface
character(len=64), parameter :: FEsolver = 'Marc' character(len=64), parameter :: FEsolver = 'Marc'
character(len=4), parameter :: InputFileExtension = '.dat'
CONTAINS CONTAINS
@ -53,40 +54,32 @@ subroutine mpie_cpfem_init
return return
end subroutine end subroutine
function getWorkingDirectoryName function getSolverWorkingDirectoryName
implicit none implicit none
character(1024) getWorkingDirectoryName, outName character(1024) getSolverWorkingDirectoryName, outName
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! /, \ character(len=*), parameter :: pathSep = achar(47)//achar(92) ! /, \
getWorkingDirectoryName='' getSolverWorkingDirectoryName=''
outName='' outName=''
inquire(6, name=outName) ! determine outputfile inquire(6, name=outName) ! determine outputfile
getWorkingDirectoryName=outName(1:scan(outName,pathSep,back=.true.)) getSolverWorkingDirectoryName=outName(1:scan(outName,pathSep,back=.true.))
! write(6,*) 'getWorkingDirectoryName', getWorkingDirectoryName ! write(6,*) 'getSolverWorkingDirectoryName', getSolverWorkingDirectoryName
end function end function
function getFullJobName function getSolverJobName
use prec use prec
implicit none implicit none
character(1024) getFullJobName, outName character(1024) getSolverJobName, outName
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! /, \
integer(pInt) extPos integer(pInt) extPos
getFullJobName='' getSolverJobName=''
outName='' outName=''
inquire(6, name=outName) ! determine outputfile inquire(6, name=outName) ! determine outputfile
extPos = len_trim(outName)-4 extPos = len_trim(outName)-4
getFullJobName=outName(1:extPos) getSolverJobName=outName(scan(outName,pathSep,back=.true.)+1:extPos)
! write(6,*) 'getFullJobName', getFullJobName ! write(6,*) 'getSolverJobName', getSolverJobName
end function
function getInputFileName
implicit none
character(1024) getInputFileName
getInputFileName=''
getInputFileName=trim(getFullJobName())//'.dat'
! write(6,*) 'getInputFileName', getInputFileName
end function end function
END MODULE END MODULE