SG++
sgpp::base::RefinementDecorator Class Reference

RefinementDecorator enhances the behavior of underlying Refinement objects using Decorator design pattern . More...

#include <RefinementDecorator.hpp>

Inheritance diagram for sgpp::base::RefinementDecorator:
sgpp::base::AbstractRefinement sgpp::base::ForwardSelectorRefinement sgpp::base::ImpurityRefinement sgpp::base::PredictiveRefinement sgpp::base::SubspaceRefinement

Public Member Functions

bool checkAdmissibility (GridStorage &storage, GridPoint &subspace)
 
virtual void free_refine (GridStorage &storage, RefinementFunctor &functor)
 Refines a grid according to a RefinementFunctor provided. More...
 
virtual size_t getNumberOfRefinablePoints (GridStorage &storage)
 Computes and returns the number of grid points, which can be refined. More...
 
virtual void refineGridpoint1D (GridStorage &storage, GridPoint &point, size_t d)
 Refine one grid point along a single direction. More...
 
 RefinementDecorator (AbstractRefinement *refinement)
 Constructor. More...
 
virtual ~RefinementDecorator ()
 
- 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 void refineGridpoint1D (GridStorage &storage, size_t seq, size_t d)
 Refine one grid point along a single direction. More...
 
virtual ~AbstractRefinement ()
 Destructor. More...
 

Protected Member Functions

virtual void collectRefinablePoints (GridStorage &storage, RefinementFunctor &functor, AbstractRefinement::refinement_container_type &collection)
 Examines the grid points and stores the indices those that can be refined and have maximal indicator values. More...
 
virtual void createGridpoint (GridStorage &storage, GridPoint &point)
 This method creates a new point on the grid. More...
 
AbstractRefinementget_decorated_refinement ()
 Returns the pointer to decorated Refinement object. More...
 
virtual AbstractRefinement::refinement_list_type getIndicator (GridStorage &storage, const GridStorage::grid_map_iterator &iter, const RefinementFunctor &functor) const
 Generates a list with indicator elements. More...
 
virtual void refineGridpoint (GridStorage &storage, size_t refine_index)
 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, AbstractRefinement::refinement_container_type &collection)
 Refines the collection of points. More...
 
void set_decorated_refiment (AbstractRefinement *refinement)
 Sets the pointer of the decorated Refinement object to the given object. 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_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...
 
- 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

RefinementDecorator enhances the behavior of underlying Refinement objects using Decorator design pattern .

Although not abstract, this class is thought to be a base class as it simply delegates the function calls to the decorated object. Subclasses will implement more sophisticated behavior.

Constructor & Destructor Documentation

sgpp::base::RefinementDecorator::RefinementDecorator ( AbstractRefinement refinement)
inlineexplicit

Constructor.

Parameters
refinementobject implementing the core functionality (e.g. refinement with or without boundaries).
virtual sgpp::base::RefinementDecorator::~RefinementDecorator ( )
inlinevirtual

Member Function Documentation

bool sgpp::base::RefinementDecorator::checkAdmissibility ( GridStorage storage,
GridPoint subspace 
)

Referenced by ~RefinementDecorator().

void sgpp::base::RefinementDecorator::collectRefinablePoints ( GridStorage storage,
RefinementFunctor functor,
AbstractRefinement::refinement_container_type collection 
)
protectedvirtual

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

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

Implements sgpp::base::AbstractRefinement.

Reimplemented in sgpp::base::PredictiveRefinement, sgpp::base::ForwardSelectorRefinement, sgpp::base::ImpurityRefinement, and sgpp::base::SubspaceRefinement.

References sgpp::base::AbstractRefinement::collectRefinablePoints().

Referenced by set_decorated_refiment().

void sgpp::base::RefinementDecorator::createGridpoint ( GridStorage storage,
GridPoint point 
)
protectedvirtual

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

Implements sgpp::base::AbstractRefinement.

References sgpp::base::AbstractRefinement::createGridpoint().

Referenced by set_decorated_refiment().

void sgpp::base::RefinementDecorator::free_refine ( GridStorage storage,
RefinementFunctor functor 
)
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()

Parameters
storagehashmap that stores the grid points
functora RefinementFunctor specifying the refinement criteria

Implements sgpp::base::AbstractRefinement.

Reimplemented in sgpp::base::SubspaceRefinement.

References sgpp::base::AbstractRefinement::free_refine().

Referenced by ~RefinementDecorator().

AbstractRefinement* sgpp::base::RefinementDecorator::get_decorated_refinement ( )
inlineprotected

Returns the pointer to decorated Refinement object.

AbstractRefinement::refinement_list_type sgpp::base::RefinementDecorator::getIndicator ( GridStorage storage,
const GridStorage::grid_map_iterator iter,
const RefinementFunctor functor 
) const
protectedvirtual

Generates a list with indicator elements.

Parameters
storagegrid storage
iteriterator
functorrefinement functor
Returns
list with indicator elements

Implements sgpp::base::AbstractRefinement.

Reimplemented in sgpp::base::PredictiveRefinement, sgpp::base::ForwardSelectorRefinement, and sgpp::base::ImpurityRefinement.

References sgpp::base::AbstractRefinement::getIndicator().

Referenced by sgpp::base::SubspaceRefinement::collectRefinablePoints(), and set_decorated_refiment().

size_t sgpp::base::RefinementDecorator::getNumberOfRefinablePoints ( GridStorage storage)
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

Implements sgpp::base::AbstractRefinement.

References sgpp::base::AbstractRefinement::getNumberOfRefinablePoints().

Referenced by ~RefinementDecorator().

void sgpp::base::RefinementDecorator::refineGridpoint ( GridStorage storage,
size_t  refine_index 
)
protectedvirtual

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

Implements sgpp::base::AbstractRefinement.

References sgpp::base::AbstractRefinement::refineGridpoint().

Referenced by sgpp::base::SubspaceRefinement::refineGridpointsCollection(), sgpp::base::ImpurityRefinement::refineGridpointsCollection(), sgpp::base::ForwardSelectorRefinement::refineGridpointsCollection(), and set_decorated_refiment().

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

Refine one grid point along a single direction.

Parameters
storagehashmap that stores the grid points
pointpoint to refine
ddirection

Implements sgpp::base::AbstractRefinement.

References sgpp::base::AbstractRefinement::refineGridpoint1D().

Referenced by sgpp::base::PredictiveRefinement::refineGridpointsCollection(), and ~RefinementDecorator().

void sgpp::base::RefinementDecorator::refineGridpointsCollection ( GridStorage storage,
RefinementFunctor functor,
AbstractRefinement::refinement_container_type collection 
)
protectedvirtual
void sgpp::base::RefinementDecorator::set_decorated_refiment ( AbstractRefinement refinement)
inlineprotected

Sets the pointer of the decorated Refinement object to the given object.

Parameters
refinementobject the pointer should be set to

References collectRefinablePoints(), createGridpoint(), getIndicator(), refineGridpoint(), and refineGridpointsCollection().


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