rectangle_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(2);
00011
00012 ex f = x*y;
00013 ReferenceRectangle rectangle;
00014
00015 ex repr = rectangle.repr();
00016 cout <<"s.repr "<<repr<<endl;
00017
00018 ex intf = rectangle.integrate(f);
00019 cout <<"intf "<<intf<<endl;
00020
00021
00022
00023 ex p0 = lst(0.0,0.0);
00024 ex p1 = lst(1.0,1.0);
00025
00026 Rectangle rectangle2(p0,p1);
00027
00028 ex repr2 = rectangle2.repr();
00029 cout <<"s2.repr "<<repr<<endl;
00030
00031 ex intf2 = rectangle2.integrate(f);
00032 cout <<"intf2 "<<intf2<<endl;
00033
00034 initSyFi(3);
00035 ex f3 = (x+1)*y*z;
00036 p0 = lst(0.0,0.0,1.0);
00037 p1 = lst(0.0,1.0,0.0);
00038
00039 Rectangle rectangle3(p0,p1);
00040
00041 ex repr3 = rectangle3.repr();
00042 cout <<"s3.repr "<<repr3<<endl;
00043
00044 ex intf3 = rectangle3.integrate(f3);
00045 cout <<"intf3 "<<intf3<<endl;
00046
00047
00048
00049 archive ar;
00050 ar.archive_ex(intf, "intf");
00051 ar.archive_ex(repr, "repr");
00052 ar.archive_ex(intf2, "intf2");
00053 ar.archive_ex(repr2, "repr2");
00054 ar.archive_ex(intf3, "intf3");
00055 ar.archive_ex(repr3, "repr3");
00056
00057 ofstream vfile("rectangle_ex1.gar.v");
00058 vfile << ar; vfile.close();
00059 if(!compare_archives("rectangle_ex1.gar.v", "rectangle_ex1.gar.r")) {
00060 cerr << "Failure!" << endl;
00061 return -1;
00062 }
00063
00064
00065
00066 return 0;
00067 }
00068