|
SyFi
0.3
|
#include <Polygon.h>
Public Member Functions | |
| Line (const std::string &subscript="") | |
| Line (GiNaC::ex x0, GiNaC::ex x1, const std::string &subscript="") | |
| Line (const Line &line) | |
| virtual | ~Line () |
| virtual unsigned int | no_space_dim () const |
| GiNaC::ex | a () const |
| GiNaC::ex | b () const |
| virtual GiNaC::ex | repr (Repr_format format=SUBS_PERFORMED) const |
| virtual GiNaC::ex | repr (GiNaC::ex t, Repr_format format=SUBS_PERFORMED) const |
| virtual const std::string | str () const |
| virtual GiNaC::ex | integrate (GiNaC::ex f, Repr_format format=SUBS_PERFORMED) |
| virtual Line * | copy () const |
Protected Attributes | |
| GiNaC::ex | a_ |
| GiNaC::ex | b_ |
| SyFi::Line::Line | ( | const std::string & | subscript = "" | ) | [inline] |
| SyFi::Line::Line | ( | GiNaC::ex | x0, |
| GiNaC::ex | x1, | ||
| const std::string & | subscript = "" |
||
| ) |
| SyFi::Line::Line | ( | const Line & | line | ) |
| virtual SyFi::Line::~Line | ( | ) | [inline, virtual] |
| ex SyFi::Line::a | ( | ) | const |
Definition at line 135 of file Polygon.cpp.
References a_.
Referenced by integrate().
{
return a_;
}
| ex SyFi::Line::b | ( | ) | const |
Definition at line 140 of file Polygon.cpp.
References b_.
Referenced by integrate().
{
return b_;
}
| Line * SyFi::Line::copy | ( | ) | const [virtual] |
Implements SyFi::Polygon.
Reimplemented in SyFi::ReferenceLine.
Definition at line 362 of file Polygon.cpp.
References Line().
Referenced by SyFi::SpaceTimeDomain::SpaceTimeDomain().
{
return new Line(*this);
}
| ex SyFi::Line::integrate | ( | GiNaC::ex | f, |
| Repr_format | format = SUBS_PERFORMED |
||
| ) | [virtual] |
Implements SyFi::Polygon.
Reimplemented in SyFi::ReferenceLine.
Definition at line 242 of file Polygon.cpp.
References a(), b(), test_syfi::debug::c, SyFi::Polygon::p, repr(), SyFi::sub(), SyFi::SUBS_NOT_PERFORMED, SyFi::SUBS_PERFORMED, SyFi::t, and SyFi::x.
Referenced by SyFi::CrouzeixRaviart::compute_basis_functions(), SyFi::Nedelec::compute_basis_functions(), SyFi::RaviartThomas::compute_basis_functions(), SyFi::Robust::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), SyFi::SpaceTimeDomain::integrate(), and main().
{
ex ret;
if ( format == SUBS_PERFORMED)
{
GiNaC::symbol t("t");
ex t_repr = repr(t);
lst sub;
int counter=0;
// perform substitution
if ( p[0].nops() == 3)
{
sub = lst(t_repr.op(0), t_repr.op(1), t_repr.op(2));
counter = 3;
}
else if ( p[0].nops() == 2)
{
sub = lst(t_repr.op(0), t_repr.op(1));
counter = 2;
}
else if ( p[0].nops() == 1)
{
sub = lst(t_repr.op(0));
counter = 1;
}
else if ( p[0].nops() == 0)
{
sub = lst(t_repr.op(0));
counter = 1;
}
// compute D
ex D;
if ( p[0].nops() == 3)
{
D = pow(t_repr.op(0).rhs().coeff(t), 2) +
pow(t_repr.op(1).rhs().coeff(t), 2) +
pow(t_repr.op(2).rhs().coeff(t), 2);
}
else if ( p[0].nops() == 2)
{
D = pow(t_repr.op(0).rhs().coeff(t), 2) +
pow(t_repr.op(1).rhs().coeff(t), 2);
}
else if ( p[0].nops() == 1)
{
D = pow(t_repr.op(0).rhs().coeff(t), 2);
}
else if ( p[0].nops() == 0)
{
D = pow(t_repr.op(0).rhs().coeff(t), 2);
}
D = sqrt(D);
ex intf = f.subs(sub)*D;
intf = GiNaC::integral(t_repr.op(counter).op(0), t_repr.op(counter).op(1), t_repr.op(counter).op(2), intf);
ret = eval_integ(intf);
}
else if ( format == SUBS_NOT_PERFORMED )
{
GiNaC::symbol t("t");
ex t_repr = repr(t);
lst sub;
GiNaC::symbol a("a"), b("b"), c("c"), D("D");
int counter=0;
// perform substitution
if ( p[0].nops() == 3)
{
x == p[0].op(0) + a*t,
// sub = lst(t_repr.op(0), t_repr.op(1), t_repr.op(2));
sub = lst( x == p[0].op(0) + a*t,
y == p[0].op(1) + b*t,
z == p[0].op(2) + c*t);
counter = 3;
}
else if ( p[0].nops() == 2)
{
// sub = lst(t_repr.op(0), t_repr.op(1));
sub = lst( x == p[0].op(0) + a*t,
y == p[0].op(1) + b*t);
counter = 2;
}
// compute D
ex DD;
if ( p[0].nops() == 3)
{
DD = pow(t_repr.op(0).rhs().coeff(t), 2) +
pow(t_repr.op(1).rhs().coeff(t), 2) +
pow(t_repr.op(2).rhs().coeff(t), 2);
}
else if ( p[0].nops() == 2)
{
DD = pow(t_repr.op(0).rhs().coeff(t), 2) +
pow(t_repr.op(1).rhs().coeff(t), 2);
}
DD = sqrt(DD);
ex intf = f.subs(sub);
intf = GiNaC::integral(t_repr.op(counter).op(0), t_repr.op(counter).op(1), t_repr.op(counter).op(2), intf);
intf = eval_integ(intf);
ret = intf*D;
}
else
{
throw std::runtime_error("Invalid format!");
}
return ret;
}
| unsigned int SyFi::Line::no_space_dim | ( | ) | const [virtual] |
| ex SyFi::Line::repr | ( | Repr_format | format = SUBS_PERFORMED | ) | const [virtual] |
Implements SyFi::Polygon.
Definition at line 145 of file Polygon.cpp.
Referenced by SyFi::Nedelec::compute_basis_functions(), SyFi::Robust::compute_basis_functions(), SyFi::Robust::compute_basis_functions_old(), integrate(), main(), SyFi::SpaceTimeDomain::repr(), SyFi::Triangle::repr(), and SyFi::Tetrahedron::repr().
{
return repr(GiNaC::symbol("t"), format);
}
| virtual GiNaC::ex SyFi::Line::repr | ( | GiNaC::ex | t, |
| Repr_format | format = SUBS_PERFORMED |
||
| ) | const [virtual] |
Reimplemented in SyFi::ReferenceLine.
| const string SyFi::Line::str | ( | ) | const [virtual] |
Implements SyFi::Polygon.
Reimplemented in SyFi::ReferenceLine.
Definition at line 233 of file Polygon.cpp.
{
std::ostringstream s;
// s <<"Line("<<p[0]<<","<<p[1]<<")";
// FIXME: would like to use the above code, but this causes a strange crash in Python
s <<"Line";
return s.str();
}
GiNaC::ex SyFi::Line::a_ [protected] |
GiNaC::ex SyFi::Line::b_ [protected] |