1 | #module imports {{{
|
---|
2 | import fielddisplay
|
---|
3 | import ismumps
|
---|
4 | from mumpsoptions import *
|
---|
5 | from iluasmoptions import *
|
---|
6 | #}}}
|
---|
7 | class solver:
|
---|
8 | #properties
|
---|
9 | def __init__(self):
|
---|
10 | # {{{ Properties
|
---|
11 | if ismumps:
|
---|
12 | self.options=[["NoneAnalysis",mumpsoptions()]]
|
---|
13 | else:
|
---|
14 | self.options=[["NoneAnalysis",iluasmoptions()]]
|
---|
15 | #}}}
|
---|
16 | def __repr__(obj):
|
---|
17 | # {{{ Display
|
---|
18 |
|
---|
19 | string2=" solver parameters:"
|
---|
20 | for i in range(len(obj.options)):
|
---|
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])
|
---|
40 | elif isinstance(option[1],int):
|
---|
41 | string="%s%s%s%s%s"%(string," -",option[0]," ","%i"%(option[1]))
|
---|
42 | else:
|
---|
43 | raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
|
---|
44 | else:
|
---|
45 | raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
|
---|
46 |
|
---|
47 | string2="%s\n%s"%(string2," %s -> '%s'"%(analysis,string))
|
---|
48 | return string2
|
---|
49 | #}}}
|
---|