fixed wrong assignment of phase and made orientation comparison robust
This commit is contained in:
parent
e6d1b21b57
commit
8dea16c07f
|
@ -108,7 +108,6 @@ for file in files:
|
||||||
if info['grid'].prod() != point:
|
if info['grid'].prod() != point:
|
||||||
file['croak'].write('Error: found %s microstructures. Header info in ang file might be wrong.\n'%point)
|
file['croak'].write('Error: found %s microstructures. Header info in ang file might be wrong.\n'%point)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if options.compress:
|
if options.compress:
|
||||||
texture = []
|
texture = []
|
||||||
microstructure = []
|
microstructure = []
|
||||||
|
@ -118,20 +117,19 @@ for file in files:
|
||||||
myTexture = -1
|
myTexture = -1
|
||||||
for otherPoint in xrange(len(microstructure)):
|
for otherPoint in xrange(len(microstructure)):
|
||||||
otherEulers = eulerangles[texture[microstructure[otherPoint][0]]]
|
otherEulers = eulerangles[texture[microstructure[otherPoint][0]]]
|
||||||
otherPhase = phase[microstructure[otherPoint][1]]
|
otherPhase = microstructure[otherPoint][1]
|
||||||
if all(eulerangles[myPoint]==otherEulers) and phase[myPoint] == otherPhase: # common microstructure
|
if all(abs(eulerangles[myPoint]-otherEulers)<1e-6) and phase[myPoint] == otherPhase: # common microstructure
|
||||||
matPoints[myPoint] = otherPoint+1 # use other points microstructure
|
matPoints[myPoint] = otherPoint+1 # use other point's microstructure, +1 because starting with 1 (.config) instead of 0 (python)
|
||||||
otherPoint = -2 # never create new microstructure
|
otherPoint = -2 # never create new microstructure
|
||||||
break
|
break
|
||||||
elif all(eulerangles[myPoint] == otherEulers): # found common texture and store it
|
elif all(eulerangles[myPoint] == otherEulers): # found common texture and store it
|
||||||
myTexture = microstructure[otherPoint][0]
|
myTexture = microstructure[otherPoint][0]
|
||||||
if otherPoint == len(microstructure)-1: # did not found matching microstructure
|
if otherPoint == len(microstructure)-1: # did not found matching microstructure
|
||||||
if myTexture == -1: # did not even found matching texture
|
if myTexture == -1: # did not even found matching texture
|
||||||
|
myTexture = len(texture)
|
||||||
texture.append(myPoint)
|
texture.append(myPoint)
|
||||||
myTexture = myPoint
|
microstructure.append([myTexture,phase[myPoint]])
|
||||||
microstructure.append([myTexture,phase[myPoint-1]]) # here, the counter is one more than in the line above!
|
|
||||||
matPoints[myPoint] = len(microstructure) # use the new microstructure
|
matPoints[myPoint] = len(microstructure) # use the new microstructure
|
||||||
file['croak'].write("%i %i\n"%(texture,microstructure))
|
|
||||||
else:
|
else:
|
||||||
texture = [i for i in xrange(info['grid'][0]*info['grid'][1])]
|
texture = [i for i in xrange(info['grid'][0]*info['grid'][1])]
|
||||||
microstructure = [[i,phase[i]] for i in xrange(info['grid'][0]*info['grid'][1])]
|
microstructure = [[i,phase[i]] for i in xrange(info['grid'][0]*info['grid'][1])]
|
||||||
|
@ -139,7 +137,7 @@ for file in files:
|
||||||
formatOut = 1+int(math.log10(len(texture)))
|
formatOut = 1+int(math.log10(len(texture)))
|
||||||
textureOut =['\n\n<texture>']
|
textureOut =['\n\n<texture>']
|
||||||
for i in xrange(len(texture)):
|
for i in xrange(len(texture)):
|
||||||
textureOut += ['[Texture%s]\n'%str(i+1).zfill(formatOut) + \
|
textureOut += ['[Texture%s]\n'%str(texture[i]+1).zfill(formatOut) + \
|
||||||
'axes %s %s %s\n'%(options.axes[0],options.axes[1],options.axes[2]) +\
|
'axes %s %s %s\n'%(options.axes[0],options.axes[1],options.axes[2]) +\
|
||||||
'(gauss)\tphi1 %4.2f\tPhi %4.2f\tphi2 %4.2f\tscatter 0.0\tfraction 1.0\n'%tuple(eulerangles[texture[i],...])
|
'(gauss)\tphi1 %4.2f\tPhi %4.2f\tphi2 %4.2f\tscatter 0.0\tfraction 1.0\n'%tuple(eulerangles[texture[i],...])
|
||||||
]
|
]
|
||||||
|
@ -190,6 +188,5 @@ for file in files:
|
||||||
#--- output finalization --------------------------------------------------------------------------
|
#--- output finalization --------------------------------------------------------------------------
|
||||||
if file['name'] != 'STDIN':
|
if file['name'] != 'STDIN':
|
||||||
file['output'].close()
|
file['output'].close()
|
||||||
print os.path.splitext(file['name'])[0]
|
|
||||||
os.rename(file['name']+'_tmp',
|
os.rename(file['name']+'_tmp',
|
||||||
os.path.splitext(file['name'])[0] +'%s'%('_material.config' if options.config else '.geom'))
|
os.path.splitext(file['name'])[0] +'%s'%('_material.config' if options.config else '.geom'))
|
||||||
|
|
Loading…
Reference in New Issue