Changeset 674 for codes/icosagcm/devel/Python/src
- Timestamp:
- 01/31/18 15:14:35 (6 years ago)
- Location:
- codes/icosagcm/devel/Python/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/src/partition.c
r620 r674 29 29 tpwgts, ubvec, options, &edgecut, part, &comm); 30 30 } 31 32 33 // http://www.forceflow.be/2013/10/07/morton-encodingdecoding-through-bit-interleaving-implementations/ 34 // method to seperate bits from a given integer 3 positions apart 35 static inline uint64_t splitBy3(unsigned int a){ 36 uint64_t x = a & 0x1fffff; // we only look at the first 21 bits 37 x = (x | x << 32) & 0x1f00000000ffff; // shift left 32 bits, OR with self, and 00011111000000000000000000000000000000001111111111111111 38 x = (x | x << 16) & 0x1f0000ff0000ff; // shift left 32 bits, OR with self, and 00011111000000000000000011111111000000000000000011111111 39 x = (x | x << 8) & 0x100f00f00f00f00f; // shift left 32 bits, OR with self, and 0001000000001111000000001111000000001111000000001111000000000000 40 x = (x | x << 4) & 0x10c30c30c30c30c3; // shift left 32 bits, OR with self, and 0001000011000011000011000011000011000011000011000011000100000000 41 x = (x | x << 2) & 0x1249249249249249; 42 return x; 43 } 44 45 static inline uint64_t mortonEncode_magicbits(unsigned int x, unsigned int y, unsigned int z){ 46 uint64_t answer = 0; 47 answer |= splitBy3(x) | splitBy3(y) << 1 | splitBy3(z) << 2; 48 return answer; 49 } 50 51 void dynamico_morton_encode(int n, const int *x, const int *y, const int *z, uint64_t *m) 52 { 53 for(int i=0; i<n; i++) 54 m[i]=mortonEncode_magicbits(x[i],y[i],z[i]); 55 } -
codes/icosagcm/devel/Python/src/unstructured.pyx
r663 r674 44 44 except OSError: 45 45 print """ 46 Unable to load shared library 'lib kernels.so' !46 Unable to load shared library 'libicosa.so' ! 47 47 """ 48 48 raise … … 59 59 ['dynamico_caldyn_unstructured', c_double, c_void_p,20], 60 60 ['dynamico_partition_graph', c_int,2, c_void_p,3, c_int, c_void_p], 61 ['dynamico_morton_encode', c_int,c_void_p,4] 61 62 ]) 62 63
Note: See TracChangeset
for help on using the changeset viewer.