SG++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sgpp::optimization::HashRefinementMultiple Class Reference

Descendant of base::HashRefinement refining without the generation of hierarchical ancestors. More...

#include <HashRefinementMultiple.hpp>

Inheritance diagram for sgpp::optimization::HashRefinementMultiple:
sgpp::base::HashRefinement sgpp::base::AbstractRefinement

Public Member Functions

size_t getNumberOfRefinablePoints (base::GridStorage &storage) override
 Returns the number of refineable points, e.g. More...
 
void refineGridpoint1D (base::GridStorage &storage, base::GridPoint &point, size_t t) override
 Refines a grid point in one dimension. More...
 
- Public Member Functions inherited from sgpp::base::HashRefinement
void free_refine (GridStorage &storage, RefinementFunctor &functor) override
 Refines a grid according to a RefinementFunctor provided. More...
 
void refineGridpoint1D (GridStorage &storage, size_t seq, size_t d) override
 Refine one grid point along a single direction. More...
 
virtual ~HashRefinement ()
 
- Public Member Functions inherited from sgpp::base::AbstractRefinement
virtual size_t getIndexOfMin (RefinementFunctor::value_type *array, size_t length)
 Returns the index of the first occurrence of minimal element in array. More...
 
bool isRefinable (GridStorage &storage, GridPoint &point)
 Check if the grid point is refinable. More...
 
virtual ~AbstractRefinement ()
 Destructor. More...
 

Protected Member Functions

void collectRefinablePoints (base::GridStorage &storage, base::RefinementFunctor &functor, base::AbstractRefinement::refinement_container_type &collection) override
 Examine the grid points and stores the indices those that can be refined and have maximal indicator values. More...
 
- Protected Member Functions inherited from sgpp::base::HashRefinement
virtual void addElementToCollection (const GridStorage::grid_map_iterator &iter, AbstractRefinement::refinement_list_type current_value_list, size_t refinements_num, AbstractRefinement::refinement_container_type &collection)
 Adds elements to the collection. More...
 
void createGridpoint (GridStorage &storage, GridPoint &point) override
 This method creates a new point on the grid. More...
 
AbstractRefinement::refinement_list_type getIndicator (GridStorage &storage, const GridStorage::grid_map_iterator &iter, const RefinementFunctor &functor) const override
 Generates a list with indicator elements. More...
 
void refineGridpoint (GridStorage &storage, size_t refine_index) override
 This method refines a grid point by generating the children in every dimension of the grid and all their missing ancestors by calling create_gridpoint(). More...
 
void refineGridpointsCollection (GridStorage &storage, RefinementFunctor &functor, AbstractRefinement::refinement_container_type &collection) override
 Extends the grid adding elements defined in collection. More...
 
- Protected Member Functions inherited from sgpp::base::AbstractRefinement
virtual void createGridpoint1D (GridPoint &point, size_t d, GridStorage &storage, index_t &source_index, level_t &source_level)
 Creates children grid points along single direction. More...
 
virtual void createGridpointSubroutine (GridStorage &storage, GridPoint &point)
 Subroutine for grid point creation. More...
 

Additional Inherited Members

- Public Types inherited from sgpp::base::AbstractRefinement
typedef std::vector
< refinement_pair_type
refinement_container_type
 Container for the collection of the refinement atoms and the corresponding value. More...
 
typedef
AbstractRefinement_refinement_key 
refinement_key_type
 Type of the identifier of the refinement atom (e.g. More...
 
typedef std::forward_list
< AbstractRefinement::refinement_pair_type
refinement_list_type
 
typedef std::pair
< std::shared_ptr
< refinement_key_type >
, refinement_value_type
refinement_pair_type
 Pair for the refinement key and value. More...
 
typedef double refinement_value_type
 Type of functor value assigned to each refinement atom. More...
 
- Static Public Member Functions inherited from sgpp::base::AbstractRefinement
static bool compare_pairs (const refinement_pair_type &lhs, const refinement_pair_type &rhs)
 Comparison of the refinement_pair_type. More...
 

Detailed Description

Descendant of base::HashRefinement refining without the generation of hierarchical ancestors.

In SG++ grids (as in sgpp::base), every grid fulfills the "hierarchical ancestors" property, e.g. every gridpoint has a direct ancestor in every dimension whose level is > 1.

By using this refinement class, the property doesn't necessarily hold anymore. The original base::HashRefinement looks at the neigbors of a grid point to be refined. If a neighbor in a dimension and a direction (left/right) already exists, no new point is inserted. If it doesn't exist, it is inserted and all hierarchical ancestors are generated recursively.

HashRefinementMultiple instead inserts exactly \(2d\) new grid points, if a point is to be refined (for Noboundary grids with \(d\) being the number of dimensions). This is done by looking at neighbors of higher levels (closer to the point to be refined) and inserting the first neighbor that doesn't exist in the grid. Additionally, no hierarchical ancestors are creating by omitting the base::HashRefinement::createGridpoint() calls.

Grids without the "hierarchical ancestors" property don't allow most standard algorithms to be executed on them, therefore grids and basis functions are separated in this module from those in sgpp::base.

Member Function Documentation

void sgpp::optimization::HashRefinementMultiple::collectRefinablePoints ( base::GridStorage storage,
base::RefinementFunctor functor,
base::AbstractRefinement::refinement_container_type collection 
)
inlineoverrideprotectedvirtual

Examine the grid points and stores the indices those that can be refined and have maximal indicator values.

This function differences from its counterpart in base::HashRefinement insofar every grid point could potentially be refined.

Parameters
storagehashmap that stores the grid points
functora PredictiveRefinementIndicator specifying the refinement criteria
collectioncontainer that contains elements to refine (empty initially)

Reimplemented from sgpp::base::HashRefinement.

References sgpp::base::HashRefinement::addElementToCollection(), sgpp::base::HashGridStorage::begin(), sgpp::base::HashGridStorage::end(), sgpp::base::HashRefinement::getIndicator(), and sgpp::base::RefinementFunctor::getRefinementsNum().

size_t sgpp::optimization::HashRefinementMultiple::getNumberOfRefinablePoints ( base::GridStorage storage)
inlineoverridevirtual

Returns the number of refineable points, e.g.

the number of all points (every grid point can be refined).

Parameters
storagegrid storage
Returns
number of refinable points

Reimplemented from sgpp::base::HashRefinement.

References sgpp::base::HashGridStorage::getSize().

void sgpp::optimization::HashRefinementMultiple::refineGridpoint1D ( base::GridStorage storage,
base::GridPoint point,
size_t  t 
)
inlineoverridevirtual

Refines a grid point in one dimension.

This creates exactly two new grid points.

Parameters
storagegrid storage
pointpoint of the grid point
tdimension in which the refinement should take place

Reimplemented from sgpp::base::HashRefinement.

References sgpp::base::HashGridPoint::get(), sgpp::base::HashGridStorage::insert(), sgpp::base::HashGridStorage::isContaining(), sgpp::base::HashGridPoint::set(), and sgpp::base::HashGridPoint::setLeaf().


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