SyFi  0.3
mxpoisson_ex.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     ReferenceTriangle domain; 
00013 
00014     // First the lowest order. 
00015     // The lowest order is special, because we must use P0 
00016     RaviartThomas v_fe;
00017     v_fe.set_order(1);
00018     v_fe.set_polygon(domain);
00019     v_fe.compute_basis_functions();
00020 
00021     P0 p_fe; 
00022     p_fe.set_polygon(domain);
00023     p_fe.compute_basis_functions();
00024 
00025     usage(v_fe, p_fe); 
00026 
00027     Dof dof; 
00028     std::map<std::pair<unsigned int,unsigned int>, ex> A; 
00029     compute_mixed_Poisson_element_matrix(v_fe, p_fe, dof, A);  
00030     print(A); 
00031 
00032 
00033     // Then for instance order 3
00034     int order = 3; 
00035     RaviartThomas v_fe2;
00036     v_fe2.set_order(order);
00037     v_fe2.set_polygon(domain);
00038     v_fe2.compute_basis_functions();
00039 
00040     DiscontinuousLagrange p_fe2; 
00041     p_fe2.set_order(order); 
00042     p_fe2.set_polygon(domain);
00043     p_fe2.compute_basis_functions();
00044 
00045     usage(v_fe2, p_fe2); 
00046 
00047     Dof dof2; 
00048     std::map<std::pair<unsigned int,unsigned int>, ex> A2; 
00049     compute_mixed_Poisson_element_matrix(v_fe2, p_fe2, dof2, A2);  
00050     print(A2); 
00051 
00052 
00053     /* comment out test for now
00054 
00055     // regression test 
00056     
00057     archive ar; 
00058     map<std::pair<unsigned int,unsigned int>,ex>::iterator iter; 
00059     for (iter = A.begin(); iter != A.end() ; iter++) {
00060         ar.archive_ex((*iter).second, istr("A_", (*iter).first.first, (*iter).first.second).c_str()); 
00061     }
00062 
00063     for (iter = A2.begin(); iter != A2.end() ; iter++) {
00064         ar.archive_ex((*iter).second, istr("A2_", (*iter).first.first, (*iter).first.second).c_str()); 
00065     }
00066     ofstream vfile("mxpoisson_ex.gar.v"); 
00067     vfile << ar; vfile.close(); 
00068     if(!compare_archives("mxpoisson_ex.gar.v", "mxpoisson_ex.gar.r")) { 
00069             cerr << "Failure!" << endl;
00070             return -1;
00071     }
00072 
00073     */
00074 
00075     return 0; 
00076 
00077 
00078 }
00079 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator