From 07c9b8b8f029d37686deeadcea1bd268d90a8b9d Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 26 May 2019 20:28:19 +0200 Subject: [PATCH] avoiding unwanted changes --- python/damask/geom.py | 10 +++++----- python/damask/util.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/damask/geom.py b/python/damask/geom.py index 389665320..540ed1bd9 100644 --- a/python/damask/geom.py +++ b/python/damask/geom.py @@ -44,7 +44,7 @@ class Geom(): def update(self,microstructure=None,size=None,rescale=False): """Updates microstructure and size""" grid_old = self.get_grid() - size_old = self.size + size_old = self.get_size() unique_old = len(np.unique(self.microstructure)) max_old = np.max(self.microstructure) @@ -71,7 +71,7 @@ class Geom(): message = '' if np.any(grid_old != self.get_grid()): message += 'grid a b c: {}\n'.format(' x '.join(map(str,self.get_grid()))) - if np.any(size_old != self.get_size()): + if np.any(size_old != self.size): message += 'size x y z: {}\n'.format(' x '.join(map(str,self.size))) if unique_old != len(np.unique(self.microstructure)): message += '# microstructures: {}\n'.format(len(np.unique(self.microstructure))) @@ -88,17 +88,17 @@ class Geom(): self.comments += [str(c) for c in comment] def set_microstructure(self,microstructure): - self.microstructure = microstructure + self.microstructure = np.copy(microstructure) def set_size(self,size): self.size = np.array(size) def get_microstructure(self): - return self.microstructure + return np.copy(self.microstructure) def get_size(self): - return self.size + return np.copy(self.size) def get_grid(self): return np.array(self.microstructure.shape) diff --git a/python/damask/util.py b/python/damask/util.py index d282963cd..1b990bea8 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -52,7 +52,7 @@ def croak(what, newline = True): def report(who = None, what = None): """Reports script and file name""" - croak( (emph(who)+': ' if who is not None else '') + (what if what is not None else '') ) + croak( (emph(who)+': ' if who is not None else '') + (what if what is not None else '') + '\n' ) # -----------------------------