| [11790] | 1 | #module imports {{{ | 
|---|
| [11788] | 2 | import fielddisplay | 
|---|
|  | 3 | import ismumps | 
|---|
| [11790] | 4 | from  mumpsoptions import * | 
|---|
|  | 5 | from  iluasmoptions import * | 
|---|
|  | 6 | #}}} | 
|---|
| [11787] | 7 | class 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 | #}}} | 
|---|