SG++-Doxygen-Documentation
sgpp::combigrid::WeightedRatioLevelManager Class Reference

This refinement criterion implements the one proposed by ´Gerstner and Griebel: Dimension-adaptive Tensor-Product Quadrature, p. More...

#include <WeightedRatioLevelManager.hpp>

Inheritance diagram for sgpp::combigrid::WeightedRatioLevelManager:
sgpp::combigrid::LevelManager

Public Member Functions

virtual std::shared_ptr< LevelManagerclone ()
 
 WeightedRatioLevelManager (double w=0.8)
 
 WeightedRatioLevelManager (std::shared_ptr< AbstractLevelEvaluator > levelEvaluator, double w=0.8)
 
virtual ~WeightedRatioLevelManager ()
 
- Public Member Functions inherited from sgpp::combigrid::LevelManager
void addLevel (MultiIndex const &level)
 Calls addLevel() on the underlying CombigridEvaluator. More...
 
virtual void addLevelsAdaptive (size_t maxNumPoints)
 Adds levels in an adaptive manner, such that the given maximum number of function evaluations (grid points) is not exceeded. More...
 
void addLevelsAdaptiveByNumLevels (size_t numLevels=1)
 Queue based addLevel-type function. More...
 
virtual void addLevelsAdaptiveParallel (size_t maxNumPoints, size_t numThreads)
 Does the same as addLevelsAdaptive(), but with parallel function evaluations. More...
 
void addLevelsFromSerializedStructure (std::string serializedStructure)
 Equivalent to deserializing serializedStructure and then calling addLevelsFromStructure(). More...
 
void addLevelsFromSerializedStructureParallel (std::string serializedStructure, size_t numThreads)
 Does the same as addLevelsFromSerializedStructure(), but with parallel precomputation of function values using numThreads threads. More...
 
void addLevelsFromStructure (std::shared_ptr< TreeStorage< uint8_t >> storage)
 Adds all levels for which an entry is contained in storage. More...
 
void addLevelsFromStructureParallel (std::shared_ptr< TreeStorage< uint8_t >> storage, size_t numThreads=4)
 Does the same as addLevelsFromStructure(), but with parallel precomputation of function values using numThreads threads. More...
 
void addRegularLevels (size_t q)
 
void addRegularLevelsByNumPoints (size_t maxNumPoints)
 Adds a set of level multi-indices. More...
 
void addRegularLevelsByNumPointsParallel (size_t maxNumPoints, size_t numThreads)
 Does the same as addRegularLevelsByNumPoints(), but with parallel precomputation of function values. More...
 
void addRegularLevelsParallel (size_t q, size_t numThreads)
 Does the same as addRegularLevels(), but with parallel precomputation of function values. More...
 
sgpp::base::DataMatrix convertLevelStructureToMatrix (std::shared_ptr< sgpp::combigrid::TreeStorage< uint8_t >> const &levelstructure, size_t numDims)
 writes a given level structure to a matrix More...
 
void disableStatsCollection ()
 Disables the collection of information on subspaces during refinement. More...
 
void enableStatsCollection ()
 Enables the collection of information on subspaces during refinement. More...
 
std::vector< base::DataVectorgetAllGridPoints ()
 
base::DataMatrix getGridPointMatrix ()
 
std::shared_ptr< LevelInfosgetInfoOnAddedLevels ()
 Returns information on all the subspaces that is sorted with respect to the iterations when they have been added to the combigrid during refinement. More...
 
std::shared_ptr< TreeStorage< uint8_t > > getLevelStructure () const
 
std::vector< MultiIndexgetRegularLevels (size_t q)
 
std::string getSerializedLevelStructure () const
 
size_t getUpperPointBound () const
 
 LevelManager (std::shared_ptr< AbstractLevelEvaluator > levelEvaluator, bool collectStats=true)
 Constructor. More...
 
 LevelManager ()
 Default constructor. More...
 
size_t maxNumPointsForRegular (size_t q)
 
virtual size_t numDims () const
 
size_t numGridPoints ()
 
void printLevelStructure (std::shared_ptr< sgpp::combigrid::TreeStorage< uint8_t >> const &levelstructure)
 prints a given level structure More...
 
void setLevelEvaluator (std::shared_ptr< AbstractLevelEvaluator > levelEvaluator)
 Sets the level evaluator (normally a CombigridEvaluator). More...
 
virtual ~LevelManager ()
 

Protected Member Functions

virtual double computePriority (MultiIndex const &level)
 By implementing this method in a derived class, the adaption can be customized. More...
 
- Protected Member Functions inherited from sgpp::combigrid::LevelManager
void addLevels (std::vector< MultiIndex > const &levels)
 Adds all the given levels. More...
 
bool addLevelToCombiEval (const MultiIndex &level)
 Adds the level to the combigrid evaluator. More...
 
void addStats (const MultiIndex &level)
 update stats for levels that have been added in the current iteration More...
 
virtual void addToQueue (MultiIndex const &level, std::shared_ptr< LevelInfo > levelInfo)
 Puts the given level into the priority queue (uses computePriority() first to compute its priority). More...
 
virtual void afterComputation (MultiIndex const &level)
 This function should be called after all desired precomputations (i.e. More...
 
virtual void beforeComputation (MultiIndex const &level)
 This function should be called between getting a level from the top of the priority queue and starting computations on it. More...
 
virtual std::vector< MultiIndexgetPredecessors (MultiIndex const &level)
 Helper function returning all predecessor level multi-indices. More...
 
std::vector< MultiIndexgetRegularLevelsByNumPoints (size_t maxNumPoints)
 
virtual std::vector< MultiIndexgetSuccessors (MultiIndex const &level)
 Helper function returning all successor level multi-indices. More...
 
virtual void initAdaption ()
 Initializes the data structures for adaptive level generation. More...
 
void precomputeLevelsParallel (std::vector< MultiIndex > const &levels, size_t numThreads)
 Does precomputations for all given levels in parallel with the specified number of threads. More...
 
virtual void predecessorsCompleted (MultiIndex const &level)
 This function is called after all desired precomputations (i.e. More...
 
virtual void tryAddLevel (MultiIndex const &level)
 Adds a level to levelData if all of its predecessors are already in levelData. More...
 
virtual void tryAddSuccessors (MultiIndex const &level)
 Adds successors of the given level to levelData if all of their other predecessors are also in levelData. More...
 
virtual void updatePriority (MultiIndex const &level, std::shared_ptr< LevelInfo > levelInfo)
 Updates the priority of a given level in the priority queue based on the currently available information. More...
 
void updateStats ()
 update statistics on added levels More...
 

Additional Inherited Members

- Protected Attributes inherited from sgpp::combigrid::LevelManager
bool collectStats
 Defines if statistics on the refinement process are collected or not. More...
 
std::shared_ptr< AbstractLevelEvaluatorcombiEval
 CombigridEvaluator (hidden behind an interface to avoid carrying around its template parameter here). More...
 
std::shared_ptr< LevelInfosinfoOnAddedLevels
 this object stores information on the levels during adaptive refinement More...
 
std::shared_ptr< TreeStorage< std::shared_ptr< LevelInfo > > > levelData
 Stores level information for already visited (!= computed) levels. More...
 
std::shared_ptr< std::recursive_mutex > managerMutex
 Mutex that is shared with all involved objects for evaluation parts that require mutual exclusion. More...
 
size_t numDimensions
 Dimensionality of the problem. More...
 
MultiIndexQueue queue
 Priority queue ranking levels that are not yet evaluated but ready for evaluation by their priority. More...
 

Detailed Description

This refinement criterion implements the one proposed by ´Gerstner and Griebel: Dimension-adaptive Tensor-Product Quadrature, p.

9´ Slight deviations from the proposed algorithm are possible due to the slightly different usage of the priority queue in this implementation.

Constructor & Destructor Documentation

◆ WeightedRatioLevelManager() [1/2]

sgpp::combigrid::WeightedRatioLevelManager::WeightedRatioLevelManager ( double  w = 0.8)
explicit

◆ WeightedRatioLevelManager() [2/2]

sgpp::combigrid::WeightedRatioLevelManager::WeightedRatioLevelManager ( std::shared_ptr< AbstractLevelEvaluator levelEvaluator,
double  w = 0.8 
)
explicit

◆ ~WeightedRatioLevelManager()

sgpp::combigrid::WeightedRatioLevelManager::~WeightedRatioLevelManager ( )
virtual

Member Function Documentation

◆ clone()

std::shared_ptr< LevelManager > sgpp::combigrid::WeightedRatioLevelManager::clone ( )
virtual

◆ computePriority()

double sgpp::combigrid::WeightedRatioLevelManager::computePriority ( MultiIndex const &  level)
protectedvirtual

By implementing this method in a derived class, the adaption can be customized.

It should yield a priority for the given level. Levels with higher priority value are added earlier.

Implements sgpp::combigrid::LevelManager.

References sgpp::combigrid::LevelManager::getPredecessors(), sgpp::combigrid::LevelManager::levelData, and sgpp::combigrid::LevelManager::numDimensions.


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