From 9694d63874fc16133b37bcb1a661ac0ed196bf69 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 22 Apr 2015 18:47:45 +0000 Subject: [PATCH] introduced option mute output to screen --- lib/damask/config/material.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/damask/config/material.py b/lib/damask/config/material.py index f7ba0dedb..09b716e04 100644 --- a/lib/damask/config/material.py +++ b/lib/damask/config/material.py @@ -106,7 +106,7 @@ class Material(): ''' __slots__ = ['data'] - def __init__(self): + def __init__(self,verbose=True): self.parts = [ 'homogenization', 'microstructure', @@ -121,11 +121,12 @@ class Material(): 'phase': {'__order__': []}, 'texture': {'__order__': []}, } + self.verbose = verbose def __repr__(self): me = [] for part in self.parts: - print('doing '+part) + if self.verbose: print('doing '+part) me += ['','#-----------------------------#','<%s>'%part,'#-----------------------------#',] for section in self.data[part]['__order__']: me += ['','[%s] %s'%(section,'-'*max(0,27-len(section))),'',] @@ -189,7 +190,7 @@ class Material(): i += 1 saveFile = file+'_%i'%i - print('Writing material data to file %s'%saveFile) + if self.verbose: print('Writing material data to file %s'%saveFile) f=open(saveFile,'w') f.write(str(self)+'\n') #newline at end f.close()