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

# CrouzeixRaviart Class Reference

`#include <CrouzeixRaviart.h>`

Inheritance diagram for CrouzeixRaviart:

List of all members.

## Public Member Functions
| CrouzeixRaviart ()
virtual | ~CrouzeixRaviart ()
void | set (int order)
void | set (Polygon &p)
void | compute_basis_functions ()
virtual int | nbf ()
virtual GiNaC::ex | N (int i)
virtual GiNaC::ex | dof (int i)

## Detailed Description

Definition at line 8 of file CrouzeixRaviart.h.

## Constructor & Destructor Documentation

CrouzeixRaviart::CrouzeixRaviart | ( |  | ) |

| Definition at line 4 of file CrouzeixRaviart.cpp. References StandardFE::order.
    00004                                   : StandardFE() {
    00005   order = 1;
    00006 }

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

| Definition at line 11 of file CrouzeixRaviart.h.
    00011 {}

## Member Function Documentation

void CrouzeixRaviart::compute_basis_functions | ( |  | ) | `[virtual]`

| Reimplemented from StandardFE. Definition at line 13 of file CrouzeixRaviart.cpp. References bernstein(), dirac(), StandardFE::dofs, Triangle::integrate(), Line::integrate(), Triangle::line(), StandardFE::Ns, StandardFE::p, Polygon::str(), and Tetrahedron::triangle(). Referenced by check_CrouzeixRaviart(), and VectorCrouzeixRaviart::compute_basis_functions().
    00013                                                {
    00014
    00015   if ( p == NULL ) {
    00016     cout <<"You need to set a polygon before the basisfunctions can be computed"<<endl;
    00017     return;
    00018   }
    00019
    00020
    00021   // see e.g. Brezzi and Fortin book page 116 for the definition
    00022
    00023   if (p->str() == "ReferenceLine") {
    00024     cout <<"Can not define the Raviart-Thomas element on a line"<<endl;
    00025   } else if (p->str() == "ReferenceTriangle" || p->str() == "Triangle"  ) {
    00026     Triangle& triangle = (Triangle&)(*p);
    00027
    00028     // create the polynomial space
    00029     GiNaC::ex polynom_space = bernstein(1, triangle, "a");
    00030     GiNaC::ex polynom = polynom_space.op(0);
    00031     GiNaC::ex variables = polynom_space.op(1);
    00032     GiNaC::ex basis = polynom_space.op(2);
    00033
    00034     // create the dofs
    00035     int counter = 0;
    00036     GiNaC::symbol t("t");
    00037     for (int i=1; i<= 3; i++) {
    00038       Line line = triangle.line(i);
    00039       GiNaC::ex dofi = line.integrate(polynom);
    00040       dofs.insert(dofs.end(),dofi);
    00041     }
    00042
    00043     // solve the linear system to compute
    00044     // each of the basis functions
    00045     for (int i=1; i<= 3; i++) {
    00046       GiNaC::lst equations;
    00047       for (int j=1; j<= 3; j++) {
    00048         equations.append(dofs[j-1] == dirac(i,j));
    00049       }
    00050       GiNaC::ex sub = lsolve(equations, variables);
    00051       GiNaC::ex Ni = polynom.subs(sub);
    00052       Ns.insert(Ns.end(),Ni);
    00053     }
    00054
    00055   } else if ( p->str() == "ReferenceTetrahedron" ||  p->str() == "Tetrahedron" ) {
    00056     Tetrahedron& tetrahedron = (Tetrahedron&)(*p);
    00057     GiNaC::ex polynom_space = bernstein(1, tetrahedron, "a");
    00058     GiNaC::ex polynom = polynom_space.op(0);
    00059     GiNaC::ex variables = polynom_space.op(1);
    00060     GiNaC::ex basis = polynom_space.op(2);
    00061
    00062
    00063     GiNaC::ex bernstein_pol;
    00064
    00065     int counter = 0;
    00066     GiNaC::symbol t("t");
    00067     // dofs related to edges
    00068     for (int i=1; i<= 4; i++) {
    00069       Triangle triangle = tetrahedron.triangle(i);
    00070       GiNaC::ex dofi = triangle.integrate(polynom);
    00071       dofs.insert(dofs.end(),dofi);
    00072     }
    00073     for (int i=1; i<= 4; i++) {
    00074       GiNaC::lst equations;
    00075       for (int j=1; j<= 4; j++) {
    00076         equations.append(dofs[j-1] == dirac(i,j));
    00077       }
    00078       GiNaC::ex sub = lsolve(equations, variables);
    00079       GiNaC::ex Ni = polynom.subs(sub);
    00080       Ns.insert(Ns.end(),Ni);
    00081     }
    00082
    00083
    00084
    00085   }
    00086 }

GiNaC::ex CrouzeixRaviart::dof | ( | int | i | ) | `[virtual]`

| Reimplemented from StandardFE. Definition at line 101 of file CrouzeixRaviart.cpp. References StandardFE::dof(). Referenced by VectorCrouzeixRaviart::compute_basis_functions().
    00101                                    {
    00102   return StandardFE::dof(i);
    00103 }

GiNaC::ex CrouzeixRaviart::N | ( | int | i | ) | `[virtual]`

| Reimplemented from StandardFE. Definition at line 106 of file CrouzeixRaviart.cpp. References StandardFE::N(). Referenced by VectorCrouzeixRaviart::compute_basis_functions().
    00106                                 {
    00107   return StandardFE::N(i);
    00108 }

int CrouzeixRaviart::nbf | ( |  | ) | `[virtual]`

| Reimplemented from StandardFE. Definition at line 9 of file CrouzeixRaviart.cpp. References StandardFE::Ns. Referenced by VectorCrouzeixRaviart::compute_basis_functions().
    00009                           {
    00010   return Ns.size();
    00011 }

void CrouzeixRaviart::set | ( | Polygon & | p | ) | `[virtual]`

| Reimplemented from StandardFE. Definition at line 89 of file CrouzeixRaviart.cpp. References StandardFE::set().
    00089                                       {
    00090   StandardFE:: set(p_);
    00091 }

void CrouzeixRaviart::set | ( | int | order | ) | `[virtual]`

| Reimplemented from StandardFE. Definition at line 94 of file CrouzeixRaviart.cpp. Referenced by check_CrouzeixRaviart(), and VectorCrouzeixRaviart::compute_basis_functions().
    00094                                      {
    00095   if (order_ != 1) {
    00096     cout <<"Only Crouziex-Raviart elements of order 1 is possible"<<endl;
    00097   }
    00098 }

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

- CrouzeixRaviart.h
- CrouzeixRaviart.cpp