GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
GmSparseMatrixLayoutBuilder Class Referenceabstract

An interface for building the layout structure of a sparse matrix. More...

#include <gmSparseMatrixLayoutBuilder.h>

Inheritance diagram for GmSparseMatrixLayoutBuilder:

Public Member Functions

virtual ~GmSparseMatrixLayoutBuilder ()
 Virtual destructor.
 
virtual bool begin (int n, int expectedNnz)=0
 Informs the builder that the process of calling addEntry() is about to begin. Paremeter n is the number of rows(CSR) / columns(CSC) of the matrix, while expectedNnz gives an estimative of the number of non zero entries per matrix row (CSR) / column (CSC). If zero, no estimative will be used to minimize memory allocations. Returns false on errors (out of memory, for example).
 
virtual bool addEntry (int row, int col)=0
 Informs the builder that the entry in the given row/column is not 0.0. Keep in mind that this function will probably be called multiple times for the same line, column pair. Returns false on errors (out of memory, for example).
 
virtual bool end ()=0
 Finishes the building process completing the creation of the associate layout structure. Returns false on errors (out of memory, for example).
 

Static Public Member Functions

static int nnzEstimative (const GmElementMesh *mesh, int maxDofsPerNode)
 Quick estimative of the number of nonzeros in a sparse matrix for a mesh given the number of dofs per node. Will return 0 if unknown.
 

Detailed Description

An interface for building the layout structure of a sparse matrix.

Member Function Documentation

◆ addEntry()

virtual bool GmSparseMatrixLayoutBuilder::addEntry ( int row,
int col )
pure virtual

Informs the builder that the entry in the given row/column is not 0.0. Keep in mind that this function will probably be called multiple times for the same line, column pair. Returns false on errors (out of memory, for example).

Implemented in GmHashCSxSparseMatrixLayoutBuilder< IndexType, T >, and GmVectorCSxSparseMatrixLayoutBuilder< IndexType, T >.

◆ begin()

virtual bool GmSparseMatrixLayoutBuilder::begin ( int n,
int expectedNnz )
pure virtual

Informs the builder that the process of calling addEntry() is about to begin. Paremeter n is the number of rows(CSR) / columns(CSC) of the matrix, while expectedNnz gives an estimative of the number of non zero entries per matrix row (CSR) / column (CSC). If zero, no estimative will be used to minimize memory allocations. Returns false on errors (out of memory, for example).

Implemented in GmHashCSxSparseMatrixLayoutBuilder< IndexType, T >, and GmVectorCSxSparseMatrixLayoutBuilder< IndexType, T >.

◆ end()

virtual bool GmSparseMatrixLayoutBuilder::end ( )
pure virtual

Finishes the building process completing the creation of the associate layout structure. Returns false on errors (out of memory, for example).

Implemented in GmHashCSxSparseMatrixLayoutBuilder< IndexType, T >, GmVectorCSxSparseMatrixLayoutBuilder< IndexType, T >, GmVectorCSxSparseMatrixLayoutBuilder< IndexType, T >, and GmVectorCSxSparseMatrixLayoutBuilder< IndexType, T >.


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