3 * Implementation of GiNaC's isospin objects.
4 * No real implementation yet, to be done. */
12 // default constructor, destructor, copy constructor assignment operator and helpers
19 debugmsg("isospin default constructor",LOGLEVEL_CONSTRUCT);
21 name=autoname_prefix()+ToString(serial);
22 tinfo_key=TINFO_ISOSPIN;
27 debugmsg("isospin destructor",LOGLEVEL_DESTRUCT);
31 isospin::isospin(isospin const & other)
33 debugmsg("isospin copy constructor",LOGLEVEL_CONSTRUCT);
37 isospin const & isospin::operator=(isospin const & other)
39 debugmsg("isospin operator=",LOGLEVEL_ASSIGNMENT);
49 void isospin::copy(isospin const & other)
56 void isospin::destroy(bool call_parent)
59 indexed::destroy(call_parent);
69 isospin::isospin(string const & initname)
71 debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT);
74 tinfo_key=TINFO_ISOSPIN;
78 // functions overriding virtual functions from bases classes
83 basic * isospin::duplicate() const
85 debugmsg("isospin duplicate",LOGLEVEL_DUPLICATE);
86 return new isospin(*this);
89 void isospin::printraw(ostream & os) const
91 debugmsg("isospin printraw",LOGLEVEL_PRINT);
92 os << "isospin(" << "name=" << name << ",serial=" << serial
95 os << ",hash=" << hashvalue << ",flags=" << flags << ")";
98 void isospin::printtree(ostream & os, unsigned indent) const
100 debugmsg("isospin printtree",LOGLEVEL_PRINT);
101 os << string(indent,' ') << name << " (isospin): "
102 << "serial=" << serial << ","
103 << seq.size() << "indices=";
104 printtreeindices(os,indent);
105 os << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
106 << ", flags=" << flags << endl;
109 void isospin::print(ostream & os, unsigned upper_precedence) const
111 debugmsg("isospin print",LOGLEVEL_PRINT);
116 void isospin::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
118 debugmsg("isospin print csrc",LOGLEVEL_PRINT);
119 print(os,upper_precedence);
122 bool isospin::info(unsigned inf) const
124 return indexed::info(inf);
129 int isospin::compare_same_type(basic const & other) const
131 ASSERT(other.tinfo() == TINFO_ISOSPIN);
132 const isospin *o = static_cast<const isospin *>(&other);
133 if (serial==o->serial) {
134 return indexed::compare_same_type(other);
136 return serial < o->serial ? -1 : 1;
139 ex isospin::simplify_ncmul(exvector const & v) const
141 return simplified_ncmul(v);
144 unsigned isospin::calchash(void) const
146 hashvalue=golden_ratio_hash(golden_ratio_hash(0x55555556U ^
147 golden_ratio_hash(tinfo_key) ^
149 setflag(status_flags::hash_calculated);
154 // virtual functions which can be overridden by derived classes
160 // non-virtual functions in this class
163 void isospin::setname(string const & n)
170 string & isospin::autoname_prefix(void)
172 static string * s=new string("isospin");
177 // static member variables
182 unsigned isospin::next_serial=0;
188 const isospin some_isospin;
189 type_info const & typeid_isospin=typeid(some_isospin);