From: bangerth Date: Sun, 18 Aug 2013 23:26:22 +0000 (+0000) Subject: Improve error message. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25a67a79f2dc238ec595f2801900f11ff8e000cd;p=dealii-svn.git Improve error message. git-svn-id: https://svn.dealii.org/trunk@30339 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/numerics/solution_transfer.cc b/deal.II/source/numerics/solution_transfer.cc index 0a40a40830..fef10bdc17 100644 --- a/deal.II/source/numerics/solution_transfer.cc +++ b/deal.II/source/numerics/solution_transfer.cc @@ -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 &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 &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);