cell_list_util
Short description
@author: Moritz F P Becker
- pyrid.data_structures.cell_list_util.create_cell_list_mesh(System, Compartment, cells_per_dim, cell_length_per_dim, triangle_ids, centroid_in_box=False, loose_grid=False)[source]
Creates a cell list for a triangulated 3D mesh.
- Parameters
- Systemobject
Instance of the System class.
- Compartmentobject
Instance of the Compartment class.
- cells_per_dimint64[3]
Cells per dimension.
- cell_length_per_dimfloat64[3]
Length of a cell in each dimension.
- triangle_idsint64[:]
List of triangle indices.
- centroid_in_boxboolean
If True, a test is run of whether a triangle’s centroid is inside the Compartment AABB. Default = False
- loose_gridboolean
If True, a loose grid approach is used. Default = False
- Returns
- tuple(object, float64[:,3])
An instance of the CellList class keeping the cell list of the 3D mesh, a list of each cell’s center coordinates.
- pyrid.data_structures.cell_list_util.create_cell_list_points(rc, sample_points, Compartment)[source]
Creates a cell list for a set of points.
- Parameters
- rcfloat64
cutoff radius
- sample pointsfloat64[:,3]
Some Information
- Compartmentobject
Instance of the Compartment class
- Returns
- tuple(list, int64[:], list, int64, int64[3])
cell list, array with the number of samples in each cell, list with all indices of nonempty cells, Total number of cells, cells per dimension
- pyrid.data_structures.cell_list_util.reverse_cell_mapping(cell, cells_per_dim)[source]
Calculates the indices of a cell in 3 dimensions given the flattened 1D cell index and the total number of cells per dimension.
- Parameters
- cellint64
Cell index of the flattened array (1D).
- cells_per_dimint64[3]
Number of cells in each dimension.
- Returns
- tuple(int64, int64, int64)
Indices of the cell in 3 dimensions cx, cy, cz
CellListMesh
- class pyrid.data_structures.cell_list_util.CellListMesh(*args, **kwargs)[source]
Dynamic array keeping a cell list for the triangles of a triangulated mesh.
- Attributes
- nint64
Number of elements in the dynamic array
- capacityint64
Capacity of the dynamic array
- item_tnp.dtype
dtype of the structured array that is the cell list.
- Dataarray_like
Structured array with fields conatining a free linked list and the triangle ids. dtype: np.dtype([(‘next’, np.int64), (‘id’, np.int64)], align=True)
- headint64[:]
Head vector of the cell list.
Methods
allocate_slot(self)
Allocates a new slot.
_resize(self, new_cap)
Resize internal array to new capacity.
make_head(self, Ncell)
Creates the head vector.
make_array(self, new_cap)
Returns a new array with new capacity
get_triangles(self, cell)
Returns a list of triangles intersecting a cell.
- _resize(new_cap)[source]
Resize internal array to a new capacity (new_cap).
- Parameters
- new_capint64
New array capacity.
- get_triangles(cell)[source]
Returns a list of triangles intersecting a cell.
- Parameters
- cellint64
Cell index at which to look for any intersecting triangles.
- Returns
- list
List of triangles intersecting the cell.