Fortran90marc必备.docx
《Fortran90marc必备.docx》由会员分享,可在线阅读,更多相关《Fortran90marc必备.docx(37页珍藏版)》请在冰点文库上搜索。
Fortran90marc必备
REM让marc自定义子程序支持f90
REM请将本run_marc.bat文件copy到marc安装目录下tools文件夹
REM作者:
阚前华
REM*.bat清单:
REM########################################################################
@echooff
setlocal
for%%iin(%0)dosetDIR=%%~dpi
ifexist"%DIR%\..\tools\include.bat"gotofull_path
for%%iin(run_marc.bat)dosetDIR=%%~dp$PATH:
i
:
full_path
REMifeditedinherebyuser,thepathmustincludethedriveletter
setDIR=%DIR%..
CALL"%DIR%\tools\include.bat"
REM
REM#########################################################################
REM
REMrun_marc-runamarcjob
REM-------------------------
REM
REMusage:
run_marc-jjid{options}
REM
REMwhereoptionsare:
REM
REM-jjidjobidnumber.
REM-prprogprogramname(savedusersubroutineexecutable)
REM-rridrestartfilejobid.
REM-sisidsubstructurefileid.
REM-pipostpostfilejobid.
REM
REM-uuserusersubroutine.
REM-say|ndoordonotsaveloadmodule:
defaultstono
REM-auy|nuseautorestartfeature:
defaultstono
REMAutorestartcontrolstopstheanalysis,runs
REMameshertoremeshandrestartstheanalysis
REMWindowsNTonly.UsedforDCOMserversupport.
REM-nprocdnumberoftasksfordomaindecomposition.
REM-nthreadnumberofthreadspertask.
REM-itreemessagepassingtreefordomaindecomposition.
REM-dedefaultsfile.
REM-vfviewfactorfile.
REM-hosthostfile:
defaultstolocal
REM-memanualremeshingcontrol
REM-mamaxallparameter.overridesvaluegiveninincludefile
REM-pcremotecomputername:
defaultstolocal.WindowsNTonly.
REMUsedforDCOMserversupport.
REM-dirsetsthecurrentdirectory.thisiswherethejob
REMi/otakesplace.defaultstocurrentdirectory
REM-sdirsetsthescratchdirectory.thisiswherescratch
REMfilesforthejobarecreated.defaultstocurrent
REMdirectory
REM-dcoupcontactdecouplingusedforSuperformproblemwith
REMdeformabletools
REM
REM-alloconlyperformmemoryallocationtest,noanalysis
REM
REM-dytranflagtoswitchfromDytrantoMarc
REMdytran=0,programwillrunwithoutMarc-Dytranswitch.
REM=1,programwillrestartMarcafterDytranrun.
REM>=2,Notsupportedyet.
REM-dytranisnotsupportedforMSC.Marc2003
REM
REM########################################################################
REMVariablesfortheMARCenvironment
SETEXITMSG=%DIR%\tools\MESSAGES
SETAFMATDAT=%DIR%\AF_flowmat\
rem:
definepathtoglobalunifiedmaterialdatabase
SETMATFILE=
REMsetPATHtoincludePatranmeshdynamiclibrary
SETPATH=%DIR%\lib;%PATH%
REMdefaults
setprog=marc
setjid=
setpid=
setrid=
setsid=
setdid=
setvid=
setdirjid=
setdirpid=
setdirrid=
setdirsid=
setdirdid=
setdirvid=
setuser=
setuserdir=
setqid=y
remsetpriority=
setatt=
setpid=
setprgsav=n
seterror=
setnprocd=0
setnthread=0
setitree=0
setiam=
setnthreadmax=0
setmarclink=
setnauto=0
setndcoup=0
setndytran=0
sethost=
setuserhost=
setcpinput=y
setcpresults=y
setdist=n
setmesh=0
setmach=
setcmdline=
setjidlog=
setdcomserver=
setdotdat=.dat
setdirscrset=
reminitializedirjobanddirscrtocurrentdirectory
for/f"delims=="%%iin('cd')dosetcurdir=%%i
setdirjob=%curdir%
ifexist"%dir%\bin\run_marc_read.exe"gotorun_marc_read
echoerror,program
echo%dir%\bin\run_marc_read.exe
echowhichreadsthecommandlineoptionsdoesnotexist
gotoend_of_file
:
run_marc_read
remfirstrun%dirjob%\throughrun_marc_readwith-jasdummy
remargumenttostripoffbackslashincasejobisruninforinstancec:
\
call"%dir%\bin\run_marc_read.exe"-j"%dirjob%"\>.\run_marc_read.bat
call.\run_marc_read.bat
setdirjob=%value2%
setdirscr=%dirjob%
remscratchdirectorycanbespecifiedviaenvironmentalvariable
remMARCSCRATCH
if"%MARCSCRATCH%"==""gotonomarcscratch
ifexist%MARCSCRATCH%gotomarcscratchexists
echo.
echoerror,scratchdirectory"%MARCSCRATCH%"
echospecifiedviaenvironmentalvariableMARCSCRATCHdoesnotexist
gotoend_of_file
:
marcscratchexists
setdirscr=%MARCSCRATCH%
:
nomarcscratch
REM###########################################################################
REMparseinput-argumentsalwayscomeinpairs#
REM###########################################################################
setarg=%1
ifnot"%arg%"==""gotono_arg_end
seterror=noinputparametersspecified
gotoread_arg_error
:
no_arg_end
setcmdline=%1
:
read_arg_beg
shift
setcmdline=%cmdline%%1
if"%arg%"=="-al"gotoal_end1
ifnot"%arg%"=="-alloc"gotoal_end
:
al_end1
remjustrunmarcwith-allocoption
"%BINDIR%\marc.exe"-alloc1
gotoend_of_file
:
al_end
setvalue=%1
if"%arg%"==""gotoread_arg_end
ifnot"%error%"==""gotoread_arg_error
call"%dir%\bin\run_marc_read.exe"%arg%%value%>.\run_marc_read.bat
call.\run_marc_read.bat
ifnot"%arg%"=="-pr"gotopr_end
setprog=%value%
gotoread_new
:
pr_end
ifnot"%arg%"=="-j"gotoj_end
setjid=%value%
setdirjid=%value2%
if"%dirjid%"==""setdirjid=%curdir%
gotoread_new
:
j_end
ifnot"%arg%"=="-pi"gotopi_end
setpid=%value%
setdirpid=%value2%
if"%dirpid%"==""setdirpid=%curdir%
gotoread_new
:
pi_end
ifnot"%arg%"=="-r"gotor_end
setrid=%value%
setdirrid=%value2%
if"%dirrid%"==""setdirrid=%curdir%
gotoread_new
:
r_end
ifnot"%arg%"=="-si"gotosi_end
setsid=%value%
setdirsid=%value2%
if"%dirsid%"==""setdirsid=%curdir%
gotoread_new
:
si_end
ifnot"%arg%"=="-de"gotode_end
setdid=%value%
setdirdid=%value2%
if"%dirdid%"==""setdirdid=%curdir%
gotoread_new
:
de_end
ifnot"%arg%"=="-vf"gotovf_end
setvid=%value%
setdirvid=%value2%
if"%dirvid%"==""setdirvid=%curdir%
gotoread_new
:
vf_end
ifnot"%arg%"=="-u"gotou_end
setuser=%value%
setuserdir=%value2%
gotoread_new
:
u_end
ifnot"%arg%"=="-sa"gotosa_end
setprgsav=%value%
gotoread_new
:
sa_end
ifnot"%arg%"=="-np"gotonp_end
setnprocd=%value%
gotoread_new
:
np_end
ifnot"%arg%"=="-nt"gotont_end
setnthread=%value%
gotoread_new
:
nt_end
ifnot"%arg%"=="-ia"gotoiam_end
setiam=%value%
gotoread_new
:
iam_end
ifnot"%arg%"=="-it"gotoit_end
setitree=%value%
gotoread_new
:
it_end
ifnot"%arg%"=="-b"gotob_end
setqid=%value%
remqidischeckedandresetbelow
gotoread_new
:
b_end
ifnot"%arg%"=="-ho"gotoho_end
sethost=%value%
setuserhost=%value%
gotoread_new
:
ho_end
ifnot"%arg%"=="-au"gotoau_end
setnauto=%value%
gotoread_new
:
au_end
ifnot"%arg%"=="-dcoup"gotodcoup_end
setndcoup=%value%
gotoread_new
:
dcoup_end
ifnot"%arg%"=="-me"gotome_end
setmesh=%value%
gotoread_new
:
me_end
ifnot"%arg%"=="-ma"gotoma_end
setmaxsize=%value%
gotoread_new
:
ma_end
ifnot"%arg%"=="-ci"gotoci_end
setcpinput=%value%
gotoread_new
:
ci_end
ifnot"%arg%"=="-cr"gotocr_end
setcpresults=%value%
gotoread_new
:
cr_end
ifnot"%arg%"=="-di"gotodi_end
setdirjob=%1
if"%dirscrset%"==""setdirscr=%dirjob%
gotoread_new
:
di_end
ifnot"%arg%"=="-sd"gotosd_end
setdirscr=%1
setdirscrset=yes
gotoread_new
:
sd_end
ifnot"%arg%"=="-pc"gotopc_end
setmach=%1
setqid=n
gotoread_new
:
pc_end
ifnot"%arg%"=="-dy"gotodytran_end
setndytran=%value%
gotoread_new
:
dytran_end
REM-serveroptiononlysetbythemarcsvr.exeprogram
ifnot"%arg%"=="-se"gotose_end
setdcomserver=%1
setqid=%value%
gotoread_new
:
se_end
if"%arg%"=="-v"gotoread_new
if"%arg%"=="-ve"gotoread_new
if"%arg%"=="-co"gotoread_new
if"%arg%"=="-q"gotoread_new
seterror=nosuchoption:
%arg%orinputvalue:
%value%
gotoread_arg_error
:
read_new
shift
setarg=%1
setcmdline=%cmdline%%1
gotoread_arg_beg
:
read_arg_end
if"%nprocd%"=="1"setnprocd=0
setnthreadmax=%nthread%
ifnot"%nthreadmax%"=="0"gotonthreadmax_end
setnthreadmax=1
ifnot"%nprocd%"=="0"setnthreadmax=%nprocd%
:
nthreadmax_end
REM##########################################################################
REMcheckparametervalidity#
REM##########################################################################
REM
REMcheckforinputfileexistence
REM
ifnot"%mach%"==""gotorun_dcom
remif"%nprocd%"=="0"gotohost_end
if"%host%"==""gotohost_end
ifnotexist"%host%"gotohost_not_exist
REMCountthenumberofcpus.Ifonlyone,then
REMthisistheDCOMserverhosttoconnectwith.
set/AMCOUNT=0
for/f"tokens=1,2delims="%%iin(%host%)do(
setmach=%%i
set/AMCOUNT+=%%j
)
ifnot%MCOUNT%==1gotohost_end
gotorun_dcom
remifexist"%host%"gotohost_end
:
host_not_exist
seterror=file%host%doesnotexist
gotoread_arg_error
:
host_end
settestfile=%dirjid%\%jid%%dotdat%
ifnot"%nprocd%"=="0"settestfile=%dirjid%\1%jid%%dotdat%
ifexist"%testfile%"gotodat_end
seterror=file"%testfile%"doesnotexist
gotoread_arg_error
:
dat_end
REM
REMassumethat"program"isaprogramintheuserslocaldirectory
REM
setMDSRCLIB=mdsrc.lib
setbd=%BINDIR%\
ifnot"%prog%"=="marc"gotomarc_end
setprogram=marc.exe
setprefix=
ifnot"%nprocd%"=="0"setprefix=1
ifnot"%nprocd%"=="0"gotoparallel
remcheckifsingleprocessorexecutableexists
ifexist%bd%\marcs.exesetprogram=marcs.exe
ifexist%bd%\marcs.exesetMDSRCLIB=mdsrcs.lib
:
parallel
if"%pid%"==""gotomt16_end
ifexist"%dirpid%\%pid%.t16"gotomt16_end
ifexist"%dirpid%\%pid%.t19"gotomt16_end
seterror=file%dirpid%\%pid%.t16/t19doesnotexist
gotoread_arg_error
:
mt16_end
if"%rid%"==""gotomt08_end
ifexist"%dirrid%\%rid%.t08"gotomt08_end
seterror=file%dirrid%\%rid%.t08doesnotexist
gotoread_arg_error
:
mt08_end
if"%did%"==""gotomt49_end
ifexist"%dirdid%\%prefix%%did%%dotdat%"gotomt49_end
seterror=file%dirdid%\%prefix%%did%%dotdat%doesnotexist
gotoread