Cadabra
Computer algebra system for field theory problems
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
cadabra::property Class Referenceabstract

Description

Base class for all properties, handling argument parsing and defining the interface.

Properties can have arguments. Parsing of these is done in the properties object itself, with the use of some helper functions. Parsing is done by implementing the virtual function property::parse(const Kernel&, keyval_t&). The argument is a container class which represents the arguments passed to the property as key/value pairs keyval_t type.

Properties will be asked to check that they can be associated to a given pattern through the virtual property::validate(const Properties&, const Ex&) function. The FIXME: the above two need to be merged, because parse may need access to the actual pattern tree, and once we are there, we may as well do checking. HOWEVER: in TableauSymmetry.cc: FIXME: we get the wrong pattern in case of a list! We should have been fed each individual item in the list, not the list itself.

This suggests that we should be calling once for every pattern, but that is wasteful in case we are just parsing arguments. Can we really avoid calling parse for every pattern?

{A_{m n}, A_{m n p}, A_{m n p q}}::TableauSymmetry(shape={2,1}, indices={0,1,2}).

leads to a problem, because the property needs to setup its internal structures but also verify that these can match all objects in the same way.

Make all identical properties point to the same property object, so that normal and list properties become pretty much identical.

#include <Props.hh>

Inheritance diagram for cadabra::property:
cadabra::Inherit< SelfCommutingBehaviour > cadabra::Inherit< Spinor > cadabra::Inherit< SortOrder > cadabra::Accent cadabra::AntiSymmetric cadabra::CommutingAsProduct cadabra::CommutingAsSum cadabra::Coordinate cadabra::DAntiSymmetric cadabra::Depends cadabra::DependsBase cadabra::DependsInherit cadabra::Derivative cadabra::DerivativeOp cadabra::Determinant cadabra::DifferentialFormBase cadabra::DiracBar cadabra::Distributable cadabra::EpsilonTensor cadabra::FilledTableau cadabra::GammaMatrix cadabra::GammaTraceless cadabra::ImaginaryI cadabra::ImplicitIndex cadabra::IndexInherit cadabra::Inherit< T > cadabra::Integer cadabra::Integral cadabra::InverseMetric cadabra::InverseVielbein cadabra::KroneckerDelta cadabra::LaTeXForm cadabra::Matrix cadabra::Metric cadabra::NumericalFlat cadabra::PartialDerivative cadabra::PropertyInherit cadabra::RiemannTensor cadabra::SatisfiesBianchi cadabra::SelfCommutingBehaviour cadabra::Spinor cadabra::Symbol cadabra::Symmetric cadabra::Tableau cadabra::TableauBase cadabra::TableauInherit cadabra::TableauSymmetry cadabra::Trace cadabra::Traceless cadabra::Vielbein cadabra::WeylTensor cadabra::labelled_property cadabra::list_property

Public Types

enum  match_t { no_match , id_match , exact_match }
 

Public Member Functions

 property (bool hidden=false)
 
virtual ~property ()
 
bool parse_to_keyvals (const Ex &, keyval_t &)
 
virtual bool parse (Kernel &, keyval_t &keyvals)
 
virtual bool parse (Kernel &, std::shared_ptr< Ex >, keyval_t &keyvals)
 
virtual void validate (const Kernel &, const Ex &) const
 
virtual void latex (std::ostream &) const
 Display the property on the stream. More...
 
virtual std::string name () const =0
 
virtual std::string unnamed_argument () const
 
virtual match_t equals (const property *) const
 
void hidden (bool h)
 Properties can be hidden because they only make sense to the system; they will not be printed when the user asks for a list of properties. More...
 
bool hidden (void) const
 

Private Member Functions

bool parse_one_argument (Ex::iterator arg, keyval_t &keyvals)
 

Private Attributes

bool hidden_
 

Member Enumeration Documentation

◆ match_t

Enumerator
no_match 
id_match 
exact_match 

Constructor & Destructor Documentation

◆ property()

property::property ( bool  hidden = false)

◆ ~property()

virtual cadabra::property::~property ( )
inlinevirtual

Member Function Documentation

◆ equals()

property::match_t property::equals ( const property ) const
virtual

◆ hidden() [1/2]

void property::hidden ( bool  h)

Properties can be hidden because they only make sense to the system; they will not be printed when the user asks for a list of properties.

◆ hidden() [2/2]

bool property::hidden ( void  ) const

◆ latex()

void property::latex ( std::ostream &  str) const
virtual

Display the property on the stream.

Generate a LaTeX representation of the property, assuming LaTeX is in text mode (so it needs dollar symbols to switch to maths).

Reimplemented in cadabra::ImplicitIndex, cadabra::WeylTensor, cadabra::Trace, cadabra::TableauSymmetry, cadabra::Metric, cadabra::Indices, cadabra::GammaMatrix, and cadabra::Determinant.

◆ name()

virtual std::string cadabra::property::name ( ) const
pure virtual

◆ parse() [1/2]

bool property::parse ( Kernel ,
keyval_t keyvals 
)
virtual

◆ parse() [2/2]

bool property::parse ( Kernel kernel,
std::shared_ptr< Ex ,
keyval_t keyvals 
)
virtual

◆ parse_one_argument()

bool property::parse_one_argument ( Ex::iterator  arg,
keyval_t keyvals 
)
private

◆ parse_to_keyvals()

bool property::parse_to_keyvals ( const Ex tr,
keyval_t keyvals 
)

◆ unnamed_argument()

std::string property::unnamed_argument ( ) const
virtual

◆ validate()

void property::validate ( const Kernel ,
const Ex  
) const
virtual

Member Data Documentation

◆ hidden_

bool cadabra::property::hidden_
private

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