QMCPACK
SimpleGrid Class Reference
+ Collaboration diagram for SimpleGrid:

Public Member Functions

int NumPoints ()
 
std::vector< double > & Points ()
 
double operator[] (int i)
 
int ReverseMap (double r)
 Returns the index of the nearest point below r. More...
 
double Start ()
 
double End ()
 
void Init (std::vector< double > &points)
 
 SimpleGrid ()
 Useless constructor. More...
 

Private Attributes

std::vector< double > grid
 

Detailed Description

Definition at line 20 of file GeneralGrid.h.

Constructor & Destructor Documentation

◆ SimpleGrid()

SimpleGrid ( )
inline

Useless constructor.

Definition at line 71 of file GeneralGrid.h.

72  { /* Do nothing */
73  }

Member Function Documentation

◆ End()

double End ( )
inline

Definition at line 62 of file GeneralGrid.h.

References grid.

Referenced by CubSpline::operator()().

62 { return grid[grid.size() - 1]; }
std::vector< double > grid
Definition: GeneralGrid.h:23

◆ Init()

void Init ( std::vector< double > &  points)
inline

Definition at line 64 of file GeneralGrid.h.

References grid.

65  {
66  grid.resize(points.size());
67  grid = points;
68  }
std::vector< double > grid
Definition: GeneralGrid.h:23

◆ NumPoints()

int NumPoints ( )
inline

Definition at line 26 of file GeneralGrid.h.

References grid.

Referenced by CubSpline::Deriv(), CubSpline::Deriv2(), CubSpline::Deriv3(), CubSpline::Init(), CubSpline::operator()(), and CubSpline::size().

26 { return grid.size(); }
std::vector< double > grid
Definition: GeneralGrid.h:23

◆ operator[]()

double operator[] ( int  i)
inline

Definition at line 30 of file GeneralGrid.h.

References grid.

30 { return grid[i]; }
std::vector< double > grid
Definition: GeneralGrid.h:23

◆ Points()

std::vector<double>& Points ( )
inline

Definition at line 28 of file GeneralGrid.h.

References grid.

28 { return grid; }
std::vector< double > grid
Definition: GeneralGrid.h:23

◆ ReverseMap()

int ReverseMap ( double  r)
inline

Returns the index of the nearest point below r.

Definition at line 33 of file GeneralGrid.h.

References BLAS::done, grid, and qmcplusplus::n.

Referenced by CubSpline::Deriv(), CubSpline::Deriv2(), CubSpline::Deriv3(), and CubSpline::operator()().

34  {
35  int n = grid.size();
36  if (r <= grid[0])
37  return (0);
38  else if (r >= grid[n - 1])
39  return n - 1;
40  else
41  {
42  int hi = n - 1;
43  int lo = 0;
44  bool done = false;
45  while (!done)
46  {
47  int i = (hi + lo) >> 1;
48  if (grid[i] > r)
49  hi = i;
50  else
51  lo = i;
52  done = (hi - lo) < 2;
53  }
54  if (grid[lo] >= r)
55  lo--;
56  return (lo);
57  }
58  }
std::vector< double > grid
Definition: GeneralGrid.h:23
constexpr double done
Definition: BLAS.hpp:48

◆ Start()

double Start ( )
inline

Definition at line 60 of file GeneralGrid.h.

References grid.

60 { return grid[0]; }
std::vector< double > grid
Definition: GeneralGrid.h:23

Member Data Documentation

◆ grid

std::vector<double> grid
private

Definition at line 23 of file GeneralGrid.h.

Referenced by End(), Init(), NumPoints(), operator[](), Points(), ReverseMap(), and Start().


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