SSAGES  0.8.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.
 
unsigned int GetBins ()
 Gets the number of bins for the discretization.
 
bool GetZeroOrder ()
 Gets the flag for constant-order polynomials.
 
double GetLower ()
 Gets the lower bound on the CV.
 
double GetUpper ()
 Gets the upper bound on the CV.
 
double GetRange ()
 Gets the magnitude of the range of bounds.
 
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

◆ 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 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

◆ 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.

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 the Fourier polynomial.
Definition: Basis.cpp:49
static Legendre * Build(const Json::Value &json, const std::string &path, unsigned int nbins)
Build the Legendre polynomial.
Definition: Basis.cpp:75
static Chebyshev * Build(const Json::Value &json, const std::string &path, unsigned int nbins)
Build the Chebyshev polynomial.
Definition: Basis.cpp:22
Here is the call graph for this function:

◆ EvalGrad()

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

151  {
152  UNUSED(val);
153  UNUSED(order);
154  return 0;
155  }

◆ Evaluate()

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

138  {
139  UNUSED(val);
140  UNUSED(order);
141  return 0;
142  }

◆ GetNorm()

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

126  {
127  UNUSED(order);
128  return 0;
129  }

◆ Weight()

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

163  {
164  UNUSED(val);
165  return 1;
166  }

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