#include <Grid.h>
Public Types | |
typedef size_t | index_t |
Public Member Functions | |
Grid (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, 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... | |
virtual | ~Grid () |
void | addKernel (const KernelFunctions &kernel) |
add a kernel function to the grid More... | |
virtual void | addValue (index_t index, double value) |
add to grid value More... | |
virtual void | addValue (const std::vector< unsigned > &indices, double value) |
virtual void | addValueAndDerivatives (index_t 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 | applyFunctionAllValuesAndDerivatives (double(*func)(double val), double(*funcder)(double valder)) |
apply function: takes pointer to function that accepts a double and apply More... | |
virtual void | clear () |
clear grid More... | |
virtual 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... | |
void | findSetOfPointsOnContour (const double &target, const std::vector< bool > &nosearch, unsigned &npoints, std::vector< std::vector< double > > &points) |
Find a set of points on a contour in the function. More... | |
std::vector< std::string > | getArgNames () const |
get argument names of this grid More... | |
double | getBinVolume () const |
get bin volume More... | |
double | getDifferenceFromContour (const std::vector< double > &x, std::vector< double > &der) const |
Get the difference from the contour. 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< unsigned > &indices) const |
index_t | getIndex (const std::vector< double > &x) const |
void | getIndices (index_t index, std::vector< unsigned > &rindex) const |
methods to handle grid indices More... | |
void | getIndices (const std::vector< double > &x, std::vector< unsigned > &rindex) const |
std::vector< unsigned > | getIndices (index_t index) const |
std::vector< unsigned > | getIndices (const std::vector< double > &x) const |
std::vector< bool > | getIsPeriodic () const |
get if periodic More... | |
std::vector< std::string > | getMax () const |
get upper boundary More... | |
virtual double | getMaxValue () const |
get maximum value More... | |
std::vector< std::string > | getMin () const |
get lower boundary More... | |
virtual double | getMinValue () const |
get minimum value More... | |
std::vector< unsigned > | getNbin () const |
get number of bins More... | |
std::vector< index_t > | getNearestNeighbors (const index_t index) const |
get nearest neighbors (those separated by exactly one lattice unit) More... | |
std::vector< index_t > | getNearestNeighbors (const std::vector< unsigned > &indices) const |
std::vector< index_t > | getNeighbors (index_t index, const std::vector< unsigned > &neigh) const |
get neighbors More... | |
std::vector< index_t > | getNeighbors (const std::vector< unsigned > &indices, const std::vector< unsigned > &neigh) const |
std::vector< index_t > | getNeighbors (const std::vector< double > &x, const std::vector< unsigned > &neigh) const |
std::vector< double > | getPoint (index_t index) const |
std::vector< double > | getPoint (const std::vector< unsigned > &indices) const |
std::vector< double > | getPoint (const std::vector< double > &x) const |
void | getPoint (index_t 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 |
virtual index_t | getSize () const |
get grid size More... | |
virtual double | getValue (index_t 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 | getValueAndDerivatives (index_t 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 |
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, 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... | |
double | integrate (std::vector< unsigned > &npoints) |
Integrate the function calculated on the grid. More... | |
virtual void | logAllValuesAndDerivatives (const double &scalef) |
Takes the scalef times the logarithm of all grid values and derivatives. More... | |
void | mpiSumValuesAndDerivatives (Communicator &comm) |
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 | resetToDefaultOutputFmt () |
reset output format to the default %14.9f format More... | |
virtual void | scaleAllValuesAndDerivatives (const double &scalef) |
Scale all grid values and derivatives by a constant factor. More... | |
virtual void | setMinToZero () |
Set the minimum value of the grid to zero and translates accordingly. More... | |
void | setOutputFmt (const std::string &ss) |
set output format More... | |
virtual void | setValue (index_t index, double value) |
set grid value More... | |
virtual void | setValue (const std::vector< unsigned > &indices, double value) |
virtual void | setValueAndDerivatives (index_t 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) |
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 &) |
dump grid on file More... | |
Static Public Member Functions | |
static std::unique_ptr< Grid > | create (const std::string &, const std::vector< Value *> &, IFile &, bool, bool, bool) |
read grid from file More... | |
static std::unique_ptr< Grid > | create (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_ |
Private Attributes | |
double | contour_location |
std::vector< std::vector< double > > | der_ |
std::vector< double > | grid_ |
typedef size_t PLMD::Grid::index_t |
PLMD::Grid::Grid | ( | 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, | ||
bool | doclear = true |
||
) |
this constructor here is Value-aware
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
|
inlinevirtual |
void PLMD::Grid::addKernel | ( | const KernelFunctions & | kernel | ) |
add a kernel function to the grid
|
virtual |
add to grid value
Reimplemented in PLMD::SparseGrid.
|
virtual |
|
virtual |
add to grid value and derivatives
Reimplemented in PLMD::SparseGrid.
|
virtual |
|
virtual |
apply function: takes pointer to function that accepts a double and apply
|
virtual |
clear grid
Reimplemented in PLMD::SparseGrid.
|
static |
read grid from file
|
static |
read grid from file and check boundaries are what is expected from input
|
virtual |
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.
void PLMD::Grid::findSetOfPointsOnContour | ( | const double & | target, |
const std::vector< bool > & | nosearch, | ||
unsigned & | npoints, | ||
std::vector< std::vector< double > > & | points | ||
) |
Find a set of points on a contour in the function.
vector< string > PLMD::Grid::getArgNames | ( | ) | const |
get argument names of this grid
double PLMD::Grid::getBinVolume | ( | ) | const |
get bin volume
double PLMD::Grid::getDifferenceFromContour | ( | const std::vector< double > & | x, |
std::vector< double > & | der | ||
) | const |
Get the difference from the contour.
unsigned PLMD::Grid::getDimension | ( | ) | const |
get grid dimension
vector< double > PLMD::Grid::getDx | ( | ) | const |
get bin size
double PLMD::Grid::getDx | ( | index_t | j | ) | const |
Grid::index_t PLMD::Grid::getIndex | ( | const std::vector< unsigned > & | indices | ) | const |
Grid::index_t PLMD::Grid::getIndex | ( | const std::vector< double > & | x | ) | const |
void PLMD::Grid::getIndices | ( | index_t | index, |
std::vector< unsigned > & | rindex | ||
) | const |
methods to handle grid indices
void PLMD::Grid::getIndices | ( | const std::vector< double > & | x, |
std::vector< unsigned > & | rindex | ||
) | const |
vector< unsigned > PLMD::Grid::getIndices | ( | index_t | index | ) | const |
vector< unsigned > PLMD::Grid::getIndices | ( | const std::vector< double > & | x | ) | const |
vector< bool > PLMD::Grid::getIsPeriodic | ( | ) | const |
get if periodic
vector< std::string > PLMD::Grid::getMax | ( | ) | const |
get upper boundary
|
virtual |
get maximum value
Reimplemented in PLMD::SparseGrid.
vector< std::string > PLMD::Grid::getMin | ( | ) | const |
get lower boundary
|
virtual |
get minimum value
Reimplemented in PLMD::SparseGrid.
vector< unsigned > PLMD::Grid::getNbin | ( | ) | const |
get number of bins
vector< Grid::index_t > PLMD::Grid::getNearestNeighbors | ( | const index_t | index | ) | const |
get nearest neighbors (those separated by exactly one lattice unit)
vector< Grid::index_t > PLMD::Grid::getNearestNeighbors | ( | const std::vector< unsigned > & | indices | ) | const |
vector< Grid::index_t > PLMD::Grid::getNeighbors | ( | index_t | index, |
const std::vector< unsigned > & | neigh | ||
) | const |
get neighbors
vector< Grid::index_t > PLMD::Grid::getNeighbors | ( | const std::vector< unsigned > & | indices, |
const std::vector< unsigned > & | neigh | ||
) | const |
vector< Grid::index_t > PLMD::Grid::getNeighbors | ( | const std::vector< double > & | x, |
const std::vector< unsigned > & | neigh | ||
) | const |
vector< double > PLMD::Grid::getPoint | ( | index_t | index | ) | const |
vector< double > PLMD::Grid::getPoint | ( | const std::vector< unsigned > & | indices | ) | const |
vector< double > PLMD::Grid::getPoint | ( | const std::vector< double > & | x | ) | const |
void PLMD::Grid::getPoint | ( | index_t | index, |
std::vector< double > & | point | ||
) | const |
faster versions relying on preallocated vectors
void PLMD::Grid::getPoint | ( | const std::vector< unsigned > & | indices, |
std::vector< double > & | point | ||
) | const |
void PLMD::Grid::getPoint | ( | const std::vector< double > & | x, |
std::vector< double > & | point | ||
) | const |
|
virtual |
get grid size
Reimplemented in PLMD::SparseGrid.
|
protected |
get "neighbors" for spline
|
virtual |
get grid value
Reimplemented in PLMD::SparseGrid.
|
virtual |
|
virtual |
|
virtual |
get grid value and derivatives
Reimplemented in PLMD::SparseGrid.
|
virtual |
|
virtual |
|
inline |
get if the grid has derivatives
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
double PLMD::Grid::integrate | ( | std::vector< unsigned > & | npoints | ) |
Integrate the function calculated on the grid.
|
virtual |
Takes the scalef times the logarithm of all grid values and derivatives.
void PLMD::Grid::mpiSumValuesAndDerivatives | ( | Communicator & | comm | ) |
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
void PLMD::Grid::projectOnLowDimension | ( | double & | val, |
std::vector< int > & | varHigh, | ||
WeightBase * | ptr2obj | ||
) |
|
inline |
reset output format to the default %14.9f format
|
virtual |
Scale all grid values and derivatives by a constant factor.
|
virtual |
Set the minimum value of the grid to zero and translates accordingly.
|
inline |
set output format
|
virtual |
set grid value
Reimplemented in PLMD::SparseGrid.
|
virtual |
|
virtual |
set grid value and derivatives
Reimplemented in PLMD::SparseGrid.
|
virtual |
void PLMD::Grid::writeCubeFile | ( | OFile & | ofile, |
const double & | lunit | ||
) |
dump grid to gaussian cube file
void PLMD::Grid::writeHeader | ( | OFile & | file | ) |
write header for grid file
|
virtual |
dump grid on file
Reimplemented in PLMD::SparseGrid.
|
protected |
|
private |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
static |
Maximum dimension (exaggerated value).
Can be used to replace local std::vectors with std::arrays (allocated on stack).
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Hosted by GitHub | 1.8.14 |