Changeset 680 for codes/icosagcm/devel/Python/src/unstructured.pyx
- Timestamp:
- 02/09/18 16:24:33 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/src/unstructured.pyx
r674 r680 1 1 import time 2 2 import math 3 import dynamico.wrap as wrap 4 from dynamico.libs import libicosa 3 import wrap 4 from libs import libicosa 5 from util import list_stencil 5 6 6 7 from ctypes import c_void_p, c_int, c_double, c_bool … … 289 290 290 291 # Helper functions and interface to ParMETIS 291 # list_stencil converts an adjacency graph from array format index[num_cells, MAX_EDGES] to compressed format292 292 # loc_stencil returns the start/end indices (vtxdist) expected by ParMETIS 293 293 # i.e. index[start:end] with start=vtxdist[cell], end=vtxdist[cell+1] lists the edges of cell 'cell' … … 295 295 import numpy as np 296 296 297 def list_stencil(degree, stencil, cond=lambda x:True):298 for i in range(degree.size):299 for j in range(degree[i]):300 s=stencil[i,j]301 if cond(s): yield stencil[i,j]302 303 297 def loc_stencil(degree, stencil): 304 298 loc=0
Note: See TracChangeset
for help on using the changeset viewer.