HermesCommon  3.0
Hermes::Algebra::Matrix< Scalar > Class Template Referenceabstract

General (abstract) matrix representation in Hermes. More...

#include <matrix.h>

+ Inheritance diagram for Hermes::Algebra::Matrix< Scalar >:

Public Member Functions

 Matrix (unsigned int size=0)
 
virtual void alloc ()=0
 allocate the memory for stiffness matrix
 
virtual void free ()=0
 free the memory associated with stiffness matrix
 
virtual Scalar get (unsigned int m, unsigned int n) const =0
 
virtual void zero ()=0
 Zero the matrix.
 
virtual void set_row_zero (unsigned int n)
 
virtual void add (unsigned int m, unsigned int n, Scalar v)=0
 
virtual void add (unsigned int m, unsigned int n, Scalar *mat, int *rows, int *cols, const int size)
 
virtual void add_to_diagonal (Scalar v)
 Add a number to each diagonal entry.
 
virtual void multiply_with_vector (Scalar *vector_in, Scalar *&vector_out, bool vector_out_initialized=false) const
 Multiply with a vector.
 
virtual void multiply_with_Scalar (Scalar value)
 Multiply with a Scalar.
 
virtual unsigned int get_size () const
 
template<>
void add (unsigned int m, unsigned int n, double *mat, int *rows, int *cols, const int size)
 
template<>
void add (unsigned int m, unsigned int n, std::complex< double > *mat, int *rows, int *cols, const int size)
 
- Public Member Functions inherited from Hermes::Mixins::Loggable
 Loggable (bool verbose_output=false, callbackFn verbose_callback=NULL, bool add_newline=true)
 
void set_file_output_only (bool onOff)
 
void set_timestamps (bool onOff)
 Sets the addition of a time stamp on each line in the log file. By default it is on.
 
void set_erase_on_beginning (bool onOff)
 Sets the logFile being always erased before logging.
 
void set_logFile_name (const char *filename)
 
void set_logFile_name (std::string filename)
 
void info (const char *msg,...) const
 
void info_if (bool cond, const char *msg,...) const
 
void warn (const char *msg,...) const
 
void warn_if (bool cond, const char *msg,...) const
 
void error (const char *msg,...) const
 
void error_if (bool cond, const char *msg,...) const
 
virtual void set_verbose_output (bool to_set)
 
bool get_verbose_output () const
 Returns the current value of verbose_output;.
 
virtual void set_verbose_callback (callbackFn callback)
 
callbackFn get_verbose_callback () const
 Returns the current value of verbose_callback;.
 
- Public Member Functions inherited from Hermes::Algebra::Mixins::MatrixRhsImportExport< Scalar >
virtual void export_to_file (const char *filename, const char *var_name, Algebra::MatrixExportFormat fmt, char *number_format="%lf")=0
 
void export_to_file (std::string filename, const char *var_name, Algebra::MatrixExportFormat fmt, char *number_format="%lf")
 
void export_to_file (std::string filename, std::string var_name, Algebra::MatrixExportFormat fmt, char *number_format="%lf")
 
virtual void import_from_file (const char *filename, const char *var_name, Algebra::MatrixExportFormat fmt)
 
void import_from_file (std::string filename, const char *var_name, Algebra::MatrixExportFormat fmt)
 
void import_from_file (std::string filename, std::string var_name, Algebra::MatrixExportFormat fmt)
 

Protected Attributes

unsigned int size
 matrix size
 

Additional Inherited Members

- Static Public Member Functions inherited from Hermes::Mixins::Loggable
static void set_static_logFile_name (const char *filename)
 
static void set_static_logFile_name (std::string filename)
 
- Public Attributes inherited from Hermes::Mixins::Loggable
char * logFileName
 Logfile name.
 
- Static Public Attributes inherited from Hermes::Mixins::Loggable
static char * staticLogFileName = nullptr
 
- Protected Member Functions inherited from Hermes::Mixins::Loggable
void hermes_fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream) const
 
void hermes_fread (void *ptr, size_t size, size_t nitems, FILE *stream) const
 

Detailed Description

template<typename Scalar>
class Hermes::Algebra::Matrix< Scalar >

General (abstract) matrix representation in Hermes.

Definition at line 36 of file matrix.h.

Constructor & Destructor Documentation

template<typename Scalar >
Hermes::Algebra::Matrix< Scalar >::Matrix ( unsigned int  size = 0)

constructor of matrix

Parameters
[in]sizesize of matrix

Definition at line 43 of file matrix.cpp.

Member Function Documentation

template<typename Scalar>
virtual void Hermes::Algebra::Matrix< Scalar >::add ( unsigned int  m,
unsigned int  n,
Scalar  v 
)
pure virtual

update the stiffness matrix

Parameters
[in]m- the row where to update
[in]n- the column where to update
[in]v- value

Implemented in Hermes::Algebra::CSRMatrix< Scalar >, Hermes::Algebra::CSCMatrix< Scalar >, Hermes::Algebra::MumpsMatrix< Scalar >, Hermes::Algebra::EpetraMatrix< Scalar >, and Hermes::Algebra::CSMatrix< Scalar >.

template<typename Scalar>
virtual void Hermes::Algebra::Matrix< Scalar >::add ( unsigned int  m,
unsigned int  n,
Scalar *  mat,
int *  rows,
int *  cols,
const int  size 
)
virtual

update the stiffness matrix

Parameters
[in]m- number of rows of given block
[in]n- number of columns of given block
[in]mat- block of values
[in]rows- array with row indexes
[in]cols- array with column indexes

Reimplemented in Hermes::Algebra::EpetraMatrix< Scalar >.

template<typename Scalar>
virtual Scalar Hermes::Algebra::Matrix< Scalar >::get ( unsigned int  m,
unsigned int  n 
) const
pure virtual

Get the value from a position

Returns
the value from the specified position
Parameters
[in]m- the number of row
[in]n- the number of column

Implemented in Hermes::Algebra::CSRMatrix< Scalar >, Hermes::Algebra::CSCMatrix< Scalar >, Hermes::Algebra::MumpsMatrix< Scalar >, Hermes::Algebra::EpetraMatrix< Scalar >, and Hermes::Algebra::CSMatrix< Scalar >.

Referenced by Hermes::Algebra::SparseMatrix< Scalar >::add_as_block().

template<typename Scalar >
void Hermes::Algebra::Matrix< Scalar >::set_row_zero ( unsigned int  n)
virtual

set the stiffness matrix

Parameters
[in]m- the row where to set
[in]n- the column where to set
[in]v- value

Reimplemented in Hermes::Algebra::CSMatrix< Scalar >.

Definition at line 48 of file matrix.cpp.


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