QMCPACK
OneDimGridFunctor< Td, Tg, CTd, CTg > Struct Template Reference

Implement One-Dimensional function on a radial grid. More...

+ Inheritance diagram for OneDimGridFunctor< Td, Tg, CTd, CTg >:
+ Collaboration diagram for OneDimGridFunctor< Td, Tg, CTd, CTg >:

Public Types

using value_type = Td
 the type of the value on a grid More...
 
using point_type = Tg
 the type of the grid value More...
 
using data_type = CTd
 the type of the containers Y, dY and d2Y More...
 
using grid_type = OneDimGridBase< Tg, CTg >
 the grid type More...
 
using this_type = OneDimGridFunctor< Td, Tg, CTd, CTg >
 the type of this class More...
 

Public Member Functions

 OneDimGridFunctor (std::unique_ptr< grid_type > gt=std::unique_ptr< grid_type >())
 constructor More...
 
 OneDimGridFunctor (const OneDimGridFunctor &a)
 
virtual ~OneDimGridFunctor ()=default
 
template<typename TT >
void resetParameters (const TT &active)
 
void setNumOfNodes (int n)
 set the number of nodes More...
 
int getNumOfNodes () const
 return the number of nodes More...
 
value_typedata ()
 return the grid data More...
 
const value_typedata () const
 assign the grid data More...
 
int size () const
 return the number of data points More...
 
void resize (int n)
 resize the number of data points More...
 
const grid_typegrid () const
 return the radial grid More...
 
grid_typegrid ()
 assign a radial grid More...
 
value_type operator() (int i) const
 returns a value More...
 
value_typeoperator() (int i)
 asign a value at i More...
 
point_type dh () const
 return the address of the values More...
 
point_type r (int i) const
 return $r(i)$ the grid point at index i More...
 
point_type dr (int i) const
 return $r(i+1)-r(i)$ More...
 
value_type f (point_type r)
 Evaluate the function and its derivatives, store the derivatives. More...
 
value_type df (point_type r)
 Evaluate the function and its derivatives, store the derivatives. More...
 
value_type evaluate (point_type r, point_type rinv)
 Evaluate the function value only. More...
 
value_type evaluateAll (point_type r, point_type rinv)
 Evaluate the function and its derivatives. More...
 
virtual value_type splint (point_type r, value_type &du, value_type &d2u) const
 
virtual value_type splint (point_type r) const
 
virtual void spline (int imin, value_type yp1, int imax, value_type ypn)
 
virtual void spline ()
 
value_type evaluate (point_type r, point_type rinv, value_type &du, value_type &d2u)
 Evaluate the function and its derivatives. More...
 

Public Attributes

std::unique_ptr< grid_typem_grid
 pointer to the radial grid More...
 
value_type Y
 store the value of the function More...
 
value_type dY
 store the derivative of the function More...
 
value_type d2Y
 store the second derivative of the function More...
 
data_type m_Y
 data for the function on the grid More...
 
int NumNodes
 the number of nodes More...
 

Detailed Description

template<class Td, class Tg = Td, class CTd = Vector<Td>, class CTg = Vector<Tg>>
struct qmcplusplus::OneDimGridFunctor< Td, Tg, CTd, CTg >

Implement One-Dimensional function on a radial grid.

template parameters

  • Td return type
  • Tg grid value type
  • CTd container type associated with the values and derivatives
  • CTg container type associated with the grid data

Store the values of the function for the corresponding grid points, $ y_i = y(x_i) $.

Definition at line 36 of file OneDimGridFunctor.h.

Member Typedef Documentation

◆ data_type

using data_type = CTd

the type of the containers Y, dY and d2Y

Definition at line 43 of file OneDimGridFunctor.h.

◆ grid_type

using grid_type = OneDimGridBase<Tg, CTg>

the grid type

Definition at line 45 of file OneDimGridFunctor.h.

◆ point_type

using point_type = Tg

the type of the grid value

Definition at line 41 of file OneDimGridFunctor.h.

◆ this_type

using this_type = OneDimGridFunctor<Td, Tg, CTd, CTg>

the type of this class

Definition at line 47 of file OneDimGridFunctor.h.

◆ value_type

using value_type = Td

the type of the value on a grid

Definition at line 39 of file OneDimGridFunctor.h.

Constructor & Destructor Documentation

◆ OneDimGridFunctor() [1/2]

OneDimGridFunctor ( std::unique_ptr< grid_type gt = std::unique_ptr<grid_type>())
inline

constructor

Parameters
gta radial grid. The pointer is treated as a reference

Definition at line 52 of file OneDimGridFunctor.h.

52  : m_grid(std::move(gt))
53  {
54  if (m_grid)
55  resize(m_grid->size());
56  }
void resize(int n)
resize the number of data points
std::unique_ptr< grid_type > m_grid
pointer to the radial grid

◆ OneDimGridFunctor() [2/2]

OneDimGridFunctor ( const OneDimGridFunctor< Td, Tg, CTd, CTg > &  a)
inline

Definition at line 58 of file OneDimGridFunctor.h.

59  {
60  if (a.m_grid)
61  m_grid = a.m_grid->makeClone();
62  Y = a.Y;
63  dY = a.dY;
64  d2Y = a.d2Y;
65  m_Y.resize(a.m_Y.size());
66  m_Y = a.m_Y;
67  NumNodes = a.NumNodes;
68  }
int NumNodes
the number of nodes
value_type Y
store the value of the function
value_type d2Y
store the second derivative of the function
value_type dY
store the derivative of the function
std::unique_ptr< grid_type > m_grid
pointer to the radial grid
data_type m_Y
data for the function on the grid

◆ ~OneDimGridFunctor()

virtual ~OneDimGridFunctor ( )
virtualdefault

Member Function Documentation

◆ data() [1/2]

value_type* data ( )
inline

return the grid data

Definition at line 83 of file OneDimGridFunctor.h.

Referenced by OneDimQuinticSpline< Td, Tg, CTd, CTg >::set().

83 { return &(m_Y[0]); }
data_type m_Y
data for the function on the grid

◆ data() [2/2]

const value_type* data ( ) const
inline

assign the grid data

Definition at line 85 of file OneDimGridFunctor.h.

85 { return &(m_Y[0]); }
data_type m_Y
data for the function on the grid

◆ df()

value_type df ( point_type  r)
inline

Evaluate the function and its derivatives, store the derivatives.

Parameters
rradial distance
Returns
the derivative of the function

Definition at line 139 of file OneDimGridFunctor.h.

140  {
141  //setgrid(r);
142  Y = splint(r, dY, d2Y);
143  return dY;
144  }
value_type Y
store the value of the function
value_type d2Y
store the second derivative of the function
virtual value_type splint(point_type r, value_type &du, value_type &d2u) const
value_type dY
store the derivative of the function
point_type r(int i) const
return the grid point at index i

◆ dh()

point_type dh ( ) const
inline

return the address of the values

Parameters
iindex, i=0 value, i=1 first derivative, i=2 second return the differntial spacing for the grid
Warning
only for LinearGrid and LogGrid

Definition at line 118 of file OneDimGridFunctor.h.

118 { return m_grid->dh(); }
std::unique_ptr< grid_type > m_grid
pointer to the radial grid

◆ dr()

point_type dr ( int  i) const
inline

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

Definition at line 123 of file OneDimGridFunctor.h.

123 { return m_grid->dr(i); }
std::unique_ptr< grid_type > m_grid
pointer to the radial grid

◆ evaluate() [1/2]

value_type evaluate ( point_type  r,
point_type  rinv 
)
inline

Evaluate the function value only.

Parameters
rvalue on a grid
rinvinverse of r
Returns
value at r

Definition at line 151 of file OneDimGridFunctor.h.

151 { return Y = splint(r); }
value_type Y
store the value of the function
virtual value_type splint(point_type r, value_type &du, value_type &d2u) const
point_type r(int i) const
return the grid point at index i

◆ evaluate() [2/2]

value_type evaluate ( point_type  r,
point_type  rinv,
value_type du,
value_type d2u 
)
inline

Evaluate the function and its derivatives.

Parameters
rradial distance
rinvinverse of radial distance
dureturn derivative
d2ureturn 2nd derivative
Returns
the value of the function

Definition at line 178 of file OneDimGridFunctor.h.

179  {
180  return splint(r, du, d2u);
181  }
virtual value_type splint(point_type r, value_type &du, value_type &d2u) const
point_type r(int i) const
return the grid point at index i

◆ evaluateAll()

value_type evaluateAll ( point_type  r,
point_type  rinv 
)
inline

Evaluate the function and its derivatives.

Parameters
rvalue on a grid
rinvinverse of r
Returns
value at r

Derivatives are storged.

Definition at line 160 of file OneDimGridFunctor.h.

160 { return Y = splint(r, dY, d2Y); }
value_type Y
store the value of the function
value_type d2Y
store the second derivative of the function
virtual value_type splint(point_type r, value_type &du, value_type &d2u) const
value_type dY
store the derivative of the function
point_type r(int i) const
return the grid point at index i

◆ f()

value_type f ( point_type  r)
inline

Evaluate the function and its derivatives, store the derivatives.

Parameters
rradial distance
Returns
the value of the function

Definition at line 129 of file OneDimGridFunctor.h.

Referenced by OneDimQuinticSpline< Td, Tg, CTd, CTg >::quinticInterpolate(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::quinticInterpolateSecondDeriv(), and OneDimQuinticSpline< Td, Tg, CTd, CTg >::quinticInterpolateThirdDeriv().

130  {
131  //setgrid(r);
132  return Y = splint(r);
133  }
value_type Y
store the value of the function
virtual value_type splint(point_type r, value_type &du, value_type &d2u) const
point_type r(int i) const
return the grid point at index i

◆ getNumOfNodes()

int getNumOfNodes ( ) const
inline

return the number of nodes

Definition at line 80 of file OneDimGridFunctor.h.

80 { return NumNodes; }
int NumNodes
the number of nodes

◆ grid() [1/2]

const grid_type& grid ( ) const
inline

return the radial grid

Definition at line 91 of file OneDimGridFunctor.h.

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

91 { return *m_grid; }
std::unique_ptr< grid_type > m_grid
pointer to the radial grid

◆ grid() [2/2]

grid_type& grid ( )
inline

assign a radial grid

Definition at line 93 of file OneDimGridFunctor.h.

93 { return *m_grid; }
std::unique_ptr< grid_type > m_grid
pointer to the radial grid

◆ operator()() [1/2]

value_type operator() ( int  i) const
inline

returns a value

Parameters
igrid index
Returns
the value at i

Definition at line 99 of file OneDimGridFunctor.h.

99 { return m_Y[i]; }
data_type m_Y
data for the function on the grid

◆ operator()() [2/2]

value_type& operator() ( int  i)
inline

asign a value at i

Parameters
igrid index
Returns
the value at i

Definition at line 105 of file OneDimGridFunctor.h.

105 { return m_Y[i]; }
data_type m_Y
data for the function on the grid

◆ r()

◆ resetParameters()

void resetParameters ( const TT &  active)
inline

Definition at line 73 of file OneDimGridFunctor.h.

74  {}

◆ resize()

void resize ( int  n)
inline

resize the number of data points

Definition at line 89 of file OneDimGridFunctor.h.

Referenced by OneDimGridFunctor< T, T, Vector< T >, Vector< T > >::OneDimGridFunctor(), and OneDimNumGridFunctor< T >::put().

89 { m_Y.resize(n); }
data_type m_Y
data for the function on the grid

◆ setNumOfNodes()

void setNumOfNodes ( int  n)
inline

set the number of nodes

Definition at line 77 of file OneDimGridFunctor.h.

77 { NumNodes = n; }
int NumNodes
the number of nodes

◆ size()

int size ( void  ) const
inline

return the number of data points

Definition at line 87 of file OneDimGridFunctor.h.

Referenced by MultiQuinticSpline1D< T >::add_spline(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::spline(), OneDimLinearSpline< Td, Tg, CTd, CTg >::spline(), and OneDimCubicSpline< T >::spline().

87 { return m_Y.size(); }
data_type m_Y
data for the function on the grid

◆ spline() [1/2]

virtual void spline ( int  imin,
value_type  yp1,
int  imax,
value_type  ypn 
)
inlinevirtual

◆ spline() [2/2]

◆ splint() [1/2]

◆ splint() [2/2]

virtual value_type splint ( point_type  r) const
inlinevirtual

Member Data Documentation

◆ d2Y

◆ dY

◆ m_grid

◆ m_Y

◆ NumNodes

◆ Y


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