X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fisospin.cpp;h=6fad095daba2fca6669efe3d13eb00ce1c6d9119;hp=a5b5912ea2a91ef0d569b182014273ac7705abcc;hb=dbb36db8d02b2c25af6bbfff8135112637936e1f;hpb=2565309dd7c38635c191eacf2a4af9b23fc0d310 diff --git a/ginac/isospin.cpp b/ginac/isospin.cpp index a5b5912e..6fad095d 100644 --- a/ginac/isospin.cpp +++ b/ginac/isospin.cpp @@ -26,6 +26,8 @@ #include "isospin.h" #include "ex.h" #include "ncmul.h" +#include "lst.h" +#include "archive.h" #include "utils.h" #include "debugmsg.h" @@ -33,6 +35,8 @@ namespace GiNaC { #endif // ndef NO_GINAC_NAMESPACE +GINAC_IMPLEMENT_REGISTERED_CLASS(isospin, indexed) + ////////// // default constructor, destructor, copy constructor assignment operator and helpers ////////// @@ -73,7 +77,7 @@ const isospin & isospin::operator=(const isospin & other) void isospin::copy(const isospin & other) { - indexed::copy(other); + inherited::copy(other); name=other.name; serial=other.serial; } @@ -81,7 +85,7 @@ void isospin::copy(const isospin & other) void isospin::destroy(bool call_parent) { if (call_parent) { - indexed::destroy(call_parent); + inherited::destroy(call_parent); } } @@ -99,6 +103,40 @@ isospin::isospin(const string & initname) tinfo_key=TINFO_isospin; } +////////// +// archiving +////////// + +/** Construct object from archive_node. */ +isospin::isospin(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst) +{ + debugmsg("isospin constructor from archive_node", LOGLEVEL_CONSTRUCT); + serial = next_serial++; + if (!(n.find_string("name", name))) + name = autoname_prefix() + ToString(serial); + tinfo_key = TINFO_isospin; +} + +/** Unarchive the object. */ +ex isospin::unarchive(const archive_node &n, const lst &sym_lst) +{ + ex s = (new isospin(n, sym_lst))->setflag(status_flags::dynallocated); + + // If isospin is in sym_lst, return the existing isospin + for (int i=0; i(&other); if (serial==o->serial) { - return indexed::compare_same_type(other); + return inherited::compare_same_type(other); } return serial < o->serial ? -1 : 1; }