SyFi
0.3
|
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 VectorCrouzeixRaviart v_fe; 00015 v_fe.set_size(2); 00016 v_fe.set_polygon(domain); 00017 v_fe.compute_basis_functions(); 00018 00019 P0 p_fe; 00020 p_fe.set_polygon(domain); 00021 p_fe.compute_basis_functions(); 00022 00023 usage(v_fe, p_fe); 00024 00025 00026 Dof dof; 00027 std::map<std::pair<unsigned int,unsigned int>, ex> A; 00028 compute_Stokes_element_matrix(v_fe, p_fe, dof, A); 00029 print(A); 00030 00031 00032 // regression test 00033 00034 archive ar; 00035 for (unsigned int i=0; i<v_fe.nbf(); i++) { 00036 ar.archive_ex(v_fe.N(i), istr("vN",i).c_str()); 00037 } 00038 for (unsigned int i=0; i<p_fe.nbf(); i++) { 00039 ar.archive_ex(p_fe.N(i), istr("pN",i).c_str()); 00040 } 00041 00042 std::map<std::pair<unsigned int,unsigned int>, ex>::iterator iter; 00043 for (iter = A.begin(); iter != A.end() ; iter++) { 00044 ar.archive_ex((*iter).second, istr("A", (*iter).first.first, (*iter).first.second).c_str()); 00045 } 00046 00047 ofstream vfile("crouzeixraviart_ex2.gar.v"); 00048 vfile << ar; vfile.close(); 00049 if(!compare_archives("crouzeixraviart_ex2.gar.v", "crouzeixraviart_ex2.gar.r")) { 00050 cerr << "Failure!" << endl; 00051 return -1; 00052 } 00053 00054 return 0; 00055 } 00056