LAMA
|
This class provides some static methods to build or create sparse matrices for certain problem classes. More...
#include <MatrixCreator.hpp>
Static Public Member Functions | |
static void | fillRandom (Matrix &matrix, double density) |
Fill a matrix in CSR format with random values. | |
static void | buildRandom (CSRSparseMatrix< T > &matrix, const IndexType size, const double density) |
Builds a block distributed CSR matrix with random values. | |
static void | buildPoisson1D (CSRSparseMatrix< T > &matrix, const IndexType stencilType, const IndexType dim) |
Build a sparse matrix representing the discretization of the Laplacian operator on a one-dimensional structured grid. | |
static void | buildPoisson2D (CSRSparseMatrix< T > &matrix, const IndexType stencilType, const IndexType dim1, const IndexType dim2) |
Build a sparse matrix representing the discretization of the Laplacian operator on a two-dimensional structured grid. | |
static void | buildPoisson3D (CSRSparseMatrix< T > &matrix, const IndexType stencilType, const IndexType dim1, const IndexType dim2, const IndexType dim3) |
Build a sparse matrix representing the discretization of the Laplacian operator on a three-dimensional structured grid. | |
static void | buildPoisson (CSRSparseMatrix< T > &matrix, const IndexType dimension, const IndexType stencilType, const IndexType dimX, const IndexType dimY, const IndexType dimZ) |
Build a sparse matrix representing the discretization of the Laplacian operator on a structured grid in up to three dimensions. | |
static bool | supportedStencilType (const IndexType dimension, const IndexType stencilType) |
Query routine to ask for a supported stencil type. | |
Private Member Functions | |
LAMA_LOG_DECL_STATIC_LOGGER (logger) |
This class provides some static methods to build or create sparse matrices for certain problem classes.
T | is the value type for the matrix elements |
void lama::MatrixCreator< ValueType >::buildPoisson | ( | CSRSparseMatrix< T > & | matrix, |
const IndexType | dimension, | ||
const IndexType | stencilType, | ||
const IndexType | dimX, | ||
const IndexType | dimY, | ||
const IndexType | dimZ | ||
) | [static] |
Build a sparse matrix representing the discretization of the Laplacian operator on a structured grid in up to three dimensions.
[out] | matrix | in CSR format |
[in] | dimension | must be 1, 2, or 3 |
[in] | stencilType | type of stencil, must be supported for corresponding dimension |
[in] | dimX,dimY,dimZ | are the sizes of the structured grid |
Note: dimZ is ignored for dimension < 3, dimY is ignored for dimension < 2.
References lama::SparseMatrix< T >::assign(), lama::CommunicatorFactory::get(), lama::CSRSparseMatrix< T >::getLocalStorage(), lama::getMatrixPosition(), lama::getNStencilValues(), lama::BlockDistribution::getRange(), lama::getStencil(), lama::getStencilProperties(), LAMA_ASSERT_DEBUG, LAMA_ASSERT_EQUAL_DEBUG, LAMA_ASSERT_EQUAL_ERROR, lama::WriteAccess< T >::resize(), and lama::CSRStorage< T >::swap().
void lama::MatrixCreator< T >::buildPoisson1D | ( | CSRSparseMatrix< T > & | matrix, |
const IndexType | stencilType, | ||
const IndexType | dim | ||
) | [static] |
Build a sparse matrix representing the discretization of the Laplacian operator on a one-dimensional structured grid.
[out] | matrix | in CSR format |
[in] | stencilType | must be 3 |
[in] | dim | is the grid size |
void lama::MatrixCreator< T >::buildPoisson2D | ( | CSRSparseMatrix< T > & | matrix, |
const IndexType | stencilType, | ||
const IndexType | dim1, | ||
const IndexType | dim2 | ||
) | [static] |
Build a sparse matrix representing the discretization of the Laplacian operator on a two-dimensional structured grid.
[out] | matrix | in CSR format |
[in] | stencilType | must be 5, or 9 |
[in] | dim1,dim2 | are the sizes of the two-dimensional grid |
void lama::MatrixCreator< T >::buildPoisson3D | ( | CSRSparseMatrix< T > & | matrix, |
const IndexType | stencilType, | ||
const IndexType | dim1, | ||
const IndexType | dim2, | ||
const IndexType | dim3 | ||
) | [static] |
Build a sparse matrix representing the discretization of the Laplacian operator on a three-dimensional structured grid.
[out] | matrix | in CSR format |
[in] | stencilType | must be 7, 19, or 27 |
[in] | dim1,dim2,dim3 | are the sizes of the three-dimensional grid |
void lama::MatrixCreator< ValueType >::buildRandom | ( | CSRSparseMatrix< T > & | matrix, |
const IndexType | size, | ||
const double | density | ||
) | [static] |
Builds a block distributed CSR matrix with random values.
param[out] matrix will be new defined as required param[in] size is the size of the square matrix (number of rows and number of columns) param[in] density specifies the density of sparse entries (0.0 is empty, 1.0 is full )
References lama::SparseMatrix< T >::allocate(), and lama::CommunicatorFactory::get().
void lama::MatrixCreator< ValueType >::fillRandom | ( | Matrix & | matrix, |
double | density | ||
) | [static] |
Fill a matrix in CSR format with random values.
param[inout] matrix size and distribution of matrix remains unchanged param[in] density specifies the density of sparse entries (0.0 is empty, 1.0 is full )
References lama::Matrix::assign(), lama::Matrix::getColDistributionPtr(), lama::Distribution::getCommunicator(), lama::Distributed::getDistribution(), lama::Distributed::getDistributionPtr(), lama::Distribution::getLocalSize(), lama::Matrix::getNumColumns(), lama::Distribution::getNumPartitions(), lama::Communicator::getRank(), and lama::MatrixStorage< T >::setRawCSRData().
lama::MatrixCreator< T >::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [private] |
bool lama::MatrixCreator< ValueType >::supportedStencilType | ( | const IndexType | dimension, |
const IndexType | stencilType | ||
) | [static] |
Query routine to ask for a supported stencil type.
[in] | dimension | is dimension of the structured grid |
[in] | stencilType | number of points for the stencil |
References lama::getStencilProperties().