SpectralLegendreDiscretizationNonConform Class Reference

#include <SpectralLegendreDiscretizationNonConform.hpp>

Inheritance diagram for SpectralLegendreDiscretizationNonConform:

Inheritance graph
[legend]
Collaboration diagram for SpectralLegendreDiscretizationNonConform:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void assembleMatrix ()
void timesX (const BaseVector &u, BaseVector &v) const
void transposedTimesX (const BaseVector &u, BaseVector &v) const
void getDiagonal (BaseVector &z) const
void assembleSecondMember ()
 SpectralLegendreDiscretizationNonConform (const Problem &p, const OctreeMesh &m, BaseMatrix &a, BaseVector &bb, const DegreeOfFreedomSet &dof, const DiscretizationType &discretizationType)
 ~SpectralLegendreDiscretizationNonConform ()
void setDirichletList (const Vector< bool > &dirichletList)
const Problemproblem () const
BaseMatrixA ()
BaseVectorb ()

Protected Attributes

const Problem__problem
 The PDEProblem to discretize.
BaseMatrix__A
 The matrix which will contain the discretization.
BaseVector__b
 The second member.
const Vector< bool > * __dirichletList
 elimination dirichlet informations

Private Member Functions

ReferenceCounting
< SpectralLegendreDiscretizer
_getLocalDiscretizer (const CartesianHexahedron &h) const

Static Private Member Functions

static TinyVector< 3, size_t > _getQuadratureDegree (const DiscretizationType &discretizationType)

Private Attributes

const DegreeOfFreedomSet__degreeOfFreedomSet
const OctreeMesh__mesh
const DiscretizationType__discretizationType
const TinyVector< 3, size_t > __quadratureDegree


Detailed Description

Definition at line 41 of file SpectralLegendreDiscretizationNonConform.hpp.


Constructor & Destructor Documentation

SpectralLegendreDiscretizationNonConform::SpectralLegendreDiscretizationNonConform ( const Problem p,
const OctreeMesh m,
BaseMatrix a,
BaseVector bb,
const DegreeOfFreedomSet dof,
const DiscretizationType discretizationType 
) [inline]

Constructor of the discretization

Parameters:
p the problem
m the mesh used for discretization
a matrix storing discretization
bb vector that stores second member discretization
dof degrees of freedom set
discretizationType type of discretization

Definition at line 214 of file SpectralLegendreDiscretizationNonConform.hpp.

00220     : Discretization(discretizationType,
00221                      p, a, bb),
00222       __degreeOfFreedomSet(dof),
00223       __mesh(m),
00224       __discretizationType(discretizationType),
00225       __quadratureDegree(SpectralLegendreDiscretizationNonConform::_getQuadratureDegree(discretizationType))
00226   {
00227     ;
00228   }

SpectralLegendreDiscretizationNonConform::~SpectralLegendreDiscretizationNonConform (  )  [inline]

Destructor

Definition at line 234 of file SpectralLegendreDiscretizationNonConform.hpp.

00235   {
00236     ;
00237   }


Member Function Documentation

static TinyVector<3,size_t> SpectralLegendreDiscretizationNonConform::_getQuadratureDegree ( const DiscretizationType discretizationType  )  [inline, static, private]

Definition at line 53 of file SpectralLegendreDiscretizationNonConform.hpp.

References ASSERT, DiscretizationType::number(), and ScalarDiscretizationTypeBase::spectralLegendre.

00054   {
00055 #ifndef NDEBUG
00056     for (size_t i=0; i<discretizationType.number(); ++i) {
00057       ASSERT(discretizationType[i].type() == ScalarDiscretizationTypeBase::spectralLegendre);
00058     }
00059 #endif // NDEBUG
00060 
00061     TinyVector<3,size_t> quadratureDegree
00062       = dynamic_cast <const ScalarDiscretizationTypeSpectral&> (discretizationType[0]).degrees();
00063 
00064     for (size_t i=1; i<discretizationType.number(); ++i) {
00065       TinyVector<3,size_t> degree
00066         = dynamic_cast <const ScalarDiscretizationTypeSpectral&>(discretizationType[i]).degrees();
00067       for (size_t j=0; j<3; ++j) {
00068         quadratureDegree[j] = std::max(quadratureDegree[j], degree[j]);
00069       }
00070     }
00071 
00072     return quadratureDegree;
00073   }

Here is the call graph for this function:

ReferenceCounting<SpectralLegendreDiscretizer> SpectralLegendreDiscretizationNonConform::_getLocalDiscretizer ( const CartesianHexahedron h  )  const [inline, private]

Definition at line 76 of file SpectralLegendreDiscretizationNonConform.hpp.

References Discretization::__A, Discretization::__b, __degreeOfFreedomSet, __discretizationType, __quadratureDegree, Discretization::b(), and Discretization::problem().

Referenced by assembleSecondMember(), getDiagonal(), timesX(), and transposedTimesX().

00077   {
00078       const TinyVector<3,real_t>& a = h(0);
00079       const TinyVector<3,real_t>& b = h(6);
00080 
00081       Structured3DMeshShape s3dM(__quadratureDegree,a,b);
00082       ReferenceCounting<VerticesCorrespondance> correspondance
00083         = new VerticesCorrespondance((__quadratureDegree[0]+1)*
00084                                      (__quadratureDegree[1]+1)*
00085                                      (__quadratureDegree[2]+1));
00086 
00087       SpectralMesh quadratureMesh(s3dM,correspondance);
00088 
00089       return new SpectralLegendreDiscretizer(this->problem(),
00090                                              quadratureMesh,
00091                                              __A,
00092                                              __b,
00093                                              __degreeOfFreedomSet,
00094                                              __discretizationType);
00095   }

Here is the call graph for this function:

void SpectralLegendreDiscretizationNonConform::assembleMatrix (  )  [inline, virtual]

Assembles the matrix associated to the PDE operators of the PDE problem.

Implements Discretization.

Definition at line 103 of file SpectralLegendreDiscretizationNonConform.hpp.

References Discretization::__A, Discretization::A(), BaseMatrix::doubleHashedMatrix, UnAssembledMatrix::setDiscretization(), BaseMatrix::unAssembled, and ErrorHandler::unexpected.

00104   {
00105     switch ((this->__A).type()) {
00106     case BaseMatrix::doubleHashedMatrix: {
00107       throw ErrorHandler(__FILE__,__LINE__,
00108                          "Spectral Method cannot be used with assembled matrices",
00109                          ErrorHandler::unexpected);
00110     }
00111     case BaseMatrix::unAssembled: {
00112       UnAssembledMatrix& A = dynamic_cast<UnAssembledMatrix&>(this->__A);
00113       A.setDiscretization(this);
00114       break;
00115     }
00116     default: {
00117       throw ErrorHandler(__FILE__,__LINE__,
00118                          "unexpected matrix type",
00119                          ErrorHandler::unexpected);
00120     }
00121     }
00122   }

Here is the call graph for this function:

void SpectralLegendreDiscretizationNonConform::timesX ( const BaseVector u,
BaseVector v 
) const [inline, virtual]

Applies directly the operator discretization to the vector X.

Parameters:
u input vector
v $ v=Au $

Implements Discretization.

Definition at line 130 of file SpectralLegendreDiscretizationNonConform.hpp.

References __mesh, and _getLocalDiscretizer().

00131   {
00132     dynamic_cast<Vector<real_t>&>(v)=0;
00133     for (OctreeMesh::const_iterator icell(__mesh);
00134          not icell.end(); ++icell) {
00135       const CartesianHexahedron& h = *icell;
00136 
00137       this->_getLocalDiscretizer(h)->timesX(u,v);
00138     }
00139   }

Here is the call graph for this function:

void SpectralLegendreDiscretizationNonConform::transposedTimesX ( const BaseVector u,
BaseVector v 
) const [inline, virtual]

Applies directly the operator discretization to the vector X.

Parameters:
u input vector
v $ v=A^T u $

Implements Discretization.

Definition at line 147 of file SpectralLegendreDiscretizationNonConform.hpp.

References __mesh, and _getLocalDiscretizer().

00148   {
00149     dynamic_cast<Vector<real_t>&>(v) = 0;
00150     for (OctreeMesh::const_iterator icell(__mesh);
00151          not icell.end(); ++icell) {
00152       const CartesianHexahedron& h = *icell;
00153 
00154       this->_getLocalDiscretizer(h)->transposedTimesX(u,v);
00155     }
00156   }

Here is the call graph for this function:

void SpectralLegendreDiscretizationNonConform::getDiagonal ( BaseVector z  )  const [inline, virtual]

Computes diagonal of the operator

Parameters:
z diagonal of the operator

Implements Discretization.

Definition at line 163 of file SpectralLegendreDiscretizationNonConform.hpp.

References __mesh, and _getLocalDiscretizer().

00164   {
00165     dynamic_cast<Vector<real_t>&>(z)=0;
00166     for (OctreeMesh::const_iterator icell(__mesh);
00167          not icell.end(); ++icell) {
00168       const CartesianHexahedron& h = *icell;
00169 
00170       this->_getLocalDiscretizer(h)->getDiagonal(z);
00171     }
00172   }

Here is the call graph for this function:

void SpectralLegendreDiscretizationNonConform::assembleSecondMember (  )  [inline, virtual]

Second member assembling

The elementary vector

Implements Discretization.

Definition at line 178 of file SpectralLegendreDiscretizationNonConform.hpp.

References Discretization::__b, __mesh, _getLocalDiscretizer(), Discretization::b(), ffout(), Timer::start(), and Timer::stop().

00179   {
00180     Timer t;
00181     t.start();
00182     
00183     ffout(2) << "- assembling second member\n";
00184     
00186     Vector<real_t>& b = (static_cast<Vector<real_t>&>(this->__b));
00187     b = 0;
00188 
00189     for (OctreeMesh::const_iterator icell(__mesh);
00190          not icell.end(); ++icell) {
00191       const CartesianHexahedron& h = *icell;
00192 
00193       this->_getLocalDiscretizer(h)->assembleSecondMember();
00194     }
00195 
00196     ffout(2) << "- assembling second member: done";
00197     t.stop();
00198     ffout(3) << " [cost: " << t << ']';
00199     ffout(2) << '\n';
00200   }

Here is the call graph for this function:

void Discretization::setDirichletList ( const Vector< bool > &  dirichletList  )  [inline, inherited]

Sets dirichlet vertices list

Parameters:
dirichletList list of dirichlet vertices

Definition at line 63 of file Discretization.hpp.

References Discretization::__dirichletList, and ASSERT.

00064   {
00065     ASSERT(__dirichletList == 0);
00066     __dirichletList = &dirichletList;
00067   }

const Problem& Discretization::problem (  )  const [inline, inherited]

BaseMatrix& Discretization::A (  )  [inline, inherited]

Read only access to the discretization type

Returns:
__type Access to the matrix

__A

Definition at line 130 of file Discretization.hpp.

References Discretization::__A.

Referenced by assembleMatrix(), SpectralLegendreDiscretizationConform::assembleMatrix(), FEMDiscretization< Structured3DMesh, TypeOfDiscretization >::assembleMatrix(), and FEMDiscretization< GivenMeshType, TypeOfDiscretization >::assembleMatrix().

00131   {
00132     return __A;
00133   }

BaseVector& Discretization::b (  )  [inline, inherited]


Member Data Documentation

Definition at line 46 of file SpectralLegendreDiscretizationNonConform.hpp.

Referenced by _getLocalDiscretizer().

The full description of the discretization

Reimplemented from Discretization.

Definition at line 49 of file SpectralLegendreDiscretizationNonConform.hpp.

Referenced by _getLocalDiscretizer().

Definition at line 50 of file SpectralLegendreDiscretizationNonConform.hpp.

Referenced by _getLocalDiscretizer().

const Problem& Discretization::__problem [protected, inherited]

The PDEProblem to discretize.

Definition at line 46 of file Discretization.hpp.

Referenced by Discretization::problem().

BaseMatrix& Discretization::__A [protected, inherited]

BaseVector& Discretization::__b [protected, inherited]

const Vector<bool>* Discretization::__dirichletList [protected, inherited]


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

Generated on Wed Nov 19 00:14:50 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6