scripts are now aware of symbolic links to themselves...

This commit is contained in:
Philip Eisenlohr 2010-10-26 16:26:55 +00:00
parent 18344b4e65
commit 487466dd88
5 changed files with 58 additions and 17 deletions

View File

@ -10,9 +10,12 @@ releases = {'2010':['linux64',''],
'2005r3':[''],
}
file = open('%s/../MSCpath'%os.path.dirname(sys.argv[0]))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
try:
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
@ -24,7 +27,12 @@ for release,subdirs in sorted(releases.items(),reverse=True):
continue
break
from py_mentat import *
try:
from py_mentat import *
except:
print('error: no valid Mentat release found in %s'%MSCpath)
sys.exit(-1)

View File

@ -9,9 +9,12 @@ releases = {'2010':['linux64',''],
'2005r3':[''],
}
file = open('%s/../MSCpath'%os.path.dirname(sys.argv[0]))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
try:
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
@ -23,7 +26,12 @@ for release,subdirs in sorted(releases.items(),reverse=True):
continue
break
from py_post import *
try:
from py_post import *
except:
print('error: no valid Mentat release found in %s'%MSCpath)
sys.exit(-1)
# -----------------------------

View File

@ -15,9 +15,12 @@ releases = {'2010':['linux64',''],
'2005r3':[''],
}
file = open('%s/../MSCpath'%os.path.dirname(sys.argv[0]))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
try:
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
@ -29,7 +32,12 @@ for release,subdirs in sorted(releases.items(),reverse=True):
continue
break
from py_mentat import *
try:
from py_mentat import *
except:
print('error: no valid Mentat release found in %s'%MSCpath)
sys.exit(-1)
def outMentat(cmd,locals):

View File

@ -10,9 +10,12 @@ releases = {'2010':['linux64',''],
'2005r3':[''],
}
file = open('%s/../MSCpath'%os.path.dirname(sys.argv[0]))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
try:
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
@ -24,7 +27,12 @@ for release,subdirs in sorted(releases.items(),reverse=True):
continue
break
from py_mentat import *
try:
from py_mentat import *
except:
print('error: no valid Mentat release found in %s'%MSCpath)
sys.exit(-1)
def outMentat(cmd,locals):
if cmd[0:3] == '(!)':

View File

@ -113,6 +113,8 @@ def geometry():
"*geometry_option red_integ_capacity:on",
"*add_geometry_elements",
"all_existing",
"*element_type 117",
"all_existing",
]
return cmds
@ -131,6 +133,13 @@ def initial_conditions(N,data):
elements[id-1].append(element)
cmds = [\
"*new_icond",
"*icond_name temperature",
"*icond_type state_variable",
"*icond_param_value state_var_id 1",
"*icond_dof_value var 300",
"*add_icond_elements",
"all_existing",
"*new_icond",
"*icond_name homogenization",
"*icond_type state_variable",
@ -171,7 +180,7 @@ parser.set_defaults(d = (16,16,16))
parser.set_defaults(N = (16,16,16))
try:
file = open('%s/../MSCpath'%os.path.dirname(sys.argv[0]))
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except: