]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Also check for the invalid FaceDescriptor that first_face() may return.
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 16 Dec 2016 05:37:32 +0000 (22:37 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 16 Dec 2016 22:57:47 +0000 (15:57 -0700)
This happens if a process has no faces to deal with. The bug was reported by Justin Kauffman <jak5378@gmail.com>.

source/numerics/data_out_faces.cc

index a510aae6b0e66362acbd64bf4f2d1c5abdb1d9b0..cc999ba3f0dc546367908175d22d6756521f9de8 100644 (file)
@@ -287,11 +287,15 @@ void DataOutFaces<dim,DoFHandlerType>::build_patches (const Mapping<dimension> &
   for (unsigned int i=0; i<this->dof_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<FaceDescriptor> 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);
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.