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

References SyFi::Lagrange::compute_basis_functions(), SyFi::StandardFE::dof(), demos::crouzeixraviart::fe, SyFi::Dof::glob2loc(), SyFi::Dof::glob_dof(), SyFi::initSyFi(), SyFi::Dof::insert_dof(), SyFi::StandardFE::nbf(), SyFi::StandardFE::set_order(), SyFi::StandardFE::set_polygon(), and SyFi::Dof::size().

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


Generated on Mon Aug 31 16:16:49 2009 for SyFi by  doxygen 1.5.9