]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Improve error message.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 18 Aug 2013 23:26:22 +0000 (23:26 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 18 Aug 2013 23:26:22 +0000 (23:26 +0000)
git-svn-id: https://svn.dealii.org/trunk@30339 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/numerics/solution_transfer.cc

index 0a40a40830a5c6b4482322212085b9d7cbc3b577..fef10bdc175905103389a3faec2b8ce20b2f5864 100644 (file)
@@ -188,24 +188,13 @@ namespace internal
           {
             matrices(i,j).reinit (fe[i].dofs_per_cell, fe[j].dofs_per_cell);
 
-            // see if we can get the
-            // interpolation matrices
-            // for this combination
-            // of elements. if not,
-            // reset the matrix sizes
-            // to zero to indicate
-            // that this particular
-            // combination isn't
-            // supported. this isn't
-            // an outright error
-            // right away since we
-            // may never need to
-            // actually interpolate
-            // between these two
-            // elements on actual
-            // cells; we simply have
-            // to trigger an error if
-            // someone actually tries
+            // see if we can get the interpolation matrices for this
+            // combination of elements. if not, reset the matrix sizes to zero
+            // to indicate that this particular combination isn't
+            // supported. this isn't an outright error right away since we may
+            // never need to actually interpolate between these two elements
+            // on actual cells; we simply have to trigger an error if someone
+            // actually tries
             try
               {
                 fe[i].get_interpolation_matrix (fe[j], matrices(i,j));
@@ -574,6 +563,26 @@ interpolate (const std::vector<VECTOR> &all_in,
                           local_values.reinit (cell->has_children() ?
                                                cell->child(0)->get_fe().dofs_per_cell
                                                : cell->get_fe().dofs_per_cell, true);
+                         // do the interpolation. we get into trouble if the
+                         // interpolation_hp(new,old) matrix hasn't been computed.
+                         // this can happen if the respective elements don't support
+                         // the corresponding interpolation; if that's the case, then
+                         // the computation of the matrix simply sets the matrix
+                         // back to size zero. so if we get here and that is
+                         // the wrong size, then this may be because the elements
+                         // haven't implemented the correct function yet
+                         Assert (! ((interpolation_hp(new_fe_index,old_index).m() == 0)
+                                    &&
+                                    (interpolation_hp(new_fe_index,old_index).n() == 0)
+                                    &&
+                                    ((dof_handler->get_fe()[new_fe_index].dofs_per_cell > 0)
+                                     ||
+                                     (dof_handler->get_fe()[old_index].dofs_per_cell > 0))),
+                                 ExcMessage ("The interpolation between two different "
+                                             "elements you are trying to use here has "
+                                             "not been implemented for this pair of "
+                                             "elememts!"));
+
                           AssertDimension (local_values.size(),
                                            interpolation_hp(new_fe_index,old_index).m());
                           // simple case where all children have the
@@ -596,6 +605,20 @@ interpolate (const std::vector<VECTOR> &all_in,
                                     AssertDimension (tmp.size(),
                                                      interpolation_hp(c_index,old_index).n());
                                     local_values.reinit(cell->child(child)->get_fe().dofs_per_cell, true);
+
+                                   // do the interpolation. same problem as above
+                                   Assert (! ((interpolation_hp(c_index,old_index).m() == 0)
+                                              &&
+                                              (interpolation_hp(c_index,old_index).n() == 0)
+                                              &&
+                                              ((dof_handler->get_fe()[c_index].dofs_per_cell > 0)
+                                               ||
+                                               (dof_handler->get_fe()[old_index].dofs_per_cell > 0))),
+                                           ExcMessage ("The interpolation between two different "
+                                                       "elements you are trying to use here has "
+                                                       "not been implemented for this pair of "
+                                                       "elememts!"));
+                                   
                                     AssertDimension (local_values.size(),
                                                      interpolation_hp(c_index,old_index).m());
                                     interpolation_hp(c_index,old_index).vmult (local_values, tmp);

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.