tools.h

Go to the documentation of this file.
00001 #ifndef TOOLS_IS_INCLUDED 
00002 #define TOOLS_IS_INCLUDED 
00003 
00004 #include <ginac/ginac.h>
00005 #include <iostream>
00006 #include <stdio.h>
00007 #include <stdlib.h>
00008 #include <math.h>
00009 #include <string>
00010 #include <sstream>
00011 #include <algorithm>
00012 #include <map>
00013 #include <stdexcept>
00014 #include <vector>
00015 
00016 
00017 
00018 using namespace GiNaC; 
00019 using namespace std; 
00020 
00021 extern symbol x; 
00022 extern symbol y; 
00023 extern symbol z; 
00024 extern numeric nsd; 
00025 extern symbol infinity; 
00026 extern symbol DUMMY; 
00027 
00028 /* Vector of ex */ 
00029 typedef vector<ex> ex_vector; 
00030 
00031 /* Dictionary with ex as keys and values */ 
00032 typedef map<ex,ex, ex_is_less>  ex_ex_map;
00033 typedef map<ex,int, ex_is_less>  ex_int_map;
00034 
00035 /* Iterator associated with the ex-ex dictionary */ 
00036 typedef map<ex,ex>::iterator ex_ex_it;  
00037 typedef map<ex,int>::iterator ex_int_it;  
00038 
00039 /* Vector of vectors of ex */ 
00040 typedef vector<exvector> ex_vector_vector;
00041 
00042 
00043 // inner product of vectors or lst
00044 ex inner(exvector& v1, exvector& v2); 
00045 ex inner(lst v1, lst v2); 
00046 lst cross(lst& v1, lst& v2); 
00047 
00048 
00049 // generates a polynom of arbitrary order on a line, a triangle, or a tetrahedron 
00050 ex pol(int order, int nsd, const string a);  
00051 // generates a vector polynom of arbitrary order on a line, a triangle or a tetrahedron 
00052 lst polv(int order, int nsd, const string a);  
00053 // generates a polynom of arbitrary order on a square or a box   
00054 ex polb(int order, int nsd, const string a);  
00055 // generates a vector polynom of arbitrary order on a squart or a box  
00056 lst polbv(int order, int nsd, const string a);  
00057 
00058 
00059 // matrix vector product
00060 lst matvec(matrix& M, lst& x);  
00061 
00062 
00063 
00064 // extracts the coefficents from a polynomial
00065 exvector coeff(ex pol); 
00066 lst coeffs(ex pol); 
00067 lst coeffs(lst pols); 
00068 // extract the basisfunctions and corresponding coefficents from a polynomial
00069 ex_ex_map  pol2basisandcoeff(ex e); 
00070 
00071 
00072 // the divergence 
00073 ex div(exvector& v);  
00074 ex div(lst& v);  
00075 lst grad(ex f); 
00076 
00077 // print functions 
00078 void print(exvector& v); 
00079 void print(lst& l); 
00080 void print(ex_ex_map m); 
00081 void print(ex_int_map m); 
00082 
00083 // dirac delta function 
00084 int dirac(int i, int j); 
00085 
00086 
00087 lst ex2equations(ex rel); 
00088 lst collapse(lst l);  
00089 
00090 matrix equations2matrix (const ex &eqns, const ex &symbols); 
00091 
00092 lst lst_equals(ex a, ex b);  
00093 ex lst_to_matrix2(const lst & l); 
00094 lst matrix_to_lst2(const ex & m ); 
00095 
00096 // FIXME bad name
00097 int find(ex e, lst list); 
00098 void check_visitor(ex e, lst& exlist);  
00099 void visitor_subst_pow(ex e, ex_ex_map& map, ex_int_map& intmap, string a);  
00100 
00101 string istr(string a, int b); 
00102 
00103 bool compare(ex e, string s); 
00104 
00105 void EQUAL_OR_DIE(ex e, char* s);  
00106 
00107 
00108 #endif 
00109 
00110 
00111 
00112 

Generated on Tue Nov 22 11:10:22 2005 for SyFi by  doxygen 1.4.4