dof_ex.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 Triangle t1(lst(0,0), lst(1,0), lst(0,1));
00014 Triangle t2(lst(1,1), lst(1,0), lst(0,1));
00015
00016
00017
00018 int order = 2;
00019 Lagrange fe;
00020 fe.set_order(order);
00021 fe.set_polygon(t1);
00022 fe.compute_basis_functions();
00023 for (unsigned int i=0; i< fe.nbf() ; i++) {
00024 cout <<"fe.dof("<<i<<")= "<<fe.dof(i)<<endl;
00025
00026 dof.insert_dof(1,i, fe.dof(i));
00027 }
00028
00029
00030
00031 fe.set_polygon(t2);
00032 fe.compute_basis_functions();
00033 for (unsigned int i=0; i< fe.nbf() ; i++) {
00034 cout <<"fe.dof("<<i<<")= "<<fe.dof(i)<<endl;
00035
00036 dof.insert_dof(2,i, fe.dof(i));
00037 }
00038
00039
00040
00041 vector<pair<unsigned int,unsigned int> > vec;
00042 pair<unsigned int,unsigned int> index;
00043 ex exdof;
00044 for (unsigned int i=0; i< dof.size(); i++) {
00045 exdof = dof.glob_dof(i);
00046 vec = dof.glob2loc(i);
00047 cout <<"global dof " <<i<<" dof "<<exdof<<endl;
00048 for (unsigned int j=0; j<vec.size(); j++) {
00049 index = vec[j];
00050 cout <<" element "<<index.first<<" local dof "<<index.second<<endl;
00051 }
00052 }
00053 }
00054
00055
00056