2010-10-26 20:32:20 +05:30
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2011-11-09 23:34:51 +05:30
|
|
|
# Makes postprocessing routines acessible from everywhere.
|
2010-10-26 20:32:20 +05:30
|
|
|
|
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 = { \
|
2011-11-09 23:21:00 +05:30
|
|
|
'pre' : [
|
|
|
|
'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',
|
|
|
|
],
|
|
|
|
'post' : [
|
|
|
|
'3Dvisualize.py',
|
|
|
|
'addCauchy.py',
|
2011-12-02 20:45:36 +05:30
|
|
|
'addCalculation.py',
|
2011-11-09 23:21:00 +05:30
|
|
|
'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 = { \
|
2011-11-09 23:21:00 +05:30
|
|
|
'pre' : [
|
|
|
|
'voronoi_randomSeeding.f90',
|
|
|
|
'voronoi_tessellation.f90',
|
|
|
|
],
|
|
|
|
'post' : [
|
|
|
|
],
|
|
|
|
}
|
2011-01-26 20:47:03 +05:30
|
|
|
|
2011-03-11 14:50:37 +05:30
|
|
|
execute = { \
|
2011-11-09 23:21:00 +05:30
|
|
|
'pre' : [
|
|
|
|
],
|
|
|
|
'post' : [
|
2011-12-01 17:32:36 +05:30
|
|
|
'make_DAMASK2Python',
|
2011-11-09 23:21:00 +05:30
|
|
|
],
|
|
|
|
}
|
2011-03-11 14:50:37 +05:30
|
|
|
|
2011-11-09 21:50:52 +05:30
|
|
|
damask_root = os.getenv('DAMASK_ROOT')
|
2011-11-09 23:21:00 +05:30
|
|
|
if damask_root == '' or damask_root == None: damask_root = os.path.join(os.path.dirname(sys.argv[0]),'../../')
|
|
|
|
damask_bin = os.getenv('DAMASK_BIN')
|
|
|
|
if damask_bin == '' or damask_bin == None: damask_bin = os.path.join(damask_root,'bin/')
|
|
|
|
basedir = os.path.join(damask_root,'processing/')
|
2011-11-09 21:07:45 +05:30
|
|
|
|
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 23:21:00 +05:30
|
|
|
sym_link = os.path.abspath(os.path.join(damask_bin,dir))
|
2010-10-26 20:32:20 +05:30
|
|
|
else:
|
2011-11-09 23:21:00 +05:30
|
|
|
sym_link = os.path.abspath(os.path.join(damask_bin,os.path.splitext(file)[0]))
|
2011-11-09 21:50:52 +05:30
|
|
|
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
|
2011-11-09 23:34:51 +05:30
|
|
|
#old_link=sym_link.replace(damask_root,os.getenv('HOME'))
|
2011-11-09 21:50:52 +05:30
|
|
|
#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)))
|