Cadabra
Computer algebra system for field theory problems
|
Class holding a collection of properties attached to expressions.
Symbols and expressions do not have a default meaning in Cadabra. They get their meaning by attaching properties to them. When the core manipulator calls an algorithm object, it passes an instance of the Properties class along with the expression tree on which to act, so that the algorithm can figure out what the symbols in the expression tree mean.
#include <Props.hh>
Classes | |
class | registered_property_map_t |
Public Types | |
typedef std::pair< pattern *, const property * > | pat_prop_pair_t |
typedef std::multimap < nset_t::iterator, pat_prop_pair_t, nset_it_less > | property_map_t |
We keep two multi-maps: one from the pattern to the property (roughly) and one from the property to the pattern. More... | |
typedef std::multimap< const property *, pattern * > | pattern_map_t |
Public Member Functions | |
void | register_property (property *(*)(), const std::string &name) |
Registering properties. More... | |
std::string | master_insert (Ex proptree, property *thepropbase) |
Register a property for the indicated Ex. More... | |
void | clear () |
template<class T > | |
const T * | get (Ex::iterator, bool ignore_parent_rel=false) const |
template<class T > | |
const T * | get () const |
template<class T > | |
const T * | get_composite (Ex::iterator, bool ignore_parent_rel=false) const |
template<class T > | |
const T * | get_composite (Ex::iterator, int &serialnum, bool doserial=true, bool ignore_parent_rel=false) const |
template<class T > | |
const T * | get_composite (Ex::iterator, const std::string &label) const |
template<class T > | |
const T * | get_composite (Ex::iterator, int &serialnum, const std::string &label, bool doserial=true) const |
template<class T > | |
const T * | get_composite (Ex::iterator, Ex::iterator, bool ignore_parent_rel=false) const |
template<class T > | |
const T * | get_composite (Ex::iterator, Ex::iterator, int &, int &, bool ignore_parent_rel=false) const |
template<class T > | |
Ex::iterator | head (Ex::iterator, bool ignore_parent_rel=false) const |
bool | has (const property *, Ex::iterator) |
int | serial_number (const property *, const pattern *) const |
Public Attributes | |
registered_property_map_t | registered_properties |
property_map_t | props |
The following two maps own the pointers to the properties and patterns stored in them; use clear() to clean up. More... | |
pattern_map_t | pats |
Private Member Functions | |
void | insert_prop (const Ex &, const property *) |
void | insert_list_prop (const std::vector< Ex > &, const list_property *) |
typedef std::pair<pattern *, const property *> cadabra::Properties::pat_prop_pair_t |
typedef std::multimap<const property *, pattern *> cadabra::Properties::pattern_map_t |
typedef std::multimap<nset_t::iterator, pat_prop_pair_t, nset_it_less> cadabra::Properties::property_map_t |
We keep two multi-maps: one from the pattern to the property (roughly) and one from the property to the pattern.
These are both multi-maps because one pattern can have multiple properties assigned to it, and one property can be assigned to multiple properties.
When we delete properties, we check the pats map to see if the reference count for that property has dropped to zero.
void Properties::clear | ( | ) |
const T * cadabra::Properties::get | ( | Ex::iterator | it, |
bool | ignore_parent_rel = false |
||
) | const |
const T * cadabra::Properties::get | ( | ) | const |
const T * cadabra::Properties::get_composite | ( | Ex::iterator | it, |
bool | ignore_parent_rel = false |
||
) | const |
const T * cadabra::Properties::get_composite | ( | Ex::iterator | it, |
int & | serialnum, | ||
bool | doserial = true , |
||
bool | ignore_parent_rel = false |
||
) | const |
const T * cadabra::Properties::get_composite | ( | Ex::iterator | it, |
const std::string & | label | ||
) | const |
const T * cadabra::Properties::get_composite | ( | Ex::iterator | it, |
int & | serialnum, | ||
const std::string & | label, | ||
bool | doserial = true |
||
) | const |
const T * cadabra::Properties::get_composite | ( | Ex::iterator | it1, |
Ex::iterator | it2, | ||
bool | ignore_parent_rel = false |
||
) | const |
const T * cadabra::Properties::get_composite | ( | Ex::iterator | it1, |
Ex::iterator | it2, | ||
int & | serialnum1, | ||
int & | serialnum2, | ||
bool | ignore_parent_rel = false |
||
) | const |
bool Properties::has | ( | const property * | pb, |
Ex::iterator | it | ||
) |
Ex::iterator cadabra::Properties::head | ( | Ex::iterator | it, |
bool | ignore_parent_rel = false |
||
) | const |
|
private |
Register a property for the indicated Ex.
Takes both normal and list properties and works out which insert calls to make. The property ownership is transferred to us on using this call.
void Properties::register_property | ( | property * | *)(, |
const std::string & | name | ||
) |
Registering properties.
When inserting a property or list_property, ownership of the property gets transferred to this class.
pattern_map_t cadabra::Properties::pats |
property_map_t cadabra::Properties::props |
The following two maps own the pointers to the properties and patterns stored in them; use clear() to clean up.
Note that pointers can sit in in more than one entry in this map (when they are pointing to list_property objects, which are shared between patterns).
registered_property_map_t cadabra::Properties::registered_properties |