Lagrangian Particle Code for The Simulation of 2D/3D Fluid Dynamics
|
A class that searches nearest neighbours of particles based on the Octree data structure and algorithm. More...
#include <neighbour_searcher.h>
Public Member Functions | |
OctreeSearcher (const Initializer &init) | |
Constructor. More... | |
OctreeSearcher (size_t maxParticleNum, size_t maxNeighbourNum, int treedepth) | |
Constructor. More... | |
virtual | ~OctreeSearcher () |
Destructor. More... | |
virtual int | buildSearchStructure (const double *x, const double *y, const double *z, size_t numParticles) |
Build an Octree object for the nearest neighbour search, based on the input particle location ayyays in the x, y, and z-coordinates and the number of particles. More... | |
virtual int | buildSearchStructure (const double *x, const double *y, const double *z, size_t begin, size_t numParticles) |
Build an Octree object for the nearest neighbour search, based on the input particle location arrays in the x, y, and z-coordinates, the starting point in the arrays and the number of particles. More... | |
virtual int | searchNeighbour (const double x, const double y, const double z, const double radius, int *result, double *distance, size_t &result_length, int index=-1) |
Searches the nearest neighbours for a particle on the built Octree object. More... | |
![]() | |
virtual | ~NeighbourSearcher () |
Destructor. | |
A class that searches nearest neighbours of particles based on the Octree data structure and algorithm.
Created on: 2014/8/22
OctreeSearcher::OctreeSearcher | ( | const Initializer & | init | ) |
Constructor.
Obtain all necessary information for the Initializer object and allocate memory for the Octree object and array of SearchResult
[in] | init | An object of the Initializer class |
OctreeSearcher::OctreeSearcher | ( | size_t | maxParticleNum, |
size_t | maxNeighbourNum, | ||
int | treedepth | ||
) |
Constructor.
Obtain scalar parameters and allocate memory for the Octree object and array of SearchResult
[in] | maxParticleNum | The capacity of the particle array (> the total number of particles) |
[in] | maxNeighbourNum | The maximum number of neighbours of a particle |
[in] | treedepth | The depth of octrees |
|
inlinevirtual |
Destructor.
Delete the Octree object and the array of SearchResult
|
inlinevirtual |
Build an Octree object for the nearest neighbour search, based on the input particle location ayyays in the x, y, and z-coordinates and the number of particles.
The function uses the information of the input arrays in the range [0,numParticles)
[in] | x | The particle location array in the x-coordinate |
[in] | y | The particle location array in the y-coordinate |
[in] | z | The particle location array in the z-coordinate |
[in] | numParticles | The number of particles used in the particle location arrays |
Implements NeighbourSearcher.
|
virtual |
Build an Octree object for the nearest neighbour search, based on the input particle location arrays in the x, y, and z-coordinates, the starting point in the arrays and the number of particles.
The function uses the information of the input arrays in the range [begin,numParticles)
[in] | x | The particle location array in the x-coordinate |
[in] | y | The particle location array in the y-coordinate |
[in] | z | The particle location array in the z-coordinate |
[in] | begin | The starting point in the particle array to use to build the search structure |
[in] | numParticles | The number of particles used in the particle location arrays |
Implements NeighbourSearcher.
|
virtual |
Searches the nearest neighbours for a particle on the built Octree object.
[in] | x | The location in the x-coordinate of the target particle |
[in] | y | The location in the y-coordinate of the target particle |
[in] | z | The location in the z-coordinate of the target particle |
[in] | radius | The neighbour search radius |
[out] | result | An array saving the results of neighbour search (the neighbour list), which is sorted based on the the distance (in the ascending order of distance) |
[out] | distance | An array saving the distance between the target particle and its neighbours |
[out] | result_length | The number of neighbours obtained for the target particle |
[in] | index | The index of target particle; this index is used to remove the target particle itself from its own neighbour list. The default argument is -1, which should only be used when the target particle itself is not in the search structure |
Implements NeighbourSearcher.