SSAGES  0.9.3
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)
 Gets the norm of the basis function. More...
 
virtual double Evaluate (double, int)
 Calculates the output of the basis function. More...
 
virtual double EvalGrad (double, int)
 Calculates the gradient of the basis function. More...
 
virtual double Weight (double)
 Calculates the weight 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 59 of file Basis.h.

Constructor & Destructor Documentation

◆ BasisFunction()

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 82 of file Basis.h.

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

Member Function Documentation

◆ Build()

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.

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 Chebyshev * Build(const Json::Value &json, const std::string &path, unsigned int nbins)
Build BasisFunction from JSON value.
Definition: Basis.cpp:22
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

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

Here is the call graph for this function:

◆ EvalGrad()

virtual double SSAGES::BasisFunction::EvalGrad ( double  ,
int   
)
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 164 of file Basis.h.

164  {
165  return 0;
166  }

◆ Evaluate()

virtual double SSAGES::BasisFunction::Evaluate ( double  ,
int   
)
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 153 of file Basis.h.

153  {
154  return 0;
155  }

◆ GetBins()

unsigned int SSAGES::BasisFunction::GetBins ( )
inline

Gets the number of bins for the discretization.

Returns
Number of bins.

Definition at line 103 of file Basis.h.

103 {return nbins_;}

References nbins_.

◆ GetLower()

double SSAGES::BasisFunction::GetLower ( )
inline

Gets the lower bound on the CV.

Returns
Lower bound on CV.

Definition at line 115 of file Basis.h.

115 {return boundLow_;}

References boundLow_.

◆ GetNorm()

virtual double SSAGES::BasisFunction::GetNorm ( int  )
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::Chebyshev, and SSAGES::Legendre.

Definition at line 142 of file Basis.h.

142  {
143  return 0;
144  }

◆ GetOrder()

unsigned int SSAGES::BasisFunction::GetOrder ( )
inline

Gets the order of the current polynomial.

Returns
Order of current polynomial.

Definition at line 97 of file Basis.h.

97 {return polyOrd_;}

References polyOrd_.

◆ GetRange()

double SSAGES::BasisFunction::GetRange ( )
inline

Gets the magnitude of the range of bounds.

Returns
Magnitude of range of bounds on CV.

Definition at line 127 of file Basis.h.

128  {
129  if(isFinite_)
130  return boundUp_ - boundLow_;
131  // No infinitely bounded basis functions are included currently so this is going to return nothing for right now
132  else
133  return 0.0;
134  }

References boundLow_, boundUp_, and isFinite_.

◆ GetUpper()

double SSAGES::BasisFunction::GetUpper ( )
inline

Gets the upper bound on the CV.

Returns
Upper bound on CV.

Definition at line 121 of file Basis.h.

121 {return boundUp_;}

References boundUp_.

◆ GetZeroOrder()

bool SSAGES::BasisFunction::GetZeroOrder ( )
inline

Gets the flag for constant-order polynomials.

Returns
Flag for constant-order polynomials.

Definition at line 109 of file Basis.h.

109 {return zeroOrder_;}

References zeroOrder_.

◆ Weight()

virtual double SSAGES::BasisFunction::Weight ( double  )
inlinevirtual

Calculates the weight of the basis function.

Parameters
valInput value for function.
Returns
Weight of function.

Reimplemented in SSAGES::Chebyshev.

Definition at line 174 of file Basis.h.

174  {
175  return 1;
176  }

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