Skip to content

Commit

Permalink
Ifpack2: add sparse block relaxation option
Browse files Browse the repository at this point in the history
Block relaxation takes the container type as a template parameter,
and is currently hardwired to dense.  As I want to be able to use
sparse blocks, I've added a separate sparse relaxation option called
"SPARSE BLOCK RELAXATION".  This in turn uses Amesos2 as the solver
for the small block matrix.

If Amesos2 isn't enabled and this option is selected, a helpful
exception is thrown.
  • Loading branch information
jhux2 committed Apr 30, 2016
1 parent 6f57082 commit 4312d67
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/ifpack2/src/Ifpack2_Details_OneLevelFactory_def.hpp
Expand Up @@ -54,6 +54,7 @@
#include "Ifpack2_BlockRelaxation.hpp"
#include "Ifpack2_BandedContainer.hpp"
#include "Ifpack2_DenseContainer.hpp"
#include "Ifpack2_SparseContainer.hpp"
#include "Ifpack2_TriDiContainer.hpp"

#ifdef HAVE_IFPACK2_AMESOS2
Expand Down Expand Up @@ -132,6 +133,23 @@ OneLevelFactory<MatrixType>::create (const std::string& precType,
typedef DenseContainer<row_matrix_type, scalar_type> container_type;
prec = rcp (new BlockRelaxation<row_matrix_type, container_type> (matrix));
}
else if (precTypeUpper == "SPARSE_BLOCK_RELAXATION" ||
precTypeUpper == "SPARSE BLOCK RELAXATION" ||
precTypeUpper == "SPARSEBLOCKRELAXATION" ) {
// FIXME (mfh 22 May 2014) We would prefer to have the choice of
// dense or sparse blocks (the "container type") be a run-time
// decision. This will require refactoring BlockRelaxation so
// that the "container type" is not a template parameter. For
// now, we default to use dense blocks.
//typedef SparseContainer<row_matrix_type, ILUT<row_matrix_type>> container_type;
#ifdef HAVE_IFPACK2_AMESOS2
typedef SparseContainer<row_matrix_type, Details::Amesos2Wrapper<row_matrix_type>> container_type;
prec = rcp (new BlockRelaxation<row_matrix_type, container_type> (matrix));
#else
TEUCHOS_TEST_FOR_EXCEPTION(true, std::invalid_argument, "Ifpack2::Details::OneLevelFactory: "
"\"SPARSE BLOCK RELAXATION\" requires building Trilinos with Amesos2 enabled.");
#endif
}
else if (precTypeUpper == "TRIDI_RELAXATION" ||
precTypeUpper == "TRIDI RELAXATION" ||
precTypeUpper == "TRIDIRELAXATION" ||
Expand Down

0 comments on commit 4312d67

Please sign in to comment.