X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fstructure.h;h=22e684008fd5395fc5e191d47efd6518c6782e88;hp=23ae93c0940a6de0e98dc0864a46af4604b4eca1;hb=e8c6a2891bc68ca8f97a7d4b8bd0dd3ac322d982;hpb=68fdf425abf14d016d5f95ee7b9d06a19a3c5926;ds=sidebyside diff --git a/ginac/structure.h b/ginac/structure.h index 23ae93c0..22e68400 100644 --- a/ginac/structure.h +++ b/ginac/structure.h @@ -3,7 +3,7 @@ * Wrapper template for making GiNaC classes out of C++ structures. */ /* - * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,9 @@ #include #include "ex.h" +#include "ncmul.h" +#include "numeric.h" +#include "operators.h" #include "print.h" namespace GiNaC { @@ -116,7 +119,7 @@ class structure : public basic, public ComparisonPolicy { GINAC_DECLARE_REGISTERED_CLASS(structure, basic) // helpers - static unsigned get_tinfo() { return reg_info.tinfo_key; } + static unsigned get_tinfo() { return reg_info.options.get_id(); } static const char *get_class_name() { return "structure"; } // constructors @@ -160,7 +163,7 @@ protected: public: // substitutions - ex subs(const lst & ls, const lst & lr, unsigned options = 0) const { return inherited::subs(ls, lr, options); } + ex subs(const exmap & m, unsigned options = 0) const { return inherited::subs(m, options); } // function mapping ex map(map_function & f) const { return inherited::map(f); } @@ -181,9 +184,9 @@ public: ex series(const relational & r, int order, unsigned options = 0) const { return inherited::series(r, order, options); } // rational functions - ex normal(lst & sym_lst, lst & repl_lst, int level = 0) const { return inherited::normal(sym_lst, repl_lst, level); } - ex to_rational(lst & repl_lst) const { return inherited::to_rational(repl_lst); } - ex to_polynomial(lst & repl_lst) const { return inherited::to_polynomial(repl_lst); } + ex normal(exmap & repl, exmap & rev_lookup, int level = 0) const { return inherited::normal(repl, rev_lookup, level); } + ex to_rational(exmap & repl) const { return inherited::to_rational(repl); } + ex to_polynomial(exmap & repl) const { return inherited::to_polynomial(repl); } // polynomial algorithms numeric integer_content() const { return 1; } @@ -193,7 +196,7 @@ public: // indexed objects exvector get_free_indices() const { return exvector(); } ex add_indexed(const ex & self, const ex & other) const { return self + other; } - ex scalar_mul_indexed(const ex & self, const numeric & other) const { return self * other; } + ex scalar_mul_indexed(const ex & self, const numeric & other) const { return self * ex(other); } bool contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const { return false; } // noncommutativity @@ -256,10 +259,7 @@ int structure::compare_same_type(const basic & other) const } template class CP> -registered_class_info structure::reg_info(structure::get_class_name(), "basic", next_structure_tinfo_key++, &structure::unarchive); - -template class CP> -const char *structure::class_name() const { return reg_info.name; } +registered_class_info structure::reg_info = registered_class_info(registered_class_options(structure::get_class_name(), "basic", next_structure_tinfo_key++, &structure::unarchive)); } // namespace GiNaC