Changeset 9141
- Timestamp:
- Jun 11, 2014, 9:54:34 AM (10 years ago)
- Location:
- trunk/anuga_core/source/anuga/mesh_engine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/mesh_engine/mesh_engine.py
r8124 r9141 119 119 # list of neighboring triangles 120 120 # EG handles lone verts! 121 121 # 122 # GD (June 2014): We get segfaults in some cases with breakLines, unless 123 # we remove repeated values in 'points', and adjust segments accordingly 124 # 125 pts_complex=points[:,0]+1j*points[:,1] # Use to match points 126 i=0 # Use this as a counter, since the length of 'points' changes as we go 127 while (i < len(pts_complex)-1): 128 i=i+1 # Maximum i = len(pts_complex)-1 = largest index of points 129 # 130 # Check if points[i,] is the same as a previous point 131 if(any(pts_complex[i]==pts_complex[0:i])): 132 # Get index of previous occurrence 133 earlierInd=(pts_complex[i]==pts_complex[0:i]).nonzero()[0][0] 134 # Remove the ith point, and adjust the segments 135 for ii in range(len(segments)): 136 for j in range(2): 137 if(segments[ii,j] == i): 138 # Segment will use previous occurrence of this point 139 segments[ii,j]=earlierInd 140 if(segments[ii,j]>i): 141 # Decrement the index (since we will remove point[i,]) 142 segments[ii,j] = segments[ii,j]-1 143 # Remove ith point 144 points=num.delete(points, i, 0) 145 pointatts=num.delete(pointatts,i,0) 146 # Recompute the complex number points for matching 147 pts_complex=points[:,0]+1j*points[:,1] 148 i=i-1 # Repeat for the last value of i = next point 149 122 150 trianglelist, pointlist, pointmarkerlist, pointattributelist, triangleattributelist, segmentlist, segmentmarkerlist, neighborlist = triang.genMesh(points,segments,holes,regions, 123 151 pointatts,segatts, mode) -
trunk/anuga_core/source/anuga/mesh_engine/mesh_engine_c_layer.c
r7276 r9141 240 240 out.holelist = (REAL *)NULL; 241 241 out.regionlist = (REAL *)NULL; 242 243 242 244 243 triangulate(mod, &in, &out, (struct triangulateio *)NULL ); 245 244
Note: See TracChangeset
for help on using the changeset viewer.