From c3a028be3d1f106d1f44ca4a4af6bbd4417e2f36 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 8 Feb 2006 16:18:09 +0000 Subject: [PATCH] Make sure that the FEValues object had actually been initialized. git-svn-id: https://svn.dealii.org/trunk@12267 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/fe/fe_values.cc | 30 ++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index e70cea625d..476ca7b90d 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -373,8 +373,11 @@ void FEValuesBase::get_function_values ( ExcDimensionMismatch(fe->n_components(), 1)); Assert (values.size() == n_quadrature_points, ExcDimensionMismatch(values.size(), n_quadrature_points)); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (fe_function.size() == present_cell->n_dofs_for_dof_handler(), - ExcDimensionMismatch(fe_function.size(), present_cell->n_dofs_for_dof_handler())); + ExcDimensionMismatch(fe_function.size(), + present_cell->n_dofs_for_dof_handler())); // get function values of dofs // on this cell @@ -448,6 +451,8 @@ void FEValuesBase::get_function_values ( // ExcDimensionMismatch(fe_function.size(), // present_cell->get_dof_handler().n_dofs())); // One entry per quadrature point + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (values.size() == n_quadrature_points, ExcDimensionMismatch(values.size(), n_quadrature_points)); @@ -663,8 +668,11 @@ get_function_grads (const InputVector &fe_function, ExcDimensionMismatch(fe->n_components(), 1)); Assert (gradients.size() == n_quadrature_points, ExcDimensionMismatch(gradients.size(), n_quadrature_points)); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (fe_function.size() == present_cell->n_dofs_for_dof_handler(), - ExcDimensionMismatch(fe_function.size(), present_cell->n_dofs_for_dof_handler())); + ExcDimensionMismatch(fe_function.size(), + present_cell->n_dofs_for_dof_handler())); // get function values of dofs // on this cell @@ -690,6 +698,7 @@ get_function_grads (const InputVector &fe_function, } + template template void FEValuesBase::get_function_grads ( @@ -744,8 +753,11 @@ get_function_grads (const InputVector &fe_function, ExcDimensionMismatch(gradients[i].size(), n_components)); Assert (this->update_flags & update_gradients, ExcAccessToUninitializedField()); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (fe_function.size() == present_cell->n_dofs_for_dof_handler(), - ExcDimensionMismatch(fe_function.size(), present_cell->n_dofs_for_dof_handler())); + ExcDimensionMismatch(fe_function.size(), + present_cell->n_dofs_for_dof_handler())); // get function values of dofs // on this cell @@ -885,8 +897,11 @@ get_function_2nd_derivatives (const InputVector &fe_function, Assert (second_derivatives.size() == n_quadrature_points, ExcDimensionMismatch(second_derivatives.size(), n_quadrature_points)); Assert (this->update_flags & update_second_derivatives, ExcAccessToUninitializedField()); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (fe_function.size() == present_cell->n_dofs_for_dof_handler(), - ExcDimensionMismatch(fe_function.size(), present_cell->n_dofs_for_dof_handler())); + ExcDimensionMismatch(fe_function.size(), + present_cell->n_dofs_for_dof_handler())); // get function values of dofs // on this cell @@ -930,8 +945,11 @@ get_function_2nd_derivatives (const InputVector &fe_func ExcDimensionMismatch(second_derivs[i].size(), n_components)); Assert (this->update_flags & update_second_derivatives, ExcAccessToUninitializedField()); + Assert (present_cell.get() != 0, + ExcMessage ("FEValues object is not reinit'ed to any cell")); Assert (fe_function.size() == present_cell->n_dofs_for_dof_handler(), - ExcDimensionMismatch(fe_function.size(), present_cell->n_dofs_for_dof_handler())); + ExcDimensionMismatch(fe_function.size(), + present_cell->n_dofs_for_dof_handler())); // get function values of dofs // on this cell -- 2.39.5