Changeset 986 for codes/icosagcm/devel/Python/dynamico/partition.pyx
- Timestamp:
- 10/24/19 18:27:01 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/dynamico/partition.pyx
r977 r986 1 2 1 from ctypes import c_void_p, c_int, c_double, c_float, c_bool 3 2 from numpy cimport ndarray … … 6 5 7 6 ctypedef int idx_t 7 ctypedef unsigned long uint64_t 8 8 9 9 cdef extern from "partition.h": … … 11 11 idx_t vtxdist[], idx_t xadj_loc[], idx_t adjncy_loc[], 12 12 idx_t nparts, idx_t part[]) 13 void dynamico_morton_encode(int n, const int *x, const int *y, const int *z, long *m) 13 14 14 15 … … 51 52 dynamico_partition_graph(mpi_rank, mpi_size, &vtxdist[0], &xadj_loc[0], &adjncy_loc[0], nparts, &owner[0]) 52 53 return owner 54 55 #-------------------------------- Space-filling (Morton) ordering ------------------------# 56 57 def toint(x): return np.int32((x+1.)*65536) 58 59 def morton_index(x,y,z): 60 cdef int nn 61 cdef int[::1] xx,yy,zz 62 cdef long[::1] idx_ 63 nn, xx, yy, zz = x.size, toint(x), toint(y), toint(z) 64 idx=np.zeros(nn, dtype=np.int64) 65 idx_=idx 66 dynamico_morton_encode(nn, &xx[0],&yy[0],&zz[0], &idx_[0]) 67 return idx
Note: See TracChangeset
for help on using the changeset viewer.