Memosa-FVM  0.2
KSearchTree Class Reference

#include <KSearchTree.h>

Public Types

typedef Vector< double, 3 > Vec3D
 
typedef Array< Vec3DVec3DArray
 
typedef Array< int > IntArray
 

Public Member Functions

 KSearchTree ()
 
 KSearchTree (const Vec3DArray &points)
 
void insert (const Vec3D &v, const int n)
 
void findNeighbors (const Vec3D &p, const int k, Array< int > &neighbors)
 

Private Types

typedef CGAL::Search_traits
< double, MyPoint, const
double
*, Construct_coord_iterator
Traits
 
typedef
CGAL::Orthogonal_k_neighbor_search
< Traits
K_neighbor_search
 
typedef K_neighbor_search::Tree Tree
 

Private Attributes

boost::shared_ptr< Tree_tree
 

Detailed Description

A wrapper for CGAL's K_neighbor_search

Definition at line 121 of file KSearchTree.h.

Member Typedef Documentation

Definition at line 126 of file KSearchTree.h.

typedef CGAL::Orthogonal_k_neighbor_search<Traits> KSearchTree::K_neighbor_search
private

Definition at line 139 of file KSearchTree.h.

typedef CGAL::Search_traits<double, MyPoint, const double*, Construct_coord_iterator> KSearchTree::Traits
private

Definition at line 138 of file KSearchTree.h.

typedef K_neighbor_search::Tree KSearchTree::Tree
private

Definition at line 140 of file KSearchTree.h.

typedef Vector<double,3> KSearchTree::Vec3D

Definition at line 124 of file KSearchTree.h.

Definition at line 125 of file KSearchTree.h.

Constructor & Destructor Documentation

KSearchTree::KSearchTree ( )

Definition at line 17 of file KSearchTree.cpp.

References _tree.

18 {
19  _tree = boost::shared_ptr<Tree>(new Tree());
20 }
boost::shared_ptr< Tree > _tree
Definition: KSearchTree.h:142
K_neighbor_search::Tree Tree
Definition: KSearchTree.h:140
KSearchTree::KSearchTree ( const Vec3DArray points)

Definition at line 8 of file KSearchTree.cpp.

References _tree, and Array< T >::getLength().

9 {
10  _tree = boost::shared_ptr<Tree>(new Tree());
11 
12  const int nPoints = points.getLength();
13  for(int n=0; n<nPoints; n++)
14  _tree->insert(MyPoint(points[n],n));
15 }
boost::shared_ptr< Tree > _tree
Definition: KSearchTree.h:142
K_neighbor_search::Tree Tree
Definition: KSearchTree.h:140

Member Function Documentation

void KSearchTree::findNeighbors ( const Vec3D p,
const int  k,
Array< int > &  neighbors 
)

Definition at line 30 of file KSearchTree.cpp.

References _tree.

Referenced by IBManager::createIBInterpolationStencil(), IBManager::createSolidInterpolationStencil(), Mesh::findCommonNodes(), and IBManager::findNearestCellForSolidFaces().

31 {
32  MyPoint query(p, -1);
33  if ( _tree->size() == 0 ){
34  return;
35  }
36  K_neighbor_search search(*_tree, query, k);
37 
38  int i=0;
39  for(K_neighbor_search::iterator it = search.begin();
40  it != search.end();
41  it++)
42  {
43  neighbors[i++] = it->first.index;
44  }
45 
46 }
CGAL::Orthogonal_k_neighbor_search< Traits > K_neighbor_search
Definition: KSearchTree.h:139
boost::shared_ptr< Tree > _tree
Definition: KSearchTree.h:142
void KSearchTree::insert ( const Vec3D v,
const int  n 
)

Definition at line 23 of file KSearchTree.cpp.

References _tree.

Referenced by IBManager::createIBInterpolationStencil(), IBManager::createSolidInterpolationStencil(), Mesh::findCommonNodes(), and IBManager::update().

24 {
25  _tree->insert(MyPoint(v,n));
26 }
boost::shared_ptr< Tree > _tree
Definition: KSearchTree.h:142

Member Data Documentation

boost::shared_ptr<Tree> KSearchTree::_tree
private

Definition at line 142 of file KSearchTree.h.

Referenced by findNeighbors(), insert(), and KSearchTree().


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