small fixes

This commit is contained in:
Martin Diehl 2020-03-19 11:51:30 +01:00
parent 0f677ac3ec
commit 27532cfa4e
5 changed files with 13 additions and 13 deletions

View File

@ -70,7 +70,7 @@ for filename in options.filenames:
pass pass
o = h5py.File(dirname + '/' + os.path.splitext(filename)[0] \ o = h5py.File(dirname + '/' + os.path.splitext(filename)[0] \
+ 'inc_{}.dream3D'.format(inc[3:].zfill(N_digits)),'w') + '_inc_{}.dream3D'.format(inc[3:].zfill(N_digits)),'w')
o.attrs['DADF5toDREAM3D'] = '1.0' o.attrs['DADF5toDREAM3D'] = '1.0'
o.attrs['FileVersion'] = '7.0' o.attrs['FileVersion'] = '7.0'

View File

@ -5,6 +5,8 @@ import sys
from io import StringIO from io import StringIO
from optparse import OptionParser from optparse import OptionParser
import numpy as np
import damask import damask
scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptName = os.path.splitext(os.path.basename(__file__))[0]

View File

@ -3,6 +3,7 @@
import os import os
import sys import sys
import multiprocessing import multiprocessing
from io import StringIO
from optparse import OptionParser,OptionGroup from optparse import OptionParser,OptionGroup
import numpy as np import numpy as np
@ -15,7 +16,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version]) scriptID = ' '.join([scriptName,damask.version])
def Laguerre_tessellation(grid, seeds, weights, grains, periodic = True, cpus = 2): def Laguerre_tessellation(grid, seeds, grains, size, periodic, weights, cpus):
def findClosestSeed(fargs): def findClosestSeed(fargs):
point, seeds, myWeights = fargs point, seeds, myWeights = fargs
@ -52,10 +53,10 @@ def Laguerre_tessellation(grid, seeds, weights, grains, periodic = True, cpus =
[ -1, 1, 1 ], [ -1, 1, 1 ],
[ 0, 1, 1 ], [ 0, 1, 1 ],
[ 1, 1, 1 ], [ 1, 1, 1 ],
]).astype(float)*info['size'] if periodic else \ ],dtype=np.float)*size if periodic else \
np.array([ np.array([
[ 0, 0, 0 ], [ 0, 0, 0 ],
]).astype(float) ],dtype=np.float)
repeatweights = np.tile(weights,len(copies)).flatten(order='F') # Laguerre weights (1,2,3,1,2,3,...,1,2,3) repeatweights = np.tile(weights,len(copies)).flatten(order='F') # Laguerre weights (1,2,3,1,2,3,...,1,2,3)
for vec in copies: # periodic copies of seed points ... for vec in copies: # periodic copies of seed points ...
@ -237,7 +238,8 @@ for name in filenames:
damask.util.croak('tessellating...') damask.util.croak('tessellating...')
if options.laguerre: if options.laguerre:
indices = Laguerre_tessellation(coords,seeds,table.get(options.weight),grains,options.periodic,options.cpus) indices = Laguerre_tessellation(coords,seeds,grains,size,options.periodic,
table.get(options.weight),options.cpus)
else: else:
indices = Voronoi_tessellation (coords,seeds,grains,size,options.periodic) indices = Voronoi_tessellation (coords,seeds,grains,size,options.periodic)

View File

@ -1,20 +1,17 @@
import os import os
try:
import tkinter import tkinter
except:
tkinter = None
class Environment: class Environment:
def __init__(self): def __init__(self):
"""Read and provide values of DAMASK configuration.""" """Read and provide values of DAMASK configuration."""
self.options = self._get_options() self.options = self._get_options()
if tkinter: try:
tk = tkinter.Tk() tk = tkinter.Tk()
self.screen_width = tk.winfo_screenwidth() self.screen_width = tk.winfo_screenwidth()
self.screen_height = tk.winfo_screenheight() self.screen_height = tk.winfo_screenheight()
tk.destroy() tk.destroy()
else: except tkinter.TclError:
self.screen_width = 1024 self.screen_width = 1024
self.screen_height = 768 self.screen_height = 768

View File

@ -49,7 +49,6 @@ class VTK:
Spatial origin. Spatial origin.
""" """
geom = vtk.vtkRectilinearGrid() geom = vtk.vtkRectilinearGrid()
geom.SetDimensions(*(grid+1)) geom.SetDimensions(*(grid+1))
geom.SetXCoordinates(np_to_vtk(np.linspace(origin[0],origin[0]+size[0],grid[0]+1),deep=True)) geom.SetXCoordinates(np_to_vtk(np.linspace(origin[0],origin[0]+size[0],grid[0]+1),deep=True))