From 9949562661ab93b5d8c61acc78473cfd30f953a2 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 18 Jan 2017 17:56:52 -0500 Subject: [PATCH] disable MGTransferPrebuilt without Trilinos Do not allow MGTransferPrebuilt to work with distributed::Vector if we don't have Trilinos. This used to compile and crash at runtime because we wrongly created serial matrices. This also fixes the tests/multigrid/transfer_prebuilt_04 error message: An error occurred in line <361> of file in function bool dealii::DynamicSparsityPattern::exists(dealii::DynamicSparsityPattern::size_type, dealii::DynamicSparsityPattern::size_type) const The violated condition was: rowset.size()==0 || rowset.is_element(i) --- include/deal.II/multigrid/mg_transfer.h | 17 +++++++++++++++++ tests/multigrid/transfer_prebuilt_04.cc | 22 ++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/include/deal.II/multigrid/mg_transfer.h b/include/deal.II/multigrid/mg_transfer.h index ccf66c5cc6..a73a919583 100644 --- a/include/deal.II/multigrid/mg_transfer.h +++ b/include/deal.II/multigrid/mg_transfer.h @@ -99,6 +99,23 @@ namespace internal { } }; +#else + // ! DEAL_II_WITH_TRILINOS + template + struct MatrixSelector > + { + typedef ::dealii::SparsityPattern Sparsity; + typedef ::dealii::SparseMatrix Matrix; + + template + static void reinit(Matrix &, Sparsity &, int, const SparsityPatternType &, const DoFHandlerType &) + { + AssertThrow(false, ExcNotImplemented( + "ERROR: MGTransferPrebuilt with LinearAlgebra::distributed::Vector currently " + "needs deal.II to be configured with Trilinos.")); + } + }; + #endif } diff --git a/tests/multigrid/transfer_prebuilt_04.cc b/tests/multigrid/transfer_prebuilt_04.cc index ca1932a15a..5a16bbf29b 100644 --- a/tests/multigrid/transfer_prebuilt_04.cc +++ b/tests/multigrid/transfer_prebuilt_04.cc @@ -16,7 +16,7 @@ // Deadlock reported by Kronbichler (github // https://github.com/dealii/dealii/issues/2051) with 3 processes -// in MgTransferPrebuilt +// in MGTransferPrebuilt #include "../tests.h" @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -76,10 +77,23 @@ void check() grid_out.write_svg (tr, grid_output); } +#ifdef DEAL_II_WITH_TRILINOS + { + // MGTransferPrebuilt internally uses Trilinos matrices, so only + // create this if we have Trilinos + MGTransferPrebuilt > + transfer_ref(mg_constrained_dofs); + transfer_ref.build_matrices(mgdof); + } +#endif + { + // but the matrix free transfer will work without Trilinos + MGTransferMatrixFree + transfer_ref(mg_constrained_dofs); + transfer_ref.build(mgdof); + } + - MGTransferPrebuilt > - transfer_ref(mg_constrained_dofs); - transfer_ref.build_matrices(mgdof); } } -- 2.39.5