Lagrangian Particle Code for The Simulation of 2D/3D Fluid Dynamics
 All Classes Files Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
OctreeSearcher Class Reference

A class that searches nearest neighbours of particles based on the Octree data structure and algorithm. More...

#include <neighbour_searcher.h>

Inheritance diagram for OctreeSearcher:
NeighbourSearcher

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...
 
- Public Member Functions inherited from NeighbourSearcher
virtual ~NeighbourSearcher ()
 Destructor.
 

Detailed Description

A class that searches nearest neighbours of particles based on the Octree data structure and algorithm.

Author
Yu, Kwangmin (yukwa.nosp@m.ngmi.nosp@m.n@gma.nosp@m.il.c.nosp@m.om)
Version
1.0
Date
2014/10/14

Created on: 2014/8/22

Constructor & Destructor Documentation

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

Parameters
[in]initAn object of the Initializer class
Author
Yu, Kwangmin yukwa.nosp@m.ngmi.nosp@m.n@gma.nosp@m.il.c.nosp@m.om
Date
Mon Oct. 15 2014
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

Parameters
[in]maxParticleNumThe capacity of the particle array (> the total number of particles)
[in]maxNeighbourNumThe maximum number of neighbours of a particle
[in]treedepthThe depth of octrees
virtual OctreeSearcher::~OctreeSearcher ( )
inlinevirtual

Destructor.

Delete the Octree object and the array of SearchResult

Member Function Documentation

virtual int OctreeSearcher::buildSearchStructure ( const double *  x,
const double *  y,
const double *  z,
size_t  numParticles 
)
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)

Parameters
[in]xThe particle location array in the x-coordinate
[in]yThe particle location array in the y-coordinate
[in]zThe particle location array in the z-coordinate
[in]numParticlesThe number of particles used in the particle location arrays
Returns
0, if success

Implements NeighbourSearcher.

int OctreeSearcher::buildSearchStructure ( const double *  x,
const double *  y,
const double *  z,
size_t  begin,
size_t  numParticles 
)
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)

Parameters
[in]xThe particle location array in the x-coordinate
[in]yThe particle location array in the y-coordinate
[in]zThe particle location array in the z-coordinate
[in]beginThe starting point in the particle array to use to build the search structure
[in]numParticlesThe number of particles used in the particle location arrays
Returns
0, if success

Implements NeighbourSearcher.

int OctreeSearcher::searchNeighbour ( const double  x,
const double  y,
const double  z,
const double  radius,
int *  result,
double *  distance,
size_t &  result_length,
int  index = -1 
)
virtual

Searches the nearest neighbours for a particle on the built Octree object.

Parameters
[in]xThe location in the x-coordinate of the target particle
[in]yThe location in the y-coordinate of the target particle
[in]zThe location in the z-coordinate of the target particle
[in]radiusThe neighbour search radius
[out]resultAn 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]distanceAn array saving the distance between the target particle and its neighbours
[out]result_lengthThe number of neighbours obtained for the target particle
[in]indexThe 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
Returns
0, if success
Note
This is the single-thread version of this function

Implements NeighbourSearcher.


The documentation for this class was generated from the following files: