From 3cfb9f0463808f1335767b5c8581bbf001805d1f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 28 Apr 2022 15:29:08 -0600 Subject: [PATCH] Also deal with internal faces. --- include/deal.II/numerics/data_postprocessor.h | 9 +++++++++ source/numerics/data_postprocessor.cc | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/deal.II/numerics/data_postprocessor.h b/include/deal.II/numerics/data_postprocessor.h index 40710dcfa9..d518ac6f92 100644 --- a/include/deal.II/numerics/data_postprocessor.h +++ b/include/deal.II/numerics/data_postprocessor.h @@ -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 class BoundaryIds : public DataPostprocessorScalar diff --git a/source/numerics/data_postprocessor.cc b/source/numerics/data_postprocessor.cc index 946be4b1ed..dc10f61b17 100644 --- a/source/numerics/data_postprocessor.cc +++ b/source/numerics/data_postprocessor.cc @@ -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 -- 2.39.5