Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Search for

# Tetrahedron Class Reference

`#include <Polygon.h>`

Inheritance diagram for Tetrahedron:

List of all members.

## Public Member Functions
| Tetrahedron (string subscript)
| Tetrahedron (GiNaC::ex x0, GiNaC::ex x1, GiNaC::ex x1, GiNaC::ex x2, string subscript="")
virtual | ~Tetrahedron ()
virtual int | no_vertices ()
virtual GiNaC::ex | vertex (int i)
virtual Line | line (int i)
virtual Triangle | triangle (int i)
virtual GiNaC::ex | repr (Repr_format format=SUBS_PERFORMED)
virtual string | str ()
virtual GiNaC::ex | integrate (GiNaC::ex f, Repr_format format=SUBS_PERFORMED)

## Detailed Description

Definition at line 142 of file Polygon.h.

## Constructor & Destructor Documentation

Tetrahedron::Tetrahedron | ( | string | subscript | ) | `[inline]`

| Definition at line 144 of file Polygon.h.
    00144 {}

Tetrahedron::Tetrahedron | ( | GiNaC::ex | x0,
|  | GiNaC::ex | x1,
|  | GiNaC::ex | x1,
|  | GiNaC::ex | x2,
|  | string | subscript = `""`
| ) |

| Definition at line 703 of file Polygon.cpp. References Polygon::p, and Polygon::subscript.
    00703                                                                                            {
    00704   subscript = subscript_;
    00705   p.insert(p.end(), x0);
    00706   p.insert(p.end(), x1);
    00707   p.insert(p.end(), x2);
    00708   p.insert(p.end(), x3);
    00709
    00710 }

virtual Tetrahedron::~Tetrahedron | ( |  | ) | `[inline, virtual]`

| Definition at line 146 of file Polygon.h.
    00146 {}

## Member Function Documentation

GiNaC::ex Tetrahedron::integrate | ( | GiNaC::ex | f,
|  | Repr_format | format = `SUBS_PERFORMED`
| ) | `[virtual]`

| Reimplemented from Polygon. Reimplemented in ReferenceTetrahedron. Definition at line 774 of file Polygon.cpp. References DUMMY, Polygon::p, repr(), SUBS_NOT_PERFORMED, SUBS_PERFORMED, x, y, and z. Referenced by RaviartThomas::compute_basis_functions(), Nedelec::compute_basis_functions(), and main().
    00774                                                                 {
    00775   if ( format == SUBS_PERFORMED ) {
    00776     GiNaC::ex t_repr = repr();
    00777
    00778     //perform substitution
    00779     GiNaC::lst sub = GiNaC::lst(t_repr.op(0), t_repr.op(1), t_repr.op(2));
    00780     GiNaC::ex intf = func.subs(sub);
    00781
    00782     // compute D
    00783     GiNaC::ex D;
    00784     GiNaC::ex r = t_repr.op(3).op(0);
    00785     GiNaC::ex s = t_repr.op(4).op(0);
    00786     GiNaC::ex t = t_repr.op(5).op(0);
    00787     GiNaC::ex a = t_repr.op(0).rhs().coeff(r,1);
    00788     GiNaC::ex b = t_repr.op(0).rhs().coeff(s,1);
    00789     GiNaC::ex c = t_repr.op(0).rhs().coeff(t,1);
    00790     GiNaC::ex d = t_repr.op(1).rhs().coeff(r,1);
    00791     GiNaC::ex e = t_repr.op(1).rhs().coeff(s,1);
    00792     GiNaC::ex f = t_repr.op(1).rhs().coeff(t,1);
    00793     GiNaC::ex g = t_repr.op(2).rhs().coeff(r,1);
    00794     GiNaC::ex h = t_repr.op(2).rhs().coeff(s,1);
    00795     GiNaC::ex k = t_repr.op(2).rhs().coeff(t,1);
    00796
    00797     D = a*(e*k-f*h) - b*(d*k-f*g) + c*(d*h - g*e);
    00798
    00799     intf = intf*D;
    00800
    00801     intf = GiNaC::integral(t_repr.op(5).op(0), t_repr.op(5).op(1), t_repr.op(5).op(2), intf);
    00802     intf = GiNaC::eval_integ(intf);
    00803
    00804     intf = GiNaC::integral(t_repr.op(4).op(0), t_repr.op(4).op(1), t_repr.op(4).op(2), intf);
    00805     intf = GiNaC::eval_integ(intf);
    00806
    00807     intf = GiNaC::integral(t_repr.op(3).op(0), t_repr.op(3).op(1), t_repr.op(3).op(2), intf);
    00808     intf = GiNaC::eval_integ(intf);
    00809
    00810     return intf;
    00811   } else if ( format == SUBS_NOT_PERFORMED ) {
    00812     GiNaC::ex t_repr = repr();
    00813
    00814     GiNaC::symbol a("a"), b("b"), c("c"), d("d"), e("e"), f("f"), g("g"), h("h"), k("k"), D("D");
    00815     GiNaC::ex r = t_repr.op(3).op(0);
    00816     GiNaC::ex s = t_repr.op(4).op(0);
    00817     GiNaC::ex t = t_repr.op(5).op(0);
    00818
    00819     //perform substitution
    00820 //    GiNaC::lst sub = GiNaC::lst(t_repr.op(0), t_repr.op(1), t_repr.op(2));
    00821     GiNaC::ex sub = GiNaC::lst(x == p[0].op(0) + a*r + b*s + c*t,
    00822                      y == p[0].op(1) + d*r + e*s + f*t,
    00823                      z == p[0].op(2) + g*r + h*s + k*t);
    00824
    00825     GiNaC::ex intf = func.subs(sub);
    00826
    00827     intf = GiNaC::integral(t_repr.op(5).op(0), t_repr.op(5).op(1), t_repr.op(5).op(2), intf);
    00828     intf = GiNaC::eval_integ(intf);
    00829
    00830     intf = GiNaC::integral(t_repr.op(4).op(0), t_repr.op(4).op(1), t_repr.op(4).op(2), intf);
    00831     intf = GiNaC::eval_integ(intf);
    00832
    00833     intf = GiNaC::integral(t_repr.op(3).op(0), t_repr.op(3).op(1), t_repr.op(3).op(2), intf);
    00834     intf = GiNaC::eval_integ(intf);
    00835
    00836     intf = intf*D;
    00837
    00838     return intf;
    00839
    00840   }
    00841   return DUMMY;
    00842 }

Line Tetrahedron::line | ( | int | i | ) | `[virtual]`

| Reimplemented in ReferenceTetrahedron. Definition at line 718 of file Polygon.cpp. References istr(), Polygon::p, and Polygon::subscript. Referenced by Nedelec::compute_basis_functions(), ReferenceTetrahedron::line(), and repr().
    00718                              {
    00719   int i0, i1;
    00720   if ( i == 1 ) {
    00721     i0 = 0; i1 = 1;
    00722   } else if ( i == 2 ) {
    00723     i0 = 0; i1 = 2;
    00724   } else if ( i == 3 )  {
    00725     i0 = 0; i1 = 3;
    00726   } else if ( i == 4 )  {
    00727     i0 = 1; i1 = 2;
    00728   } else if ( i == 5 )  {
    00729     i0 = 1; i1 = 3;
    00730   } else if ( i == 6 )  {
    00731     i0 = 2; i1 = 3;
    00732   }
    00733   Line l = Line(p[i0], p[i1], istr(subscript,i));
    00734   return l;
    00735 }

int Tetrahedron::no_vertices | ( |  | ) | `[virtual]`

| Reimplemented from Polygon. Reimplemented in ReferenceTetrahedron. Definition at line 712 of file Polygon.cpp.
    00712 {return 4; }

GiNaC::ex Tetrahedron::repr | ( | Repr_format | format = `SUBS_PERFORMED` | ) | `[virtual]`

| Reimplemented in ReferenceTetrahedron. Definition at line 750 of file Polygon.cpp. References line(), Line::repr(), x, y, and z. Referenced by integrate(), and main().
    00750                                              {
    00751    GiNaC::symbol r("r"), s("s"), t("t");
    00752    GiNaC::ex l1_repr = line(1).repr(r);
    00753    GiNaC::ex l2_repr = line(2).repr(s);
    00754    GiNaC::ex l3_repr = line(3).repr(t);
    00755    GiNaC::lst ret;
    00756
    00757
    00758    ret = GiNaC::lst(
    00759        x == l1_repr.op(0).rhs().coeff(r,0)   + l1_repr.op(0).rhs().coeff(r,1)*r
    00760          +  l2_repr.op(0).rhs().coeff(s,1)*s + l3_repr.op(0).rhs().coeff(t,1)*t,
    00761        y == l1_repr.op(1).rhs().coeff(r,0)   + l1_repr.op(1).rhs().coeff(r,1)*r
    00762          +  l2_repr.op(1).rhs().coeff(s,1)*s + l3_repr.op(1).rhs().coeff(t,1)*t,
    00763        z == l1_repr.op(2).rhs().coeff(r,0)   + l1_repr.op(1).rhs().coeff(r,1)*r
    00764          +  l2_repr.op(2).rhs().coeff(s,1)*s + l3_repr.op(2).rhs().coeff(t,1)*t);
    00765
    00766
    00767    ret.append(GiNaC::lst(r, 0, 1));
    00768    ret.append(GiNaC::lst(s, 0, 1 - r));
    00769    ret.append(GiNaC::lst(t, 0, 1 - r - s));
    00770
    00771    return ret;
    00772 }

string Tetrahedron::str | ( |  | ) | `[virtual]`

| Reimplemented from Polygon. Reimplemented in ReferenceTetrahedron. Definition at line 742 of file Polygon.cpp.
    00742                          {
    00743    std::ostringstream s;
    00744 //   s <<"Tetrahedron("<<p[0]<<","<<p[1]<<","<<p[2]<<","<<p[3]<<")";
    00745    s <<"Tetrahedron";
    00746    return s.str();
    00747 }

Triangle Tetrahedron::triangle | ( | int | i | ) | `[virtual]`

| Reimplemented in ReferenceTetrahedron. Definition at line 737 of file Polygon.cpp. References istr(), Polygon::p, and Polygon::subscript. Referenced by RaviartThomas::compute_basis_functions(), Nedelec::compute_basis_functions(), CrouzeixRaviart::compute_basis_functions(), normal(), and ReferenceTetrahedron::triangle().
    00737                                       {
    00738   Triangle t = Triangle(p[i%4], p[(i+1)%4], p[(i+2)%4], istr(subscript,i));
    00739   return t;
    00740 }

GiNaC::ex Tetrahedron::vertex | ( | int | i | ) | `[virtual]`

| Reimplemented from Polygon. Reimplemented in ReferenceTetrahedron. Definition at line 714 of file Polygon.cpp. References Polygon::p. Referenced by bezier_ordinates(), and ReferenceTetrahedron::vertex().
    00714                                   {
    00715   return p[i];
    00716 }

The documentation for this class was generated from the following files:

- Polygon.h
- Polygon.cpp