Tetrahedron Class Reference

#include <Polygon.h>

Inheritance diagram for Tetrahedron:

Polygon ReferenceTetrahedron 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="")
 ~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 115 of file Polygon.h.


Constructor & Destructor Documentation

Tetrahedron::Tetrahedron string  subscript  )  [inline]
 

Definition at line 117 of file Polygon.h.

00117 {}

Tetrahedron::Tetrahedron GiNaC::ex  x0,
GiNaC::ex  x1,
GiNaC::ex  x1,
GiNaC::ex  x2,
string  subscript = ""
 

Definition at line 426 of file Polygon.cpp.

References Polygon::p, and Polygon::subscript.

00426                                                                                            { 
00427   subscript = subscript_; 
00428   p.insert(p.end(), x0); 
00429   p.insert(p.end(), x1); 
00430   p.insert(p.end(), x2); 
00431   p.insert(p.end(), x3); 
00432 
00433 }

Tetrahedron::~Tetrahedron  )  [inline]
 

Definition at line 119 of file Polygon.h.

00119 {}


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 497 of file Polygon.cpp.

References repr().

Referenced by RaviartThomas::compute_basis_functions(), and main().

00497                                                                 {
00498   GiNaC::ex t_repr = repr(); 
00499 
00500   //perform substitution
00501   GiNaC::lst sub = GiNaC::lst(t_repr.op(0), t_repr.op(1), t_repr.op(2));  
00502   GiNaC::ex intf = func.subs(sub); 
00503 
00504   // compute D 
00505   GiNaC::ex D; 
00506   GiNaC::ex r = t_repr.op(3).op(0); 
00507   GiNaC::ex s = t_repr.op(4).op(0); 
00508   GiNaC::ex t = t_repr.op(5).op(0); 
00509   GiNaC::ex a = t_repr.op(0).rhs().coeff(r,1); 
00510   GiNaC::ex b = t_repr.op(0).rhs().coeff(s,1); 
00511   GiNaC::ex c = t_repr.op(0).rhs().coeff(t,1); 
00512   GiNaC::ex d = t_repr.op(1).rhs().coeff(r,1); 
00513   GiNaC::ex e = t_repr.op(1).rhs().coeff(s,1); 
00514   GiNaC::ex f = t_repr.op(1).rhs().coeff(t,1); 
00515   GiNaC::ex g = t_repr.op(2).rhs().coeff(r,1); 
00516   GiNaC::ex h = t_repr.op(2).rhs().coeff(s,1); 
00517   GiNaC::ex k = t_repr.op(2).rhs().coeff(t,1); 
00518 
00519   D = a*(e*k-f*h) - b*(d*k-f*g) + c*(d*h - g*e); 
00520 
00521   intf = intf*D; 
00522 
00523   intf = GiNaC::integral(t_repr.op(5).op(0), t_repr.op(5).op(1), t_repr.op(5).op(2), intf);  
00524   intf = GiNaC::eval_integ(intf); 
00525 
00526   intf = GiNaC::integral(t_repr.op(4).op(0), t_repr.op(4).op(1), t_repr.op(4).op(2), intf);  
00527   intf = GiNaC::eval_integ(intf); 
00528 
00529   intf = GiNaC::integral(t_repr.op(3).op(0), t_repr.op(3).op(1), t_repr.op(3).op(2), intf);  
00530   intf = GiNaC::eval_integ(intf); 
00531 
00532   return intf; 
00533 }

Line Tetrahedron::line int  i  )  [virtual]
 

Reimplemented in ReferenceTetrahedron.

Definition at line 441 of file Polygon.cpp.

References istr(), Polygon::p, and Polygon::subscript.

Referenced by ReferenceTetrahedron::line(), and repr().

00441                              {
00442   int i0, i1; 
00443   if ( i == 1 ) {
00444     i0 = 0; i1 = 1;  
00445   } else if ( i == 2 ) { 
00446     i0 = 0; i1 = 2;  
00447   } else if ( i == 3 )  { 
00448     i0 = 0; i1 = 3;  
00449   } else if ( i == 4 )  { 
00450     i0 = 1; i1 = 2;  
00451   } else if ( i == 5 )  { 
00452     i0 = 1; i1 = 3;  
00453   } else if ( i == 6 )  { 
00454     i0 = 2; i1 = 3;  
00455   }
00456   Line l = Line(p[i0], p[i1], istr(subscript,i)); 
00457   return l; 
00458 }

int Tetrahedron::no_vertices  )  [virtual]
 

Reimplemented from Polygon.

Reimplemented in ReferenceTetrahedron.

Definition at line 435 of file Polygon.cpp.

00435 {return 4; }

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

Reimplemented in ReferenceTetrahedron.

Definition at line 473 of file Polygon.cpp.

References line(), Line::repr(), x, y, and z.

Referenced by integrate(), and main().

00473                                              {
00474    GiNaC::symbol r("r"), s("s"), t("t"); 
00475    GiNaC::ex l1_repr = line(1).repr(r); 
00476    GiNaC::ex l2_repr = line(2).repr(s); 
00477    GiNaC::ex l3_repr = line(3).repr(t); 
00478    GiNaC::lst ret; 
00479 
00480 
00481    ret = GiNaC::lst( 
00482        x == l1_repr.op(0).rhs().coeff(r,0)   + l1_repr.op(0).rhs().coeff(r,1)*r 
00483          +  l2_repr.op(0).rhs().coeff(s,1)*s + l3_repr.op(0).rhs().coeff(t,1)*t,  
00484        y == l1_repr.op(1).rhs().coeff(r,0)   + l1_repr.op(1).rhs().coeff(r,1)*r 
00485          +  l2_repr.op(1).rhs().coeff(s,1)*s + l3_repr.op(1).rhs().coeff(t,1)*t,  
00486        z == l1_repr.op(2).rhs().coeff(r,0)   + l1_repr.op(1).rhs().coeff(r,1)*r  
00487          +  l2_repr.op(2).rhs().coeff(s,1)*s + l3_repr.op(2).rhs().coeff(t,1)*t);   
00488 
00489 
00490    ret.append(GiNaC::lst(r, 0, 1)); 
00491    ret.append(GiNaC::lst(s, 0, 1 - r)); 
00492    ret.append(GiNaC::lst(t, 0, 1 - r - s)); 
00493 
00494    return ret; 
00495 }

string Tetrahedron::str  )  [virtual]
 

Reimplemented from Polygon.

Reimplemented in ReferenceTetrahedron.

Definition at line 465 of file Polygon.cpp.

00465                          {
00466    std::ostringstream s; 
00467 //   s <<"Tetrahedron("<<p[0]<<","<<p[1]<<","<<p[2]<<","<<p[3]<<")"; 
00468    s <<"Tetrahedron";
00469    return s.str(); 
00470 }

Triangle Tetrahedron::triangle int  i  )  [virtual]
 

Reimplemented in ReferenceTetrahedron.

Definition at line 460 of file Polygon.cpp.

References istr(), Polygon::p, and Polygon::subscript.

Referenced by RaviartThomas::compute_basis_functions(), CrouzeixRaviart::compute_basis_functions(), normal(), and ReferenceTetrahedron::triangle().

00460                                       {
00461   Triangle t = Triangle(p[i%4], p[(i+1)%4], p[(i+2)%4], istr(subscript,i)); 
00462   return t; 
00463 }

GiNaC::ex Tetrahedron::vertex int  i  )  [virtual]
 

Reimplemented from Polygon.

Reimplemented in ReferenceTetrahedron.

Definition at line 437 of file Polygon.cpp.

References Polygon::p.

Referenced by bezier_ordinates(), and ReferenceTetrahedron::vertex().

00437                                   {
00438   return p[i]; 
00439 }


The documentation for this class was generated from the following files:
Generated on Mon Jan 9 18:08:09 2006 for SyFi by  doxygen 1.4.4