From: Simon Sticko Date: Tue, 10 May 2022 06:10:50 +0000 (+0200) Subject: Add two asserts in NonMatching::MeshClassifier. X-Git-Tag: v9.4.0-rc1~249^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e5f9c25e5b4d179467f48e32a5c7dafe8834b56;p=dealii.git Add two asserts in NonMatching::MeshClassifier. --- diff --git a/source/non_matching/mesh_classifier.cc b/source/non_matching/mesh_classifier.cc index 236b14022e..7195ce3b33 100644 --- a/source/non_matching/mesh_classifier.cc +++ b/source/non_matching/mesh_classifier.cc @@ -46,6 +46,16 @@ namespace NonMatching { namespace MeshClassifierImplementation { + DeclExceptionMsg( + ReclassifyNotCalled, + "The Triangulation has not been classified. You need to call the " + "reclassify()-function before using this function."); + + DeclExceptionMsg( + ExcTriangulationMismatch, + "The incoming cell does not belong to the triangulation passed to " + "the constructor."); + /** * Return LocationToLevelSet::inside/outside if all values in incoming * vector are negative/positive, otherwise return @@ -419,6 +429,11 @@ namespace NonMatching MeshClassifier::location_to_level_set( const typename Triangulation::cell_iterator &cell) const { + Assert(cell_locations.size() == triangulation->n_active_cells(), + internal::MeshClassifierImplementation::ReclassifyNotCalled()); + Assert(&cell->get_triangulation() == triangulation, + internal::MeshClassifierImplementation::ExcTriangulationMismatch()); + return cell_locations.at(cell->active_cell_index()); } @@ -431,6 +446,10 @@ namespace NonMatching const unsigned int face_index) const { AssertIndexRange(face_index, GeometryInfo::faces_per_cell); + Assert(face_locations.size() == triangulation->n_raw_faces(), + internal::MeshClassifierImplementation::ReclassifyNotCalled()); + Assert(&cell->get_triangulation() == triangulation, + internal::MeshClassifierImplementation::ExcTriangulationMismatch()); return face_locations.at(cell->face(face_index)->index()); }