ESyS-Particle  2.3.4
NeighborTable< T > Class Template Reference

class for neighbor search More...

#include <ntable.h>

Inheritance diagram for NeighborTable< T >:
Collaboration diagram for NeighborTable< T >:

Public Types

typedef valarray< vector< typename list< T >::iterator > > arraytype
 
typedef vector< typename list< T >::iteratorpointtype
 
typedef pair< int, int > indextype
 
typedef list< pair< T *, T * > > pairlist
 
typedef list< T * > particlelist
 
typedef std::map< int, T * > IdParticleMap
 
typedef list< T >::iterator iterator
 

Public Member Functions

 NeighborTable ()
 Constructors. More...
 
 NeighborTable (int, int, int, double, double, const Vec3 &, int, int, int)
 
 ~NeighborTable ()
 
void insert (const T &)
 particle insertion More...
 
void insert (iterator i, const T &data)
 
void build ()
 STL compat. insert. More...
 
int index (int, int, int) const
 
iterator begin ()
 < iterators More...
 
iterator end ()
 
unsigned int nparts_at_gridpoint (unsigned int idx) const
 number of particles at a given gridpoint More...
 
bool isInInner (const Vec3 &)
 dimensions More...
 
int xsize ()
 
int ysize ()
 
int zsize ()
 
int size ()
 
Vec3 base_point () const
 
int base_idx_x () const
 
int base_idx_y () const
 
int base_idx_z () const
 
NTSlab< T > xy_slab (int)
 partial access functions More...
 
NTSlab< T > xz_slab (int)
 
NTSlab< T > yz_slab (int)
 
NTBlock< T > block (int, int, int, int, int, int)
 
NTBlock< T > block (const Vec3 &, const Vec3 &)
 
NTBlock< T > inner ()
 
T * ptr (NeighborTable< T >::indextype)
 
T & ref (NeighborTable< T >::indextype)
 
T * ptr_by_id (int)
 
T * getNearestPtr (const Vec3 &)
 
void erase (NeighborTable< T >::indextype)
 
T_Handle< pairlistgetFullList ()
 
T_Handle< pairlistgetNewList ()
 
T_Handle< particlelistgetParticlesAtPlane (const Vec3 &, const Vec3 &)
 
T_Handle< particlelistgetParticlesNearSphere (const Vec3 &, const double &)
 
T_Handle< particlelistgetParticlesNearTriangle (const Triangle &)
 
T_Handle< particlelistgetParticlesNearEdge (const AEdge *)
 
T_Handle< particlelistgetParticlesNearPoint (const Vec3 &)
 
T_Handle< particlelistgetAllParticles ()
 

Private Member Functions

void clear_search_array ()
 
int index (const Vec3 &)
 
void addPairsToList (T_Handle< pairlist >, int, int)
 
void addPairsToListLocal (T_Handle< pairlist >, int)
 
void addPairsToListFlagged (T_Handle< pairlist >, int, int)
 
void addPairsToListLocalFlagged (T_Handle< pairlist >, int)
 
arraytypearray ()
 

Private Attributes

list< T > m_list
 list of particles More...
 
arraytype m_array
 search array More...
 
IdParticleMap m_idParticleMap
 mapping between particle-id and particle-pointer More...
 
Vec3 m_p0_global
 minimum corner of global search space More...
 
double m_dim
 grid spacing of search array More...
 
double m_alpha
 padding factor (dim=2*rmax+alpha) More...
 
int m_global_idx
 minimum corner index (x component) More...
 
int m_global_idy
 minimum corner index (y component) More...
 
int m_global_idz
 minimum corner index (z component) More...
 
int m_xsize
 number of grid point, x direction More...
 
int m_ysize
 number of grid point, y direction More...
 
int m_zsize
 number of grid point, z direction More...
 
bool m_valid
 
Vec3 m_min_corner
 minimum corner of the search array More...
 
Vec3 m_max_corner
 maximum corner of the search array More...
 

Friends

template<typename TT >
std::ostream & operator<< (std::ostream &, const NeighborTable< TT > &)
 output More...
 

Detailed Description

template<typename T>
class NeighborTable< T >

class for neighbor search

Member Typedef Documentation

◆ arraytype

template<typename T >
typedef valarray<vector<typename list<T>::iterator> > NeighborTable< T >::arraytype

◆ IdParticleMap

template<typename T >
typedef std::map<int, T*> NeighborTable< T >::IdParticleMap

◆ indextype

template<typename T >
typedef pair<int,int> NeighborTable< T >::indextype

◆ iterator

template<typename T >
typedef list<T>::iterator NeighborTable< T >::iterator

◆ pairlist

template<typename T >
typedef list<pair<T*,T*> > NeighborTable< T >::pairlist

◆ particlelist

template<typename T >
typedef list<T*> NeighborTable< T >::particlelist

◆ pointtype

template<typename T >
typedef vector<typename list<T>::iterator> NeighborTable< T >::pointtype

Constructor & Destructor Documentation

◆ NeighborTable() [1/2]

template<typename T >
NeighborTable< T >::NeighborTable

Constructors.

construct an empty, uninitialized NeighborTable -> not usable

◆ NeighborTable() [2/2]

template<typename T >
NeighborTable< T >::NeighborTable ( int  x,
int  y,
int  z,
double  range,
double  alpha,
const Vec3 p0_global,
int  ix,
int  iy,
int  iz 
)

construct neigbortable with known dimensions

Parameters
xnr. of grid points in x-direction
ynr. of grid points in y-direction
znr. of grid points in z-direction
rangegrid spacing
alphapair search cutoff
p0_globalminimal corner (origin) of the global search space
ixx-index of the local origin
iyy-index of the local origin
izz-index of the local origin

References console, Console::Debug(), NeighborTable< T >::m_array, NeighborTable< T >::m_dim, NeighborTable< T >::m_global_idx, NeighborTable< T >::m_global_idy, NeighborTable< T >::m_global_idz, NeighborTable< T >::m_max_corner, NeighborTable< T >::m_min_corner, NeighborTable< T >::m_p0_global, NeighborTable< T >::m_xsize, NeighborTable< T >::m_ysize, NeighborTable< T >::m_zsize, Vec3::X(), Vec3::Y(), and Vec3::Z().

Here is the call graph for this function:

◆ ~NeighborTable()

template<typename T >
NeighborTable< T >::~NeighborTable

destruct NeighborTable

Member Function Documentation

◆ addPairsToList()

template<typename T >
void NeighborTable< T >::addPairsToList ( T_Handle< pairlist list,
int  idx1,
int  idx2 
)
private

Add pairs containing the particles at two given gridpoints to list.

Parameters
listthe pairlist
idx1the index of the first gridpoint
idx2the index of the second gridpoint

References esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ addPairsToListFlagged()

template<typename T >
void NeighborTable< T >::addPairsToListFlagged ( T_Handle< pairlist list,
int  idx1,
int  idx2 
)
private

Add pairs containing at least one flagged particle at two given gridpoints to list.

Parameters
listthe pairlist
idx1the index of the first gridpoint
idx2the index of the second gridpoint

References esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ addPairsToListLocal()

template<typename T >
void NeighborTable< T >::addPairsToListLocal ( T_Handle< pairlist list,
int  idx 
)
private

Add pairs containing the particles at one given gridpoint to list.

Parameters
listthe pairlist
idxthe index of the gridpoint

References esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ addPairsToListLocalFlagged()

template<typename T >
void NeighborTable< T >::addPairsToListLocalFlagged ( T_Handle< pairlist list,
int  idx 
)
private

Add pairs containing at least one flagged particle at one given gridpoint to list.

Parameters
listthe pairlist
idxthe index of the gridpoint

References esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ array()

template<typename T >
arraytype* NeighborTable< T >::array ( )
inlineprivate

◆ base_idx_x()

template<typename T >
int NeighborTable< T >::base_idx_x ( ) const
inline

◆ base_idx_y()

template<typename T >
int NeighborTable< T >::base_idx_y ( ) const
inline

◆ base_idx_z()

template<typename T >
int NeighborTable< T >::base_idx_z ( ) const
inline

◆ base_point()

template<typename T >
Vec3 NeighborTable< T >::base_point ( ) const
inline

◆ begin()

template<typename T >
iterator NeighborTable< T >::begin ( )
inline

< iterators

Referenced by DataExtractor::MaxShearToScalarData(), DataExtractor::StrainToTensorData(), and DataExtractor::writeScalarDataVtk().

Here is the caller graph for this function:

◆ block() [1/2]

template<typename T >
NTBlock< T > NeighborTable< T >::block ( const Vec3 vmin,
const Vec3 vmax 
)

References Vec3::X(), Vec3::Y(), and Vec3::Z().

Here is the call graph for this function:

◆ block() [2/2]

template<typename T >
NTBlock< T > NeighborTable< T >::block ( int  xmin,
int  xmax,
int  ymin,
int  ymax,
int  zmin,
int  zmax 
)

Referenced by main().

Here is the caller graph for this function:

◆ build()

template<typename T >
void NeighborTable< T >::build

STL compat. insert.

build search array

Build or rebuild the search array, calls clean_search_array. Particles outside the search space are removed from the list

References esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ clear_search_array()

template<typename T >
void NeighborTable< T >::clear_search_array
private

clean up the search array

References esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ end()

template<typename T >
iterator NeighborTable< T >::end ( )
inline

◆ erase()

template<typename T >
void NeighborTable< T >::erase ( NeighborTable< T >::indextype  idx)

erase particle (not meant to be used directly)

◆ getAllParticles()

template<typename T >
T_Handle< typename NeighborTable< T >::particlelist > NeighborTable< T >::getAllParticles

Get list of all particles

References esys::lsm::bpu::iter().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFullList()

template<typename T >
T_Handle< typename NeighborTable< T >::pairlist > NeighborTable< T >::getFullList

Create a full list of pair of neighboring particles and return handle to it.

Referenced by main().

Here is the caller graph for this function:

◆ getNearestPtr()

template<typename T >
T * NeighborTable< T >::getNearestPtr ( const Vec3 pos)

Return pointer to particle nearest to given position. Returns NULL if position is outside search area.

Parameters
posposition

References esys::lsm::bpu::iter(), and NULL.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNewList()

template<typename T >
T_Handle< typename NeighborTable< T >::pairlist > NeighborTable< T >::getNewList

Create a list of all pairs of neighboring particles involving a "flagged" particles and return handle to it.

References esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ getParticlesAtPlane()

template<typename T >
T_Handle< typename NeighborTable< T >::particlelist > NeighborTable< T >::getParticlesAtPlane ( const Vec3 orig,
const Vec3 normal 
)

Get list of all particles along a given plane. Naive implementation, i.e. check all particles for distance to plane. The plane is given by one point an the normal.

Parameters
origThe origin of the plane
normalThe normal of the plane

References console, Console::Debug(), and esys::lsm::bpu::iter().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParticlesNearEdge()

template<typename T >
T_Handle< typename NeighborTable< T >::particlelist > NeighborTable< T >::getParticlesNearEdge ( const AEdge E)

Get list of all particles near a given edge. Checks all particles at grid within range of the bounding box of the triangle; (could be improved - search area via Bresenham)

Parameters
Ethe Edge

References NTBlock< T >::begin(), NTBlock< T >::end(), AEdge::getBoundingBoxMax(), AEdge::getBoundingBoxMin(), esys::lsm::bpu::iter(), AEdge::sep(), Vec3::X(), Vec3::Y(), and Vec3::Z().

Here is the call graph for this function:

◆ getParticlesNearPoint()

template<typename T >
T_Handle< typename NeighborTable< T >::particlelist > NeighborTable< T >::getParticlesNearPoint ( const Vec3 p)

Get list of all particles near a given point.

Parameters
pthe point

References NTBlock< T >::begin(), NTBlock< T >::end(), esys::lsm::bpu::iter(), Vec3::X(), Vec3::Y(), and Vec3::Z().

Referenced by DataExtractor::StrainToTensorData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParticlesNearSphere()

template<typename T >
T_Handle< typename NeighborTable< T >::particlelist > NeighborTable< T >::getParticlesNearSphere ( const Vec3 centre,
const double &  radius 
)

Get list of all particles near a given sphere. Naive implementation, i.e. check all particles for distance to sphere.

Parameters
centreThe centre of the sphere
radiusThe radius of the sphere

References console, Console::Debug(), and esys::lsm::bpu::iter().

Here is the call graph for this function:

◆ getParticlesNearTriangle()

template<typename T >
T_Handle< typename NeighborTable< T >::particlelist > NeighborTable< T >::getParticlesNearTriangle ( const Triangle Tr)

Get list of all particles near a given triangle. Checks all particles at grid within range of the bounding box of the triangle; (could be improved)

Parameters
Tthe triangle

References NTBlock< T >::begin(), NTBlock< T >::end(), Triangle::getBoundingBoxMax(), Triangle::getBoundingBoxMin(), esys::lsm::bpu::iter(), Triangle::sep(), Vec3::X(), Vec3::Y(), and Vec3::Z().

Here is the call graph for this function:

◆ index() [1/2]

template<typename T >
int NeighborTable< T >::index ( const Vec3 pos)
private

helper function which returns the index in the search array into which a given position is mapped. Returns -1 if pos is outside the search space

Parameters
theposition

References Vec3::X(), and Vec3::Y().

Referenced by operator<<(), NTBlock< T >::ptr(), and NTBlock< T >::ref().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ index() [2/2]

template<typename T >
int NeighborTable< T >::index ( int  x,
int  y,
int  z 
) const
inline

helper function which returns the index in the search array from given x-,y- and z-indices.

Parameters
xthe x-index
ythe y-index
zthe z-index
Warning
no checks

◆ inner()

template<typename T >
NTBlock< T > NeighborTable< T >::inner

Return the inner region, i.e. excluding the boundary, as a NTBlock

Referenced by main().

Here is the caller graph for this function:

◆ insert() [1/2]

template<typename T >
void NeighborTable< T >::insert ( const T &  t)

particle insertion

insert a particle into the NeighborTable

Parameters
tthe particle

Referenced by main(), and DataExtractor::read().

Here is the caller graph for this function:

◆ insert() [2/2]

template<typename T >
void NeighborTable< T >::insert ( iterator  i,
const T &  data 
)
inline

Referenced by NeighborTable< DataParticle >::insert().

Here is the caller graph for this function:

◆ isInInner()

template<typename T >
bool NeighborTable< T >::isInInner ( const Vec3 pos)

dimensions

check if a position is in the inner part

Parameters
posthe position

◆ nparts_at_gridpoint()

template<typename T >
unsigned int NeighborTable< T >::nparts_at_gridpoint ( unsigned int  idx) const
inline

number of particles at a given gridpoint

Referenced by operator<<().

Here is the caller graph for this function:

◆ ptr()

template<typename T >
T * NeighborTable< T >::ptr ( NeighborTable< T >::indextype  idx)

Return pointer to particle at index.

Referenced by NTBlock< T >::ptr(), and NTSlab< T >::ptr().

Here is the caller graph for this function:

◆ ptr_by_id()

template<typename T >
T * NeighborTable< T >::ptr_by_id ( int  id)

Return pointer to particle with given id. Return NULL if the table doesn't contain the particle.

Parameters
idthe id of the particle

References console, Console::Debug(), and NULL.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ref()

template<typename T >
T & NeighborTable< T >::ref ( NeighborTable< T >::indextype  idx)

Return reference to particle at index.

Referenced by NTBlock< T >::ref(), and NTSlab< T >::ref().

Here is the caller graph for this function:

◆ size()

template<typename T >
int NeighborTable< T >::size ( )
inline

Referenced by DataExtractor::read(), and DataExtractor::writeScalarDataVtk().

Here is the caller graph for this function:

◆ xsize()

template<typename T >
int NeighborTable< T >::xsize ( )
inline

◆ xy_slab()

template<typename T >
NTSlab< T > NeighborTable< T >::xy_slab ( int  z)

partial access functions

Return representation for a slab of the search array in the xy-plane.

Parameters
zposition of the slab in z-direction

Referenced by main().

Here is the caller graph for this function:

◆ xz_slab()

template<typename T >
NTSlab< T > NeighborTable< T >::xz_slab ( int  y)

Return representation for a slab of the search array in the xz-plane.

Parameters
yposition of the slab in y-direction

Referenced by main().

Here is the caller graph for this function:

◆ ysize()

template<typename T >
int NeighborTable< T >::ysize ( )
inline

◆ yz_slab()

template<typename T >
NTSlab< T > NeighborTable< T >::yz_slab ( int  x)

Return representation for a slab of the search array in the yz-plane.

Parameters
xposition of the slab in x-direction

Referenced by main().

Here is the caller graph for this function:

◆ zsize()

template<typename T >
int NeighborTable< T >::zsize ( )
inline

Friends And Related Function Documentation

◆ operator<<

template<typename T >
template<typename TT >
std::ostream& operator<< ( std::ostream &  ,
const NeighborTable< TT > &   
)
friend

output

Member Data Documentation

◆ m_alpha

template<typename T >
double NeighborTable< T >::m_alpha
private

padding factor (dim=2*rmax+alpha)

◆ m_array

◆ m_dim

template<typename T >
double NeighborTable< T >::m_dim
private

grid spacing of search array

Referenced by NeighborTable< T >::NeighborTable(), and operator<<().

◆ m_global_idx

template<typename T >
int NeighborTable< T >::m_global_idx
private

minimum corner index (x component)

Referenced by NeighborTable< DataParticle >::base_idx_x(), and NeighborTable< T >::NeighborTable().

◆ m_global_idy

template<typename T >
int NeighborTable< T >::m_global_idy
private

minimum corner index (y component)

Referenced by NeighborTable< DataParticle >::base_idx_y(), and NeighborTable< T >::NeighborTable().

◆ m_global_idz

template<typename T >
int NeighborTable< T >::m_global_idz
private

minimum corner index (z component)

Referenced by NeighborTable< DataParticle >::base_idx_z(), and NeighborTable< T >::NeighborTable().

◆ m_idParticleMap

template<typename T >
IdParticleMap NeighborTable< T >::m_idParticleMap
private

mapping between particle-id and particle-pointer

◆ m_list

template<typename T >
list<T> NeighborTable< T >::m_list
private

◆ m_max_corner

template<typename T >
Vec3 NeighborTable< T >::m_max_corner
private

maximum corner of the search array

Referenced by NeighborTable< T >::NeighborTable().

◆ m_min_corner

template<typename T >
Vec3 NeighborTable< T >::m_min_corner
private

minimum corner of the search array

Referenced by NeighborTable< T >::NeighborTable().

◆ m_p0_global

template<typename T >
Vec3 NeighborTable< T >::m_p0_global
private

minimum corner of global search space

Referenced by NeighborTable< DataParticle >::base_point(), and NeighborTable< T >::NeighborTable().

◆ m_valid

template<typename T >
bool NeighborTable< T >::m_valid
private

◆ m_xsize

template<typename T >
int NeighborTable< T >::m_xsize
private

number of grid point, x direction

Referenced by NeighborTable< T >::NeighborTable(), operator<<(), and NeighborTable< DataParticle >::xsize().

◆ m_ysize

template<typename T >
int NeighborTable< T >::m_ysize
private

number of grid point, y direction

Referenced by NeighborTable< T >::NeighborTable(), operator<<(), and NeighborTable< DataParticle >::ysize().

◆ m_zsize

template<typename T >
int NeighborTable< T >::m_zsize
private

number of grid point, z direction

Referenced by NeighborTable< T >::NeighborTable(), operator<<(), and NeighborTable< DataParticle >::zsize().


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