Reference documentation for deal.II version Git 24041777c5 2021-12-02 20:43:25 -0700
\(\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 - 2021 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.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 
221 namespace DataOutBase
222 {
245  template <int dim, int spacedim = dim>
246  struct Patch
247  {
251  static const unsigned int space_dim = spacedim;
252 
266 
272  std::array<unsigned int, GeometryInfo<dim>::faces_per_cell> neighbors;
273 
278  unsigned int patch_index;
279 
285  unsigned int n_subdivisions;
286 
309 
323 
328 
333  Patch();
334 
339  bool
340  operator==(const Patch &patch) const;
341 
348  std::size_t
349  memory_consumption() const;
350 
354  void
355  swap(Patch<dim, spacedim> &other_patch);
356 
360  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
361 
372  int,
373  int,
374  << "It is not possible to have a structural dimension of " << arg1
375  << " to be larger than the space dimension of the surrounding"
376  << " space " << arg2);
378  };
379 
380 
381 
397  template <int spacedim>
398  struct Patch<0, spacedim>
399  {
403  static const unsigned int space_dim = spacedim;
404 
414 
419  static unsigned int neighbors[1];
420 
425  unsigned int patch_index;
426 
436  static const unsigned int n_subdivisions;
437 
459 
473 
480 
485  Patch();
486 
491  bool
492  operator==(const Patch &patch) const;
493 
500  std::size_t
501  memory_consumption() const;
502 
506  void
507  swap(Patch<0, spacedim> &other_patch);
508 
512  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
513 
524  int,
525  int,
526  << "It is not possible to have a structural dimension of " << arg1
527  << " to be larger than the space dimension of the surrounding"
528  << " space " << arg2);
530  };
531 
532 
544  template <typename FlagsType>
546  {
554  static void
555  declare_parameters(ParameterHandler &prm);
556 
564  void
565  parse_parameters(const ParameterHandler &prm);
566 
573  std::size_t
574  memory_consumption() const;
575  };
576 
577 
578  template <typename FlagsType>
579  void
581  {}
582 
583 
584  template <typename FlagsType>
585  void
587  {}
588 
589 
590  template <typename FlagsType>
591  std::size_t
593  {
594  return sizeof(FlagsType);
595  }
596 
597 
603  struct DXFlags : public OutputFlagsBase<DXFlags>
604  {
619 
624 
630 
634  DXFlags(const bool write_neighbors = false,
635  const bool int_binary = false,
636  const bool coordinates_binary = false,
637  const bool data_binary = false);
638 
643  static void
644  declare_parameters(ParameterHandler &prm);
645 
652  void
653  parse_parameters(const ParameterHandler &prm);
654  };
655 
661  struct UcdFlags : public OutputFlagsBase<UcdFlags>
662  {
673 
677  UcdFlags(const bool write_preamble = false);
678 
683  static void
684  declare_parameters(ParameterHandler &prm);
685 
692  void
693  parse_parameters(const ParameterHandler &prm);
694  };
695 
701  struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
702  {
707  GnuplotFlags();
708 
712  GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
713 
729  std::vector<std::string> space_dimension_labels;
730 
735  std::size_t
736  memory_consumption() const;
737 
742  DeclExceptionMsg(ExcNotEnoughSpaceDimensionLabels,
743  "There should be at least one space dimension per spatial "
744  "dimension (extras are ignored).");
745  };
746 
753  struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
754  {
760  bool smooth;
761 
768 
776 
780  PovrayFlags(const bool smooth = false,
781  const bool bicubic_patch = false,
782  const bool external_data = false);
783 
788  static void
789  declare_parameters(ParameterHandler &prm);
790 
797  void
798  parse_parameters(const ParameterHandler &prm);
799  };
800 
801 
808  struct EpsFlags : public OutputFlagsBase<EpsFlags>
809  {
816  unsigned int height_vector;
817 
822  unsigned int color_vector;
823 
829  enum SizeType
830  {
834  height
835  };
836 
841 
849  unsigned int size;
850 
854  double line_width;
855 
861  double azimut_angle;
862 
886  double turn_angle;
887 
898  double z_scaling;
899 
906  bool draw_mesh;
907 
925 
935 
939  struct RgbValues
940  {
941  float red;
942  float green;
943  float blue;
944 
949  bool
950  is_grey() const;
951  };
952 
960  using ColorFunction = RgbValues (*)(const double value,
961  const double min_value,
962  const double max_value);
963 
970 
971 
980  static RgbValues
981  default_color_function(const double value,
982  const double min_value,
983  const double max_value);
984 
990  static RgbValues
991  grey_scale_color_function(const double value,
992  const double min_value,
993  const double max_value);
994 
1001  static RgbValues
1002  reverse_grey_scale_color_function(const double value,
1003  const double min_value,
1004  const double max_value);
1005 
1009  EpsFlags(const unsigned int height_vector = 0,
1010  const unsigned int color_vector = 0,
1011  const SizeType size_type = width,
1012  const unsigned int size = 300,
1013  const double line_width = 0.5,
1014  const double azimut_angle = 60,
1015  const double turn_angle = 30,
1016  const double z_scaling = 1.0,
1017  const bool draw_mesh = true,
1018  const bool draw_cells = true,
1019  const bool shade_cells = true,
1020  const ColorFunction color_function = &default_color_function);
1021 
1029  static void
1030  declare_parameters(ParameterHandler &prm);
1031 
1038  void
1039  parse_parameters(const ParameterHandler &prm);
1040  };
1041 
1048  struct GmvFlags : public OutputFlagsBase<GmvFlags>
1049  {};
1050 
1056  struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
1057  {
1062  const char *zone_name;
1063 
1070 
1074  TecplotFlags(const char * zone_name = nullptr,
1075  const double solution_time = -1.0);
1076 
1081  std::size_t
1082  memory_consumption() const;
1083  };
1084 
1090  struct VtkFlags : public OutputFlagsBase<VtkFlags>
1091  {
1102  double time;
1103 
1114  unsigned int cycle;
1115 
1123 
1129  {
1147  default_compression
1148  };
1149 
1155 
1174 
1196  std::map<std::string, std::string> physical_units;
1197 
1202  VtkFlags(
1203  const double time = std::numeric_limits<double>::min(),
1204  const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
1205  const bool print_date_and_time = true,
1206  const ZlibCompressionLevel compression_level = best_compression,
1207  const bool write_higher_order_cells = false,
1208  const std::map<std::string, std::string> &physical_units = {});
1209  };
1210 
1211 
1217  struct SvgFlags : public OutputFlagsBase<SvgFlags>
1218  {
1222  unsigned int height;
1223 
1228  unsigned int width;
1229 
1236  unsigned int height_vector;
1237 
1241  int azimuth_angle, polar_angle;
1242 
1243  unsigned int line_thickness;
1244 
1248  bool margin;
1249 
1254 
1258  SvgFlags(const unsigned int height_vector = 0,
1259  const int azimuth_angle = 37,
1260  const int polar_angle = 45,
1261  const unsigned int line_thickness = 1,
1262  const bool margin = true,
1263  const bool draw_colorbar = true);
1264  };
1265 
1266 
1274  : public OutputFlagsBase<Deal_II_IntermediateFlags>
1275  {
1282  static const unsigned int format_version;
1283  };
1284 
1291  {
1301 
1307 
1311  DataOutFilterFlags(const bool filter_duplicate_vertices = false,
1312  const bool xdmf_hdf5_output = false);
1313 
1318  static void
1319  declare_parameters(ParameterHandler &prm);
1320 
1327  void
1328  parse_parameters(const ParameterHandler &prm);
1329 
1334  std::size_t
1335  memory_consumption() const;
1336  };
1337 
1360  {
1361  public:
1365  DataOutFilter();
1366 
1372 
1378  template <int dim>
1379  void
1380  write_point(const unsigned int index, const Point<dim> &p);
1381 
1385  template <int dim>
1386  void
1387  write_cell(const unsigned int index,
1388  const unsigned int start,
1389  const unsigned int d1,
1390  const unsigned int d2,
1391  const unsigned int d3);
1392 
1397  void
1398  write_cell_single(const unsigned int index,
1399  const unsigned int start,
1400  const unsigned int n_points,
1401  const ReferenceCell &reference_cell);
1402 
1409  void
1410  write_data_set(const std::string & name,
1411  const unsigned int dimension,
1412  const unsigned int set_num,
1413  const Table<2, double> &data_vectors);
1414 
1419  void
1420  fill_node_data(std::vector<double> &node_data) const;
1421 
1426  void
1427  fill_cell_data(const unsigned int local_node_offset,
1428  std::vector<unsigned int> &cell_data) const;
1429 
1433  std::string
1434  get_data_set_name(const unsigned int set_num) const;
1435 
1439  unsigned int
1440  get_data_set_dim(const unsigned int set_num) const;
1441 
1446  const double *
1447  get_data_set(const unsigned int set_num) const;
1448 
1453  unsigned int
1454  n_nodes() const;
1455 
1460  unsigned int
1461  n_cells() const;
1462 
1467  unsigned int
1468  n_data_sets() const;
1469 
1473  void
1474  flush_points();
1475 
1479  void
1480  flush_cells();
1481 
1482 
1483  private:
1487  struct Point3Comp
1488  {
1489  bool
1490  operator()(const Point<3> &one, const Point<3> &two) const
1491  {
1492  /*
1493  * The return statement below is an optimized version of the following
1494  * code:
1495  *
1496  * for (unsigned int d=0; d<3; ++d)
1497  * {
1498  * if (one(d) < two(d))
1499  * return true;
1500  * else if (one(d) > two(d))
1501  * return false;
1502  * }
1503  * return false;
1504  */
1505 
1506  return (one(0) < two(0) ||
1507  (!(two(0) < one(0)) &&
1508  (one(1) < two(1) || (!(two(1) < one(1)) && one(2) < two(2)))));
1509  }
1510  };
1511 
1512  using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1513 
1518 
1525  unsigned int node_dim;
1526 
1530  unsigned int num_cells;
1531 
1536 
1540  std::map<unsigned int, unsigned int> filtered_points;
1541 
1545  std::map<unsigned int, unsigned int> filtered_cells;
1546 
1550  std::vector<std::string> data_set_names;
1551 
1555  std::vector<unsigned int> data_set_dims;
1556 
1560  std::vector<std::vector<double>> data_sets;
1561 
1565  void
1566  internal_add_cell(const unsigned int cell_index,
1567  const unsigned int pt_index);
1568  };
1569 
1570 
1575  {
1580 
1585 
1590 
1595 
1600 
1605 
1610 
1615 
1620 
1628 
1633 
1638 
1643 
1648 
1653  };
1654 
1655 
1659  template <int dim, int spacedim>
1660  void
1661  write_dx(
1662  const std::vector<Patch<dim, spacedim>> &patches,
1663  const std::vector<std::string> & data_names,
1664  const std::vector<
1665  std::tuple<unsigned int,
1666  unsigned int,
1667  std::string,
1669  & nonscalar_data_ranges,
1670  const DXFlags &flags,
1671  std::ostream & out);
1672 
1717  template <int spacedim>
1718  void
1719  write_eps(
1720  const std::vector<Patch<2, spacedim>> &patches,
1721  const std::vector<std::string> & data_names,
1722  const std::vector<
1723  std::tuple<unsigned int,
1724  unsigned int,
1725  std::string,
1727  & nonscalar_data_ranges,
1728  const EpsFlags &flags,
1729  std::ostream & out);
1730 
1736  template <int dim, int spacedim>
1737  void
1738  write_eps(
1739  const std::vector<Patch<dim, spacedim>> &patches,
1740  const std::vector<std::string> & data_names,
1741  const std::vector<
1742  std::tuple<unsigned int,
1743  unsigned int,
1744  std::string,
1746  & nonscalar_data_ranges,
1747  const EpsFlags &flags,
1748  std::ostream & out);
1749 
1750 
1760  template <int dim, int spacedim>
1761  void
1762  write_gmv(
1763  const std::vector<Patch<dim, spacedim>> &patches,
1764  const std::vector<std::string> & data_names,
1765  const std::vector<
1766  std::tuple<unsigned int,
1767  unsigned int,
1768  std::string,
1770  & nonscalar_data_ranges,
1771  const GmvFlags &flags,
1772  std::ostream & out);
1773 
1829  template <int dim, int spacedim>
1830  void
1831  write_gnuplot(
1832  const std::vector<Patch<dim, spacedim>> &patches,
1833  const std::vector<std::string> & data_names,
1834  const std::vector<
1835  std::tuple<unsigned int,
1836  unsigned int,
1837  std::string,
1839  & nonscalar_data_ranges,
1840  const GnuplotFlags &flags,
1841  std::ostream & out);
1842 
1888  template <int dim, int spacedim>
1889  void
1890  write_povray(
1891  const std::vector<Patch<dim, spacedim>> &patches,
1892  const std::vector<std::string> & data_names,
1893  const std::vector<
1894  std::tuple<unsigned int,
1895  unsigned int,
1896  std::string,
1898  & nonscalar_data_ranges,
1899  const PovrayFlags &flags,
1900  std::ostream & out);
1901 
1908  template <int dim, int spacedim>
1909  void
1910  write_tecplot(
1911  const std::vector<Patch<dim, spacedim>> &patches,
1912  const std::vector<std::string> & data_names,
1913  const std::vector<
1914  std::tuple<unsigned int,
1915  unsigned int,
1916  std::string,
1918  & nonscalar_data_ranges,
1919  const TecplotFlags &flags,
1920  std::ostream & out);
1921 
1936  template <int dim, int spacedim>
1937  void
1938  write_ucd(
1939  const std::vector<Patch<dim, spacedim>> &patches,
1940  const std::vector<std::string> & data_names,
1941  const std::vector<
1942  std::tuple<unsigned int,
1943  unsigned int,
1944  std::string,
1946  & nonscalar_data_ranges,
1947  const UcdFlags &flags,
1948  std::ostream & out);
1949 
1969  template <int dim, int spacedim>
1970  void
1971  write_vtk(
1972  const std::vector<Patch<dim, spacedim>> &patches,
1973  const std::vector<std::string> & data_names,
1974  const std::vector<
1975  std::tuple<unsigned int,
1976  unsigned int,
1977  std::string,
1979  & nonscalar_data_ranges,
1980  const VtkFlags &flags,
1981  std::ostream & out);
1982 
1983 
2007  template <int dim, int spacedim>
2008  void
2009  write_vtu(
2010  const std::vector<Patch<dim, spacedim>> &patches,
2011  const std::vector<std::string> & data_names,
2012  const std::vector<
2013  std::tuple<unsigned int,
2014  unsigned int,
2015  std::string,
2017  & nonscalar_data_ranges,
2018  const VtkFlags &flags,
2019  std::ostream & out);
2020 
2026  void
2027  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2028 
2035  void
2036  write_vtu_footer(std::ostream &out);
2037 
2044  template <int dim, int spacedim>
2045  void
2047  const std::vector<Patch<dim, spacedim>> &patches,
2048  const std::vector<std::string> & data_names,
2049  const std::vector<
2050  std::tuple<unsigned int,
2051  unsigned int,
2052  std::string,
2054  & nonscalar_data_ranges,
2055  const VtkFlags &flags,
2056  std::ostream & out);
2057 
2099  void
2101  std::ostream & out,
2102  const std::vector<std::string> &piece_names,
2103  const std::vector<std::string> &data_names,
2104  const std::vector<
2105  std::tuple<unsigned int,
2106  unsigned int,
2107  std::string,
2109  & nonscalar_data_ranges,
2110  const VtkFlags &flags);
2111 
2160  void
2162  std::ostream & out,
2163  const std::vector<std::pair<double, std::string>> &times_and_names);
2164 
2176  void
2177  write_visit_record(std::ostream & out,
2178  const std::vector<std::string> &piece_names);
2179 
2207  void
2208  write_visit_record(std::ostream & out,
2209  const std::vector<std::vector<std::string>> &piece_names);
2210 
2243  void
2245  std::ostream &out,
2246  const std::vector<std::pair<double, std::vector<std::string>>>
2247  &times_and_piece_names);
2248 
2269  template <int spacedim>
2270  void
2271  write_svg(
2272  const std::vector<Patch<2, spacedim>> &patches,
2273  const std::vector<std::string> & data_names,
2274  const std::vector<
2275  std::tuple<unsigned int,
2276  unsigned int,
2277  std::string,
2279  & nonscalar_data_ranges,
2280  const SvgFlags &flags,
2281  std::ostream & out);
2282 
2320  template <int dim, int spacedim>
2321  void
2323  const std::vector<Patch<dim, spacedim>> &patches,
2324  const std::vector<std::string> & data_names,
2325  const std::vector<
2326  std::tuple<unsigned int,
2327  unsigned int,
2328  std::string,
2330  & nonscalar_data_ranges,
2331  const Deal_II_IntermediateFlags &flags,
2332  std::ostream & out);
2333 
2338  template <int dim, int spacedim>
2339  void
2340  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2341  const DataOutFilter & data_filter,
2342  const std::string & filename,
2343  const MPI_Comm & comm);
2344 
2352  template <int dim, int spacedim>
2353  void
2354  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2355  const DataOutFilter & data_filter,
2356  const bool write_mesh_file,
2357  const std::string & mesh_filename,
2358  const std::string &solution_filename,
2359  const MPI_Comm & comm);
2360 
2367  template <int dim, int spacedim>
2368  void
2370  const std::vector<Patch<dim, spacedim>> &patches,
2371  const std::vector<std::string> & data_names,
2372  const std::vector<
2373  std::tuple<unsigned int,
2374  unsigned int,
2375  std::string,
2377  & nonscalar_data_ranges,
2378  DataOutFilter &filtered_data);
2379 
2391  std::pair<unsigned int, unsigned int>
2392  determine_intermediate_format_dimensions(std::istream &input);
2393 
2405  OutputFormat
2406  parse_output_format(const std::string &format_name);
2407 
2413  std::string
2415 
2436  std::string
2437  default_suffix(const OutputFormat output_format);
2438 
2448  int,
2449  int,
2450  << "The number of points in this data set is " << arg1
2451  << ", but we expected " << arg2
2452  << " in each space direction.");
2457  "You are trying to write graphical data into a file, but "
2458  "no data is available in the intermediate format that "
2459  "the DataOutBase functions require. Did you forget to "
2460  "call a function such as DataOut::build_patches()?");
2465  "The error code of one of the Tecplot functions was "
2466  "not zero as expected.");
2471  char *,
2472  << "There was an error opening Tecplot file " << arg1
2473  << " for output.");
2474 
2476 } // namespace DataOutBase
2477 
2478 
2479 
2586 template <int dim, int spacedim = dim>
2588 {
2589 public:
2593  DataOutInterface();
2594 
2599  virtual ~DataOutInterface() = default;
2600 
2605  void
2606  write_dx(std::ostream &out) const;
2607 
2612  void
2613  write_eps(std::ostream &out) const;
2614 
2619  void
2620  write_gmv(std::ostream &out) const;
2621 
2626  void
2627  write_gnuplot(std::ostream &out) const;
2628 
2633  void
2634  write_povray(std::ostream &out) const;
2635 
2640  void
2641  write_tecplot(std::ostream &out) const;
2642 
2647  void
2648  write_ucd(std::ostream &out) const;
2649 
2661  void
2662  write_vtk(std::ostream &out) const;
2663 
2678  void
2679  write_vtu(std::ostream &out) const;
2680 
2689  void
2690  write_vtu_in_parallel(const std::string &filename,
2691  const MPI_Comm & comm) const;
2692 
2726  void
2727  write_pvtu_record(std::ostream & out,
2728  const std::vector<std::string> &piece_names) const;
2729 
2788  std::string
2789  write_vtu_with_pvtu_record(
2790  const std::string &directory,
2791  const std::string &filename_without_extension,
2792  const unsigned int counter,
2793  const MPI_Comm & mpi_communicator,
2794  const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2795  const unsigned int n_groups = 0) const;
2796 
2801  void
2802  write_svg(std::ostream &out) const;
2803 
2814  void
2815  write_deal_II_intermediate(std::ostream &out) const;
2816 
2822  XDMFEntry
2823  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2824  const std::string & h5_filename,
2825  const double cur_time,
2826  const MPI_Comm & comm) const;
2827 
2833  XDMFEntry
2834  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2835  const std::string & h5_mesh_filename,
2836  const std::string & h5_solution_filename,
2837  const double cur_time,
2838  const MPI_Comm & comm) const;
2839 
2864  void
2865  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2866  const std::string & filename,
2867  const MPI_Comm & comm) const;
2868 
2883  void
2885  const std::string & filename,
2886  const MPI_Comm & comm) const;
2887 
2895  void
2897  const bool write_mesh_file,
2898  const std::string & mesh_filename,
2899  const std::string & solution_filename,
2900  const MPI_Comm & comm) const;
2901 
2908  void
2909  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2910 
2911 
2920  void
2921  write(std::ostream & out,
2922  const DataOutBase::OutputFormat output_format =
2924 
2929  void
2930  set_default_format(const DataOutBase::OutputFormat default_format);
2931 
2932 
2937  template <typename FlagType>
2938  void
2939  set_flags(const FlagType &flags);
2940 
2941 
2949  std::string
2950  default_suffix(const DataOutBase::OutputFormat output_format =
2952 
2967  static void
2968  declare_parameters(ParameterHandler &prm);
2969 
2977  void
2978  parse_parameters(ParameterHandler &prm);
2979 
2985  std::size_t
2986  memory_consumption() const;
2987 
2988 protected:
2996  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
2997  get_patches() const = 0;
2998 
3003  virtual std::vector<std::string>
3004  get_dataset_names() const = 0;
3005 
3024  virtual std::vector<
3025  std::tuple<unsigned int,
3026  unsigned int,
3027  std::string,
3029  get_nonscalar_data_ranges() const;
3030 
3037  void
3038  validate_dataset_names() const;
3039 
3040 
3046  unsigned int default_subdivisions;
3047 
3048 private:
3055 
3061 
3067 
3073 
3079 
3085 
3091 
3097 
3103 
3109 
3115 };
3116 
3117 
3118 
3164 template <int dim, int spacedim = dim>
3165 class DataOutReader : public DataOutInterface<dim, spacedim>
3166 {
3167 public:
3173  void
3174  read(std::istream &in);
3175 
3197  void
3198  merge(const DataOutReader<dim, spacedim> &other);
3199 
3204  "You are trying to merge two sets of patches for which the "
3205  "declared names of the variables do not match.");
3210  "You are trying to merge two sets of patches for which the "
3211  "number of subdivisions or the number of vector components "
3212  "do not match.");
3216  DeclException4(ExcIncompatibleDimensions,
3217  int,
3218  int,
3219  int,
3220  int,
3221  << "Either the dimensions <" << arg1 << "> and <" << arg2
3222  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3223  << "> do not match!");
3224 
3225 protected:
3234  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3235  get_patches() const override;
3236 
3243  virtual std::vector<std::string>
3244  get_dataset_names() const override;
3245 
3264  virtual std::vector<
3265  std::tuple<unsigned int,
3266  unsigned int,
3267  std::string,
3269  get_nonscalar_data_ranges() const override;
3270 
3271 private:
3276  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3277  std::vector<std::string> dataset_names;
3278 
3283  std::vector<
3284  std::tuple<unsigned int,
3285  unsigned int,
3286  std::string,
3289 };
3290 
3291 
3292 
3301 {
3302 public:
3306  XDMFEntry();
3307 
3313  XDMFEntry(const std::string &filename,
3314  const double time,
3315  const unsigned int nodes,
3316  const unsigned int cells,
3317  const unsigned int dim);
3318 
3323  XDMFEntry(const std::string &mesh_filename,
3324  const std::string &solution_filename,
3325  const double time,
3326  const unsigned int nodes,
3327  const unsigned int cells,
3328  const unsigned int dim);
3329 
3333  XDMFEntry(const std::string &mesh_filename,
3334  const std::string &solution_filename,
3335  const double time,
3336  const unsigned int nodes,
3337  const unsigned int cells,
3338  const unsigned int dim,
3339  const unsigned int spacedim);
3340 
3344  void
3345  add_attribute(const std::string &attr_name, const unsigned int dimension);
3346 
3352  template <class Archive>
3353  void
3354  serialize(Archive &ar, const unsigned int /*version*/)
3355  {
3356  ar &valid &h5_sol_filename &h5_mesh_filename &entry_time &num_nodes
3357  &num_cells &dimension &space_dimension &attribute_dims;
3358  }
3359 
3368  std::string
3369  get_xdmf_content(const unsigned int indent_level) const;
3370 
3375  std::string
3376  get_xdmf_content(const unsigned int indent_level,
3377  const ReferenceCell &reference_cell) const;
3378 
3379 private:
3383  bool valid;
3384 
3388  std::string h5_sol_filename;
3389 
3393  std::string h5_mesh_filename;
3394 
3398  double entry_time;
3399 
3403  unsigned int num_nodes;
3404 
3408  unsigned int num_cells;
3409 
3413  unsigned int dimension;
3414 
3419  unsigned int space_dimension;
3420 
3424  std::map<std::string, unsigned int> attribute_dims;
3425 };
3426 
3427 
3428 
3429 /* -------------------- inline functions ------------------- */
3430 
3431 namespace DataOutBase
3432 {
3433  inline bool
3435  {
3436  return (red == green) && (red == blue);
3437  }
3438 
3439 
3440  /* -------------------- template functions ------------------- */
3441 
3448  template <int dim, int spacedim>
3449  std::ostream &
3450  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3451 
3452 
3453 
3460  template <int dim, int spacedim>
3461  std::istream &
3462  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3463 } // namespace DataOutBase
3464 
3465 
3467 
3468 #endif
ReferenceCell reference_cell
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)
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static const unsigned int invalid_unsigned_int
Definition: types.h:196
unsigned int space_dimension
static ::ExceptionBase & ExcIncompatiblePatchLists()
unsigned int height_vector
void write_vtu_footer(std::ostream &out)
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)
static void declare_parameters(ParameterHandler &prm)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:532
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm)
std::size_t memory_consumption() const
std::map< unsigned int, unsigned int > filtered_cells
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
unsigned int num_cells
std::pair< unsigned int, unsigned int > determine_intermediate_format_dimensions(std::istream &input)
bool operator()(const Point< 3 > &one, const Point< 3 > &two) const
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_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 swap(Patch< dim, spacedim > &other_patch)
void write_vtu_header(std::ostream &out, const VtkFlags &flags)
static const ReferenceCell reference_cell
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > nonscalar_data_ranges
void write_pvd_record(std::ostream &out, const std::vector< std::pair< double, std::string >> &times_and_names)
double entry_time
ZlibCompressionLevel compression_level
std::map< std::string, std::string > physical_units
static const types::blas_int one
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)
unsigned int default_subdivisions
std::vector< unsigned int > data_set_dims
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
std::vector< std::vector< double > > data_sets
std::map< std::string, unsigned int > attribute_dims
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)
std::multimap< Point< 3 >, unsigned int, Point3Comp > Map3DPoint
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)
static ::ExceptionBase & ExcNoPatches()
DataOutBase::PovrayFlags povray_flags
static ::ExceptionBase & ExcIncompatibleDatasetNames()
DataOutBase::DataOutFilterFlags flags
std::string default_suffix(const OutputFormat output_format)
unsigned int patch_index
std::istream & operator>>(std::istream &in, Patch< dim, spacedim > &patch)
std::vector< std::string > space_dimension_labels
void serialize(Archive &ar, const unsigned int)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:509
std::vector< std::string > data_set_names
void parse_parameters(const ParameterHandler &prm)
DataOutBase::Deal_II_IntermediateFlags deal_II_intermediate_flags
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:487
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:404
std::vector<::DataOutBase::Patch< dim, spacedim > > patches
OutputFormat parse_output_format(const std::string &format_name)
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)
ColorFunction color_function
constexpr TableIndices< 2 > merge(const TableIndices< 2 > &previous_indices, const unsigned int new_index, const unsigned int position)
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)
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)
unsigned int n_subdivisions
DataOutBase::TecplotFlags tecplot_flags
Scale to given width.
DataOutBase::SvgFlags svg_flags
unsigned int dimension
std::string h5_sol_filename
std::string h5_mesh_filename
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
Definition: tria.cc:13721
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
bool operator==(const Patch &patch) const
static const unsigned int no_neighbor
DataOutBase::GmvFlags gmv_flags
DataOutBase::VtkFlags vtk_flags
static const unsigned int format_version
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)
static const unsigned int space_dim
DataOutBase::GnuplotFlags gnuplot_flags
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:403
unsigned int num_nodes
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)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:578
unsigned int color_vector
static ::ExceptionBase & ExcInvalidCombinationOfDimensions(int arg1, int arg2)
const MPI_Comm & comm
DataOutBase::OutputFormat default_fmt
std::array< unsigned int, GeometryInfo< dim >::faces_per_cell > neighbors
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)
Iterator points to a valid object.
DataOutBase::EpsFlags eps_flags
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)
std::size_t memory_consumption() const
std::map< unsigned int, unsigned int > filtered_points
static const unsigned int n_subdivisions
unsigned int line_thickness
std::string get_output_format_names()
#define DEAL_II_DEPRECATED
Definition: config.h:160
std::vector< std::string > dataset_names
Table< 2, float > data
DataOutBase::UcdFlags ucd_flags
unsigned int cell_index
Definition: grid_tools.cc:1092
unsigned int height_vector
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
DataOutBase::DXFlags dx_flags
static ::ExceptionBase & ExcTecplotAPIError()