]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace message-less exceptions with ones that say what's happening. 4617/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sun, 16 Jul 2017 16:39:05 +0000 (10:39 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 17 Jul 2017 02:41:39 +0000 (20:41 -0600)
include/deal.II/dofs/dof_accessor.templates.h
include/deal.II/dofs/dof_handler.h
include/deal.II/dofs/dof_renumbering.h
include/deal.II/hp/dof_handler.h
source/dofs/dof_renumbering.cc

index b127266e5a231679585648a88761d8692b20cc6b..77de465c2b58fa5a917a4be4ca70c8d7145e4b70 100644 (file)
@@ -2047,9 +2047,13 @@ DoFAccessor<structdim,DoFHandlerType,level_dof_access>::get_dof_indices
 (std::vector<types::global_dof_index> &dof_indices,
  const unsigned int                    fe_index) const
 {
-  Assert (this->dof_handler != nullptr, ExcNotInitialized());
+  Assert (this->dof_handler != nullptr,
+          ExcMessage("This accessor object has not been associated "
+                     "with any DoFHandler object."));
   Assert (static_cast<unsigned int>(this->level()) < this->dof_handler->levels.size(),
-          ExcMessage ("DoFHandler not initialized"));
+          ExcMessage ("The DoFHandler to which this accessor points has not "
+                      "been initialized, i.e., it doesn't appear that DoF indices "
+                      "have been distributed on it."));
 
   switch (structdim)
     {
index 515b9f613f2e2e50e0aa85ad4193ba5f2a783845..8cce7cbdfbe414fccd2192975181ee37630262a1 100644 (file)
@@ -1227,7 +1227,9 @@ inline
 const Triangulation<dim,spacedim> &
 DoFHandler<dim,spacedim>::get_triangulation () const
 {
-  Assert(tria != nullptr, ExcNotInitialized());
+  Assert(tria != nullptr,
+         ExcMessage("This DoFHandler object has not been associated "
+                    "with a triangulation."));
   return *tria;
 }
 
index 9c61467a33d850a8e9dc90036e89edabf3bde4ac..43212cb374c0f17027abfa37f19d6d7d36d9307a 100644 (file)
@@ -1072,18 +1072,32 @@ namespace DoFRenumbering
    * @}
    */
 
+
+
+  /**
+   * Exception
+   *
+   * @ingroup Exceptions
+   */
+  DeclExceptionMsg (ExcDoFHandlerNotInitialized,
+                    "The DoFHandler on which this function should work has not "
+                    "been initialized, i.e., it doesn't appear that DoF indices "
+                    "have been distributed on it.");
+
   /**
    * Exception
    *
    * @ingroup Exceptions
    */
   DeclException0 (ExcRenumberingIncomplete);
+
   /**
    * Exception
    *
    * @ingroup Exceptions
    */
   DeclException0 (ExcInvalidComponentOrder);
+
   /**
    * The function is only implemented for Discontinuous Galerkin Finite
    * elements.
index 81c0e3f40ff337d28146b0fb0041b6222da53404..f3155341727616a623c6342846de39d6df4c55db 100644 (file)
@@ -1054,6 +1054,9 @@ namespace hp
   const Triangulation<dim,spacedim> &
   DoFHandler<dim,spacedim>::get_triangulation () const
   {
+    Assert(tria != nullptr,
+           ExcMessage("This DoFHandler object has not been associated "
+                      "with a triangulation."));
     return *tria;
   }
 
index 652efdf5e428b412b2769998a868680787ef31b1..81200c8fa534f496ddba2fa85632645877ef1e22 100644 (file)
@@ -474,7 +474,7 @@ namespace DoFRenumbering
                       const std::vector<types::global_dof_index> &starting_indices)
   {
     Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index,
-           ExcNotInitialized());
+           ExcDoFHandlerNotInitialized());
 
     // make the connection graph
     DynamicSparsityPattern dsp (dof_handler.n_dofs(level),
@@ -541,7 +541,7 @@ namespace DoFRenumbering
                   const std::vector<unsigned int> &component_order_arg)
   {
     Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index,
-           ExcNotInitialized());
+           ExcDoFHandlerNotInitialized());
 
     std::vector<types::global_dof_index> renumbering (dof_handler.n_dofs(level),
                                                       numbers::invalid_dof_index);
@@ -874,7 +874,7 @@ namespace DoFRenumbering
   block_wise (DoFHandler<dim,spacedim> &dof_handler, const unsigned int level)
   {
     Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index,
-           ExcNotInitialized());
+           ExcDoFHandlerNotInitialized());
 
     std::vector<types::global_dof_index> renumbering (dof_handler.n_dofs(level),
                                                       numbers::invalid_dof_index);
@@ -1238,7 +1238,7 @@ namespace DoFRenumbering
                            const unsigned int       level)
   {
     Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index,
-           ExcNotInitialized());
+           ExcDoFHandlerNotInitialized());
 
     std::vector<types::global_dof_index> renumbering(dof_handler.n_dofs(level),
                                                      numbers::invalid_dof_index);
@@ -1295,7 +1295,7 @@ namespace DoFRenumbering
                                    const unsigned int                    level)
   {
     Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index,
-           ExcNotInitialized());
+           ExcDoFHandlerNotInitialized());
 
     const unsigned int n_dofs = dof_handler.n_dofs(level);
     Assert (selected_dofs.size() == n_dofs,
@@ -1419,7 +1419,7 @@ namespace DoFRenumbering
    const typename std::vector<typename DoFHandlerType::level_cell_iterator> &cells)
   {
     Assert(dof.n_dofs(level) != numbers::invalid_dof_index,
-           ExcNotInitialized());
+           ExcDoFHandlerNotInitialized());
 
     std::vector<types::global_dof_index> renumbering(dof.n_dofs(level));
     std::vector<types::global_dof_index> reverse(dof.n_dofs(level));

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.