normal.cpp numeric.cpp operators.cpp power.cpp registrar.cpp relational.cpp \
symbol.cpp pseries.cpp utils.cpp ncmul.cpp structure.cpp exprseq_suppl.cpp \
lst.cpp lst_suppl.cpp input_parser.yy input_lexer.ll input_lexer.h \
- remember.h remember.cpp debugmsg.h utils.h idx.cpp indexed.cpp tensor.cpp
+ remember.h remember.cpp debugmsg.h utils.h idx.cpp indexed.cpp tensor.cpp \
+ color.cpp clifford.cpp
libginac_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
ginacincludedir = $(includedir)/ginac
expair.h expairseq.h exprseq.h fail.h flags.h function.h inifcns.h \
lst.h matrix.h mul.h ncmul.h normal.h numeric.h operators.h power.h \
registrar.h relational.h pseries.h structure.h symbol.h tinfos.h assertion.h \
- version.h idx.h indexed.h tensor.h
+ version.h idx.h indexed.h tensor.h color.h clifford.h
LFLAGS = -Pginac_yy -olex.yy.c
YFLAGS = -p ginac_yy -d
EXTRA_DIST = container.pl function.pl structure.pl input_parser.h version.h.in
// default constructor, destructor, copy constructor assignment operator and helpers
//////////
-// public
-
add::add()
{
debugmsg("add default constructor",LOGLEVEL_CONSTRUCT);
tinfo_key = TINFO_add;
}
-// protected
-
-/** For use by copy ctor and assignment operator. */
-void add::copy(const add & other)
-{
- inherited::copy(other);
-}
-
-void add::destroy(bool call_parent)
-{
- if (call_parent) inherited::destroy(call_parent);
-}
+DEFAULT_COPY(add)
+DEFAULT_DESTROY(add)
//////////
// other constructors
// archiving
//////////
-/** Construct object from archive_node. */
-add::add(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
- debugmsg("add constructor from archive_node", LOGLEVEL_CONSTRUCT);
-}
-
-/** Unarchive the object. */
-ex add::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new add(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void add::archive(archive_node &n) const
-{
- inherited::archive(n);
-}
+DEFAULT_ARCHIVING(add)
//////////
// functions overriding virtual functions from bases classes
}
/** Unarchive the object. */
-ex basic::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new basic(n, sym_lst))->setflag(status_flags::dynallocated);
-}
+DEFAULT_UNARCHIVE(basic)
/** Archive the object. */
void basic::archive(archive_node &n) const
--- /dev/null
+/** @file clifford.cpp
+ *
+ * Implementation of GiNaC's clifford algebra (Dirac gamma) objects. */
+
+/*
+ * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "clifford.h"
+#include "ex.h"
+#include "idx.h"
+#include "ncmul.h"
+#include "archive.h"
+#include "debugmsg.h"
+#include "utils.h"
+
+#include <stdexcept>
+
+namespace GiNaC {
+
+GINAC_IMPLEMENT_REGISTERED_CLASS(clifford, indexed)
+GINAC_IMPLEMENT_REGISTERED_CLASS(diracgamma, tensor)
+
+//////////
+// default constructor, destructor, copy constructor assignment operator and helpers
+//////////
+
+clifford::clifford()
+{
+ debugmsg("clifford default constructor", LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_clifford;
+}
+
+DEFAULT_COPY(clifford)
+DEFAULT_DESTROY(clifford)
+DEFAULT_CTORS(diracgamma)
+
+//////////
+// other constructors
+//////////
+
+/** Construct object with one Lorentz index. This constructor is for internal
+ * use only. Use the dirac_gamma() function instead.
+ * @see dirac_gamma */
+clifford::clifford(const ex & b, const ex & mu) : inherited(b, mu)
+{
+ debugmsg("clifford constructor from ex,ex", LOGLEVEL_CONSTRUCT);
+ GINAC_ASSERT(is_ex_of_type(mu, varidx));
+ tinfo_key = TINFO_clifford;
+}
+
+clifford::clifford(const exvector & v, bool discardable) : inherited(indexed::unknown, v, discardable)
+{
+ debugmsg("clifford constructor from exvector", LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_clifford;
+}
+
+clifford::clifford(exvector * vp) : inherited(indexed::unknown, vp)
+{
+ debugmsg("clifford constructor from exvector *", LOGLEVEL_CONSTRUCT);
+ tinfo_key = TINFO_clifford;
+}
+
+//////////
+// archiving
+//////////
+
+DEFAULT_ARCHIVING(clifford)
+DEFAULT_ARCHIVING(diracgamma)
+
+//////////
+// functions overriding virtual functions from bases classes
+//////////
+
+int clifford::compare_same_type(const basic & other) const
+{
+ return inherited::compare_same_type(other);
+}
+
+DEFAULT_COMPARE(diracgamma)
+DEFAULT_PRINT(diracgamma, "gamma")
+
+/** Perform automatic simplification on noncommutative product of clifford
+ * objects. */
+ex clifford::simplify_ncmul(const exvector & v) const
+{
+ //!! to be implemented
+ return nonsimplified_ncmul(v);
+}
+
+ex clifford::thisexprseq(const exvector & v) const
+{
+ return clifford(v);
+}
+
+ex clifford::thisexprseq(exvector * vp) const
+{
+ return clifford(vp);
+}
+
+//////////
+// global functions
+//////////
+
+ex dirac_gamma(const ex & mu)
+{
+ if (!is_ex_of_type(mu, varidx))
+ throw(std::invalid_argument("index of Dirac gamma must be of type varidx"));
+ return clifford(diracgamma(), mu);
+}
+
+} // namespace GiNaC
// archiving
//////////
-/** Construct object from archive_node. */
constant::constant(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
debugmsg("constant ctor from archive_node", LOGLEVEL_CONSTRUCT);
}
-/** Unarchive the object. */
ex constant::unarchive(const archive_node &n, const lst &sym_lst)
{
// Find constant by name (!! this is bad: 'twould be better if there
throw (std::runtime_error("unnamed constant in archive"));
}
-/** Archive the object. */
void constant::archive(archive_node &n) const
{
inherited::archive(n);
#endif // EXPAIRSEQ_USE_HASHTAB
}
-void expairseq::destroy(bool call_parent)
-{
- if (call_parent)
- basic::destroy(call_parent);
-}
+DEFAULT_DESTROY(expairseq)
//////////
// other ctors
// archiving
//////////
-/** Construct object from archive_node. */
expairseq::expairseq(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
#if EXPAIRSEQ_USE_HASHTAB
, hashtabsize(0)
n.find_ex("overall_coeff", overall_coeff, sym_lst);
}
-/** Unarchive the object. */
-ex expairseq::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new expairseq(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
void expairseq::archive(archive_node &n) const
{
inherited::archive(n);
n.add_ex("overall_coeff", overall_coeff);
}
+DEFAULT_UNARCHIVE(expairseq)
+
//////////
// functions overriding virtual functions from bases classes
//////////
#include "fail.h"
#include "archive.h"
#include "debugmsg.h"
+#include "utils.h"
namespace GiNaC {
// default ctor, dtor, copy ctor assignment operator and helpers
//////////
-// public
-
-fail::fail() : inherited(TINFO_fail)
-{
- debugmsg("fail default ctor",LOGLEVEL_CONSTRUCT);
-}
-
-// protected
-
-void fail::copy(const fail & other)
-{
- inherited::copy(other);
-}
-
-void fail::destroy(bool call_parent)
-{
- if (call_parent) inherited::destroy(call_parent);
-}
+DEFAULT_CTORS(fail)
//////////
// archiving
//////////
-/** Construct object from archive_node. */
-fail::fail(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
- debugmsg("fail ctor from archive_node", LOGLEVEL_CONSTRUCT);
-}
-
-/** Unarchive the object. */
-ex fail::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new fail(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void fail::archive(archive_node &n) const
-{
- inherited::archive(n);
-}
+DEFAULT_ARCHIVING(fail)
//////////
// functions overriding virtual functions from bases classes
//////////
-// public
-
-void fail::print(std::ostream & os, unsigned upper_precedence) const
-{
- debugmsg("fail print",LOGLEVEL_PRINT);
- os << "FAIL";
-}
-
-void fail::printraw(std::ostream & os) const
-{
- debugmsg("fail printraw",LOGLEVEL_PRINT);
- os << "FAIL";
-}
-
-// protected
-
-int fail::compare_same_type(const basic & other) const
-{
- // two fails are always identical
- return 0;
-}
+DEFAULT_COMPARE(fail)
+DEFAULT_PRINT(fail, "FAIL")
} // namespace GiNaC
{
GINAC_DECLARE_REGISTERED_CLASS(fail, basic)
- // other ctors
- // none
-
// functions overriding virtual functions from bases classes
public:
void print(std::ostream & os, unsigned upper_precedence=0) const;
- void printraw(std::ostream & os) const;
protected:
unsigned return_type(void) const { return return_types::noncommutative_composite; };
-
- // new virtual functions which can be overridden by derived classes
- // none
-
- // non-virtual functions in this class
- // none
-
- // member variables
- // none
};
} // namespace GiNaC
#include "idx.h"
#include "indexed.h"
#include "tensor.h"
+#include "color.h"
+#include "clifford.h"
#endif // ndef GINAC_BASE_ONLY
#ifdef __MAKECINT__
covariant = other.covariant;
}
-void idx::destroy(bool call_parent)
-{
- if (call_parent)
- inherited::destroy(call_parent);
-}
-
-void varidx::destroy(bool call_parent)
-{
- if (call_parent)
- inherited::destroy(call_parent);
-}
+DEFAULT_DESTROY(idx)
+DEFAULT_DESTROY(varidx)
//////////
// other constructors
n.find_bool("covariant", covariant);
}
-ex idx::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new idx(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-ex varidx::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new varidx(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
void idx::archive(archive_node &n) const
{
inherited::archive(n);
n.add_bool("covariant", covariant);
}
+DEFAULT_UNARCHIVE(idx)
+DEFAULT_UNARCHIVE(varidx)
+
//////////
// functions overriding virtual functions from bases classes
//////////
symmetry = other.symmetry;
}
-void indexed::destroy(bool call_parent)
-{
- if (call_parent)
- inherited::destroy(call_parent);
-}
+DEFAULT_DESTROY(indexed)
//////////
// other constructors
// archiving
//////////
-/** Construct object from archive_node. */
indexed::indexed(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
debugmsg("indexed constructor from archive_node", LOGLEVEL_CONSTRUCT);
throw (std::runtime_error("unknown indexed symmetry type in archive"));
}
-/** Unarchive the object. */
-ex indexed::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new indexed(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
void indexed::archive(archive_node &n) const
{
inherited::archive(n);
n.add_unsigned("symmetry", symmetry);
}
+DEFAULT_UNARCHIVE(indexed)
+
//////////
// functions overriding virtual functions from bases classes
//////////
// default ctor, dtor, copy ctor, assignment operator and helpers:
//////////
-// public
-
/** Default ctor. Initializes to 1 x 1-dimensional zero-matrix. */
matrix::matrix() : inherited(TINFO_matrix), row(1), col(1)
{
m.push_back(_ex0());
}
-// protected
-
-/** For use by copy ctor and assignment operator. */
void matrix::copy(const matrix & other)
{
inherited::copy(other);
m = other.m; // STL's vector copying invoked here
}
-void matrix::destroy(bool call_parent)
-{
- if (call_parent) inherited::destroy(call_parent);
-}
+DEFAULT_DESTROY(matrix)
//////////
// other ctors
// archiving
//////////
-/** Construct object from archive_node. */
matrix::matrix(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
debugmsg("matrix ctor from archive_node", LOGLEVEL_CONSTRUCT);
}
}
-/** Unarchive the object. */
-ex matrix::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new matrix(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
void matrix::archive(archive_node &n) const
{
inherited::archive(n);
}
}
+DEFAULT_UNARCHIVE(matrix)
+
//////////
// functions overriding virtual functions from bases classes
//////////
// default ctor, dctor, copy ctor assignment operator and helpers
//////////
-// public
-
mul::mul()
{
debugmsg("mul default ctor",LOGLEVEL_CONSTRUCT);
tinfo_key = TINFO_mul;
}
-// protected
-
-/** For use by copy ctor and assignment operator. */
-void mul::copy(const mul & other)
-{
- inherited::copy(other);
-}
-
-void mul::destroy(bool call_parent)
-{
- if (call_parent) inherited::destroy(call_parent);
-}
+DEFAULT_COPY(mul)
+DEFAULT_DESTROY(mul)
//////////
// other ctors
// archiving
//////////
-/** Construct object from archive_node. */
-mul::mul(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
- debugmsg("mul ctor from archive_node", LOGLEVEL_CONSTRUCT);
-}
-
-/** Unarchive the object. */
-ex mul::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new mul(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void mul::archive(archive_node &n) const
-{
- inherited::archive(n);
-}
+DEFAULT_ARCHIVING(mul)
//////////
// functions overriding virtual functions from bases classes
// default constructor, destructor, copy constructor assignment operator and helpers
//////////
-// public
-
ncmul::ncmul()
{
debugmsg("ncmul default constructor",LOGLEVEL_CONSTRUCT);
tinfo_key = TINFO_ncmul;
}
-// protected
-
-void ncmul::copy(const ncmul & other)
-{
- inherited::copy(other);
-}
-
-void ncmul::destroy(bool call_parent)
-{
- if (call_parent) inherited::destroy(call_parent);
-}
+DEFAULT_COPY(ncmul)
+DEFAULT_DESTROY(ncmul)
//////////
// other constructors
// archiving
//////////
-/** Construct object from archive_node. */
-ncmul::ncmul(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
- debugmsg("ncmul constructor from archive_node", LOGLEVEL_CONSTRUCT);
-}
-
-/** Unarchive the object. */
-ex ncmul::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new ncmul(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void ncmul::archive(archive_node &n) const
-{
- inherited::archive(n);
-}
-
+DEFAULT_ARCHIVING(ncmul)
//////////
// functions overriding virtual functions from bases classes
// *(c1,c2,ncmul(...)) (pull out commutative elements)
// ncmul(x1,y1,x2,y2) -> *(ncmul(x1,x2),ncmul(y1,y2))
// (collect elements of same type)
- // ncmul(x1,x2,x3,...) -> x::eval_ncmul(x1,x2,x3,...)
+ // ncmul(x1,x2,x3,...) -> x::simplify_ncmul(x1,x2,x3,...)
// the following rule would be nice, but produces a recursion,
// which must be trapped by introducing a flag that the sub-ncmuls()
// are already evaluated (maybe later...)
// operator and helpers
//////////
-// public
-
/** default ctor. Numerically it initializes to an integer zero. */
numeric::numeric() : basic(TINFO_numeric)
{
setflag(status_flags::evaluated | status_flags::expanded);
}
-// protected
-
-/** For use by copy ctor and assignment operator. */
void numeric::copy(const numeric &other)
{
inherited::copy(other);
value = other.value;
}
-void numeric::destroy(bool call_parent)
-{
- if (call_parent) inherited::destroy(call_parent);
-}
+DEFAULT_DESTROY(numeric)
//////////
// other ctors
// archiving
//////////
-/** Construct object from archive_node. */
numeric::numeric(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
debugmsg("numeric ctor from archive_node", LOGLEVEL_CONSTRUCT);
setflag(status_flags::evaluated | status_flags::expanded);
}
-/** Unarchive the object. */
-ex numeric::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new numeric(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
void numeric::archive(archive_node &n) const
{
inherited::archive(n);
#endif
}
+DEFAULT_UNARCHIVE(numeric)
+
//////////
// functions overriding virtual functions from bases classes
//////////
// default ctor, dtor, copy ctor assignment operator and helpers
//////////
-// public
-
power::power() : basic(TINFO_power)
{
debugmsg("power default ctor",LOGLEVEL_CONSTRUCT);
}
-// protected
-
void power::copy(const power & other)
{
inherited::copy(other);
exponent = other.exponent;
}
-void power::destroy(bool call_parent)
-{
- if (call_parent) inherited::destroy(call_parent);
-}
+DEFAULT_DESTROY(power)
//////////
// other ctors
//////////
-// public
-
power::power(const ex & lh, const ex & rh) : basic(TINFO_power), basis(lh), exponent(rh)
{
debugmsg("power ctor from ex,ex",LOGLEVEL_CONSTRUCT);
// archiving
//////////
-/** Construct object from archive_node. */
power::power(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
debugmsg("power ctor from archive_node", LOGLEVEL_CONSTRUCT);
n.find_ex("exponent", exponent, sym_lst);
}
-/** Unarchive the object. */
-ex power::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new power(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
void power::archive(archive_node &n) const
{
inherited::archive(n);
n.add_ex("exponent", exponent);
}
+DEFAULT_UNARCHIVE(power)
+
//////////
// functions overriding virtual functions from bases classes
//////////
GINAC_IMPLEMENT_REGISTERED_CLASS(pseries, basic)
+
/*
* Default ctor, dtor, copy ctor, assignment operator and helpers
*/
point = other.point;
}
-void pseries::destroy(bool call_parent)
-{
- if (call_parent)
- inherited::destroy(call_parent);
-}
+DEFAULT_DESTROY(pseries)
/*
* Archiving
*/
-/** Construct object from archive_node. */
pseries::pseries(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
debugmsg("pseries ctor from archive_node", LOGLEVEL_CONSTRUCT);
n.find_ex("point", point, sym_lst);
}
-/** Unarchive the object. */
-ex pseries::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new pseries(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
void pseries::archive(archive_node &n) const
{
inherited::archive(n);
n.add_ex("point", point);
}
+DEFAULT_UNARCHIVE(pseries)
+
//////////
// functions overriding virtual functions from bases classes
//////////
// default ctor, dtor, copy ctor assignment operator and helpers
//////////
-// public
-
relational::relational() : basic(TINFO_relational)
{
debugmsg("relational default ctor",LOGLEVEL_CONSTRUCT);
}
-// protected
-
void relational::copy(const relational & other)
{
basic::copy(other);
o=other.o;
}
-void relational::destroy(bool call_parent)
-{
- if (call_parent) basic::destroy(call_parent);
-}
+DEFAULT_DESTROY(relational)
//////////
// other ctors
// archiving
//////////
-/** Construct object from archive_node. */
relational::relational(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
debugmsg("relational ctor from archive_node", LOGLEVEL_CONSTRUCT);
n.find_ex("rh", rh, sym_lst);
}
-/** Unarchive the object. */
-ex relational::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new relational(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
void relational::archive(archive_node &n) const
{
inherited::archive(n);
n.add_unsigned("op", o);
}
+DEFAULT_UNARCHIVE(relational)
+
//////////
// functions overriding virtual functions from bases classes
//////////
#include "structure.h"
#include "archive.h"
#include "debugmsg.h"
+#include "utils.h"
namespace GiNaC {
// default ctor, dtor, copy ctor assignment operator and helpers
//////////
-// public
-
-structure::structure()
-{
- debugmsg("structure default ctor",LOGLEVEL_CONSTRUCT);
- tinfo_key = TINFO_structure;
-}
-
-// protected
-
-void structure::copy(const structure & other)
-{
- basic::copy(other);
-}
-
-void structure::destroy(bool call_parent)
-{
- if (call_parent) basic::destroy(call_parent);
-}
-
-//////////
-// other ctors
-//////////
-
-// none
+DEFAULT_CTORS(structure)
//////////
// archiving
//////////
-/** Construct object from archive_node. */
-structure::structure(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
-{
- debugmsg("structure ctor from archive_node", LOGLEVEL_CONSTRUCT);
-}
-
-/** Unarchive the object. */
-ex structure::unarchive(const archive_node &n, const lst &sym_lst)
-{
- return (new structure(n, sym_lst))->setflag(status_flags::dynallocated);
-}
-
-/** Archive the object. */
-void structure::archive(archive_node &n) const
-{
- inherited::archive(n);
-}
+DEFAULT_ARCHIVING(structure)
//////////
-// structures overriding virtual structures from bases classes
+// functions overriding virtual functions from bases classes
//////////
-// public
-
void structure::printraw(std::ostream & os) const
{
debugmsg("structure printraw",LOGLEVEL_PRINT);
// protected
-int structure::compare_same_type(const basic & other) const
-{
- GINAC_ASSERT(is_of_type(other, structure));
- return 0; // all structures are the same
-}
+DEFAULT_COMPARE(structure)
bool structure::is_equal_same_type(const basic & other) const
{
}
//////////
-// new virtual structures which can be overridden by derived classes
-//////////
-
-// none
-
-//////////
-// non-virtual structures in this class
+// non-virtual functions in this class
//////////
// protected
{
GINAC_DECLARE_REGISTERED_CLASS(structure, basic)
- // other ctors
- // none
-
// functions overriding virtual functions from bases classes
public:
void printraw(std::ostream & os) const;
protected:
bool is_equal_same_type(const basic & other) const;
- // new virtual functions which can be overridden by derived classes
- // none
-
// non-virtual functions in this class
protected:
static std::vector<registered_structure_info> & registered_structures(void);
public:
static unsigned register_new(const char * nm);
-
-// member variables
-// none
-
};
} // namespace GiNaC
// default constructor, destructor, copy constructor assignment operator and helpers
//////////
-#define DEFAULT_DESTROY(classname) \
-void classname::destroy(bool call_parent) \
-{ \
- if (call_parent) \
- inherited::destroy(call_parent); \
-}
-
-#define DEFAULT_CTORS(classname) \
-classname::classname() : inherited(TINFO_##classname) \
-{ \
- debugmsg(#classname " default constructor", LOGLEVEL_CONSTRUCT); \
-} \
-void classname::copy(const classname & other) \
-{ \
- inherited::copy(other); \
-} \
-DEFAULT_DESTROY(classname)
-
tensor::tensor(unsigned ti) : inherited(ti)
{
debugmsg("tensor constructor from unsigned", LOGLEVEL_CONSTRUCT); \
// archiving
//////////
-#define DEFAULT_UNARCHIVE(classname) \
-ex classname::unarchive(const archive_node &n, const lst &sym_lst) \
-{ \
- return (new classname(n, sym_lst))->setflag(status_flags::dynallocated); \
-}
-
-#define DEFAULT_ARCHIVING(classname) \
-classname::classname(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) \
-{ \
- debugmsg(#classname " constructor from archive_node", LOGLEVEL_CONSTRUCT); \
-} \
-DEFAULT_UNARCHIVE(classname) \
-void classname::archive(archive_node &n) const \
-{ \
- inherited::archive(n); \
-}
-
DEFAULT_ARCHIVING(tensor)
DEFAULT_ARCHIVING(tensdelta)
DEFAULT_ARCHIVING(tensmetric)
// functions overriding virtual functions from bases classes
//////////
-#define DEFAULT_COMPARE(classname) \
-int classname::compare_same_type(const basic & other) const \
-{ \
- /* by default, two tensors of the same class are always identical */ \
- return 0; \
-}
-
DEFAULT_COMPARE(tensor)
DEFAULT_COMPARE(tensdelta)
DEFAULT_COMPARE(tensmetric)
return inherited::compare_same_type(other);
}
-void tensdelta::print(std::ostream & os, unsigned upper_precedence) const
-{
- debugmsg("tensdelta print",LOGLEVEL_PRINT);
- os << "delta";
-}
-
-void tensmetric::print(std::ostream & os, unsigned upper_precedence) const
-{
- debugmsg("tensmetric print",LOGLEVEL_PRINT);
- os << "g";
-}
-
-void minkmetric::print(std::ostream & os, unsigned upper_precedence) const
-{
- debugmsg("minkmetric print",LOGLEVEL_PRINT);
- os << "eta";
-}
-
-void tensepsilon::print(std::ostream & os, unsigned upper_precedence) const
-{
- debugmsg("tensepsilon print",LOGLEVEL_PRINT);
- os << "eps";
-}
+DEFAULT_PRINT(tensdelta, "delta")
+DEFAULT_PRINT(tensmetric, "g")
+DEFAULT_PRINT(minkmetric, "eta")
+DEFAULT_PRINT(tensepsilon, "eps")
/** Automatic symbolic evaluation of an indexed delta tensor. */
ex tensdelta::eval_indexed(const basic & i) const
const unsigned TINFO_pseries = 0x000a0001U;
const unsigned TINFO_indexed = 0x000b0001U;
+const unsigned TINFO_color = 0x000b1001U;
+const unsigned TINFO_clifford = 0x000b1002U;
const unsigned TINFO_structure = 0x000c0001U;
// reserved up to 0x000cffffU
const unsigned TINFO_tensmetric = 0x000e1002U;
const unsigned TINFO_minkmetric = 0x000e2001U;
const unsigned TINFO_tensepsilon = 0x000e1003U;
+const unsigned TINFO_su3one = 0x000e1008U;
+const unsigned TINFO_su3t = 0x000e1009U;
+const unsigned TINFO_su3f = 0x000e100aU;
+const unsigned TINFO_su3d = 0x000e100bU;
+const unsigned TINFO_diracgamma = 0x000e100cU;
} // namespace GiNaC
const numeric & _num120(void); // 120
const ex & _ex120(void);
+
+// Helper macros for class implementations (mostly useful for trivial classes)
+
+#define DEFAULT_COPY(classname) \
+void classname::copy(const classname & other) \
+{ \
+ inherited::copy(other); \
+}
+
+#define DEFAULT_DESTROY(classname) \
+void classname::destroy(bool call_parent) \
+{ \
+ if (call_parent) \
+ inherited::destroy(call_parent); \
+}
+
+#define DEFAULT_CTORS(classname) \
+classname::classname() : inherited(TINFO_##classname) \
+{ \
+ debugmsg(#classname " default constructor", LOGLEVEL_CONSTRUCT); \
+} \
+DEFAULT_COPY(classname) \
+DEFAULT_DESTROY(classname)
+
+#define DEFAULT_UNARCHIVE(classname) \
+ex classname::unarchive(const archive_node &n, const lst &sym_lst) \
+{ \
+ return (new classname(n, sym_lst))->setflag(status_flags::dynallocated); \
+}
+
+#define DEFAULT_ARCHIVING(classname) \
+classname::classname(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) \
+{ \
+ debugmsg(#classname " constructor from archive_node", LOGLEVEL_CONSTRUCT); \
+} \
+DEFAULT_UNARCHIVE(classname) \
+void classname::archive(archive_node &n) const \
+{ \
+ inherited::archive(n); \
+}
+
+#define DEFAULT_COMPARE(classname) \
+int classname::compare_same_type(const basic & other) const \
+{ \
+ /* by default, the objects are always identical */ \
+ return 0; \
+}
+
+#define DEFAULT_PRINT(classname, text) \
+void classname::print(std::ostream & os, unsigned upper_precedence) const \
+{ \
+ debugmsg(#classname " print", LOGLEVEL_PRINT); \
+ os << text; \
+}
+
} // namespace GiNaC
#endif // ndef __GINAC_UTILS_H__