P0.cpp

Go to the documentation of this file.
00001 #include <P0.h>
00002 
00003 void P0:: compute_basis_functions() {
00004 
00005   if ( p == NULL ) {
00006     cout <<"You need to set a polygon before the basisfunctions can be computed"<<endl; 
00007     return; 
00008   }
00009  
00010   // insert basis function
00011   Ns.insert(Ns.end(), GiNaC::numeric(1)); 
00012 
00013   // create and insert dof
00014   GiNaC::lst midpoint = GiNaC::lst(); 
00015     for (int d=0; d< p->vertex(1).nops(); d++) {           
00016       midpoint.append(GiNaC::numeric(0)); 
00017     }
00018   for (int i=1; i<= p->no_vertices(); i++) {   
00019     for (int d=0; d< p->vertex(i-1).nops(); d++) {         
00020       midpoint.let_op(d)  += p->vertex(i-1).op(d);
00021     }
00022   }
00023 
00024   for (int d=0; d< p->vertex(1).nops(); d++) {     
00025     midpoint.let_op(d)  = midpoint.op(d)/p->no_vertices(); 
00026   }
00027 
00028   dofs.insert(dofs.end(), midpoint); 
00029 }

Generated on Wed Apr 19 12:38:13 2006 for SyFi by  doxygen 1.4.4