small polishing
This commit is contained in:
parent
cf1cfb0cd9
commit
4c5939ef23
|
@ -93,7 +93,7 @@ def strikeout(what):
|
|||
|
||||
|
||||
def execute(cmd,
|
||||
streamIn = None,
|
||||
stream_in = None,
|
||||
wd = './',
|
||||
env = None):
|
||||
"""
|
||||
|
@ -103,7 +103,7 @@ def execute(cmd,
|
|||
----------
|
||||
cmd : str
|
||||
Command to be executed.
|
||||
streanIn :, optional
|
||||
stream_in : file object, optional
|
||||
Input (via pipe) for executed process.
|
||||
wd : str, optional
|
||||
Working directory of process. Defaults to ./ .
|
||||
|
@ -119,14 +119,14 @@ def execute(cmd,
|
|||
stderr = subprocess.PIPE,
|
||||
stdin = subprocess.PIPE,
|
||||
env = myEnv)
|
||||
out,error = [i for i in (process.communicate() if streamIn is None
|
||||
else process.communicate(streamIn.read().encode('utf-8')))]
|
||||
stdout, stderr = [i for i in (process.communicate() if stream_in is None
|
||||
else process.communicate(stream_in.read().encode('utf-8')))]
|
||||
os.chdir(initialPath)
|
||||
out = out.decode('utf-8').replace('\x08','')
|
||||
error = error.decode('utf-8').replace('\x08','')
|
||||
stdout = stdout.decode('utf-8').replace('\x08','')
|
||||
stderr = stderr.decode('utf-8').replace('\x08','')
|
||||
if process.returncode != 0:
|
||||
raise RuntimeError('{} failed with returncode {}'.format(cmd,process.returncode))
|
||||
return out,error
|
||||
return stdout, stderr
|
||||
|
||||
|
||||
def show_progress(iterable,N_iter=None,prefix='',bar_length=50):
|
||||
|
|
|
@ -950,14 +950,14 @@ class TestRotation:
|
|||
|
||||
def test_rotate_inverse(self):
|
||||
R = Rotation.from_random()
|
||||
assert np.allclose(np.eye(3),(R.inversed()@R).as_matrix())
|
||||
assert np.allclose(np.eye(3),(~R@R).as_matrix())
|
||||
|
||||
@pytest.mark.parametrize('data',[np.random.rand(3),
|
||||
np.random.rand(3,3),
|
||||
np.random.rand(3,3,3,3)])
|
||||
def test_rotate_inverse_array(self,data):
|
||||
R = Rotation.from_random()
|
||||
assert np.allclose(data,R.inversed()@(R@data))
|
||||
assert np.allclose(data,~R@(R@data))
|
||||
|
||||
@pytest.mark.parametrize('data',[np.random.rand(4),
|
||||
np.random.rand(3,2),
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
from damask import util
|
||||
|
||||
class TestUtil:
|
||||
|
||||
def test_execute_direct(self):
|
||||
out,err = util.execute('echo test')
|
||||
assert out=='test\n' and err==''
|
||||
|
||||
def test_execute_env(self):
|
||||
out,err = util.execute('sh -c "echo $test_for_execute"',env={'test_for_execute':'test'})
|
||||
assert out=='test\n' and err==''
|
|
@ -49,7 +49,7 @@ subroutine discretization_init(homogenizationAt,microstructureAt,&
|
|||
IPcoords0, &
|
||||
NodeCoords0
|
||||
integer, optional, intent(in) :: &
|
||||
sharedNodesBegin ! index of first node shared among different processes (MPI)
|
||||
sharedNodesBegin !< index of first node shared among different processes (MPI)
|
||||
|
||||
write(6,'(/,a)') ' <<<+- discretization init -+>>>'; flush(6)
|
||||
|
||||
|
|
Loading…
Reference in New Issue