]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Improve an error message. 2852/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 22 Jul 2016 04:15:09 +0000 (23:15 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 22 Jul 2016 04:15:09 +0000 (23:15 -0500)
Specifically, say early that using ::SolutionTransfer with
parallel::distributed::Triangulation is likely going to lead to
heartache.

source/numerics/solution_transfer.cc

index 6e1dc4def21fb2ea5d71477932eb78506f95da83..77deb0f9eb445e6f48e5fdb2729959ef24cdc885 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 1999 - 2015 by the deal.II authors
+// Copyright (C) 1999 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
 
 #include <deal.II/base/memory_consumption.h>
 #include <deal.II/grid/tria.h>
-#include <deal.II/dofs/dof_handler.h>
 #include <deal.II/grid/tria_accessor.h>
-#include <deal.II/dofs/dof_accessor.h>
 #include <deal.II/grid/tria_iterator.h>
+#include <deal.II/distributed/tria.h>
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_accessor.h>
 #include <deal.II/fe/fe.h>
 #include <deal.II/lac/vector.h>
 #include <deal.II/lac/la_parallel_vector.h>
@@ -35,12 +36,22 @@ DEAL_II_NAMESPACE_OPEN
 
 
 template<int dim, typename VectorType, typename DoFHandlerType>
-SolutionTransfer<dim, VectorType, DoFHandlerType>::SolutionTransfer(const DoFHandlerType &dof)
+SolutionTransfer<dim, VectorType, DoFHandlerType>::
+SolutionTransfer(const DoFHandlerType &dof)
   :
   dof_handler(&dof, typeid(*this).name()),
   n_dofs_old(0),
   prepared_for(none)
-{}
+{
+  Assert ((dynamic_cast<const parallel::distributed::Triangulation<DoFHandlerType::dimension, DoFHandlerType::space_dimension>*>
+           (&dof_handler->get_tria())
+           == 0),
+          ExcMessage ("You are calling the dealii::SolutionTransfer class "
+                      "with a DoF handler that is built on a "
+                      "parallel::distributed::Triangulation. This will not "
+                      "work for parallel computations. You probably want to "
+                      "use the parallel::distributed::SolutionTransfer class."));
+}
 
 
 

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.