fe_ex4.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
00009
00010
00011
00012 int main(){
00013
00014 initSyFi(2);
00015
00016
00017 int order = 1;
00018 Triangle triangle(lst(0,0), lst(1,0), lst(0,1));
00019 Lagrange fe;
00020 fe.set_order(order);
00021 fe.set_polygon(triangle);
00022 fe.compute_basis_functions();
00023
00024 Dof dof;
00025 std::map<std::pair<unsigned int,unsigned int>, ex> A;
00026 compute_Poisson_element_matrix(fe, dof, A);
00027 print(A);
00028
00029
00030 symbol x0("x0", "x_0"), x1("x1", "x_1"), x2("x2", "x_2");
00031 symbol y0("y0", "y_0"), y1("y1", "y_1"), y2("y2", "y_2");
00032 Triangle triangle2(lst(x0,y0), lst(x1,y1), lst(x2,y2));
00033
00034 Lagrange fe2;
00035 fe2.set_order(order);
00036 fe2.set_polygon(triangle2);
00037 fe2.compute_basis_functions();
00038
00039 Dof dof2;
00040 std::map<std::pair<unsigned int,unsigned int>, ex> A2;
00041 compute_Poisson_element_matrix(fe2, dof2, A2);
00042
00043 cout <<"standard format on output"<<endl;
00044 print(A2);
00045 cout <<"LaTeX format on output "<<endl;
00046 cout <<latex;
00047 print(A2);
00048 cout <<"C code format on output "<<endl;
00049 cout <<csrc;
00050 print(A2);
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 return 0;
00073 }
00074
00075