BubbleProfiler  0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
restricted_quartic_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_RESTRICTED_QUARTIC_POTENTIAL_HPP_INCLUDED
19 #define BUBBLEPROFILER_RESTRICTED_QUARTIC_POTENTIAL_HPP_INCLUDED
20 
21 #include "potential.hpp"
22 
23 #include <Eigen/Core>
24 
25 namespace BubbleProfiler {
26 
28 public:
29  Restricted_quartic_potential() = default;
30  explicit Restricted_quartic_potential(double);
31  Restricted_quartic_potential(double, double);
32  virtual ~Restricted_quartic_potential() = default;
37 
38  virtual Restricted_quartic_potential * clone() const override {
39  return new Restricted_quartic_potential(*this);
40  }
41 
42  virtual double operator()(const Eigen::VectorXd&) const override;
43  virtual double partial(const Eigen::VectorXd&, int) const override;
44  virtual double partial(const Eigen::VectorXd&, int, int) const override;
45 
46  virtual std::size_t get_number_of_fields() const override { return 1; }
47 
48  virtual void translate_origin(const Eigen::VectorXd &translation) override {
49  origin += translation(0);
50  }
51 
52  virtual void apply_basis_change(const Eigen::MatrixXd& cob_matrix) override {
53  scale *= cob_matrix(0,0);
54  }
55 
56  virtual void add_constant_term(double _offset) override {
57  offset += _offset;
58  }
59 
60  double operator()(double) const;
61  double first_deriv(double) const;
62  double second_deriv(double) const;
63 
64  double get_global_minimum_location() const;
65  double get_local_minimum_location() const;
66  double get_local_maximum_location() const;
67 
68 private:
69  double alpha{0.6};
70  double E{1.};
71  double origin{0.};
72  double scale{1.};
73  double offset{0.};
74 };
75 
76 } // namespace BubbleProfiler
77 
78 #endif
Restricted_quartic_potential & operator=(const Restricted_quartic_potential &)=default
virtual double operator()(const Eigen::VectorXd &) const override
Evaluate potential at point.
virtual std::size_t get_number_of_fields() const override
virtual void apply_basis_change(const Eigen::MatrixXd &cob_matrix) override
Apply a change of basis matrix.
virtual double partial(const Eigen::VectorXd &, int) const override
Partial derivative WRT coordinate i at a point.
virtual void add_constant_term(double _offset) override
Add a constant offset to the potential.
virtual void translate_origin(const Eigen::VectorXd &translation) override
Shift the location of the origin by a specified vector.
virtual Restricted_quartic_potential * clone() const override
Subclasses must implement a clone method.
Abstract base class for a generic potential.
Definition: potential.hpp:36