2010-10-26 20:32:20 +05:30
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2011-03-11 14:50:37 +05:30
|
|
|
# renders the postprocessing routines acessible from everywhere.
|
2010-10-26 20:32:20 +05:30
|
|
|
# you need a ~/bin directory in your home folder
|
2011-03-11 14:50:37 +05:30
|
|
|
# if necessary, add the bin directory to your path by
|
|
|
|
# adding the following lines to your .bashrc file:
|
2010-10-26 20:32:20 +05:30
|
|
|
# PATH="$PATH:~/bin"
|
|
|
|
# export PATH
|
|
|
|
|
2011-01-26 20:47:03 +05:30
|
|
|
import os,sys,glob
|
2010-10-26 20:32:20 +05:30
|
|
|
|
2011-11-09 21:50:52 +05:30
|
|
|
import damask_tools; reload(damask_tools)
|
|
|
|
damask_tools.DAMASK_TOOLS().check_env()
|
|
|
|
|
2011-01-26 20:47:03 +05:30
|
|
|
bin_link = { \
|
2010-10-26 20:32:20 +05:30
|
|
|
'pre' : [
|
2011-11-09 21:07:45 +05:30
|
|
|
'marc_addUserOutput.py',
|
|
|
|
'mentat_pbcOnBoxMesh.py',
|
|
|
|
'mentat_spectralBox.py',
|
|
|
|
'patchFromReconstructedBoundaries.py',
|
|
|
|
'spectral_geomCheck.py',
|
|
|
|
'spectral_minimalSurface.py',
|
|
|
|
'spectral_vicinityOffset.py',
|
|
|
|
'voronoi_randomSeeding.py',
|
|
|
|
'voronoi_tessellation.py',
|
2010-10-26 20:32:20 +05:30
|
|
|
],
|
|
|
|
'post' : [
|
2011-11-09 21:07:45 +05:30
|
|
|
'3Dvisualize.py',
|
|
|
|
'addCauchy.py',
|
|
|
|
'addDeterminant.py',
|
|
|
|
'addDivergence.py',
|
|
|
|
'addMises.py',
|
|
|
|
'addNorm.py',
|
|
|
|
'addStrainTensors.py',
|
|
|
|
'addCompatibilityMismatch.py',
|
|
|
|
'averageDown.py',
|
|
|
|
'mentat_colorMap.py',
|
|
|
|
'postResults.py',
|
|
|
|
'spectral_iterationCount.py',
|
|
|
|
'spectral_convergence.py',
|
|
|
|
'spectral_scaleGeom.py',
|
2010-10-26 20:32:20 +05:30
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2011-01-26 20:47:03 +05:30
|
|
|
compile = { \
|
|
|
|
'pre' : [
|
|
|
|
'voronoi_randomSeeding.f90',
|
|
|
|
'voronoi_tessellation.f90',
|
|
|
|
],
|
|
|
|
'post' : [
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2011-03-11 14:50:37 +05:30
|
|
|
execute = { \
|
|
|
|
'pre' : [
|
|
|
|
],
|
|
|
|
'post' : [
|
|
|
|
'make_postprocessingMath',
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2011-11-09 21:50:52 +05:30
|
|
|
homedir = os.getenv('HOME')
|
2011-11-09 21:07:45 +05:30
|
|
|
#basedir = os.path.join(os.path.dirname(sys.argv[0]),'..')
|
2011-11-09 21:50:52 +05:30
|
|
|
damask_root = os.getenv('DAMASK_ROOT')
|
2011-11-09 21:07:45 +05:30
|
|
|
basedir = os.getenv('DAMASK_ROOT')+'/processing/'
|
|
|
|
|
2011-01-26 20:47:03 +05:30
|
|
|
for dir in bin_link:
|
|
|
|
for file in bin_link[dir]:
|
2010-10-26 20:32:20 +05:30
|
|
|
src = os.path.abspath(os.path.join(basedir,dir,file))
|
|
|
|
if (file == ''):
|
2011-11-09 21:50:52 +05:30
|
|
|
sym_link = os.path.abspath(os.path.join(damask_root,'bin',dir))
|
2010-10-26 20:32:20 +05:30
|
|
|
else:
|
2011-11-09 21:50:52 +05:30
|
|
|
sym_link = os.path.abspath(os.path.join(damask_root,'bin',os.path.splitext(file)[0]))
|
|
|
|
print sym_link,'-->',src
|
|
|
|
if os.path.lexists(sym_link):
|
|
|
|
os.remove(sym_link)
|
|
|
|
os.symlink(src,sym_link)
|
|
|
|
|
|
|
|
#--- uncomment next lines to remove your old symbolic links in ~/bin
|
|
|
|
#old_link=sym_link.replace(damask_root,homedir)
|
|
|
|
#if os.path.lexists(old_link):
|
|
|
|
# os.remove(old_link)
|
|
|
|
|
2011-11-09 21:07:45 +05:30
|
|
|
|
2011-01-26 20:47:03 +05:30
|
|
|
for dir in compile:
|
|
|
|
for file in compile[dir]:
|
|
|
|
src = os.path.abspath(os.path.join(basedir,dir,file))
|
|
|
|
if os.path.isfile(src):
|
|
|
|
print file
|
2011-08-25 17:46:06 +05:30
|
|
|
os.system('rm %s.exe'%(os.path.splitext(src)[0]))
|
2011-10-15 04:09:58 +05:30
|
|
|
os.system('ifort -O3 -parallel -o%s %s'%(os.path.splitext(src)[0],src))
|
2011-03-22 21:12:53 +05:30
|
|
|
|
|
|
|
modules = glob.glob('*.mod')
|
2011-01-26 20:47:03 +05:30
|
|
|
for module in modules:
|
|
|
|
print module
|
|
|
|
os.remove(module)
|
2011-03-11 14:50:37 +05:30
|
|
|
|
|
|
|
for dir in execute:
|
|
|
|
for file in execute[dir]:
|
|
|
|
cmd = os.path.abspath(os.path.join(basedir,dir,file))
|
|
|
|
if os.access(cmd,os.X_OK):
|
|
|
|
print cmd
|
|
|
|
os.system('%s %s'%(cmd,os.path.join(basedir,dir)))
|