]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use Teuchos::RCP for Trilinos preconditioner type
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 24 Jan 2019 12:38:26 +0000 (13:38 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 24 Jan 2019 17:55:28 +0000 (18:55 +0100)
include/deal.II/lac/trilinos_precondition.h
source/lac/trilinos_precondition.cc
source/lac/trilinos_precondition_ml.cc
source/lac/trilinos_solver.cc

index 56e459a0b3eb8e7022e824d7973b553024fa6cd3..0b75cd92a8b3ade437d3ddf5f0355b8a93fd5758 100644 (file)
@@ -232,7 +232,7 @@ namespace TrilinosWrappers
      * This is a pointer to the preconditioner object that is used when
      * applying the preconditioner.
      */
-    std::shared_ptr<Epetra_Operator> preconditioner;
+    Teuchos::RCP<Epetra_Operator> preconditioner;
 
     /**
      * Internal communication pattern in case the matrix needs to be copied
index 2068166215130c7475e1045ce6e331ef49467b43..aebb75d81d22a1f908b92bb729cd3e04ba15015f 100644 (file)
@@ -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<Ifpack_Chebyshev>(&matrix.trilinos_matrix());
+      Teuchos::rcp(new Ifpack_Chebyshev(&matrix.trilinos_matrix()));
 
     Ifpack_Chebyshev *ifpack =
       dynamic_cast<Ifpack_Chebyshev *>(preconditioner.get());
index 57c8234437d1850dd2b4114f941db5c4d0f76fcc..0375697c39203a688d191d75cb26f3568aa5bed9 100644 (file)
@@ -224,10 +224,8 @@ namespace TrilinosWrappers
   PreconditionAMG::initialize(const Epetra_RowMatrix &      matrix,
                               const Teuchos::ParameterList &ml_parameters)
   {
-    preconditioner.reset();
-    preconditioner =
-      std::make_shared<ML_Epetra::MultiLevelPreconditioner>(matrix,
-                                                            ml_parameters);
+    preconditioner.reset(
+      new ML_Epetra::MultiLevelPreconditioner(matrix, ml_parameters));
   }
 
 
index 059a4d0ef4b24bcd002c49f5a26d7cb72480bee4..3642fbefb8303f2b12bd7dfcf097c1ac8069c022 100644 (file)
@@ -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<Epetra_Operator *>(preconditioner.preconditioner.get()));

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.