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

# dof_ex2.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 dof_ex2.cpp. References Dof::glob2loc(), Dof::glob_dof(), Dof::insert_dof(), Line::integrate(), Triangle::line(), pol(), and Dof::size().
    00005            {
    00006
    00007   Dof dof;
    00008
    00009   // create two triangles
    00010   Triangle t1(lst(0,0), lst(1,0), lst(0,1));
    00011   Triangle t2(lst(1,1), lst(1,0), lst(0,1));
    00012
    00013   // create the polynomial space
    00014   ex Nj = pol(1,2,"a");
    00015   cout <<"Nj " <<Nj<<endl;
    00016   Line line;
    00017   ex   dofi;
    00018
    00019   // dofs on first triangle
    00020   for (int i=1; i<= 3; i++) {
    00021     line = t1.line(i);         // pick out the i'th line
    00022     dofi = line.integrate(Nj); // create the dof which is a line integral
    00023     dof.insert_dof(1,i, dofi); // insert local dof in global set of dofs
    00024   }
    00025
    00026   // dofs on second triangle
    00027   for (int i=1; i<= 3; i++) {
    00028     line = t2.line(i);         // pick out the i'th line
    00029     dofi = line.integrate(Nj); // create the dof which is a line integral
    00030     dof.insert_dof(2,i, dofi); // insert local dof in global set of dofs
    00031   }
    00032
    00033   // Print out the global degrees of freedom an their
    00034   // corresponding local degrees of freedom
    00035   vector<pair<int,int> > vec;
    00036   pair<int,int> index;
    00037   ex exdof;
    00038   for (int i=1; i<= dof.size(); i++) {
    00039     exdof = dof.glob_dof(i);
    00040     vec = dof.glob2loc(i);
    00041     cout <<"global dof " <<i<<" dof "<<exdof<<endl;
    00042     for (int j=0; j<vec.size(); j++) {
    00043       index = vec[j];
    00044       cout <<"  element "<<index.first<<" local dof "<<index.second<<endl;
    00045     }
    00046   }
    00047
    00048
    00049 }