Changeset 4584
- Timestamp:
- Jul 4, 2007, 11:41:43 AM (17 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r4583 r4584 295 295 296 296 # Treat special case: Polygon situation 297 # Location will be ignored and set to 'centroids' 297 298 # FIXME (Ole): This needs to be generalised and 298 299 # perhaps the notion of location and indices simplified 300 299 301 if polygon is not None: 300 302 if indices is not None: 301 303 msg = 'Only one of polygon and indices can be specified' 302 304 raise Exception, msg 303 304 305 305 306 msg = 'With polygon selected, set_quantity must provide ' -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py
r4583 r4584 404 404 polygon = [[0,2.1], [4,2.1], [4,7], [0,7]] 405 405 quantity.set_values(0.0) 406 quantity.set_values(3.14, polygon=polygon, location='vertices') 407 408 # Indices refer to triangle numbers here - not vertices (why?) 406 quantity.set_values(3.14, polygon=polygon) 407 409 408 assert allclose(quantity.vertex_values, 410 409 [[0,0,0], [0,0,0], [0,0,0], 411 410 [3.14,3.14,3.14]]) 412 411 413 414 412 413 # Another polygon (pick triangle 1 and 2 (rightmost triangles) 414 polygon = [[2.1, 0.0], [3.5,0.1], [2,2.2], [0.2,2]] 415 quantity.set_values(0.0) 416 quantity.set_values(3.14, polygon=polygon) 417 418 assert allclose(quantity.vertex_values, 419 [[0,0,0], 420 [3.14,3.14,3.14], 421 [3.14,3.14,3.14], 422 [0,0,0]]) 423 424 425 426 # Test input checking 427 try: 428 quantity.set_values(3.14, polygon=polygon, indices = [0,2]) 429 except: 430 pass 431 else: 432 msg = 'Should have caught this' 433 raise msg 434 435 415 436 416 437 def test_set_values_using_fit(self):
Note: See TracChangeset
for help on using the changeset viewer.