ShellMatrix< T > Class Template Reference
#include <shell_matrix.h>

Public Member Functions | |
| ShellMatrix () | |
| virtual | ~ShellMatrix () |
| virtual unsigned int | m () const =0 |
| virtual unsigned int | n () const =0 |
| virtual void | vector_mult (NumericVector< T > &dest, const NumericVector< T > &arg) const =0 |
| virtual void | vector_mult_add (NumericVector< T > &dest, const NumericVector< T > &arg) const =0 |
| virtual void | get_diagonal (NumericVector< T > &dest) const =0 |
Static Public Member Functions | |
| static std::string | get_info () |
| static void | print_info () |
| static unsigned int | n_objects () |
Protected Types | |
| typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Protected Member Functions | |
| void | increment_constructor_count (const std::string &name) |
| void | increment_destructor_count (const std::string &name) |
Static Protected Attributes | |
| static Counts | _counts |
| static Threads::atomic < unsigned int > | _n_objects |
| static Threads::spin_mutex | _mutex |
Detailed Description
template<typename T>
class ShellMatrix< T >
Generic shell matrix, i.e. a matrix that does not define anything but its action on a vector. This class contains pure virtual members that must be overloaded in derived classes.
Definition at line 44 of file shell_matrix.h.
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited] |
Data structure to log the information. The log is identified by the class name.
Definition at line 105 of file reference_counter.h.
Constructor & Destructor Documentation
| ShellMatrix< T >::ShellMatrix | ( | ) | [inline] |
| ShellMatrix< T >::~ShellMatrix | ( | ) | [inline, virtual] |
Member Function Documentation
| virtual void ShellMatrix< T >::get_diagonal | ( | NumericVector< T > & | dest | ) | const [pure virtual] |
Copies the diagonal part of the matrix into dest.
Implemented in SparseShellMatrix< T >, SumShellMatrix< T >, and TensorShellMatrix< T >.
Referenced by SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), and PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal().
| std::string ReferenceCounter::get_info | ( | ) | [static, inherited] |
Gets a string containing the reference information.
Definition at line 45 of file reference_counter.C.
References ReferenceCounter::_counts, and QuadratureRules::name().
Referenced by ReferenceCounter::print_info().
00046 { 00047 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG) 00048 00049 std::ostringstream out; 00050 00051 out << '\n' 00052 << " ---------------------------------------------------------------------------- \n" 00053 << "| Reference count information |\n" 00054 << " ---------------------------------------------------------------------------- \n"; 00055 00056 for (Counts::iterator it = _counts.begin(); 00057 it != _counts.end(); ++it) 00058 { 00059 const std::string name(it->first); 00060 const unsigned int creations = it->second.first; 00061 const unsigned int destructions = it->second.second; 00062 00063 out << "| " << name << " reference count information:\n" 00064 << "| Creations: " << creations << '\n' 00065 << "| Destructions: " << destructions << '\n'; 00066 } 00067 00068 out << " ---------------------------------------------------------------------------- \n"; 00069 00070 return out.str(); 00071 00072 #else 00073 00074 return ""; 00075 00076 #endif 00077 }
| void ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 149 of file reference_counter.h.
References ReferenceCounter::_counts, and Threads::spin_mtx.
Referenced by ReferenceCountedObject< SparseMatrix< T > >::ReferenceCountedObject().
00150 { 00151 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00152 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00153 00154 p.first++; 00155 }
| void ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 167 of file reference_counter.h.
References ReferenceCounter::_counts, and Threads::spin_mtx.
Referenced by ReferenceCountedObject< SparseMatrix< T > >::~ReferenceCountedObject().
00168 { 00169 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00170 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00171 00172 p.second++; 00173 }
| virtual unsigned int ShellMatrix< T >::m | ( | ) | const [pure virtual] |
- Returns:
m, the row-dimension of the matrix where the marix is
.
Implemented in SparseShellMatrix< T >, SumShellMatrix< T >, and TensorShellMatrix< T >.
Referenced by SlepcEigenSolver< T >::solve_generalized(), and SlepcEigenSolver< T >::solve_standard().
| virtual unsigned int ShellMatrix< T >::n | ( | ) | const [pure virtual] |
- Returns:
n, the column-dimension of the matrix where the marix is
.
Implemented in SparseShellMatrix< T >, SumShellMatrix< T >, and TensorShellMatrix< T >.
Referenced by SlepcEigenSolver< T >::solve_generalized(), and SlepcEigenSolver< T >::solve_standard().
| static unsigned int ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 76 of file reference_counter.h.
References ReferenceCounter::_n_objects.
00077 { return _n_objects; }
| void ReferenceCounter::print_info | ( | ) | [static, inherited] |
Prints the reference information to std::cout.
Definition at line 83 of file reference_counter.C.
References ReferenceCounter::get_info().
00084 { 00085 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG) 00086 00087 std::cout << ReferenceCounter::get_info(); 00088 00089 #endif 00090 }
| virtual void ShellMatrix< T >::vector_mult | ( | NumericVector< T > & | dest, | |
| const NumericVector< T > & | arg | |||
| ) | const [pure virtual] |
Multiplies the matrix with arg and stores the result in dest.
Implemented in SparseShellMatrix< T >, SumShellMatrix< T >, and TensorShellMatrix< T >.
Referenced by SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), and PetscLinearSolver< T >::_petsc_shell_matrix_mult().
| virtual void ShellMatrix< T >::vector_mult_add | ( | NumericVector< T > & | dest, | |
| const NumericVector< T > & | arg | |||
| ) | const [pure virtual] |
Multiplies the matrix with arg and adds the result to dest.
Implemented in SparseShellMatrix< T >, SumShellMatrix< T >, and TensorShellMatrix< T >.
Referenced by NumericVector< T >::add_vector().
Member Data Documentation
ReferenceCounter::Counts ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 110 of file reference_counter.h.
Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().
Threads::spin_mutex ReferenceCounter::_mutex [static, protected, inherited] |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 123 of file reference_counter.h.
Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited] |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 118 of file reference_counter.h.
Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().
The documentation for this class was generated from the following file: