From: wolf Date: Mon, 7 May 2001 15:45:28 +0000 (+0000) Subject: Add some more checks for the correct vector lengths. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=015ab9eb07fb899b7a4432438df3725f4c40c500;p=dealii-svn.git Add some more checks for the correct vector lengths. git-svn-id: https://svn.dealii.org/trunk@4551 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index 5e3d0e5c57..bb2f61d398 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -121,14 +121,16 @@ FEValuesBase::~FEValuesBase () template template -void FEValuesBase::get_function_values (const InputVector &fe_function, - typename std::vector &values) const +void FEValuesBase::get_function_values (const InputVector &fe_function, + typename std::vector &values) const { Assert (update_flags & update_values, ExcAccessToUninitializedField()); Assert (fe->n_components() == 1, ExcWrongNoOfComponents()); Assert (values.size() == n_quadrature_points, ExcWrongVectorSize(values.size(), n_quadrature_points)); + Assert (fe_function.size() == present_cell->get_dof_handler().n_dofs(), + ExcWrongVectorSize(fe_function.size(), present_cell->get_dof_handler().n_dofs())); // get function values of dofs // on this cell @@ -150,9 +152,10 @@ void FEValuesBase::get_function_values (const InputVector &fe_function, }; + template template -void FEValuesBase::get_function_values (const InputVector &fe_function, +void FEValuesBase::get_function_values (const InputVector &fe_function, typename std::vector > &values) const { Assert (n_quadrature_points == values.size(), @@ -161,7 +164,9 @@ void FEValuesBase::get_function_values (const InputVector &fe_functio Assert (values[i].size() == fe->n_components(), ExcWrongNoOfComponents()); Assert (update_flags & update_values, ExcAccessToUninitializedField()); - + Assert (fe_function.size() == present_cell->get_dof_handler().n_dofs(), + ExcWrongVectorSize(fe_function.size(), present_cell->get_dof_handler().n_dofs())); + // get function values of dofs // on this cell Vector dof_values (dofs_per_cell); @@ -193,6 +198,7 @@ FEValuesBase::get_shape_values () const }; + template const typename FEValuesData::GradientVector & FEValuesBase::get_shape_grads () const @@ -203,6 +209,7 @@ FEValuesBase::get_shape_grads () const + template const typename std::vector > > & FEValuesBase::get_shape_2nd_derivatives () const @@ -235,8 +242,10 @@ FEValuesBase::get_JxW_values () const template template -void FEValuesBase::get_function_grads (const InputVector &fe_function, - typename std::vector > &gradients) const +void +FEValuesBase:: +get_function_grads (const InputVector &fe_function, + typename std::vector > &gradients) const { Assert (update_flags & update_gradients, ExcAccessToUninitializedField()); @@ -244,6 +253,8 @@ void FEValuesBase::get_function_grads (const InputVector &fe_function, ExcWrongNoOfComponents()); Assert (gradients.size() == n_quadrature_points, ExcWrongVectorSize(gradients.size(), n_quadrature_points)); + Assert (fe_function.size() == present_cell->get_dof_handler().n_dofs(), + ExcWrongVectorSize(fe_function.size(), present_cell->get_dof_handler().n_dofs())); // get function values of dofs // on this cell @@ -271,8 +282,10 @@ void FEValuesBase::get_function_grads (const InputVector &fe_function, template template -void FEValuesBase::get_function_grads (const InputVector &fe_function, - typename std::vector > > &gradients) const +void +FEValuesBase:: +get_function_grads (const InputVector &fe_function, + typename std::vector > > &gradients) const { Assert (n_quadrature_points == gradients.size(), ExcWrongNoOfComponents()); @@ -280,6 +293,8 @@ void FEValuesBase::get_function_grads (const InputVector &fe_ Assert (gradients[i].size() == fe->n_components(), ExcWrongVectorSize(gradients[i].size(), fe->n_components())); Assert (update_flags & update_gradients, ExcAccessToUninitializedField()); + Assert (fe_function.size() == present_cell->get_dof_handler().n_dofs(), + ExcWrongVectorSize(fe_function.size(), present_cell->get_dof_handler().n_dofs())); // get function values of dofs // on this cell @@ -309,14 +324,18 @@ void FEValuesBase::get_function_grads (const InputVector &fe_ template template -void FEValuesBase::get_function_2nd_derivatives (const InputVector &fe_function, - typename std::vector > &second_derivatives) const +void +FEValuesBase:: +get_function_2nd_derivatives (const InputVector &fe_function, + typename std::vector > &second_derivatives) const { Assert (fe->n_components() == 1, ExcWrongNoOfComponents()); Assert (second_derivatives.size() == n_quadrature_points, ExcWrongVectorSize(second_derivatives.size(), n_quadrature_points)); Assert (update_flags & update_second_derivatives, ExcAccessToUninitializedField()); + Assert (fe_function.size() == present_cell->get_dof_handler().n_dofs(), + ExcWrongVectorSize(fe_function.size(), present_cell->get_dof_handler().n_dofs())); // get function values of dofs // on this cell @@ -346,7 +365,7 @@ template template void FEValuesBase:: -get_function_2nd_derivatives (const InputVector &fe_function, +get_function_2nd_derivatives (const InputVector &fe_function, typename std::vector > > &second_derivs) const { Assert (n_quadrature_points == second_derivs.size(), @@ -355,6 +374,8 @@ get_function_2nd_derivatives (const InputVector &fe_function, Assert (second_derivs[i].size() == fe->n_components(), ExcWrongVectorSize(second_derivs[i].size(), fe->n_components())); Assert (update_flags & update_second_derivatives, ExcAccessToUninitializedField()); + Assert (fe_function.size() == present_cell->get_dof_handler().n_dofs(), + ExcWrongVectorSize(fe_function.size(), present_cell->get_dof_handler().n_dofs())); // get function values of dofs // on this cell