adapted to VTR geom files
This commit is contained in:
parent
a82b1adc14
commit
662a033d91
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
|||
Subproject commit 2d00aa541f071dbfc200f32e358d324995a061f5
|
||||
Subproject commit d04e6753e7e6cea9089ee1d1602c55a715f73d45
|
|
@ -15,7 +15,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|||
scriptID = ' '.join([scriptName,damask.version])
|
||||
|
||||
|
||||
getInterfaceEnergy = lambda A,B: np.float32((A*B != 0)*(A != B)*1.0) # 1.0 if A & B are distinct & nonzero, 0.0 otherwise
|
||||
getInterfaceEnergy = lambda A,B: np.float32((A != B)*1.0) # 1.0 if A & B are distinct, 0.0 otherwise
|
||||
struc = ndimage.generate_binary_structure(3,1) # 3D von Neumann neighborhood
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ if filenames == []: filenames = [None]
|
|||
for name in filenames:
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.load_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
geom = damask.Geom.load(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
|
||||
grid_original = geom.grid
|
||||
damask.util.croak(geom)
|
||||
|
@ -174,4 +174,4 @@ for name in filenames:
|
|||
origin = geom.origin,
|
||||
comments = geom.comments + [scriptID + ' ' + ' '.join(sys.argv[1:])],
|
||||
)\
|
||||
.save_ASCII(sys.stdout if name is None else name)
|
||||
.save(sys.stdout if name is None else name)
|
||||
|
|
|
@ -11,8 +11,6 @@ import numpy as np
|
|||
|
||||
import damask
|
||||
|
||||
sys.path.append(str(damask.solver.Marc().library_path))
|
||||
|
||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||
scriptID = ' '.join([scriptName,damask.version])
|
||||
|
||||
|
@ -235,6 +233,7 @@ if remote and filenames != []:
|
|||
if filenames == []: filenames = [None]
|
||||
|
||||
if remote:
|
||||
sys.path.append(str(damask.solver.Marc().library_path))
|
||||
import py_mentat
|
||||
|
||||
damask.util.report(scriptName, 'waiting to connect...')
|
||||
|
|
|
@ -9,7 +9,6 @@ import damask
|
|||
|
||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||
scriptID = ' '.join([scriptName,damask.version])
|
||||
sys.path.append(str(damask.solver.Marc().library_path))
|
||||
|
||||
#-------------------------------------------------------------------------------------------------
|
||||
def outMentat(cmd,locals):
|
||||
|
@ -185,9 +184,10 @@ parser.set_defaults(port = None,
|
|||
|
||||
if options.port is not None:
|
||||
try:
|
||||
sys.path.append(str(damask.solver.Marc().library_path))
|
||||
import py_mentat
|
||||
except ImportError:
|
||||
parser.error('no valid Mentat release found.')
|
||||
parser.error('no valid Mentat release found')
|
||||
|
||||
# --- loop over input files ------------------------------------------------------------------------
|
||||
|
||||
|
@ -196,7 +196,7 @@ if filenames == []: filenames = [None]
|
|||
for name in filenames:
|
||||
damask.util.report(scriptName,name)
|
||||
|
||||
geom = damask.Geom.load_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
geom = damask.Geom.load(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||
material = geom.material.flatten(order='F')
|
||||
|
||||
cmds = [\
|
||||
|
|
|
@ -213,9 +213,8 @@ class Geom:
|
|||
if not keyword.startswith('head') or header_length < 3:
|
||||
raise TypeError('Header length information missing or invalid')
|
||||
|
||||
content = f.readlines()
|
||||
|
||||
comments = []
|
||||
content = f.readlines()
|
||||
for i,line in enumerate(content[:header_length]):
|
||||
items = line.split('#')[0].lower().strip().split()
|
||||
key = items[0] if items else ''
|
||||
|
@ -510,7 +509,7 @@ class Geom:
|
|||
|
||||
Parameters
|
||||
----------
|
||||
fname : str or or pathlib.Path
|
||||
fname : str or pathlib.Path
|
||||
Filename to write. Valid extension is .vtr, it will be appended if not given.
|
||||
compress : bool, optional
|
||||
Compress with zlib algorithm. Defaults to True.
|
||||
|
|
Loading…
Reference in New Issue