SyFi  0.3
symbol_factory.h
Go to the documentation of this file.
00001 // Copyright (C) 2006-2009 Kent-Andre Mardal and Simula Research Laboratory
00002 //
00003 // This file is part of SyFi.
00004 //
00005 // SyFi is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // SyFi is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with SyFi. If not, see <http://www.gnu.org/licenses/>.
00017 
00018 #ifndef SYMBOL_FACTORY_IS_INCLUDED
00019 #define SYMBOL_FACTORY_IS_INCLUDED
00020 
00021 #include <string>
00022 
00023 #include <ginac/ginac.h>
00024 
00025 namespace SyFi
00026 {
00027 
00028         // TODO: make a class SymbolSpace or something
00029         /*
00030         class SpaceSymbols
00031         {
00032         public:
00033           SpaceSymbols(int nsd_, const std::string & base_name);
00034 
00035         int nsd() const;
00036         GiNaC::symbol x(int i) const;
00037         GiNaC::symbol t() const;
00038         };
00039 
00040         ex diff(e, i, ss=default_ss, ss2=default_ss2);
00041         ex div(e, ss=default_ss, ss2=default_ss2);
00042         ex grad(e, ss=default_ss, ss2=default_ss2);
00043         */
00044 
00045         // Initialize global variables of SyFi
00046         void initSyFi(unsigned int nsd);
00047 
00048         // spacial variables, used by differential operators
00049         extern unsigned int nsd;
00050         extern GiNaC::symbol x;
00051         extern GiNaC::symbol y;
00052         extern GiNaC::symbol z;
00053         extern GiNaC::symbol t;
00054         extern GiNaC::lst    p;
00055 
00056         // utility symbols
00057         extern GiNaC::symbol infinity;
00058         extern GiNaC::symbol DUMMY;
00059 
00060         // ===== symbol factory
00061 
00062         // TODO: is it useful to make a singleton for this?
00063 
00064         bool symbol_exists(const std::string & name);
00065 
00066         // TODO: we don't need the const & ?
00067         const GiNaC::symbol & get_symbol(const std::string & name);
00068 
00069         const GiNaC::symbol & isymb(const std::string & a, int b);
00070         const GiNaC::symbol & isymb(const std::string & a, int b, int c);
00071 
00072         GiNaC::ex get_symbolic_vector(int m, const std::string & basename);
00073 
00074         GiNaC::ex get_symbolic_matrix(int m, int n, const std::string & basename);
00075 
00076 }                                                                // namespace SyFi
00077 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator