SyFi  0.3
triangle_ex1.cpp
Go to the documentation of this file.
00001 #include <SyFi.h>
00002 #include <fstream>
00003 
00004 using namespace GiNaC; 
00005 using namespace SyFi; 
00006 using namespace std; 
00007 
00008 int main() {
00009 
00010     initSyFi(3); 
00011 
00012     ex p0 = lst(0.0,0.0,1.0);
00013     ex p1 = lst(1.0,0.0,1.0);
00014     ex p2 = lst(0.0,1.0,1.0);
00015 
00016     Triangle triangle(p0,p1,p2);
00017 
00018     ex repr = triangle.repr();
00019     cout <<"t.repr "<<repr<<endl; 
00020 
00021     ex f = x*y*z;
00022     ex intf = triangle.integrate(f); 
00023     cout <<"intf "<<intf<<endl; 
00024 
00025 
00026     // regression test
00027 
00028     archive ar; 
00029     ar.archive_ex(intf, "intf"); 
00030     ar.archive_ex(repr, "repr"); 
00031 
00032     ofstream vfile("triangle_ex1.gar.v"); 
00033     vfile << ar; vfile.close(); 
00034     if(!compare_archives("triangle_ex1.gar.v", "triangle_ex1.gar.r")) { 
00035             cerr << "Failure!" << endl;
00036             return -1;
00037     }
00038 
00039     return 0; 
00040 }
00041 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator