3 * Implementation of GiNaC's isospin objects.
4 * No real implementation yet, to be done.
6 * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 // default constructor, destructor, copy constructor assignment operator and helpers
38 debugmsg("isospin default constructor",LOGLEVEL_CONSTRUCT);
40 name=autoname_prefix()+ToString(serial);
41 tinfo_key=TINFO_isospin;
46 debugmsg("isospin destructor",LOGLEVEL_DESTRUCT);
50 isospin::isospin(isospin const & other)
52 debugmsg("isospin copy constructor",LOGLEVEL_CONSTRUCT);
56 isospin const & isospin::operator=(isospin const & other)
58 debugmsg("isospin operator=",LOGLEVEL_ASSIGNMENT);
68 void isospin::copy(isospin const & other)
75 void isospin::destroy(bool call_parent)
78 indexed::destroy(call_parent);
88 isospin::isospin(string const & initname)
90 debugmsg("isospin constructor from string",LOGLEVEL_CONSTRUCT);
93 tinfo_key=TINFO_isospin;
97 // functions overriding virtual functions from bases classes
102 basic * isospin::duplicate() const
104 debugmsg("isospin duplicate",LOGLEVEL_DUPLICATE);
105 return new isospin(*this);
108 void isospin::printraw(ostream & os) const
110 debugmsg("isospin printraw",LOGLEVEL_PRINT);
111 os << "isospin(" << "name=" << name << ",serial=" << serial
114 os << ",hash=" << hashvalue << ",flags=" << flags << ")";
117 void isospin::printtree(ostream & os, unsigned indent) const
119 debugmsg("isospin printtree",LOGLEVEL_PRINT);
120 os << string(indent,' ') << name << " (isospin): "
121 << "serial=" << serial << ","
122 << seq.size() << "indices=";
123 printtreeindices(os,indent);
124 os << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
125 << ", flags=" << flags << endl;
128 void isospin::print(ostream & os, unsigned upper_precedence) const
130 debugmsg("isospin print",LOGLEVEL_PRINT);
135 void isospin::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
137 debugmsg("isospin print csrc",LOGLEVEL_PRINT);
138 print(os,upper_precedence);
141 bool isospin::info(unsigned inf) const
143 return indexed::info(inf);
148 int isospin::compare_same_type(basic const & other) const
150 ASSERT(other.tinfo() == TINFO_isospin);
151 const isospin *o = static_cast<const isospin *>(&other);
152 if (serial==o->serial) {
153 return indexed::compare_same_type(other);
155 return serial < o->serial ? -1 : 1;
158 ex isospin::simplify_ncmul(exvector const & v) const
160 return simplified_ncmul(v);
163 unsigned isospin::calchash(void) const
165 hashvalue=golden_ratio_hash(golden_ratio_hash(0x55555556U ^
166 golden_ratio_hash(tinfo_key) ^
168 setflag(status_flags::hash_calculated);
173 // virtual functions which can be overridden by derived classes
179 // non-virtual functions in this class
182 void isospin::setname(string const & n)
189 string & isospin::autoname_prefix(void)
191 static string * s=new string("isospin");
196 // static member variables
201 unsigned isospin::next_serial=0;
207 const isospin some_isospin;
208 type_info const & typeid_isospin=typeid(some_isospin);