- Main Page
- Related Pages
- Classes
- Files

- File List

# TabulatedFunction.h

    00001 #ifndef OPENMM_TABULATEDFUNCTION_H_
    00002 #define OPENMM_TABULATEDFUNCTION_H_
    00003
    00004 /* -------------------------------------------------------------------------- *
    00005  *                                   OpenMM                                   *
    00006  * -------------------------------------------------------------------------- *
    00007  * This is part of the OpenMM molecular simulation toolkit originating from   *
    00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
    00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
    00010  * Medical Research, grant U54 GM072970. See https://simtk.org.               *
    00011  *                                                                            *
    00012  * Portions copyright (c) 2014 Stanford University and the Authors.           *
    00013  * Authors: Peter Eastman                                                     *
    00014  * Contributors:                                                              *
    00015  *                                                                            *
    00016  * Permission is hereby granted, free of charge, to any person obtaining a    *
    00017  * copy of this software and associated documentation files (the "Software"), *
    00018  * to deal in the Software without restriction, including without limitation  *
    00019  * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
    00020  * and/or sell copies of the Software, and to permit persons to whom the      *
    00021  * Software is furnished to do so, subject to the following conditions:       *
    00022  *                                                                            *
    00023  * The above copyright notice and this permission notice shall be included in *
    00024  * all copies or substantial portions of the Software.                        *
    00025  *                                                                            *
    00026  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
    00027  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
    00028  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
    00029  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
    00030  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
    00031  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
    00032  * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
    00033  * -------------------------------------------------------------------------- */
    00034
    00035 #include "internal/windowsExport.h"
    00036 #include <vector>
    00037
    00038 namespace OpenMM {
    00039
    00058 class OPENMM_EXPORT TabulatedFunction {
    00059 public:
    00060     virtual ~TabulatedFunction() {
    00061     }
    00062     virtual TabulatedFunction* Copy() const = 0;
    00063 };
    00064
    00068 class OPENMM_EXPORT Continuous1DFunction : public TabulatedFunction {
    00069 public:
    00079     Continuous1DFunction(const std::vector<double>& values, double min, double max);
    00089     void getFunctionParameters(std::vector<double>& values, double& min, double& max) const;
    00099     void setFunctionParameters(const std::vector<double>& values, double min, double max);
    00103     Continuous1DFunction* Copy() const;
    00104 private:
    00105     std::vector<double> values;
    00106     double min, max;
    00107 };
    00108
    00112 class OPENMM_EXPORT Continuous2DFunction : public TabulatedFunction {
    00113 public:
    00128     Continuous2DFunction(int xsize, int ysize, const std::vector<double>& values, double xmin, double xmax, double ymin, double ymax);
    00143     void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values, double& xmin, double& xmax, double& ymin, double& ymax) const;
    00158     void setFunctionParameters(int xsize, int ysize, const std::vector<double>& values, double xmin, double xmax, double ymin, double ymax);
    00162     Continuous2DFunction* Copy() const;
    00163 private:
    00164     std::vector<double> values;
    00165     int xsize, ysize;
    00166     double xmin, xmax, ymin, ymax;
    00167 };
    00168
    00172 class OPENMM_EXPORT Continuous3DFunction : public TabulatedFunction {
    00173 public:
    00193     Continuous3DFunction(int xsize, int ysize, int zsize, const std::vector<double>& values, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
    00213     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;
    00233     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);
    00237     Continuous3DFunction* Copy() const;
    00238 private:
    00239     std::vector<double> values;
    00240     int xsize, ysize, zsize;
    00241     double xmin, xmax, ymin, ymax, zmin, zmax;
    00242 };
    00243
    00249 class OPENMM_EXPORT Discrete1DFunction : public TabulatedFunction {
    00250 public:
    00256     Discrete1DFunction(const std::vector<double>& values);
    00262     void getFunctionParameters(std::vector<double>& values) const;
    00268     void setFunctionParameters(const std::vector<double>& values);
    00272     Discrete1DFunction* Copy() const;
    00273 private:
    00274     std::vector<double> values;
    00275 };
    00276
    00282 class OPENMM_EXPORT Discrete2DFunction : public TabulatedFunction {
    00283 public:
    00292     Discrete2DFunction(int xsize, int ysize, const std::vector<double>& values);
    00301     void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values) const;
    00310     void setFunctionParameters(int xsize, int ysize, const std::vector<double>& values);
    00314     Discrete2DFunction* Copy() const;
    00315 private:
    00316     int xsize, ysize;
    00317     std::vector<double> values;
    00318 };
    00319
    00325 class OPENMM_EXPORT Discrete3DFunction : public TabulatedFunction {
    00326 public:
    00336     Discrete3DFunction(int xsize, int ysize, int zsize, const std::vector<double>& values);
    00346     void getFunctionParameters(int& xsize, int& ysize, int& zsize, std::vector<double>& values) const;
    00356     void setFunctionParameters(int xsize, int ysize, int zsize, const std::vector<double>& values);
    00360     Discrete3DFunction* Copy() const;
    00361 private:
    00362     int xsize, ysize, zsize;
    00363     std::vector<double> values;
    00364 };
    00365
    00366 } // namespace OpenMM
    00367
    00368 #endif /*OPENMM_TABULATEDFUNCTION_H_*/