SG++-Doxygen-Documentation
sgpp::base::AbstractRefinement Class Referenceabstract

Abstract refinement class for sparse grids. More...

#include <AbstractRefinement.hpp>

Inheritance diagram for sgpp::base::AbstractRefinement:
sgpp::base::HashRefinement sgpp::base::HashRefinementBoundaries sgpp::base::RefinementDecorator sgpp::base::ANOVAHashRefinement sgpp::base::HashRefinementInconsistent sgpp::base::HashRefinementInteraction sgpp::base::MultipleClassRefinement sgpp::optimization::HashRefinementMultiple sgpp::base::HashRefinementBoundariesMaxLevel sgpp::base::ForwardSelectorRefinement sgpp::base::ImpurityRefinement sgpp::base::PredictiveRefinement sgpp::base::SubspaceRefinement

Public Types

typedef std::vector< refinement_pair_typerefinement_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_typerefinement_list_type
 
typedef std::pair< std::shared_ptr< refinement_key_type >, refinement_value_typerefinement_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...
 

Public Member Functions

virtual void free_refine (GridStorage &storage, RefinementFunctor &functor, std::vector< size_t > *addedPoints=0)=0
 Refines a grid according to a RefinementFunctor provided. More...
 
virtual size_t getIndexOfMin (RefinementFunctor::value_type *array, size_t length)
 Returns the index of the first occurrence of minimal element in array. More...
 
virtual size_t getNumberOfRefinablePoints (GridStorage &storage)=0
 Computes and returns the number of grid points, which can be refined. More...
 
bool isRefinable (GridStorage &storage, GridPoint &point)
 Check if the grid point is refinable. More...
 
virtual void refineGridpoint1D (GridStorage &storage, GridPoint &point, size_t d)=0
 Refine one grid point along a single direction. More...
 
virtual void refineGridpoint1D (GridStorage &storage, size_t seq, size_t d)
 Refine one grid point along a single direction. More...
 
virtual ~AbstractRefinement ()
 Destructor. More...
 

Static Public Member Functions

static bool compare_pairs (const refinement_pair_type &lhs, const refinement_pair_type &rhs)
 Comparison of the refinement_pair_type. More...
 

Protected Member Functions

virtual void collectRefinablePoints (GridStorage &storage, RefinementFunctor &functor, refinement_container_type &collection)=0
 Identifies the sparse grid refinement atoms (points or subspaces) with the largest indicator values. More...
 
virtual void createGridpoint (GridStorage &storage, GridPoint &point)=0
 This method creates a new point on the grid. More...
 
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...
 
virtual refinement_list_type getIndicator (GridStorage &storage, const GridStorage::grid_map_iterator &iter, const RefinementFunctor &functor) const =0
 
virtual void refineGridpoint (GridStorage &storage, size_t refine_index)=0
 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...
 
virtual void refineGridpointsCollection (GridStorage &storage, RefinementFunctor &functor, refinement_container_type &collection)=0
 Refines the collection of points. More...
 

Friends

class RefinementDecorator
 

Detailed Description

Abstract refinement class for sparse grids.

Member Typedef Documentation

◆ refinement_container_type

Container for the collection of the refinement atoms and the corresponding value.

◆ refinement_key_type

Type of the identifier of the refinement atom (e.g.

a grid point or a subspace)

◆ refinement_list_type

◆ refinement_pair_type

Pair for the refinement key and value.

◆ refinement_value_type

Type of functor value assigned to each refinement atom.

Constructor & Destructor Documentation

◆ ~AbstractRefinement()

virtual sgpp::base::AbstractRefinement::~AbstractRefinement ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ collectRefinablePoints()

virtual void sgpp::base::AbstractRefinement::collectRefinablePoints ( GridStorage storage,
RefinementFunctor functor,
refinement_container_type collection 
)
protectedpure virtual

Identifies the sparse grid refinement atoms (points or subspaces) with the largest indicator values.

Parameters
storagehashmap that stores the grid points
functora RefinementFunctor specifying the refinement criteria
collectioncontainer with grid element identifiers (e.g. sequence number, grid point) and corresponding refinement values (usually empty)

Implemented in sgpp::optimization::HashRefinementMultiple, sgpp::base::RefinementDecorator, sgpp::base::PredictiveRefinement, sgpp::base::HashRefinementBoundaries, sgpp::base::HashRefinement, sgpp::base::ForwardSelectorRefinement, sgpp::base::ImpurityRefinement, sgpp::base::SubspaceRefinement, sgpp::base::MultipleClassRefinement, and sgpp::base::HashRefinementInteraction.

Referenced by sgpp::base::RefinementDecorator::collectRefinablePoints().

◆ compare_pairs()

static bool sgpp::base::AbstractRefinement::compare_pairs ( const refinement_pair_type lhs,
const refinement_pair_type rhs 
)
inlinestatic

◆ createGridpoint()

virtual void sgpp::base::AbstractRefinement::createGridpoint ( GridStorage storage,
GridPoint point 
)
protectedpure virtual

This method creates a new point on the grid.

It checks if some parents or children are needed in other dimensions.

Parameters
storagehashmap that stores the gridpoints
pointThe point that should be inserted

Implemented in sgpp::base::RefinementDecorator, sgpp::base::HashRefinement, sgpp::base::HashRefinementBoundaries, sgpp::base::HashRefinementInconsistent, and sgpp::base::HashRefinementInteraction.

Referenced by sgpp::base::RefinementDecorator::createGridpoint().

◆ createGridpoint1D()

void sgpp::base::AbstractRefinement::createGridpoint1D ( GridPoint point,
size_t  d,
GridStorage storage,
index_t source_index,
level_t source_level 
)
protectedvirtual

Creates children grid points along single direction.

Parameters
pointThe point that should be refined
ddirection
storagehashmap that stores the gridpoints
source_indexindex value in the dimension d
source_levellevel value in the dimension d

Reimplemented in sgpp::base::HashRefinementBoundaries.

References createGridpointSubroutine(), sgpp::base::HashGridPoint::get(), and sgpp::base::HashGridPoint::set().

Referenced by sgpp::base::HashRefinementInteraction::createGridpoint(), sgpp::base::HashRefinement::createGridpoint(), and sgpp::base::HashRefinementBoundaries::createGridpoint1D().

◆ createGridpointSubroutine()

virtual void sgpp::base::AbstractRefinement::createGridpointSubroutine ( GridStorage storage,
GridPoint point 
)
inlineprotectedvirtual

Subroutine for grid point creation.

Parameters
storagehashmap that stores the gridpoints
pointThe point that should be inserted

References sgpp::base::HashGridStorage::find(), sgpp::base::HashGridStorage::getPoint(), sgpp::base::HashGridStorage::isContaining(), sgpp::base::HashGridPoint::isLeaf(), and sgpp::base::HashGridPoint::setLeaf().

Referenced by sgpp::base::HashRefinementBoundaries::createGridpoint1D(), and createGridpoint1D().

◆ free_refine()

virtual void sgpp::base::AbstractRefinement::free_refine ( GridStorage storage,
RefinementFunctor functor,
std::vector< size_t > *  addedPoints = 0 
)
pure virtual

Refines a grid according to a RefinementFunctor provided.

Refines up to RefinementFunctor::getRefinementsNum() grid points if possible, and if their refinement value is larger than RefinementFunctor::start() and their absolute value is larger or equal than RefinementFunctor::getRefinementThreshold() If addedPoints is supplied and not a zero pointer, then newly created grid points are appended to this vector.

Parameters
storagehashmap that stores the grid points
functora RefinementFunctor specifying the refinement criteria
addedPointspointer to vector to append newly created grid points to

Implemented in sgpp::base::RefinementDecorator, sgpp::base::SubspaceRefinement, sgpp::base::HashRefinement, and sgpp::base::HashRefinementBoundaries.

Referenced by sgpp::base::RefinementDecorator::free_refine().

◆ getIndexOfMin()

size_t sgpp::base::AbstractRefinement::getIndexOfMin ( RefinementFunctor::value_type array,
size_t  length 
)
virtual

Returns the index of the first occurrence of minimal element in array.

Used to find which entry is to be replaced next searching the maximum ones.

Parameters
arrayarray with values
lengthlength of array
Returns
index of the first occurrence of minimal element in array

References python.statsfileInfo::i.

Referenced by sgpp::base::HashRefinementBoundariesMaxLevel::refineToMaxLevel().

◆ getIndicator()

◆ getNumberOfRefinablePoints()

virtual size_t sgpp::base::AbstractRefinement::getNumberOfRefinablePoints ( GridStorage storage)
pure virtual

Computes and returns the number of grid points, which can be refined.

This is the number of grid points that have at least one child missing.

Parameters
storagehashmap that stores the grid points
Returns
The number of grid points that can be refined

Implemented in sgpp::base::RefinementDecorator, sgpp::optimization::HashRefinementMultiple, sgpp::base::HashRefinement, and sgpp::base::HashRefinementBoundaries.

Referenced by sgpp::base::RefinementDecorator::getNumberOfRefinablePoints().

◆ isRefinable()

bool sgpp::base::AbstractRefinement::isRefinable ( GridStorage storage,
GridPoint point 
)

◆ refineGridpoint()

virtual void sgpp::base::AbstractRefinement::refineGridpoint ( GridStorage storage,
size_t  refine_index 
)
protectedpure virtual

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().

Parameters
storagehashmap that stores the gridpoints
refine_indexThe index in the hashmap of the point that should be refined

Implemented in sgpp::base::RefinementDecorator, sgpp::base::HashRefinement, sgpp::base::HashRefinementBoundaries, sgpp::base::MultipleClassRefinement, and sgpp::base::ANOVAHashRefinement.

Referenced by sgpp::base::RefinementDecorator::refineGridpoint().

◆ refineGridpoint1D() [1/2]

virtual void sgpp::base::AbstractRefinement::refineGridpoint1D ( GridStorage storage,
GridPoint point,
size_t  d 
)
pure virtual

Refine one grid point along a single direction.

Parameters
storagehashmap that stores the grid points
pointpoint to refine
ddirection

Implemented in sgpp::base::RefinementDecorator, sgpp::optimization::HashRefinementMultiple, sgpp::base::HashRefinement, and sgpp::base::HashRefinementBoundaries.

Referenced by sgpp::base::RefinementDecorator::refineGridpoint1D(), and refineGridpoint1D().

◆ refineGridpoint1D() [2/2]

void sgpp::base::AbstractRefinement::refineGridpoint1D ( GridStorage storage,
size_t  seq,
size_t  d 
)
virtual

Refine one grid point along a single direction.

Parameters
storagehashmap that stores the grid points
seqsequential number of the grid point
ddirection

Reimplemented in sgpp::base::HashRefinement.

References sgpp::base::HashGridStorage::getPoint(), and refineGridpoint1D().

◆ refineGridpointsCollection()

virtual void sgpp::base::AbstractRefinement::refineGridpointsCollection ( GridStorage storage,
RefinementFunctor functor,
refinement_container_type collection 
)
protectedpure virtual

Refines the collection of points.

Parameters
storagehashmap that stores the grid points
functora RefinementFunctor specifying the refinement criteria
collectioncontainer with grid element identifiers (e.g. sequence number, grid point) and corresponding refinement values

Implemented in sgpp::base::RefinementDecorator, sgpp::base::PredictiveRefinement, sgpp::base::HashRefinementBoundaries, sgpp::base::HashRefinement, sgpp::base::ForwardSelectorRefinement, sgpp::base::ImpurityRefinement, and sgpp::base::SubspaceRefinement.

Referenced by sgpp::base::RefinementDecorator::refineGridpointsCollection().

Friends And Related Function Documentation

◆ RefinementDecorator

friend class RefinementDecorator
friend

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