]> https://gitweb.dealii.org/ - dealii.git/commitdiff
disable MGTransferPrebuilt without Trilinos 3828/head
authorTimo Heister <timo.heister@gmail.com>
Wed, 18 Jan 2017 22:56:52 +0000 (17:56 -0500)
committerTimo Heister <timo.heister@gmail.com>
Sat, 21 Jan 2017 19:40:49 +0000 (14:40 -0500)
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
</mnt/data/testsuite/dealii/source/lac/dynamic_sparsity_pattern.cc> 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
tests/multigrid/transfer_prebuilt_04.cc

index ccf66c5cc61f564dfa4c7194602df423df7e76a1..a73a91958358e0a9d8677ee77b704fe81f5b49e3 100644 (file)
@@ -99,6 +99,23 @@ namespace internal
     {
     }
   };
+#else
+  // ! DEAL_II_WITH_TRILINOS
+  template <typename Number>
+  struct MatrixSelector<LinearAlgebra::distributed::Vector<Number> >
+  {
+    typedef ::dealii::SparsityPattern Sparsity;
+    typedef ::dealii::SparseMatrix<Number> Matrix;
+
+    template <typename SparsityPatternType, typename DoFHandlerType>
+    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
 }
 
index ca1932a15a32247212406d59e7353252a98cf3b4..5a16bbf29b18ad2b0a5242f7c890e581847b714c 100644 (file)
@@ -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 <deal.II/grid/grid_generator.h>
 #include <deal.II/fe/fe_q.h>
 #include <deal.II/multigrid/mg_transfer.h>
+#include <deal.II/multigrid/mg_transfer_matrix_free.h>
 #include <deal.II/grid/grid_out.h>
 
 
@@ -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<LinearAlgebra::distributed::Vector<double> >
+        transfer_ref(mg_constrained_dofs);
+        transfer_ref.build_matrices(mgdof);
+      }
+#endif
+      {
+        // but the matrix free transfer will work without Trilinos
+        MGTransferMatrixFree<dim, double>
+        transfer_ref(mg_constrained_dofs);
+        transfer_ref.build(mgdof);
+      }
+
 
-      MGTransferPrebuilt<LinearAlgebra::distributed::Vector<double> >
-      transfer_ref(mg_constrained_dofs);
-      transfer_ref.build_matrices(mgdof);
     }
 }
 

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.