Changeset 7400 for anuga_core/source/anuga_parallel/pmesh_divide.py
- Timestamp:
- Aug 21, 2009, 2:02:46 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga_parallel/pmesh_divide.py
r6721 r7400 12 12 # Modified: Linda Stals, Nov 2005 13 13 # Jack Kelly, Nov 2005 14 # Steve Roberts, Aug 2009 (updating to numpy) 14 15 # 15 16 # … … 20 21 from math import floor 21 22 22 from Numeric import zeros, Float, Int, reshape, argsort, ArrayType 23 23 import numpy as num 24 #import zeros, float, Int, reshape, argsort, ArrayType 24 25 25 26 ######################################################### … … 49 50 # Temporary storage area 50 51 51 index = zeros(N, Int)52 index = num.zeros(N, num.int) 52 53 q_reord = {} 53 54 … … 62 63 63 64 for k in quantities: 64 q_reord[k] = zeros((N, 3), Float)65 q_reord[k] = num.zeros((N, 3), num.float) 65 66 for i in range(N): 66 67 q_reord[k][index[i]]=quantities[k].vertex_values[i] … … 88 89 89 90 try: 90 91 91 from pymetis.metis import partMeshNodal 92 92 except ImportError: … … 96 96 print "***************************************************" 97 97 raise ImportError 98 98 99 def pmesh_divide_metis(domain, n_procs): 99 100 … … 121 122 n_vert = domain.get_number_of_nodes() 122 123 t_list = domain.triangles.copy() 123 t_list = reshape(t_list, (-1,))124 t_list = num.reshape(t_list, (-1,)) 124 125 125 126 # The 1 here is for triangular mesh elements. … … 133 134 # Sometimes (usu. on x86_64), partMeshNodal returnes an array of zero 134 135 # dimensional arrays. Correct this. 135 if type(epart[0]) == ArrayType:136 epart_new = zeros(len(epart), Int)136 if type(epart[0]) == num.ndarray: 137 epart_new = num.zeros(len(epart), num.int) 137 138 for i in range(len(epart)): 138 139 epart_new[i] = epart[i][0] … … 184 185 quantities = {} 185 186 for k in domain.quantities: 186 quantities[k] = zeros((n_tri, 3), Float)187 quantities[k] = num.zeros((n_tri, 3), num.float) 187 188 for i in range(n_tri): 188 189 quantities[k][i] = domain.quantities[k].vertex_values[i] … … 195 196 # this helps with the communication 196 197 197 ttriangles = zeros((len(triangles), 3), Int)198 ttriangles = num.zeros((len(triangles), 3), num.int) 198 199 for i in range(len(triangles)): 199 200 ttriangles[i] = triangles[i]
Note: See TracChangeset
for help on using the changeset viewer.