@@ -56,7 +56,7 @@ class Solution(object):
56
56
- (:class:`~pyclaw.geometry.Dimension`) - A domain and
57
57
patch is created with the dimensions or list of
58
58
dimensions provided.
59
- 3. `args` is a variable number of arguments that describes the
59
+ 3. `args` is a variable number of keyword arguments that describes the
60
60
location of a file to be read in to initialize the object
61
61
62
62
:Examples:
@@ -140,17 +140,14 @@ def get_clawpack_dot_xxx(modname): return modname.rpartition('.')[0]
140
140
frame = arg [0 ]
141
141
if not isinstance (frame ,int ):
142
142
raise Exception ('Invalid pyclaw.Solution object initialization' )
143
- if 'count_from_zero' in list (kargs .keys ()) and \
144
- kargs ['count_from_zero' ] == True :
145
- self ._start_frame = 0
146
- else :
147
- self ._start_frame = frame
148
- try :
143
+ if ('count_from_zero' in kargs ):
144
+ if (kargs ['count_from_zero' ] == True ):
145
+ self ._start_frame = 0
146
+ else :
147
+ self ._start_frame = frame
149
148
kargs .pop ('count_from_zero' )
150
- except KeyError :
151
- pass
152
-
153
149
self .read (frame ,** kargs )
150
+
154
151
elif len (arg ) == 2 :
155
152
#Set domain
156
153
if isinstance (arg [1 ],Domain ):
@@ -163,7 +160,7 @@ def get_clawpack_dot_xxx(modname): return modname.rpartition('.')[0]
163
160
elif isinstance (arg [1 ][0 ],Patch ):
164
161
self .domain = Domain (arg [1 ])
165
162
else :
166
- raise Exception ("Invalid argument list " )
163
+ raise Exception ("Invalid arguments for Solution initialization. " )
167
164
168
165
#Set state
169
166
if isinstance (arg [0 ],State ):
@@ -176,11 +173,16 @@ def get_clawpack_dot_xxx(modname): return modname.rpartition('.')[0]
176
173
elif isinstance (arg [0 ][0 ],int ):
177
174
self .states = State (self .domain ,arg [0 ][0 ],arg [0 ][1 ])
178
175
else :
179
- raise Exception ("Invalid argument list " )
176
+ raise Exception ("Invalid arguments for Solution initialization. " )
180
177
elif isinstance (arg [0 ],int ):
181
178
self .states .append (State (self .domain ,arg [0 ]))
182
179
if self .states == [] or self .domain is None :
183
- raise Exception ("Invalid argument list" )
180
+ raise Exception ("Invalid arguments for Solution initialization." )
181
+ elif len (arg ) == 0 and 'frame' in kargs :
182
+ frame = kargs .pop ('frame' )
183
+ self .read (frame ,** kargs )
184
+ else :
185
+ raise Exception ("Invalid arguments for Solution initialization." )
184
186
185
187
186
188
def is_valid (self ):
0 commit comments