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

# dof_ex3.cpp File Reference

`#include <SyFi.h>`
`#include <ptv.h>`

Go to the source code of this file.

## Functions
int | main ()

## Function Documentation

int main | ( |  | ) |

| Definition at line 6 of file dof_ex3.cpp. References DofT< D, C >::glob2loc(), DofT< D, C >::glob_dof(), DofT< D, C >::insert_dof(), DofT< D, C >::size(), and x.
    00006            {
    00007
    00008   DofT<ptv,ptv_is_less> dof;
    00009
    00010   // initialization of ptv used as dof
    00011
    00012   // first triangle
    00013   double x[2];
    00014   x[0] = 0.0; x[1] = 0.0;
    00015   ptv p(2,x);
    00016   dof.insert_dof(1,1,p);
    00017
    00018   p[0] = 1.0; p[1] = 0.0;
    00019   dof.insert_dof(1,2,p);
    00020
    00021   p[0] = 0.0; p[1] = 1.0;
    00022   dof.insert_dof(1,3,p);
    00023
    00024   // second triangle
    00025   p[0] = 1.0; p[1] = 1.0;
    00026   dof.insert_dof(2,1,p);
    00027
    00028   p[0] = 1.0; p[1] = 0.0;
    00029   dof.insert_dof(2,2,p);
    00030
    00031   p[0] = 0.0; p[1] = 1.0;
    00032   dof.insert_dof(2,3,p);
    00033
    00034
    00035
    00036   // print out the global dofs
    00037   // and their corresponding local dofs
    00038
    00039   vector<pair<int,int> > vec;
    00040   pair<int,int> index;
    00041   ptv exdof;
    00042   for (int i=0; i< dof.size(); i++) {
    00043     exdof = dof.glob_dof(i);
    00044     cout <<"global dof " <<i<<" dof "<<exdof<<endl;
    00045     vec = dof.glob2loc(i);
    00046     for (int j=0; j<vec.size(); j++) {
    00047       index = vec[j];
    00048       cout <<"  element "<<index.first<<" local dof "<<index.second<<endl;
    00049     }
    00050   }
    00051 }