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

References SyFi::Dof::glob2loc(), SyFi::Dof::glob_dof(), SyFi::initSyFi(), SyFi::Dof::insert_dof(), SyFi::Line::integrate(), SyFi::Triangle::line(), SyFi::pol(), and SyFi::Dof::size().

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


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