From 625914540edb8d9a5f61ee505ff4686474a2a4fc Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 4 May 2006 03:57:22 +0000 Subject: [PATCH] Add a bunch of safety checks. git-svn-id: https://svn.dealii.org/trunk@13042 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/dofs/hp_dof_levels.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/deal.II/deal.II/source/dofs/hp_dof_levels.cc b/deal.II/deal.II/source/dofs/hp_dof_levels.cc index cdd8d96b75..949e3ef9df 100644 --- a/deal.II/deal.II/source/dofs/hp_dof_levels.cc +++ b/deal.II/deal.II/source/dofs/hp_dof_levels.cc @@ -41,6 +41,8 @@ namespace internal Assert (&dof_handler.get_fe() != 0, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_line, ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_line)); @@ -116,6 +118,8 @@ namespace internal Assert (&dof_handler.get_fe() != 0, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_line, ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_line)); @@ -259,6 +263,8 @@ namespace internal Assert (fe_index != ::hp::DoFHandler::default_fe_index, ExcMessage ("You need to specify a FE index when working " "with hp DoFHandlers")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); // make sure we are on an // object for which DoFs have @@ -329,6 +335,8 @@ namespace internal Assert (&dof_handler.get_fe() != 0, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_quad, ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_quad)); @@ -405,6 +413,8 @@ namespace internal Assert (&dof_handler.get_fe() != 0, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_quad, ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_quad)); @@ -548,6 +558,8 @@ namespace internal Assert (fe_index != ::hp::DoFHandler::default_fe_index, ExcMessage ("You need to specify a FE index when working " "with hp DoFHandlers")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); // make sure we are on an // object for which DoFs have @@ -618,6 +630,8 @@ namespace internal Assert (&dof_handler.get_fe() != 0, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_hex, ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_hex)); @@ -694,6 +708,8 @@ namespace internal Assert (&dof_handler.get_fe() != 0, ExcMessage ("No finite element collection is associated with " "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); Assert (local_index < dof_handler.get_fe()[fe_index].dofs_per_hex, ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_hex)); @@ -837,6 +853,8 @@ namespace internal Assert (fe_index != ::hp::DoFHandler::default_fe_index, ExcMessage ("You need to specify a FE index when working " "with hp DoFHandlers")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); // make sure we are on an // object for which DoFs have -- 2.39.5