#include <SyFi.h>
Go to the source code of this file.
Functions | |
int | main () |
|
Definition at line 5 of file dof_ex.cpp. References LagrangeFE::compute_basis_functions(), LagrangeFE::dof(), Dof::glob2loc(), Dof::glob_dof(), Dof::insert_dof(), LagrangeFE::nbf(), LagrangeFE::set(), and Dof::size(). 00005 { 00006 00007 Dof dof; 00008 00009 Triangle t1(lst(0,0), lst(1,0), lst(0,1)); 00010 Triangle t2(lst(1,1), lst(1,0), lst(0,1)); 00011 00012 // Create a finite element and corresponding 00013 // degrees of freedom on the first triangle 00014 int order = 2; 00015 LagrangeFE fe; 00016 fe.set(order); 00017 fe.set(t1); 00018 fe.compute_basis_functions(); 00019 for (int i=1; i<= fe.nbf() ; i++) { 00020 cout <<"fe.dof("<<i<<")= "<<fe.dof(i)<<endl; 00021 // insert local dof in global set of dofs 00022 dof.insert_dof(1,i, fe.dof(i)); 00023 } 00024 00025 // Create a finite element and corresponding 00026 // degrees of freedom on the second triangle 00027 fe.set(t2); 00028 fe.compute_basis_functions(); 00029 for (int i=1; i<= fe.nbf() ; i++) { 00030 cout <<"fe.dof("<<i<<")= "<<fe.dof(i)<<endl; 00031 // insert local dof in global set of dofs 00032 dof.insert_dof(2,i, fe.dof(i)); 00033 } 00034 00035 // Print out the global degrees of freedom an their 00036 // corresponding local degrees of freedom 00037 vector<pair<int,int> > vec; 00038 pair<int,int> index; 00039 ex exdof; 00040 for (int i=1; i<= dof.size(); i++) { 00041 exdof = dof.glob_dof(i); 00042 vec = dof.glob2loc(i); 00043 cout <<"global dof " <<i<<" dof "<<exdof<<endl; 00044 for (int j=0; j<vec.size(); j++) { 00045 index = vec[j]; 00046 cout <<" element "<<index.first<<" local dof "<<index.second<<endl; 00047 } 00048 } 00049 00050 00051 00052 }
|