]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Also deal with internal faces.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 28 Apr 2022 21:29:08 +0000 (15:29 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 28 Apr 2022 21:29:08 +0000 (15:29 -0600)
include/deal.II/numerics/data_postprocessor.h
source/numerics/data_postprocessor.cc

index 40710dcfa997dd070d2cfd3d03950262d3df1bf3..d518ac6f927f7a9f3aca3822ee5c8a1d69912746 100644 (file)
@@ -1293,6 +1293,15 @@ namespace DataPostprocessors
    * @note This class is intended for use with DataOutFaces, not DataOut.
    *   This is because it provides information about the *faces* of a
    *   triangulation, not about cell-based information.
+   *
+   * By default, the DataOutFaces class function only generates
+   * output for faces that lie on the boundary of the domain, and on these
+   * faces, boundary indicators are available. But one can also
+   * instruct DataOutFaces to run on internal faces as
+   * well (by providing an argument to the constructor of the class).
+   * At these internal faces, no boundary indicator is available because,
+   * of course, the face is not actually at the boundary. For these
+   * faces, the current class then outputs -1 as an indicator.
    */
   template <int dim>
   class BoundaryIds : public DataPostprocessorScalar<dim>
index 946be4b1ed047fc87d98cd4632a57770ad2cde9a..dc10f61b175cd338a43a233ad4207b841b8081fc 100644 (file)
@@ -219,7 +219,15 @@ namespace DataPostprocessors
     for (auto &output : computed_quantities)
       {
         AssertDimension(output.size(), 1);
-        output(0) = cell->face(face)->boundary_id();
+
+        // By default, DataOutFaces is only run on faces at the boundary of the
+        // domain. But one can instruct it to also run on internal faces, and in
+        // that case we cannot ask for the boundary id. Rather, we output -1, as
+        // described in the documentation.
+        if (cell->at_boundary(face))
+          output(0) = cell->face(face)->boundary_id();
+        else
+          output(0) = -1;
       }
   }
 } // namespace DataPostprocessors

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.