OpenMM
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
TabulatedFunction.h
1 #ifndef OPENMM_TABULATEDFUNCTION_H_
2 #define OPENMM_TABULATEDFUNCTION_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * OpenMM *
6  * -------------------------------------------------------------------------- *
7  * This is part of the OpenMM molecular simulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org. *
11  * *
12  * Portions copyright (c) 2014 Stanford University and the Authors. *
13  * Authors: Peter Eastman *
14  * Contributors: *
15  * *
16  * Permission is hereby granted, free of charge, to any person obtaining a *
17  * copy of this software and associated documentation files (the "Software"), *
18  * to deal in the Software without restriction, including without limitation *
19  * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
20  * and/or sell copies of the Software, and to permit persons to whom the *
21  * Software is furnished to do so, subject to the following conditions: *
22  * *
23  * The above copyright notice and this permission notice shall be included in *
24  * all copies or substantial portions of the Software. *
25  * *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
27  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
28  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
29  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
30  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
31  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
32  * USE OR OTHER DEALINGS IN THE SOFTWARE. *
33  * -------------------------------------------------------------------------- */
34 
35 #include "internal/windowsExport.h"
36 #include <vector>
37 
38 namespace OpenMM {
39 
58 class OPENMM_EXPORT TabulatedFunction {
59 public:
60  virtual ~TabulatedFunction() {
61  }
62  virtual TabulatedFunction* Copy() const = 0;
63 };
64 
68 class OPENMM_EXPORT Continuous1DFunction : public TabulatedFunction {
69 public:
79  Continuous1DFunction(const std::vector<double>& values, double min, double max);
89  void getFunctionParameters(std::vector<double>& values, double& min, double& max) const;
99  void setFunctionParameters(const std::vector<double>& values, double min, double max);
103  Continuous1DFunction* Copy() const;
104 private:
105  std::vector<double> values;
106  double min, max;
107 };
108 
112 class OPENMM_EXPORT Continuous2DFunction : public TabulatedFunction {
113 public:
128  Continuous2DFunction(int xsize, int ysize, const std::vector<double>& values, double xmin, double xmax, double ymin, double ymax);
143  void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values, double& xmin, double& xmax, double& ymin, double& ymax) const;
158  void setFunctionParameters(int xsize, int ysize, const std::vector<double>& values, double xmin, double xmax, double ymin, double ymax);
162  Continuous2DFunction* Copy() const;
163 private:
164  std::vector<double> values;
165  int xsize, ysize;
166  double xmin, xmax, ymin, ymax;
167 };
168 
172 class OPENMM_EXPORT Continuous3DFunction : public TabulatedFunction {
173 public:
193  Continuous3DFunction(int xsize, int ysize, int zsize, const std::vector<double>& values, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
213  void getFunctionParameters(int& xsize, int& ysize, int& zsize, std::vector<double>& values, double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax) const;
233  void setFunctionParameters(int xsize, int ysize, int zsize, const std::vector<double>& values, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
237  Continuous3DFunction* Copy() const;
238 private:
239  std::vector<double> values;
240  int xsize, ysize, zsize;
241  double xmin, xmax, ymin, ymax, zmin, zmax;
242 };
243 
249 class OPENMM_EXPORT Discrete1DFunction : public TabulatedFunction {
250 public:
256  Discrete1DFunction(const std::vector<double>& values);
262  void getFunctionParameters(std::vector<double>& values) const;
268  void setFunctionParameters(const std::vector<double>& values);
272  Discrete1DFunction* Copy() const;
273 private:
274  std::vector<double> values;
275 };
276 
282 class OPENMM_EXPORT Discrete2DFunction : public TabulatedFunction {
283 public:
292  Discrete2DFunction(int xsize, int ysize, const std::vector<double>& values);
301  void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values) const;
310  void setFunctionParameters(int xsize, int ysize, const std::vector<double>& values);
314  Discrete2DFunction* Copy() const;
315 private:
316  int xsize, ysize;
317  std::vector<double> values;
318 };
319 
325 class OPENMM_EXPORT Discrete3DFunction : public TabulatedFunction {
326 public:
336  Discrete3DFunction(int xsize, int ysize, int zsize, const std::vector<double>& values);
346  void getFunctionParameters(int& xsize, int& ysize, int& zsize, std::vector<double>& values) const;
356  void setFunctionParameters(int xsize, int ysize, int zsize, const std::vector<double>& values);
360  Discrete3DFunction* Copy() const;
361 private:
362  int xsize, ysize, zsize;
363  std::vector<double> values;
364 };
365 
366 } // namespace OpenMM
367 
368 #endif /*OPENMM_TABULATEDFUNCTION_H_*/
A TabulatedFunction uses a set of tabulated values to define a mathematical function.
Definition: TabulatedFunction.h:58
This is a TabulatedFunction that computes a discrete three dimensional function f(x,y,z).
Definition: TabulatedFunction.h:325
This is a TabulatedFunction that computes a discrete two dimensional function f(x,y).
Definition: TabulatedFunction.h:282
This is a TabulatedFunction that computes a discrete one dimensional function f(x).
Definition: TabulatedFunction.h:249
This is a TabulatedFunction that computes a continuous one dimensional function.
Definition: TabulatedFunction.h:68
This is a TabulatedFunction that computes a continuous two dimensional function.
Definition: TabulatedFunction.h:112
This is a TabulatedFunction that computes a continuous three dimensional function.
Definition: TabulatedFunction.h:172
virtual ~TabulatedFunction()
Definition: TabulatedFunction.h:60
Definition: AndersenThermostat.h:40