Bases: pysph.base.nnps.LinkedListNNPS
Nearest neighbor query class using the box sort method but which uses the LinkedList algorithm. This makes this very fast but perhaps not as safe as the DictBoxSortNNPS. All this class does is to use a std::map to obtain a linear cell index from the actual flattened cell index.
Constructor for NNPS
cell_to_index: ‘map[long,int]’
Bases: object
Cell(IntPoint cid, double cell_size, int narrays, int layers=2) Basic indexing structure for the box-sort NNPS.
For a spatial indexing based on the box-sort algorithm, this class defines the spatial data structure used to hold particle indices (local and global) that are within this cell.
Constructor
centroid: ‘cPoint’
Compute the bounding box for the cell.
Utility function to get the centroid of the cell.
The centroid is defined as the origin plus half the cell size in each dimension.
gindices: list
is_boundary: ‘bool’
lindices: list
Set the global and local indices for the cell
size: ‘int’
Bases: pysph.base.nnps.NNPS
DictBoxSortNNPS(int dim, list particles, double radius_scale=2.0, int ghost_layers=1, domain=None, cache=False, sort_gids=False) Nearest neighbor query class using the box-sort algorithm using a
dictionary.
NNPS bins all local particles using the box sort algorithm in Cells. The cells are stored in a dictionary ‘cells’ which is keyed on the spatial index (IntPoint) of the cell.
Constructor for NNPS
cells: dict
Utility function to get near-neighbors for a particle.
Bases: object
DomainManager(double xmin=-1000, double xmax=1000, double ymin=0, double ymax=0, double zmin=0, double zmax=0, periodic_in_x=False, periodic_in_y=False, periodic_in_z=False) This class determines the limits of the solution domain.
We expect all simulations to have well defined domain limits beyond which we are either not interested or the solution is invalid to begin with. Thus, if a particle leaves the domain, the solution should be considered invalid (at least locally).
The initial domain limits could be given explicitly or asked to be computed from the particle arrays. The domain could be periodic.
Constructor
cell_size: ‘double’
dim: ‘int’
is_periodic: ‘bool’
narrays: ‘int’
pa_wrappers: list
periodic_in_x: ‘bool’
periodic_in_y: ‘bool’
periodic_in_z: ‘bool’
radius_scale: ‘double’
General method that is called before NNPS can bin particles.
This method is responsible for the computation of cell sizes and creation of any ghost particles for periodic or wall boundary conditions.
xmax: ‘double’
xmin: ‘double’
xtranslate: ‘double’
ymax: ‘double’
ymin: ‘double’
ytranslate: ‘double’
zmax: ‘double’
zmin: ‘double’
ztranslate: ‘double’
Bases: pysph.base.nnps.NNPS
LinkedListNNPS(int dim, list particles, double radius_scale=2.0, int ghost_layers=1, domain=None, bool fixed_h=False, bool cache=False, bool sort_gids=False) Nearest neighbor query class using the linked list method.
Constructor for NNPS
fixed_h: ‘bool’
Utility function to get near-neighbors for a particle.
heads: list
ncells_per_dim: pyzoltan.core.carray.IntArray
ncells_tot: ‘int’
nexts: list
Setup the context before asking for neighbors. The dst_index represents the particles for whom the neighbors are to be determined from the particle array with index src_index.
src_index: int: the source index of the particle array. dst_index: int: the destination index of the particle array.
Bases: object
NNPS(int dim, list particles, double radius_scale=2.0, int ghost_layers=1, domain=None, bool cache=False, bool sort_gids=False) Nearest neighbor query class using the box-sort algorithm.
NNPS bins all local particles using the box sort algorithm in Cells. The cells are stored in a dictionary ‘cells’ which is keyed on the spatial index (IntPoint) of the cell.
Constructor for NNPS
cell_size: ‘double’
current_cache: pysph.base.nnps.NeighborCache
dim: ‘int’
domain: pysph.base.nnps.DomainManager
is_periodic: ‘bool’
n_cells: ‘int’
narrays: ‘int’
pa_wrappers: list
particles: list
radius_scale: ‘double’
Setup the context before asing for neighbors. The dst_index represents the particles for whom the neighbors are to be determined from the particle array with index src_index.
src_index: int: the source index of the particle array. dst_index: int: the destination index of the particle array.
sort_gids: ‘bool’
Spatially order particles such that nearby particles have indices nearer each other. This may improve pre-fetching on the CPU.
Update the local data after particles have moved.
For parallel runs, we want the NNPS to be independent of the ParallelManager which is solely responsible for distributing particles across available processors. We assume therefore that after a parallel update, each processor has all the local particle information it needs and this operation is carried out locally.
For serial runs, this method should be called when the particles have moved.
use_cache: ‘bool’
xmax: pyzoltan.core.carray.DoubleArray
xmin: pyzoltan.core.carray.DoubleArray
Bases: object
NNPSParticleArrayWrapper(ParticleArray pa)
gid: pyzoltan.core.carray.UIntArray
h: pyzoltan.core.carray.DoubleArray
pa: pysph.base.particle_array.ParticleArray
tag: pyzoltan.core.carray.IntArray
x: pyzoltan.core.carray.DoubleArray
y: pyzoltan.core.carray.DoubleArray
z: pyzoltan.core.carray.DoubleArray
Bases: object
NeighborCache(NNPS nnps, int dst_index, int src_index)
Utility function to return a numpy.arange for a UIntArray
Get the centroid of the cell.
centroid : Point
The centroid in any coordinate direction is defined to be the origin plus half the cell size in that direction
Python wrapper
Return the flattened cell index for a valid cell
Python wrapper