Changeset 6304 for branches/numpy/anuga/mesh_engine
- Timestamp:
- Feb 10, 2009, 11:11:04 AM (16 years ago)
- Location:
- branches/numpy
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/mesh_engine/mesh_engine.py
r6155 r6304 11 11 #import anuga.mesh_engine.list_dic as triang 12 12 13 import Numericas num13 import numpy as num 14 14 15 15 from anuga.utilities.numerical_tools import ensure_numeric … … 46 46 47 47 try: 48 points = ensure_numeric(points, num. Float)48 points = ensure_numeric(points, num.float) 49 49 except ValueError: 50 50 msg = 'ERROR: Inconsistent points array.' … … 60 60 61 61 try: 62 # If Int is used, instead of Int32, it fails in Linux63 segments = ensure_numeric(segments, num. Int32)62 # If int is used, instead of int32, it fails in Linux 63 segments = ensure_numeric(segments, num.int32) 64 64 65 65 except ValueError: … … 72 72 73 73 try: 74 holes = ensure_numeric(holes, num. Float)74 holes = ensure_numeric(holes, num.float) 75 75 except ValueError: 76 76 msg = 'ERROR: Inconsistent holess array.' … … 80 80 regions = add_area_tag(regions) 81 81 try: 82 regions = ensure_numeric(regions, num. Float)82 regions = ensure_numeric(regions, num.float) 83 83 except (ValueError, TypeError): 84 84 msg = 'ERROR: Inconsistent regions array.' … … 90 90 91 91 try: 92 pointatts = ensure_numeric(pointatts, num. Float)92 pointatts = ensure_numeric(pointatts, num.float) 93 93 except (ValueError, TypeError): 94 94 msg = 'ERROR: Inconsistent point attributes array.' … … 103 103 104 104 try: 105 segatts = ensure_numeric(segatts, num. Int32)105 segatts = ensure_numeric(segatts, num.int32) 106 106 except ValueError: 107 107 msg = 'ERROR: Inconsistent point attributes array.' -
branches/numpy/anuga/mesh_engine/mesh_engine_c_layer.c
r4917 r6304 8 8 9 9 This code interfaces pmesh directly with "triangle", a general 10 purpose triangulation code. In doing so, Python Numeric data structures10 purpose triangulation code. In doing so, Python numeric data structures 11 11 are passed to C for use by "triangle" and the results are then 12 12 converted back. This was accomplished using the Python/C API. … … 64 64 #define PY_ARRAY_UNIQUE_SYMBOL API_YEAH 65 65 //#define NO_IMPORT_ARRAY 66 #include " Numeric/arrayobject.h"66 #include "numpy/arrayobject.h" 67 67 #include <sys/types.h> 68 68 … … 245 245 abs quantity_ext.c compute_gradients 246 246 247 PyArray_FromDims allolws you to create a Numeric array with unitialized data.247 PyArray_FromDims allolws you to create a numeric array with unitialized data. 248 248 The first argument is the size of the second argument ( 249 249 the dimensions array). … … 351 351 352 352 353 /* These memory blocks are passed into Numeric arrays353 /* These memory blocks are passed into numeric arrays 354 354 so don't free them */ 355 355 /* -
branches/numpy/anuga/mesh_engine/test_generate_mesh.py
r6174 r6304 12 12 from anuga.mesh_engine.mesh_engine import generate_mesh 13 13 14 import Numericas num14 import numpy as num 15 15 16 16 from anuga.utilities.numerical_tools import ensure_numeric … … 43 43 pointattlist,segattlist, mode, points) 44 44 45 correct = num.array([(1, 0, 2), (2, 3, 1)] , num.Int) #array default#45 correct = num.array([(1, 0, 2), (2, 3, 1)]) 46 46 self.failUnless(num.alltrue(data['generatedtrianglelist'].flat == \ 47 47 correct.flat), 48 48 'trianglelist is wrong!') 49 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)] , num.Int) #array default#49 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)]) 50 50 self.failUnless(num.alltrue(data['generatedsegmentlist'].flat == \ 51 51 correct.flat), … … 74 74 data = generate_mesh(points,seglist,holelist,regionlist, 75 75 pointattlist,segattlist, mode, points) 76 correct = num.array([(1, 0, 2), (2, 3, 1)] , num.Int) #array default#76 correct = num.array([(1, 0, 2), (2, 3, 1)]) 77 77 self.failUnless(num.alltrue(data['generatedtrianglelist'].flat == \ 78 78 correct.flat), 79 79 'trianglelist is wrong!') 80 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)] , num.Int) #array default#80 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)]) 81 81 self.failUnless(num.alltrue(data['generatedsegmentlist'].flat == \ 82 82 correct.flat), … … 154 154 pointattlist,segattlist, mode, points) 155 155 156 correct = num.array([(1, 0, 2), (2, 3, 1)] , num.Int) #array default#156 correct = num.array([(1, 0, 2), (2, 3, 1)]) 157 157 self.failUnless(num.alltrue(data['generatedtrianglelist'].flat == \ 158 158 correct.flat), 159 159 'trianglelist is wrong!') 160 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)] , num.Int) #array default#160 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)]) 161 161 self.failUnless(num.alltrue(data['generatedsegmentlist'].flat == \ 162 162 correct.flat), … … 170 170 171 171 self.failUnless(num.alltrue(data['generatedsegmentmarkerlist'] == \ 172 num.array([1,2,3,4] , num.Int)), #array default#172 num.array([1,2,3,4])), 173 173 'Failed!') 174 174 … … 388 388 389 389 390 correct = num.array([(1, 0, 2), (2, 3, 1)] , num.Int) #array default#390 correct = num.array([(1, 0, 2), (2, 3, 1)]) 391 391 self.failUnless(num.alltrue(data['generatedtrianglelist'].flat == \ 392 392 correct.flat), 393 393 'trianglelist is wrong!') 394 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)] , num.Int) #array default#394 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)]) 395 395 self.failUnless(num.alltrue(data['generatedsegmentlist'].flat == \ 396 396 correct.flat), … … 407 407 correct.flat), 408 408 'Failed') 409 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)] , num.Int) #array default#409 correct = num.array([(0, 1), (1, 3), (3, 2), (2, 0)]) 410 410 self.failUnless(num.alltrue(data['generatedsegmentlist'].flat == \ 411 411 correct.flat), 412 412 'Failed!') 413 413 414 correct = num.array(segattlist , num.Int) #array default#414 correct = num.array(segattlist) 415 415 self.failUnless(num.allclose(data['generatedsegmentmarkerlist'].flat, 416 416 correct.flat), … … 418 418 419 419 # I copied these answers from the output, so bad test.. 420 correct = num.array([(-1, 1, -1), (-1, 0, -1)] , num.Int) #array default#420 correct = num.array([(-1, 1, -1), (-1, 0, -1)]) 421 421 self.failUnless(num.alltrue(data['generatedtriangleneighborlist'].flat == \ 422 422 correct.flat), … … 467 467 468 468 suite = unittest.makeSuite(triangTestCase,'test') 469 #suite = unittest.makeSuite(triangTestCase,'testrectangleIIb')470 #suite = unittest.makeSuite(triangTestCase,'testsegmarker')471 #suite = unittest.makeSuite(triangTestCase,'testrectangle_regionsII')472 469 runner = unittest.TextTestRunner() #verbosity=2) 473 470 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.