SyFi
0.3
|
00001 #include <SyFi.h> 00002 #include <fstream> 00003 00004 00005 using namespace GiNaC; 00006 using namespace SyFi; 00007 using namespace std; 00008 00009 00010 int main() { 00011 00012 initSyFi(3); 00013 00014 ex p0 = lst(0.0,0.0,0.0); 00015 ex p1 = lst(1.0,1.0,1.0); 00016 00017 Line line(p0,p1); 00018 00019 // show usage of repr 00020 symbol t("t"); 00021 ex l_repr = line.repr(t); 00022 cout <<"l.repr "<<l_repr<<endl; 00023 00024 00025 for (unsigned int i=0; i< l_repr.nops(); i++) { 00026 cout <<"l_repr.op(" <<i<<"): "<<l_repr.op(i)<<endl; 00027 } 00028 00029 // compute the integral of a function along the line 00030 ex f = x*x + y*y*y + z; 00031 ex intf = line.integrate(f); 00032 cout <<"intf "<<intf<<endl; 00033 00034 00035 // regression test 00036 archive ar; 00037 ar.archive_ex(l_repr, "l_repr"); 00038 ar.archive_ex(intf, "intf"); 00039 00040 ofstream vfile("line_ex1.gar.v"); 00041 vfile << ar; vfile.close(); 00042 if(!compare_archives("line_ex1.gar.v", "line_ex1.gar.r")) { 00043 cerr << "Failure!" << endl; 00044 return -1; 00045 } 00046 00047 return 0; 00048 00049 } 00050