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
00015
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
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
00054
00055
00056 archive ar;
00057 map<std::pair<unsigned int,unsigned int>,ex>::iterator iter;
00058 for (iter = A.begin(); iter != A.end() ; iter++) {
00059 ar.archive_ex((*iter).second, istr("A_", (*iter).first.first, (*iter).first.second).c_str());
00060 }
00061
00062 for (iter = A2.begin(); iter != A2.end() ; iter++) {
00063 ar.archive_ex((*iter).second, istr("A2_", (*iter).first.first, (*iter).first.second).c_str());
00064 }
00065 ofstream vfile("mxpoisson_ex.gar.v");
00066 vfile << ar; vfile.close();
00067 if(!compare_archives("mxpoisson_ex.gar.v", "mxpoisson_ex.gar.r")) {
00068 cerr << "Failure!" << endl;
00069 return -1;
00070 }
00071
00072 return 0;
00073
00074
00075 }
00076