viscid.cython.cyamr module

class viscid.cython.cyamr.AMRField_F4_Crd_F4

Bases: viscid.cython.cyamr.CyAMRField

class viscid.cython.cyamr.AMRField_F8_Crd_F8

Bases: viscid.cython.cyamr.CyAMRField

class viscid.cython.cyamr.AMRField_I4_Crd_F8

Bases: viscid.cython.cyamr.CyAMRField

class viscid.cython.cyamr.AMRField_I8_Crd_F8

Bases: viscid.cython.cyamr.CyAMRField

class viscid.cython.cyamr.CyAMRField

Bases: object

viscid.cython.cyamr.discover_neighbors()

Find which patches touch

Parameters:skel (viscid.amr_grid.AMRSkeleton) – A skeleton with valid xm and L.
Returns:(nr_neighbors, neighbors, neighbor_mask)
  • nr_neighbors (ndarray with shape (npatches,)): how many neighbors a patch has
  • neighbors (int ndarray with shape (npatches, 48)): gives index of all the neighbors of a given patch. Empty values are filled with -1
  • neighbor_mask (int ndarray with shape (npatches, 48)): Bit mask of the relationship to the neighboring patch. Touching in x is 1 or 2, touching in y is 3 or 4, touching in z is 5 or 6. The lesser value is used if the neighboring patch is to the “right”.

Note

The rules for neighbor_mask are:

  • mask >> 6 will be a bitmask of 3 bits that says if patches touch in a given direction. So if they touch in x, mask >> 6 == 0b100 and if they touch in x and y, mask >> 6 == 0b110
  • TODO: document the 6 least significant bits