line_ex1.cpp File Reference

#include <SyFi.h>
#include <fstream>

Go to the source code of this file.

Functions

int main ()


Function Documentation

int main (  ) 

Definition at line 10 of file line_ex1.cpp.

References SyFi::compare_archives(), demos::simple::f, SyFi::initSyFi(), SyFi::Line::integrate(), demos::crouzeixraviart::p0, SyFi::Line::repr(), SyFi::t, SyFi::x, SyFi::y, and SyFi::z.

00010            {
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 (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 }


Generated on Mon Aug 31 16:16:49 2009 for SyFi by  doxygen 1.5.9