SG++-Doxygen-Documentation
|
This class provides a simple-to-use solver of the multi dimensional Heat Equation that uses Sparse Grids. More...
#include <HeatEquationSolverWithStretching.hpp>
Public Member Functions | |
void | constructGrid (sgpp::base::Stretching &myStretching, size_t level) |
void | constructGrid (sgpp::base::BoundingBox &myStretching, size_t level) |
Use this routine the construct a regular grid to solve a PDE. More... | |
HeatEquationSolverWithStretching () | |
Std-Constructor of the solver. More... | |
void | initGridWithSmoothHeat (sgpp::base::DataVector &alpha, double mu, double sigma, double factor) |
Inits the grid in the middle of the whole domain with one single heat. More... | |
void | initScreen () |
Inits the grid with a constant heat. More... | |
void | printGrid (sgpp::base::DataVector &alpha, size_t PointesPerDimension, std::string tfilename) const |
This is some kind of debug functionality. More... | |
void | printGridDomain (sgpp::base::DataVector &alpha, size_t PointesPerDimension, sgpp::base::BoundingBox &GridArea, std::string tfilename) const |
This function is a placeholder, is not used. More... | |
void | printGridDomainStretching (sgpp::base::DataVector &alpha, size_t PointesPerDimension, sgpp::base::Stretching &GridArea, std::string tfilename) const |
This is some kind of debug functionality. More... | |
void | printSparseGrid (sgpp::base::DataVector &alpha, std::string tfilename, bool bSurplus) const |
Prints the sgpp::base::Grid Points of the Sparse sgpp::base::Grid either with their node basis value or their hierarchical surplus. More... | |
void | printSparseGridExpTransform (sgpp::base::DataVector &alpha, std::string tfilename, bool bSurplus) const |
Prints the sgpp::base::Grid Points of the Sparse sgpp::base::Grid either with their node basis value or their hierarchical surplus. More... | |
void | setHeatCoefficient (double a) |
This method sets the heat coefficient of the regarded material. More... | |
void | solveCrankNicolson (size_t numTimesteps, double timestepsize, size_t maxCGIterations, double epsilonCG, sgpp::base::DataVector &alpha, size_t NumImEul=0) |
Call this routine to use the Crank Nicolson algorithm to solve the parabolic PDE. More... | |
void | solveExplicitEuler (size_t numTimesteps, double timestepsize, size_t maxCGIterations, double epsilonCG, sgpp::base::DataVector &alpha, bool verbose=false, bool generateAnimation=false) |
Call this routine to use an explicit Euler algorithm to solve the parabolic PDE. More... | |
void | solveImplicitEuler (size_t numTimesteps, double timestepsize, size_t maxCGIterations, double epsilonCG, sgpp::base::DataVector &alpha, bool verbose=false, bool generateAnimation=false) |
Call this routine to use an explicit Euler algorithm to solve the parabolic PDE. More... | |
virtual | ~HeatEquationSolverWithStretching () |
Std-Destructor of the solver. More... | |
Public Member Functions inherited from sgpp::pde::ParabolicPDESolver | |
ParabolicPDESolver () | |
the size of one timestep More... | |
virtual | ~ParabolicPDESolver () |
Std-Destructor of the solver. More... | |
Public Member Functions inherited from sgpp::pde::PDESolver | |
void | coarsenInitialGridSurplus (sgpp::base::DataVector &alpha, double dThreshold) |
Coarsens a grid by taking the grid's coefficients into account. More... | |
void | deleteGrid () |
deletes the grid created within that solver More... | |
void | evaluateCuboid (sgpp::base::DataVector &alpha, sgpp::base::DataVector &FunctionValues, sgpp::base::DataMatrix &EvaluationPoints) |
Evaluates the sparse grid's function given by the stored grid and the alpha coefficients. More... | |
double | evaluatePoint (sgpp::base::DataVector &evalPoint, sgpp::base::DataVector &alpha) |
Determines the value of the function in the d-dimensional space. More... | |
std::string | getGrid () const |
gets the a string the describes the grid which is currently used to solve More... | |
size_t | getNumberDimensions () const |
use this the determine the number of dimensions that are currently used in the solver. More... | |
size_t | getNumberGridPoints () const |
use this to determine the number of grid points, used to solve the current problem More... | |
size_t | getNumberInnerGridPoints () const |
use this to determine the number of inner grid points, used to solve the current problem More... | |
PDESolver () | |
Std-Constructor of the solver. More... | |
virtual void | printLevelIndexGrid (std::string tfilename) const |
Prints the level,index pairs of the grid for each Gridpoint to a file. More... | |
void | refineInitialGridSurplus (sgpp::base::DataVector &alpha, int numRefinePoints, double dThreshold) |
Refines a grid by taking the grid's coefficients into account. More... | |
void | refineInitialGridSurplusSubDomain (sgpp::base::DataVector &alpha, int numRefinePoints, double dThreshold, std::vector< double > &norm_mu, std::vector< double > &norm_sigma) |
Refines a grid by taking the grid's coefficients into account. More... | |
void | refineInitialGridSurplusToMaxLevel (sgpp::base::DataVector &alpha, double dThreshold, sgpp::base::level_t maxLevel) |
Refines a grid by taking the grid's coefficients into account. More... | |
void | refineInitialGridSurplusToMaxLevelSubDomain (sgpp::base::DataVector &alpha, double dThreshold, sgpp::base::level_t maxLevel, std::vector< double > &norm_mu, std::vector< double > &norm_sigma) |
Refines a grid by taking the grid's coefficients into account. More... | |
void | setGrid (const std::string &serializedGrid) |
Sets the grid used in this BlackScholes Solver by an given serialized string of the grid. More... | |
virtual | ~PDESolver () |
Std-Destructor of the solver. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from sgpp::pde::PDESolver | |
virtual void | getGridNormalDistribution (sgpp::base::DataVector &alpha, std::vector< double > &norm_mu, std::vector< double > &norm_sigma) |
This function calculates for every grid point the value of a normal distribution given by norm_mu and norm_sigma. More... | |
Protected Attributes inherited from sgpp::pde::PDESolver | |
bool | bGridConstructed |
stores if the grid was created inside the solver More... | |
size_t | dim |
the dimension of the grid More... | |
int | levels |
the number of levels used for an regular grid More... | |
sgpp::base::BoundingBox * | myBoundingBox |
Stores Pointer to the sgpp::base::Grid's Bounding Box. More... | |
sgpp::base::Grid * | myGrid |
The Sparse sgpp::base::Grid needed in this classificator. More... | |
sgpp::base::GridStorage * | myGridStorage |
Stores Pointer to the Girs's Storage. More... | |
This class provides a simple-to-use solver of the multi dimensional Heat Equation that uses Sparse Grids.
The class's aim is, to hide all complex details of solving the Heat Equation with Sparse Grids!
sgpp::pde::HeatEquationSolverWithStretching::HeatEquationSolverWithStretching | ( | ) |
Std-Constructor of the solver.
References sgpp::pde::PDESolver::bGridConstructed.
|
virtual |
Std-Destructor of the solver.
void sgpp::pde::HeatEquationSolverWithStretching::constructGrid | ( | sgpp::base::Stretching & | myStretching, |
size_t | level | ||
) |
References sgpp::pde::PDESolver::bGridConstructed, sgpp::pde::PDESolver::dim, sgpp::base::BoundingBox::getDimension(), sgpp::base::Grid::getGenerator(), sgpp::base::Grid::getStorage(), sgpp::base::Grid::getStretching(), level, sgpp::pde::PDESolver::levels, sgpp::pde::PDESolver::myGrid, sgpp::pde::PDESolver::myGridStorage, and sgpp::base::GridGenerator::regular().
|
virtual |
Use this routine the construct a regular grid to solve a PDE.
myBoundingBox | reference to a bounding box that describes the grid |
level | number of the regular's grid levels |
Implements sgpp::pde::PDESolver.
void sgpp::pde::HeatEquationSolverWithStretching::initGridWithSmoothHeat | ( | sgpp::base::DataVector & | alpha, |
double | mu, | ||
double | sigma, | ||
double | factor | ||
) |
Inits the grid in the middle of the whole domain with one single heat.
alpha reference to the coefficients vector heat the value of the heat in the middle of the domain Inits the grid in the middle the domain with an smooth heat distribution that the normal distribution formula
alpha | reference to the coefficients vector |
mu | the exspected value of the normal distribution |
sigma | the sigma of the normal distribution |
factor | a factor that is used to stretch the function values |
References sgpp::pde::PDESolver::bGridConstructed, sgpp::op_factory::createOperationHierarchisation(), sgpp::pde::PDESolver::dim, sgpp::base::OperationHierarchisation::doHierarchisation(), sgpp::base::HashGridStorage::getCoordinates(), sgpp::base::HashGridStorage::getPoint(), sgpp::base::Grid::getSize(), python.statsfileInfo::i, python.utils.statsfile2gnuplot::j, mu, sgpp::pde::PDESolver::myGrid, sgpp::pde::PDESolver::myGridStorage, and analyse_erg::tmp.
void sgpp::pde::HeatEquationSolverWithStretching::initScreen | ( | ) |
Inits the grid with a constant heat.
alpha reference to the coefficients vector constHeat the temperature of the constant heat Inits the screen object
References sgpp::base::ScreenOutput::writeTitle().
|
virtual |
This is some kind of debug functionality.
It writes a file, that can be used with gnuplot the print the grid.
Is only implemented for 1D and 2D grids!
alpha | the coefficients of the Sparse Gird's basis functions |
PointesPerDimension | the distance between evaluation points |
tfilename | absolute path to file into which the grid's evaluation is written |
Reimplemented from sgpp::pde::PDESolver.
References sgpp::pde::PDESolver::myGrid, and sgpp::base::GridPrinterForStretching::printGrid().
|
virtual |
This function is a placeholder, is not used.
Reimplemented from sgpp::pde::PDESolver.
void sgpp::pde::HeatEquationSolverWithStretching::printGridDomainStretching | ( | sgpp::base::DataVector & | alpha, |
size_t | PointesPerDimension, | ||
sgpp::base::Stretching & | GridArea, | ||
std::string | tfilename | ||
) | const |
This is some kind of debug functionality.
It writes a file, that can be used with gnuplot the print the grid.
Is only implemented for 2D grids!
alpha | the coefficients of the Sparse Gird's basis functions |
PointesPerDimension | the distance between evaluation points |
GridArea | the area in which the function should be plotted |
tfilename | absolute path to file into which the grid's evaluation is written |
References sgpp::pde::PDESolver::myGrid, and sgpp::base::GridPrinterForStretching::printGridDomainStretching().
|
virtual |
Prints the sgpp::base::Grid Points of the Sparse sgpp::base::Grid either with their node basis value or their hierarchical surplus.
This function is available for all dimensions
alpha | the coefficients of the grid's ansatzfunctions |
tfilename | absoulte path to the file the grid is written into |
bSurplus | specifies whether the surplus (true) or the node basis value (false) is written |
Reimplemented from sgpp::pde::PDESolver.
References sgpp::pde::PDESolver::myGrid, and sgpp::base::GridPrinterForStretching::printSparseGrid().
|
virtual |
Prints the sgpp::base::Grid Points of the Sparse sgpp::base::Grid either with their node basis value or their hierarchical surplus.
This function is available for all dimensions.
The coordinates of the grid points are pushed the exp function. So log transformed grids can be plotted in cartesion coordinates.
alpha | the coefficients of the grid's ansatzfunctions |
tfilename | absoulte path to the file the grid is written into |
bSurplus | specifies whether the surplus (true) or the node basis value (false) is written |
Reimplemented from sgpp::pde::PDESolver.
References sgpp::pde::PDESolver::myGrid, and sgpp::base::GridPrinterForStretching::printSparseGridExpTransform().
void sgpp::pde::HeatEquationSolverWithStretching::setHeatCoefficient | ( | double | a | ) |
This method sets the heat coefficient of the regarded material.
a | the heat coefficient |
|
virtual |
Call this routine to use the Crank Nicolson algorithm to solve the parabolic PDE.
numTimesteps | the number of timesteps that should be executed |
timestepsize | the size of the interval one timestep moves forward |
maxCGIterations | the maximum of interation in the CG solver |
epsilonCG | the epsilon used in the CG |
alpha | the coefficients of the Sparse Gird's basis functions |
NumImEul | specifies how many ImEul steps should be executed before CrNic is used, default is 0 |
Implements sgpp::pde::ParabolicPDESolver.
References sgpp::pde::PDESolver::bGridConstructed, sgpp::pde::PDESolver::myGrid, sgpp::solver::CrankNicolson::solve(), sgpp::solver::Euler::solve(), sgpp::base::SGppStopwatch::start(), sgpp::base::SGppStopwatch::stop(), sgpp::base::ScreenOutput::writeEmptyLines(), and sgpp::base::ScreenOutput::writeStartSolve().
|
virtual |
Call this routine to use an explicit Euler algorithm to solve the parabolic PDE.
numTimesteps | the number of timesteps that should be executed |
timestepsize | the size of the interval one timestep moves forward |
maxCGIterations | the maximum of interation in the CG solver |
epsilonCG | the epsilon used in the CG |
alpha | the coefficients of the Sparse Gird's basis functions |
verbose | enables verbose output during solving |
generateAnimation | set this to true, if you want to generate a grid output in every timestep |
Implements sgpp::pde::ParabolicPDESolver.
References sgpp::pde::PDESolver::bGridConstructed, sgpp::pde::PDESolver::myGrid, sgpp::solver::Euler::solve(), sgpp::base::SGppStopwatch::start(), sgpp::base::SGppStopwatch::stop(), sgpp::base::ScreenOutput::writeEmptyLines(), and sgpp::base::ScreenOutput::writeStartSolve().
|
virtual |
Call this routine to use an explicit Euler algorithm to solve the parabolic PDE.
numTimesteps | the number of timesteps that should be executed |
timestepsize | the size of the interval one timestep moves forward |
maxCGIterations | the maximum of interation in the CG solver |
epsilonCG | the epsilon used in the CG |
alpha | the coefficients of the Sparse Gird's basis functions |
verbose | enables verbose output during solving |
generateAnimation | set this to true, if you want to generate a grid output in every timestep |
Implements sgpp::pde::ParabolicPDESolver.
References sgpp::pde::PDESolver::bGridConstructed, sgpp::pde::PDESolver::myGrid, sgpp::solver::Euler::solve(), sgpp::base::SGppStopwatch::start(), sgpp::base::SGppStopwatch::stop(), sgpp::base::ScreenOutput::writeEmptyLines(), and sgpp::base::ScreenOutput::writeStartSolve().