SyFi
0.3
|
#include <Polygon.h>
Public Member Functions | |
Rectangle (GiNaC::ex p0, GiNaC::ex p1, const std::string &subscript="") | |
Rectangle (GiNaC::ex p0, GiNaC::ex p1, GiNaC::ex p2, GiNaC::ex p3, const std::string &subscript="") | |
Rectangle (const Rectangle &rectangle) | |
virtual | ~Rectangle () |
virtual unsigned int | no_space_dim () const |
virtual Line | line (unsigned int i) const |
virtual GiNaC::ex | repr (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 Rectangle * | copy () const |
Protected Member Functions | |
Rectangle (const std::string &subscript="") |
SyFi::Rectangle::Rectangle | ( | const std::string & | subscript = "" | ) | [protected] |
Referenced by copy().
SyFi::Rectangle::Rectangle | ( | GiNaC::ex | p0, |
GiNaC::ex | p1, | ||
const std::string & | subscript = "" |
||
) |
SyFi::Rectangle::Rectangle | ( | GiNaC::ex | p0, |
GiNaC::ex | p1, | ||
GiNaC::ex | p2, | ||
GiNaC::ex | p3, | ||
const std::string & | subscript = "" |
||
) |
SyFi::Rectangle::Rectangle | ( | const Rectangle & | rectangle | ) |
Definition at line 730 of file Polygon.cpp.
virtual SyFi::Rectangle::~Rectangle | ( | ) | [inline, virtual] |
Rectangle * SyFi::Rectangle::copy | ( | ) | const [virtual] |
Implements SyFi::Polygon.
Reimplemented in SyFi::ReferenceRectangle.
Definition at line 732 of file Polygon.cpp.
References Rectangle().
{ return new Rectangle(*this); }
ex SyFi::Rectangle::integrate | ( | GiNaC::ex | f, |
Repr_format | format = SUBS_PERFORMED |
||
) | [virtual] |
Implements SyFi::Polygon.
Definition at line 783 of file Polygon.cpp.
References SyFi::Polygon::p, repr(), and SyFi::sub().
Referenced by main().
{ unsigned int counter = 0; ex s_repr = repr(); lst sub; // perform substitution if ( p[0].nops() == 3) { sub = lst(s_repr.op(0), s_repr.op(1), s_repr.op(2)); counter = 3; } else if ( p[0].nops() == 2) { sub = lst(s_repr.op(0), s_repr.op(1)); counter = 2; } ex D; if ( p[0].nops() == 2) { D = ( p[2].op(0) - p[0].op(0)) *( p[2].op(1) - p[0].op(1)); } else if ( p[0].nops() == 3 ) { if ( p[2].op(0) == p[0].op(0) ) { D = ( p[2].op(1) - p[0].op(1)) *( p[2].op(2) - p[0].op(2)); } else if ( p[2].op(1) == p[0].op(1) ) { D = ( p[2].op(0) - p[0].op(0)) *( p[2].op(2) - p[0].op(2)); } else if ( p[2].op(2) == p[0].op(2) ) { D = ( p[2].op(0) - p[0].op(0)) *( p[2].op(1) - p[0].op(1)); } } ex intf = func.subs(sub); intf = intf*D; intf = GiNaC::integral(s_repr.op(counter).op(0), s_repr.op(counter).op(1), s_repr.op(counter).op(2), intf); intf = eval_integ(intf); counter++; intf = GiNaC::integral(s_repr.op(counter).op(0), s_repr.op(counter).op(1), s_repr.op(counter).op(2), intf); intf = eval_integ(intf); counter++; if ( counter < s_repr.nops() ) { intf = GiNaC::integral(s_repr.op(counter).op(0), s_repr.op(counter).op(1), s_repr.op(counter).op(2), intf); intf = eval_integ(intf); } return intf; }
Line SyFi::Rectangle::line | ( | unsigned int | i | ) | const [virtual] |
Reimplemented from SyFi::Polygon.
Definition at line 742 of file Polygon.cpp.
References SyFi::istr(), SyFi::Polygon::p, and SyFi::Polygon::subscript.
unsigned int SyFi::Rectangle::no_space_dim | ( | ) | const [virtual] |
ex SyFi::Rectangle::repr | ( | Repr_format | format = SUBS_PERFORMED | ) | const [virtual] |
Implements SyFi::Polygon.
Definition at line 752 of file Polygon.cpp.
References SyFi::Polygon::p, SyFi::t, and SyFi::x.
Referenced by integrate(), and main().
{ lst ret; GiNaC::symbol r("r"), s("s"), t("t"); if ( p[0].nops() == 2 ) { ret.append( x == p[0].op(0) + r*( p[2].op(0) - p[0].op(0))); ret.append( y == p[0].op(1) + s*( p[2].op(1) - p[0].op(1))); ret.append( lst(r,0,1) ); ret.append( lst(s,0,1) ); } else if ( p[0].nops() == 3 ) { ret.append( x == p[0].op(0) + r*( p[2].op(0) - p[0].op(0))); ret.append( y == p[0].op(1) + s*( p[2].op(1) - p[0].op(1))); ret.append( z == p[0].op(2) + t*( p[2].op(2) - p[0].op(2))); ret.append( lst(r,0,1) ); ret.append( lst(s,0,1) ); ret.append( lst(t,0,1) ); } return ret; }
const string SyFi::Rectangle::str | ( | ) | const [virtual] |
Implements SyFi::Polygon.
Reimplemented in SyFi::ReferenceRectangle.
Definition at line 775 of file Polygon.cpp.
{ std::ostringstream s; // s <<"Rectangle("<<p[0]<<","<<p[1]<<","<<p[2]<<","<<p[3]<<")"; s <<"Rectangle"; return s.str(); }