|
Ifpack2 Templated Preconditioning Package
Version 1.0
|
Store and solve a local sparse linear problem. More...
#include <Ifpack2_SparseContainer_decl.hpp>

Public Types | |
Public typedefs | |
| typedef MatrixType | matrix_type |
| The first template parameter of this class. | |
| typedef InverseType | inverse_type |
| The second template parameter of this class. | |
| typedef MatrixType::scalar_type | scalar_type |
| The type of entries in the input (global) matrix. | |
| typedef MatrixType::local_ordinal_type | local_ordinal_type |
| The type of local indices in the input (global) matrix. | |
| typedef MatrixType::global_ordinal_type | global_ordinal_type |
| The type of global indices in the input (global) matrix. | |
| typedef MatrixType::node_type | node_type |
| The Kokkos Node type of the input (global) matrix. | |
| typedef Container< MatrixType > ::row_matrix_type | row_matrix_type |
| The (base class) type of the input matrix. | |
Public Member Functions | |
Constructor and destructor | |
| SparseContainer (const Teuchos::RCP< const row_matrix_type > &matrix, const Teuchos::ArrayView< const local_ordinal_type > &localRows) | |
| Constructor. | |
| virtual | ~SparseContainer () |
| Destructor (declared virtual for memory safety of derived classes). | |
Get and set methods | |
| virtual size_t | getNumRows () const |
| The number of rows in the local matrix on the calling process. | |
| virtual bool | isInitialized () const |
| Whether the container has been successfully initialized. | |
| virtual bool | isComputed () const |
| Whether the container has been successfully computed. | |
| virtual void | setParameters (const Teuchos::ParameterList &List) |
| Set all necessary parameters. | |
Mathematical functions | |
| virtual void | initialize () |
| Do all set-up operations that only require matrix structure. | |
| virtual void | compute () |
| Extract the local diagonal block and prepare the solver. | |
| virtual void | apply (const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const |
Compute Y := alpha * M^{-1} X + beta*Y. | |
| virtual void | weightedApply (const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &D, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const |
Compute Y := alpha * diag(D) * M^{-1} (diag(D) * X) + beta*Y. | |
Miscellaneous methods | |
| virtual std::ostream & | print (std::ostream &os) const |
| Print information about this object to the given output stream. | |
Implementation of Teuchos::Describable | |
| virtual std::string | description () const |
| A one-line description of this object. | |
| virtual void | describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const |
| Print the object with some verbosity level to the given FancyOStream. | |
Store and solve a local sparse linear problem.
Please refer to the documentation of the Container interface. Currently, Containers are used by BlockRelaxation. Block relaxations need to be able to do two things:
These correspond to the two template parameters:
MatrixType, which stores a sparse matrix InverseType, which solves linear systems with that matrix This class stores each block as a sparse matrix. Thus, MatrixType must be a specialization of Tpetra::RowMatrix or of its subclass Tpetra::CrsMatrix. Using a sparse matrix for each block is a good idea when the blocks are large and sparse. For small and / or dense blocks, it would probably be better to use an implementation of Container that stores the blocks densely.
The InverseType template parameter represents the class to use for solving linear systems with a block. In SparseContainer, this template parameter must be a specialization of Preconditioner. Specifically, InverseType must implement the following methods:
RCP<const MatrixType> setParameters(Teuchos::ParameterList&) initialize() compute() apply (const MV& X, MV& Y, ...), where MV is the appropriate specialization of Tpetra::MultiVector We also assume that InverseType has the following typedefs:
scalar_type local_ordinal_type global_ordinal_type node_type MatrixType and InverseType may store values of different types, and may have different template parameters (e.g., local or global ordinal types). You may mix and match so long as implicit conversions are available. The most obvious use case for this are:
MatrixType::global_ordinal_type=long long and InverseType::global_ordinal_type=shortMatrixType::scalar_type=float and InverseType::scalar_type=doubleSparseContainer currently assumes the following about the column and row Maps of the input matrix:
These assumptions may be violated if MatrixType is a Tpetra::CrsMatrix specialization and was constructed with a user-provided column Map. The assumptions are not mathematically necessary and could be relaxed at any time. Implementers who wish to do so will need to modify the extract() method, so that it translates explicitly between local row and column indices, instead of just assuming that they are the same.
| typedef MatrixType Ifpack2::SparseContainer< MatrixType, InverseType >::matrix_type |
The first template parameter of this class.
This must be either a Tpetra::RowMatrix specialization or a Tpetra::CrsMatrix specialization. It may have entirely different template parameters (e.g., scalar_type) than InverseType.
| typedef InverseType Ifpack2::SparseContainer< MatrixType, InverseType >::inverse_type |
The second template parameter of this class.
This must be a specialization of Ifpack2::Preconditioner or one of its subclasses. It may have entirely different template parameters (e.g., scalar_type) than MatrixType.
| typedef MatrixType::scalar_type Ifpack2::SparseContainer< MatrixType, InverseType >::scalar_type |
The type of entries in the input (global) matrix.
Reimplemented from Ifpack2::Container< MatrixType >.
| typedef MatrixType::local_ordinal_type Ifpack2::SparseContainer< MatrixType, InverseType >::local_ordinal_type |
The type of local indices in the input (global) matrix.
Reimplemented from Ifpack2::Container< MatrixType >.
| typedef MatrixType::global_ordinal_type Ifpack2::SparseContainer< MatrixType, InverseType >::global_ordinal_type |
The type of global indices in the input (global) matrix.
Reimplemented from Ifpack2::Container< MatrixType >.
| typedef MatrixType::node_type Ifpack2::SparseContainer< MatrixType, InverseType >::node_type |
The Kokkos Node type of the input (global) matrix.
Reimplemented from Ifpack2::Container< MatrixType >.
| typedef Container<MatrixType>::row_matrix_type Ifpack2::SparseContainer< MatrixType, InverseType >::row_matrix_type |
The (base class) type of the input matrix.
The input matrix to the constructor may be either a Tpetra::RowMatrix specialization or a Tpetra::CrsMatrix specialization. However, we want to make the constructor as general as possible, so we always accept the matrix as a Tpetra::RowMatrix. This typedef is the appropriate specialization of Tpetra::RowMatrix.
Reimplemented from Ifpack2::Container< MatrixType >.
| Ifpack2::SparseContainer< MatrixType, InverseType >::SparseContainer | ( | const Teuchos::RCP< const row_matrix_type > & | matrix, |
| const Teuchos::ArrayView< const local_ordinal_type > & | localRows | ||
| ) |
Constructor.
matrix [in] The original input matrix. This Container will construct a local diagonal block from the rows given by localRows.
| localRows | [in] The set of (local) rows assigned to this container. localRows[i] == j, where i (from 0 to getNumRows() - 1) indicates the SparseContainer's row, and j indicates the local row in the calling process. localRows.size() gives the number of rows in the local matrix on each process. This may be different on different processes. |
| Ifpack2::SparseContainer< MatrixType, InverseType >::~SparseContainer | ( | ) | [virtual] |
Destructor (declared virtual for memory safety of derived classes).
| size_t Ifpack2::SparseContainer< MatrixType, InverseType >::getNumRows | ( | ) | const [virtual] |
The number of rows in the local matrix on the calling process.
Local matrices must be square. Each process has exactly one matrix. Those matrices may vary in dimensions.
Implements Ifpack2::Container< MatrixType >.
| bool Ifpack2::SparseContainer< MatrixType, InverseType >::isInitialized | ( | ) | const [virtual] |
Whether the container has been successfully initialized.
Implements Ifpack2::Container< MatrixType >.
| bool Ifpack2::SparseContainer< MatrixType, InverseType >::isComputed | ( | ) | const [virtual] |
Whether the container has been successfully computed.
Implements Ifpack2::Container< MatrixType >.
| void Ifpack2::SparseContainer< MatrixType, InverseType >::setParameters | ( | const Teuchos::ParameterList & | List | ) | [virtual] |
Set all necessary parameters.
Implements Ifpack2::Container< MatrixType >.
| void Ifpack2::SparseContainer< MatrixType, InverseType >::initialize | ( | ) | [virtual] |
Do all set-up operations that only require matrix structure.
Implements Ifpack2::Container< MatrixType >.
| void Ifpack2::SparseContainer< MatrixType, InverseType >::compute | ( | ) | [virtual] |
Extract the local diagonal block and prepare the solver.
Implements Ifpack2::Container< MatrixType >.
| void Ifpack2::SparseContainer< MatrixType, InverseType >::apply | ( | const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | X, |
| Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | Y, | ||
| Teuchos::ETransp | mode = Teuchos::NO_TRANS, |
||
| scalar_type | alpha = Teuchos::ScalarTraits< scalar_type >::one(), |
||
| scalar_type | beta = Teuchos::ScalarTraits< scalar_type >::zero() |
||
| ) | const [virtual] |
Compute Y := alpha * M^{-1} X + beta*Y.
Implements Ifpack2::Container< MatrixType >.
| void Ifpack2::SparseContainer< MatrixType, InverseType >::weightedApply | ( | const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | X, |
| Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | Y, | ||
| const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > & | D, | ||
| Teuchos::ETransp | mode = Teuchos::NO_TRANS, |
||
| scalar_type | alpha = Teuchos::ScalarTraits< scalar_type >::one(), |
||
| scalar_type | beta = Teuchos::ScalarTraits< scalar_type >::zero() |
||
| ) | const [virtual] |
Compute Y := alpha * diag(D) * M^{-1} (diag(D) * X) + beta*Y.
Implements Ifpack2::Container< MatrixType >.
| std::ostream & Ifpack2::SparseContainer< MatrixType, InverseType >::print | ( | std::ostream & | os | ) | const [virtual] |
Print information about this object to the given output stream.
operator<< uses this method.
Implements Ifpack2::Container< MatrixType >.
| std::string Ifpack2::SparseContainer< MatrixType, InverseType >::description | ( | ) | const [virtual] |
A one-line description of this object.
Reimplemented from Teuchos::Describable.
| void Ifpack2::SparseContainer< MatrixType, InverseType >::describe | ( | Teuchos::FancyOStream & | out, |
| const Teuchos::EVerbosityLevel | verbLevel = Teuchos::Describable::verbLevel_default |
||
| ) | const [virtual] |
Print the object with some verbosity level to the given FancyOStream.
Reimplemented from Teuchos::Describable.
1.7.6.1