Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
PLMD::GridBase Class Referenceabstract

#include <Grid.h>

Inheritance diagram for PLMD::GridBase:
Inheritance graph
[legend]

Public Types

typedef size_t index_t
 

Public Member Functions

 GridBase (const std::string &funcl, const std::vector< std::string > &names, const std::vector< std::string > &gmin, const std::vector< std::string > &gmax, const std::vector< unsigned > &nbin, bool dospline, bool usederiv, const std::vector< bool > &isperiodic, const std::vector< std::string > &pmin, const std::vector< std::string > &pmax)
 this constructor here is not Value-aware More...
 
 GridBase (const std::string &funcl, const std::vector< Value * > &args, const std::vector< std::string > &gmin, const std::vector< std::string > &gmax, const std::vector< unsigned > &nbin, bool dospline, bool usederiv)
 this constructor here is Value-aware More...
 
virtual ~GridBase ()
 
void addKernel (const KernelFunctions &kernel)
 add a kernel function to the grid More...
 
void addValue (const std::vector< unsigned > &indices, double value)
 
virtual void addValue (index_t index, double value)=0
 add to grid value More...
 
void addValueAndDerivatives (const std::vector< unsigned > &indices, double value, std::vector< double > &der)
 
virtual void addValueAndDerivatives (index_t index, double value, std::vector< double > &der)=0
 add to grid value and derivatives More...
 
double findMaximalPathMinimum (const std::vector< double > &source, const std::vector< double > &sink)
 Find the maximum over paths of the minimum value of the gridded function along the paths for all paths of neighboring grid lattice points from a source point to a sink point. More...
 
std::vector< std::string > getArgNames () const
 get argument names of this grid More...
 
double getBinVolume () const
 get bin volume More...
 
unsigned getDimension () const
 get grid dimension More...
 
std::vector< double > getDx () const
 get bin size More...
 
double getDx (index_t j) const
 
index_t getIndex (const std::vector< double > &x) const
 
index_t getIndex (const std::vector< unsigned > &indices) const
 
std::vector< unsigned > getIndices (const std::vector< double > &x) const
 
void getIndices (const std::vector< double > &x, std::vector< unsigned > &rindex) const
 
std::vector< unsigned > getIndices (index_t index) const
 
void getIndices (index_t index, std::vector< unsigned > &rindex) const
 methods to handle grid indices More...
 
std::vector< bool > getIsPeriodic () const
 get if periodic More...
 
std::vector< std::string > getMax () const
 get upper boundary More...
 
virtual double getMaxValue () const =0
 get maximum value More...
 
std::vector< std::string > getMin () const
 get lower boundary More...
 
virtual double getMinValue () const =0
 get minimum value More...
 
std::vector< unsigned > getNbin () const
 get number of bins More...
 
std::vector< index_tgetNearestNeighbors (const index_t index) const
 get nearest neighbors (those separated by exactly one lattice unit) More...
 
std::vector< index_tgetNearestNeighbors (const std::vector< unsigned > &indices) const
 
std::vector< index_tgetNeighbors (const std::vector< double > &x, const std::vector< unsigned > &neigh) const
 
std::vector< index_tgetNeighbors (const std::vector< unsigned > &indices, const std::vector< unsigned > &neigh) const
 
std::vector< index_tgetNeighbors (index_t index, const std::vector< unsigned > &neigh) const
 get neighbors More...
 
std::vector< double > getPoint (const std::vector< double > &x) const
 
void getPoint (const std::vector< double > &x, std::vector< double > &point) const
 
std::vector< double > getPoint (const std::vector< unsigned > &indices) const
 
void getPoint (const std::vector< unsigned > &indices, std::vector< double > &point) const
 
std::vector< double > getPoint (index_t index) const
 
void getPoint (index_t index, std::vector< double > &point) const
 faster versions relying on preallocated vectors More...
 
virtual index_t getSize () const =0
 get grid size More...
 
double getValue (const std::vector< double > &x) const
 
double getValue (const std::vector< unsigned > &indices) const
 
virtual double getValue (index_t index) const =0
 get grid value More...
 
double getValueAndDerivatives (const std::vector< double > &x, std::vector< double > &der) const
 
double getValueAndDerivatives (const std::vector< unsigned > &indices, std::vector< double > &der) const
 
virtual double getValueAndDerivatives (index_t index, std::vector< double > &der) const =0
 get grid value and derivatives More...
 
bool hasDerivatives () const
 get if the grid has derivatives More...
 
void Init (const std::string &funcl, const std::vector< std::string > &names, const std::vector< std::string > &gmin, const std::vector< std::string > &gmax, const std::vector< unsigned > &nbin, bool dospline, bool usederiv, const std::vector< bool > &isperiodic, const std::vector< std::string > &pmin, const std::vector< std::string > &pmax)
 this is the real initializator More...
 
void resetToDefaultOutputFmt ()
 reset output format to the default %14.9f format More...
 
void setOutputFmt (const std::string &ss)
 set output format More...
 
void setValue (const std::vector< unsigned > &indices, double value)
 
virtual void setValue (index_t index, double value)=0
 set grid value More...
 
void setValueAndDerivatives (const std::vector< unsigned > &indices, double value, std::vector< double > &der)
 
virtual void setValueAndDerivatives (index_t index, double value, std::vector< double > &der)=0
 set grid value and derivatives More...
 
void writeCubeFile (OFile &, const double &lunit)
 dump grid to gaussian cube file More...
 
void writeHeader (OFile &file)
 write header for grid file More...
 
virtual void writeToFile (OFile &)=0
 dump grid on file More...
 

Static Public Member Functions

static std::unique_ptr< GridBasecreate (const std::string &, const std::vector< Value * > &, IFile &, bool, bool, bool)
 read grid from file More...
 
static std::unique_ptr< GridBasecreate (const std::string &, const std::vector< Value * > &, IFile &, const std::vector< std::string > &, const std::vector< std::string > &, const std::vector< unsigned > &, bool, bool, bool)
 read grid from file and check boundaries are what is expected from input More...
 

Static Public Attributes

static constexpr size_t maxdim =64
 Maximum dimension (exaggerated value). More...
 

Protected Member Functions

void getSplineNeighbors (const std::vector< unsigned > &indices, std::vector< index_t > &neigh, unsigned &nneigh) const
 get "neighbors" for spline More...
 

Protected Attributes

std::vector< std::string > argnames
 
unsigned dimension_
 
bool dospline_
 
std::vector< double > dx_
 
std::string fmt_
 
std::string funcname
 
std::vector< double > max_
 
index_t maxsize_
 
std::vector< double > min_
 
std::vector< unsigned > nbin_
 
std::vector< bool > pbc_
 
std::vector< std::string > str_max_
 
std::vector< std::string > str_min_
 
bool usederiv_
 

Member Typedef Documentation

◆ index_t

typedef size_t PLMD::GridBase::index_t

Constructor & Destructor Documentation

◆ GridBase() [1/2]

PLMD::GridBase::GridBase ( const std::string &  funcl,
const std::vector< Value * > &  args,
const std::vector< std::string > &  gmin,
const std::vector< std::string > &  gmax,
const std::vector< unsigned > &  nbin,
bool  dospline,
bool  usederiv 
)

this constructor here is Value-aware

◆ GridBase() [2/2]

PLMD::GridBase::GridBase ( const std::string &  funcl,
const std::vector< std::string > &  names,
const std::vector< std::string > &  gmin,
const std::vector< std::string > &  gmax,
const std::vector< unsigned > &  nbin,
bool  dospline,
bool  usederiv,
const std::vector< bool > &  isperiodic,
const std::vector< std::string > &  pmin,
const std::vector< std::string > &  pmax 
)

this constructor here is not Value-aware

◆ ~GridBase()

virtual PLMD::GridBase::~GridBase ( )
inlinevirtual

Member Function Documentation

◆ addKernel()

void PLMD::GridBase::addKernel ( const KernelFunctions kernel)

add a kernel function to the grid

◆ addValue() [1/2]

void PLMD::GridBase::addValue ( const std::vector< unsigned > &  indices,
double  value 
)

◆ addValue() [2/2]

virtual void PLMD::GridBase::addValue ( index_t  index,
double  value 
)
pure virtual

add to grid value

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ addValueAndDerivatives() [1/2]

void PLMD::GridBase::addValueAndDerivatives ( const std::vector< unsigned > &  indices,
double  value,
std::vector< double > &  der 
)

◆ addValueAndDerivatives() [2/2]

virtual void PLMD::GridBase::addValueAndDerivatives ( index_t  index,
double  value,
std::vector< double > &  der 
)
pure virtual

add to grid value and derivatives

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ create() [1/2]

std::unique_ptr< GridBase > PLMD::GridBase::create ( const std::string &  funcl,
const std::vector< Value * > &  args,
IFile ifile,
bool  dosparse,
bool  dospline,
bool  doder 
)
static

read grid from file

◆ create() [2/2]

std::unique_ptr< GridBase > PLMD::GridBase::create ( const std::string &  funcl,
const std::vector< Value * > &  args,
IFile ifile,
const std::vector< std::string > &  gmin,
const std::vector< std::string > &  gmax,
const std::vector< unsigned > &  nbin,
bool  dosparse,
bool  dospline,
bool  doder 
)
static

read grid from file and check boundaries are what is expected from input

◆ findMaximalPathMinimum()

double PLMD::GridBase::findMaximalPathMinimum ( const std::vector< double > &  source,
const std::vector< double > &  sink 
)

Find the maximum over paths of the minimum value of the gridded function along the paths for all paths of neighboring grid lattice points from a source point to a sink point.

◆ getArgNames()

vector< string > PLMD::GridBase::getArgNames ( ) const

get argument names of this grid

◆ getBinVolume()

double PLMD::GridBase::getBinVolume ( ) const

get bin volume

◆ getDimension()

unsigned PLMD::GridBase::getDimension ( ) const

get grid dimension

◆ getDx() [1/2]

vector< double > PLMD::GridBase::getDx ( ) const

get bin size

◆ getDx() [2/2]

double PLMD::GridBase::getDx ( index_t  j) const

◆ getIndex() [1/2]

GridBase::index_t PLMD::GridBase::getIndex ( const std::vector< double > &  x) const

◆ getIndex() [2/2]

GridBase::index_t PLMD::GridBase::getIndex ( const std::vector< unsigned > &  indices) const

◆ getIndices() [1/4]

vector< unsigned > PLMD::GridBase::getIndices ( const std::vector< double > &  x) const

◆ getIndices() [2/4]

void PLMD::GridBase::getIndices ( const std::vector< double > &  x,
std::vector< unsigned > &  rindex 
) const

◆ getIndices() [3/4]

vector< unsigned > PLMD::GridBase::getIndices ( index_t  index) const

◆ getIndices() [4/4]

void PLMD::GridBase::getIndices ( index_t  index,
std::vector< unsigned > &  rindex 
) const

methods to handle grid indices

◆ getIsPeriodic()

vector< bool > PLMD::GridBase::getIsPeriodic ( ) const

get if periodic

◆ getMax()

vector< std::string > PLMD::GridBase::getMax ( ) const

get upper boundary

◆ getMaxValue()

virtual double PLMD::GridBase::getMaxValue ( ) const
pure virtual

get maximum value

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ getMin()

vector< std::string > PLMD::GridBase::getMin ( ) const

get lower boundary

◆ getMinValue()

virtual double PLMD::GridBase::getMinValue ( ) const
pure virtual

get minimum value

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ getNbin()

vector< unsigned > PLMD::GridBase::getNbin ( ) const

get number of bins

◆ getNearestNeighbors() [1/2]

vector< GridBase::index_t > PLMD::GridBase::getNearestNeighbors ( const index_t  index) const

get nearest neighbors (those separated by exactly one lattice unit)

◆ getNearestNeighbors() [2/2]

vector< GridBase::index_t > PLMD::GridBase::getNearestNeighbors ( const std::vector< unsigned > &  indices) const

◆ getNeighbors() [1/3]

vector< GridBase::index_t > PLMD::GridBase::getNeighbors ( const std::vector< double > &  x,
const std::vector< unsigned > &  neigh 
) const

◆ getNeighbors() [2/3]

vector< GridBase::index_t > PLMD::GridBase::getNeighbors ( const std::vector< unsigned > &  indices,
const std::vector< unsigned > &  neigh 
) const

◆ getNeighbors() [3/3]

vector< GridBase::index_t > PLMD::GridBase::getNeighbors ( index_t  index,
const std::vector< unsigned > &  neigh 
) const

get neighbors

◆ getPoint() [1/6]

vector< double > PLMD::GridBase::getPoint ( const std::vector< double > &  x) const

◆ getPoint() [2/6]

void PLMD::GridBase::getPoint ( const std::vector< double > &  x,
std::vector< double > &  point 
) const

◆ getPoint() [3/6]

vector< double > PLMD::GridBase::getPoint ( const std::vector< unsigned > &  indices) const

◆ getPoint() [4/6]

void PLMD::GridBase::getPoint ( const std::vector< unsigned > &  indices,
std::vector< double > &  point 
) const

◆ getPoint() [5/6]

vector< double > PLMD::GridBase::getPoint ( index_t  index) const

◆ getPoint() [6/6]

void PLMD::GridBase::getPoint ( index_t  index,
std::vector< double > &  point 
) const

faster versions relying on preallocated vectors

◆ getSize()

virtual index_t PLMD::GridBase::getSize ( ) const
pure virtual

get grid size

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ getSplineNeighbors()

void PLMD::GridBase::getSplineNeighbors ( const std::vector< unsigned > &  indices,
std::vector< index_t > &  neigh,
unsigned &  nneigh 
) const
protected

get "neighbors" for spline

◆ getValue() [1/3]

double PLMD::GridBase::getValue ( const std::vector< double > &  x) const

◆ getValue() [2/3]

double PLMD::GridBase::getValue ( const std::vector< unsigned > &  indices) const

◆ getValue() [3/3]

virtual double PLMD::GridBase::getValue ( index_t  index) const
pure virtual

get grid value

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ getValueAndDerivatives() [1/3]

double PLMD::GridBase::getValueAndDerivatives ( const std::vector< double > &  x,
std::vector< double > &  der 
) const

◆ getValueAndDerivatives() [2/3]

double PLMD::GridBase::getValueAndDerivatives ( const std::vector< unsigned > &  indices,
std::vector< double > &  der 
) const

◆ getValueAndDerivatives() [3/3]

virtual double PLMD::GridBase::getValueAndDerivatives ( index_t  index,
std::vector< double > &  der 
) const
pure virtual

get grid value and derivatives

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ hasDerivatives()

bool PLMD::GridBase::hasDerivatives ( ) const
inline

get if the grid has derivatives

◆ Init()

void PLMD::GridBase::Init ( const std::string &  funcl,
const std::vector< std::string > &  names,
const std::vector< std::string > &  gmin,
const std::vector< std::string > &  gmax,
const std::vector< unsigned > &  nbin,
bool  dospline,
bool  usederiv,
const std::vector< bool > &  isperiodic,
const std::vector< std::string > &  pmin,
const std::vector< std::string > &  pmax 
)

this is the real initializator

◆ resetToDefaultOutputFmt()

void PLMD::GridBase::resetToDefaultOutputFmt ( )
inline

reset output format to the default %14.9f format

◆ setOutputFmt()

void PLMD::GridBase::setOutputFmt ( const std::string &  ss)
inline

set output format

◆ setValue() [1/2]

void PLMD::GridBase::setValue ( const std::vector< unsigned > &  indices,
double  value 
)

◆ setValue() [2/2]

virtual void PLMD::GridBase::setValue ( index_t  index,
double  value 
)
pure virtual

set grid value

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ setValueAndDerivatives() [1/2]

void PLMD::GridBase::setValueAndDerivatives ( const std::vector< unsigned > &  indices,
double  value,
std::vector< double > &  der 
)

◆ setValueAndDerivatives() [2/2]

virtual void PLMD::GridBase::setValueAndDerivatives ( index_t  index,
double  value,
std::vector< double > &  der 
)
pure virtual

set grid value and derivatives

Implemented in PLMD::SparseGrid, and PLMD::Grid.

◆ writeCubeFile()

void PLMD::GridBase::writeCubeFile ( OFile ofile,
const double &  lunit 
)

dump grid to gaussian cube file

◆ writeHeader()

void PLMD::GridBase::writeHeader ( OFile file)

write header for grid file

◆ writeToFile()

virtual void PLMD::GridBase::writeToFile ( OFile )
pure virtual

dump grid on file

Implemented in PLMD::SparseGrid, and PLMD::Grid.

Member Data Documentation

◆ argnames

std::vector<std::string> PLMD::GridBase::argnames
protected

◆ dimension_

unsigned PLMD::GridBase::dimension_
protected

◆ dospline_

bool PLMD::GridBase::dospline_
protected

◆ dx_

std::vector<double> PLMD::GridBase::dx_
protected

◆ fmt_

std::string PLMD::GridBase::fmt_
protected

◆ funcname

std::string PLMD::GridBase::funcname
protected

◆ max_

std::vector<double> PLMD::GridBase::max_
protected

◆ maxdim

constexpr size_t PLMD::GridBase::maxdim =64
staticconstexpr

Maximum dimension (exaggerated value).

Can be used to replace local std::vectors with std::arrays (allocated on stack).

◆ maxsize_

index_t PLMD::GridBase::maxsize_
protected

◆ min_

std::vector<double> PLMD::GridBase::min_
protected

◆ nbin_

std::vector<unsigned> PLMD::GridBase::nbin_
protected

◆ pbc_

std::vector<bool> PLMD::GridBase::pbc_
protected

◆ str_max_

std::vector<std::string> PLMD::GridBase::str_max_
protected

◆ str_min_

std::vector<std::string> PLMD::GridBase::str_min_
protected

◆ usederiv_

bool PLMD::GridBase::usederiv_
protected

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