From: kronbichler Date: Fri, 4 Oct 2013 07:29:31 +0000 (+0000) Subject: Improve exception messages X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c41bb42604801f509ec3b6048cc67a42467184dc;p=dealii-svn.git Improve exception messages git-svn-id: https://svn.dealii.org/trunk@31115 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/matrix_free/fe_evaluation.h b/deal.II/include/deal.II/matrix_free/fe_evaluation.h index 0e46cdb59c..4e3cc316c5 100644 --- a/deal.II/include/deal.II/matrix_free/fe_evaluation.h +++ b/deal.II/include/deal.II/matrix_free/fe_evaluation.h @@ -3686,9 +3686,9 @@ inline FEEvaluationGeneral ::FEEvaluationGeneral (const MatrixFree &data_in, const unsigned int fe_no, - const unsigned int quad_no_in) + const unsigned int quad_no) : - BaseClass (data_in, fe_no, quad_no_in) + BaseClass (data_in, fe_no, quad_no) { #ifdef DEBUG // print error message when the dimensions do not match. Propose a possible @@ -3701,34 +3701,49 @@ FEEvaluationGeneral message += "Illegal arguments in constructor/wrong template arguments!\n"; message += " Called --> FEEvaluation(data, "; + message += Utilities::int_to_string(n_q_points_1d); + message += "," + Utilities::int_to_string(n_components); + message += ",Number>(data, "; message += Utilities::int_to_string(fe_no) + ", "; - message += Utilities::int_to_string(quad_no_in) + ")\n"; + message += Utilities::int_to_string(quad_no) + ")\n"; // check whether some other vector component has the correct number of // points unsigned int proposed_dof_comp = numbers::invalid_unsigned_int, proposed_quad_comp = numbers::invalid_unsigned_int; - for (unsigned int no=0; nomatrix_info.n_components(); ++no) - if (this->matrix_info.get_dof_info(no).dofs_per_cell[0] == - dofs_per_cell) - { - proposed_dof_comp = no; - break; - } - for (unsigned int no=0; nomapping_info.mapping_data_gen.size(); ++no) - if (this->mapping_info.mapping_data_gen[no].n_q_points[this->active_quad_index] == n_q_points) - { - proposed_quad_comp = no; - break; - } + if (dofs_per_cell == this->matrix_info.get_dof_info(fe_no).dofs_per_cell[this->active_fe_index]) + proposed_dof_comp = fe_no; + else + for (unsigned int no=0; nomatrix_info.n_components(); ++no) + if (this->matrix_info.get_dof_info(no).dofs_per_cell[this->active_fe_index] + == dofs_per_cell) + { + proposed_dof_comp = no; + break; + } + if (n_q_points == + this->mapping_info.mapping_data_gen[quad_no].n_q_points[this->active_quad_index]) + proposed_quad_comp = quad_no; + else + for (unsigned int no=0; nomapping_info.mapping_data_gen.size(); ++no) + if (this->mapping_info.mapping_data_gen[no].n_q_points[this->active_quad_index] + == n_q_points) + { + proposed_quad_comp = no; + break; + } if (proposed_dof_comp != numbers::invalid_unsigned_int && proposed_quad_comp != numbers::invalid_unsigned_int) { - message += "Wrong vector component selection:\n"; - message += " Did you mean FEEvaluation(data, "; + message += Utilities::int_to_string(n_q_points_1d); + message += "," + Utilities::int_to_string(n_components); + message += ",Number>(data, "; message += Utilities::int_to_string(proposed_dof_comp) + ", "; message += Utilities::int_to_string(proposed_quad_comp) + ")?\n"; std::string correct_pos; @@ -3736,11 +3751,11 @@ FEEvaluationGeneral correct_pos = " ^ "; else correct_pos = " "; - if (proposed_quad_comp != quad_no_in) + if (proposed_quad_comp != quad_no) correct_pos += " ^\n"; else correct_pos += " \n"; - message += " " + correct_pos; + message += " " + correct_pos; } // ok, did not find the numbers specified by the template arguments in // the given list. Suggest correct template arguments @@ -3750,9 +3765,10 @@ FEEvaluationGeneral message += " Did you mean FEEvaluation