output complete microstructure and texture info instead of limiting to grainIDs used in geometry

This commit is contained in:
Philip Eisenlohr 2016-03-07 22:12:02 -05:00
parent 0c1fe236b4
commit 4dfd59a9e2
1 changed files with 14 additions and 14 deletions

View File

@ -276,10 +276,10 @@ for name in filenames:
grid = np.vstack(meshgrid2(x, y, z)).reshape(3,-1).T
indices = laguerreTessellation(grid, coords, weights, grains, options.nonperiodic, options.cpus)
# --- write header ---------------------------------------------------------------------------------
# --- write header ------------------------------------------------------------------------
grainIDs = np.intersect1d(grainIDs,indices)
info['microstructures'] = len(grainIDs)
usedGrainIDs = np.intersect1d(grainIDs,indices)
info['microstructures'] = len(usedGrainIDs)
if info['homogenization'] == 0: info['homogenization'] = options.homogenization
@ -292,13 +292,13 @@ for name in filenames:
])
config_header = []
formatwidth = 1+int(math.log10(info['microstructures']))
formatwidth = 1+int(math.log10(NgrainIDs))
phase = options.phase * np.ones(info['microstructures'],'i')
phase = options.phase * np.ones(NgrainIDs,'i')
if int(options.secondphase*info['microstructures']) > 0:
phase[0:int(options.secondphase*info['microstructures'])] += 1
randomSeed = int(os.urandom(4).encode('hex'), 16) if options.randomSeed is None \
else options.randomSeed # random seed for second phase
phase[0:int(options.secondphase*info['microstructures'])] += 1 # alter fraction 'options.secondphase' of used grainIDs
randomSeed = options.randomSeed if options.randomSeed \
else int(os.urandom(4).encode('hex'), 16) # random seed for second phase
np.random.seed(randomSeed)
np.random.shuffle(phase)
config_header += ['# random seed (phase shuffling): {}'.format(randomSeed)]