LAMA
lama::MatrixCreator< T > Class Template Reference

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)

Detailed Description

template<typename T>
class lama::MatrixCreator< T >

This class provides some static methods to build or create sparse matrices for certain problem classes.

Template Parameters:
Tis the value type for the matrix elements

Member Function Documentation

template<typename T >
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.

Parameters:
[out]matrixin CSR format
[in]dimensionmust be 1, 2, or 3
[in]stencilTypetype of stencil, must be supported for corresponding dimension
[in]dimX,dimY,dimZare 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().

template<typename T >
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.

Parameters:
[out]matrixin CSR format
[in]stencilTypemust be 3
[in]dimis the grid size
template<typename T >
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.

Parameters:
[out]matrixin CSR format
[in]stencilTypemust be 5, or 9
[in]dim1,dim2are the sizes of the two-dimensional grid
template<typename T >
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.

Parameters:
[out]matrixin CSR format
[in]stencilTypemust be 7, 19, or 27
[in]dim1,dim2,dim3are the sizes of the three-dimensional grid
template<typename T >
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().

template<typename ValueType >
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().

template<typename T >
lama::MatrixCreator< T >::LAMA_LOG_DECL_STATIC_LOGGER ( logger  ) [private]
template<typename ValueType >
bool lama::MatrixCreator< ValueType >::supportedStencilType ( const IndexType  dimension,
const IndexType  stencilType 
) [static]

Query routine to ask for a supported stencil type.

Parameters:
[in]dimensionis dimension of the structured grid
[in]stencilTypenumber of points for the stencil

References lama::getStencilProperties().


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