#include <deal.II/base/tensor.h>
#include <deal.II/base/utilities.h>
+#include <iosfwd>
+#include <string>
DEAL_II_NAMESPACE_OPEN
*/
friend DEAL_II_CONSTEXPR ReferenceCell
internal::ReferenceCell::make_reference_cell_from_int(const std::uint8_t);
+
+ friend std::ostream &
+ operator<<(std::ostream &out, const ReferenceCell &reference_cell);
+
+ friend std::istream &
+ operator>>(std::istream &in, ReferenceCell &reference_cell);
};
+/**
+ * Output operator that writes the @p reference_cell object to the stream
+ * in a text format in which the object is represented by an integer. The
+ * details of which integer value represents each kind of reference cell
+ * is unimportant and consequently not specified. If you want a string
+ * representation of what a ReferenceCell is, use ReferenceCell::to_string().
+ */
+std::ostream &
+operator<<(std::ostream &out, const ReferenceCell &reference_cell);
+
+/**
+ * Input operator that reads the @p reference_cell object from the stream
+ * in a text format in which the object is represented by an integer. Which
+ * specific integer value represents which reference cell is unspecified,
+ * but the function uses the same translation as the corresponding
+ * output `operator<<`.
+ */
+std::istream &
+operator>>(std::istream &in, ReferenceCell &reference_cell);
+
inline constexpr ReferenceCell::ReferenceCell(const std::uint8_t kind)
: kind(kind)
#include <deal.II/grid/reference_cell.h>
#include <deal.II/grid/tria.h>
+#include <iostream>
#include <memory>
DEAL_II_NAMESPACE_OPEN
return VTKCellType::VTK_INVALID;
}
+
+
+std::ostream &
+operator<<(std::ostream &out, const ReferenceCell &reference_cell)
+{
+ AssertThrow(out, ExcIO());
+
+ // Output as an integer to avoid outputting it as a character with
+ // potentially non-printing value:
+ out << static_cast<unsigned int>(reference_cell.kind);
+ return out;
+}
+
+
+
+std::istream &
+operator>>(std::istream &in, ReferenceCell &reference_cell)
+{
+ AssertThrow(in, ExcIO());
+
+ // Read the information as an integer and convert it to the correct type
+ unsigned int value;
+ in >> value;
+ reference_cell.kind = static_cast<decltype(reference_cell.kind)>(value);
+
+ // Ensure that the object we read is valid
+ Assert(
+ (reference_cell == ReferenceCells::Vertex) ||
+ (reference_cell == ReferenceCells::Line) ||
+ (reference_cell == ReferenceCells::Triangle) ||
+ (reference_cell == ReferenceCells::Quadrilateral) ||
+ (reference_cell == ReferenceCells::Tetrahedron) ||
+ (reference_cell == ReferenceCells::Hexahedron) ||
+ (reference_cell == ReferenceCells::Wedge) ||
+ (reference_cell == ReferenceCells::Pyramid) ||
+ (reference_cell == ReferenceCells::Invalid),
+ ExcMessage(
+ "The reference cell kind just read does not correspond to one of the valid choices. There must be an error."));
+
+ return in;
+}
+
+
+
#include "reference_cell.inst"
DEAL_II_NAMESPACE_CLOSE