BubbleProfiler  0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
potential.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of BubbleProfiler.
3  *
4  * BubbleProfiler is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * BubbleProfiler is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with BubbleProfiler. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef BUBBLEPROFILER_POTENTIAL_HPP_INCLUDED
19 #define BUBBLEPROFILER_POTENTIAL_HPP_INCLUDED
20 
21 #include <cstddef>
22 
23 #include <Eigen/Core>
24 
25 namespace BubbleProfiler {
26 
28 
36 class Potential {
37 public:
38  virtual ~Potential() = default;
39 
41  virtual Potential * clone() const = 0;
42 
44 
48  virtual double operator()(const Eigen::VectorXd& coords) const = 0;
49 
51 
56  virtual double partial(const Eigen::VectorXd& coords, int i) const = 0;
57 
59 
65  virtual double partial(const Eigen::VectorXd& coords, int i, int j) const = 0;
66 
67  virtual std::size_t get_number_of_fields() const = 0;
68 
70 
73  virtual void translate_origin(const Eigen::VectorXd &translation) = 0;
74 
76 
79  virtual void apply_basis_change(const Eigen::MatrixXd& cob_matrix) = 0;
80 
82 
85  virtual void add_constant_term(double offset) = 0;
86 };
87 
88 } // namespace BubbleProfiler
89 
90 #endif
virtual ~Potential()=default
virtual void add_constant_term(double offset)=0
Add a constant offset to the potential.
virtual double partial(const Eigen::VectorXd &coords, int i) const =0
Partial derivative WRT coordinate i at a point.
virtual double operator()(const Eigen::VectorXd &coords) const =0
Evaluate potential at point.
virtual Potential * clone() const =0
Subclasses must implement a clone method.
virtual void apply_basis_change(const Eigen::MatrixXd &cob_matrix)=0
Apply a change of basis matrix.
virtual std::size_t get_number_of_fields() const =0
Abstract base class for a generic potential.
Definition: potential.hpp:36
virtual void translate_origin(const Eigen::VectorXd &translation)=0
Shift the location of the origin by a specified vector.