Changeset 8567
- Timestamp:
- Sep 9, 2012, 9:05:44 AM (13 years ago)
- Location:
- trunk/anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain.py
r8565 r8567 219 219 return sides 220 220 221 def calc_sides (triangles):221 def calc_sides_zip(triangles): 222 222 '''Build dictionary mapping from sides (2-tuple of points) 223 223 to left hand side neighbouring triangle … … 242 242 return sides 243 243 244 def calc_sides _c(triangles):244 def calc_sides(triangles): 245 245 '''Build dictionary mapping from sides (2-tuple of points) 246 246 to left hand side neighbouring triangle … … 256 256 # print type(triangles) 257 257 258 print ntriangles258 #print ntriangles 259 259 260 260 from pmesh2domain_ext import sides_dictionary_construct -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain_ext.c
r8566 r8567 6 6 #define DDATA(p) ((double*)(((PyArrayObject *)p)->data)) 7 7 #define IDATA(p) ((long*)(((PyArrayObject *)p)->data)) 8 #define LENDATA(p) ((long *)(((PyArrayObject *)p)->dimensions[0]))8 #define LENDATA(p) ((long)(((PyArrayObject *)p)->dimensions[0])) 9 9 10 10 … … 16 16 long *triangles; 17 17 PyObject *pyobj_key; 18 PyObject *pyobj_value;19 18 PyObject *pyobj_sides; 20 19 PyArrayObject *pyobj_triangles; … … 37 36 c = int(triangle[2]) 38 37 39 sides[a,b] = (id, 2)#(id, face)40 sides[b,c] = (id, 0)#(id, face)41 sides[c,a] = (id, 1)#(id, face)38 sides[a,b] = 3*id+2 #(id, face) 39 sides[b,c] = 3*id+0 #(id, face) 40 sides[c,a] = 3*id+1 #(id, face) 42 41 */ 43 42 44 printf("numTriangle %d\n",numTriangle);43 //printf("numTriangle %d\n",numTriangle); 45 44 46 45 for(i=0; i<numTriangle; i++){ … … 54 53 PyTuple_SetItem( pyobj_key, 1, PyInt_FromLong( b ) ); 55 54 56 pyobj_value = PyTuple_New( 2 ); 57 PyTuple_SetItem( pyobj_value, 0, PyInt_FromLong( i ) ); 58 PyTuple_SetItem( pyobj_value, 1, PyInt_FromLong( 2 ) ); 59 60 PyDict_SetItem( pyobj_sides, pyobj_key, pyobj_value ); 55 PyDict_SetItem( pyobj_sides, pyobj_key, PyInt_FromLong( 3*i+2 ) ); 61 56 62 57 Py_DECREF(pyobj_key); 63 Py_DECREF(pyobj_value);64 58 65 59 // sides[b,c] = (id, 0) #(id, face) … … 68 62 PyTuple_SetItem( pyobj_key, 1, PyInt_FromLong( c ) ); 69 63 70 pyobj_value = PyTuple_New( 2 ); 71 PyTuple_SetItem( pyobj_value, 0, PyInt_FromLong( i ) ); 72 PyTuple_SetItem( pyobj_value, 1, PyInt_FromLong( 0 ) ); 73 74 PyDict_SetItem( pyobj_sides, pyobj_key, pyobj_value ); 64 PyDict_SetItem( pyobj_sides, pyobj_key, PyInt_FromLong( 3*i+0 ) ); 75 65 76 66 Py_DECREF(pyobj_key); 77 Py_DECREF(pyobj_value); 67 78 68 79 69 // sides[c,a] = (id, 1) #(id, face) 80 70 pyobj_key = PyTuple_New( 2 ); 81 71 PyTuple_SetItem( pyobj_key, 0, PyInt_FromLong( c ) ); 82 PyTuple_SetItem( pyobj_key, 1, PyInt_FromLong( a) ); 83 84 pyobj_value = PyTuple_New( 2 ); 85 PyTuple_SetItem( pyobj_value, 0, PyInt_FromLong( i ) ); 86 PyTuple_SetItem( pyobj_value, 1, PyInt_FromLong( 1 ) ); 87 88 PyDict_SetItem( pyobj_sides, pyobj_key, pyobj_value ); 72 PyTuple_SetItem( pyobj_key, 1, PyInt_FromLong( a ) ); 73 74 PyDict_SetItem( pyobj_sides, pyobj_key, PyInt_FromLong( 3*i+1 ) ); 89 75 90 76 Py_DECREF(pyobj_key); 91 Py_DECREF(pyobj_value); 77 92 78 93 79 }
Note: See TracChangeset
for help on using the changeset viewer.