# include <Epetra_Map.h>
# include <Teuchos_ParameterList.hpp>
-# include <Epetra_Operator.h>
+# include <Epetra_RowMatrix.h>
# include <Epetra_Vector.h>
// forward declarations
* linear system with the given matrix. The function uses the matrix
* format specified in TrilinosWrappers::SparseMatrix.
*/
- void initialize (const SparseMatrix &matrix,
+ void initialize (const SparseMatrix &matrix,
const AdditionalData &additional_data = AdditionalData());
+ /**
+ * Let Trilinos compute a multilevel hierarchy for the solution of a
+ * linear system with the given matrix. As opposed to the other initialize
+ * function above, this function uses an abstract interface to an object
+ * of type Epetra_RowMatrix which allows a user to pass by rather
+ * arbitrary objects to the ML preconditioner.
+ */
+ void initialize (const Epetra_RowMatrix &matrix,
+ const AdditionalData &additional_data = AdditionalData());
+
/**
* Let Trilinos compute a multilevel hierarchy for the solution of a
* linear system with the given matrix. The function uses the matrix
void initialize (const SparseMatrix &matrix,
const Teuchos::ParameterList &ml_parameters);
+ /**
+ * Let Trilinos compute a multilevel hierarchy for the solution of a
+ * linear system with the given matrix. As opposed to the other initialize
+ * function above, this function uses an abstract interface to an object
+ * of type Epetra_RowMatrix which allows a user to pass by rather
+ * arbitrary objects to the ML preconditioner.
+ */
+ void initialize (const Epetra_RowMatrix &matrix,
+ const Teuchos::ParameterList &ml_parameters);
+
/**
* Let Trilinos compute a multilevel hierarchy for the solution of a
* linear system with the given matrix. This function takes a deal.ii
// ---------------------------------------------------------------------
// $Id$
//
-// Copyright (C) 2008 - 2013 by the deal.II authors
+// Copyright (C) 2008 - 2014 by the deal.II authors
//
// This file is part of the deal.II library.
//
namespace
{
#ifndef DEAL_II_WITH_64BIT_INDICES
+ long long int n_global_rows (const Epetra_RowMatrix &matrix)
+ {
+ return matrix.NumGlobalRows();
+ }
+
int global_length (const Epetra_MultiVector &vector)
{
return vector.GlobalLength();
return map.GID(i);
}
#else
+ long long int n_global_rows (const Epetra_RowMatrix &matrix)
+ {
+ return matrix.NumGlobalRows64();
+ }
+
long long int global_length (const Epetra_MultiVector &vector)
{
return vector.GlobalLength64();
}
+
void
PreconditionAMG:: initialize (const SparseMatrix &matrix,
const AdditionalData &additional_data)
{
- const size_type n_rows = matrix.m();
+ initialize(matrix.trilinos_matrix(), additional_data);
+ }
+
+
+ void
+ PreconditionAMG:: initialize (const Epetra_RowMatrix &matrix,
+ const AdditionalData &additional_data)
+ {
// Build the AMG preconditioner.
Teuchos::ParameterList parameter_list;
// standard choice uncoupled. if higher order, right now we also just
// use Uncoupled, but we should be aware that maybe MIS might be
// needed
- //
- // TODO: Maybe there are any other/better options?
if (additional_data.higher_order_elements)
- {
- //if (matrix.m()/matrix.matrix->Comm().NumProc() < 50000)
- parameter_list.set("aggregation: type", "Uncoupled");
- //else
- //parameter_list.set("aggregation: type", "MIS");
- }
+ parameter_list.set("aggregation: type", "Uncoupled");
}
else
{
else
parameter_list.set("ML output", 0);
- const Epetra_Map &domain_map = matrix.domain_partitioner();
+ const Epetra_Map &domain_map = matrix.OperatorDomainMap();
const size_type constant_modes_dimension =
additional_data.constant_modes.size();
if (constant_modes_dimension > 0)
{
+ const size_type n_rows = n_global_rows(matrix);
const bool constant_modes_are_global =
additional_data.constant_modes[0].size() == n_rows;
const size_type n_relevant_rows =
void
PreconditionAMG::initialize (const SparseMatrix &matrix,
const Teuchos::ParameterList &ml_parameters)
+ {
+ initialize(matrix.trilinos_matrix(), ml_parameters);
+ }
+
+
+
+ void
+ PreconditionAMG::initialize (const Epetra_RowMatrix &matrix,
+ const Teuchos::ParameterList &ml_parameters)
{
preconditioner.reset ();
preconditioner.reset (new ML_Epetra::MultiLevelPreconditioner
- (matrix.trilinos_matrix(), ml_parameters));
+ (matrix, ml_parameters));
}