uxarray.Grid.get_spatial_hash

uxarray.Grid.get_spatial_hash#

Grid.get_spatial_hash(reconstruct=False)#

Get the SpatialHash data structure of this Grid that allows for fast face search queries. Face searches are used to find the faces that a list of points, in spherical coordinates, are contained within.

Parameters:

reconstruct (bool, default=False) – If true, reconstructs the spatial hash

Returns:

self._spatialhash – SpatialHash instance

Return type:

grid.Neighbors.SpatialHash

Note

Does not currently support queries on periodic elements.

Examples

Open a grid from a file path:

>>> import uxarray as ux
>>> uxgrid = ux.open_grid("grid_filename.nc")

Obtain SpatialHash instance:

>>> spatial_hash = uxgrid.get_spatial_hash()

Query to find the face a point lies within in addition to its barycentric coordinates:

>>> face_ids, bcoords = spatial_hash.query([0.0, 0.0])