From 080c77e33e9ac7cea62fe519b6c09b8545b83885 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 15 Dec 2016 22:37:32 -0700 Subject: [PATCH] Also check for the invalid FaceDescriptor that first_face() may return. This happens if a process has no faces to deal with. The bug was reported by Justin Kauffman . --- source/numerics/data_out_faces.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/numerics/data_out_faces.cc b/source/numerics/data_out_faces.cc index a510aae6b0..cc999ba3f0 100644 --- a/source/numerics/data_out_faces.cc +++ b/source/numerics/data_out_faces.cc @@ -287,11 +287,15 @@ void DataOutFaces::build_patches (const Mapping & for (unsigned int i=0; idof_data.size(); ++i) n_datasets += this->dof_data[i]->n_output_variables; - // first count the cells we want to create patches of and make sure there is - // enough memory for that + // first collect the cells we want to create patches of; we will + // then iterate over them. the end-condition of the loop needs to + // test that next_face() returns an end iterator, as well as for the + // case that first_face() returns an invalid FaceDescriptor object std::vector all_faces; for (FaceDescriptor face=first_face(); - face.first != this->triangulation->end(); + ((face.first != this->triangulation->end()) + && + (face != FaceDescriptor())); face = next_face(face)) all_faces.push_back (face); -- 2.39.5