Changeset 4894
- Timestamp:
- Dec 21, 2007, 12:44:10 PM (17 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/alpha_shape/alpha_shape.py
r4668 r4894 227 227 self._init_boundary_triangles() 228 228 229 del tridata['generatedtriangleneighborlist']230 del tridata['generatedpointmarkerlist']231 del tridata['generatedpointlist']232 #del tridata['generatedpointattributetitlelist']233 del tridata['generatedsegmentlist']234 del tridata['generatedsegmentmarkerlist']235 del tridata['generatedtrianglelist']236 del tridata['generatedtriangleattributelist']237 del tridata['generatedpointattributelist']238 229 return 239 230 -
anuga_core/source/anuga/mesh_engine/mesh_engine.py
r4893 r4894 123 123 #print "mode", mode 124 124 #print "yeah" 125 mesh_dict = triang.genMesh(points,segments,holes,regions,125 mesh_dict, r_test = triang.genMesh(points,segments,holes,regions, 126 126 pointatts,segatts, mode, segments.flat) 127 127 mesh_dict['qaz'] = 1 #debugging 128 ##print "r_test", r_test 128 129 return mesh_dict 129 130 -
anuga_core/source/anuga/mesh_engine/mesh_engine_c_layer.c
r4893 r4894 62 62 #include "Python.h" 63 63 64 //#define PY_ARRAY_UNIQUE_SYMBOL API_YEAH 65 66 #define PY_ARRAY_UNIQUE_SYMBOL API_YEAH 67 //#define NO_IMPORT_ARRAY 64 68 #include "Numeric/arrayobject.h" 65 69 #include <sys/types.h> 66 70 67 71 static PyObject *triang_genMesh(PyObject *self, PyObject *args){ … … 214 218 /*printf("\n\nTriangulate input args: %s \n\n", mod); */ 215 219 triangulate(mod, &in, &out, (struct triangulateio *)NULL ); 216 220 221 222 /* 223 PyArray_FromDims allolws you to create a Numeric array with unitialized data. 224 The first argument is the size of the second argument ( 225 the dimensions array). 226 The dimension array argument is just a 1D C array where each element of 227 the array is the size of that dimension. 228 (int dimensions[2] = { 4, 3 }; defines a 4 by 3 array.) 229 The third argument is just the desired type. 230 */ 231 232 //Py_Initialize(); 233 // Testing passing a numeric array out 234 dimensions[0] = 4; 235 // Allocate space for return vectors a and b (don't DECREF) 236 r_test = (PyArrayObject *) PyArray_FromDims(1, dimensions, PyArray_DOUBLE); 237 217 238 /* printf(" *** back from triangulate\n" ); */ 218 239 /* … … 330 351 Py_DECREF(ii); Py_DECREF(holderlist); 331 352 } 332 /* 333 // Testing passing a numeric array out 334 dimensions[0] = 4; 335 // Allocate space for return vectors a and b (don't DECREF) 336 // This is crashing - don't know why 337 r_test = (PyArrayObject *) PyArray_FromDims(1, dimensions, PyArray_DOUBLE); 338 */ 353 354 339 355 340 356 /* Free in/out structure memory */ … … 382 398 } 383 399 384 /*Py_DECREF(holder);*/ 385 R = Py_BuildValue((char *)"O", holder); 386 /*Py_DECREF(holder);* Try this to fix memory problems */ 400 /* R = Py_BuildValue((char *)"O", holder); */ 401 R = Py_BuildValue((char *)"OO", holder, PyArray_Return(r_test)); 402 Py_DECREF(holder); /** This fixed a memory problem ticket#189 */ 403 Py_DECREF(r_test); 387 404 return R; 388 405 } … … 397 414 void initmesh_engine_c_layer(){ 398 415 Py_InitModule((char *)"mesh_engine_c_layer",triang_methods); 416 417 import_array(); // Necessary for handling of NumPY structures 399 418 } -
anuga_core/source/anuga/pmesh/mesh.py
r4888 r4894 1581 1581 ObjectNeighbor[2]) 1582 1582 index += 1 1583 #genDict['lonepointlist'].sort()1584 #genDict['lonepointlist'].reverse()1585 #for loner in genDict['lonepointlist']:1586 # Remove the loner vertex1587 #print "Removing the loner", loner1588 #self.meshVertices.pop(loner)1589 # delete the info from this data structure1590 del genDict['generatedtriangleneighborlist']1591 del genDict['generatedpointmarkerlist']1592 del genDict['generatedpointlist']1593 del genDict['generatedpointattributetitlelist']1594 del genDict['generatedsegmentlist']1595 del genDict['generatedsegmentmarkerlist']1596 del genDict['generatedtrianglelist']1597 del genDict['generatedtriangleattributelist']1598 del genDict['generatedpointattributelist']1599 genDict['zpp'] = 1 # just an identifier1600 1583 1601 1584 def setMesh(self, genDict): -
anuga_core/source/anuga/shallow_water/benchmark_sww2dem.py
r4668 r4894 1 """Least squares smoot ing and interpolation.1 """Least squares smoothing and interpolation. 2 2 3 3 measure the speed of least squares. … … 25 25 26 26 from Scientific.IO.NetCDF import NetCDFFile 27 from Numeric import array 27 from Numeric import array, Float 28 28 29 29 from anuga.fit_interpolate.interpolate import Interpolate … … 107 107 fid = NetCDFFile(sww_fileName, 'w') 108 108 sww = Write_sww() 109 sww. header(fid, 0,109 sww.store_header(fid, 0, 110 110 len(mesh_dict['triangles']), 111 len(mesh_dict["vertices"]) )112 sww. triangulation(fid,111 len(mesh_dict["vertices"]),sww_precision=Float) 112 sww.store_triangulation(fid, 113 113 mesh_dict["vertices"], mesh_dict['triangles'], 114 114 elevation) 115 115 116 116 for time_step in range(10): 117 sww. quantities(fid,117 sww.store_quantities(fid, 118 118 time=time_step, 119 119 stage=stage,
Note: See TracChangeset
for help on using the changeset viewer.