Skip to content

Commit e39fc75

Browse files
committed
More testing of preparation() validity in dbg mode
1 parent aa107d4 commit e39fc75

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/mesh/mesh_base.C

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,14 @@ void MeshBase::complete_preparation()
860860

861861
libmesh_assert(this->comm().verify(this->is_serial()));
862862

863+
#ifdef DEBUG
863864
// If we don't go into this method with valid constraint rows, we're
864865
// only going to be able to make that worse.
865-
#ifdef DEBUG
866866
MeshTools::libmesh_assert_valid_constraint_rows(*this);
867+
868+
// If this mesh thinks it's already partially prepared, then in
869+
// optimized builds we'll trust it, but in debug builds we'll check.
870+
const bool was_partly_prepared = (_preparation == Preparation());
867871
#endif
868872

869873
// A distributed mesh may have processors with no elements (or
@@ -971,6 +975,10 @@ void MeshBase::complete_preparation()
971975
libmesh_assert(_preparation);
972976

973977
#ifdef DEBUG
978+
// The if() here avoids both unnecessary work *and* stack overflow
979+
if (was_partly_prepared)
980+
libmesh_assert(MeshTools::valid_is_prepared(*this));
981+
974982
MeshTools::libmesh_assert_valid_boundary_ids(*this);
975983
#ifdef LIBMESH_ENABLE_UNIQUE_ID
976984
MeshTools::libmesh_assert_valid_unique_ids(*this);

0 commit comments

Comments
 (0)