Changeset 13116
- Timestamp:
- 08/21/12 16:09:35 (13 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/flaim.py
r13032 r13116 1 1 #module imports 2 2 import numpy 3 from collections import OrderedDict 3 4 from fielddisplay import fielddisplay 4 5 from EnumDefinitions import * … … 19 20 self.targets = '' 20 21 self.tracks = '' 21 self.flightreqs = {}22 self.flightreqs = OrderedDict() 22 23 self.criterion = float('NaN') 23 24 self.gridsatequator = 200000 -
issm/trunk-jpl/src/m/classes/miscellaneous.py
r13030 r13116 1 1 #module imports 2 from collections import OrderedDict 2 3 from fielddisplay import fielddisplay 3 4 from EnumDefinitions import * … … 18 19 self.notes = '' 19 20 self.name = '' 20 self.dummy = {}21 self.dummy = OrderedDict() 21 22 22 23 #set defaults -
issm/trunk-jpl/src/m/classes/model/model.py
r13107 r13116 86 86 #}}} 87 87 88 def properties(self): # {{{ 89 # ordered list of properties since vars(self) is random 90 return ['mesh',\ 91 'mask',\ 92 'geometry',\ 93 'constants',\ 94 'surfaceforcings',\ 95 'basalforcings',\ 96 'materials',\ 97 'friction',\ 98 'flowequation',\ 99 'timestepping',\ 100 'initialization',\ 101 'rifts',\ 102 'debug',\ 103 'verbose',\ 104 'settings',\ 105 'solver',\ 106 'cluster',\ 107 'balancethickness',\ 108 'diagnostic',\ 109 'groundingline',\ 110 'hydrology',\ 111 'prognostic',\ 112 'thermal',\ 113 'steadystate',\ 114 'transient',\ 115 'autodiff',\ 116 'flaim',\ 117 'inversion',\ 118 'qmu',\ 119 'results',\ 120 'radaroverlay',\ 121 'miscellaneous',\ 122 'private'] 123 # }}} 124 88 125 def __repr__(obj): 89 126 # {{{ Display … … 101 138 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("timestepping","[%s,%s]" % ("1x1",obj.timestepping.__class__.__name__),"time stepping for transient models")) 102 139 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("initialization","[%s,%s]" % ("1x1",obj.initialization.__class__.__name__),"initial guess/state")) 103 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("rifts","[%s,%s]" % ("1x1",obj.rifts.__class__.__name__),"rifts properties '"))140 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("rifts","[%s,%s]" % ("1x1",obj.rifts.__class__.__name__),"rifts properties")) 104 141 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("debug","[%s,%s]" % ("1x1",obj.debug.__class__.__name__),"debugging tools (valgrind, gprof")) 105 142 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("verbose","[%s,%s]" % ("1x1",obj.verbose.__class__.__name__),"verbosity level in solve")) 106 143 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("settings","[%s,%s]" % ("1x1",obj.settings.__class__.__name__),"settings properties")) 107 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("solver","[%s,%s]" % ("1x1",obj.solver.__class__.__name__),"PETSc options for each solution '"))144 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("solver","[%s,%s]" % ("1x1",obj.solver.__class__.__name__),"PETSc options for each solution")) 108 145 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("cluster","[%s,%s]" % ("1x1",obj.cluster.__class__.__name__),"cluster parameters (number of cpus...)")) 109 146 string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("balancethickness","[%s,%s]" % ("1x1",obj.balancethickness.__class__.__name__),"parameters for balancethickness solution")) -
issm/trunk-jpl/src/m/classes/pairoptions.py
r13098 r13116 1 from collections import OrderedDict 1 2 from WriteData import * 2 3 … … 12 13 def __init__(self,*arg): 13 14 self.functionname = '' 14 self.list = {}15 self.list = OrderedDict() 15 16 16 17 #get calling function name -
issm/trunk-jpl/src/m/classes/private.py
r13030 r13116 1 1 #module imports 2 from collections import OrderedDict 2 3 from fielddisplay import fielddisplay 3 4 from EnumDefinitions import * … … 17 18 self.isconsistent = True 18 19 self.runtimename = '' 19 self.bamg = {}20 self.bamg = OrderedDict() 20 21 self.solution = '' 21 22 -
issm/trunk-jpl/src/m/classes/qmu.py
r13030 r13116 1 1 #module imports 2 2 import numpy 3 from collections import OrderedDict 3 4 from fielddisplay import fielddisplay 4 5 from EnumDefinitions import * … … 19 20 # {{{ Properties 20 21 self.isdakota = 0 21 self.variables = {}22 self.responses = {}23 self.method = {}24 self.params = {}25 self.results = {}22 self.variables = OrderedDict() 23 self.responses = OrderedDict() 24 self.method = OrderedDict() 25 self.params = OrderedDict() 26 self.results = OrderedDict() 26 27 self.partition = float('NaN') 27 28 self.numberofpartitions = 0 … … 72 73 73 74 s+="%s\n" % fielddisplay(self,'isdakota','is qmu analysis activated?') 74 for i,variable in enumerate(self.variables ):75 for i,variable in enumerate(self.variables.iteritems()): 75 76 s+=" variables%s: (arrays of each variable class)\n" % \ 76 77 string_dim(self.variables,i) … … 84 85 (maxlen+1,fname,size(getattr(variable,fname)),type(getattr(variable,fname))) 85 86 86 for i,response in enumerate(self.responses ):87 for i,response in enumerate(self.responses.iteritems()): 87 88 s+=" responses%s: (arrays of each response class)\n" % \ 88 89 string_dim(self.responses,i) … … 98 99 s+="%s\n" % fielddisplay(self,'numberofresponses','number of responses') 99 100 100 for i,method in enumerate(self.method ):101 for i,method in enumerate(self.method.iteritems()): 101 102 if isinstance(method,'dakota_method'): 102 103 s+=" method%s : '%s'\n" % \ 103 104 (string_dim(method,i),method.method) 104 105 105 for i,param in enumerate(self.params ):106 for i,param in enumerate(self.params.iteritems()): 106 107 s+=" params%s: (array of method-independent parameters)\n" % \ 107 108 string_dim(self.params,i) … … 115 116 (maxlen+1,fname,any2str(getattr(param,fname))) 116 117 117 for i,result in enumerate(self.results ):118 for i,result in enumerate(self.results.iteritems()): 118 119 s+=" results%s: (information from dakota files)\n" % \ 119 120 string_dim(self.results,i) -
issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py
r13043 r13116 77 77 #Go through a model fields, check that it is a class, and call checkconsistency 78 78 fields=vars(md) 79 for field in fields.iterkeys(): 79 # for field in fields.iterkeys(): 80 for field in md.properties(): 80 81 81 82 #Some properties do not need to be checked -
issm/trunk-jpl/src/m/solve/loadresultsfromdisk.py
r13098 r13116 1 1 import os 2 from collections import OrderedDict 2 3 from parseresultsfromdisk import * 3 4 from EnumToString import EnumToString … … 23 24 #initialize md.results if not a structure yet 24 25 if not isinstance(md.results,dict): 25 md.results= {}26 md.results=OrderedDict() 26 27 27 28 #load results onto model -
issm/trunk-jpl/src/m/solve/marshall.py
r13107 r13116 28 28 29 29 # for field in fields.iterkeys(): 30 for field in ['mesh','mask','geometry','constants','surfaceforcings','basalforcings','materials','friction','flowequation','timestepping','initialization','rifts','debug','verbose','settings','solver','cluster','balancethickness','diagnostic','groundingline','hydrology','prognostic','thermal','steadystate','transient','autodiff','flaim','inversion','qmu','results','radaroverlay','miscellaneous','private']:30 for field in md.properties(): 31 31 32 32 #Some properties do not need to be marshalled -
issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py
r13023 r13116 1 1 import struct 2 2 import numpy 3 from collections import OrderedDict 3 4 from MatlabFuncs import * 4 5 from MatlabProcessPatch import * … … 36 37 raise IOError("loadresultsfromdisk error message: could not open '%s' for binary reading." % filename) 37 38 38 results= {}39 results=OrderedDict() 39 40 40 41 #Read fields until the end of the file. … … 43 44 #Get time and step 44 45 if result['step'] not in results: 45 results[result['step']]= {}46 results[result['step']]=OrderedDict() 46 47 results[result['step']]['step']=result['step'] 47 48 results[result['step']]['time']=result['time'] … … 77 78 raise IOError("loadresultsfromdisk error message: could not open '%s' for binary reading." % filename) 78 79 79 results= {}80 results=OrderedDict() 80 81 81 82 #if we have done split I/O, ie, we have results that are fragmented across patches, … … 86 87 #Get time and step 87 88 if result['step'] not in results: 88 results[result['step']]= {}89 results[result['step']]=OrderedDict() 89 90 results[result['step']]['step']=result['step'] 90 91 results[result['step']]['time']=result['time'] … … 125 126 #Get time and step 126 127 if result['step'] not in results: 127 results[result['step']]= {}128 results[result['step']]=OrderedDict() 128 129 results[result['step']]['step']=result['step'] 129 130 results[result['step']]['time']=result['time'] … … 180 181 raise TypeError("cannot read data of type %d" % type) 181 182 182 result= {}183 result=OrderedDict() 183 184 result['fieldname']=fieldname 184 185 result['time']=time … … 187 188 188 189 except struct.error as e: 189 result= {}190 result=OrderedDict() 190 191 191 192 return result … … 221 222 raise TypeError("cannot read data of type %d" % type) 222 223 223 result= {}224 result=OrderedDict() 224 225 result['fieldname']=fieldname 225 226 result['time']=time … … 229 230 230 231 except struct.error as e: 231 result= {}232 result=OrderedDict() 232 233 233 234 return result -
issm/trunk-jpl/src/m/solve/process_solve_options.py
r13043 r13116 1 1 import os 2 from collections import OrderedDict 2 3 from EnumDefinitions import * 3 4 from EnumToString import EnumToString … … 13 14 """ 14 15 15 outoptions= {}16 outoptions=OrderedDict() 16 17 17 18 #solution_type: check on this option, error out otherwise
Note:
See TracChangeset
for help on using the changeset viewer.