SpectralMethod Class Reference

#include <SpectralMethod.hpp>

Inheritance diagram for SpectralMethod:

Inheritance graph
[legend]
Collaboration diagram for SpectralMethod:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void Discretize (ConstReferenceCounting< Problem > Pb)
void Compute (Solution &u)
const Problemproblem () const
const Meshmesh () const
 SpectralMethod (const DiscretizationType &discretizationType, ConstReferenceCounting< Mesh > M, const DegreeOfFreedomSet &dOfFreedom)
 ~SpectralMethod ()

Protected Attributes

DiscretizationType __discretizationType

Private Member Functions

void __discretizeOnConformingMesh ()
void __discretizeOnOctreeMesh ()
void __discretize ()

Private Attributes

ReferenceCounting< BaseMatrix__A
ReferenceCounting< BaseVector__b
ConstReferenceCounting< Mesh__mesh
ConstReferenceCounting< Problem__problem
const DegreeOfFreedomSet__degreeOfFreedomSet


Detailed Description

Definition at line 42 of file SpectralMethod.hpp.


Constructor & Destructor Documentation

SpectralMethod::SpectralMethod ( const DiscretizationType discretizationType,
ConstReferenceCounting< Mesh M,
const DegreeOfFreedomSet dOfFreedom 
)

Definition at line 180 of file SpectralMethod.cpp.

References StaticBase< SolverInformationCenter >::instance(), SolverInformationCenter::pushDiscretizationType(), and SolverInformationCenter::pushMesh().

00183   : Method(discretizationType),
00184     __mesh(mesh),
00185     __degreeOfFreedomSet(dOfFreedom)
00186 {
00187   SolverInformationCenter::instance().pushMesh(mesh);
00188   SolverInformationCenter::instance().pushDiscretizationType(&discretizationType);
00189 }

Here is the call graph for this function:

SpectralMethod::~SpectralMethod (  ) 

Definition at line 192 of file SpectralMethod.cpp.

References StaticBase< SolverInformationCenter >::instance(), and SolverInformationCenter::pop().

00193 {
00194   SolverInformationCenter::instance().pop();
00195 }

Here is the call graph for this function:


Member Function Documentation

void SpectralMethod::__discretizeOnConformingMesh (  )  [private]

Definition at line 46 of file SpectralMethod.cpp.

References __A, __b, __degreeOfFreedomSet, Method::__discretizationType, ffout(), StaticBase< ParameterCenter >::instance(), mesh(), problem(), MemoryManager::ReserveMatrix(), MemoryManager::ReserveVector(), ParameterCenter::set(), and DegreeOfFreedomSet::size().

Referenced by __discretize().

00047 {
00048   // overwritting memory matrix
00049   ParameterCenter::instance().set("memory::matrix","none");
00050 
00051   MemoryManager MM;
00052 
00053   MM.ReserveMatrix(__A,
00054                    problem().numberOfUnknown(),
00055                    __degreeOfFreedomSet.size());
00056 
00057   MM.ReserveVector(__b,
00058                    problem().numberOfUnknown(),
00059                    __degreeOfFreedomSet.size());
00060 
00061   ffout(2) << "Spectral method: disretization...\n";
00062 
00063   ReferenceCounting<SpectralLegendreDiscretizationConform> spectralMethod
00064     = new SpectralLegendreDiscretizationConform(problem(),
00065                                                 dynamic_cast<const SpectralMesh&>(mesh()),
00066                                                 *__A,*__b, __degreeOfFreedomSet,
00067                                                 __discretizationType);
00068 
00069   spectralMethod->assembleMatrix();
00070   spectralMethod->assembleSecondMember();
00071 
00072   ffout(2) << "- discretizing boundary conditions\n";
00073 
00074   ReferenceCounting<BoundaryConditionDiscretization> bcDiscretization
00075     = new BoundaryConditionDiscretizationSpectralConform(problem(),
00076                                                          dynamic_cast<const SpectralMesh&>(mesh()),
00077                                                          __degreeOfFreedomSet,
00078                                                          __discretizationType);
00079 
00080   ffout(2) << "- second member modification\n";
00081   bcDiscretization->setSecondMember(__A,__b);
00082 
00083   ffout(2) << "- matrix modification\n";
00084   bcDiscretization->setMatrix(__A,__b);
00085 
00086   ffout(2) << "Spectral method: disretization done\n";
00087 }

Here is the call graph for this function:

void SpectralMethod::__discretizeOnOctreeMesh (  )  [private]

Definition at line 91 of file SpectralMethod.cpp.

References __A, __b, __degreeOfFreedomSet, Method::__discretizationType, BoundaryConditionDiscretizationSpectralNonConform::associatesMeshesToBoundaryConditions(), ffout(), StaticBase< ParameterCenter >::instance(), mesh(), problem(), MemoryManager::ReserveMatrix(), MemoryManager::ReserveVector(), ParameterCenter::set(), and DegreeOfFreedomSet::size().

Referenced by __discretize().

00092 {
00093   // overwritting memory matrix
00094   ParameterCenter::instance().set("memory::matrix","none");
00095 
00096   MemoryManager MM;
00097   
00098   MM.ReserveMatrix(__A,
00099                    problem().numberOfUnknown(),
00100                    __degreeOfFreedomSet.size());
00101 
00102   MM.ReserveVector(__b,
00103                    problem().numberOfUnknown(),
00104                    __degreeOfFreedomSet.size());
00105 
00106   ffout(2) << "Spectral method: disretization...\n";
00107   
00108   ReferenceCounting<SpectralLegendreDiscretizationNonConform> spectralMethod
00109     = new SpectralLegendreDiscretizationNonConform(problem(),
00110                                                    dynamic_cast<const OctreeMesh&>(mesh()),
00111                                                    *__A,*__b, __degreeOfFreedomSet,
00112                                                    __discretizationType);
00113 
00114   spectralMethod->assembleMatrix();
00115   spectralMethod->assembleSecondMember();
00116 
00117   ffout(2) << "- discretizing boundary conditions\n";
00118 
00119   BoundaryConditionDiscretizationSpectralNonConform* bcd
00120     = new BoundaryConditionDiscretizationSpectralNonConform(problem(),
00121                                                             dynamic_cast<const OctreeMesh&>(mesh()),
00122                                                             __degreeOfFreedomSet,
00123                                                             __discretizationType);
00124   bcd->associatesMeshesToBoundaryConditions();
00125   ReferenceCounting<BoundaryConditionDiscretization> bcDiscretization = bcd;
00126 
00127   ffout(2) << "- second member modification\n";
00128   bcDiscretization->setSecondMember(__A,__b);
00129 
00130   ffout(2) << "- matrix modification\n";
00131   bcDiscretization->setMatrix(__A,__b);
00132 
00133   ffout(2) << "Spectral method: disretization done\n";
00134 }

Here is the call graph for this function:

void SpectralMethod::__discretize (  )  [private]

Definition at line 136 of file SpectralMethod.cpp.

References __discretizeOnConformingMesh(), __discretizeOnOctreeMesh(), mesh(), ErrorHandler::normal, Mesh::octreeMesh, and Mesh::spectralMesh.

Referenced by Discretize().

00137 {
00138   switch (mesh().type()) {
00139   case Mesh::spectralMesh: {
00140     this->__discretizeOnConformingMesh();
00141     break;
00142   }
00143   case Mesh::octreeMesh: {
00144     this->__discretizeOnOctreeMesh();
00145     break;
00146   }
00147   default: {
00148     throw ErrorHandler(__FILE__, __LINE__,
00149                        "Cannot use '"+mesh().typeName()+"' for spectral method computations",
00150                        ErrorHandler::normal);
00151   }
00152   }
00153 }

Here is the call graph for this function:

void SpectralMethod::Discretize ( ConstReferenceCounting< Problem Pb  )  [virtual]

Implements Method.

Definition at line 155 of file SpectralMethod.cpp.

References Method::__discretizationType, __discretize(), __problem, ErrorHandler::normal, and ScalarDiscretizationTypeBase::spectralLegendre.

00156 {
00157   __problem = Pb;
00158 
00159   switch(__discretizationType[0].type()) {
00160   case ScalarDiscretizationTypeBase::spectralLegendre: {
00161     this->__discretize();
00162     return;
00163   }
00164   default: {
00165     throw ErrorHandler(__FILE__,__LINE__,
00166                        "Discretization type not implemented",
00167                        ErrorHandler::normal);
00168   }
00169   }
00170 }

Here is the call graph for this function:

void SpectralMethod::Compute ( Solution u  )  [virtual]

Implements Method.

Definition at line 172 of file SpectralMethod.cpp.

References __A, __b, __degreeOfFreedomSet, problem(), KrylovSolver::solve(), and PDESolution::values().

00173 {
00174   PDESolution& u = static_cast<PDESolution&>(U);
00175   KrylovSolver K(*__A, *__b, __degreeOfFreedomSet);
00176   K.solve(problem(), u.values());
00177 }

Here is the call graph for this function:

const Problem& SpectralMethod::problem (  )  const [inline]

Definition at line 65 of file SpectralMethod.hpp.

References __problem.

Referenced by __discretizeOnConformingMesh(), __discretizeOnOctreeMesh(), and Compute().

00066   {
00067     return *__problem;
00068   }

const Mesh& SpectralMethod::mesh (  )  const [inline]

Definition at line 70 of file SpectralMethod.hpp.

References __mesh.

Referenced by __discretize(), __discretizeOnConformingMesh(), and __discretizeOnOctreeMesh().

00071   {
00072     return *__mesh;
00073   }


Member Data Documentation

Definition at line 49 of file SpectralMethod.hpp.

Referenced by mesh().

Definition at line 51 of file SpectralMethod.hpp.

Referenced by Discretize(), and problem().


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

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