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

# fe_ex2.cpp

Go to the documentation of this file.

    00001 #include <SyFi.h>
    00002
    00003 using namespace GiNaC;
    00004
    00005 int main() {
    00006   Triangle T(lst(0,0), lst(1,0), lst(0,1), "t");
    00007   int order = 2;
    00008
    00009   std::map<std::pair<int,int>, ex> A;
    00010   std::pair<int,int> index;
    00011   LagrangeFE fe;
    00012   fe.set(order);
    00013   fe.set(T);
    00014   fe.compute_basis_functions();
    00015   for (int i=0; i< fe.nbf() ; i++) {
    00016     index.first = i;
    00017     for (int j=0; j< fe.nbf() ; j++) {
    00018       index.second = j;
    00019       ex nabla = inner(grad(fe.N(i)), grad(fe.N(j)));
    00020       ex Aij = T.integrate(nabla);
    00021       A[index] = Aij;
    00022     }
    00023   }
    00024
    00025   map<std::pair<int,int>,ex>::iterator iter;
    00026   for (iter = A.begin(); iter != A.end() ; iter++) {
    00027       ex intf = (*iter).second;
    00028       cout <<"A["<<(*iter).first.first<<","<<(*iter).first.second<<"]="<<(*iter).second<<endl;
    00029   }
    00030
    00031
    00032
    00033 }
    00034
    00035
    00036