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

# disconlagrange_ex.cpp File Reference

`#include <SyFi.h>`

Go to the source code of this file.

## Functions
int | main ()

## Function Documentation

int main | ( |  | ) |

| Definition at line 5 of file disconlagrange_ex.cpp. References DiscontinuousLagrangeFE::compute_basis_functions(), DiscontinuousLagrangeFE::dof(), Dof::glob2loc(), Dof::glob_dof(), Dof::insert_dof(), DiscontinuousLagrangeFE::nbf(), DiscontinuousLagrangeFE::set(), DiscontinuousLagrangeFE::set_element_number(), Dof::size(), and usage().
    00005            {
    00006   Dof dof;
    00007   // create two triangles
    00008   Triangle t1(lst(0,0), lst(1,0), lst(0,1));
    00009   Triangle t2(lst(1,1), lst(1,0), lst(0,1));
    00010
    00011   int order = 2;
    00012
    00013   DiscontinuousLagrangeFE fe;
    00014   fe.set(order);
    00015   fe.set(t1);
    00016   fe.set_element_number(1);
    00017   fe.compute_basis_functions();
    00018   usage(fe);
    00019   for (int i=0; i< fe.nbf(); i++) {
    00020     dof.insert_dof(1,i,fe.dof(i));
    00021   }
    00022
    00023   fe.set(t2);
    00024   fe.set_element_number(2);
    00025   fe.compute_basis_functions();
    00026   usage(fe);
    00027   for (int i=0; i< fe.nbf(); i++) {
    00028     dof.insert_dof(2,i,fe.dof(i));
    00029   }
    00030
    00031   // Print out the global degrees of freedom an their
    00032   // corresponding local degrees of freedom
    00033   vector<pair<int,int> > vec;
    00034   pair<int,int> index;
    00035   ex exdof;
    00036   for (int i=0; i< dof.size(); i++) {
    00037     exdof = dof.glob_dof(i);
    00038     vec = dof.glob2loc(i);
    00039     cout <<"global dof " <<i<<" dof "<<exdof<<endl;
    00040     for (int j=0; j<vec.size(); j++) {
    00041       index = vec[j];
    00042       cout <<"  element "<<index.first<<" local dof "<<index.second<<endl;
    00043     }
    00044   }
    00045
    00046
    00047
    00048
    00049
    00050
    00051
    00052
    00053
    00054
    00055 }