From: Timo Heister Date: Wed, 18 Jan 2017 22:56:52 +0000 (-0500) Subject: disable MGTransferPrebuilt without Trilinos X-Git-Tag: v8.5.0-rc1~207^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9949562661ab93b5d8c61acc78473cfd30f953a2;p=dealii.git 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) --- 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); } }