# `Discrete2DFunction`¶

class Discrete2DFunction : public OpenMM::TabulatedFunction

This is a TabulatedFunction that computes a discrete two dimensional function f(x,y). To evaluate it, x and y are each rounded to the nearest integer and the table element with those indices is returned. If either index is outside the range [0, size), the result is undefined.

Public Functions

Discrete2DFunction(int xsize, int ysize, const std::vector<double> &values)

Create a Discrete2DFunction f(x,y) based on a set of tabulated values.

Parameters
• xsize – the number of table elements along the x direction

• ysize – the number of table elements along the y direction

• values – the tabulated values of the function f(x,y), ordered so that values[i+xsize*j] = f(i,j). This must be of length xsize*ysize.

void getFunctionParameters(int &xsize, int &ysize, std::vector<double> &values) const

Get the parameters for the tabulated function.

Parameters
• xsize[out] the number of table elements along the x direction

• ysize[out] the number of table elements along the y direction

• values[out] the tabulated values of the function f(x,y), ordered so that values[i+xsize*j] = f(i,j). This must be of length xsize*ysize.

void setFunctionParameters(int xsize, int ysize, const std::vector<double> &values)

Set the parameters for the tabulated function.

Parameters
• xsize – the number of table elements along the x direction

• ysize – the number of table elements along the y direction

• values – the tabulated values of the function f(x,y), ordered so that values[i+xsize*j] = f(i,j). This must be of length xsize*ysize.

virtual Discrete2DFunction *Copy() const

Create a deep copy of the tabulated function

Deprecated:

This will be removed in a future release.