SyFi
0.3
|
#include <P0.h>
Public Member Functions | |
P0 () | |
P0 (Polygon &p, unsigned int order=0) | |
virtual | ~P0 () |
virtual void | compute_basis_functions () |
SyFi::P0::P0 | ( | ) |
Definition at line 27 of file P0.cpp.
References SyFi::StandardFE::description.
: StandardFE() { description = "P0"; }
SyFi::P0::P0 | ( | Polygon & | p, |
unsigned int | order = 0 |
||
) |
Definition at line 32 of file P0.cpp.
References compute_basis_functions().
: StandardFE (p,order) { compute_basis_functions(); }
virtual SyFi::P0::~P0 | ( | ) | [inline, virtual] |
void SyFi::P0::compute_basis_functions | ( | ) | [virtual] |
Reimplemented from SyFi::StandardFE.
Definition at line 37 of file P0.cpp.
References SyFi::StandardFE::description, SyFi::StandardFE::dofs, SyFi::istr(), SyFi::Polygon::no_vertices(), SyFi::StandardFE::Ns, SyFi::StandardFE::p, and SyFi::Polygon::vertex().
Referenced by main(), and P0().
{ // remove previously computed basis functions and dofs Ns.clear(); dofs.clear(); if ( p == NULL ) { throw(std::logic_error("You need to set a polygon before the basisfunctions can be computed")); } // insert basis function Ns.insert(Ns.end(), GiNaC::numeric(1)); GiNaC::lst midpoint = GiNaC::lst(); // create and insert dof // p is a lst if (GiNaC::is_a<GiNaC::lst>(p->vertex(0))) { for (unsigned int d=0; d< p->vertex(1).nops(); d++) { midpoint.append(GiNaC::numeric(0)); } for (unsigned int i=0; i< p->no_vertices(); i++) { int nops; nops = p->vertex(i).nops(); for (int d=0; d< nops; d++) { midpoint.let_op(d) += p->vertex(i).op(d); } } for (unsigned int d=0; d< p->vertex(1).nops(); d++) { midpoint.let_op(d) = midpoint.op(d)/p->no_vertices(); } } else { midpoint.append(GiNaC::numeric(0)); for (unsigned int i=0; i< p->no_vertices(); i++) { midpoint.let_op(0) += p->vertex(i); } midpoint.let_op(0) = midpoint.op(0)/p->no_vertices(); } dofs.insert(dofs.end(), midpoint); description = istr("P0_" , midpoint.nops()) + "D"; }