introduced option mute output to screen
This commit is contained in:
parent
2e6bbe887e
commit
9694d63874
|
@ -106,7 +106,7 @@ class Material():
|
||||||
'''
|
'''
|
||||||
__slots__ = ['data']
|
__slots__ = ['data']
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self,verbose=True):
|
||||||
self.parts = [
|
self.parts = [
|
||||||
'homogenization',
|
'homogenization',
|
||||||
'microstructure',
|
'microstructure',
|
||||||
|
@ -121,11 +121,12 @@ class Material():
|
||||||
'phase': {'__order__': []},
|
'phase': {'__order__': []},
|
||||||
'texture': {'__order__': []},
|
'texture': {'__order__': []},
|
||||||
}
|
}
|
||||||
|
self.verbose = verbose
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
me = []
|
me = []
|
||||||
for part in self.parts:
|
for part in self.parts:
|
||||||
print('doing '+part)
|
if self.verbose: print('doing '+part)
|
||||||
me += ['','#-----------------------------#','<%s>'%part,'#-----------------------------#',]
|
me += ['','#-----------------------------#','<%s>'%part,'#-----------------------------#',]
|
||||||
for section in self.data[part]['__order__']:
|
for section in self.data[part]['__order__']:
|
||||||
me += ['','[%s] %s'%(section,'-'*max(0,27-len(section))),'',]
|
me += ['','[%s] %s'%(section,'-'*max(0,27-len(section))),'',]
|
||||||
|
@ -189,7 +190,7 @@ class Material():
|
||||||
i += 1
|
i += 1
|
||||||
saveFile = file+'_%i'%i
|
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=open(saveFile,'w')
|
||||||
f.write(str(self)+'\n') #newline at end
|
f.write(str(self)+'\n') #newline at end
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Reference in New Issue