box_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 f = x*y*z;
00013
00014
00015 ReferenceBox box;
00016
00017 ex repr = box.repr();
00018 cout <<"b.repr "<<repr<<endl;
00019
00020 ex intf = box.integrate(f);
00021 cout <<"intf "<<intf<<endl;
00022
00023
00024 ex p0 = lst(-1.0,-1.0,-1.0);
00025 ex p1 = lst( 1.0, 1.0, 1.0);
00026
00027 Box box2(p0,p1);
00028
00029 ex repr2 = box2.repr();
00030 cout <<"b2.repr "<<repr<<endl;
00031
00032
00033
00034 ex intf2 = box2.integrate(f);
00035 cout <<"intf2 "<<intf2<<endl;
00036
00037
00038
00039
00040 archive ar;
00041 ar.archive_ex(repr, "repr");
00042 ar.archive_ex(intf, "intf");
00043 ar.archive_ex(repr2, "repr2");
00044 ar.archive_ex(intf2, "intf2");
00045
00046
00047 ofstream vfile("box_ex1.gar.v");
00048 vfile << ar; vfile.close();
00049
00050 if(!compare_archives("box_ex1.gar.v", "box_ex1.gar.r")) {
00051 cerr << "Failure!" << endl;
00052 return -1;
00053 }
00054
00055 return 0;
00056 }
00057