From: Daniel Arndt Date: Thu, 24 Jan 2019 12:38:26 +0000 (+0100) Subject: Use Teuchos::RCP for Trilinos preconditioner type X-Git-Tag: v9.1.0-rc1~403^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0f92599ebbd715680f720bfca1523b46ea2e14f;p=dealii.git Use Teuchos::RCP for Trilinos preconditioner type --- diff --git a/include/deal.II/lac/trilinos_precondition.h b/include/deal.II/lac/trilinos_precondition.h index 56e459a0b3..0b75cd92a8 100644 --- a/include/deal.II/lac/trilinos_precondition.h +++ b/include/deal.II/lac/trilinos_precondition.h @@ -232,7 +232,7 @@ namespace TrilinosWrappers * This is a pointer to the preconditioner object that is used when * applying the preconditioner. */ - std::shared_ptr preconditioner; + Teuchos::RCP preconditioner; /** * Internal communication pattern in case the matrix needs to be copied diff --git a/source/lac/trilinos_precondition.cc b/source/lac/trilinos_precondition.cc index 2068166215..aebb75d81d 100644 --- a/source/lac/trilinos_precondition.cc +++ b/source/lac/trilinos_precondition.cc @@ -77,7 +77,7 @@ namespace TrilinosWrappers Epetra_Operator & PreconditionBase::trilinos_operator() const { - AssertThrow(preconditioner, + AssertThrow(!preconditioner.is_null(), ExcMessage("Trying to dereference a null pointer.")); return (*preconditioner); } @@ -679,9 +679,8 @@ namespace TrilinosWrappers PreconditionChebyshev::initialize(const SparseMatrix & matrix, const AdditionalData &additional_data) { - preconditioner.reset(); preconditioner = - std::make_shared(&matrix.trilinos_matrix()); + Teuchos::rcp(new Ifpack_Chebyshev(&matrix.trilinos_matrix())); Ifpack_Chebyshev *ifpack = dynamic_cast(preconditioner.get()); diff --git a/source/lac/trilinos_precondition_ml.cc b/source/lac/trilinos_precondition_ml.cc index 57c8234437..0375697c39 100644 --- a/source/lac/trilinos_precondition_ml.cc +++ b/source/lac/trilinos_precondition_ml.cc @@ -224,10 +224,8 @@ namespace TrilinosWrappers PreconditionAMG::initialize(const Epetra_RowMatrix & matrix, const Teuchos::ParameterList &ml_parameters) { - preconditioner.reset(); - preconditioner = - std::make_shared(matrix, - ml_parameters); + preconditioner.reset( + new ML_Epetra::MultiLevelPreconditioner(matrix, ml_parameters)); } diff --git a/source/lac/trilinos_solver.cc b/source/lac/trilinos_solver.cc index 059a4d0ef4..3642fbefb8 100644 --- a/source/lac/trilinos_solver.cc +++ b/source/lac/trilinos_solver.cc @@ -566,7 +566,7 @@ namespace TrilinosWrappers { // Introduce the preconditioner, if the identity preconditioner is used, // the precondioner is set to none, ... - if (preconditioner.preconditioner.use_count() != 0) + if (preconditioner.preconditioner.strong_count() != 0) { const int ierr = solver.SetPrecOperator( const_cast(preconditioner.preconditioner.get()));