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