dof_ex2.cpp

Go to the documentation of this file.
00001 #include <SyFi.h>
00002 
00003 int main() { 
00004 
00005   Dof dof; 
00006 
00007   // create two triangles
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 the polynomial space
00012   ex Nj = pol(1,2,"a"); 
00013   cout <<"Nj " <<Nj<<endl; 
00014   Line line; 
00015   ex   dofi; 
00016 
00017   // dofs on first triangle
00018   for (int i=1; i<= 3; i++) {
00019     line = t1.line(i);         // pick out the i'th line 
00020     dofi = line.integrate(Nj); // create the dof which is a line integral 
00021     dof.insert_dof(1,i, dofi); // insert local dof in global set of dofs 
00022   }
00023 
00024   // dofs on second triangle
00025   for (int i=1; i<= 3; i++) {
00026     line = t2.line(i);         // pick out the i'th line
00027     dofi = line.integrate(Nj); // create the dof which is a line integral 
00028     dof.insert_dof(2,i, dofi); // insert local dof in global set of dofs 
00029   }
00030 
00031   // Print out the global degrees of freedom an their 
00032   // corresponding local degrees of freedom 
00033   vector<pair<int,int> > vec; 
00034   pair<int,int> index; 
00035   ex exdof; 
00036   for (int i=1; i<= dof.size(); i++) {
00037     exdof = dof.glob_dof(i); 
00038     vec = dof.glob2loc(i);
00039     cout <<"global dof " <<i<<" dof "<<exdof<<endl; 
00040     for (int j=0; j<vec.size(); j++) { 
00041       index = vec[j]; 
00042       cout <<"  element "<<index.first<<" local dof "<<index.second<<endl; 
00043     }
00044   }
00045 
00046 
00047 }
00048 
00049 
00050 

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