]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a missing assertion in the XDMF writer.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 30 May 2022 17:10:36 +0000 (11:10 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 30 May 2022 17:17:18 +0000 (11:17 -0600)
source/base/data_out_base.cc

index 5db3b1bcb6a9907b092769d824eb141c122df42e..a6794da7ba999c310faafe35767617b3a2682e23 100644 (file)
@@ -8007,8 +8007,7 @@ DataOutInterface<dim, spacedim>::write_xdmf_file(
   // Only rank 0 process writes the XDMF file
   if (myrank == 0)
     {
-      std::ofstream                          xdmf_file(filename.c_str());
-      std::vector<XDMFEntry>::const_iterator it;
+      std::ofstream xdmf_file(filename.c_str());
 
       xdmf_file << "<?xml version=\"1.0\" ?>\n";
       xdmf_file << "<!DOCTYPE Xdmf SYSTEM \"Xdmf.dtd\" []>\n";
@@ -8021,9 +8020,16 @@ DataOutInterface<dim, spacedim>::write_xdmf_file(
       const auto &patches = get_patches();
       Assert(patches.size() > 0, DataOutBase::ExcNoPatches());
 
-      for (it = entries.begin(); it != entries.end(); ++it)
+      // We currently don't support writing mixed meshes:
+#ifdef DEBUG
+      for (const auto &patch : patches)
+        Assert(patch.reference_cell == patches[0].reference_cell,
+               ExcNotImplemented());
+#endif
+
+      for (const auto &entry : entries)
         {
-          xdmf_file << it->get_xdmf_content(3, patches[0].reference_cell);
+          xdmf_file << entry.get_xdmf_content(3, patches[0].reference_cell);
         }
 
       xdmf_file << "    </Grid>\n";

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.