libMesh
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
libMesh::EpetraMatrix< T > Class Template Referencefinal

This class provides a nice interface to the Epetra data structures for parallel, sparse matrices. More...

#include <trilinos_epetra_matrix.h>

Inheritance diagram for libMesh::EpetraMatrix< T >:
[legend]

Public Member Functions

 EpetraMatrix (const Parallel::Communicator &comm)
 Constructor; initializes the matrix to be empty, without any structure, i.e. More...
 
 EpetraMatrix (Epetra_FECrsMatrix *m, const Parallel::Communicator &comm)
 Constructor. More...
 
 EpetraMatrix (EpetraMatrix &&)=delete
 This class manages the lifetime of an Epetra_FECrsMatrix manually, so we don't want to allow any automatic copy/move functions to be generated, and we can't default the destructor. More...
 
 EpetraMatrix (const EpetraMatrix &)=delete
 
EpetraMatrixoperator= (const EpetraMatrix &)=delete
 
EpetraMatrixoperator= (EpetraMatrix &&)=delete
 
virtual ~EpetraMatrix ()
 
virtual bool need_full_sparsity_pattern () const override
 The EpetraMatrix needs the full sparsity pattern. More...
 
virtual void update_sparsity_pattern (const SparsityPattern::Graph &) override
 Updates the matrix sparsity pattern. More...
 
virtual void init (const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1) override
 Initialize SparseMatrix with the specified sizes. More...
 
virtual void init () override
 Initialize this matrix using the sparsity structure computed by dof_map. More...
 
virtual void clear () override
 Restores the SparseMatrix<T> to a pristine state. More...
 
virtual void zero () override
 Set all entries to 0. More...
 
virtual void close () override
 Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across processors. More...
 
virtual numeric_index_type m () const override
 
virtual numeric_index_type n () const override
 
virtual numeric_index_type row_start () const override
 
virtual numeric_index_type row_stop () const override
 
virtual void set (const numeric_index_type i, const numeric_index_type j, const T value) override
 Set the element (i,j) to value. More...
 
virtual void add (const numeric_index_type i, const numeric_index_type j, const T value) override
 Add value to the element (i,j). More...
 
virtual void add_matrix (const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols) override
 Add the full matrix dm to the SparseMatrix. More...
 
virtual void add_matrix (const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &dof_indices) override
 Same as add_matrix, but assumes the row and column maps are the same. More...
 
virtual void add (const T a, const SparseMatrix< T > &X) override
 Compute A += a*X for scalar a, matrix X. More...
 
virtual T operator() (const numeric_index_type i, const numeric_index_type j) const override
 
virtual Real l1_norm () const override
 
virtual Real linfty_norm () const override
 
virtual bool closed () const override
 
virtual void print_personal (std::ostream &os=libMesh::out) const override
 Print the contents of the matrix to the screen in a package-personalized style, if available. More...
 
virtual void get_diagonal (NumericVector< T > &dest) const override
 Copies the diagonal part of the matrix into dest. More...
 
virtual void get_transpose (SparseMatrix< T > &dest) const override
 Copies the transpose of the matrix into dest, which may be *this. More...
 
void swap (EpetraMatrix< T > &)
 Swaps the internal data pointers, no actual values are swapped. More...
 
Epetra_FECrsMatrix * mat ()
 
const Epetra_FECrsMatrix * mat () const
 
virtual bool initialized () const
 
void attach_dof_map (const DofMap &dof_map)
 Get a pointer to the DofMap to use. More...
 
virtual void zero_rows (std::vector< numeric_index_type > &rows, T diag_value=0.0)
 Sets all row entries to 0 then puts diag_value in the diagonal entry. More...
 
virtual void flush ()
 For PETSc matrix , this function is similar to close but without shrinking memory. More...
 
virtual void add_block_matrix (const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &brows, const std::vector< numeric_index_type > &bcols)
 Add the full matrix dm to the SparseMatrix. More...
 
virtual void add_block_matrix (const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &dof_indices)
 Same as add_block_matrix(), but assumes the row and column maps are the same. More...
 
void print (std::ostream &os=libMesh::out, const bool sparse=false) const
 Print the contents of the matrix to the screen in a uniform style, regardless of matrix/solver package being used. More...
 
virtual void print_matlab (const std::string &="") const
 Print the contents of the matrix in Matlab's sparse matrix format. More...
 
virtual void create_submatrix (SparseMatrix< T > &submatrix, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols) const
 This function creates a matrix called "submatrix" which is defined by the row and column indices given in the "rows" and "cols" entries. More...
 
virtual void reinit_submatrix (SparseMatrix< T > &submatrix, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols) const
 This function is similar to the one above, but it allows you to reuse the existing sparsity pattern of "submatrix" instead of reallocating it again. More...
 
void vector_mult (NumericVector< T > &dest, const NumericVector< T > &arg) const
 Multiplies the matrix by the NumericVector arg and stores the result in NumericVector dest. More...
 
void vector_mult_add (NumericVector< T > &dest, const NumericVector< T > &arg) const
 Multiplies the matrix by the NumericVector arg and adds the result to the NumericVector dest. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static std::unique_ptr< SparseMatrix< T > > build (const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
 Builds a SparseMatrix<T> using the linear solver package specified by solver_package. More...
 
static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

virtual void _get_submatrix (SparseMatrix< T > &, const std::vector< numeric_index_type > &, const std::vector< numeric_index_type > &, const bool) const
 Protected implementation of the create_submatrix and reinit_submatrix routines. More...
 
void increment_constructor_count (const std::string &name)
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name)
 Increments the destruction counter. More...
 

Protected Attributes

DofMap const * _dof_map
 The DofMap object associated with this object. More...
 
bool _is_initialized
 Flag indicating whether or not the matrix has been initialized. More...
 
const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int > _n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Attributes

Epetra_FECrsMatrix * _mat
 Actual Epetra datatype to hold matrix entries. More...
 
Epetra_Map * _map
 Holds the distributed Map. More...
 
Epetra_CrsGraph * _graph
 Holds the sparsity pattern. More...
 
bool _destroy_mat_on_exit
 This boolean value should only be set to false for the constructor which takes an Epetra_FECrsMatrix object. More...
 
bool _use_transpose
 Epetra has no GetUseTranspose so we need to keep track of whether we're transposed manually. More...
 

Detailed Description

template<typename T>
class libMesh::EpetraMatrix< T >

This class provides a nice interface to the Epetra data structures for parallel, sparse matrices.

All overridden virtual functions are documented in sparse_matrix.h.

Author
Benjamin S. Kirk
Date
2008

Definition at line 63 of file trilinos_epetra_matrix.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 117 of file reference_counter.h.

Constructor & Destructor Documentation

◆ EpetraMatrix() [1/4]

template<typename T >
libMesh::EpetraMatrix< T >::EpetraMatrix ( const Parallel::Communicator comm)

Constructor; initializes the matrix to be empty, without any structure, i.e.

the matrix is not usable at all. This constructor is therefore only useful for matrices which are members of a class. All other matrices should be created at a point in the data flow where all necessary information is available.

You have to initialize the matrix before usage with init(...).

◆ EpetraMatrix() [2/4]

template<typename T >
libMesh::EpetraMatrix< T >::EpetraMatrix ( Epetra_FECrsMatrix *  m,
const Parallel::Communicator comm 
)

Constructor.

Creates a EpetraMatrix assuming you already have a valid Epetra_FECrsMatrix object. In this case, m is NOT destroyed by the EpetraMatrix destructor when this object goes out of scope. This allows ownership of m to remain with the original creator, and to simply provide additional functionality with the EpetraMatrix.

◆ EpetraMatrix() [3/4]

template<typename T >
libMesh::EpetraMatrix< T >::EpetraMatrix ( EpetraMatrix< T > &&  )
delete

This class manages the lifetime of an Epetra_FECrsMatrix manually, so we don't want to allow any automatic copy/move functions to be generated, and we can't default the destructor.

◆ EpetraMatrix() [4/4]

template<typename T >
libMesh::EpetraMatrix< T >::EpetraMatrix ( const EpetraMatrix< T > &  )
delete

◆ ~EpetraMatrix()

template<typename T >
virtual libMesh::EpetraMatrix< T >::~EpetraMatrix ( )
virtual

Member Function Documentation

◆ _get_submatrix()

template<typename T>
virtual void libMesh::SparseMatrix< T >::_get_submatrix ( SparseMatrix< T > &  ,
const std::vector< numeric_index_type > &  ,
const std::vector< numeric_index_type > &  ,
const bool   
) const
protectedvirtualinherited

Protected implementation of the create_submatrix and reinit_submatrix routines.

Note
This function must be overridden in derived classes for it to work properly!

Reimplemented in libMesh::PetscMatrix< T >.

Definition at line 414 of file sparse_matrix.h.

Referenced by libMesh::SparseMatrix< Number >::create_submatrix(), and libMesh::SparseMatrix< Number >::reinit_submatrix().

418  {
419  libmesh_not_implemented();
420  }

◆ add() [1/2]

template<typename T >
virtual void libMesh::EpetraMatrix< T >::add ( const numeric_index_type  i,
const numeric_index_type  j,
const T  value 
)
overridevirtual

Add value to the element (i,j).

Throws an error if the entry does not exist. Zero values can be "added" to non-existent entries.

Implements libMesh::SparseMatrix< T >.

◆ add() [2/2]

template<typename T >
virtual void libMesh::EpetraMatrix< T >::add ( const T  a,
const SparseMatrix< T > &  X 
)
overridevirtual

Compute A += a*X for scalar a, matrix X.

Note
It is advisable to not only allocate appropriate memory with init(), but also explicitly zero the terms of this whenever you add a non-zero value to X.
X will be closed, if not already done, before performing any work.

Implements libMesh::SparseMatrix< T >.

◆ add_block_matrix() [1/2]

template<typename T>
virtual void libMesh::SparseMatrix< T >::add_block_matrix ( const DenseMatrix< T > &  dm,
const std::vector< numeric_index_type > &  brows,
const std::vector< numeric_index_type > &  bcols 
)
virtualinherited

Add the full matrix dm to the SparseMatrix.

This is useful for adding an element matrix at assembly time. The matrix is assumed blocked, and brow, bcol correspond to the block row and column indices.

Reimplemented in libMesh::PetscMatrix< T >.

Referenced by libMesh::SparseMatrix< Number >::add_block_matrix().

◆ add_block_matrix() [2/2]

template<typename T>
virtual void libMesh::SparseMatrix< T >::add_block_matrix ( const DenseMatrix< T > &  dm,
const std::vector< numeric_index_type > &  dof_indices 
)
virtualinherited

Same as add_block_matrix(), but assumes the row and column maps are the same.

Thus the matrix dm must be square.

Reimplemented in libMesh::PetscMatrix< T >.

Definition at line 253 of file sparse_matrix.h.

255  { this->add_block_matrix (dm, dof_indices, dof_indices); }
virtual void add_block_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &brows, const std::vector< numeric_index_type > &bcols)
Add the full matrix dm to the SparseMatrix.

◆ add_matrix() [1/2]

template<typename T >
virtual void libMesh::EpetraMatrix< T >::add_matrix ( const DenseMatrix< T > &  dm,
const std::vector< numeric_index_type > &  rows,
const std::vector< numeric_index_type > &  cols 
)
overridevirtual

Add the full matrix dm to the SparseMatrix.

This is useful for adding an element matrix at assembly time.

Implements libMesh::SparseMatrix< T >.

◆ add_matrix() [2/2]

template<typename T >
virtual void libMesh::EpetraMatrix< T >::add_matrix ( const DenseMatrix< T > &  dm,
const std::vector< numeric_index_type > &  dof_indices 
)
overridevirtual

Same as add_matrix, but assumes the row and column maps are the same.

Thus the matrix dm must be square.

Implements libMesh::SparseMatrix< T >.

◆ attach_dof_map()

template<typename T>
void libMesh::SparseMatrix< T >::attach_dof_map ( const DofMap dof_map)
inherited

Get a pointer to the DofMap to use.

Definition at line 109 of file sparse_matrix.h.

110  { _dof_map = &dof_map; }
DofMap const * _dof_map
The DofMap object associated with this object.

◆ build()

template<typename T>
static std::unique_ptr<SparseMatrix<T> > libMesh::SparseMatrix< T >::build ( const Parallel::Communicator comm,
const SolverPackage  solver_package = libMesh::default_solver_package() 
)
staticinherited

Builds a SparseMatrix<T> using the linear solver package specified by solver_package.

◆ clear()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::clear ( )
overridevirtual

Restores the SparseMatrix<T> to a pristine state.

Implements libMesh::SparseMatrix< T >.

◆ close()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::close ( )
overridevirtual

Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across processors.

Implements libMesh::SparseMatrix< T >.

◆ closed()

template<typename T >
virtual bool libMesh::EpetraMatrix< T >::closed ( ) const
overridevirtual
Returns
true if the matrix has been assembled.

Implements libMesh::SparseMatrix< T >.

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited

◆ create_submatrix()

template<typename T>
virtual void libMesh::SparseMatrix< T >::create_submatrix ( SparseMatrix< T > &  submatrix,
const std::vector< numeric_index_type > &  rows,
const std::vector< numeric_index_type > &  cols 
) const
virtualinherited

This function creates a matrix called "submatrix" which is defined by the row and column indices given in the "rows" and "cols" entries.

Currently this operation is only defined for the PetscMatrix type.

Definition at line 354 of file sparse_matrix.h.

357  {
358  this->_get_submatrix(submatrix,
359  rows,
360  cols,
361  false); // false means DO NOT REUSE submatrix
362  }
virtual void _get_submatrix(SparseMatrix< T > &, const std::vector< numeric_index_type > &, const std::vector< numeric_index_type > &, const bool) const
Protected implementation of the create_submatrix and reinit_submatrix routines.

◆ disable_print_counter_info()

static void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

◆ enable_print_counter_info()

static void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

◆ flush()

template<typename T>
virtual void libMesh::SparseMatrix< T >::flush ( )
virtualinherited

For PETSc matrix , this function is similar to close but without shrinking memory.

This is useful when we want to switch between ADD_VALUES and INSERT_VALUES. close should be called before using the matrix.

Reimplemented in libMesh::PetscMatrix< T >.

Definition at line 182 of file sparse_matrix.h.

182 { close(); }
virtual void close()=0
Calls the SparseMatrix&#39;s internal assembly routines, ensuring that the values are consistent across p...

◆ get_diagonal()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::get_diagonal ( NumericVector< T > &  dest) const
overridevirtual

Copies the diagonal part of the matrix into dest.

Implements libMesh::SparseMatrix< T >.

◆ get_info()

static std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

◆ get_transpose()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::get_transpose ( SparseMatrix< T > &  dest) const
overridevirtual

Copies the transpose of the matrix into dest, which may be *this.

Implements libMesh::SparseMatrix< T >.

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
protectedinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 181 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
protectedinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 194 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
static Counts _counts
Actually holds the data.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.

◆ init() [1/2]

template<typename T >
virtual void libMesh::EpetraMatrix< T >::init ( const numeric_index_type  m,
const numeric_index_type  n,
const numeric_index_type  m_l,
const numeric_index_type  n_l,
const numeric_index_type  nnz = 30,
const numeric_index_type  noz = 10,
const numeric_index_type  blocksize = 1 
)
overridevirtual

Initialize SparseMatrix with the specified sizes.

Parameters
mThe global number of rows.
nThe global number of columns.
m_lThe local number of rows.
n_lThe local number of columns.
nnzThe number of on-diagonal nonzeros per row (defaults to 30).
nozThe number of off-diagonal nonzeros per row (defaults to 10).
blocksizeOptional value indicating dense coupled blocks for systems with multiple variables all of the same type.

Implements libMesh::SparseMatrix< T >.

◆ init() [2/2]

template<typename T >
virtual void libMesh::EpetraMatrix< T >::init ( )
overridevirtual

Initialize this matrix using the sparsity structure computed by dof_map.

Implements libMesh::SparseMatrix< T >.

◆ initialized()

template<typename T>
virtual bool libMesh::SparseMatrix< T >::initialized ( ) const
virtualinherited
Returns
true if the matrix has been initialized, false otherwise.

Definition at line 104 of file sparse_matrix.h.

104 { return _is_initialized; }
bool _is_initialized
Flag indicating whether or not the matrix has been initialized.

◆ l1_norm()

template<typename T >
virtual Real libMesh::EpetraMatrix< T >::l1_norm ( ) const
overridevirtual
Returns
The $ \ell_1 $-norm of the matrix, that is the max column sum: $ |M|_1 = \max_{j} \sum_{i} |M_{ij}| $

This is the natural matrix norm that is compatible with the $ \ell_1 $-norm for vectors, i.e. $ |Mv|_1 \leq |M|_1 |v|_1 $. (cf. Haemmerlin-Hoffmann : Numerische Mathematik)

Implements libMesh::SparseMatrix< T >.

◆ linfty_norm()

template<typename T >
virtual Real libMesh::EpetraMatrix< T >::linfty_norm ( ) const
overridevirtual
Returns
The $ \ell_{\infty} $-norm of the matrix, that is the max row sum:

$ |M|_{\infty} = \max_{i} \sum_{j} |M_{ij}| $

This is the natural matrix norm that is compatible to the $ \ell_{\infty} $-norm of vectors, i.e. $ |Mv|_{\infty} \leq |M|_{\infty} |v|_{\infty} $. (cf. Haemmerlin-Hoffmann : Numerische Mathematik)

Implements libMesh::SparseMatrix< T >.

◆ m()

template<typename T >
virtual numeric_index_type libMesh::EpetraMatrix< T >::m ( ) const
overridevirtual
Returns
The row-dimension of the matrix.

Implements libMesh::SparseMatrix< T >.

◆ mat() [1/2]

template<typename T >
Epetra_FECrsMatrix* libMesh::EpetraMatrix< T >::mat ( )
Returns
The raw Epetra_FECrsMatrix pointer.
Note
This is generally not required in user-level code.
Don't do anything crazy like deleting the pointer, or very bad things will likely happen!

Definition at line 192 of file trilinos_epetra_matrix.h.

References libMesh::EpetraMatrix< T >::_mat.

192 { libmesh_assert(_mat); return _mat; }
Epetra_FECrsMatrix * _mat
Actual Epetra datatype to hold matrix entries.

◆ mat() [2/2]

template<typename T >
const Epetra_FECrsMatrix* libMesh::EpetraMatrix< T >::mat ( ) const

Definition at line 194 of file trilinos_epetra_matrix.h.

References libMesh::EpetraMatrix< T >::_mat.

194 { libmesh_assert(_mat); return _mat; }
Epetra_FECrsMatrix * _mat
Actual Epetra datatype to hold matrix entries.

◆ n()

template<typename T >
virtual numeric_index_type libMesh::EpetraMatrix< T >::n ( ) const
overridevirtual
Returns
The column-dimension of the matrix.

Implements libMesh::SparseMatrix< T >.

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
staticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 83 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

84  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().

Referenced by libMesh::MeshBase::partition().

94  { return cast_int<processor_id_type>(_communicator.size()); }
processor_id_type size() const
Definition: communicator.h:175
const Parallel::Communicator & _communicator

◆ need_full_sparsity_pattern()

template<typename T >
virtual bool libMesh::EpetraMatrix< T >::need_full_sparsity_pattern ( ) const
overridevirtual

The EpetraMatrix needs the full sparsity pattern.

Reimplemented from libMesh::SparseMatrix< T >.

Definition at line 103 of file trilinos_epetra_matrix.h.

104  { return true; }

◆ operator()()

template<typename T >
virtual T libMesh::EpetraMatrix< T >::operator() ( const numeric_index_type  i,
const numeric_index_type  j 
) const
overridevirtual
Returns
A copy of matrix entry (i,j).
Note
This may be an expensive operation, and you should always be careful where you call this function.

Implements libMesh::SparseMatrix< T >.

◆ operator=() [1/2]

template<typename T >
EpetraMatrix& libMesh::EpetraMatrix< T >::operator= ( const EpetraMatrix< T > &  )
delete

◆ operator=() [2/2]

template<typename T >
EpetraMatrix& libMesh::EpetraMatrix< T >::operator= ( EpetraMatrix< T > &&  )
delete

◆ print()

template<typename T>
void libMesh::SparseMatrix< T >::print ( std::ostream &  os = libMesh::out,
const bool  sparse = false 
) const
inherited

Print the contents of the matrix to the screen in a uniform style, regardless of matrix/solver package being used.

Referenced by libMesh::EigenSparseMatrix< T >::print_personal(), and libMesh::LaspackMatrix< T >::print_personal().

◆ print_info()

static void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

◆ print_matlab()

template<typename T>
virtual void libMesh::SparseMatrix< T >::print_matlab ( const std::string &  = "") const
virtualinherited

Print the contents of the matrix in Matlab's sparse matrix format.

Optionally prints the matrix to the file named name. If name is not specified it is dumped to the screen.

Reimplemented in libMesh::PetscMatrix< T >.

Definition at line 344 of file sparse_matrix.h.

345  {
346  libmesh_not_implemented();
347  }

◆ print_personal()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::print_personal ( std::ostream &  os = libMesh::out) const
overridevirtual

Print the contents of the matrix to the screen in a package-personalized style, if available.

Implements libMesh::SparseMatrix< T >.

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited

◆ reinit_submatrix()

template<typename T>
virtual void libMesh::SparseMatrix< T >::reinit_submatrix ( SparseMatrix< T > &  submatrix,
const std::vector< numeric_index_type > &  rows,
const std::vector< numeric_index_type > &  cols 
) const
virtualinherited

This function is similar to the one above, but it allows you to reuse the existing sparsity pattern of "submatrix" instead of reallocating it again.

This should hopefully be more efficient if you are frequently extracting submatrices of the same size.

Definition at line 370 of file sparse_matrix.h.

373  {
374  this->_get_submatrix(submatrix,
375  rows,
376  cols,
377  true); // true means REUSE submatrix
378  }
virtual void _get_submatrix(SparseMatrix< T > &, const std::vector< numeric_index_type > &, const std::vector< numeric_index_type > &, const bool) const
Protected implementation of the create_submatrix and reinit_submatrix routines.

◆ row_start()

template<typename T >
virtual numeric_index_type libMesh::EpetraMatrix< T >::row_start ( ) const
overridevirtual
Returns
The index of the first matrix row stored on this processor.

Implements libMesh::SparseMatrix< T >.

◆ row_stop()

template<typename T >
virtual numeric_index_type libMesh::EpetraMatrix< T >::row_stop ( ) const
overridevirtual
Returns
The index of the last matrix row (+1) stored on this processor.

Implements libMesh::SparseMatrix< T >.

◆ set()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::set ( const numeric_index_type  i,
const numeric_index_type  j,
const T  value 
)
overridevirtual

Set the element (i,j) to value.

Throws an error if the entry does not exist. Zero values can be "stored" in non-existent fields.

Implements libMesh::SparseMatrix< T >.

◆ swap()

template<typename T >
void libMesh::EpetraMatrix< T >::swap ( EpetraMatrix< T > &  )

Swaps the internal data pointers, no actual values are swapped.

◆ update_sparsity_pattern()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::update_sparsity_pattern ( const SparsityPattern::Graph )
overridevirtual

Updates the matrix sparsity pattern.

This will tell the underlying matrix storage scheme how to map the $ (i,j) $ elements.

Reimplemented from libMesh::SparseMatrix< T >.

◆ vector_mult()

template<typename T>
void libMesh::SparseMatrix< T >::vector_mult ( NumericVector< T > &  dest,
const NumericVector< T > &  arg 
) const
inherited

Multiplies the matrix by the NumericVector arg and stores the result in NumericVector dest.

◆ vector_mult_add()

template<typename T>
void libMesh::SparseMatrix< T >::vector_mult_add ( NumericVector< T > &  dest,
const NumericVector< T > &  arg 
) const
inherited

Multiplies the matrix by the NumericVector arg and adds the result to the NumericVector dest.

◆ zero()

template<typename T >
virtual void libMesh::EpetraMatrix< T >::zero ( )
overridevirtual

Set all entries to 0.

Implements libMesh::SparseMatrix< T >.

◆ zero_rows()

template<typename T>
virtual void libMesh::SparseMatrix< T >::zero_rows ( std::vector< numeric_index_type > &  rows,
diag_value = 0.0 
)
virtualinherited

Sets all row entries to 0 then puts diag_value in the diagonal entry.

Reimplemented in libMesh::PetscMatrix< T >.

Member Data Documentation

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _counts

Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

◆ _destroy_mat_on_exit

template<typename T >
bool libMesh::EpetraMatrix< T >::_destroy_mat_on_exit
private

This boolean value should only be set to false for the constructor which takes an Epetra_FECrsMatrix object.

Definition at line 218 of file trilinos_epetra_matrix.h.

◆ _dof_map

template<typename T>
DofMap const* libMesh::SparseMatrix< T >::_dof_map
protectedinherited

The DofMap object associated with this object.

Definition at line 425 of file sparse_matrix.h.

Referenced by libMesh::SparseMatrix< Number >::attach_dof_map().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 141 of file reference_counter.h.

◆ _graph

template<typename T >
Epetra_CrsGraph* libMesh::EpetraMatrix< T >::_graph
private

Holds the sparsity pattern.

Definition at line 212 of file trilinos_epetra_matrix.h.

◆ _is_initialized

template<typename T>
bool libMesh::SparseMatrix< T >::_is_initialized
protectedinherited

Flag indicating whether or not the matrix has been initialized.

Definition at line 430 of file sparse_matrix.h.

Referenced by libMesh::SparseMatrix< Number >::initialized().

◆ _map

template<typename T >
Epetra_Map* libMesh::EpetraMatrix< T >::_map
private

Holds the distributed Map.

Definition at line 207 of file trilinos_epetra_matrix.h.

◆ _mat

template<typename T >
Epetra_FECrsMatrix* libMesh::EpetraMatrix< T >::_mat
private

Actual Epetra datatype to hold matrix entries.

Definition at line 202 of file trilinos_epetra_matrix.h.

Referenced by libMesh::EpetraMatrix< T >::mat().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 135 of file reference_counter.h.

◆ _n_objects

Threads::atomic<unsigned int> libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 130 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

◆ _use_transpose

template<typename T >
bool libMesh::EpetraMatrix< T >::_use_transpose
private

Epetra has no GetUseTranspose so we need to keep track of whether we're transposed manually.

Definition at line 224 of file trilinos_epetra_matrix.h.


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