Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Search for

# fe_ex4.cpp

Go to the documentation of this file.

    00001 #include <SyFi.h>
    00002
    00003 using namespace GiNaC;
    00004
    00005
    00006
    00007
    00008
    00009 int main(){
    00010   //matrix in terms of rational numbers
    00011   int order = 1;
    00012   Triangle triangle(lst(0,0), lst(1,0), lst(0,1));
    00013   LagrangeFE fe;
    00014   fe.set(order);
    00015   fe.set(triangle);
    00016   fe.compute_basis_functions();
    00017
    00018   Dof dof;
    00019   std::map<std::pair<int,int>, ex> A;
    00020   compute_Poisson_element_matrix(fe, dof, A);
    00021   print(A);
    00022
    00023   //matrix in terms of symbols
    00024   symbol x0("x0", "x_0"), x1("x1", "x_1"), x2("x2", "x_2");
    00025   symbol y0("y0", "y_0"), y1("y1", "y_1"), y2("y2", "y_2");
    00026   Triangle triangle2(lst(x0,y0), lst(x1,y1), lst(x2,y2));
    00027
    00028   LagrangeFE fe2;
    00029   fe2.set(order);
    00030   fe2.set(triangle2);
    00031   fe2.compute_basis_functions();
    00032
    00033   Dof dof2;
    00034   std::map<std::pair<int,int>, ex> A2;
    00035   compute_Poisson_element_matrix(fe2, dof2, A2);
    00036
    00037   cout <<"standard format on output"<<endl;
    00038   print(A2);
    00039   cout <<"LaTeX format on output "<<endl;
    00040   cout <<latex;
    00041   print(A2);
    00042   cout <<"C code format on output "<<endl;
    00043   cout <<csrc;
    00044   print(A2);
    00045
    00046
    00047 }
    00048
    00049