dof_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 4 of file dof_ex.cpp.

References LagrangeFE::compute_basis_functions(), LagrangeFE::dof(), Dof::glob2loc(), Dof::glob_dof(), Dof::insert_dof(), LagrangeFE::nbf(), LagrangeFE::set(), and Dof::size().

00004            { 
00005 
00006   Dof dof; 
00007 
00008   Triangle t1(lst(0.0,0.0), lst(1.0,0.0), lst(0.0,1.0)); 
00009   Triangle t2(lst(1,1), lst(1,0), lst(0,1)); 
00010 
00011   // Create a finite element and corresponding 
00012   // degrees of freedom on the first triangle
00013   int order = 2; 
00014   LagrangeFE fe; 
00015   fe.set(order); 
00016   fe.set(t1); 
00017   fe.compute_basis_functions(); 
00018   for (int i=1; i<= fe.nbf() ; i++) {
00019     cout <<"fe.dof("<<i<<")= "<<fe.dof(i)<<endl;  
00020     // insert local dof in global set of dofs   
00021     dof.insert_dof(1,i, fe.dof(i)); 
00022   }
00023 
00024   // Create a finite element and corresponding 
00025   // degrees of freedom on the second triangle
00026   fe.set(t2); 
00027   fe.compute_basis_functions(); 
00028   for (int i=1; i<= fe.nbf() ; i++) {
00029     cout <<"fe.dof("<<i<<")= "<<fe.dof(i)<<endl; 
00030     // insert local dof in global set of dofs   
00031     dof.insert_dof(2,i, fe.dof(i)); 
00032   }
00033 
00034   // Print out the global degrees of freedom an their 
00035   // corresponding local degrees of freedom 
00036   vector<pair<int,int> > vec; 
00037   pair<int,int> index; 
00038   ex exdof; 
00039   for (int i=1; i<= dof.size(); i++) {
00040     exdof = dof.glob_dof(i); 
00041     vec = dof.glob2loc(i);
00042     cout <<"global dof " <<i<<" dof "<<exdof<<endl; 
00043     for (int j=0; j<vec.size(); j++) { 
00044       index = vec[j]; 
00045       cout <<"  element "<<index.first<<" local dof "<<index.second<<endl; 
00046     }
00047   }
00048 
00049 
00050 
00051 }


Generated on Tue Nov 22 11:10:23 2005 for SyFi by  doxygen 1.4.4