BubbleProfiler  0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
BubbleProfiler::Algebraic_potential Class Reference

Implements a multi dimensional scalar field potential, which may be expressed as almost any algerbraic fucntion. More...

#include <algebraic_potential.hpp>

Inheritance diagram for BubbleProfiler::Algebraic_potential:
Inheritance graph
[legend]
Collaboration diagram for BubbleProfiler::Algebraic_potential:
Collaboration graph
[legend]

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_potentialclone () 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...
 
- Public Member Functions inherited from BubbleProfiler::Potential
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)
 

Detailed Description

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.

Constructor & Destructor Documentation

BubbleProfiler::Algebraic_potential::Algebraic_potential ( const std::vector< std::string > &  fields,
const std::string &  expr 
)

Construct from list of fields and GiNaC potential string.

Parameters
fieldsvector of field names. These must match the fields in expr.
exprspecification 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().

virtual BubbleProfiler::Algebraic_potential::~Algebraic_potential ( )
virtualdefault

Member Function Documentation

void BubbleProfiler::Algebraic_potential::add_constant_term ( double  offset)
overridevirtual

Add a constant offset to the potential.

Parameters
offsetconstant 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().

void BubbleProfiler::Algebraic_potential::apply_basis_change ( const Eigen::MatrixXd &  cob_matrix)
overridevirtual

Apply a change of basis matrix.

Parameters
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().

void BubbleProfiler::Algebraic_potential::build_derivatives ( )
private
Algebraic_potential* BubbleProfiler::Algebraic_potential::clone ( ) const
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().

double BubbleProfiler::Algebraic_potential::eval ( const GiNaC::ex &  expr,
const Eigen::VectorXd &  coords 
) const
private

Definition at line 143 of file algebraic_potential.cpp.

References syms.

Referenced by operator()(), and partial().

virtual std::size_t BubbleProfiler::Algebraic_potential::get_number_of_fields ( ) const
inlineoverridevirtual
double BubbleProfiler::Algebraic_potential::operator() ( const Eigen::VectorXd &  coords) const
overridevirtual

Evaluate potential at point.

Parameters
coordsCoordinates at which to evaluate
Returns
Value of potential at coordinates

Implements BubbleProfiler::Potential.

Definition at line 166 of file algebraic_potential.cpp.

References eval(), and v.

Referenced by clone().

double BubbleProfiler::Algebraic_potential::partial ( const Eigen::VectorXd &  coords,
int  i 
) const
overridevirtual

Partial derivative WRT coordinate i at a point.

Parameters
coordsCoordinates at which to evaluate
iIndex of coordinate to be differentiated
Returns
Value of specified partial at point

Implements BubbleProfiler::Potential.

Definition at line 172 of file algebraic_potential.cpp.

References eval(), and first_partials.

Referenced by clone().

double BubbleProfiler::Algebraic_potential::partial ( const Eigen::VectorXd &  coords,
int  i,
int  j 
) const
overridevirtual

Partial derivative WRT coordinates i, j at a a point.

Parameters
coordsCoordinates at which to evaluate
iIndex of first coordinate to be differentiated
jIndex of second coordinate to be differentiated
Returns
Value of specified partial at point

Implements BubbleProfiler::Potential.

Definition at line 178 of file algebraic_potential.cpp.

References eval(), and second_partials.

void BubbleProfiler::Algebraic_potential::translate_origin ( const Eigen::VectorXd &  translation)
overridevirtual

Shift the location of the origin by a specified vector.

Parameters
translationshift 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().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Algebraic_potential p 
)
friend

Definition at line 67 of file algebraic_potential.hpp.

Member Data Documentation

std::vector<std::string> BubbleProfiler::Algebraic_potential::fields {}
private

Definition at line 74 of file algebraic_potential.hpp.

std::vector<GiNaC::ex> BubbleProfiler::Algebraic_potential::first_partials {}
private

First partials.

Definition at line 76 of file algebraic_potential.hpp.

Referenced by build_derivatives(), and partial().

logging::Basic_logger BubbleProfiler::Algebraic_potential::logger {}
private
std::vector<std::vector<GiNaC::ex> > BubbleProfiler::Algebraic_potential::second_partials {}
private

Second partials.

Definition at line 77 of file algebraic_potential.hpp.

Referenced by build_derivatives(), and partial().

std::vector<GiNaC::symbol> BubbleProfiler::Algebraic_potential::syms {}
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().

GiNaC::ex BubbleProfiler::Algebraic_potential::v {}
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().


The documentation for this class was generated from the following files: