From 5cb5309bc9b247c072f387d45ce671cd20cef076 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 22 May 2000 08:29:50 +0000 Subject: [PATCH] Check that the fe used by a fevalues object is the same as the one used to reinit the fevalues object on a new cell. git-svn-id: https://svn.dealii.org/trunk@2916 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_values.h | 4 +++ deal.II/deal.II/source/fe/fe_values.cc | 36 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index 0a63bc791c..164d08023e 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -582,6 +582,10 @@ class FEValuesBase * Exception */ DeclException0 (ExcInvalidUpdateFlag); + /** + * Exception + */ + DeclException0 (ExcFEDontMatch); protected: /** diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index 8b8c79a558..98dd3caa46 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -368,6 +368,16 @@ template void FEValues::reinit (const typename DoFHandler::cell_iterator &cell) { present_cell = cell; + + // assert that the finite elements + // passed to the constructor and + // used by the DoFHandler used by + // this cell, are the same + Assert (static_cast&>(*fe) + == + static_cast&>(cell->get_dof_handler().get_fe()), + ExcFEDontMatch()); + // fill jacobi matrices and real // quadrature points if ((update_flags & update_jacobians) || @@ -550,6 +560,18 @@ void FEFaceValues::reinit (const typename DoFHandler::cell_iterator &c { present_cell = cell; selected_dataset = face_no; + + // assert that the finite elements + // passed to the constructor and + // used by the DoFHandler used by + // this cell, are the same + Assert (static_cast&>(*fe) + == + static_cast&>(cell->get_dof_handler().get_fe()), + ExcFEDontMatch()); + Assert (face_no < GeometryInfo::faces_per_cell, + ExcIndexRange (face_no, 0, GeometryInfo::faces_per_cell)); + // fill jacobi matrices and real // quadrature points if ((update_flags & update_jacobians) || @@ -722,6 +744,20 @@ void FESubfaceValues::reinit (const typename DoFHandler::cell_iterator present_cell = cell; selected_dataset = face_no*(1<<(dim-1)) + subface_no; + + // assert that the finite elements + // passed to the constructor and + // used by the DoFHandler used by + // this cell, are the same + Assert (static_cast&>(*fe) + == + static_cast&>(cell->get_dof_handler().get_fe()), + ExcFEDontMatch()); + Assert (face_no < GeometryInfo::faces_per_cell, + ExcIndexRange (face_no, 0, GeometryInfo::faces_per_cell)); + Assert (subface_no < GeometryInfo::subfaces_per_face, + ExcIndexRange (subface_no, 0, GeometryInfo::subfaces_per_face)); + // fill jacobi matrices and real // quadrature points if ((update_flags & update_jacobians) || -- 2.39.5