]> www.ginac.de Git - ginac.git/blob - ginac/isospin.h
- Introduced exception do_taylor to signal Taylor expansion is ok for series
[ginac.git] / ginac / isospin.h
1 /** @file isospin.h
2  *
3  *  Interface to GiNaC's isospin objects. */
4
5 /*
6  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #ifndef __GINAC_ISOSPIN_H__
24 #define __GINAC_ISOSPIN_H__
25
26 #include <string>
27 #include <ginac/indexed.h>
28
29 #ifndef NO_GINAC_NAMESPACE
30 namespace GiNaC {
31 #endif // ndef NO_GINAC_NAMESPACE
32
33 /** Base class for isospin object */
34 class isospin : public indexed
35 {
36 // member functions
37
38     // default constructor, destructor, copy constructor assignment operator and helpers
39 public:
40     isospin();
41     ~isospin();
42     isospin(isospin const & other);
43     isospin const & operator=(isospin const & other);
44 protected:
45     void copy(isospin const & other); 
46     void destroy(bool call_parent);
47
48     // other constructors
49 public:
50     explicit isospin(string const & initname);
51
52     // functions overriding virtual functions from base classes
53 public:
54     basic * duplicate() const;
55     void printraw(ostream & os) const;
56     void printtree(ostream & os, unsigned indent) const;
57     void print(ostream & os, unsigned upper_precedence=0) const;
58     void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
59     bool info(unsigned inf) const;
60 protected:
61     int compare_same_type(basic const & other) const;
62     ex simplify_ncmul(exvector const & v) const;
63     unsigned calchash(void) const;
64
65     // new virtual functions which can be overridden by derived classes
66     // none
67     
68     // non-virtual functions in this class
69 public:
70     void setname(string const & n);
71 private:
72     string & autoname_prefix(void);
73
74 // member variables
75
76 protected:
77     string name;
78     unsigned serial; // unique serial number for comparision
79 private:
80     static unsigned next_serial;
81 };
82
83 // global constants
84
85 extern const isospin some_isospin;
86 extern type_info const & typeid_isospin;
87
88 // utility functions
89 inline const isospin &ex_to_isospin(const ex &e)
90 {
91         return static_cast<const isospin &>(*e.bp);
92 }
93
94 #ifndef NO_GINAC_NAMESPACE
95 } // namespace GiNaC
96 #endif // ndef NO_GINAC_NAMESPACE
97
98 #endif // ndef __GINAC_ISOSPIN_H__