Public Member Functions | Protected Attributes | List of all members
oomph::CCMatrix< T > Class Template Reference

/////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// More...

#include <matrices.h>

+ Inheritance diagram for oomph::CCMatrix< T >:

Public Member Functions

 CCMatrix ()
 Default constructor. More...
 
 CCMatrix (const Vector< T > &value, const Vector< int > &row_index_, const Vector< int > &column_start_, const unsigned long &n, const unsigned long &m)
 Constructor: Pass vector of values, vector of row indices, vector of column starts and number of rows (can be suppressed for square matrices). Number of nonzero entries is read off from value, so make sure the vector has been shrunk to its correct length. More...
 
 CCMatrix (const CCMatrix &source_matrix)
 Copy constructor. More...
 
void operator= (const CCMatrix &)=delete
 Broken assignment operator. More...
 
virtual ~CCMatrix ()
 Destructor, delete any allocated memory. More...
 
get_entry (const unsigned long &i, const unsigned long &j) const
 Access function that will be called by the read-only round-bracket operator (const) More...
 
T & entry (const unsigned long &i, const unsigned long &j)
 Read-write access is not permitted for these matrices and is deliberately broken. More...
 
int * column_start ()
 Access to C-style column_start array. More...
 
const int * column_start () const
 Access to C-style column_start array (const version) More...
 
int * row_index ()
 Access to C-style row index array. More...
 
const int * row_index () const
 Access to C-style row index array (const version) More...
 
void output_bottom_right_zero_helper (std::ostream &outfile) const
 Output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python). More...
 
void sparse_indexed_output_helper (std::ostream &outfile) const
 Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only. More...
 
void clean_up_memory ()
 Wipe matrix data and set all values to 0. More...
 
void build (const Vector< T > &value, const Vector< int > &row_index, const Vector< int > &column_start, const unsigned long &n, const unsigned long &m)
 Build matrix from compressed representation. Number of nonzero entries is read off from value, so make sure the vector has been shrunk to its correct length. More...
 
void build_without_copy (T *value, int *row_index, int *column_start, const unsigned long &nnz, const unsigned long &n, const unsigned long &m)
 Function to build matrix from pointers to arrays which hold the column starts, row indices and non-zero values. The final parameters specifies the number of rows and columns. Note that, as the name suggests, this function does not make a copy of the data pointed to by the first three arguments! More...
 
- Public Member Functions inherited from oomph::SparseMatrix< T, CCMatrix< T > >
 SparseMatrix ()
 Default constructor. More...
 
 SparseMatrix (const SparseMatrix &source_matrix)
 Copy constructor. More...
 
void operator= (const SparseMatrix &)=delete
 Broken assignment operator. More...
 
virtual ~SparseMatrix ()
 Destructor, delete the memory associated with the values. More...
 
T * value ()
 Access to C-style value array. More...
 
const T * value () const
 Access to C-style value array (const version) More...
 
unsigned long nrow () const
 Return the number of rows of the matrix. More...
 
unsigned long ncol () const
 Return the number of columns of the matrix. More...
 
unsigned long nnz () const
 Return the number of nonzero entries. More...
 
- Public Member Functions inherited from oomph::Matrix< T, MATRIX_TYPE >
 Matrix ()
 (Empty) constructor More...
 
 Matrix (const Matrix &matrix)=delete
 Broken copy constructor. More...
 
void operator= (const Matrix &)=delete
 Broken assignment operator. More...
 
virtual ~Matrix ()
 Virtual (empty) destructor. More...
 
operator() (const unsigned long &i, const unsigned long &j) const
 Round brackets to give access as a(i,j) for read only (we're not providing a general interface for component-wise write access since not all matrix formats allow efficient direct access!) The function uses the MATRIX_TYPE template parameter to call the get_entry() function which must be defined in all derived classes that are to be fully instantiated. More...
 
T & operator() (const unsigned long &i, const unsigned long &j)
 Round brackets to give access as a(i,j) for read-write access. The function uses the MATRIX_TYPE template parameter to call the entry() function which must be defined in all derived classes that are to be fully instantiated. If the particular Matrix does not allow write access, the function should break with an error message. More...
 
virtual void output (std::ostream &outfile) const
 Output function to print a matrix row-by-row, in the form a(0,0) a(0,1) ... a(1,0) a(1,1) ... ... to the stream outfile. Broken virtual since it might not be sensible to implement this for some sparse matrices. More...
 
void sparse_indexed_output (std::ostream &outfile, const unsigned &precision=0, const bool &output_bottom_right_zero=false) const
 Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only with specified precision (if precision=0 then nothing is changed). If optional boolean flag is set to true we also output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python). More...
 
void sparse_indexed_output (std::string filename, const unsigned &precision=0, const bool &output_bottom_right_zero=false) const
 Indexed output function to print a matrix to the file named filename as i,j,a(i,j) for a(i,j)!=0 only with specified precision. If optional boolean flag is set to true we also output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python). More...
 

Protected Attributes

int * Row_index
 Row index. More...
 
int * Column_start
 Start index for column. More...
 
- Protected Attributes inherited from oomph::SparseMatrix< T, CCMatrix< T > >
T * Value
 Internal representation of the matrix values, a pointer. More...
 
unsigned long N
 Number of rows. More...
 
unsigned long M
 Number of columns. More...
 
unsigned long Nnz
 Number of non-zero values (i.e. size of Value array) More...
 

Additional Inherited Members

- Protected Member Functions inherited from oomph::Matrix< T, MATRIX_TYPE >
void range_check (const unsigned long &i, const unsigned long &j) const
 Range check to catch when an index is out of bounds, if so, it issues a warning message and dies by throwing an OomphLibError. More...
 
- Static Protected Attributes inherited from oomph::SparseMatrix< T, CCMatrix< T > >
static T Zero
 Dummy zero. More...
 

Detailed Description

template<class T>
class oomph::CCMatrix< T >

/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////

A class for compressed column matrices: a sparse matrix format The class is passed as the MATRIX_TYPE paramater so that the base class can use the specific access functions in the round-bracket operator.

Definition at line 2584 of file matrices.h.

Constructor & Destructor Documentation

◆ CCMatrix() [1/3]

template<class T >
oomph::CCMatrix< T >::CCMatrix ( )
inline

Default constructor.

Definition at line 2588 of file matrices.h.

References oomph::CCMatrix< T >::Column_start, and oomph::CCMatrix< T >::Row_index.

◆ CCMatrix() [2/3]

template<class T >
oomph::CCMatrix< T >::CCMatrix ( const Vector< T > &  value,
const Vector< int > &  row_index_,
const Vector< int > &  column_start_,
const unsigned long &  n,
const unsigned long &  m 
)
inline

Constructor: Pass vector of values, vector of row indices, vector of column starts and number of rows (can be suppressed for square matrices). Number of nonzero entries is read off from value, so make sure the vector has been shrunk to its correct length.

Definition at line 2600 of file matrices.h.

References oomph::CCMatrix< T >::build(), oomph::CCMatrix< T >::Column_start, oomph::CCMatrix< T >::Row_index, and oomph::SparseMatrix< T, CCMatrix< T > >::value().

◆ CCMatrix() [3/3]

template<class T >
oomph::CCMatrix< T >::CCMatrix ( const CCMatrix< T > &  source_matrix)
inline

◆ ~CCMatrix()

template<class T >
virtual oomph::CCMatrix< T >::~CCMatrix ( )
inlinevirtual

Destructor, delete any allocated memory.

Definition at line 2644 of file matrices.h.

References oomph::CCMatrix< T >::Column_start, and oomph::CCMatrix< T >::Row_index.

Member Function Documentation

◆ build()

template<class T >
void oomph::CCMatrix< T >::build ( const Vector< T > &  value,
const Vector< int > &  row_index,
const Vector< int > &  column_start,
const unsigned long &  n,
const unsigned long &  m 
)

Build matrix from compressed representation. Number of nonzero entries is read off from value, so make sure the vector has been shrunk to its correct length.

Definition at line 3247 of file matrices.h.

References i, oomph::QuadTreeNames::N, and oomph::ElementGeometry::T.

Referenced by oomph::CCMatrix< T >::CCMatrix().

◆ build_without_copy()

template<class T >
void oomph::CCMatrix< T >::build_without_copy ( T *  value,
int *  row_index,
int *  column_start,
const unsigned long &  nnz,
const unsigned long &  n,
const unsigned long &  m 
)

Function to build matrix from pointers to arrays which hold the column starts, row indices and non-zero values. The final parameters specifies the number of rows and columns. Note that, as the name suggests, this function does not make a copy of the data pointed to by the first three arguments!

Build matrix from compressed representation. Note that, as the name suggests, this function does not make a copy of the data pointed to by the first three arguments!

Definition at line 3199 of file matrices.h.

References oomph::QuadTreeNames::N.

Referenced by oomph::Problem::get_jacobian(), and oomph::CCDoubleMatrix::multiply().

◆ clean_up_memory()

template<class T >
void oomph::CCMatrix< T >::clean_up_memory

Wipe matrix data and set all values to 0.

///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

Wipe matrix data and set all values to 0.

Definition at line 3169 of file matrices.h.

References oomph::QuadTreeNames::N.

Referenced by oomph::SuperLUSolver::factorise_distributed().

◆ column_start() [1/2]

template<class T >
int* oomph::CCMatrix< T >::column_start ( )
inline

◆ column_start() [2/2]

template<class T >
const int* oomph::CCMatrix< T >::column_start ( ) const
inline

Access to C-style column_start array (const version)

Definition at line 2698 of file matrices.h.

References oomph::CCMatrix< T >::Column_start.

◆ entry()

template<class T >
T& oomph::CCMatrix< T >::entry ( const unsigned long &  i,
const unsigned long &  j 
)
inline

Read-write access is not permitted for these matrices and is deliberately broken.

Definition at line 2671 of file matrices.h.

References oomph::Global_string_for_annotation::string(), and oomph::ElementGeometry::T.

◆ get_entry()

template<class T >
T oomph::CCMatrix< T >::get_entry ( const unsigned long &  i,
const unsigned long &  j 
) const
inline

◆ operator=()

template<class T >
void oomph::CCMatrix< T >::operator= ( const CCMatrix< T > &  )
delete

Broken assignment operator.

◆ output_bottom_right_zero_helper()

template<class T >
void oomph::CCMatrix< T >::output_bottom_right_zero_helper ( std::ostream &  outfile) const
inlinevirtual

Output the "bottom right" entry regardless of it being zero or not (this allows automatic detection of matrix size in e.g. matlab, python).

Reimplemented from oomph::SparseMatrix< T, CCMatrix< T > >.

Definition at line 2718 of file matrices.h.

References oomph::SparseMatrix< T, CCMatrix< T > >::M, oomph::SparseMatrix< T, CCMatrix< T > >::N, oomph::Matrix< T, MATRIX_TYPE >::operator()(), and oomph::ElementGeometry::T.

◆ row_index() [1/2]

template<class T >
int* oomph::CCMatrix< T >::row_index ( )
inline

◆ row_index() [2/2]

template<class T >
const int* oomph::CCMatrix< T >::row_index ( ) const
inline

Access to C-style row index array (const version)

Definition at line 2710 of file matrices.h.

References oomph::CCMatrix< T >::Row_index.

◆ sparse_indexed_output_helper()

template<class T >
void oomph::CCMatrix< T >::sparse_indexed_output_helper ( std::ostream &  outfile) const
inlinevirtual

Indexed output function to print a matrix to the stream outfile as i,j,a(i,j) for a(i,j)!=0 only.

Reimplemented from oomph::SparseMatrix< T, CCMatrix< T > >.

Definition at line 2735 of file matrices.h.

References oomph::CCMatrix< T >::Column_start, oomph::SparseMatrix< T, CCMatrix< T > >::N, oomph::CCMatrix< T >::Row_index, and oomph::SparseMatrix< T, CCMatrix< T > >::Value.

Member Data Documentation

◆ Column_start

template<class T >
int* oomph::CCMatrix< T >::Column_start
protected

◆ Row_index

template<class T >
int* oomph::CCMatrix< T >::Row_index
protected

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