BubbleProfiler
0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
|
Implements a multi dimensional scalar field potential, which may be expressed as almost any algerbraic fucntion. More...
#include <algebraic_potential.hpp>
Public Member Functions | |
Algebraic_potential (const std::vector< std::string > &fields, const std::string &expr) | |
Construct from list of fields and GiNaC potential string. More... | |
virtual | ~Algebraic_potential ()=default |
Algebraic_potential * | clone () const |
Get a fresh copy of this potential. More... | |
virtual double | operator() (const Eigen::VectorXd &coords) const override |
Evaluate potential at point. More... | |
virtual double | partial (const Eigen::VectorXd &coords, int i) const override |
Partial derivative WRT coordinate i at a point. More... | |
virtual double | partial (const Eigen::VectorXd &coords, int i, int j) const override |
Partial derivative WRT coordinates i, j at a a point. More... | |
virtual std::size_t | get_number_of_fields () const override |
virtual void | translate_origin (const Eigen::VectorXd &) override |
Shift the location of the origin by a specified vector. More... | |
virtual void | apply_basis_change (const Eigen::MatrixXd &) override |
Apply a change of basis matrix. More... | |
virtual void | add_constant_term (double) override |
Add a constant offset to the potential. More... | |
![]() | |
virtual | ~Potential ()=default |
Private Member Functions | |
double | eval (const GiNaC::ex &, const Eigen::VectorXd &) const |
void | build_derivatives () |
Private Attributes | |
std::vector< std::string > | fields {} |
GiNaC::ex | v {} |
GiNaC expression to hold potential. More... | |
std::vector< GiNaC::ex > | first_partials {} |
First partials. More... | |
std::vector< std::vector< GiNaC::ex > > | second_partials {} |
Second partials. More... | |
std::vector< GiNaC::symbol > | syms {} |
GiNaC symbols matched to fields vec. More... | |
logging::Basic_logger | logger {} |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Algebraic_potential &p) |
Implements a multi dimensional scalar field potential, which may be expressed as almost any algerbraic fucntion.
Given a vector of field names, and a GiNaCs expression specifying a scalar function of these fields, this class provides a an implementation of Potential suitable for calculating bubble profiles.
For the profiler to work correctly, the potential should be a fourth degree polynomial.
Definition at line 36 of file algebraic_potential.hpp.
BubbleProfiler::Algebraic_potential::Algebraic_potential | ( | const std::vector< std::string > & | fields, |
const std::string & | expr | ||
) |
Construct from list of fields and GiNaC potential string.
fields | vector of field names. These must match the fields in expr. |
expr | specification of potential in GiNaCs syntax. |
Note that the potential is expected to be a quartic multivariate polynomial in the specified fields.
Definition at line 26 of file algebraic_potential.cpp.
References build_derivatives(), BubbleProfiler::logging::Basic_logger::log_message(), logger, sm_plus_singlet::parser, syms, BubbleProfiler::logging::Trace, and v.
Referenced by clone().
|
virtualdefault |
|
overridevirtual |
Add a constant offset to the potential.
offset | constant term to add to potential |
Implements BubbleProfiler::Potential.
Definition at line 132 of file algebraic_potential.cpp.
References BubbleProfiler::logging::Basic_logger::log_message(), logger, BubbleProfiler::logging::Trace, and v.
Referenced by get_number_of_fields().
|
overridevirtual |
Apply a change of basis matrix.
cob_matrix |
Implements BubbleProfiler::Potential.
Definition at line 96 of file algebraic_potential.cpp.
References build_derivatives(), BubbleProfiler::logging::Basic_logger::log_message(), logger, syms, BubbleProfiler::logging::Trace, and v.
Referenced by get_number_of_fields().
|
private |
Definition at line 49 of file algebraic_potential.cpp.
References first_partials, second_partials, syms, and v.
Referenced by Algebraic_potential(), apply_basis_change(), and translate_origin().
|
inlinevirtual |
Get a fresh copy of this potential.
Implements BubbleProfiler::Potential.
Definition at line 52 of file algebraic_potential.hpp.
References Algebraic_potential(), operator()(), and partial().
|
private |
Definition at line 143 of file algebraic_potential.cpp.
References syms.
Referenced by operator()(), and partial().
|
inlineoverridevirtual |
Implements BubbleProfiler::Potential.
Definition at line 59 of file algebraic_potential.hpp.
References add_constant_term(), apply_basis_change(), and translate_origin().
Referenced by BubbleProfiler::run_perturbative_profiler(), and BubbleProfiler::run_shooting_profiler().
|
overridevirtual |
Evaluate potential at point.
coords | Coordinates at which to evaluate |
Implements BubbleProfiler::Potential.
Definition at line 166 of file algebraic_potential.cpp.
Referenced by clone().
|
overridevirtual |
Partial derivative WRT coordinate i at a point.
coords | Coordinates at which to evaluate |
i | Index of coordinate to be differentiated |
Implements BubbleProfiler::Potential.
Definition at line 172 of file algebraic_potential.cpp.
References eval(), and first_partials.
Referenced by clone().
|
overridevirtual |
Partial derivative WRT coordinates i, j at a a point.
coords | Coordinates at which to evaluate |
i | Index of first coordinate to be differentiated |
j | Index of second coordinate to be differentiated |
Implements BubbleProfiler::Potential.
Definition at line 178 of file algebraic_potential.cpp.
References eval(), and second_partials.
|
overridevirtual |
Shift the location of the origin by a specified vector.
translation | shift of origin |
Implements BubbleProfiler::Potential.
Definition at line 69 of file algebraic_potential.cpp.
References build_derivatives(), BubbleProfiler::logging::Basic_logger::log_message(), logger, syms, BubbleProfiler::logging::Trace, and v.
Referenced by get_number_of_fields().
|
friend |
Definition at line 67 of file algebraic_potential.hpp.
|
private |
Definition at line 74 of file algebraic_potential.hpp.
|
private |
First partials.
Definition at line 76 of file algebraic_potential.hpp.
Referenced by build_derivatives(), and partial().
|
private |
Definition at line 79 of file algebraic_potential.hpp.
Referenced by add_constant_term(), Algebraic_potential(), apply_basis_change(), and translate_origin().
|
private |
Second partials.
Definition at line 77 of file algebraic_potential.hpp.
Referenced by build_derivatives(), and partial().
|
private |
GiNaC symbols matched to fields vec.
Definition at line 78 of file algebraic_potential.hpp.
Referenced by Algebraic_potential(), apply_basis_change(), build_derivatives(), eval(), and translate_origin().
|
private |
GiNaC expression to hold potential.
Definition at line 75 of file algebraic_potential.hpp.
Referenced by add_constant_term(), Algebraic_potential(), apply_basis_change(), build_derivatives(), operator()(), and translate_origin().