Merge branch 'development' into 12-fixOrientationSampling
This commit is contained in:
commit
f0f86f68b7
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit 563d327d92b3e22e6845080f9971e400888a8c9d
|
Subproject commit af851689285b8c1a633495219abd9dbbd5a11c69
|
|
@ -109,14 +109,6 @@ for name in filenames:
|
||||||
|
|
||||||
for smoothIter in range(options.N):
|
for smoothIter in range(options.N):
|
||||||
|
|
||||||
# replace immutable microstructures with closest mutable ones
|
|
||||||
index = ndimage.morphology.distance_transform_edt(np.in1d(microstructure,options.immutable).reshape(grid),
|
|
||||||
return_distances = False,
|
|
||||||
return_indices = True)
|
|
||||||
microstructure = microstructure[index[0],
|
|
||||||
index[1],
|
|
||||||
index[2]]
|
|
||||||
|
|
||||||
interfaceEnergy = np.zeros(microstructure.shape,dtype=np.float32)
|
interfaceEnergy = np.zeros(microstructure.shape,dtype=np.float32)
|
||||||
for i in (-1,0,1):
|
for i in (-1,0,1):
|
||||||
for j in (-1,0,1):
|
for j in (-1,0,1):
|
||||||
|
@ -182,8 +174,16 @@ for name in filenames:
|
||||||
grid[1]/2:-grid[1]/2,
|
grid[1]/2:-grid[1]/2,
|
||||||
grid[2]/2:-grid[2]/2] # extent grains into interface region
|
grid[2]/2:-grid[2]/2] # extent grains into interface region
|
||||||
|
|
||||||
|
# replace immutable microstructures with closest mutable ones
|
||||||
|
index = ndimage.morphology.distance_transform_edt(np.in1d(microstructure,options.immutable).reshape(grid),
|
||||||
|
return_distances = False,
|
||||||
|
return_indices = True)
|
||||||
|
microstructure = microstructure[index[0],
|
||||||
|
index[1],
|
||||||
|
index[2]]
|
||||||
|
|
||||||
immutable = np.zeros(microstructure.shape, dtype=np.bool)
|
immutable = np.zeros(microstructure.shape, dtype=np.bool)
|
||||||
# find locations where immutable microstructures have been (or are now)
|
# find locations where immutable microstructures have been in original structure
|
||||||
for micro in options.immutable:
|
for micro in options.immutable:
|
||||||
immutable += microstructure_original == micro
|
immutable += microstructure_original == micro
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,24 @@ import damask
|
||||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||||
scriptID = ' '.join([scriptName,damask.version])
|
scriptID = ' '.join([scriptName,damask.version])
|
||||||
|
|
||||||
|
def taintedNeighborhood(stencil,trigger=[],size=1):
|
||||||
|
|
||||||
|
me = stencil[stencil.shape[0]//2]
|
||||||
|
if len(trigger) == 0:
|
||||||
|
return np.any(stencil != me)
|
||||||
|
if me in trigger:
|
||||||
|
trigger = set(trigger)
|
||||||
|
trigger.remove(me)
|
||||||
|
trigger = list(trigger)
|
||||||
|
return np.any(np.in1d(stencil,np.array(trigger)))
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------------------------
|
||||||
# MAIN
|
# MAIN
|
||||||
#--------------------------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
|
||||||
Offset microstructure index for points which see a microstructure different from themselves within a given (cubic) vicinity,
|
Offset microstructure index for points which see a microstructure different from themselves
|
||||||
i.e. within the region close to a grain/phase boundary.
|
(or listed as triggers) within a given (cubic) vicinity, i.e. within the region close to a grain/phase boundary.
|
||||||
|
|
||||||
""", version = scriptID)
|
""", version = scriptID)
|
||||||
|
|
||||||
|
@ -29,6 +40,9 @@ parser.add_option('-m', '--microstructureoffset',
|
||||||
type = 'int', metavar = 'int',
|
type = 'int', metavar = 'int',
|
||||||
help = 'offset (positive or negative) for tagged microstructure indices. '+
|
help = 'offset (positive or negative) for tagged microstructure indices. '+
|
||||||
'"0" selects maximum microstructure index [%default]')
|
'"0" selects maximum microstructure index [%default]')
|
||||||
|
parser.add_option('-t', '--trigger',
|
||||||
|
action = 'extend', dest = 'trigger', metavar = '<int LIST>',
|
||||||
|
help = 'list of microstructure indices triggering a change')
|
||||||
parser.add_option('-n', '--nonperiodic',
|
parser.add_option('-n', '--nonperiodic',
|
||||||
dest = 'mode',
|
dest = 'mode',
|
||||||
action = 'store_const', const = 'nearest',
|
action = 'store_const', const = 'nearest',
|
||||||
|
@ -36,10 +50,13 @@ parser.add_option('-n', '--nonperiodic',
|
||||||
|
|
||||||
parser.set_defaults(vicinity = 1,
|
parser.set_defaults(vicinity = 1,
|
||||||
offset = 0,
|
offset = 0,
|
||||||
|
trigger = [],
|
||||||
mode = 'wrap',
|
mode = 'wrap',
|
||||||
)
|
)
|
||||||
|
|
||||||
(options, filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
options.trigger = np.array(options.trigger, dtype=int)
|
||||||
|
|
||||||
|
|
||||||
# --- loop over input files -------------------------------------------------------------------------
|
# --- loop over input files -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -84,9 +101,12 @@ for name in filenames:
|
||||||
|
|
||||||
if options.offset == 0: options.offset = microstructure.max()
|
if options.offset == 0: options.offset = microstructure.max()
|
||||||
|
|
||||||
microstructure = np.where(ndimage.filters.maximum_filter(microstructure,size=1+2*options.vicinity,mode=options.mode) ==
|
microstructure = np.where(ndimage.filters.generic_filter(microstructure,
|
||||||
ndimage.filters.minimum_filter(microstructure,size=1+2*options.vicinity,mode=options.mode),
|
taintedNeighborhood,
|
||||||
microstructure, microstructure + options.offset)
|
size=1+2*options.vicinity,mode=options.mode,
|
||||||
|
extra_arguments=(),
|
||||||
|
extra_keywords={"trigger":options.trigger,"size":1+2*options.vicinity}),
|
||||||
|
microstructure + options.offset,microstructure)
|
||||||
|
|
||||||
newInfo['microstructures'] = microstructure.max()
|
newInfo['microstructures'] = microstructure.max()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue