QMCPACK
OneDimGridBase< T, CT > Struct Template Referenceabstract

An abstract base class to implement a One-Dimensional grid. More...

+ Inheritance diagram for OneDimGridBase< T, CT >:
+ Collaboration diagram for OneDimGridBase< T, CT >:

Public Types

using value_type = T
 
using Array_t = CT
 

Public Member Functions

 OneDimGridBase ()
 
virtual std::unique_ptr< OneDimGridBase< T, CT > > makeClone () const =0
 
virtual ~OneDimGridBase ()=default
 
int getGridTag () const
 
int getIndex (T r) const
 
T & operator[] (int i)
 assign a value More...
 
T & operator() (int i)
 assign a value More...
 
operator[] (int i) const
 return a value More...
 
operator() (int i) const
 return a value More...
 
const T * data () const
 
T * data ()
 
dh () const
 return the differential spacing of the grid More...
 
r (int i) const
 returns $ r(i)$ More...
 
dr (int i) const
 returns $ r(i+1)-r(i)$ More...
 
int size () const
 returns the size of the grid More...
 
rmin () const
 return the first grid point More...
 
rmax () const
 return the last grid point More...
 
template<typename T1 >
int getIndexAndDistanceFromGridPoint (T r, T1 &dist) const
 
virtual int locate (T r) const =0
 evaluate the index of r More...
 
virtual void set (T ri, T rf, int n)=0
 Set the grid given the parameters. More...
 

Public Attributes

int GridTag
 
int num_points
 
value_type lower_bound
 
value_type upper_bound
 
value_type Delta
 differential spacing of the grid More...
 
double DeltaInv
 
Array_t X
 array to store the radial grid data More...
 

Detailed Description

template<class T, class CT = Vector<T>>
struct qmcplusplus::OneDimGridBase< T, CT >

An abstract base class to implement a One-Dimensional grid.

Definition at line 35 of file OneDimGridBase.h.

Member Typedef Documentation

◆ Array_t

using Array_t = CT

Definition at line 38 of file OneDimGridBase.h.

◆ value_type

using value_type = T

Definition at line 37 of file OneDimGridBase.h.

Constructor & Destructor Documentation

◆ OneDimGridBase()

OneDimGridBase ( )
inline

Definition at line 53 of file OneDimGridBase.h.

◆ ~OneDimGridBase()

virtual ~OneDimGridBase ( )
virtualdefault

Member Function Documentation

◆ data() [1/2]

const T* data ( ) const
inline

Definition at line 86 of file OneDimGridBase.h.

86 { return &(X[0]); }
Array_t X
array to store the radial grid data

◆ data() [2/2]

T* data ( )
inline

Definition at line 87 of file OneDimGridBase.h.

87 { return &(X[0]); }
Array_t X
array to store the radial grid data

◆ dh()

T dh ( ) const
inline

return the differential spacing of the grid

Definition at line 90 of file OneDimGridBase.h.

Referenced by qmcplusplus::TEST_CASE().

90 { return Delta; }
value_type Delta
differential spacing of the grid

◆ dr()

T dr ( int  i) const
inline

returns $ r(i+1)-r(i)$

Definition at line 94 of file OneDimGridBase.h.

Referenced by qmcplusplus::TEST_CASE().

94 { return X[i + 1] - X[i]; }
Array_t X
array to store the radial grid data

◆ getGridTag()

int getGridTag ( ) const
inline

Definition at line 59 of file OneDimGridBase.h.

◆ getIndex()

int getIndex ( r) const
inline

Definition at line 61 of file OneDimGridBase.h.

Referenced by SkParserBase::compute_sk().

62  {
63  int k;
64  int klo = 0;
65  int khi = this->size();
66  while (khi - klo > 1)
67  {
68  k = (khi + klo) >> 1;
69  if (X[k] > r)
70  khi = k;
71  else
72  klo = k;
73  }
74  return klo;
75  }
Array_t X
array to store the radial grid data
int size() const
returns the size of the grid
T r(int i) const
returns

◆ getIndexAndDistanceFromGridPoint()

int getIndexAndDistanceFromGridPoint ( r,
T1 &  dist 
) const
inline

Definition at line 103 of file OneDimGridBase.h.

104  {
105  //Find Loc
106  int Loc = locate(r);
107  dist = (r - X[Loc]);
108  return Loc;
109  }
Array_t X
array to store the radial grid data
virtual int locate(T r) const =0
evaluate the index of r
T r(int i) const
returns

◆ locate()

virtual int locate ( r) const
pure virtual

evaluate the index of r

Parameters
rcurrent position

The grid index satisfies $ X[Loc] \ge r < X[Loc+1]$.

Implemented in NumericalGrid< T, CT >, LogGridZero< T, CT >, LogGrid< T, CT >, LinearGrid< T, CT >, and LinearGrid< RealType >.

Referenced by OneDimGridBase< RealType, Vector< RealType > >::getIndexAndDistanceFromGridPoint().

◆ makeClone()

virtual std::unique_ptr<OneDimGridBase<T, CT> > makeClone ( ) const
pure virtual

◆ operator()() [1/2]

T& operator() ( int  i)
inline

assign a value

Definition at line 80 of file OneDimGridBase.h.

80 { return X[i]; }
Array_t X
array to store the radial grid data

◆ operator()() [2/2]

T operator() ( int  i) const
inline

return a value

Definition at line 84 of file OneDimGridBase.h.

84 { return X[i]; }
Array_t X
array to store the radial grid data

◆ operator[]() [1/2]

T& operator[] ( int  i)
inline

assign a value

Definition at line 78 of file OneDimGridBase.h.

78 { return X[i]; }
Array_t X
array to store the radial grid data

◆ operator[]() [2/2]

T operator[] ( int  i) const
inline

return a value

Definition at line 82 of file OneDimGridBase.h.

82 { return X[i]; }
Array_t X
array to store the radial grid data

◆ r()

◆ rmax()

◆ rmin()

T rmin ( ) const
inline

◆ set()

virtual void set ( ri,
rf,
int  n 
)
pure virtual

Set the grid given the parameters.

Parameters
riinitial grid point
rffinal grid point
nnumber of grid points

Implemented in NumericalGrid< T, CT >, LogGridZero< T, CT >, LogGrid< T, CT >, LinearGrid< T, CT >, and LinearGrid< RealType >.

◆ size()

Member Data Documentation

◆ Delta

◆ DeltaInv

◆ GridTag

◆ lower_bound

◆ num_points

◆ upper_bound

◆ X


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