QMCPACK
ClusterGrid Class Reference

ClusterGrid is a function whose gridpoints are clustered tightly around the origin. More...

+ Inheritance diagram for ClusterGrid:
+ Collaboration diagram for ClusterGrid:

Public Member Functions

GridType Type () override
 Returns the type of the grid (i.e. linear, optimal, etc) More...
 
int ReverseMap (double r) override
 Returns the index of the nearest point below r. More...
 
void Init (double start, double end, double cluster, int numpoints)
 
void Write (IOSectionClass &outSection) override
 
void Read (IOSectionClass &inSection) override
 
 ClusterGrid (double start, double end, double cluster, int numpoints)
 
 ClusterGrid ()
 
- Public Member Functions inherited from Grid
double operator() (int i) const
 The i'th point in the grid. More...
 
double * data ()
 
Array< double, 1 > & Points ()
 
virtual ~Grid ()
 

Public Attributes

double Start
 
double End
 
double Cluster
 
- Public Attributes inherited from Grid
double Start
 First and last grid points. More...
 
double End
 
int NumPoints
 Number of points in the grid. More...
 

Private Attributes

double x0
 
double dri
 
double rr
 

Additional Inherited Members

- Protected Attributes inherited from Grid
Array< double, 1 > grid
 Contains the grid points. More...
 

Detailed Description

ClusterGrid is a function whose gridpoints are clustered tightly around the origin.

Definition at line 578 of file Grid.h.

Constructor & Destructor Documentation

◆ ClusterGrid() [1/2]

ClusterGrid ( double  start,
double  end,
double  cluster,
int  numpoints 
)
inline

Definition at line 626 of file Grid.h.

References Init().

626 { Init(start, end, cluster, numpoints); }
void Init(double start, double end, double cluster, int numpoints)
Definition: Grid.h:590

◆ ClusterGrid() [2/2]

ClusterGrid ( )
inline

Definition at line 627 of file Grid.h.

628  { /* Do nothing */
629  }

Member Function Documentation

◆ Init()

void Init ( double  start,
double  end,
double  cluster,
int  numpoints 
)
inline

Definition at line 590 of file Grid.h.

References Cluster, dri, End, Grid::grid, Grid::NumPoints, Array< T, D, ALLOC >::resize(), rr, Start, and x0.

Referenced by ClusterGrid(), and Read().

591  {
592  Start = start;
593  End = end;
594  Cluster = cluster;
595  NumPoints = numpoints;
596 
597  x0 = (NumPoints - Cluster) / (1.0 - Cluster);
598  dri = -(End - Start) * ((double)NumPoints - x0) * (1.0 - x0) / ((double)NumPoints - 1.0);
599  rr = Start - dri / (1.0 - x0);
601  for (int i = 0; i < NumPoints; i++)
602  grid(i) = rr + dri / (i + 1.0 - x0);
603  }
Array< double, 1 > grid
Contains the grid points.
Definition: Grid.h:47
int NumPoints
Number of points in the grid.
Definition: Grid.h:54
void resize(const std::array< SIZET, D > &dims)
Resize the container.
Definition: OhmmsArray.h:65
double rr
Definition: Grid.h:581
double x0
Definition: Grid.h:581
double Cluster
Definition: Grid.h:584
double Start
Definition: Grid.h:584
double End
Definition: Grid.h:584
double dri
Definition: Grid.h:581

◆ Read()

void Read ( IOSectionClass inSection)
inlineoverridevirtual

Implements Grid.

Definition at line 615 of file Grid.h.

References Init(), and IOSectionClass::ReadVar().

616  {
617  double start, end, cluster;
618  int numpoints;
619  assert(inSection.ReadVar("Start", start));
620  assert(inSection.ReadVar("End", end));
621  assert(inSection.ReadVar("Cluster", cluster));
622  assert(inSection.ReadVar("NumPoints", numpoints));
623  Init(start, end, cluster, numpoints);
624  }
void Init(double start, double end, double cluster, int numpoints)
Definition: Grid.h:590
bool ReadVar(std::string name, T &var)
Template function which reads a variable in the present section into the passed-by-reference T variab...
Definition: IO.h:168

◆ ReverseMap()

int ReverseMap ( double  r)
inlineoverridevirtual

Returns the index of the nearest point below r.

Implements Grid.

Definition at line 588 of file Grid.h.

References dri, qmcplusplus::floor(), rr, and x0.

588 { return ((int)floor(dri / (r - rr) - 1.0 + x0)); }
double rr
Definition: Grid.h:581
double x0
Definition: Grid.h:581
double dri
Definition: Grid.h:581
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)

◆ Type()

GridType Type ( )
inlineoverridevirtual

Returns the type of the grid (i.e. linear, optimal, etc)

Implements Grid.

Definition at line 586 of file Grid.h.

References CLUSTER.

586 { return (CLUSTER); }
Definition: Grid.h:36

◆ Write()

void Write ( IOSectionClass outSection)
inlineoverridevirtual

Implements Grid.

Definition at line 605 of file Grid.h.

References Cluster, End, Grid::grid, Grid::NumPoints, Start, and IOSectionClass::WriteVar().

606  {
607  outSection.WriteVar("Points", grid);
608  outSection.WriteVar("Type", std::string("Cluster"));
609  outSection.WriteVar("Start", Start);
610  outSection.WriteVar("End", End);
611  outSection.WriteVar("Cluster", Cluster);
612  outSection.WriteVar("NumPoints", NumPoints);
613  }
Array< double, 1 > grid
Contains the grid points.
Definition: Grid.h:47
int NumPoints
Number of points in the grid.
Definition: Grid.h:54
bool WriteVar(std::string name, T val)
Writes a variable under the current section.
Definition: IO.h:184
double Cluster
Definition: Grid.h:584
double Start
Definition: Grid.h:584
double End
Definition: Grid.h:584

Member Data Documentation

◆ Cluster

double Cluster

Definition at line 584 of file Grid.h.

Referenced by Init(), and Write().

◆ dri

double dri
private

Definition at line 581 of file Grid.h.

Referenced by Init(), and ReverseMap().

◆ End

double End

Definition at line 584 of file Grid.h.

Referenced by Init(), and Write().

◆ rr

double rr
private

Definition at line 581 of file Grid.h.

Referenced by Init(), and ReverseMap().

◆ Start

double Start

Definition at line 584 of file Grid.h.

Referenced by Init(), and Write().

◆ x0

double x0
private

Definition at line 581 of file Grid.h.

Referenced by Init(), and ReverseMap().


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