SyFi  0.3
dof_ex3.cpp
Go to the documentation of this file.
00001 #include <SyFi.h>
00002 #include <Dof_Ptv.h>
00003 
00004 //double Ptv::tolerance = 0.0001; 
00005 
00006 
00007 using namespace SyFi; 
00008 using namespace std; 
00009 
00010 int main() {
00011 
00012 
00013     Dof_Ptv dof(true,true); 
00014 
00015     // initialization of Ptv used as dof 
00016     double x[2];
00017     x[0] = 0.0; x[1] = 0.0;  
00018     Ptv p(2,x); 
00019 
00020 
00021     // first triangle 
00022     p[0] = 0.0; p[1] = 0.0;  
00023     dof.insert_dof(0,1,p); 
00024 
00025     p[0] = 1.0; p[1] = 0.0;  
00026     dof.insert_dof(0,2,p); 
00027 
00028     p[0] = 0.0; p[1] = 1.0;  
00029     dof.insert_dof(0,3,p); 
00030 
00031     // second triangle 
00032     p[0] = 1.0; p[1] = 1.0;  
00033     dof.insert_dof(1,1,p); 
00034 
00035     p[0] = 1.0; p[1] = 0.0;  
00036     dof.insert_dof(1,2,p); 
00037 
00038     p[0] = 0.0; p[1] = 1.0;  
00039     dof.insert_dof(1,3,p); 
00040 
00041 
00042 
00043     // print out the global dofs
00044     // and their corresponding local dofs
00045 
00046     vector_ii vec; 
00047     pair<unsigned int,unsigned int> index; 
00048     Ptv exdof; 
00049     for (int i=0; i< dof.size(); i++) {
00050         exdof = dof.glob_dof(i); 
00051         cout <<"global dof " <<i<<" dof "<<exdof<<endl; 
00052 //        vec = dof.glob2loc(i);
00053         for (unsigned int j=0; j<vec.size(); j++) { 
00054             index = vec[j]; 
00055             cout <<"  element "<<index.first<<" local dof "<<index.second<<endl; 
00056         }
00057     }
00058 }
00059 
00060 
00061 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator