#include <CrouzeixRaviart.h>
Public Member Functions | |
CrouzeixRaviart () | |
CrouzeixRaviart (Polygon &p, unsigned int order=1) | |
virtual | ~CrouzeixRaviart () |
void | compute_basis_functions () |
def | __init__ |
def | compute_basis_functions |
Public Attributes | |
this | |
Static Private Attributes | |
dictionary | __swig_setmethods__ = {} |
tuple | __setattr__ = lambdaself,name,value:_swig_setattr(self, CrouzeixRaviart, name, value) |
dictionary | __swig_getmethods__ = {} |
tuple | __getattr__ = lambdaself,name:_swig_getattr(self, CrouzeixRaviart, name) |
__repr__ = _swig_repr | |
__swig_destroy__ = _SyFi.delete_CrouzeixRaviart | |
__del__ = lambdaself:None; |
Proxy of C++ SyFi::CrouzeixRaviart class
Definition at line 12 of file CrouzeixRaviart.h.
SyFi::CrouzeixRaviart::CrouzeixRaviart | ( | ) |
Definition at line 15 of file CrouzeixRaviart.cpp.
References SyFi::StandardFE::order.
00015 : StandardFE() 00016 { 00017 order = 1; 00018 }
SyFi::CrouzeixRaviart::CrouzeixRaviart | ( | Polygon & | p, | |
unsigned int | order = 1 | |||
) |
Definition at line 20 of file CrouzeixRaviart.cpp.
References compute_basis_functions().
00020 : StandardFE(p, order) 00021 { 00022 compute_basis_functions(); 00023 }
virtual SyFi::CrouzeixRaviart::~CrouzeixRaviart | ( | ) | [inline, virtual] |
def SyFi::CrouzeixRaviart::__init__ | ( | self, | ||
args | ||||
) |
__init__(self) -> CrouzeixRaviart __init__(self, Polygon p, unsigned int order = 1) -> CrouzeixRaviart __init__(self, Polygon p) -> CrouzeixRaviart
Reimplemented from SyFi::StandardFE.
Definition at line 2275 of file SyFi.py.
02275 : 02276 """ 02277 __init__(self) -> CrouzeixRaviart 02278 __init__(self, Polygon p, unsigned int order = 1) -> CrouzeixRaviart 02279 __init__(self, Polygon p) -> CrouzeixRaviart 02280 """ 02281 this = _SyFi.new_CrouzeixRaviart(*args) 02282 try: self.this.append(this) 02283 except: self.this = this
def SyFi::CrouzeixRaviart::compute_basis_functions | ( | self | ) |
compute_basis_functions(self)
Reimplemented from SyFi::StandardFE.
Definition at line 2286 of file SyFi.py.
02286 : 02287 """compute_basis_functions(self)""" 02288 return _SyFi.CrouzeixRaviart_compute_basis_functions(self) 02289 CrouzeixRaviart_swigregister = _SyFi.CrouzeixRaviart_swigregister
void SyFi::CrouzeixRaviart::compute_basis_functions | ( | ) | [virtual] |
Reimplemented from SyFi::StandardFE.
Definition at line 25 of file CrouzeixRaviart.cpp.
References SyFi::bernstein(), SyFi::StandardFE::description, SyFi::dirac(), SyFi::StandardFE::dofs, SyFi::Line::integrate(), SyFi::Triangle::line(), SyFi::StandardFE::Ns, SyFi::StandardFE::order, SyFi::StandardFE::p, SyFi::Polygon::str(), SyFi::sub(), SyFi::t, demos::geom_test::tetrahedron, SyFi::Tetrahedron::triangle(), demos::crouzeixraviart::triangle, SyFi::Polygon::vertex(), SyFi::x, SyFi::y, and SyFi::z.
Referenced by check_CrouzeixRaviart(), SyFi::VectorCrouzeixRaviart::compute_basis_functions(), and CrouzeixRaviart().
00026 { 00027 00028 // remove previously computed basis functions and dofs 00029 Ns.clear(); 00030 dofs.clear(); 00031 00032 if ( p == NULL ) 00033 { 00034 throw(std::logic_error("You need to set a polygon before the basisfunctions can be computed")); 00035 } 00036 00037 if (order != 1) 00038 { 00039 throw(std::logic_error("Only Crouziex-Raviart elements of order 1 is possible")); 00040 } 00041 00042 // see e.g. Brezzi and Fortin book page 116 for the definition 00043 00044 if ( p->str().find("ReferenceLine") != string::npos ) 00045 { 00046 cout <<"Can not define the Raviart-Thomas element on a line"<<endl; 00047 } 00048 else if ( p->str().find("Triangle") != string::npos ) 00049 { 00050 00051 description = "CrouzeixRaviart_2D"; 00052 00053 Triangle& triangle = (Triangle&)(*p); 00054 00055 // create the polynomial space 00056 GiNaC::ex polynom_space = bernstein(1, triangle, "a"); 00057 GiNaC::ex polynom = polynom_space.op(0); 00058 GiNaC::lst variables = GiNaC::ex_to<GiNaC::lst>(polynom_space.op(1)); 00059 GiNaC::ex basis = polynom_space.op(2); 00060 00061 // create the dofs 00062 GiNaC::symbol t("t"); 00063 for (int j=0; j< 3; j++) 00064 { 00065 00066 // solve the linear system to compute 00067 // each of the basis functions 00068 GiNaC::lst equations; 00069 for (int i=0; i< 3; i++) 00070 { 00071 00072 Line line = triangle.line(i); 00073 // GiNaC::ex dofi = line.integrate(polynom); 00074 GiNaC::lst midpoint = GiNaC::lst( 00075 (line.vertex(0).op(0) + line.vertex(1).op(0))/2, 00076 (line.vertex(0).op(1) + line.vertex(1).op(1))/2); 00077 dofs.insert(dofs.end(), midpoint); 00078 00079 // GiNaC::ex dofi = polynom.subs( x == midpoint.op(0)).subs( y == midpoint.op(1)); 00080 GiNaC::ex dofi = line.integrate(polynom); 00081 equations.append( dofi == dirac(i,j)); 00082 00083 if (j == 1) 00084 { 00085 // GiNaC::lst d = GiNaC::lst(line.vertex(0) , line.vertex(1)); 00086 dofs.insert(dofs.end(), midpoint); 00087 } 00088 00089 } 00090 GiNaC::ex sub = lsolve(equations, variables); 00091 GiNaC::ex Ni = polynom.subs(sub); 00092 Ns.insert(Ns.end(),Ni); 00093 } 00094 00095 } 00096 else if ( p->str().find("Tetrahedron") != string::npos ) 00097 { 00098 00099 description = "CrouzeixRaviart_3D"; 00100 00101 Tetrahedron& tetrahedron = (Tetrahedron&)(*p); 00102 GiNaC::ex polynom_space = bernstein(1, tetrahedron, "a"); 00103 GiNaC::ex polynom = polynom_space.op(0); 00104 GiNaC::lst variables = GiNaC::ex_to<GiNaC::lst>(polynom_space.op(1)); 00105 GiNaC::ex basis = polynom_space.op(2); 00106 00107 GiNaC::ex bernstein_pol; 00108 00109 GiNaC::symbol t("t"); 00110 // dofs related to edges 00111 for (int j=0; j< 4; j++) 00112 { 00113 00114 GiNaC::lst equations; 00115 for (int i=0; i< 4; i++) 00116 { 00117 Triangle triangle = tetrahedron.triangle(i); 00118 GiNaC::lst midpoint = GiNaC::lst( 00119 (triangle.vertex(0).op(0) + triangle.vertex(1).op(0) + triangle.vertex(2).op(0))/3, 00120 (triangle.vertex(0).op(1) + triangle.vertex(1).op(1) + triangle.vertex(2).op(1))/3, 00121 (triangle.vertex(0).op(2) + triangle.vertex(1).op(2) + triangle.vertex(2).op(2))/3 00122 ); 00123 00124 GiNaC::ex dofi = polynom.subs(x == midpoint.op(0)).subs(y == midpoint.op(1)).subs(z == midpoint.op(2)); 00125 equations.append( dofi == dirac(i,j)); 00126 00127 if ( j == 1 ) 00128 { 00129 // GiNaC::lst d = GiNaC::lst(triangle.vertex(0), triangle.vertex(1), triangle.vertex(2)); 00130 dofs.insert(dofs.end(), midpoint); 00131 } 00132 } 00133 GiNaC::ex sub = lsolve(equations, variables); 00134 GiNaC::ex Ni = polynom.subs(sub); 00135 Ns.insert(Ns.end(),Ni); 00136 00137 } 00138 } 00139 }
SyFi::CrouzeixRaviart::__del__ = lambdaself:None; [static, private] |
tuple SyFi::CrouzeixRaviart::__getattr__ = lambdaself,name:_swig_getattr(self, CrouzeixRaviart, name) [static, private] |
SyFi::CrouzeixRaviart::__repr__ = _swig_repr [static, private] |
tuple SyFi::CrouzeixRaviart::__setattr__ = lambdaself,name,value:_swig_setattr(self, CrouzeixRaviart, name, value) [static, private] |
SyFi::CrouzeixRaviart::__swig_destroy__ = _SyFi.delete_CrouzeixRaviart [static, private] |
dictionary SyFi::CrouzeixRaviart::__swig_getmethods__ = {} [static, private] |
dictionary SyFi::CrouzeixRaviart::__swig_setmethods__ = {} [static, private] |