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