|
GiNaC
1.6.2
|
00001 00005 /* 00006 * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef GINAC_COLOR_H 00024 #define GINAC_COLOR_H 00025 00026 #include "indexed.h" 00027 #include "tensor.h" 00028 00029 #include <set> 00030 00031 namespace GiNaC { 00032 00040 class color : public indexed 00041 { 00042 GINAC_DECLARE_REGISTERED_CLASS(color, indexed) 00043 // other constructors 00044 public: 00045 color(const ex & b, unsigned char rl = 0); 00046 color(const ex & b, const ex & i1, unsigned char rl = 0); 00047 00048 // internal constructors 00049 color(unsigned char rl, const exvector & v, bool discardable = false); 00050 color(unsigned char rl, std::auto_ptr<exvector> vp); 00051 void archive(archive_node& n) const; 00052 void read_archive(const archive_node& n, lst& sym_lst); 00053 00054 // functions overriding virtual functions from base classes 00055 protected: 00056 ex eval_ncmul(const exvector & v) const; 00057 bool match_same_type(const basic & other) const; 00058 ex thiscontainer(const exvector & v) const; 00059 ex thiscontainer(std::auto_ptr<exvector> vp) const; 00060 unsigned return_type() const { return return_types::noncommutative; } 00061 return_type_t return_type_tinfo() const; 00062 00063 // non-virtual functions in this class 00064 public: 00065 unsigned char get_representation_label() const {return representation_label;} 00066 00067 // member variables 00068 private: 00069 unsigned char representation_label; 00070 }; 00071 GINAC_DECLARE_UNARCHIVER(color); 00072 00073 00075 class su3one : public tensor 00076 { 00077 GINAC_DECLARE_REGISTERED_CLASS(su3one, tensor) 00078 00079 // non-virtual functions in this class 00080 protected: 00081 void do_print(const print_context & c, unsigned level) const; 00082 void do_print_latex(const print_latex & c, unsigned level) const; 00083 }; 00084 GINAC_DECLARE_UNARCHIVER(su3one); 00085 00087 class su3t : public tensor 00088 { 00089 GINAC_DECLARE_REGISTERED_CLASS(su3t, tensor) 00090 00091 // functions overriding virtual functions from base classes 00092 public: 00093 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const; 00094 00095 // non-virtual functions in this class 00096 protected: 00097 void do_print(const print_context & c, unsigned level) const; 00098 void do_print_latex(const print_latex & c, unsigned level) const; 00099 }; 00100 GINAC_DECLARE_UNARCHIVER(su3t); 00101 00104 class su3f : public tensor 00105 { 00106 GINAC_DECLARE_REGISTERED_CLASS(su3f, tensor) 00107 00108 // functions overriding virtual functions from base classes 00109 public: 00110 ex eval_indexed(const basic & i) const; 00111 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const; 00112 00113 // non-virtual functions in this class 00114 protected: 00115 unsigned return_type() const { return return_types::commutative; } 00116 void do_print(const print_context & c, unsigned level) const; 00117 void do_print_latex(const print_latex & c, unsigned level) const; 00118 }; 00119 GINAC_DECLARE_UNARCHIVER(su3f); 00120 00122 class su3d : public tensor 00123 { 00124 GINAC_DECLARE_REGISTERED_CLASS(su3d, tensor) 00125 00126 // functions overriding virtual functions from base classes 00127 public: 00128 ex eval_indexed(const basic & i) const; 00129 bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const; 00130 00131 // non-virtual functions in this class 00132 protected: 00133 unsigned return_type() const { return return_types::commutative; } 00134 void do_print(const print_context & c, unsigned level) const; 00135 void do_print_latex(const print_latex & c, unsigned level) const; 00136 }; 00137 GINAC_DECLARE_UNARCHIVER(su3d); 00138 00139 00140 // global functions 00141 00147 ex color_ONE(unsigned char rl = 0); 00148 00154 ex color_T(const ex & a, unsigned char rl = 0); 00155 00162 ex color_f(const ex & a, const ex & b, const ex & c); 00163 00170 ex color_d(const ex & a, const ex & b, const ex & c); 00171 00173 ex color_h(const ex & a, const ex & b, const ex & c); 00174 00179 ex color_trace(const ex & e, const std::set<unsigned char> & rls); 00180 00185 ex color_trace(const ex & e, const lst & rll); 00186 00192 ex color_trace(const ex & e, unsigned char rl = 0); 00193 00194 } // namespace GiNaC 00195 00196 #endif // ndef GINAC_COLOR_H