libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim > Class Template Reference

List of all members.

Public Types

typedef Real coord_t

Public Member Functions

 PointListAdaptor (const std::vector< Point > &pts)
size_t kdtree_get_point_count () const
coord_t kdtree_distance (const coord_t *p1, const size_t idx_p2, size_t size) const
coord_t kdtree_get_pt (const size_t idx, int dim) const
template<class BBOX >
bool kdtree_get_bbox (BBOX &) const

Private Attributes

const std::vector< Point > & _pts

Detailed Description

template<unsigned int KDDim>
template<unsigned int PLDim>
class libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim >

This class adapts list of libMesh Point types for use in a nanoflann KD-Tree. For more on the basic idea see examples/pointcloud_adaptor_example.cpp in the nanoflann source tree.

Definition at line 183 of file meshfree_interpolation.h.


Member Typedef Documentation

template<unsigned int KDDim>
template<unsigned int PLDim>
typedef Real libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim >::coord_t

libMesh Point coordinate type

Definition at line 196 of file meshfree_interpolation.h.


Constructor & Destructor Documentation

template<unsigned int KDDim>
template<unsigned int PLDim>
libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim >::PointListAdaptor ( const std::vector< Point > &  pts  )  [inline]

Definition at line 189 of file meshfree_interpolation.h.

00189                                                    :
00190       _pts(pts)
00191     {}


Member Function Documentation

template<unsigned int KDDim>
template<unsigned int PLDim>
coord_t libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim >::kdtree_distance ( const coord_t p1,
const size_t  idx_p2,
size_t  size 
) const [inline]

Returns the distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored in the class

Definition at line 207 of file meshfree_interpolation.h.

00208     {
00209       libmesh_assert_equal_to (size, PLDim);
00210       libmesh_assert_less (idx_p2, _pts.size());
00211 
00212       const Point &p2(_pts[idx_p2]);
00213 
00214       switch (size)
00215         {
00216         case 3:
00217           {
00218             const coord_t d0=p1[0] - p2(0);
00219             const coord_t d1=p1[1] - p2(1);
00220             const coord_t d2=p1[2] - p2(2);
00221 
00222             return d0*d0 + d1*d1 + d2*d2;
00223           }
00224          
00225         case 2:
00226           {
00227             const coord_t d0=p1[0] - p2(0);
00228             const coord_t d1=p1[1] - p2(1);
00229 
00230             return d0*d0 + d1*d1;
00231           }
00232          
00233         case 1:
00234           {
00235             const coord_t d0=p1[0] - p2(0);
00236 
00237             return d0*d0;
00238           }
00239          
00240         default:
00241           libMesh::err << "ERROR: unknown size " << size << std::endl;
00242           libmesh_error();
00243         }
00244 
00245       return -1.;
00246     }

template<unsigned int KDDim>
template<unsigned int PLDim>
template<class BBOX >
bool libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim >::kdtree_get_bbox ( BBOX &   )  const [inline]

Optional bounding-box computation: return false to default to a standard bbox computation loop. Return true if the BBOX was already computed by the class and returned in "bb" so it can be avoided to redo it again. Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3 for point clouds)

Definition at line 273 of file meshfree_interpolation.h.

00273 { return false; }

template<unsigned int KDDim>
template<unsigned int PLDim>
size_t libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim >::kdtree_get_point_count (  )  const [inline]

Must return the number of data points

Definition at line 201 of file meshfree_interpolation.h.

00201 { return _pts.size(); }

template<unsigned int KDDim>
template<unsigned int PLDim>
coord_t libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< PLDim >::kdtree_get_pt ( const size_t  idx,
int  dim 
) const [inline]

Returns the dim'th component of the idx'th point in the class: Since this is inlined and the "dim" argument is typically an immediate value, the "if's" are actually solved at compile time.

Definition at line 253 of file meshfree_interpolation.h.

00254     {
00255       libmesh_assert_less (dim, (int) PLDim);
00256       libmesh_assert_less (idx, _pts.size());
00257       libmesh_assert_less (dim, 3);
00258 
00259       const Point &p(_pts[idx]);
00260 
00261       if (dim==0) return p(0);
00262       if (dim==1) return p(1);
00263       return p(2);
00264     }


Member Data Documentation


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

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:30 UTC

Hosted By:
SourceForge.net Logo