|
Amesos2 - Direct Sparse Solver Interfaces
Version of the Day
|
#include <Amesos2_AbstractConcreteMatrixAdapter.hpp>

This class provides a statically polymorphic abstract base class for concrete matrix adapters.
If a matrix M inherits from another matrix class A, it's adapter should inherit from::
AbstractConcreteMatrixAdapter<A,M>
and the common functionality for matrices inheritting from A should reside in a specialization of AbstractConcreteMatrixAdapter
For example, Epetra_CrsMatrix and Epetra_VbrMatrix both inherit from Epetra_RowMatrix. There is much functionality which is common, but some details, such as object construction is specific to each, so the get_impl function, which must create new instances should be adapted differently for each.
template < typename M > AbstractConcreteMatrixAdapter<Epetra_RowMatrix, M> : MatrixAdapter<M> { // < ...common functions... > RCP<MatrixAdapter<M> > get_impl(){ return static_cast<ConcreteMatrixAdapter<M>*>(this)->get_impl(); } }
So now the ConcreteMatrixAdapter specializations for Epetra_CrsMatrix and Epetra_VbrMatrix must only provide the get_impl function.
1.7.6.1