Changeset 2491
- Timestamp:
- Mar 8, 2006, 1:39:11 PM (19 years ago)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
development/analytical solutions/Analytical_solution_Yoon_import_mesh.py
r2229 r2491 128 128 interp = Interpolation(tri_array,t_array,[points]) 129 129 130 stage = domain.get_quantity('stage') [n_point]131 xmomentum = domain.get_quantity('xmomentum') [n_point]132 ymomentum = domain.get_quantity('ymomentum') [n_point]130 stage = domain.get_quantity('stage').get_values()[n_point] 131 xmomentum = domain.get_quantity('xmomentum').get_values()[n_point] 132 ymomentum = domain.get_quantity('ymomentum').get_values()[n_point] 133 133 134 134 interp_stage = interp.interpolate([[stage[0]],[stage[1]],[stage[2]]]) -
documentation/user_manual/anuga_user_manual.tex
r2486 r2491 29 29 30 30 %Draft date 31 \date{\today} 31 \date{\today} % update before release! 32 32 % Use an explicit date so that reformatting 33 33 % doesn't cause a new date to be used. Setting … … 35 35 % stages to make it easier to handle versions. 36 36 37 \release{1.0} 37 \release{1.0} % release version; this is used to define the 38 38 % \version macro 39 39 -
inundation/pyvolution/domain.py
r2380 r2491 196 196 197 197 def get_quantity(self, name, location='vertices', indices = None): 198 """Get values for named quantity198 """Get quantity object. 199 199 200 200 name: Name of quantity 201 201 202 In case of location == 'centroids' the dimension values must 203 be a list of a Numerical array of length N, N being the number 204 of elements. Otherwise it must be of dimension Nx3. 205 206 Indices is the set of element ids that the operation applies to. 207 208 The values will be stored in elements following their 209 internal ordering. 210 """ 211 212 return self.quantities[name].get_values( location, indices = indices) 202 See methods inside the quantity object for more options 203 """ 204 205 return self.quantities[name] #.get_values( location, indices = indices) 206 213 207 214 208 def get_quantity_object(self, name): … … 216 210 217 211 name: Name of quantity 218 """ 219 212 213 FIXME: Obsolete 214 """ 215 216 print 'get_quantity_object has been deprecated. Please use get_quantity' 220 217 return self.quantities[name] 221 218 -
inundation/pyvolution/quantity.py
r2472 r2491 761 761 Indices is the set of element ids that the operation applies to. 762 762 763 The values will be stored in elements following their 764 internal ordering. 765 763 766 """ 764 767 from Numeric import take -
inundation/pyvolution/region.py
r1751 r2491 84 84 """ 85 85 if tag == self.tag: 86 new_values = domain.get_quantity(self.quantity_initial_value, 87 indices=self.build_indices(elements, domain), 88 location=self.location) + self.X 86 #new_values = domain.get_quantity(self.quantity_initial_value, 87 # indices=self.build_indices(elements, domain), 88 # location=self.location) + self.X 89 90 Q = domain.get_quantity(self.quantity_initial_value) 91 new_values = Q.get_values(indices=self.build_indices(elements, domain), 92 location=self.location) + self.X 89 93 domain.set_quantity(self.quantity_answer, new_values, 90 94 indices=self.build_indices(elements, domain), … … 111 115 """ 112 116 if tag == self.tag: 117 118 #new_values = domain.get_quantity(self.quantity_answer, 119 # indices=self.build_indices(elements, domain), 120 # location=self.location) \ 121 # + domain.get_quantity(self.adding_quantity, 122 # indices=self.build_indices(elements, domain), 123 # location=self.location) 124 125 126 127 indices = self.build_indices(elements, domain) 128 location = self.location 129 Q1 = domain.get_quantity(self.quantity_answer) 130 Q2 = domain.get_quantity(self.adding_quantity) 131 new_values = Q1.get_values(indices=indices, location=location) +\ 132 Q2.get_values(indices=indices, location=location) 133 113 134 114 new_values = domain.get_quantity(self.quantity_answer,115 indices=self.build_indices(elements, domain),116 location=self.location) \117 + domain.get_quantity(self.adding_quantity,118 indices=self.build_indices(elements, domain),119 location=self.location)120 135 domain.set_quantity(self.quantity_answer, new_values, 121 136 indices=self.build_indices(elements, domain), -
inundation/pyvolution/test_data_manager.py
r2305 r2491 2277 2277 elevation = domain.quantities['elevation'].vertex_values 2278 2278 domain.set_quantity('stage', elevation + h) 2279 #elevation = domain.get_quantity('elevation')2280 #domain.set_quantity('stage', elevation + h)2281 2279 2282 2280 domain.check_integrity() … … 2307 2305 bits = ['vertex_coordinates'] 2308 2306 for quantity in ['elevation']+domain.quantities_to_be_stored: 2309 bits.append(' quantities["%s"].get_integral()'%quantity)2310 bits.append('get_quantity("%s") '%quantity)2307 bits.append('get_quantity("%s").get_integral()' %quantity) 2308 bits.append('get_quantity("%s").get_values()' %quantity) 2311 2309 2312 2310 for bit in bits: … … 2368 2366 2369 2367 for quantity in ['elevation','xmomentum','ymomentum']:#+domain.quantities_to_be_stored: 2370 bits.append(' quantities["%s"].get_integral()'%quantity)2371 bits.append('get_quantity("%s") '%quantity)2368 bits.append('get_quantity("%s").get_integral()' %quantity) 2369 bits.append('get_quantity("%s").get_values()' %quantity) 2372 2370 2373 2371 for bit in bits: … … 2450 2448 2451 2449 for quantity in ['elevation']+domain.quantities_to_be_stored: 2452 bits.append(' quantities["%s"].get_integral()'%quantity)2453 bits.append('get_quantity("%s") '%quantity)2450 bits.append('get_quantity("%s").get_integral()' %quantity) 2451 bits.append('get_quantity("%s").get_values()' %quantity) 2454 2452 2455 2453 for bit in bits: … … 2457 2455 assert allclose(eval('domain.'+bit),eval('domain2.'+bit)) 2458 2456 2459 assert max(max(domain2.get_quantity('xmomentum') ))==filler2460 assert min(min(domain2.get_quantity('xmomentum') ))==filler2461 assert max(max(domain2.get_quantity('ymomentum') ))==filler2462 assert min(min(domain2.get_quantity('ymomentum') ))==filler2457 assert max(max(domain2.get_quantity('xmomentum').get_values()))==filler 2458 assert min(min(domain2.get_quantity('xmomentum').get_values()))==filler 2459 assert max(max(domain2.get_quantity('ymomentum').get_values()))==filler 2460 assert min(min(domain2.get_quantity('ymomentum').get_values()))==filler 2463 2461 2464 2462 … … 2526 2524 elevation = domain.quantities['elevation'].vertex_values 2527 2525 domain.set_quantity('stage', elevation + h) 2528 #elevation = domain.get_quantity('elevation') 2529 #domain.set_quantity('stage', elevation + h) 2526 2530 2527 2531 2528 domain.check_integrity() … … 2559 2556 for quantity in ['elevation']+domain.quantities_to_be_stored: 2560 2557 bits.append('quantities["%s"].get_integral()'%quantity) 2561 #bits.append('get_quantity("%s")'%quantity) 2558 2562 2559 2563 2560 for bit in bits: … … 2616 2613 ################## 2617 2614 2615 print '><><><><>>' 2618 2616 bits = [ 'vertex_coordinates'] 2619 2617 2620 2618 for quantity in ['elevation','xmomentum','ymomentum']:#+domain.quantities_to_be_stored: 2621 2619 #bits.append('quantities["%s"].get_integral()'%quantity) 2622 bits.append('get_quantity("%s") '%quantity)2620 bits.append('get_quantity("%s").get_values()' %quantity) 2623 2621 2624 2622 for bit in bits: -
inundation/pyvolution/test_domain.py
r1928 r2491 26 26 27 27 def set_all_friction(tag, elements, domain): 28 if tag == "all":29 new_values = domain.get_quantity('friction' ,indices = elements) + 10.028 if tag == 'all': 29 new_values = domain.get_quantity('friction').get_values(indices = elements) + 10.0 30 30 31 31 domain.set_quantity('friction', new_values, indices = elements)
Note: See TracChangeset
for help on using the changeset viewer.