PrCellStructure Class Reference

PrCellStructure - Represents a set of points in three dimensions and a cell structure: a 3D grid of cubical cells each with a local list of those points which lie inside it. More...

#include <PrCellStructure.h>

List of all members.

Public Member Functions

 PrCellStructure ()
 Default constructor.
 PrCellStructure (int n, double *xyz_points, int max_no_cells=10)
 Constructor.
virtual ~PrCellStructure ()
 Destructor.
void attach (int n, const double *xyz_points)
 Reset the PrCellStructure to a set of new points, deleting old content.
void setNumCells (int max_no_cells)
 Set the maximum number of cells in X, Y and Z direction to 'max_no_cells'.
int getNumCells () const
 Get the previously set limit for the maximum number of cells in the X, Y and Z direction.
int getNumNodes () const
 Get the number of points (nodes) stored in the cell structure.
Vector3D get3dNode (int i) const
 Get a specific point (node) in the PrCellStructure by its index.
void set3dNode (int i, const Vector3D &p)
 Change the coordinates of a specific point in the PrCellStructure.
void getBall (const Vector3D &p, double radius, vector< int > &neighbours, int notP=0) const
 Return all points within the ball of radius radius around the point p.
void getKNearest (const Vector3D &p, int k, vector< int > &neighbours, int notP=0) const
 Return k nearest points to the point p.
int getI (int i, int j, int k) const
 Get the index of the cell positioned at 'i', 'j', 'k'.
void getIJK (int ii, int &i, int &j, int &k) const
 Get the 'i', 'j', 'k'-position of the cell indexed 'ii'.
void whichCell (const Vector3D &xyz, int &i, int &j, int &k) const
 Locate the cell which contains the coordinate 'xyz'.
void print (ostream &os)
 write points to stream
void scan (istream &is)
 read points from stream and regenerate cell structure.


Detailed Description

PrCellStructure - Represents a set of points in three dimensions and a cell structure: a 3D grid of cubical cells each with a local list of those points which lie inside it.

This allows one to perform various queries, such as finding all points in a ball, very efficiently. Creating the cell structure requires only O(N) operations, where N is the number of points.

Definition at line 53 of file PrCellStructure.h.


Constructor & Destructor Documentation

PrCellStructure::PrCellStructure ( int  n,
double *  xyz_points,
int  max_no_cells = 10 
)

Constructor.

Parameters:
n total number of points
xyz_points pointer to an array of points stored xyz-wise (The points will be copied to internal data structure.
max_no_cells indicate maximum number of cells along the X, Y and Z axis.

Definition at line 127 of file PrCellStructure.C.


Member Function Documentation

void PrCellStructure::attach ( int  n,
const double *  xyz_points 
)

Reset the PrCellStructure to a set of new points, deleting old content.

Parameters:
n number of points
xyz_points pointer to the array of stored points. (The points will be copied to internal data structure).

Definition at line 143 of file PrCellStructure.C.

Referenced by PrFastUnorganized_OP::PrFastUnorganized_OP(), PrUnorganized_OP::PrUnorganized_OP(), PrUnorganized_OP::scanRawData(), and PrFastUnorganized_OP::scanRawData().

void PrCellStructure::setNumCells ( int  max_no_cells  )  [inline]

Set the maximum number of cells in X, Y and Z direction to 'max_no_cells'.

This must be set before the cells are generated (ie. before the 'attach()' command.

Definition at line 91 of file PrCellStructure.h.

Referenced by PrFastUnorganized_OP::PrFastUnorganized_OP(), PrUnorganized_OP::PrUnorganized_OP(), PrUnorganized_OP::scanRawData(), and PrFastUnorganized_OP::scanRawData().

void PrCellStructure::set3dNode ( int  i,
const Vector3D &  p 
) [inline]

Change the coordinates of a specific point in the PrCellStructure.

Parameters:
i index of node to change
p the new coordinates

Definition at line 106 of file PrCellStructure.h.

Referenced by PrUnorganized_OP::set3dNode().

void PrCellStructure::getBall ( const Vector3D &  p,
double  radius,
vector< int > &  neighbours,
int  notP = 0 
) const

Return all points within the ball of radius radius around the point p.

Don't include p itself if notP = 1.

Parameters:
p the center of the ball
radius the radius of the ball
Return values:
neighbours will be filled with the indexes of the neighbour points.
Parameters:
notP if != 0, 'p' itself will not be included in the list of returned points.

Definition at line 159 of file PrCellStructure.C.

Referenced by PrUnorganized_OP::getNeighbours().

void PrCellStructure::getKNearest ( const Vector3D &  p,
int  k,
vector< int > &  neighbours,
int  notP = 0 
) const

Return k nearest points to the point p.

Don't include p itself if notP = 1.

Parameters:
p the point for which we seek the k nearest neighbours
k the number of neighbours we seek
Return values:
neighbours will be filled with the indexes of the neighbour points.
Parameters:
notP if != 0, 'p' itself will not be included in the list of returned points.

Definition at line 200 of file PrCellStructure.C.

void PrCellStructure::whichCell ( const Vector3D &  xyz,
int &  i,
int &  j,
int &  k 
) const

Locate the cell which contains the coordinate 'xyz'.

Parameters:
xyz we want to find the cell containing these coordinates
Return values:
i i-position of the located cell
j j-position of the located cell
k k-position of the located cell

Definition at line 267 of file PrCellStructure.C.


The documentation for this class was generated from the following files:
Generated on Tue Jun 12 11:05:05 2007 for GoTools Parametrization Library by  doxygen 1.5.1