]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do not preset Patch::reference_cell. 12877/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Oct 2021 03:49:10 +0000 (21:49 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 26 Oct 2021 22:42:31 +0000 (16:42 -0600)
include/deal.II/base/bounding_box_data_out.h
include/deal.II/lac/matrix_out.h
source/base/data_out_base.cc
source/numerics/data_out_rotation.cc
source/numerics/data_out_stack.cc
tests/base/functions_04.cc
tests/data_out/data_out_base.cc
tests/data_out/data_out_hdf5_02.cc
tests/data_out/patches.h

index 2dd9738de494e32b8f59326a0c35f3bbf4b0d807..7469889710a438f34dbeb18144fab40afe8f45ec 100644 (file)
@@ -141,9 +141,10 @@ BoundingBoxDataOut<dim>::build_patches(
       boost::geometry::convert(getter(*value), box);
       for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
         {
-          patches[i].vertices[v]          = box.vertex(v);
-          patches[i].patch_index          = i;
-          patches[i].n_subdivisions       = 1;
+          patches[i].vertices[v]    = box.vertex(v);
+          patches[i].patch_index    = i;
+          patches[i].n_subdivisions = 1;
+          patches[i].reference_cell = ReferenceCells::get_hypercube<dim>();
           patches[i].points_are_available = false;
         }
       ++i;
index 21319b292ebab24b6a458aa9fea49c6efe3b5e7e..96866fb679c585b2a996d6ffc486e279b945015b 100644 (file)
@@ -349,12 +349,15 @@ MatrixOut::build_patches(const Matrix &     matrix,
   for (size_type i = 0; i < gridpoints_y; ++i)
     for (size_type j = 0; j < gridpoints_x; ++j, ++index)
       {
+        patches[index].n_subdivisions = 1;
+        patches[index].reference_cell = ReferenceCells::Quadrilateral;
+
         // within each patch, order the points in such a way that if some
         // graphical output program (such as gnuplot) plots the quadrilaterals
         // as two triangles, then the diagonal of the quadrilateral which cuts
         // it into the two printed triangles is parallel to the diagonal of the
         // matrix, rather than perpendicular to it. this has the advantage that,
-        // for example, the unit matrix is plotted as a straight rim, rather
+        // for example, the unit matrix is plotted as a straight ridge, rather
         // than as a series of bumps and valleys along the diagonal
         patches[index].vertices[0](0) = j;
         patches[index].vertices[0](1) = -static_cast<signed int>(i);
index b0c68aa4306e4b1b8c98589c59bb7cd0c543af70..cfdf5227d8c7c0736600facea0c9c75ed5f1857f 100644 (file)
@@ -959,6 +959,12 @@ namespace
     n_cells = 0;
     for (const auto &patch : patches)
       {
+        Assert(patch.reference_cell != ReferenceCells::Invalid,
+               ExcMessage(
+                 "The reference cell for this patch is set to 'Invalid', "
+                 "but that is clearly not a valid choice. Did you forget "
+                 "to set the reference cell for the patch?"));
+
         // The following formula doesn't hold for non-tensor products.
         if (patch.reference_cell == ReferenceCells::get_hypercube<dim>())
           {
@@ -1964,7 +1970,7 @@ namespace DataOutBase
     : patch_index(no_neighbor)
     , n_subdivisions(1)
     , points_are_available(false)
-    , reference_cell(ReferenceCells::get_hypercube<dim>())
+    , reference_cell(ReferenceCells::Invalid)
   // all the other data has a constructor of its own, except for the "neighbors"
   // field, which we set to invalid values.
   {
index 87fe4d7269c6c94496246f9e6f9c9f20c2b82c8e..4b12a279caeb3851aa76174f475b5e908dd60a15 100644 (file)
@@ -524,6 +524,8 @@ DataOutRotation<dim, spacedim>::build_patches(
   for (unsigned int i = 0; i < new_patches.size(); ++i)
     {
       new_patches[i].n_subdivisions = n_subdivisions;
+      new_patches[i].reference_cell = ReferenceCells::get_hypercube<dim + 1>();
+
       new_patches[i].data.reinit(
         n_datasets, Utilities::fixed_power<patch_dim>(n_subdivisions + 1));
     }
index f2011bb21f87f1a74f1e69b4cc5fa67081ca8984..68a871c28615549e0d0bf3da7ce73264a1942720 100644 (file)
@@ -310,6 +310,7 @@ DataOutStack<dim, spacedim, void>::build_patches(
   // the time direction) points
   dealii::DataOutBase::Patch<patch_dim, patch_spacedim> default_patch;
   default_patch.n_subdivisions = n_subdivisions;
+  default_patch.reference_cell = ReferenceCells::get_hypercube<dim + 1>();
   default_patch.data.reinit(n_datasets, n_q_points * (n_subdivisions + 1));
   patches.insert(patches.end(), n_patches, default_patch);
 
index 2b2b1edd4680add190aef8debcb009f823f7dd86..87ee67901d4340c1a966a0bc81b2459c566eb943 100644 (file)
@@ -61,6 +61,7 @@ check_function(const Functions::FlowFunction<dim> &f,
     patches[0].neighbors[i] = numbers::invalid_unsigned_int;
   patches[0].patch_index          = 0;
   patches[0].n_subdivisions       = sub;
+  patches[0].reference_cell       = ReferenceCells::get_hypercube<dim>();
   patches[0].points_are_available = false;
 
   vertex_number = 1;
index ff7e7fa1f58d6ff72da759e947540f2591dacb03..3a6dfa127405c635dcbd4bc9188f05a551b0c27e 100644 (file)
@@ -161,6 +161,7 @@ create_patches(std::vector<DataOutBase::Patch<dim, spacedim>> &patches)
       DataOutBase::Patch<dim, spacedim> &p = patches[c];
       p.patch_index                        = c;
       p.n_subdivisions                     = nsub;
+      p.reference_cell = ReferenceCells::get_hypercube<dim>();
 
       for (unsigned int i = 0; i < ncells; ++i)
         for (unsigned int j = 0; j < spacedim; ++j)
index 2fea33737f588fa1b39447adc22ecd374a727e17..4573f9099e7a7e131b8d8fe781faad29b49577b3 100644 (file)
@@ -41,6 +41,7 @@ create_patches(std::vector<DataOutBase::Patch<dim, spacedim>> &patches)
       const unsigned int nsubp = nsub + 1;
 
       patch.n_subdivisions = nsub;
+      patch.reference_cell = ReferenceCells::get_hypercube<dim>();
       for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
         for (unsigned int d = 0; d < spacedim; ++d)
           patch.vertices[v](d) =
index d3ec419cd60dcb180fbbbd87ab248fc10f4c28f6..0f6269e12f41dd561af30f75ebb8339db8121fe9 100644 (file)
@@ -35,6 +35,14 @@ create_patches(std::vector<DataOutBase::Patch<dim, spacedim>> &patches)
       const unsigned int nsubp = nsub + 1;
 
       patch.n_subdivisions = nsub;
+#if DEAL_II_HAVE_CXX17
+      if constexpr (dim > 0)
+        patch.reference_cell = ReferenceCells::get_hypercube<dim>();
+#else
+      if (dim > 0)
+        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) =
@@ -98,6 +106,7 @@ create_continuous_patches(std::vector<DataOutBase::Patch<dim, dim>> &patches,
         {
           DataOutBase::Patch<dim, dim> patch;
           patch.n_subdivisions = n_sub;
+          patch.reference_cell = ReferenceCells::get_hypercube<dim>();
           for (unsigned int k = 0; k < trapez.size(); ++k)
             {
               Point<dim> p = trapez.point(k);

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.