#include <Grid.h>
Public Types | |
typedef std::size_t | index_t |
Public Member Functions | |
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, const std::vector< bool > &isperiodic, const std::vector< std::string > &pmin, const std::vector< std::string > &pmax) | |
this constructor here is not Value-aware | |
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) | |
void | addKernel (const KernelFunctions &kernel) |
add a kernel function to the grid | |
void | addValue (const std::vector< unsigned > &indices, double value) |
void | addValue (index_t index, double value) override |
add to grid value | |
void | addValueAndDerivatives (const std::vector< unsigned > &indices, double value, std::vector< double > &der) |
void | addValueAndDerivatives (index_t index, double value, std::vector< double > &der) override |
add to grid value and derivatives | |
void | applyFunctionAllValuesAndDerivatives (double(*func)(double val), double(*funcder)(double valder)) |
apply function: takes pointer to function that accepts a double and apply | |
void | clear () |
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. | |
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. | |
std::vector< std::string > | getArgNames () const |
get argument names of this grid | |
double | getBinVolume () const |
get bin volume | |
double | getDifferenceFromContour (const std::vector< double > &x, std::vector< double > &der) const |
Get the difference from the contour. | |
unsigned | getDimension () const |
get grid dimension | |
std::vector< double > | getDx () const |
get bin size | |
double | getDx (index_t j) const |
index_t | getIndex (const std::vector< double > &x) const |
index_t | getIndex (const std::vector< unsigned > &indices) const |
index_t | getIndex (const unsigned *indices, std::size_t indices_size) const |
std::vector< unsigned > | getIndices (const std::vector< double > &x) const |
void | getIndices (const std::vector< double > &x, std::vector< unsigned > &rindex) const |
void | getIndices (const std::vector< double > &x, unsigned *rindex_data, std::size_t rindex_size) const |
std::vector< unsigned > | getIndices (index_t index) const |
void | getIndices (index_t index, std::vector< unsigned > &rindex) const |
methods to handle grid indices | |
void | getIndices (index_t index, unsigned *rindex_data, std::size_t rindex_size) const |
std::vector< bool > | getIsPeriodic () const |
get if periodic | |
std::vector< std::string > | getMax () const |
get upper boundary | |
double | getMaxValue () const override |
get maximum value | |
std::vector< std::string > | getMin () const |
get lower boundary | |
double | getMinValue () const override |
get minimum value | |
std::vector< unsigned > | getNbin () const |
get number of bins | |
std::vector< index_t > | getNearestNeighbors (const index_t index) const |
get nearest neighbors (those separated by exactly one lattice unit) | |
std::vector< index_t > | getNearestNeighbors (const std::vector< unsigned > &indices) const |
std::vector< index_t > | getNeighbors (const std::vector< double > &x, const std::vector< unsigned > &neigh) const |
std::vector< index_t > | getNeighbors (const std::vector< unsigned > &indices, const std::vector< unsigned > &neigh) const |
std::vector< index_t > | getNeighbors (index_t index, const std::vector< unsigned > &neigh) const |
get neighbors | |
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 |
void | getPoint (const unsigned *indices_data, std::size_t indices_size, double *point, std::size_t point_size) const |
void | getPoint (const unsigned *indices_data, std::size_t indices_size, 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 | |
index_t | getSize () const override |
OVERRIDES ARE BELOW. | |
double | getValue (const std::vector< double > &x) const |
this is to access to Grid:: version of these methods (allowing overloading of virtual methods) | |
double | getValue (const std::vector< unsigned > &indices) const |
this is to access to Grid:: version of these methods (allowing overloading of virtual methods) | |
double | getValue (index_t index) const override |
get grid value | |
double | getValueAndDerivatives (const std::vector< double > &x, std::vector< double > &der) const |
double | getValueAndDerivatives (const std::vector< unsigned > &indices, std::vector< double > &der) const |
double | getValueAndDerivatives (index_t index, double *der, std::size_t der_size) const override |
get grid value and derivatives | |
double | getValueAndDerivatives (index_t index, std::vector< double > &der) const |
bool | hasDerivatives () const |
get if the grid has derivatives | |
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 | |
double | integrate (std::vector< unsigned > &npoints) |
Integrate the function calculated on the grid. | |
void | logAllValuesAndDerivatives (const double &scalef) |
Takes the scalef times the logarithm of all grid values and derivatives. | |
void | mpiSumValuesAndDerivatives (Communicator &comm) |
Grid | project (const std::vector< std::string > &proj, WeightBase *ptr2obj) |
Since this method returns a concrete Grid, it should be here and not in GridBase - GB project a high dimensional grid onto a low dimensional one: this should be changed at some time to enable many types of weighting. | |
void | projectOnLowDimension (double &val, std::vector< int > &varHigh, WeightBase *ptr2obj) |
void | resetToDefaultOutputFmt () |
reset output format to the default %14.9f format | |
void | scaleAllValuesAndDerivatives (const double &scalef) |
Scale all grid values and derivatives by a constant factor. | |
void | setMinToZero () |
Set the minimum value of the grid to zero and translates accordingly. | |
void | setOutputFmt (const std::string &ss) |
set output format | |
void | setValue (const std::vector< unsigned > &indices, double value) |
void | setValue (index_t index, double value) override |
set grid value | |
void | setValueAndDerivatives (const std::vector< unsigned > &indices, double value, std::vector< double > &der) |
void | setValueAndDerivatives (index_t index, double value, std::vector< double > &der) override |
set grid value and derivatives | |
void | writeCubeFile (OFile &, const double &lunit) |
dump grid to gaussian cube file | |
void | writeHeader (OFile &file) |
write header for grid file | |
void | writeToFile (OFile &) override |
dump grid on file | |
Static Public Member Functions | |
static std::unique_ptr< GridBase > | create (const std::string &, const std::vector< Value * > &, IFile &, bool, bool, bool) |
read grid from file | |
static std::unique_ptr< GridBase > | 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 | |
Static Public Attributes | |
static constexpr std::size_t | maxdim =16 |
Maximum dimension (exaggerated value). | |
Protected Member Functions | |
unsigned | getSplineNeighbors (const unsigned *indices, std::size_t indices_size, index_t *neighbors, std::size_t neighbors_size) const |
get "neighbors" for spline | |
Protected Attributes | |
AcceleratorHandler | accelerator |
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 =0.0 |
std::vector< double > | der_ |
std::vector< double > | grid_ |
|
inherited |
|
inline |
|
inline |
this constructor here is not Value-aware
|
inherited |
add a kernel function to the grid
void PLMD::GridBase::addValue | ( | const std::vector< unsigned > & | indices, |
double | value ) |
|
overridevirtual |
add to grid value
Implements PLMD::GridBase.
void PLMD::GridBase::addValueAndDerivatives | ( | const std::vector< unsigned > & | indices, |
double | value, | ||
std::vector< double > & | der ) |
|
overridevirtual |
add to grid value and derivatives
Implements PLMD::GridBase.
void PLMD::Grid::applyFunctionAllValuesAndDerivatives | ( | double(* | func )(double val), |
double(* | funcder )(double valder) ) |
apply function: takes pointer to function that accepts a double and apply
void PLMD::Grid::clear | ( | ) |
|
staticinherited |
read grid from file
|
staticinherited |
read grid from file and check boundaries are what is expected from input
|
inherited |
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.
|
inherited |
get argument names of this grid
|
inherited |
get bin volume
double PLMD::Grid::getDifferenceFromContour | ( | const std::vector< double > & | x, |
std::vector< double > & | der ) const |
Get the difference from the contour.
|
inherited |
get grid dimension
|
inherited |
get bin size
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
methods to handle grid indices
|
inlineinherited |
|
inherited |
get if periodic
|
inherited |
get upper boundary
|
overridevirtual |
get maximum value
Implements PLMD::GridBase.
|
inherited |
get lower boundary
|
overridevirtual |
get minimum value
Implements PLMD::GridBase.
|
inherited |
get number of bins
|
inherited |
get nearest neighbors (those separated by exactly one lattice unit)
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
get neighbors
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
faster versions relying on preallocated vectors
|
overridevirtual |
OVERRIDES ARE BELOW.
Implements PLMD::GridBase.
|
protectedinherited |
get "neighbors" for spline
double PLMD::GridBase::getValue | ( | const std::vector< double > & | x | ) | const |
this is to access to Grid:: version of these methods (allowing overloading of virtual methods)
double PLMD::GridBase::getValue | ( | const std::vector< unsigned > & | indices | ) | const |
this is to access to Grid:: version of these methods (allowing overloading of virtual methods)
|
overridevirtual |
get grid value
Implements PLMD::GridBase.
double PLMD::GridBase::getValueAndDerivatives | ( | const std::vector< double > & | x, |
std::vector< double > & | der ) const |
double PLMD::GridBase::getValueAndDerivatives | ( | const std::vector< unsigned > & | indices, |
std::vector< double > & | der ) const |
|
overridevirtual |
get grid value and derivatives
Implements PLMD::GridBase.
double PLMD::GridBase::getValueAndDerivatives | ( | index_t | index, |
std::vector< double > & | der ) const |
|
inlineinherited |
get if the grid has derivatives
|
inherited |
this is the real initializator
double PLMD::Grid::integrate | ( | std::vector< unsigned > & | npoints | ) |
Integrate the function calculated on the grid.
void PLMD::Grid::logAllValuesAndDerivatives | ( | const double & | scalef | ) |
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 ) |
void PLMD::Grid::projectOnLowDimension | ( | double & | val, |
std::vector< int > & | varHigh, | ||
WeightBase * | ptr2obj ) |
|
inlineinherited |
reset output format to the default %14.9f format
void PLMD::Grid::scaleAllValuesAndDerivatives | ( | const double & | scalef | ) |
Scale all grid values and derivatives by a constant factor.
void PLMD::Grid::setMinToZero | ( | ) |
Set the minimum value of the grid to zero and translates accordingly.
|
inlineinherited |
set output format
void PLMD::GridBase::setValue | ( | const std::vector< unsigned > & | indices, |
double | value ) |
|
overridevirtual |
set grid value
Implements PLMD::GridBase.
void PLMD::GridBase::setValueAndDerivatives | ( | const std::vector< unsigned > & | indices, |
double | value, | ||
std::vector< double > & | der ) |
|
overridevirtual |
set grid value and derivatives
Implements PLMD::GridBase.
|
inherited |
dump grid to gaussian cube file
|
inherited |
write header for grid file
|
overridevirtual |
dump grid on file
Implements PLMD::GridBase.
|
protectedinherited |
|
protectedinherited |
|
private |
|
private |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
private |
|
protectedinherited |
|
staticconstexprinherited |
Maximum dimension (exaggerated value).
Can be used to replace local std::vectors with std::arrays (allocated on stack).
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Hosted by GitHub
![]() |
![]() |