All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
PLMD::Grid Class Reference

#include <Grid.h>

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

Public Member Functions

virtual void clear ()
 clear grid More...
 
 Grid (const std::string &funcl, 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, bool doclear=true)
 this constructor here is Value-aware More...
 
 Grid (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, bool doclear, 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...
 
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, bool doclear, const std::vector< bool > &isperiodic, const std::vector< std::string > &pmin, const std::vector< std::string > &pmax)
 this is the real initializator More...
 
std::vector< std::string > getMin () const
 get lower boundary More...
 
std::vector< std::string > getMax () const
 get upper boundary More...
 
std::vector< double > getDx () const
 get bin size More...
 
double getBinVolume () const
 get bin volume More...
 
std::vector< unsigned > getNbin () const
 get number of bins More...
 
std::vector< bool > getIsPeriodic () const
 get if periodic More...
 
unsigned getDimension () const
 get grid dimension More...
 
std::vector< std::string > getArgNames () const
 get argument names of this grid More...
 
std::vector< unsigned > getIndices (unsigned index) const
 methods to handle grid indices More...
 
std::vector< unsigned > getIndices (const std::vector< double > &x) const
 
unsigned getIndex (const std::vector< unsigned > &indices) const
 
unsigned getIndex (const std::vector< double > &x) const
 
std::vector< double > getPoint (unsigned index) const
 
std::vector< double > getPoint (const std::vector< unsigned > &indices) const
 
std::vector< double > getPoint (const std::vector< double > &x) const
 
void getPoint (unsigned index, std::vector< double > &point) const
 faster versions relying on preallocated vectors More...
 
void getPoint (const std::vector< unsigned > &indices, std::vector< double > &point) const
 
void getPoint (const std::vector< double > &x, std::vector< double > &point) const
 
std::vector< unsigned > getNeighbors (unsigned index, const std::vector< unsigned > &neigh) const
 get neighbors More...
 
std::vector< unsigned > getNeighbors (const std::vector< unsigned > &indices, const std::vector< unsigned > &neigh) const
 
std::vector< unsigned > getNeighbors (const std::vector< double > &x, const std::vector< unsigned > &neigh) const
 
void writeHeader (OFile &file)
 write header for grid file More...
 
virtual unsigned getSize () const
 get grid size More...
 
virtual double getValue (unsigned index) const
 get grid value More...
 
virtual double getValue (const std::vector< unsigned > &indices) const
 
virtual double getValue (const std::vector< double > &x) const
 
virtual double getMinValue () const
 get minimum value More...
 
virtual double getMaxValue () const
 get maximum value More...
 
virtual double getValueAndDerivatives (unsigned index, std::vector< double > &der) const
 get grid value and derivatives More...
 
virtual double getValueAndDerivatives (const std::vector< unsigned > &indices, std::vector< double > &der) const
 
virtual double getValueAndDerivatives (const std::vector< double > &x, std::vector< double > &der) const
 
virtual void setValue (unsigned index, double value)
 set grid value More...
 
virtual void setValue (const std::vector< unsigned > &indices, double value)
 
virtual void setValueAndDerivatives (unsigned index, double value, std::vector< double > &der)
 set grid value and derivatives More...
 
virtual void setValueAndDerivatives (const std::vector< unsigned > &indices, double value, std::vector< double > &der)
 
virtual void addValue (unsigned index, double value)
 add to grid value More...
 
virtual void addValue (const std::vector< unsigned > &indices, double value)
 
virtual void addValueAndDerivatives (unsigned index, double value, std::vector< double > &der)
 add to grid value and derivatives More...
 
virtual void addValueAndDerivatives (const std::vector< unsigned > &indices, double value, std::vector< double > &der)
 
virtual void scaleAllValuesAndDerivatives (const double &scalef)
 Scale all grid values and derivatives by a constant factor. More...
 
virtual void applyFunctionAllValuesAndDerivatives (double(*func)(double val), double(*funcder)(double valder))
 apply function: takes pointer to function that accepts a double and apply More...
 
void addKernel (const KernelFunctions &kernel)
 add a kernel function to the grid More...
 
virtual void writeToFile (OFile &)
 dump grid on file More...
 
virtual ~Grid ()
 
Grid project (const std::vector< std::string > &proj, WeightBase *ptr2obj)
 project a high dimensional grid onto a low dimensional one: this should be changed at some time to enable many types of weighting More...
 
void projectOnLowDimension (double &val, std::vector< int > &varHigh, WeightBase *ptr2obj)
 
void setOutputFmt (std::string ss)
 set output format More...
 

Static Public Member Functions

static Gridcreate (const std::string &, std::vector< Value * >, IFile &, bool, bool, bool)
 read grid from file More...
 
static Gridcreate (const std::string &, 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...
 

Protected Member Functions

std::vector< unsigned > getSplineNeighbors (const std::vector< unsigned > &indices) const
 get "neighbors" for spline More...
 

Protected Attributes

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

Private Attributes

std::vector< double > grid_
 
std::vector< std::vector
< double > > 
der_
 

Detailed Description

Definition at line 69 of file Grid.h.

Constructor & Destructor Documentation

PLMD::Grid::Grid ( const std::string &  funcl,
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,
bool  doclear = true 
)

this constructor here is Value-aware

Definition at line 39 of file Grid.cpp.

PLMD::Grid::Grid ( 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,
bool  doclear,
const std::vector< bool > &  isperiodic,
const std::vector< std::string > &  pmin,
const std::vector< std::string > &  pmax 
)

this constructor here is not Value-aware

Definition at line 68 of file Grid.cpp.

virtual PLMD::Grid::~Grid ( )
inlinevirtual

Definition at line 184 of file Grid.h.

Member Function Documentation

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

add a kernel function to the grid

Definition at line 325 of file Grid.cpp.

void PLMD::Grid::addValue ( unsigned  index,
double  value 
)
virtual

add to grid value

Reimplemented in PLMD::SparseGrid.

Definition at line 479 of file Grid.cpp.

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

Definition at line 484 of file Grid.cpp.

void PLMD::Grid::addValueAndDerivatives ( unsigned  index,
double  value,
std::vector< double > &  der 
)
virtual

add to grid value and derivatives

Reimplemented in PLMD::SparseGrid.

Definition at line 489 of file Grid.cpp.

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

Definition at line 496 of file Grid.cpp.

void PLMD::Grid::applyFunctionAllValuesAndDerivatives ( double(*)(double val)  func,
double(*)(double valder)  funcder 
)
virtual

apply function: takes pointer to function that accepts a double and apply

Definition at line 511 of file Grid.cpp.

void PLMD::Grid::clear ( )
virtual

clear grid

Reimplemented in PLMD::SparseGrid.

Definition at line 116 of file Grid.cpp.

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

read grid from file

Definition at line 573 of file Grid.cpp.

Grid * PLMD::Grid::create ( const std::string &  funcl,
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

Definition at line 555 of file Grid.cpp.

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

get argument names of this grid

Definition at line 154 of file Grid.cpp.

double PLMD::Grid::getBinVolume ( ) const

get bin volume

Definition at line 140 of file Grid.cpp.

unsigned PLMD::Grid::getDimension ( ) const

get grid dimension

Definition at line 163 of file Grid.cpp.

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

get bin size

Definition at line 136 of file Grid.cpp.

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

Definition at line 168 of file Grid.cpp.

unsigned PLMD::Grid::getIndex ( const std::vector< double > &  x) const

Definition at line 184 of file Grid.cpp.

vector< unsigned > PLMD::Grid::getIndices ( unsigned  index) const

methods to handle grid indices

Definition at line 190 of file Grid.cpp.

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

Definition at line 204 of file Grid.cpp.

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

get if periodic

Definition at line 146 of file Grid.cpp.

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

get upper boundary

Definition at line 132 of file Grid.cpp.

double PLMD::Grid::getMaxValue ( ) const
virtual

get maximum value

Definition at line 369 of file Grid.cpp.

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

get lower boundary

Definition at line 128 of file Grid.cpp.

double PLMD::Grid::getMinValue ( ) const
virtual

get minimum value

Definition at line 360 of file Grid.cpp.

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

get number of bins

Definition at line 150 of file Grid.cpp.

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

get neighbors

Definition at line 300 of file Grid.cpp.

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

Definition at line 252 of file Grid.cpp.

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

Definition at line 294 of file Grid.cpp.

vector< double > PLMD::Grid::getPoint ( unsigned  index) const

Definition at line 222 of file Grid.cpp.

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

Definition at line 213 of file Grid.cpp.

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

Definition at line 227 of file Grid.cpp.

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

faster versions relying on preallocated vectors

Definition at line 232 of file Grid.cpp.

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

Definition at line 237 of file Grid.cpp.

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

Definition at line 245 of file Grid.cpp.

unsigned PLMD::Grid::getSize ( ) const
virtual

get grid size

Reimplemented in PLMD::SparseGrid.

Definition at line 159 of file Grid.cpp.

vector< unsigned > PLMD::Grid::getSplineNeighbors ( const std::vector< unsigned > &  indices) const
protected

get "neighbors" for spline

Definition at line 305 of file Grid.cpp.

double PLMD::Grid::getValue ( unsigned  index) const
virtual

get grid value

Reimplemented in PLMD::SparseGrid.

Definition at line 355 of file Grid.cpp.

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

Definition at line 381 of file Grid.cpp.

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

Definition at line 385 of file Grid.cpp.

double PLMD::Grid::getValueAndDerivatives ( unsigned  index,
std::vector< double > &  der 
) const
virtual

get grid value and derivatives

Reimplemented in PLMD::SparseGrid.

Definition at line 395 of file Grid.cpp.

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

Definition at line 402 of file Grid.cpp.

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

Definition at line 407 of file Grid.cpp.

void PLMD::Grid::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,
bool  doclear,
const std::vector< bool > &  isperiodic,
const std::vector< std::string > &  pmin,
const std::vector< std::string > &  pmax 
)

this is the real initializator

Definition at line 74 of file Grid.cpp.

Grid PLMD::Grid::project ( const std::vector< std::string > &  proj,
WeightBase ptr2obj 
)

project a high dimensional grid onto a low dimensional one: this should be changed at some time to enable many types of weighting

Definition at line 751 of file Grid.cpp.

void PLMD::Grid::projectOnLowDimension ( double &  val,
std::vector< int > &  varHigh,
WeightBase ptr2obj 
)

Definition at line 717 of file Grid.cpp.

void PLMD::Grid::scaleAllValuesAndDerivatives ( const double &  scalef)
virtual

Scale all grid values and derivatives by a constant factor.

Definition at line 500 of file Grid.cpp.

void PLMD::Grid::setOutputFmt ( std::string  ss)
inline

set output format

Definition at line 191 of file Grid.h.

void PLMD::Grid::setValue ( unsigned  index,
double  value 
)
virtual

set grid value

Reimplemented in PLMD::SparseGrid.

Definition at line 458 of file Grid.cpp.

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

Definition at line 463 of file Grid.cpp.

void PLMD::Grid::setValueAndDerivatives ( unsigned  index,
double  value,
std::vector< double > &  der 
)
virtual

set grid value and derivatives

Reimplemented in PLMD::SparseGrid.

Definition at line 468 of file Grid.cpp.

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

Definition at line 475 of file Grid.cpp.

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

write header for grid file

Definition at line 522 of file Grid.cpp.

void PLMD::Grid::writeToFile ( OFile ofile)
virtual

dump grid on file

Reimplemented in PLMD::SparseGrid.

Definition at line 531 of file Grid.cpp.

Member Data Documentation

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

Definition at line 75 of file Grid.h.

std::vector< std::vector<double> > PLMD::Grid::der_
private

Definition at line 72 of file Grid.h.

unsigned PLMD::Grid::dimension_
protected

Definition at line 80 of file Grid.h.

bool PLMD::Grid::dospline_
protected

Definition at line 81 of file Grid.h.

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

Definition at line 77 of file Grid.h.

std::string PLMD::Grid::fmt_
protected

Definition at line 82 of file Grid.h.

std::string PLMD::Grid::funcname
protected

Definition at line 74 of file Grid.h.

std::vector<double> PLMD::Grid::grid_
private

Definition at line 71 of file Grid.h.

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

Definition at line 77 of file Grid.h.

unsigned PLMD::Grid::maxsize_
protected

Definition at line 80 of file Grid.h.

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

Definition at line 77 of file Grid.h.

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

Definition at line 78 of file Grid.h.

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

Definition at line 79 of file Grid.h.

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

Definition at line 76 of file Grid.h.

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

Definition at line 76 of file Grid.h.

bool PLMD::Grid::usederiv_
protected

Definition at line 81 of file Grid.h.


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