disconlagrange_ex.cpp

Go to the documentation of this file.
00001 #include <SyFi.h>
00002 
00003 using namespace GiNaC; 
00004 
00005 int main() {
00006   Dof dof; 
00007   // create two triangles
00008   Triangle t1(lst(0,0), lst(1,0), lst(0,1)); 
00009   Triangle t2(lst(1,1), lst(1,0), lst(0,1)); 
00010 
00011   int order = 2; 
00012 
00013   DiscontinuousLagrangeFE fe; 
00014   fe.set(order); 
00015   fe.set(t1); 
00016   fe.set_element_number(1); 
00017   fe.compute_basis_functions(); 
00018   usage(fe); 
00019   for (int i=1; i<= fe.nbf(); i++) {
00020     dof.insert_dof(1,i,fe.dof(i)); 
00021   }
00022 
00023   fe.set(t2); 
00024   fe.set_element_number(2); 
00025   fe.compute_basis_functions(); 
00026   usage(fe); 
00027   for (int i=1; i<= fe.nbf(); i++) {
00028     dof.insert_dof(2,i,fe.dof(i)); 
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 
00051 
00052 
00053 
00054 
00055 }

Generated on Mon Jan 9 18:08:08 2006 for SyFi by  doxygen 1.4.4