SG++-Doxygen-Documentation
|
The TreeStorage class is an optimized implementation of a storage that stores values addressed by MultiIndex-objects. More...
#include <TreeStorage.hpp>
Public Types | |
typedef std::function< T(MultiIndex const &)> | function_type |
Public Member Functions | |
virtual bool | containsIndex (MultiIndex const &index) const |
virtual T & | get (MultiIndex const &index) |
Returns the value for the given MultiIndex. More... | |
virtual std::shared_ptr< AbstractMultiStorageIterator< T > > | getGuidedIterator (MultiIndexIterator &indexIter, IterationPolicy const &policy=IterationPolicy::Default) |
virtual size_t | getNumDimensions () const |
virtual std::shared_ptr< AbstractMultiStorageIterator< T > > | getStoredDataIterator () |
virtual void | set (MultiIndex const &index, T const &value) |
Unlike get(), this function does not activate a computation if there is no entry for the given multi-index in the storage. More... | |
virtual void | setFunc (function_type func) |
Changes the function that generates the entries. More... | |
TreeStorage (size_t numDimensions, function_type func=multiIndexToDefaultValue< T >()) | |
Constructor. More... | |
virtual | ~TreeStorage () |
Public Member Functions inherited from sgpp::combigrid::AbstractMultiStorage< T > | |
virtual | ~AbstractMultiStorage () |
The TreeStorage class is an optimized implementation of a storage that stores values addressed by MultiIndex-objects.
It uses a tree with as many levels as dimensions in the multi-indices. TreeStorage can be configured with a function that computes a value for a multi-index such that TreeStorage caches its values. Multi-Indices start from 0 in each dimension. The class T has to have a default constructor. For more information see AbstractMultiStorage.
typedef std::function<T(MultiIndex const &)> sgpp::combigrid::TreeStorage< T >::function_type |
|
inlineexplicit |
Constructor.
numDimensions | number of dimensions of the multi-indices that the storage is addressed with |
func | "Default-value-function" that is called to compute entries that are not already stored. If this parameter is not specified, func will be set to a function returning T(). The storage might serve as a function value cache such that these values only have to be computed once. If no function is specified, the default constructor of the stored type is used. |
|
inlinevirtual |
|
inlinevirtual |
Implements sgpp::combigrid::AbstractMultiStorage< T >.
|
inlinevirtual |
Returns the value for the given MultiIndex.
If the value is not stored, it is computed using the function and then stored and returned.
Implements sgpp::combigrid::AbstractMultiStorage< T >.
References sgpp::combigrid::TreeStorageContext< T >::numDimensions.
|
inlinevirtual |
indexIter | Iterator that defines which values should be iterated over. |
policy | Defines for each dimension the order that the values should be traversed in. |
Implements sgpp::combigrid::AbstractMultiStorage< T >.
References sgpp::combigrid::TreeStorageContext< T >::numDimensions.
|
inlinevirtual |
Implements sgpp::combigrid::AbstractMultiStorage< T >.
References sgpp::combigrid::TreeStorageContext< T >::numDimensions.
|
inlinevirtual |
Implements sgpp::combigrid::AbstractMultiStorage< T >.
References sgpp::combigrid::TreeStorageContext< T >::numDimensions.
|
inlinevirtual |
Unlike get(), this function does not activate a computation if there is no entry for the given multi-index in the storage.
Instead, it directly sets the given value.
Implements sgpp::combigrid::AbstractMultiStorage< T >.
|
inlinevirtual |
Changes the function that generates the entries.
References sgpp::combigrid::TreeStorageContext< T >::func.