Merge remote-tracking branch 'refs/remotes/origin/development'
Conflicts: lib/damask/test/test.py
This commit is contained in:
commit
6f843ce85b
|
@ -178,7 +178,6 @@ subroutine math_init
|
||||||
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
|
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
|
||||||
use prec, only: tol_math_check
|
use prec, only: tol_math_check
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
worldrank, &
|
|
||||||
fixedSeed
|
fixedSeed
|
||||||
use IO, only: IO_error, IO_timeStamp
|
use IO, only: IO_error, IO_timeStamp
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,6 @@ class Test():
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
"""Delete directory tree containing current results."""
|
"""Delete directory tree containing current results."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(self.dirCurrent())
|
shutil.rmtree(self.dirCurrent())
|
||||||
except:
|
except:
|
||||||
|
@ -549,14 +548,16 @@ class Test():
|
||||||
|
|
||||||
def report_Success(self,culprit):
|
def report_Success(self,culprit):
|
||||||
|
|
||||||
|
ret = culprit
|
||||||
|
|
||||||
if culprit == 0:
|
if culprit == 0:
|
||||||
logging.critical(('The test' if len(self.variants) == 1 else 'All {} tests'.format(len(self.variants))) + ' passed')
|
msg = 'The test passed' if len(self.variants) == 1 \
|
||||||
logging.critical('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
else 'All {} tests passed.'.format(len(self.variants))
|
||||||
return 0
|
elif culprit == -1:
|
||||||
if culprit == -1:
|
msg = 'Warning: Could not start test...'
|
||||||
logging.warning('Warning: Could not start test')
|
ret = 0
|
||||||
return 0
|
|
||||||
else:
|
else:
|
||||||
logging.critical(' ********\n * Test {} failed...\n ********'.format(culprit))
|
msg = ' * Test "{}" failed.'.format(self.variants[culprit-1])
|
||||||
logging.critical('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
|
|
||||||
return culprit
|
logging.critical('\n'.join(['*'*40,msg,'*'*40]) + '\n')
|
||||||
|
return ret
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import os,vtk
|
import os,vtk
|
||||||
import damask
|
import damask
|
||||||
|
import numpy as np
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
@ -131,11 +132,14 @@ for name in filenames:
|
||||||
|
|
||||||
for datatype,labels in active.items(): # loop over scalar,color
|
for datatype,labels in active.items(): # loop over scalar,color
|
||||||
for me in labels: # loop over all requested items
|
for me in labels: # loop over all requested items
|
||||||
theData = [table.data[i] for i in table.label_indexrange(me)] # read strings
|
theData = [float(table.data[i]) for i in table.label_indexrange(me)] # read strings
|
||||||
if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData))
|
if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*x),theData))
|
||||||
elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData))
|
elif datatype == 'scalar': VTKarray[me].InsertNextValue(theData[0])
|
||||||
elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*map(float,theData))
|
elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*theData)
|
||||||
elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0]))
|
elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*0.5*(np.array(theData)+
|
||||||
|
np.array(theData) \
|
||||||
|
.reshape(3,3).T \
|
||||||
|
.reshape(9)))
|
||||||
|
|
||||||
table.input_close() # close input ASCII table
|
table.input_close() # close input ASCII table
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import os,vtk
|
import os,vtk
|
||||||
import damask
|
import damask
|
||||||
|
import numpy as np
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
@ -38,6 +39,10 @@ parser.add_option('-v', '--vector',
|
||||||
dest = 'vector',
|
dest = 'vector',
|
||||||
action = 'extend', metavar = '<string LIST>',
|
action = 'extend', metavar = '<string LIST>',
|
||||||
help = 'vector value label(s)')
|
help = 'vector value label(s)')
|
||||||
|
parser.add_option('-t', '--tensor',
|
||||||
|
dest = 'tensor',
|
||||||
|
action = 'extend', metavar = '<string LIST>',
|
||||||
|
help = 'tensor (3x3) value label(s)')
|
||||||
parser.add_option('-c', '--color',
|
parser.add_option('-c', '--color',
|
||||||
dest = 'color',
|
dest = 'color',
|
||||||
action = 'extend', metavar = '<string LIST>',
|
action = 'extend', metavar = '<string LIST>',
|
||||||
|
@ -45,6 +50,7 @@ parser.add_option('-c', '--color',
|
||||||
|
|
||||||
parser.set_defaults(scalar = [],
|
parser.set_defaults(scalar = [],
|
||||||
vector = [],
|
vector = [],
|
||||||
|
tensor = [],
|
||||||
color = [],
|
color = [],
|
||||||
inplace = False,
|
inplace = False,
|
||||||
render = False,
|
render = False,
|
||||||
|
@ -95,6 +101,7 @@ for name in filenames:
|
||||||
|
|
||||||
for datatype,dimension,label in [['scalar',1,options.scalar],
|
for datatype,dimension,label in [['scalar',1,options.scalar],
|
||||||
['vector',3,options.vector],
|
['vector',3,options.vector],
|
||||||
|
['tensor',9,options.tensor],
|
||||||
['color',3,options.color],
|
['color',3,options.color],
|
||||||
]:
|
]:
|
||||||
for i,dim in enumerate(table.label_dimension(label)):
|
for i,dim in enumerate(table.label_dimension(label)):
|
||||||
|
@ -105,7 +112,7 @@ for name in filenames:
|
||||||
remarks.append('adding {} "{}"...'.format(datatype,me))
|
remarks.append('adding {} "{}"...'.format(datatype,me))
|
||||||
active[datatype].append(me)
|
active[datatype].append(me)
|
||||||
|
|
||||||
if datatype in ['scalar','vector']: VTKarray[me] = vtk.vtkDoubleArray()
|
if datatype in ['scalar','vector','tensor']: VTKarray[me] = vtk.vtkDoubleArray()
|
||||||
elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray()
|
elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray()
|
||||||
|
|
||||||
VTKarray[me].SetNumberOfComponents(dimension)
|
VTKarray[me].SetNumberOfComponents(dimension)
|
||||||
|
@ -128,8 +135,12 @@ for name in filenames:
|
||||||
for me in labels: # loop over all requested items
|
for me in labels: # loop over all requested items
|
||||||
theData = [table.data[i] for i in table.label_indexrange(me)] # read strings
|
theData = [table.data[i] for i in table.label_indexrange(me)] # read strings
|
||||||
if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData))
|
if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData))
|
||||||
elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData))
|
|
||||||
elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0]))
|
elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0]))
|
||||||
|
elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData))
|
||||||
|
elif datatype == 'tensor': VTKarray[me].InsertNextTuple9(*0.5*(np.array(theData)+
|
||||||
|
np.array(theData) \
|
||||||
|
.reshape(3,3).T \
|
||||||
|
.reshape(9)))
|
||||||
|
|
||||||
table.close() # close input ASCII table
|
table.close() # close input ASCII table
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue