|
SyFi
0.3
|
#include <Bubble.h>
Public Member Functions | |
| Bubble () | |
| Bubble (Polygon &p, unsigned int order=3) | |
| virtual | ~Bubble () |
| virtual void | compute_basis_functions () |
Definition at line 29 of file Bubble.cpp.
References SyFi::StandardFE::description.
: StandardFE() { description = "Bubble"; }
| SyFi::Bubble::Bubble | ( | Polygon & | p, |
| unsigned int | order = 3 |
||
| ) |
Definition at line 34 of file Bubble.cpp.
References compute_basis_functions().
: StandardFE(p, order) { compute_basis_functions(); }
| virtual SyFi::Bubble::~Bubble | ( | ) | [inline, virtual] |
| void SyFi::Bubble::compute_basis_functions | ( | ) | [virtual] |
Reimplemented from SyFi::StandardFE.
Definition at line 39 of file Bubble.cpp.
References SyFi::barycenter_tetrahedron(), SyFi::barycenter_triangle(), SyFi::StandardFE::description, SyFi::StandardFE::dofs, SyFi::StandardFE::N(), SyFi::Polygon::no_vertices(), SyFi::StandardFE::Ns, SyFi::StandardFE::p, SyFi::Polygon::str(), SyFi::Polygon::vertex(), and SyFi::x.
Referenced by Bubble().
{
// 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"));
}
if ( p->str().find("ReferenceLine") != string::npos )
{
Ns.insert(Ns.end(), x*(1-x));
description = "Bubble_1D";
}
else if ( p->str().find("Triangle") != string::npos )
{
GiNaC::ex b = barycenter_triangle(p->vertex(0), p->vertex(1), p->vertex(2));
GiNaC::ex N = GiNaC::numeric(1);
for (unsigned int d=0; d< b.nops(); d++)
{
N = N*b.op(d).rhs();
}
Ns.insert(Ns.end(), N);
description = "Bubble_2D";
}
else if ( p->str().find("Tetrahedron") != string::npos )
{
GiNaC::ex b = barycenter_tetrahedron(p->vertex(0), p->vertex(1),
p->vertex(2), p->vertex(3));
GiNaC::ex N = GiNaC::numeric(1);
for (unsigned int d=0; d< b.nops(); d++)
{
N = N*b.op(d).rhs();
}
Ns.insert(Ns.end(), N);
description = "Bubble_3D";
}
// create and insert dof
GiNaC::lst midpoint = GiNaC::lst();
for (unsigned int d=0; d< p->vertex(1).nops(); d++)
{
midpoint.append(GiNaC::numeric(0));
}
for (unsigned int i=1; i<= p->no_vertices(); i++)
{
for (unsigned int d=0; d< p->vertex(i-1).nops(); d++)
{
midpoint.let_op(d) += p->vertex(i-1).op(d);
}
}
for (unsigned int d=0; d< p->vertex(1).nops(); d++)
{
midpoint.let_op(d) = midpoint.op(d)/p->no_vertices();
}
dofs.insert(dofs.end(), midpoint);
}