import of damask.core will not complain any more if done in setup_processing.py, however setup_processing.py will check if core.so exist after compilation and delete it before compilation

This commit is contained in:
Martin Diehl 2012-10-25 07:55:27 +00:00
parent b212da5928
commit 868984cb89
3 changed files with 23 additions and 9 deletions

View File

@ -43,7 +43,9 @@ try:
#core.mesh.deformedCoordsLin = core.mesh.mesh_deformedCoordsLin
#core.mesh.deformedCoordsFFT = core.mesh.mesh_deformedCoordsFFT
except ImportError, e:
sys.stderr.write('\nWARNING: Core module (Fortran code) not available, try to run setup_processing.py\nError Message when importing core.so: %s\n\n'%e)
core = None # from http://www.python.org/dev/peps/pep-0008/
if(sys.argv[0]!='setup_processing.py'):
sys.stderr.write('\nWARNING: Core module (Fortran code) not available, '\
'try to run setup_processing.py\nError Message when importing core.so: %s\n\n'%e)

View File

@ -171,11 +171,15 @@ class Test():
table = damask.ASCIItable(refFile)
table.head_read()
refFile.close()
refArray = numpy.nan_to_num(numpy.genfromtxt(File1,missing_values='n/a',skip_header = len(table.info)+1))
curArray = numpy.nan_to_num(numpy.genfromtxt(File2,missing_values='n/a',skip_header = len(table.info)+1))
refArray = numpy.nan_to_num(numpy.genfromtxt(File1,missing_values='n/a',skip_header = len(table.info)+1,autostrip=True))
curArray = numpy.nan_to_num(numpy.genfromtxt(File2,missing_values='n/a',skip_header = len(table.info)+1,autostrip=True))
if len(curArray) == len(refArray):
max_err=numpy.max(abs(refArray[curArray.nonzero()]/curArray[curArray.nonzero()]-1.))
print ' ********\n * maximum relative error',max_err,'\n ********'
return max_err
else:
print ' ********\n * mismatch in array size to compare \n ********'
return sys.float_info.max
def compare_ArrayRefCur(self,ref,cur=''):

View File

@ -142,6 +142,7 @@ execute = { \
#'f2py -h damask.core.pyf' +\
#' --overwrite-signature --no-lower prec.f90 DAMASK_spectral_interface.f90 math.f90 mesh.f90',
###########################################################################
'rm `readlink -f %s`' %(os.path.join(damaskEnv.relPath('lib/damask'),'core.so')),
'f2py damask.core.pyf' +\
' --build-dir ./' +\
' -c --no-lower --fcompiler=%s'%(f2py_compiler) +\
@ -161,7 +162,7 @@ execute = { \
}
for dir in compile:
for dir in compile: #there is nothing to compile at the moment
for file in compile[dir]:
src = os.path.abspath(os.path.join(baseDir,dir,file))
if os.path.isfile(src):
@ -201,3 +202,10 @@ for dir in bin_link:
os.remove(sym_link)
os.symlink(src,sym_link)
#check if compilation of core module was successful
try:
with open(damaskEnv.relPath('lib/damask/core.so')) as f: pass
except IOError as e:
print '*********\n* core.so not found, compilation of core modules was not successful\n*********'
sys.exit()
f.close