source: issm/branches/trunk-jpl-damage/src/py/classes/solver.py@ 12004

Last change on this file since 12004 was 12004, checked in by cborstad, 13 years ago

merged trunk-jpl into trunk-jpl-damage through revision 11990

File size: 1.4 KB
RevLine 
[11790]1#module imports {{{
[11788]2import fielddisplay
3import ismumps
[11790]4from mumpsoptions import *
5from iluasmoptions import *
6#}}}
[11787]7class solver:
8 #properties
9 def __init__(self):
10 # {{{ Properties
[11788]11 if ismumps:
[11790]12 self.options=[["NoneAnalysis",mumpsoptions()]]
[11788]13 else:
[11790]14 self.options=[["NoneAnalysis",iluasmoptions()]]
[11787]15 #}}}
16 def __repr__(obj):
17 # {{{ Display
18
19 string2=" solver parameters:"
[11788]20 for i in range(len(obj.options)):
[11787]21 option=obj.options[i]
22 analysis=option[0]
23 ioptions=option[1]
24
25 string=""
26 for i in range(len(ioptions)):
27 option=ioptions[i]
28 if not option:
29 #do nothing
30 pass
31 elif len(option)==1:
32 #this option has only one argument
33 string="%s%s%s"%(string," -",option[0])
34 elif len(option)==2:
35 #option with value. value can be string or scalar
36 if isinstance(option[1],float):
37 string="%s%s%s%s%s"%(string," -",option[0]," ","%g"%(option[1]))
38 elif isinstance(option[1],str):
39 string="%s%s%s%s%s"%(string," -",option[0]," ",option[1])
[11790]40 elif isinstance(option[1],int):
41 string="%s%s%s%s%s"%(string," -",option[0]," ","%i"%(option[1]))
[11787]42 else:
[11788]43 raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
[11787]44 else:
[11788]45 raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
46
[11787]47 string2="%s\n%s"%(string2," %s -> '%s'"%(analysis,string))
48 return string2
49 #}}}
Note: See TracBrowser for help on using the repository browser.