Changeset 5899 for anuga_core/source_numpy_conversion/anuga/abstract_2d_finite_volumes/general_mesh.py
- Timestamp:
- Nov 6, 2008, 12:28:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source_numpy_conversion/anuga/abstract_2d_finite_volumes/general_mesh.py
r5842 r5899 1 2 from Numeric import concatenate, reshape, take, allclose 3 from Numeric import array, zeros, Int, Float, sqrt, sum, arange 1 ## Automatically adapted for numpy.oldnumeric Oct 28, 2008 by alter_code1.py 2 3 4 ##from numpy.oldnumeric import concatenate, reshape, take, allclose 5 ##from numpy.oldnumeric import array, zeros, Int, Float, sqrt, sum, arange 6 from numpy import concatenate, reshape, take, allclose 7 from numpy import array, zeros, int, float, sqrt, sum, arange 4 8 5 9 from anuga.coordinate_transforms.geo_reference import Geo_reference … … 90 94 if verbose: print 'General_mesh: Building basic mesh structure in ANUGA domain' 91 95 92 self.triangles = array(triangles, Int) 93 self.nodes = array(nodes, Float) 96 ## self.triangles = array(triangles, Int) 97 ## self.nodes = array(nodes, Float) 98 self.triangles = array(triangles, int) 99 self.nodes = array(nodes, float) 94 100 95 101 … … 138 144 139 145 msg = 'Vertex indices reference non-existing coordinate sets' 140 assert max(self.triangles. flat) < self.nodes.shape[0], msg146 assert max(self.triangles.ravel()) < self.nodes.shape[0], msg 141 147 142 148 … … 146 152 max(self.nodes[:,0]), max(self.nodes[:,1]) ] 147 153 148 self.xy_extent = array(xy_extent, Float) 154 ## self.xy_extent = array(xy_extent, Float) 155 self.xy_extent = array(xy_extent, float) 149 156 150 157 151 158 # Allocate space for geometric quantities 152 self.normals = zeros((N, 6), Float) 153 self.areas = zeros(N, Float) 154 self.edgelengths = zeros((N, 3), Float) 159 ## self.normals = zeros((N, 6), Float) 160 ## self.areas = zeros(N, Float) 161 ## self.edgelengths = zeros((N, 3), Float) 162 self.normals = zeros((N, 6), float) 163 self.areas = zeros(N, float) 164 self.edgelengths = zeros((N, 3), float) 155 165 156 166 # Get x,y coordinates for all triangles and store … … 311 321 i = triangle_id 312 322 msg = 'triangle_id must be an integer' 323 print 'type(triangle_id)=%s. triangle_id=%s' % (type(triangle_id), str(triangle_id)) 313 324 assert int(i) == i, msg 314 325 assert 0 <= i < self.number_of_triangles … … 349 360 350 361 M = self.number_of_triangles 351 vertex_coordinates = zeros((3*M, 2), Float) 362 ## vertex_coordinates = zeros((3*M, 2), Float) 363 vertex_coordinates = zeros((3*M, 2), float) 352 364 353 365 for i in range(M): … … 376 388 indices = range(M) 377 389 378 return take(self.triangles, indices )390 return take(self.triangles, indices, axis=0) 379 391 380 392 … … 409 421 410 422 #T = reshape(array(range(K)).astype(Int), (M,3)) 411 T = reshape(arange(K).astype(Int), (M,3)) # Faster 423 ## T = reshape(arange(K).astype(Int), (M,3)) # Faster 424 T = reshape(arange(K).astype(int), (M,3)) # Faster 412 425 413 426 return T … … 442 455 443 456 # Get number of triangles for this node 444 count = self.number_of_triangles_per_node[node]457 count = int(self.number_of_triangles_per_node[node]) 445 458 446 459 for i in range(count): … … 582 595 Y = C[:,1:6:2].copy() 583 596 584 xmin = min(X. flat)585 xmax = max(X. flat)586 ymin = min(Y. flat)587 ymax = max(Y. flat)597 xmin = min(X.ravel()) 598 xmax = max(X.ravel()) 599 ymin = min(Y.ravel()) 600 ymax = max(Y.ravel()) 588 601 #print "C",C 589 602 return xmin, xmax, ymin, ymax
Note: See TracChangeset
for help on using the changeset viewer.