From 4c0676fbee12cc22f9f410e6b894cc25896dba1f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 4 May 2006 02:32:54 +0000 Subject: [PATCH] A few more safety checks. git-svn-id: https://svn.dealii.org/trunk@13037 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/dofs/hp_dof_levels.cc | 48 ++++++++++++++++++++ 1 file changed, 48 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 97f0657ea6..dc04c1b02b 100644 --- a/deal.II/deal.II/source/dofs/hp_dof_levels.cc +++ b/deal.II/deal.II/source/dofs/hp_dof_levels.cc @@ -45,6 +45,14 @@ namespace internal ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_line)); + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (line_dof_offsets[line_index] != deal_II_numbers::invalid_unsigned_int, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + // if we are in 1d, then the // only set of indices we store // is the one for the cell, @@ -110,6 +118,14 @@ namespace internal ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_line)); + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (line_dof_offsets[line_index] != deal_II_numbers::invalid_unsigned_int, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + // if we are in 1d, then the // only set of indices we store // is the one for the cell, @@ -178,6 +194,14 @@ namespace internal ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_quad)); + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (quad_dof_offsets[quad_index] != deal_II_numbers::invalid_unsigned_int, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + // if we are in 1d, then the // only set of indices we store // is the one for the cell, @@ -244,6 +268,14 @@ namespace internal ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_quad)); + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (quad_dof_offsets[quad_index] != deal_II_numbers::invalid_unsigned_int, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + // if we are in 1d, then the // only set of indices we store // is the one for the cell, @@ -312,6 +344,14 @@ namespace internal ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_hex)); + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (hex_dof_offsets[hex_index] != deal_II_numbers::invalid_unsigned_int, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + // if we are in 1d, then the // only set of indices we store // is the one for the cell, @@ -378,6 +418,14 @@ namespace internal ExcIndexRange(local_index, 0, dof_handler.get_fe()[fe_index].dofs_per_hex)); + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (hex_dof_offsets[hex_index] != deal_II_numbers::invalid_unsigned_int, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + // if we are in 1d, then the // only set of indices we store // is the one for the cell, -- 2.39.5