JDFTx  1.7.0
PeriodicLookup< T > Class Template Reference

#include <LatticeUtils.h>

Public Member Functions

 PeriodicLookup (const std::vector< T > &points, matrix3<> metric, size_t nPointsTarget=0)
 
void addPoint (size_t iPoint, const T &point)
 
template<typename Tag = double, typename TagEquality = std::equal_to<Tag>>
size_t find (vector3<> v, Tag tag=Tag(), const std::vector< Tag > *tagArr=0, TagEquality tagEquality=std::equal_to< Tag >()) const
 

Detailed Description

template<typename T>
class PeriodicLookup< T >

O(1) look-up table for finding periodic image within symmThreshold Needs a companion function vector3<> getCoord(T) that returns the lattice coordinates corresponding to type T

Constructor & Destructor Documentation

◆ PeriodicLookup()

template<typename T >
PeriodicLookup< T >::PeriodicLookup ( const std::vector< T > &  points,
matrix3<>  metric,
size_t  nPointsTarget = 0 
)
inline

Initialize given an array of points and a metric corresponding to the lattice coordinates (optionally override the number of points, if the points array is to be dynamically grown)

Member Function Documentation

◆ addPoint()

template<typename T >
void PeriodicLookup< T >::addPoint ( size_t  iPoint,
const T &  point 
)
inline

Call every time a point is added to the end of the points vector externally. Note that points may only be added to the end of the vector (otherwise some of the existing indices are invalidated!)

◆ find()

template<typename T >
template<typename Tag = double, typename TagEquality = std::equal_to<Tag>>
size_t PeriodicLookup< T >::find ( vector3<>  v,
Tag  tag = Tag(),
const std::vector< Tag > *  tagArr = 0,
TagEquality  tagEquality = std::equal_to<Tag>() 
) const
inline

Return index of a point within symmThresold of x, and string::npos if none found (Optionally also only return points whose tag matches the specified value)


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