changed commandline parameters into a keyword driven form
use "-l, --load, --loadcase" to specify loadcase file and "-g, --geom, --geometry" to specify geometry file !incremental update, wait for commit of damask_spectral.f90 before checking out
This commit is contained in:
parent
ea2ba1573c
commit
9a6977b024
|
@ -49,20 +49,38 @@ function getSolverWorkingDirectoryName()
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
character(len=1024) cwd,outname,getSolverWorkingDirectoryName
|
character(len=1024) cwd,commandLine,outName,getSolverWorkingDirectoryName
|
||||||
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
||||||
|
integer :: i, start, length
|
||||||
|
|
||||||
|
call get_command(commandLine)
|
||||||
|
do i=1,len(commandLine) ! remove capitals
|
||||||
|
if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
start = index(commandLine,'-g',.true.) + 3_pInt ! search for '-g' and jump to first char of geometry
|
||||||
|
if (index(commandLine,'--geom',.true.)>0) then ! if '--geom' is found, use that (contains '-g')
|
||||||
|
start = index(commandLine,'--geom',.true.) + 7_pInt
|
||||||
|
endif
|
||||||
|
if (index(commandLine,'--geometry',.true.)>0) then ! again, now searching for --geometry'
|
||||||
|
start = index(commandLine,'--geometry',.true.) + 11_pInt
|
||||||
|
endif
|
||||||
|
if(start==3_pInt) stop 'No Geometry Specified, terminating DAMASK'! Could not find valid keyword functions from IO.f90 are not available
|
||||||
|
length = index(commandLine(start:len(commandLine)),' ',.false.)
|
||||||
|
|
||||||
call getarg(1,outname) ! path to loadFile
|
call get_command(commandLine) ! may contain capitals
|
||||||
|
outName = ' ' ! should be empty
|
||||||
if (scan(outname,pathSep) == 1) then ! absolute path given as command line argument
|
outName(1:length)=commandLine(start:start+length)
|
||||||
getSolverWorkingDirectoryName = outname(1:scan(outname,pathSep,back=.true.))
|
|
||||||
|
if (scan(outName,pathSep) == 1) then ! absolute path given as command line argument
|
||||||
|
getSolverWorkingDirectoryName = outName(1:scan(outName,pathSep,back=.true.))
|
||||||
else
|
else
|
||||||
call getcwd(cwd)
|
call getcwd(cwd)
|
||||||
getSolverWorkingDirectoryName = trim(cwd)//'/'//outname(1:scan(outname,pathSep,back=.true.))
|
getSolverWorkingDirectoryName = trim(cwd)//'/'//outName(1:scan(outName,pathSep,back=.true.))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
getSolverWorkingDirectoryName = rectifyPath(getSolverWorkingDirectoryName)
|
getSolverWorkingDirectoryName = rectifyPath(getSolverWorkingDirectoryName)
|
||||||
|
|
||||||
endfunction getSolverWorkingDirectoryName
|
endfunction getSolverWorkingDirectoryName
|
||||||
|
|
||||||
!********************************************************************
|
!********************************************************************
|
||||||
|
@ -71,13 +89,11 @@ endfunction getSolverWorkingDirectoryName
|
||||||
!********************************************************************
|
!********************************************************************
|
||||||
function getSolverJobName()
|
function getSolverJobName()
|
||||||
|
|
||||||
use prec, only: pInt
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
character(1024) :: getSolverJobName
|
||||||
|
|
||||||
character(1024) getSolverJobName
|
|
||||||
getSolverJobName = trim(getModelName())//'_'//trim(getLoadCase())
|
getSolverJobName = trim(getModelName())//'_'//trim(getLoadCase())
|
||||||
|
|
||||||
endfunction getSolverJobName
|
endfunction getSolverJobName
|
||||||
|
|
||||||
!********************************************************************
|
!********************************************************************
|
||||||
|
@ -90,13 +106,29 @@ function getModelName()
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
character(1024) getModelName, outName, cwd
|
character(1024) getModelName, outName, cwd, commandLine
|
||||||
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
||||||
integer(pInt) posExt,posSep
|
integer(pInt) :: i,posExt,posSep,start,length
|
||||||
|
|
||||||
getModelName = ''
|
call get_command(commandLine)
|
||||||
|
do i=1,len(commandLine) ! remove capitals
|
||||||
call getarg(1,outName)
|
if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
start = index(commandLine,'-g',.true.) + 3_pInt ! search for '-g' and jump to first char of geometry
|
||||||
|
if (index(commandLine,'--geom',.true.)>0) then ! if '--geom' is found, use that (contains '-g')
|
||||||
|
start = index(commandLine,'--geom',.true.) + 7_pInt
|
||||||
|
endif
|
||||||
|
if (index(commandLine,'--geometry',.true.)>0) then ! again, now searching for --geometry'
|
||||||
|
start = index(commandLine,'--geometry',.true.) + 11_pInt
|
||||||
|
endif
|
||||||
|
if(start==3_pInt) stop 'No Geometry Specified, terminating DAMASK'! Could not find valid keyword functions from IO.f90 are not available
|
||||||
|
length = index(commandLine(start:len(commandLine)),' ',.false.)
|
||||||
|
|
||||||
|
call get_command(commandLine) ! may contain capitals
|
||||||
|
getModelName = ' '
|
||||||
|
outName = ' ' ! should be empty
|
||||||
|
outName(1:length)=commandLine(start:start+length)
|
||||||
posExt = scan(outName,'.',back=.true.)
|
posExt = scan(outName,'.',back=.true.)
|
||||||
posSep = scan(outName,pathSep,back=.true.)
|
posSep = scan(outName,pathSep,back=.true.)
|
||||||
|
|
||||||
|
@ -112,6 +144,7 @@ function getModelName()
|
||||||
|
|
||||||
getModelName = makeRelativePath(getSolverWorkingDirectoryName(),&
|
getModelName = makeRelativePath(getSolverWorkingDirectoryName(),&
|
||||||
getModelName)
|
getModelName)
|
||||||
|
|
||||||
endfunction getModelName
|
endfunction getModelName
|
||||||
|
|
||||||
!********************************************************************
|
!********************************************************************
|
||||||
|
@ -124,19 +157,34 @@ function getLoadCase()
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
character(1024) getLoadCase, outName
|
character(1024) getLoadCase, outName, commandLine
|
||||||
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
||||||
integer(pInt) posExt,posSep
|
integer(pInt) posExt,posSep,i,start,length
|
||||||
|
|
||||||
|
call get_command(commandLine)
|
||||||
|
do i=1,len(commandLine) ! remove capitals
|
||||||
|
if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
start = index(commandLine,'-l',.true.) + 3_pInt ! search for '-l' and jump forward to given name
|
||||||
|
if (index(commandLine,'--load',.true.)>0) then ! if '--load' is found, use that (contains '-l')
|
||||||
|
start = index(commandLine,'--load',.true.) + 7_pInt
|
||||||
|
endif
|
||||||
|
if (index(commandLine,'--loadcase',.true.)>0) then ! again, now searching for --loadcase'
|
||||||
|
start = index(commandLine,'--loadcase',.true.) + 11_pInt
|
||||||
|
endif
|
||||||
|
if(start==3_pInt) stop 'No Loadcase Specified, terminating DAMASK'! Could not find valid keyword functions from IO.f90 are not available
|
||||||
|
length = index(commandLine(start:len(commandLine)),' ',.false.)
|
||||||
|
|
||||||
|
call get_command(commandLine) ! may contain capitals
|
||||||
getLoadCase = ''
|
getLoadCase = ''
|
||||||
|
outName = ' ' ! should be empty
|
||||||
posSep=1
|
outName(1:length)=commandLine(start:start+length)
|
||||||
call getarg(2,outName)
|
|
||||||
posExt = scan(outName,'.',back=.true.)
|
posExt = scan(outName,'.',back=.true.)
|
||||||
posSep = scan(outName,pathSep,back=.true.)
|
posSep = scan(outName,pathSep,back=.true.)
|
||||||
|
|
||||||
if (posExt <= posSep) posExt = len_trim(outName)+1 ! no extension present
|
if (posExt <= posSep) posExt = len_trim(outName)+1 ! no extension present
|
||||||
getLoadCase = outName(posSep+1:posExt-1) ! name of load case file exluding extension
|
getLoadCase = outName(posSep+1:posExt-1) ! name of load case file exluding extension
|
||||||
|
|
||||||
endfunction getLoadCase
|
endfunction getLoadCase
|
||||||
|
|
||||||
|
@ -151,12 +199,30 @@ function getLoadcaseName()
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
character(len=1024) getLoadcaseName, outName, cwd
|
character(len=1024) getLoadcaseName, cwd, commandLine
|
||||||
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
character(len=*), parameter :: pathSep = achar(47)//achar(92) ! forwardslash, backwardslash
|
||||||
integer(pInt) posExt,posSep
|
integer(pInt) posExt,posSep,i,start,length
|
||||||
posExt = 0
|
posExt = 0
|
||||||
|
|
||||||
call getarg(2,getLoadcaseName)
|
call get_command(commandLine)
|
||||||
|
do i=1,len(commandLine) ! remove capitals
|
||||||
|
if(64<iachar(commandLine(i:i)) .and. iachar(commandLine(i:i))<91) commandLine(i:i) =achar(iachar(commandLine(i:i))+32)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
start = index(commandLine,'-l',.true.) + 3_pInt ! search for '-l' and jump forward to given name
|
||||||
|
if (index(commandLine,'--load',.true.)>0) then ! if '--load' is found, use that (contains '-l')
|
||||||
|
start = index(commandLine,'--load',.true.) + 7_pInt
|
||||||
|
endif
|
||||||
|
if (index(commandLine,'--loadcase',.true.)>0) then ! again, now searching for --loadcase'
|
||||||
|
start = index(commandLine,'--loadcase',.true.) + 11_pInt
|
||||||
|
endif
|
||||||
|
if(start==3_pInt) stop 'No Loadcase Specified, terminating DAMASK'! Could not find valid keyword functions from IO.f90 are not available
|
||||||
|
length = index(commandLine(start:len(commandLine)),' ',.false.)
|
||||||
|
|
||||||
|
call get_command(commandLine) ! may contain capitals
|
||||||
|
getLoadCaseName = ' '
|
||||||
|
getLoadCaseName(1:length)=commandLine(start:start+length)
|
||||||
|
|
||||||
posExt = scan(getLoadcaseName,'.',back=.true.)
|
posExt = scan(getLoadcaseName,'.',back=.true.)
|
||||||
posSep = scan(getLoadcaseName,pathSep,back=.true.)
|
posSep = scan(getLoadcaseName,pathSep,back=.true.)
|
||||||
|
|
||||||
|
@ -236,4 +302,4 @@ function makeRelativePath(a,b)
|
||||||
|
|
||||||
endfunction makeRelativePath
|
endfunction makeRelativePath
|
||||||
|
|
||||||
END MODULE
|
END MODULE
|
||||||
|
|
Loading…
Reference in New Issue