no need to loop over files
will procude the same file over and over again
This commit is contained in:
parent
c5daa7e577
commit
f30eda0267
|
@ -70,30 +70,28 @@ parser.set_defaults(type = minimal_surfaces[0],
|
||||||
microstructure = (1,2),
|
microstructure = (1,2),
|
||||||
)
|
)
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filename) = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
if filenames == []: filenames = [None]
|
name = None if filename == [] else filename[0]
|
||||||
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
for name in filenames:
|
X = options.periods*2.0*np.pi*(np.arange(options.grid[0])+0.5)/options.grid[0]
|
||||||
damask.util.report(scriptName,name)
|
Y = options.periods*2.0*np.pi*(np.arange(options.grid[1])+0.5)/options.grid[1]
|
||||||
|
Z = options.periods*2.0*np.pi*(np.arange(options.grid[2])+0.5)/options.grid[2]
|
||||||
|
|
||||||
X = options.periods*2.0*np.pi*(np.arange(options.grid[0])+0.5)/options.grid[0]
|
microstructure = np.empty(options.grid,dtype=int)
|
||||||
Y = options.periods*2.0*np.pi*(np.arange(options.grid[1])+0.5)/options.grid[1]
|
for x in range(options.grid[0]):
|
||||||
Z = options.periods*2.0*np.pi*(np.arange(options.grid[2])+0.5)/options.grid[2]
|
for y in range(options.grid[1]):
|
||||||
|
for z in range(options.grid[2]):
|
||||||
|
microstructure[x,y,z]=options.microstructure[int(options.threshold < surface[options.type](X[x],Y[y],Z[z]))]
|
||||||
|
|
||||||
microstructure = np.empty(options.grid,dtype=int)
|
geom=damask.Geom(microstructure,options.size,
|
||||||
for x in range(options.grid[0]):
|
homogenization=options.homogenization,
|
||||||
for y in range(options.grid[1]):
|
comments=[scriptID + ' ' + ' '.join(sys.argv[1:])])
|
||||||
for z in range(options.grid[2]):
|
|
||||||
microstructure[x,y,z]=options.microstructure[int(options.threshold < surface[options.type](X[x],Y[y],Z[z]))]
|
|
||||||
|
|
||||||
geom=damask.Geom(microstructure,options.size,
|
damask.util.croak(geom)
|
||||||
homogenization=options.homogenization,
|
if name is None:
|
||||||
comments=[scriptID + ' ' + ' '.join(sys.argv[1:])])
|
sys.stdout.write(str(geom.show()))
|
||||||
|
else:
|
||||||
damask.util.croak(geom)
|
geom.to_file(name)
|
||||||
if name is None:
|
|
||||||
sys.stdout.write(str(geom.show()))
|
|
||||||
else:
|
|
||||||
geom.to_file(name)
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import math
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -193,7 +192,7 @@ class Geom():
|
||||||
"""Writes to file"""
|
"""Writes to file"""
|
||||||
header = self.get_header()
|
header = self.get_header()
|
||||||
grid = self.get_grid()
|
grid = self.get_grid()
|
||||||
format_string = '%{}i'.format(int(math.floor(math.log10(self.microstructure.max())+1))) if self.microstructure.dtype == int \
|
format_string = '%{}i'.format(1+int(np.floor(np.log10(np.nanmax(self.microstructure)-1)))) if self.microstructure.dtype == int \
|
||||||
else '%g'
|
else '%g'
|
||||||
np.savetxt(fname,
|
np.savetxt(fname,
|
||||||
self.microstructure.reshape([grid[0],np.prod(grid[1:])],order='F').T,
|
self.microstructure.reshape([grid[0],np.prod(grid[1:])],order='F').T,
|
||||||
|
|
Loading…
Reference in New Issue