Reference documentation for deal.II version GIT 5dd0dfed0b 2022-12-08 21:45:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
data_out_base.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2022 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_data_out_base_h
17 #define dealii_data_out_base_h
18 
19 
20 #include <deal.II/base/config.h>
21 
23 #include <deal.II/base/mpi_stub.h>
24 #include <deal.II/base/point.h>
25 #include <deal.II/base/table.h>
26 
28 
30 
31 // To be able to serialize XDMFEntry
32 #include <boost/serialization/map.hpp>
33 
34 #include <limits>
35 #include <string>
36 #include <tuple>
37 #include <typeinfo>
38 #include <vector>
39 
40 // Only include the Tecplot API header if the appropriate files
41 // were detected by configure
42 #ifdef DEAL_II_HAVE_TECPLOT
43 # include <string.h>
44 
45 # include "TECIO.h"
46 #endif
47 
48 #include <ostream>
49 
51 
52 // Forward declarations
53 #ifndef DOXYGEN
54 class ParameterHandler;
55 class XDMFEntry;
56 #endif
57 
207 namespace DataOutBase
208 {
216  enum class CompressionLevel
217  {
225  best_speed,
239  plain_text
240  };
241 
242 
265  template <int dim, int spacedim = dim>
266  struct Patch
267  {
271  static const unsigned int space_dim = spacedim;
272 
286 
292  std::array<unsigned int, GeometryInfo<dim>::faces_per_cell> neighbors;
293 
298  unsigned int patch_index;
299 
305  unsigned int n_subdivisions;
306 
329 
343 
348 
353  Patch();
354 
359  bool
360  operator==(const Patch &patch) const;
361 
368  std::size_t
369  memory_consumption() const;
370 
374  void
375  swap(Patch<dim, spacedim> &other_patch);
376 
380  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
381 
392  int,
393  int,
394  << "It is not possible to have a structural dimension of " << arg1
395  << " to be larger than the space dimension of the surrounding"
396  << " space " << arg2);
398  };
399 
400 
401 
417  template <int spacedim>
418  struct Patch<0, spacedim>
419  {
423  static const unsigned int space_dim = spacedim;
424 
434 
439  static unsigned int neighbors[1];
440 
445  unsigned int patch_index;
446 
456  static const unsigned int n_subdivisions;
457 
479 
493 
500 
505  Patch();
506 
511  bool
512  operator==(const Patch &patch) const;
513 
520  std::size_t
521  memory_consumption() const;
522 
526  void
527  swap(Patch<0, spacedim> &other_patch);
528 
532  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
533 
544  int,
545  int,
546  << "It is not possible to have a structural dimension of " << arg1
547  << " to be larger than the space dimension of the surrounding"
548  << " space " << arg2);
550  };
551 
552 
564  template <typename FlagsType>
566  {
574  static void
576 
584  void
586 
593  std::size_t
595  };
596 
597 
598  template <typename FlagsType>
599  void
601  {}
602 
603 
604  template <typename FlagsType>
605  void
607  {}
608 
609 
610  template <typename FlagsType>
611  std::size_t
613  {
614  return sizeof(FlagsType);
615  }
616 
617 
623  struct DXFlags : public OutputFlagsBase<DXFlags>
624  {
639 
644 
650 
654  DXFlags(const bool write_neighbors = false,
655  const bool int_binary = false,
656  const bool coordinates_binary = false,
657  const bool data_binary = false);
658 
663  static void
665 
672  void
674  };
675 
681  struct UcdFlags : public OutputFlagsBase<UcdFlags>
682  {
693 
697  UcdFlags(const bool write_preamble = false);
698 
703  static void
705 
712  void
714  };
715 
721  struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
722  {
727  GnuplotFlags();
728 
732  GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
733 
749  std::vector<std::string> space_dimension_labels;
750 
755  std::size_t
756  memory_consumption() const;
757 
763  "There should be at least one space dimension per spatial "
764  "dimension (extras are ignored).");
765  };
766 
773  struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
774  {
780  bool smooth;
781 
788 
796 
800  PovrayFlags(const bool smooth = false,
801  const bool bicubic_patch = false,
802  const bool external_data = false);
803 
808  static void
810 
817  void
819  };
820 
821 
828  struct EpsFlags : public OutputFlagsBase<EpsFlags>
829  {
836  unsigned int height_vector;
837 
842  unsigned int color_vector;
843 
849  enum SizeType
850  {
854  height
855  };
856 
861 
869  unsigned int size;
870 
874  double line_width;
875 
881  double azimut_angle;
882 
906  double turn_angle;
907 
918  double z_scaling;
919 
926  bool draw_mesh;
927 
945 
955 
959  struct RgbValues
960  {
961  float red;
962  float green;
963  float blue;
964 
969  bool
970  is_grey() const;
971  };
972 
980  using ColorFunction = RgbValues (*)(const double value,
981  const double min_value,
982  const double max_value);
983 
990 
991 
1000  static RgbValues
1001  default_color_function(const double value,
1002  const double min_value,
1003  const double max_value);
1004 
1010  static RgbValues
1011  grey_scale_color_function(const double value,
1012  const double min_value,
1013  const double max_value);
1014 
1021  static RgbValues
1022  reverse_grey_scale_color_function(const double value,
1023  const double min_value,
1024  const double max_value);
1025 
1029  EpsFlags(const unsigned int height_vector = 0,
1030  const unsigned int color_vector = 0,
1031  const SizeType size_type = width,
1032  const unsigned int size = 300,
1033  const double line_width = 0.5,
1034  const double azimut_angle = 60,
1035  const double turn_angle = 30,
1036  const double z_scaling = 1.0,
1037  const bool draw_mesh = true,
1038  const bool draw_cells = true,
1039  const bool shade_cells = true,
1041 
1049  static void
1051 
1058  void
1059  parse_parameters(const ParameterHandler &prm);
1060  };
1061 
1068  struct GmvFlags : public OutputFlagsBase<GmvFlags>
1069  {};
1070 
1076  struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
1077  {
1082  const char *zone_name;
1083 
1090 
1094  TecplotFlags(const char * zone_name = nullptr,
1095  const double solution_time = -1.0);
1096 
1101  std::size_t
1102  memory_consumption() const;
1103  };
1104 
1110  struct VtkFlags : public OutputFlagsBase<VtkFlags>
1111  {
1122  double time;
1123 
1134  unsigned int cycle;
1135 
1143 
1152 
1161 
1167 
1186 
1208  std::map<std::string, std::string> physical_units;
1209 
1214  explicit VtkFlags(
1215  const double time = std::numeric_limits<double>::min(),
1216  const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
1217  const bool print_date_and_time = true,
1220  const bool write_higher_order_cells = false,
1221  const std::map<std::string, std::string> &physical_units = {});
1222  };
1223 
1224 
1230  struct SvgFlags : public OutputFlagsBase<SvgFlags>
1231  {
1235  unsigned int height;
1236 
1241  unsigned int width;
1242 
1249  unsigned int height_vector;
1250 
1255 
1256  unsigned int line_thickness;
1257 
1261  bool margin;
1262 
1267 
1271  SvgFlags(const unsigned int height_vector = 0,
1272  const int azimuth_angle = 37,
1273  const int polar_angle = 45,
1274  const unsigned int line_thickness = 1,
1275  const bool margin = true,
1276  const bool draw_colorbar = true);
1277  };
1278 
1279 
1287  : public OutputFlagsBase<Deal_II_IntermediateFlags>
1288  {
1295  static const unsigned int format_version;
1296  };
1297 
1304  {
1315 
1321 
1325  DataOutFilterFlags(const bool filter_duplicate_vertices = false,
1326  const bool xdmf_hdf5_output = false);
1327 
1332  static void
1334 
1341  void
1342  parse_parameters(const ParameterHandler &prm);
1343 
1348  std::size_t
1350  };
1351 
1384  {
1385  public:
1389  DataOutFilter();
1390 
1396 
1402  template <int dim>
1403  void
1404  write_point(const unsigned int index, const Point<dim> &p);
1405 
1409  template <int dim>
1410  void
1411  write_cell(const unsigned int index,
1412  const unsigned int start,
1413  const std::array<unsigned int, dim> &offsets);
1414 
1419  void
1420  write_cell_single(const unsigned int index,
1421  const unsigned int start,
1422  const unsigned int n_points,
1423  const ReferenceCell &reference_cell);
1424 
1431  void
1432  write_data_set(const std::string & name,
1433  const unsigned int dimension,
1434  const unsigned int set_num,
1435  const Table<2, double> &data_vectors);
1436 
1441  void
1442  fill_node_data(std::vector<double> &node_data) const;
1443 
1448  void
1449  fill_cell_data(const unsigned int local_node_offset,
1450  std::vector<unsigned int> &cell_data) const;
1451 
1455  std::string
1456  get_data_set_name(const unsigned int set_num) const;
1457 
1461  unsigned int
1462  get_data_set_dim(const unsigned int set_num) const;
1463 
1468  const double *
1469  get_data_set(const unsigned int set_num) const;
1470 
1475  unsigned int
1476  n_nodes() const;
1477 
1482  unsigned int
1483  n_cells() const;
1484 
1489  unsigned int
1490  n_data_sets() const;
1491 
1495  void
1496  flush_points();
1497 
1501  void
1502  flush_cells();
1503 
1504 
1505  private:
1509  struct Point3Comp
1510  {
1511  bool
1512  operator()(const Point<3> &one, const Point<3> &two) const
1513  {
1514  /*
1515  * The return statement below is an optimized version of the following
1516  * code:
1517  *
1518  * for (unsigned int d=0; d<3; ++d)
1519  * {
1520  * if (one(d) < two(d))
1521  * return true;
1522  * else if (one(d) > two(d))
1523  * return false;
1524  * }
1525  * return false;
1526  */
1527 
1528  return (one(0) < two(0) ||
1529  (!(two(0) < one(0)) &&
1530  (one(1) < two(1) || (!(two(1) < one(1)) && one(2) < two(2)))));
1531  }
1532  };
1533 
1534  using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1535 
1540 
1547  unsigned int node_dim;
1548 
1553  unsigned int num_cells;
1554 
1559 
1563  std::map<unsigned int, unsigned int> filtered_points;
1564 
1568  std::map<unsigned int, unsigned int> filtered_cells;
1569 
1573  std::vector<std::string> data_set_names;
1574 
1578  std::vector<unsigned int> data_set_dims;
1579 
1583  std::vector<std::vector<double>> data_sets;
1584 
1588  void
1589  internal_add_cell(const unsigned int cell_index,
1590  const unsigned int pt_index);
1591  };
1592 
1593 
1598  {
1603 
1608 
1613 
1618 
1623 
1628 
1633 
1638 
1643 
1651 
1656 
1661 
1666 
1671 
1675  hdf5
1676  };
1677 
1678 
1682  template <int dim, int spacedim>
1683  void
1684  write_dx(
1685  const std::vector<Patch<dim, spacedim>> &patches,
1686  const std::vector<std::string> & data_names,
1687  const std::vector<
1688  std::tuple<unsigned int,
1689  unsigned int,
1690  std::string,
1692  & nonscalar_data_ranges,
1693  const DXFlags &flags,
1694  std::ostream & out);
1695 
1740  template <int spacedim>
1741  void
1742  write_eps(
1743  const std::vector<Patch<2, spacedim>> &patches,
1744  const std::vector<std::string> & data_names,
1745  const std::vector<
1746  std::tuple<unsigned int,
1747  unsigned int,
1748  std::string,
1750  & nonscalar_data_ranges,
1751  const EpsFlags &flags,
1752  std::ostream & out);
1753 
1759  template <int dim, int spacedim>
1760  void
1761  write_eps(
1762  const std::vector<Patch<dim, spacedim>> &patches,
1763  const std::vector<std::string> & data_names,
1764  const std::vector<
1765  std::tuple<unsigned int,
1766  unsigned int,
1767  std::string,
1769  & nonscalar_data_ranges,
1770  const EpsFlags &flags,
1771  std::ostream & out);
1772 
1773 
1783  template <int dim, int spacedim>
1784  void
1785  write_gmv(
1786  const std::vector<Patch<dim, spacedim>> &patches,
1787  const std::vector<std::string> & data_names,
1788  const std::vector<
1789  std::tuple<unsigned int,
1790  unsigned int,
1791  std::string,
1793  & nonscalar_data_ranges,
1794  const GmvFlags &flags,
1795  std::ostream & out);
1796 
1852  template <int dim, int spacedim>
1853  void
1854  write_gnuplot(
1855  const std::vector<Patch<dim, spacedim>> &patches,
1856  const std::vector<std::string> & data_names,
1857  const std::vector<
1858  std::tuple<unsigned int,
1859  unsigned int,
1860  std::string,
1862  & nonscalar_data_ranges,
1863  const GnuplotFlags &flags,
1864  std::ostream & out);
1865 
1911  template <int dim, int spacedim>
1912  void
1913  write_povray(
1914  const std::vector<Patch<dim, spacedim>> &patches,
1915  const std::vector<std::string> & data_names,
1916  const std::vector<
1917  std::tuple<unsigned int,
1918  unsigned int,
1919  std::string,
1921  & nonscalar_data_ranges,
1922  const PovrayFlags &flags,
1923  std::ostream & out);
1924 
1931  template <int dim, int spacedim>
1932  void
1933  write_tecplot(
1934  const std::vector<Patch<dim, spacedim>> &patches,
1935  const std::vector<std::string> & data_names,
1936  const std::vector<
1937  std::tuple<unsigned int,
1938  unsigned int,
1939  std::string,
1941  & nonscalar_data_ranges,
1942  const TecplotFlags &flags,
1943  std::ostream & out);
1944 
1959  template <int dim, int spacedim>
1960  void
1961  write_ucd(
1962  const std::vector<Patch<dim, spacedim>> &patches,
1963  const std::vector<std::string> & data_names,
1964  const std::vector<
1965  std::tuple<unsigned int,
1966  unsigned int,
1967  std::string,
1969  & nonscalar_data_ranges,
1970  const UcdFlags &flags,
1971  std::ostream & out);
1972 
1992  template <int dim, int spacedim>
1993  void
1994  write_vtk(
1995  const std::vector<Patch<dim, spacedim>> &patches,
1996  const std::vector<std::string> & data_names,
1997  const std::vector<
1998  std::tuple<unsigned int,
1999  unsigned int,
2000  std::string,
2002  & nonscalar_data_ranges,
2003  const VtkFlags &flags,
2004  std::ostream & out);
2005 
2006 
2030  template <int dim, int spacedim>
2031  void
2032  write_vtu(
2033  const std::vector<Patch<dim, spacedim>> &patches,
2034  const std::vector<std::string> & data_names,
2035  const std::vector<
2036  std::tuple<unsigned int,
2037  unsigned int,
2038  std::string,
2040  & nonscalar_data_ranges,
2041  const VtkFlags &flags,
2042  std::ostream & out);
2043 
2049  void
2050  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2051 
2058  void
2059  write_vtu_footer(std::ostream &out);
2060 
2067  template <int dim, int spacedim>
2068  void
2070  const std::vector<Patch<dim, spacedim>> &patches,
2071  const std::vector<std::string> & data_names,
2072  const std::vector<
2073  std::tuple<unsigned int,
2074  unsigned int,
2075  std::string,
2077  & nonscalar_data_ranges,
2078  const VtkFlags &flags,
2079  std::ostream & out);
2080 
2122  void
2124  std::ostream & out,
2125  const std::vector<std::string> &piece_names,
2126  const std::vector<std::string> &data_names,
2127  const std::vector<
2128  std::tuple<unsigned int,
2129  unsigned int,
2130  std::string,
2132  & nonscalar_data_ranges,
2133  const VtkFlags &flags);
2134 
2183  void
2185  std::ostream & out,
2186  const std::vector<std::pair<double, std::string>> &times_and_names);
2187 
2199  void
2200  write_visit_record(std::ostream & out,
2201  const std::vector<std::string> &piece_names);
2202 
2230  void
2231  write_visit_record(std::ostream & out,
2232  const std::vector<std::vector<std::string>> &piece_names);
2233 
2266  void
2268  std::ostream &out,
2269  const std::vector<std::pair<double, std::vector<std::string>>>
2270  &times_and_piece_names);
2271 
2292  template <int spacedim>
2293  void
2294  write_svg(
2295  const std::vector<Patch<2, spacedim>> &patches,
2296  const std::vector<std::string> & data_names,
2297  const std::vector<
2298  std::tuple<unsigned int,
2299  unsigned int,
2300  std::string,
2302  & nonscalar_data_ranges,
2303  const SvgFlags &flags,
2304  std::ostream & out);
2305 
2343  template <int dim, int spacedim>
2344  void
2346  const std::vector<Patch<dim, spacedim>> &patches,
2347  const std::vector<std::string> & data_names,
2348  const std::vector<
2349  std::tuple<unsigned int,
2350  unsigned int,
2351  std::string,
2353  & nonscalar_data_ranges,
2354  const Deal_II_IntermediateFlags &flags,
2355  std::ostream & out);
2356 
2365  template <int dim, int spacedim>
2366  void
2368  const std::vector<Patch<dim, spacedim>> &patches,
2369  const std::vector<std::string> & data_names,
2370  const std::vector<
2371  std::tuple<unsigned int,
2372  unsigned int,
2373  std::string,
2375  & nonscalar_data_ranges,
2376  const Deal_II_IntermediateFlags &flags,
2377  const std::string & filename,
2378  const MPI_Comm & comm,
2379  const CompressionLevel compression);
2380 
2385  template <int dim, int spacedim>
2386  void
2387  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2388  const DataOutFilter & data_filter,
2389  const std::string & filename,
2390  const MPI_Comm & comm);
2391 
2399  template <int dim, int spacedim>
2400  void
2401  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2402  const DataOutFilter & data_filter,
2403  const bool write_mesh_file,
2404  const std::string & mesh_filename,
2405  const std::string &solution_filename,
2406  const MPI_Comm & comm);
2407 
2414  template <int dim, int spacedim>
2415  void
2417  const std::vector<Patch<dim, spacedim>> &patches,
2418  const std::vector<std::string> & data_names,
2419  const std::vector<
2420  std::tuple<unsigned int,
2421  unsigned int,
2422  std::string,
2424  & nonscalar_data_ranges,
2425  DataOutFilter &filtered_data);
2426 
2438  std::pair<unsigned int, unsigned int>
2439  determine_intermediate_format_dimensions(std::istream &input);
2440 
2452  OutputFormat
2453  parse_output_format(const std::string &format_name);
2454 
2460  std::string
2462 
2483  std::string
2484  default_suffix(const OutputFormat output_format);
2485 
2495  int,
2496  int,
2497  << "The number of points in this data set is " << arg1
2498  << ", but we expected " << arg2
2499  << " in each space direction.");
2504  "You are trying to write graphical data into a file, but "
2505  "no data is available in the intermediate format that "
2506  "the DataOutBase functions require. Did you forget to "
2507  "call a function such as DataOut::build_patches()?");
2512  "The error code of one of the Tecplot functions was "
2513  "not zero as expected.");
2518  char *,
2519  << "There was an error opening Tecplot file " << arg1
2520  << " for output.");
2521 
2523 } // namespace DataOutBase
2524 
2525 
2526 
2633 template <int dim, int spacedim = dim>
2635 {
2636 public:
2640  DataOutInterface();
2641 
2646  virtual ~DataOutInterface() = default;
2647 
2652  void
2653  write_dx(std::ostream &out) const;
2654 
2659  void
2660  write_eps(std::ostream &out) const;
2661 
2666  void
2667  write_gmv(std::ostream &out) const;
2668 
2673  void
2674  write_gnuplot(std::ostream &out) const;
2675 
2680  void
2681  write_povray(std::ostream &out) const;
2682 
2687  void
2688  write_tecplot(std::ostream &out) const;
2689 
2694  void
2695  write_ucd(std::ostream &out) const;
2696 
2708  void
2709  write_vtk(std::ostream &out) const;
2710 
2725  void
2726  write_vtu(std::ostream &out) const;
2727 
2736  void
2737  write_vtu_in_parallel(const std::string &filename,
2738  const MPI_Comm & comm) const;
2739 
2773  void
2774  write_pvtu_record(std::ostream & out,
2775  const std::vector<std::string> &piece_names) const;
2776 
2835  std::string
2837  const std::string &directory,
2838  const std::string &filename_without_extension,
2839  const unsigned int counter,
2840  const MPI_Comm & mpi_communicator,
2841  const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2842  const unsigned int n_groups = 0) const;
2843 
2848  void
2849  write_svg(std::ostream &out) const;
2850 
2861  void
2862  write_deal_II_intermediate(std::ostream &out) const;
2863 
2870  void
2872  const std::string & filename,
2873  const MPI_Comm & comm,
2874  const DataOutBase::CompressionLevel compression) const;
2875 
2881  XDMFEntry
2882  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2883  const std::string & h5_filename,
2884  const double cur_time,
2885  const MPI_Comm & comm) const;
2886 
2892  XDMFEntry
2893  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2894  const std::string & h5_mesh_filename,
2895  const std::string & h5_solution_filename,
2896  const double cur_time,
2897  const MPI_Comm & comm) const;
2898 
2923  void
2924  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2925  const std::string & filename,
2926  const MPI_Comm & comm) const;
2927 
2942  void
2944  const std::string & filename,
2945  const MPI_Comm & comm) const;
2946 
2954  void
2956  const bool write_mesh_file,
2957  const std::string & mesh_filename,
2958  const std::string & solution_filename,
2959  const MPI_Comm & comm) const;
2960 
2967  void
2968  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2969 
2970 
2979  void
2980  write(std::ostream & out,
2981  const DataOutBase::OutputFormat output_format =
2983 
2988  void
2990 
2991 
2996  template <typename FlagType>
2997  void
2998  set_flags(const FlagType &flags);
2999 
3000 
3008  std::string
3009  default_suffix(const DataOutBase::OutputFormat output_format =
3011 
3026  static void
3028 
3036  void
3038 
3044  std::size_t
3045  memory_consumption() const;
3046 
3047 protected:
3055  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
3056  get_patches() const = 0;
3057 
3062  virtual std::vector<std::string>
3063  get_dataset_names() const = 0;
3064 
3083  virtual std::vector<
3084  std::tuple<unsigned int,
3085  unsigned int,
3086  std::string,
3088  get_nonscalar_data_ranges() const;
3089 
3096  void
3097  validate_dataset_names() const;
3098 
3099 
3105  unsigned int default_subdivisions;
3106 
3107 private:
3114 
3120 
3126 
3132 
3138 
3144 
3150 
3156 
3162 
3168 
3174 };
3175 
3176 
3177 
3223 template <int dim, int spacedim = dim>
3224 class DataOutReader : public DataOutInterface<dim, spacedim>
3225 {
3226 public:
3232  void
3233  read(std::istream &in);
3234 
3240  void
3241  read_whole_parallel_file(std::istream &in);
3242 
3264  void
3265  merge(const DataOutReader<dim, spacedim> &other);
3266 
3271  "You are trying to merge two sets of patches for which the "
3272  "declared names of the variables do not match.");
3277  "You are trying to merge two sets of patches for which the "
3278  "number of subdivisions or the number of vector components "
3279  "do not match.");
3284  int,
3285  int,
3286  int,
3287  int,
3288  << "Either the dimensions <" << arg1 << "> and <" << arg2
3289  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3290  << "> do not match!");
3291 
3292 protected:
3301  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3302  get_patches() const override;
3303 
3310  virtual std::vector<std::string>
3311  get_dataset_names() const override;
3312 
3331  virtual std::vector<
3332  std::tuple<unsigned int,
3333  unsigned int,
3334  std::string,
3336  get_nonscalar_data_ranges() const override;
3337 
3338 private:
3343  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3344  std::vector<std::string> dataset_names;
3345 
3350  std::vector<
3351  std::tuple<unsigned int,
3352  unsigned int,
3353  std::string,
3356 };
3357 
3358 
3359 
3368 {
3369 public:
3373  XDMFEntry();
3374 
3380  XDMFEntry(const std::string & filename,
3381  const double time,
3382  const std::uint64_t nodes,
3383  const std::uint64_t cells,
3384  const unsigned int dim,
3385  const ReferenceCell &cell_type);
3386 
3392  XDMFEntry(const std::string & filename,
3393  const double time,
3394  const std::uint64_t nodes,
3395  const std::uint64_t cells,
3396  const unsigned int dim);
3397 
3403  XDMFEntry(const std::string & mesh_filename,
3404  const std::string & solution_filename,
3405  const double time,
3406  const std::uint64_t nodes,
3407  const std::uint64_t cells,
3408  const unsigned int dim);
3409 
3414  XDMFEntry(const std::string & mesh_filename,
3415  const std::string & solution_filename,
3416  const double time,
3417  const std::uint64_t nodes,
3418  const std::uint64_t cells,
3419  const unsigned int dim,
3420  const ReferenceCell &cell_type);
3421 
3428  XDMFEntry(const std::string & mesh_filename,
3429  const std::string & solution_filename,
3430  const double time,
3431  const std::uint64_t nodes,
3432  const std::uint64_t cells,
3433  const unsigned int dim,
3434  const unsigned int spacedim);
3435 
3439  XDMFEntry(const std::string & mesh_filename,
3440  const std::string & solution_filename,
3441  const double time,
3442  const std::uint64_t nodes,
3443  const std::uint64_t cells,
3444  const unsigned int dim,
3445  const unsigned int spacedim,
3446  const ReferenceCell &cell_type);
3447 
3451  void
3452  add_attribute(const std::string &attr_name, const unsigned int dimension);
3453 
3459  template <class Archive>
3460  void
3461  serialize(Archive &ar, const unsigned int /*version*/)
3462  {
3465  }
3466 
3471  std::string
3472  get_xdmf_content(const unsigned int indent_level) const;
3473 
3481  std::string
3482  get_xdmf_content(const unsigned int indent_level,
3483  const ReferenceCell &reference_cell) const;
3484 
3485 private:
3489  bool valid;
3490 
3494  std::string h5_sol_filename;
3495 
3499  std::string h5_mesh_filename;
3500 
3504  double entry_time;
3505 
3509  std::uint64_t num_nodes;
3510 
3514  std::uint64_t num_cells;
3515 
3519  unsigned int dimension;
3520 
3525  unsigned int space_dimension;
3526 
3532 
3536  std::map<std::string, unsigned int> attribute_dims;
3537 };
3538 
3539 
3540 
3541 /* -------------------- inline functions ------------------- */
3542 
3543 namespace DataOutBase
3544 {
3545  inline bool
3547  {
3548  return (red == green) && (red == blue);
3549  }
3550 
3551 
3552  /* -------------------- template functions ------------------- */
3553 
3560  template <int dim, int spacedim>
3561  std::ostream &
3562  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3563 
3564 
3565 
3572  template <int dim, int spacedim>
3573  std::istream &
3574  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3575 } // namespace DataOutBase
3576 
3577 
3579 
3580 #endif
const double * get_data_set(const unsigned int set_num) const
std::map< unsigned int, unsigned int > filtered_points
std::string get_data_set_name(const unsigned int set_num) const
std::multimap< Point< 3 >, unsigned int, Point3Comp > Map3DPoint
void internal_add_cell(const unsigned int cell_index, const unsigned int pt_index)
void write_cell(const unsigned int index, const unsigned int start, const std::array< unsigned int, dim > &offsets)
std::vector< unsigned int > data_set_dims
unsigned int n_nodes() const
void fill_node_data(std::vector< double > &node_data) const
std::vector< std::vector< double > > data_sets
unsigned int get_data_set_dim(const unsigned int set_num) const
void write_data_set(const std::string &name, const unsigned int dimension, const unsigned int set_num, const Table< 2, double > &data_vectors)
std::map< unsigned int, unsigned int > filtered_cells
void write_cell_single(const unsigned int index, const unsigned int start, const unsigned int n_points, const ReferenceCell &reference_cell)
std::vector< std::string > data_set_names
void fill_cell_data(const unsigned int local_node_offset, std::vector< unsigned int > &cell_data) const
void write_point(const unsigned int index, const Point< dim > &p)
unsigned int n_cells() const
DataOutBase::DataOutFilterFlags flags
unsigned int n_data_sets() const
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const
unsigned int default_subdivisions
std::string write_vtu_with_pvtu_record(const std::string &directory, const std::string &filename_without_extension, const unsigned int counter, const MPI_Comm &mpi_communicator, const unsigned int n_digits_for_counter=numbers::invalid_unsigned_int, const unsigned int n_groups=0) const
void parse_parameters(ParameterHandler &prm)
DataOutBase::Deal_II_IntermediateFlags deal_II_intermediate_flags
virtual std::vector< std::string > get_dataset_names() const =0
void write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names) const
static void declare_parameters(ParameterHandler &prm)
void write_deal_II_intermediate_in_parallel(const std::string &filename, const MPI_Comm &comm, const DataOutBase::CompressionLevel compression) const
void write_hdf5_parallel(const DataOutBase::DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm) const
DataOutBase::TecplotFlags tecplot_flags
void write_ucd(std::ostream &out) const
void write_povray(std::ostream &out) const
std::string default_suffix(const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
XDMFEntry create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, const MPI_Comm &comm) const
void write_vtu_in_parallel(const std::string &filename, const MPI_Comm &comm) const
DataOutBase::GmvFlags gmv_flags
std::size_t memory_consumption() const
void set_default_format(const DataOutBase::OutputFormat default_format)
DataOutBase::PovrayFlags povray_flags
DataOutBase::UcdFlags ucd_flags
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
virtual const std::vector< DataOutBase::Patch< dim, spacedim > > & get_patches() const =0
DataOutBase::OutputFormat default_fmt
DataOutBase::GnuplotFlags gnuplot_flags
void write_gnuplot(std::ostream &out) const
virtual ~DataOutInterface()=default
void write_vtu(std::ostream &out) const
void write_tecplot(std::ostream &out) const
void write_svg(std::ostream &out) const
DataOutBase::SvgFlags svg_flags
void write_xdmf_file(const std::vector< XDMFEntry > &entries, const std::string &filename, const MPI_Comm &comm) const
void validate_dataset_names() const
void set_flags(const FlagType &flags)
void write_vtk(std::ostream &out) const
DataOutBase::VtkFlags vtk_flags
void write_gmv(std::ostream &out) const
DataOutBase::EpsFlags eps_flags
void write_eps(std::ostream &out) const
DataOutBase::DXFlags dx_flags
void write_dx(std::ostream &out) const
void write_deal_II_intermediate(std::ostream &out) const
void merge(const DataOutReader< dim, spacedim > &other)
void read_whole_parallel_file(std::istream &in)
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > nonscalar_data_ranges
virtual const std::vector<::DataOutBase::Patch< dim, spacedim > > & get_patches() const override
void read(std::istream &in)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
virtual std::vector< std::string > get_dataset_names() const override
std::vector< std::string > dataset_names
std::vector<::DataOutBase::Patch< dim, spacedim > > patches
ReferenceCell cell_type
std::uint64_t num_nodes
unsigned int dimension
std::string h5_sol_filename
void serialize(Archive &ar, const unsigned int)
double entry_time
std::string h5_mesh_filename
std::string get_xdmf_content(const unsigned int indent_level) const
void add_attribute(const std::string &attr_name, const unsigned int dimension)
std::uint64_t num_cells
std::map< std::string, unsigned int > attribute_dims
unsigned int space_dimension
#define DEAL_II_DEPRECATED
Definition: config.h:164
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:458
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:459
unsigned int cell_index
Definition: grid_tools.cc:1177
static ::ExceptionBase & ExcIncompatiblePatchLists()
static ::ExceptionBase & ExcIncompatibleDimensions(int arg1, int arg2, int arg3, int arg4)
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:578
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
static ::ExceptionBase & ExcInvalidCombinationOfDimensions(int arg1, int arg2)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:532
static ::ExceptionBase & ExcNotEnoughSpaceDimensionLabels()
static ::ExceptionBase & ExcIncompatibleDatasetNames()
static ::ExceptionBase & ExcTecplotAPIError()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:487
static ::ExceptionBase & ExcNoPatches()
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:509
void write_deal_II_intermediate_in_parallel(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const Deal_II_IntermediateFlags &flags, const std::string &filename, const MPI_Comm &comm, const CompressionLevel compression)
std::pair< unsigned int, unsigned int > determine_intermediate_format_dimensions(std::istream &input)
std::ostream & operator<<(std::ostream &out, const Patch< dim, spacedim > &patch)
void write_vtk(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
void write_vtu(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
void write_gnuplot(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const GnuplotFlags &flags, std::ostream &out)
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const VtkFlags &flags)
void write_filtered_data(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, DataOutFilter &filtered_data)
void write_ucd(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const UcdFlags &flags, std::ostream &out)
void write_vtu_header(std::ostream &out, const VtkFlags &flags)
void write_pvd_record(std::ostream &out, const std::vector< std::pair< double, std::string >> &times_and_names)
void write_deal_II_intermediate(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const Deal_II_IntermediateFlags &flags, std::ostream &out)
void write_dx(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const DXFlags &flags, std::ostream &out)
void write_eps(const std::vector< Patch< 2, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const EpsFlags &flags, std::ostream &out)
void write_vtu_footer(std::ostream &out)
void write_tecplot(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const TecplotFlags &flags, std::ostream &out)
OutputFormat parse_output_format(const std::string &format_name)
void write_vtu_main(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
void write_svg(const std::vector< Patch< 2, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const SvgFlags &flags, std::ostream &out)
std::istream & operator>>(std::istream &in, Patch< dim, spacedim > &patch)
std::string get_output_format_names()
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
void write_povray(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const PovrayFlags &flags, std::ostream &out)
std::string default_suffix(const OutputFormat output_format)
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm)
void write_gmv(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const GmvFlags &flags, std::ostream &out)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
static const types::blas_int one
static const unsigned int invalid_unsigned_int
Definition: types.h:206
void parse_parameters(const ParameterHandler &prm)
DXFlags(const bool write_neighbors=false, const bool int_binary=false, const bool coordinates_binary=false, const bool data_binary=false)
static void declare_parameters(ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
std::size_t memory_consumption() const
void parse_parameters(const ParameterHandler &prm)
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
bool operator()(const Point< 3 > &one, const Point< 3 > &two) const
static const unsigned int format_version
static void declare_parameters(ParameterHandler &prm)
static RgbValues default_color_function(const double value, const double min_value, const double max_value)
void parse_parameters(const ParameterHandler &prm)
ColorFunction color_function
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
EpsFlags(const unsigned int height_vector=0, const unsigned int color_vector=0, const SizeType size_type=width, const unsigned int size=300, const double line_width=0.5, const double azimut_angle=60, const double turn_angle=30, const double z_scaling=1.0, const bool draw_mesh=true, const bool draw_cells=true, const bool shade_cells=true, const ColorFunction color_function=&default_color_function)
unsigned int color_vector
static RgbValues reverse_grey_scale_color_function(const double value, const double min_value, const double max_value)
@ width
Scale to given width.
@ height
Scale to given height.
unsigned int height_vector
std::vector< std::string > space_dimension_labels
std::size_t memory_consumption() const
std::size_t memory_consumption() const
static void declare_parameters(ParameterHandler &prm)
void parse_parameters(const ParameterHandler &prm)
static const unsigned int n_subdivisions
static const ReferenceCell reference_cell
std::size_t memory_consumption() const
unsigned int patch_index
ReferenceCell reference_cell
Table< 2, float > data
static const unsigned int no_neighbor
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
bool operator==(const Patch &patch) const
static const unsigned int space_dim
unsigned int n_subdivisions
void swap(Patch< dim, spacedim > &other_patch)
std::array< unsigned int, GeometryInfo< dim >::faces_per_cell > neighbors
static void declare_parameters(ParameterHandler &prm)
PovrayFlags(const bool smooth=false, const bool bicubic_patch=false, const bool external_data=false)
void parse_parameters(const ParameterHandler &prm)
unsigned int height_vector
SvgFlags(const unsigned int height_vector=0, const int azimuth_angle=37, const int polar_angle=45, const unsigned int line_thickness=1, const bool margin=true, const bool draw_colorbar=true)
unsigned int line_thickness
std::size_t memory_consumption() const
TecplotFlags(const char *zone_name=nullptr, const double solution_time=-1.0)
void parse_parameters(const ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
UcdFlags(const bool write_preamble=false)
std::map< std::string, std::string > physical_units
static const DataOutBase::CompressionLevel default_compression
static const DataOutBase::CompressionLevel best_compression
VtkFlags(const double time=std::numeric_limits< double >::min(), const unsigned int cycle=std::numeric_limits< unsigned int >::min(), const bool print_date_and_time=true, const CompressionLevel compression_level=CompressionLevel::best_compression, const bool write_higher_order_cells=false, const std::map< std::string, std::string > &physical_units={})
static const DataOutBase::CompressionLevel best_speed
DataOutBase::CompressionLevel compression_level
static const DataOutBase::CompressionLevel no_compression
const MPI_Comm & comm