SSAGES  0.8.5
Software Suite for Advanced General Ensemble Simulations
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SSAGES::BasisFunction Class Reference

Abstract class for all BasisFunction inheritance. More...

#include <Basis.h>

Inheritance diagram for SSAGES::BasisFunction:
Inheritance graph
[legend]

Public Member Functions

 BasisFunction (unsigned int polyOrd, unsigned int nbins, bool isFinite, bool zeroOrder, double boundLow, double boundUp)
 Constructor. More...
 
unsigned int GetOrder ()
 Gets the order of the current polynomial. More...
 
unsigned int GetBins ()
 Gets the number of bins for the discretization. More...
 
bool GetZeroOrder ()
 Gets the flag for constant-order polynomials. More...
 
double GetLower ()
 Gets the lower bound on the CV. More...
 
double GetUpper ()
 Gets the upper bound on the CV. More...
 
double GetRange ()
 Gets the magnitude of the range of bounds. More...
 
virtual double GetNorm (int order)
 Gets the norm of the basis function. More...
 
virtual double Evaluate (double val, int order)
 Calculates the output of the basis function. More...
 
virtual double EvalGrad (double val, int order)
 Calculates the gradient of the basis function. More...
 
virtual double Weight (double val)
 Calculates the gradient of the basis function. More...
 
virtual ~BasisFunction ()
 Destructor.
 

Static Public Member Functions

static BasisFunctionBuild (const Json::Value &json, const std::string &path, unsigned int nbins)
 Build BasisFunction from JSON value. More...
 

Protected Attributes

unsigned int polyOrd_
 Order of the polynomial.
 
unsigned int nbins_
 Number of bins.
 
bool isFinite_
 Flag for finite-range polynomials.
 
bool zeroOrder_
 Flag for constant-order polynomials.
 
double boundLow_
 Lower bound on CV.
 
double boundUp_
 Upper bound on CV.
 

Detailed Description

Abstract class for all BasisFunction inheritance.

Definition at line 61 of file Basis.h.

Constructor & Destructor Documentation

SSAGES::BasisFunction::BasisFunction ( unsigned int  polyOrd,
unsigned int  nbins,
bool  isFinite,
bool  zeroOrder,
double  boundLow,
double  boundUp 
)
inline

Constructor.

Parameters
polyOrdOrder of polynomial.
nbinsNumber of bins.
isFiniteFlag for finite-range polynomials.
zeroOrderFlag for constant-order polynomials.
boundLowLower bounds of restraint springs.
boundUpUpper bounds of restraint springs.

Constructs an instance of the Basis function class, which can have multiple different inherited forms.

Definition at line 84 of file Basis.h.

89  :
90  polyOrd_(polyOrd), nbins_(nbins), isFinite_(isFinite), zeroOrder_(zeroOrder),
91  boundLow_(boundLow), boundUp_(boundUp)
92  {
93  }
bool isFinite_
Flag for finite-range polynomials.
Definition: Basis.h:66
unsigned int nbins_
Number of bins.
Definition: Basis.h:65
double boundUp_
Upper bound on CV.
Definition: Basis.h:69
double boundLow_
Lower bound on CV.
Definition: Basis.h:68
unsigned int polyOrd_
Order of the polynomial.
Definition: Basis.h:64
bool zeroOrder_
Flag for constant-order polynomials.
Definition: Basis.h:67

Member Function Documentation

BasisFunction * SSAGES::BasisFunction::Build ( const Json::Value &  json,
const std::string &  path,
unsigned int  nbins 
)
static

Build BasisFunction from JSON value.

Parameters
jsonJSON value node.
pathPath for JSON path specification.
nbinsNumber of bins.
Returns
Pointer to new BasisFunction.

Definition at line 9 of file Basis.cpp.

References SSAGES::Chebyshev::Build(), SSAGES::Legendre::Build(), and SSAGES::Fourier::Build().

10  {
11  auto type = json.get("type","none").asString();
12  if(type == "Legendre")
13  return Legendre::Build(json, path, nbins);
14  else if (type == "Chebyshev")
15  return Chebyshev::Build(json, path, nbins);
16  else if (type == "Fourier")
17  return Fourier::Build(json, path, nbins);
18  else
19  throw std::invalid_argument("Invalid basis set type \"" + type + "\".");
20  }
static Fourier * Build(const Json::Value &json, const std::string &path, unsigned int nbins)
Build BasisFunction from JSON value.
Definition: Basis.cpp:49
static Legendre * Build(const Json::Value &json, const std::string &path, unsigned int nbins)
Build BasisFunction from JSON value.
Definition: Basis.cpp:75
static Chebyshev * Build(const Json::Value &json, const std::string &path, unsigned int nbins)
Build BasisFunction from JSON value.
Definition: Basis.cpp:22

Here is the call graph for this function:

virtual double SSAGES::BasisFunction::EvalGrad ( double  val,
int  order 
)
inlinevirtual

Calculates the gradient of the basis function.

Parameters
valInput value for function.
orderOrder of the polynomial.
Returns
Gradient for function.

Reimplemented in SSAGES::Fourier, SSAGES::Legendre, and SSAGES::Chebyshev.

Definition at line 169 of file Basis.h.

169  {
170  UNUSED(val);
171  UNUSED(order);
172  return 0;
173  }
virtual double SSAGES::BasisFunction::Evaluate ( double  val,
int  order 
)
inlinevirtual

Calculates the output of the basis function.

Parameters
valInput value for function.
orderOrder of the polynomial.
Returns
Output value for function.

Reimplemented in SSAGES::Fourier, SSAGES::Legendre, and SSAGES::Chebyshev.

Definition at line 156 of file Basis.h.

156  {
157  UNUSED(val);
158  UNUSED(order);
159  return 0;
160  }
unsigned int SSAGES::BasisFunction::GetBins ( )
inline

Gets the number of bins for the discretization.

Returns
Number of bins.

Definition at line 105 of file Basis.h.

105 {return nbins_;}
unsigned int nbins_
Number of bins.
Definition: Basis.h:65
double SSAGES::BasisFunction::GetLower ( )
inline

Gets the lower bound on the CV.

Returns
Lower bound on CV.

Definition at line 117 of file Basis.h.

Referenced by SSAGES::BasisEvaluator::BasisInit().

117 {return boundLow_;}
double boundLow_
Lower bound on CV.
Definition: Basis.h:68

Here is the caller graph for this function:

virtual double SSAGES::BasisFunction::GetNorm ( int  order)
inlinevirtual

Gets the norm of the basis function.

Parameters
orderOrder of the polynomial.
Returns
Norm of a specific order of polynomial.

Reimplemented in SSAGES::Fourier, SSAGES::Legendre, and SSAGES::Chebyshev.

Definition at line 144 of file Basis.h.

144  {
145  UNUSED(order);
146  return 0;
147  }
unsigned int SSAGES::BasisFunction::GetOrder ( )
inline

Gets the order of the current polynomial.

Returns
Order of current polynomial.

Definition at line 99 of file Basis.h.

Referenced by SSAGES::BasisEvaluator::CoeffInit().

99 {return polyOrd_;}
unsigned int polyOrd_
Order of the polynomial.
Definition: Basis.h:64

Here is the caller graph for this function:

double SSAGES::BasisFunction::GetRange ( )
inline

Gets the magnitude of the range of bounds.

Returns
Magnitude of range of bounds on CV.

Definition at line 129 of file Basis.h.

130  {
131  if(isFinite_)
132  return boundUp_ - boundLow_;
133  // No infinitely bounded basis functions are included currently so this is going to return nothing for right now
134  else
135  return 0.0;
136  }
bool isFinite_
Flag for finite-range polynomials.
Definition: Basis.h:66
double boundUp_
Upper bound on CV.
Definition: Basis.h:69
double boundLow_
Lower bound on CV.
Definition: Basis.h:68
double SSAGES::BasisFunction::GetUpper ( )
inline

Gets the upper bound on the CV.

Returns
Upper bound on CV.

Definition at line 123 of file Basis.h.

123 {return boundUp_;}
double boundUp_
Upper bound on CV.
Definition: Basis.h:69
bool SSAGES::BasisFunction::GetZeroOrder ( )
inline

Gets the flag for constant-order polynomials.

Returns
Flag for constant-order polynomials.

Definition at line 111 of file Basis.h.

111 {return zeroOrder_;}
bool zeroOrder_
Flag for constant-order polynomials.
Definition: Basis.h:67
virtual double SSAGES::BasisFunction::Weight ( double  val)
inlinevirtual

Calculates the gradient of the basis function.

Parameters
valInput value for function.
Returns
Gradient of function.

Reimplemented in SSAGES::Chebyshev.

Definition at line 181 of file Basis.h.

181  {
182  UNUSED(val);
183  return 1;
184  }

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