SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::combigrid::CombinationGrid Class Reference

Class for representing a collection of full grids together with one scalar coefficient per full grid. More...

#include <CombinationGrid.hpp>

Public Member Functions

 CombinationGrid ()
 Default constructor, leaves the list of full grids empty.
 
 CombinationGrid (const FullGrid &fullGrid)
 Constructor for a CombinationGrid consisting of only one FullGrid.
 
 CombinationGrid (const std::vector< FullGrid > &fullGrids, const base::DataVector &coefficients)
 Constructor.
 
void combinePoints (base::GridStorage &gridStorage) const
 Combine the grid points of all full grids of this combination grid and store the grid points in an existing GridStorage.
 
void combineSparseGridValues (const base::GridStorage &gridStorage, const std::vector< base::DataMatrix > &values, base::DataMatrix &result) const
 Combine vectors associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid), i.e., vector version of the other combineSparseGridValues method.
 
void combineSparseGridValues (const base::GridStorage &gridStorage, const std::vector< base::DataVector > &values, base::DataVector &result) const
 Combine scalars associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid).
 
void combineValues (const base::DataMatrix &values, base::DataVector &result) const
 Combine equally-sized vectors (one per full grid) using a weighted sum (weighted by the coefficients of the combination grid).
 
double combineValues (const base::DataVector &values) const
 Combine scalars (one scalar per full grid) using a weighted sum (weighted by the coefficients of the combination grid).
 
void distributeValuesToFullGrid (const base::GridStorage &gridStorage, const base::DataVector &values, const FullGrid &fullGrid, base::DataVector &result) const
 Distribute values given on the combined grid to a specific full grid (which should be contained in this combination grid).
 
void distributeValuesToFullGrids (const base::GridStorage &gridStorage, const base::DataVector &values, std::vector< base::DataVector > &result) const
 Distribute values given on the combined grid to the full grids contained in this combination grid.
 
const base::DataVectorgetCoefficients () const
 
size_t getDimension () const
 
const std::vector< FullGrid > & getFullGrids () const
 
void setFullGridsAndCoefficients (const std::vector< FullGrid > &fullGrids, const base::DataVector &coefficients)
 

Static Public Member Functions

static CombinationGrid fromRegularSparse (size_t dim, level_t n, const HeterogeneousBasis &basis, bool hasBoundary=true)
 Factory method to create a CombinationGrid corresponding to the combination technique for a regular sparse grid.
 
static CombinationGrid fromRegularSparseTruncated (size_t dim, LevelVector truncationLevel, level_t levelSumDistance, const HeterogeneousBasis &basis, bool hasBoundary=true)
 Factory method to create a CombinationGrid corresponding to the truncated combination technique for a regular sparse grid, given a truncation level.
 
static CombinationGrid fromSubspaces (const std::vector< LevelVector > &subspaceLevels, const HeterogeneousBasis &basis, bool hasBoundary=true)
 Factory method to create a CombinationGrid corresponding to the combination technique for a (potentially dimensionally adaptive) sparse grid specified via its nodal subspaces/full grids.
 

Protected Attributes

base::DataVector coefficients
 vector of coefficients, same size as fullGrids
 
std::vector< FullGridfullGrids
 vector of full grids
 

Detailed Description

Class for representing a collection of full grids together with one scalar coefficient per full grid.

Constructor & Destructor Documentation

◆ CombinationGrid() [1/3]

sgpp::combigrid::CombinationGrid::CombinationGrid ( )

Default constructor, leaves the list of full grids empty.

Referenced by fromRegularSparseTruncated(), and fromSubspaces().

◆ CombinationGrid() [2/3]

sgpp::combigrid::CombinationGrid::CombinationGrid ( const std::vector< FullGrid > &  fullGrids,
const base::DataVector coefficients 
)

Constructor.

Parameters
fullGridsvector of full grids
coefficientsvector of coefficients, same size as fullGrids

◆ CombinationGrid() [3/3]

sgpp::combigrid::CombinationGrid::CombinationGrid ( const FullGrid fullGrid)
explicit

Constructor for a CombinationGrid consisting of only one FullGrid.

Parameters
fullGridthe full grid

Member Function Documentation

◆ combinePoints()

void sgpp::combigrid::CombinationGrid::combinePoints ( base::GridStorage gridStorage) const

Combine the grid points of all full grids of this combination grid and store the grid points in an existing GridStorage.

Parameters
[out]gridStorageGridStorage in which to save the grid points (will be cleared)

References fullGrids, getDimension(), sgpp::combigrid::HeterogeneousBasis::hierarchizeLevelIndex(), and level.

◆ combineSparseGridValues() [1/2]

void sgpp::combigrid::CombinationGrid::combineSparseGridValues ( const base::GridStorage gridStorage,
const std::vector< base::DataMatrix > &  values,
base::DataMatrix result 
) const

Combine vectors associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid), i.e., vector version of the other combineSparseGridValues method.

Parameters
[in]gridStorageGridStorage containing the combined grid
[in]valuesvector of DataMatrix, each DataMatrix corresponds to a full grid and has the same number of columns as the number of grid points of the full grid (every column corresponds to one full grid point, the order of columns is given by IndexVectorRange)
[out]resultmatrix resulting from the combination, columns have the same order as gridStorage (every column corresponds to one grid point of the combined grid)

References coefficients, sgpp::combigrid::IndexVectorRange::find(), fullGrids, getDimension(), m, sgpp::base::DataMatrix::resize(), sgpp::base::DataMatrix::setAll(), and sgpp::combigrid::IndexVectorRange::setGrid().

◆ combineSparseGridValues() [2/2]

void sgpp::combigrid::CombinationGrid::combineSparseGridValues ( const base::GridStorage gridStorage,
const std::vector< base::DataVector > &  values,
base::DataVector result 
) const

Combine scalars associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid).

Hierarchization is one example: In every full grid, there is a scalar (hierarchical surplus) associated with every grid point. This method combines these grid values to have one value for each point in the combined grid (usually a sparse grid).

Parameters
[in]gridStorageGridStorage containing the combined grid
[in]valuesvector of DataVector, each DataVector corresponds to a full grid and has the same size as the number of grid points of the full grid (the order of DataVector entries is given by IndexVectorRange)
[out]resultvector resulting from the combination, same order as gridStorage

References coefficients, sgpp::combigrid::IndexVectorRange::find(), fullGrids, getDimension(), sgpp::base::DataVector::setAll(), and sgpp::combigrid::IndexVectorRange::setGrid().

◆ combineValues() [1/2]

void sgpp::combigrid::CombinationGrid::combineValues ( const base::DataMatrix values,
base::DataVector result 
) const

Combine equally-sized vectors (one per full grid) using a weighted sum (weighted by the coefficients of the combination grid).

Parameters
[in]valuesdata matrix, same number of columns as the number of full grids (every column corresponds to one full grid, the order of rows is given by IndexVectorRange)
[out]resultvector resulting from the combination

References coefficients, sgpp::base::DataMatrix::getNrows(), and sgpp::base::DataMatrix::mult().

◆ combineValues() [2/2]

double sgpp::combigrid::CombinationGrid::combineValues ( const base::DataVector values) const

Combine scalars (one scalar per full grid) using a weighted sum (weighted by the coefficients of the combination grid).

Parameters
valuesdata vector, same size as the number of full grids
Returns
value resulting from the combination

References coefficients, and sgpp::base::DataVector::dotProduct().

Referenced by sgpp::combigrid::OperationEvalCombinationGrid::eval(), and sgpp::combigrid::OperationEvalCombinationGrid::multiEval().

◆ distributeValuesToFullGrid()

void sgpp::combigrid::CombinationGrid::distributeValuesToFullGrid ( const base::GridStorage gridStorage,
const base::DataVector values,
const FullGrid fullGrid,
base::DataVector result 
) const

Distribute values given on the combined grid to a specific full grid (which should be contained in this combination grid).

Parameters
[in]gridStorageGridStorage containing the combined grid
[in]valuesvector of values on the combined grid, same size as gridStorage
[in]fullGridfull grid, should be contained in this combination grid
[out]resultvector of values on the full grid, same size as the number of grid points of the full grid (the order is given by IndexVectorRange)

References sgpp::combigrid::IndexVectorRange::find(), sgpp::combigrid::FullGrid::findGridPointInFullGrid(), getDimension(), sgpp::combigrid::FullGrid::getNumberOfIndexVectors(), and sgpp::base::DataVector::setAll().

◆ distributeValuesToFullGrids()

void sgpp::combigrid::CombinationGrid::distributeValuesToFullGrids ( const base::GridStorage gridStorage,
const base::DataVector values,
std::vector< base::DataVector > &  result 
) const

Distribute values given on the combined grid to the full grids contained in this combination grid.

Parameters
[in]gridStorageGridStorage containing the combined grid
[in]valuesvector of values on the combined grid, same size as gridStorage
[out]resultvector of vectors with values on the full grids, every vector corresponds to one full grid of the combination grid, every vector has the same size as the number of grid points of the respective full grid (the order of DataVector entries is given by IndexVectorRange)

References sgpp::combigrid::IndexVectorRange::find(), fullGrids, getDimension(), and sgpp::combigrid::IndexVectorRange::setGrid().

◆ fromRegularSparse()

CombinationGrid sgpp::combigrid::CombinationGrid::fromRegularSparse ( size_t  dim,
level_t  n,
const HeterogeneousBasis basis,
bool  hasBoundary = true 
)
static

Factory method to create a CombinationGrid corresponding to the combination technique for a regular sparse grid.

Parameters
dimdimensionality
nsparse grid level
basisbasis of the sparse grid (will be the same for all full grids; this can be changed)
hasBoundarywhether the sparse grid has points on the boundary
Returns
CombinationGrid corresponding to the combination technique for the regular sparse grid

References fromRegularSparseTruncated().

◆ fromRegularSparseTruncated()

CombinationGrid sgpp::combigrid::CombinationGrid::fromRegularSparseTruncated ( size_t  dim,
LevelVector  truncationLevel,
level_t  levelSumDistance,
const HeterogeneousBasis basis,
bool  hasBoundary = true 
)
static

Factory method to create a CombinationGrid corresponding to the truncated combination technique for a regular sparse grid, given a truncation level.

Parameters
dimdimensionality
truncationLevelminimum level for each full component grid
levelSumDistanceregular level in analogy to fromRegularSparse, the result is a regular sparse grid of level n with each level shifted by truncationLevel
basisbasis of the sparse grid (will be the same for all full grids; this can be changed)
hasBoundarywhether the sparse grid has points on the boundary
Returns
CombinationGrid corresponding to the combination technique for the regular sparse grid

References coefficients, CombinationGrid(), fullGrids, sgpp::combigrid::LevelVectorTools::generateDiagonalWithBoundary(), sgpp::combigrid::LevelVectorTools::generateDiagonalWithoutBoundary(), and level.

Referenced by fromRegularSparse().

◆ fromSubspaces()

CombinationGrid sgpp::combigrid::CombinationGrid::fromSubspaces ( const std::vector< LevelVector > &  subspaceLevels,
const HeterogeneousBasis basis,
bool  hasBoundary = true 
)
static

Factory method to create a CombinationGrid corresponding to the combination technique for a (potentially dimensionally adaptive) sparse grid specified via its nodal subspaces/full grids.

Note: You have to specify the levels of all nodal subspaces, i.e., the specified list of subspaces has to be downward closed.

Parameters
subspaceLevelsvector of subspace levels
basisbasis of the sparse grid (will be the same for all full grids; this can be changed)
hasBoundarywhether the sparse grid has points on the boundary
Returns
CombinationGrid corresponding to the combination technique for the sparse grid

References coefficients, CombinationGrid(), fullGrids, and sgpp::combigrid::getStandardCoefficientsFromLevelSet().

Referenced by sgpp::combigrid::AdaptiveCombinationGridGenerator::getCombinationGrid().

◆ getCoefficients()

const base::DataVector & sgpp::combigrid::CombinationGrid::getCoefficients ( ) const
Returns
vector of coefficients, same size as fullGrids

References coefficients.

◆ getDimension()

size_t sgpp::combigrid::CombinationGrid::getDimension ( ) const

◆ getFullGrids()

◆ setFullGridsAndCoefficients()

void sgpp::combigrid::CombinationGrid::setFullGridsAndCoefficients ( const std::vector< FullGrid > &  fullGrids,
const base::DataVector coefficients 
)
Parameters
fullGridsvector of full grids
coefficientsvector of coefficients, same size as fullGrids

References coefficients, and fullGrids.

Member Data Documentation

◆ coefficients

base::DataVector sgpp::combigrid::CombinationGrid::coefficients
protected

◆ fullGrids


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