* @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>
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