Merge remote-tracking branch 'origin/development' into unit-in-vtk
This commit is contained in:
commit
287d44c5df
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
|||
Subproject commit e719eee4f213baedecb8c68afab12331e3730d62
|
||||
Subproject commit 25b7b78951ab9fb682aaf048d3e0f0d09a3be695
|
|
@ -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 ''
|
||||
|
@ -247,7 +246,7 @@ class Geom:
|
|||
raise TypeError(f'Invalid file: expected {grid.prod()} entries, found {i}')
|
||||
|
||||
if not np.any(np.mod(material,1) != 0.0): # no float present
|
||||
material = material.astype('int')
|
||||
material = material.astype('int') - (1 if material.min() > 0 else 0)
|
||||
|
||||
return Geom(material.reshape(grid,order='F'),size,origin,comments)
|
||||
|
||||
|
@ -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.
|
||||
|
|
|
@ -74,6 +74,7 @@ class TestGeom:
|
|||
|
||||
def test_save_load_ASCII(self,default,tmp_path):
|
||||
default.save_ASCII(tmp_path/'ASCII')
|
||||
default.material -= 1
|
||||
assert geom_equal(Geom.load_ASCII(tmp_path/'ASCII'),default)
|
||||
|
||||
def test_invalid_origin(self,default):
|
||||
|
|
Loading…
Reference in New Issue