SyFi  0.3
dof_ex2.cpp
Go to the documentation of this file.
00001 #include <SyFi.h>
00002 
00003 using namespace GiNaC; 
00004 using namespace SyFi; 
00005 using namespace std; 
00006 
00007 int main() { 
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 }
00054 
00055 
00056 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator