]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Allow the use of make_periodicity_constraints when running on a parallel::distributed...
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 24 Jan 2013 13:12:23 +0000 (13:12 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 24 Jan 2013 13:12:23 +0000 (13:12 +0000)
Reported by Jean-Paul Pelteret

git-svn-id: https://svn.dealii.org/trunk@28167 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/dofs/dof_tools.cc

index 6165c9ed588532cc63b4d8a92db280b01a290ab0..b5267c426ff6f02b9d12e0bd2e35fdffd9fdc082 100644 (file)
@@ -1,8 +1,8 @@
 //---------------------------------------------------------------------------
-//    $Id$
+//    $Id:$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -3007,10 +3007,16 @@ namespace DoFTools
     static const int space_dim = DH::space_dimension;
     Assert (0<=direction && direction<space_dim,
             ExcIndexRange (direction, 0, space_dim));
-    Assert ((dynamic_cast<const parallel::distributed::Triangulation<DH::dimension,DH::space_dimension>*>
-             (&dof_handler.get_tria()) == 0),
+
+#ifdef DEBUG
+    // Check whether we run on a non parallel mesh or on a
+    // parallel::distributed::Triangulation in serial
+    typedef parallel::distributed::Triangulation<DH::dimension,DH::space_dimension> PTRIA;
+    const PTRIA* ptria_p = dynamic_cast<const PTRIA*> (&dof_handler.get_tria());
+    Assert ((ptria_p == 0 || Utilities::MPI::n_mpi_processes(ptria_p->get_communicator()) == 1),
             ExcMessage ("This function can not be used with distributed triangulations."
                         "See the documentation for more information."));
+#endif
 
     Assert (b_id1 != b_id2,
             ExcMessage ("The boundary indicators b_id1 and b_id2 must be"
@@ -3094,10 +3100,15 @@ namespace DoFTools
     Assert(dim == space_dim,
            ExcNotImplemented());
 
-    Assert ((dynamic_cast<const parallel::distributed::Triangulation<DH::dimension,DH::space_dimension>*>
-             (&dof_handler.get_tria()) == 0),
+#ifdef DEBUG
+    // Check whether we run on a non parallel mesh or on a
+    // parallel::distributed::Triangulation in serial
+    typedef typename parallel::distributed::Triangulation<DH::dimension,DH::space_dimension> PTRIA;
+    const PTRIA* ptria_p = dynamic_cast<const PTRIA*> (&dof_handler.get_tria());
+    Assert ((ptria_p == 0 || Utilities::MPI::n_mpi_processes(ptria_p->get_communicator()) == 1),
             ExcMessage ("This function can not be used with distributed triangulations."
                         "See the documentation for more information."));
+#endif
 
     typedef typename DH::face_iterator FaceIterator;
     typedef std::map<FaceIterator, FaceIterator> FaceMap;
@@ -3608,8 +3619,7 @@ namespace DoFTools
   {
     Assert ((dynamic_cast<const parallel::distributed::Triangulation<DH::dimension,DH::space_dimension>*>
              (&dof_handler.get_tria())
-             ==
-             0),
+             == 0),
             ExcMessage ("This function can not be used with distributed triangulations."
                         "See the documentation for more information."));
 

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.