SG++-Doxygen-Documentation
sgpp::base::HashRefinementBoundaries Class Reference

Standard free refinement class for sparse grids with boundaries. More...

#include <HashRefinementBoundaries.hpp>

Inheritance diagram for sgpp::base::HashRefinementBoundaries:
sgpp::base::AbstractRefinement sgpp::base::HashRefinementBoundariesMaxLevel

Public Member Functions

void free_refine (GridStorage &storage, RefinementFunctor &functor, std::vector< size_t > *addedPoints=0) override
 Performs the refinement on grid. More...
 
size_t getNumberOfRefinablePoints (GridStorage &storage) override
 Calculates the number of points, which can be refined. More...
 
void refineGridpoint1D (GridStorage &storage, GridPoint &point, size_t d) override
 Refine one grid point along a single direction. More...
 
- 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 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 collectRefinablePoints (GridStorage &storage, RefinementFunctor &functor, AbstractRefinement::refinement_container_type &collection) override
 Examines the grid points and stores the indices those that can be refined and have maximal indicator values. More...
 
void createGridpoint (GridStorage &storage, GridPoint &point) override
 Wrapper for the two functions create_gridpoint_general and create_gridpoint_levelZeroConsistency which have both to be executed if a gridpoint is refined. More...
 
void createGridpoint1D (GridPoint &point, size_t d, GridStorage &storage, index_t &source_index, level_t &source_level) override
 Creates children grid points along single direction. More...
 
void createGridpointGeneral (GridStorage &storage, GridPoint &point)
 This method creates a new point on the grid. More...
 
void createGridpointLevelZeroConsistency (GridStorage &storage, GridPoint &point)
 Assures that we have always a consistent grid with both functions 0,0 and 0,1 on level zero. 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 be generating the children in every dimension of the grid. 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 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

Standard free refinement class for sparse grids with boundaries.

Member Function Documentation

◆ addElementToCollection()

void sgpp::base::HashRefinementBoundaries::addElementToCollection ( const GridStorage::grid_map_iterator iter,
AbstractRefinement::refinement_list_type  current_value_list,
size_t  refinements_num,
AbstractRefinement::refinement_container_type collection 
)
protectedvirtual

Adds elements to the collection.

This method is responsible for selection the elements with most important indicators and to limit the size of collection to refinements_num elements.

Parameters
iterstorage iterator
current_value_listlist with elements that contain keys and values that specify refinement
refinements_numnumber of elements to refine
collectioncontainer where element pairs for refinement need to be stored

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

Referenced by collectRefinablePoints().

◆ collectRefinablePoints()

void sgpp::base::HashRefinementBoundaries::collectRefinablePoints ( GridStorage storage,
RefinementFunctor functor,
AbstractRefinement::refinement_container_type collection 
)
overrideprotectedvirtual

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.

References addElementToCollection(), sgpp::base::HashGridStorage::begin(), sgpp::base::HashGridStorage::end(), sgpp::base::HashGridStorage::find(), sgpp::base::HashGridPoint::get(), sgpp::base::HashGridStorage::getDimension(), getIndicator(), sgpp::base::RefinementFunctor::getRefinementsNum(), chess::point, and sgpp::base::HashGridPoint::set().

Referenced by free_refine().

◆ createGridpoint()

void sgpp::base::HashRefinementBoundaries::createGridpoint ( GridStorage storage,
GridPoint point 
)
overrideprotectedvirtual

Wrapper for the two functions create_gridpoint_general and create_gridpoint_levelZeroConsistency which have both to be executed if a gridpoint is refined.

Parameters
storagehashmap that stores the gridpoinrs
pointthe point that should be inserted

Implements sgpp::base::AbstractRefinement.

References createGridpointGeneral(), and createGridpointLevelZeroConsistency().

Referenced by createGridpointLevelZeroConsistency(), refineGridpoint1D(), and sgpp::base::HashRefinementBoundariesMaxLevel::refineGridpoint1D().

◆ createGridpoint1D()

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

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 from sgpp::base::AbstractRefinement.

References sgpp::base::AbstractRefinement::createGridpoint1D(), sgpp::base::AbstractRefinement::createGridpointSubroutine(), sgpp::base::HashGridPoint::get(), sgpp::base::HashGridStorage::getDimension(), and sgpp::base::HashGridPoint::set().

Referenced by createGridpointGeneral().

◆ createGridpointGeneral()

void sgpp::base::HashRefinementBoundaries::createGridpointGeneral ( GridStorage storage,
GridPoint point 
)
protected

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 gridpoinrs
pointthe point that should be inserted

References createGridpoint1D(), sgpp::base::HashGridStorage::getDimension(), and sgpp::base::HashGridStorage::insert().

Referenced by createGridpoint().

◆ createGridpointLevelZeroConsistency()

void sgpp::base::HashRefinementBoundaries::createGridpointLevelZeroConsistency ( GridStorage storage,
GridPoint point 
)
protected

Assures that we have always a consistent grid with both functions 0,0 and 0,1 on level zero.

Parameters
storagehashmap that stores the gridpoinrs
pointthe point that should be inserted

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

Referenced by createGridpoint().

◆ free_refine()

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

Performs the refinement on grid.

Parameters
storagehashmap that stores the grid points
functora function used to determine if refinement is needed
addedPointspointer to vector to append newly created grid points to

Assumption: during the refinement process the only change made to the storage is the following: New (if any) gridpoints are appended (to the end) of the storage

Implements sgpp::base::AbstractRefinement.

References collectRefinablePoints(), sgpp::base::HashGridStorage::getSize(), python.statsfileInfo::i, and refineGridpointsCollection().

Referenced by sgpp::base::StretchedBoundaryGridGenerator::refine(), sgpp::base::L0BoundaryGridGenerator::refine(), and sgpp::base::BoundaryGridGenerator::refine().

◆ getIndicator()

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

Generates a list with indicator elements.

Parameters
storagegrid storage
iteriterator
functorrefinement functor
Returns
list with indicator elements

Implements sgpp::base::AbstractRefinement.

Referenced by collectRefinablePoints().

◆ getNumberOfRefinablePoints()

◆ refineGridpoint()

void sgpp::base::HashRefinementBoundaries::refineGridpoint ( GridStorage storage,
size_t  refine_index 
)
overrideprotectedvirtual

This method refines a grid point be generating the children in every dimension of the grid.

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::HashGridStorage::getDimension(), chess::point, and refineGridpoint1D().

Referenced by refineGridpointsCollection().

◆ refineGridpoint1D()

void sgpp::base::HashRefinementBoundaries::refineGridpoint1D ( GridStorage storage,
GridPoint point,
size_t  d 
)
overridevirtual

Refine one grid point along a single direction.

Parameters
storagehashmap that stores the grid points
pointpoint to refine
ddirection

Implements sgpp::base::AbstractRefinement.

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

Referenced by refineGridpoint().

◆ refineGridpointsCollection()

void sgpp::base::HashRefinementBoundaries::refineGridpointsCollection ( GridStorage storage,
RefinementFunctor functor,
AbstractRefinement::refinement_container_type collection 
)
overrideprotectedvirtual

Extends the grid adding elements defined in collection.

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.

References sgpp::base::RefinementFunctor::getRefinementThreshold(), and refineGridpoint().

Referenced by free_refine().


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