]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make sure we only write into variables that are non-const.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Oct 2021 18:11:25 +0000 (12:11 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 28 Oct 2021 03:19:14 +0000 (21:19 -0600)
tests/data_out/patches.h

index 0f6269e12f41dd561af30f75ebb8339db8121fe9..6636d7a22ab621ef26615e76665edcef3a953b5a 100644 (file)
@@ -34,8 +34,15 @@ create_patches(std::vector<DataOutBase::Patch<dim, spacedim>> &patches)
       const unsigned int nsub  = p + 1;
       const unsigned int nsubp = nsub + 1;
 
-      patch.n_subdivisions = nsub;
-#if DEAL_II_HAVE_CXX17
+#ifdef DEAL_II_HAVE_CXX17
+      if constexpr (dim > 0)
+        patch.n_subdivisions = nsub;
+#else
+      if (dim > 0)
+        const_cast<unsigned int &>(patch.n_subdivisions) = nsub;
+#endif
+
+#ifdef DEAL_II_HAVE_CXX17
       if constexpr (dim > 0)
         patch.reference_cell = ReferenceCells::get_hypercube<dim>();
 #else
@@ -43,6 +50,7 @@ create_patches(std::vector<DataOutBase::Patch<dim, spacedim>> &patches)
         const_cast<ReferenceCell &>(patch.reference_cell) =
           ReferenceCells::get_hypercube<dim>();
 #endif
+
       for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         for (unsigned int d = 0; d < spacedim; ++d)
           patch.vertices[v](d) =

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.