Reference documentation for deal.II version Git d76be9dd25 2020-05-29 08:52:26 -0400
\(\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 - 2020 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 
29 // To be able to serialize XDMFEntry
30 #include <boost/serialization/map.hpp>
31 
32 #include <limits>
33 #include <string>
34 #include <tuple>
35 #include <typeinfo>
36 #include <vector>
37 
38 // Only include the Tecplot API header if the appropriate files
39 // were detected by configure
40 #ifdef DEAL_II_HAVE_TECPLOT
41 # include <string.h>
42 
43 # include "TECIO.h"
44 #endif
45 
46 #include <ostream>
47 
49 
50 // Forward declarations
51 #ifndef DOXYGEN
52 class ParameterHandler;
53 class XDMFEntry;
54 #endif
55 
221 namespace DataOutBase
222 {
247  template <int dim, int spacedim = dim>
248  struct Patch
249  {
253  static const unsigned int space_dim = spacedim;
254 
268 
274  std::array<unsigned int, GeometryInfo<dim>::faces_per_cell> neighbors;
275 
280  unsigned int patch_index;
281 
287  unsigned int n_subdivisions;
288 
311 
325 
330  Patch();
331 
336  bool
337  operator==(const Patch &patch) const;
338 
345  std::size_t
346  memory_consumption() const;
347 
351  void
352  swap(Patch<dim, spacedim> &other_patch);
353 
357  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
358 
369  int,
370  int,
371  << "It is not possible to have a structural dimension of " << arg1
372  << " to be larger than the space dimension of the surrounding"
373  << " space " << arg2);
375  };
376 
377 
378 
396  template <int spacedim>
397  struct Patch<0, spacedim>
398  {
402  static const unsigned int space_dim = spacedim;
403 
413 
418  static unsigned int neighbors[1];
419 
424  unsigned int patch_index;
425 
435  static unsigned int n_subdivisions;
436 
458 
472 
477  Patch();
478 
483  bool
484  operator==(const Patch &patch) const;
485 
492  std::size_t
493  memory_consumption() const;
494 
498  void swap(Patch<0, spacedim> &other_patch);
499 
503  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
504 
515  int,
516  int,
517  << "It is not possible to have a structural dimension of " << arg1
518  << " to be larger than the space dimension of the surrounding"
519  << " space " << arg2);
521  };
522 
523 
535  template <typename FlagsType>
537  {
545  static void
546  declare_parameters(ParameterHandler &prm);
547 
555  void
556  parse_parameters(const ParameterHandler &prm);
557 
564  std::size_t
565  memory_consumption() const;
566  };
567 
568 
569  template <typename FlagsType>
570  void
572  {}
573 
574 
575  template <typename FlagsType>
576  void
578  {}
579 
580 
581  template <typename FlagsType>
582  std::size_t
584  {
585  return sizeof(FlagsType);
586  }
587 
588 
594  struct DXFlags : public OutputFlagsBase<DXFlags>
595  {
610 
615 
621 
625  DXFlags(const bool write_neighbors = false,
626  const bool int_binary = false,
627  const bool coordinates_binary = false,
628  const bool data_binary = false);
629 
634  static void
635  declare_parameters(ParameterHandler &prm);
636 
643  void
644  parse_parameters(const ParameterHandler &prm);
645  };
646 
652  struct UcdFlags : public OutputFlagsBase<UcdFlags>
653  {
664 
668  UcdFlags(const bool write_preamble = false);
669 
674  static void
675  declare_parameters(ParameterHandler &prm);
676 
683  void
684  parse_parameters(const ParameterHandler &prm);
685  };
686 
692  struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
693  {
698  GnuplotFlags();
699 
703  GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
704 
720  std::vector<std::string> space_dimension_labels;
721 
726  std::size_t
727  memory_consumption() const;
728 
733  DeclExceptionMsg(ExcNotEnoughSpaceDimensionLabels,
734  "There should be at least one space dimension per spatial "
735  "dimension (extras are ignored).");
736  };
737 
744  struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
745  {
751  bool smooth;
752 
759 
767 
771  PovrayFlags(const bool smooth = false,
772  const bool bicubic_patch = false,
773  const bool external_data = false);
774 
779  static void
780  declare_parameters(ParameterHandler &prm);
781 
788  void
789  parse_parameters(const ParameterHandler &prm);
790  };
791 
792 
799  struct EpsFlags : public OutputFlagsBase<EpsFlags>
800  {
807  unsigned int height_vector;
808 
813  unsigned int color_vector;
814 
820  enum SizeType
821  {
825  height
826  };
827 
832 
840  unsigned int size;
841 
845  double line_width;
846 
852  double azimut_angle;
853 
877  double turn_angle;
878 
889  double z_scaling;
890 
897  bool draw_mesh;
898 
916 
926 
930  struct RgbValues
931  {
932  float red;
933  float green;
934  float blue;
935 
940  bool
941  is_grey() const;
942  };
943 
951  using ColorFunction = RgbValues (*)(const double value,
952  const double min_value,
953  const double max_value);
954 
961 
962 
971  static RgbValues
972  default_color_function(const double value,
973  const double min_value,
974  const double max_value);
975 
981  static RgbValues
982  grey_scale_color_function(const double value,
983  const double min_value,
984  const double max_value);
985 
992  static RgbValues
993  reverse_grey_scale_color_function(const double value,
994  const double min_value,
995  const double max_value);
996 
1000  EpsFlags(const unsigned int height_vector = 0,
1001  const unsigned int color_vector = 0,
1002  const SizeType size_type = width,
1003  const unsigned int size = 300,
1004  const double line_width = 0.5,
1005  const double azimut_angle = 60,
1006  const double turn_angle = 30,
1007  const double z_scaling = 1.0,
1008  const bool draw_mesh = true,
1009  const bool draw_cells = true,
1010  const bool shade_cells = true,
1011  const ColorFunction color_function = &default_color_function);
1012 
1020  static void
1021  declare_parameters(ParameterHandler &prm);
1022 
1029  void
1030  parse_parameters(const ParameterHandler &prm);
1031  };
1032 
1039  struct GmvFlags : public OutputFlagsBase<GmvFlags>
1040  {};
1041 
1047  struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
1048  {
1057 
1062  const char *zone_name;
1063 
1070 
1078  TecplotFlags(const char * tecplot_binary_file_name = nullptr,
1079  const char * zone_name = nullptr,
1080  const double solution_time = -1.0);
1081 
1086  std::size_t
1087  memory_consumption() const;
1088  };
1089 
1095  struct VtkFlags : public OutputFlagsBase<VtkFlags>
1096  {
1107  double time;
1108 
1119  unsigned int cycle;
1120 
1128 
1134  {
1152  default_compression
1153  };
1154 
1160 
1179 
1183  VtkFlags(
1184  const double time = std::numeric_limits<double>::min(),
1185  const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
1186  const bool print_date_and_time = true,
1187  const ZlibCompressionLevel compression_level = best_compression,
1188  const bool write_higher_order_cells = false);
1189  };
1190 
1191 
1197  struct SvgFlags : public OutputFlagsBase<SvgFlags>
1198  {
1202  unsigned int height;
1203 
1208  unsigned int width;
1209 
1216  unsigned int height_vector;
1217 
1221  int azimuth_angle, polar_angle;
1222 
1223  unsigned int line_thickness;
1224 
1228  bool margin;
1229 
1234 
1238  SvgFlags(const unsigned int height_vector = 0,
1239  const int azimuth_angle = 37,
1240  const int polar_angle = 45,
1241  const unsigned int line_thickness = 1,
1242  const bool margin = true,
1243  const bool draw_colorbar = true);
1244  };
1245 
1246 
1254  : public OutputFlagsBase<Deal_II_IntermediateFlags>
1255  {
1262  static const unsigned int format_version;
1263  };
1264 
1271  {
1281 
1287 
1291  DataOutFilterFlags(const bool filter_duplicate_vertices = false,
1292  const bool xdmf_hdf5_output = false);
1293 
1298  static void
1299  declare_parameters(ParameterHandler &prm);
1300 
1307  void
1308  parse_parameters(const ParameterHandler &prm);
1309 
1314  std::size_t
1315  memory_consumption() const;
1316  };
1317 
1340  {
1341  public:
1345  DataOutFilter();
1346 
1352 
1358  template <int dim>
1359  void
1360  write_point(const unsigned int index, const Point<dim> &p);
1361 
1365  template <int dim>
1366  void
1367  write_cell(const unsigned int index,
1368  const unsigned int start,
1369  const unsigned int d1,
1370  const unsigned int d2,
1371  const unsigned int d3);
1372 
1379  void
1380  write_data_set(const std::string & name,
1381  const unsigned int dimension,
1382  const unsigned int set_num,
1383  const Table<2, double> &data_vectors);
1384 
1389  void
1390  fill_node_data(std::vector<double> &node_data) const;
1391 
1396  void
1397  fill_cell_data(const unsigned int local_node_offset,
1398  std::vector<unsigned int> &cell_data) const;
1399 
1403  std::string
1404  get_data_set_name(const unsigned int set_num) const;
1405 
1409  unsigned int
1410  get_data_set_dim(const unsigned int set_num) const;
1411 
1416  const double *
1417  get_data_set(const unsigned int set_num) const;
1418 
1423  unsigned int
1424  n_nodes() const;
1425 
1430  unsigned int
1431  n_cells() const;
1432 
1437  unsigned int
1438  n_data_sets() const;
1439 
1443  void
1444  flush_points();
1445 
1449  void
1450  flush_cells();
1451 
1452 
1453  private:
1457  struct Point3Comp
1458  {
1459  bool
1460  operator()(const Point<3> &one, const Point<3> &two) const
1461  {
1462  /*
1463  * The return statement below is an optimized version of the following
1464  * code:
1465  *
1466  * for (unsigned int d=0; d<3; ++d)
1467  * {
1468  * if (one(d) < two(d))
1469  * return true;
1470  * else if (one(d) > two(d))
1471  * return false;
1472  * }
1473  * return false;
1474  */
1475 
1476  return (one(0) < two(0) ||
1477  (!(two(0) < one(0)) &&
1478  (one(1) < two(1) || (!(two(1) < one(1)) && one(2) < two(2)))));
1479  }
1480  };
1481 
1482  using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1483 
1488 
1495  unsigned int node_dim;
1496 
1503  unsigned int vertices_per_cell;
1504 
1509 
1513  std::map<unsigned int, unsigned int> filtered_points;
1514 
1518  std::map<unsigned int, unsigned int> filtered_cells;
1519 
1523  std::vector<std::string> data_set_names;
1524 
1528  std::vector<unsigned int> data_set_dims;
1529 
1533  std::vector<std::vector<double>> data_sets;
1534 
1538  void
1539  internal_add_cell(const unsigned int cell_index,
1540  const unsigned int pt_index);
1541  };
1542 
1543 
1548  {
1553 
1558 
1563 
1568 
1573 
1578 
1583 
1588 
1593 
1601 
1606 
1611 
1616 
1621 
1626  };
1627 
1628 
1632  template <int dim, int spacedim>
1633  void
1634  write_dx(
1635  const std::vector<Patch<dim, spacedim>> &patches,
1636  const std::vector<std::string> & data_names,
1637  const std::vector<
1638  std::tuple<unsigned int,
1639  unsigned int,
1640  std::string,
1642  & nonscalar_data_ranges,
1643  const DXFlags &flags,
1644  std::ostream & out);
1645 
1690  template <int spacedim>
1691  void
1692  write_eps(
1693  const std::vector<Patch<2, spacedim>> &patches,
1694  const std::vector<std::string> & data_names,
1695  const std::vector<
1696  std::tuple<unsigned int,
1697  unsigned int,
1698  std::string,
1700  & nonscalar_data_ranges,
1701  const EpsFlags &flags,
1702  std::ostream & out);
1703 
1709  template <int dim, int spacedim>
1710  void
1711  write_eps(
1712  const std::vector<Patch<dim, spacedim>> &patches,
1713  const std::vector<std::string> & data_names,
1714  const std::vector<
1715  std::tuple<unsigned int,
1716  unsigned int,
1717  std::string,
1719  & nonscalar_data_ranges,
1720  const EpsFlags &flags,
1721  std::ostream & out);
1722 
1723 
1733  template <int dim, int spacedim>
1734  void
1735  write_gmv(
1736  const std::vector<Patch<dim, spacedim>> &patches,
1737  const std::vector<std::string> & data_names,
1738  const std::vector<
1739  std::tuple<unsigned int,
1740  unsigned int,
1741  std::string,
1743  & nonscalar_data_ranges,
1744  const GmvFlags &flags,
1745  std::ostream & out);
1746 
1803  template <int dim, int spacedim>
1804  void
1805  write_gnuplot(
1806  const std::vector<Patch<dim, spacedim>> &patches,
1807  const std::vector<std::string> & data_names,
1808  const std::vector<
1809  std::tuple<unsigned int,
1810  unsigned int,
1811  std::string,
1813  & nonscalar_data_ranges,
1814  const GnuplotFlags &flags,
1815  std::ostream & out);
1816 
1862  template <int dim, int spacedim>
1863  void
1864  write_povray(
1865  const std::vector<Patch<dim, spacedim>> &patches,
1866  const std::vector<std::string> & data_names,
1867  const std::vector<
1868  std::tuple<unsigned int,
1869  unsigned int,
1870  std::string,
1872  & nonscalar_data_ranges,
1873  const PovrayFlags &flags,
1874  std::ostream & out);
1875 
1882  template <int dim, int spacedim>
1883  void
1884  write_tecplot(
1885  const std::vector<Patch<dim, spacedim>> &patches,
1886  const std::vector<std::string> & data_names,
1887  const std::vector<
1888  std::tuple<unsigned int,
1889  unsigned int,
1890  std::string,
1892  & nonscalar_data_ranges,
1893  const TecplotFlags &flags,
1894  std::ostream & out);
1895 
1917  template <int dim, int spacedim>
1918  DEAL_II_DEPRECATED void
1920  const std::vector<Patch<dim, spacedim>> &patches,
1921  const std::vector<std::string> & data_names,
1922  const std::vector<
1923  std::tuple<unsigned int,
1924  unsigned int,
1925  std::string,
1927  & nonscalar_data_ranges,
1928  const TecplotFlags &flags,
1929  std::ostream & out);
1930 
1945  template <int dim, int spacedim>
1946  void
1947  write_ucd(
1948  const std::vector<Patch<dim, spacedim>> &patches,
1949  const std::vector<std::string> & data_names,
1950  const std::vector<
1951  std::tuple<unsigned int,
1952  unsigned int,
1953  std::string,
1955  & nonscalar_data_ranges,
1956  const UcdFlags &flags,
1957  std::ostream & out);
1958 
1978  template <int dim, int spacedim>
1979  void
1980  write_vtk(
1981  const std::vector<Patch<dim, spacedim>> &patches,
1982  const std::vector<std::string> & data_names,
1983  const std::vector<
1984  std::tuple<unsigned int,
1985  unsigned int,
1986  std::string,
1988  & nonscalar_data_ranges,
1989  const VtkFlags &flags,
1990  std::ostream & out);
1991 
1992 
2016  template <int dim, int spacedim>
2017  void
2018  write_vtu(
2019  const std::vector<Patch<dim, spacedim>> &patches,
2020  const std::vector<std::string> & data_names,
2021  const std::vector<
2022  std::tuple<unsigned int,
2023  unsigned int,
2024  std::string,
2026  & nonscalar_data_ranges,
2027  const VtkFlags &flags,
2028  std::ostream & out);
2029 
2035  void
2036  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2037 
2044  void
2045  write_vtu_footer(std::ostream &out);
2046 
2053  template <int dim, int spacedim>
2054  void
2056  const std::vector<Patch<dim, spacedim>> &patches,
2057  const std::vector<std::string> & data_names,
2058  const std::vector<
2059  std::tuple<unsigned int,
2060  unsigned int,
2061  std::string,
2063  & nonscalar_data_ranges,
2064  const VtkFlags &flags,
2065  std::ostream & out);
2066 
2108  void
2110  std::ostream & out,
2111  const std::vector<std::string> &piece_names,
2112  const std::vector<std::string> &data_names,
2113  const std::vector<
2114  std::tuple<unsigned int,
2115  unsigned int,
2116  std::string,
2118  &nonscalar_data_ranges);
2119 
2170  void
2172  std::ostream & out,
2173  const std::vector<std::pair<double, std::string>> &times_and_names);
2174 
2186  void
2187  write_visit_record(std::ostream & out,
2188  const std::vector<std::string> &piece_names);
2189 
2217  void
2218  write_visit_record(std::ostream & out,
2219  const std::vector<std::vector<std::string>> &piece_names);
2220 
2253  void
2255  std::ostream &out,
2256  const std::vector<std::pair<double, std::vector<std::string>>>
2257  &times_and_piece_names);
2258 
2279  template <int spacedim>
2280  void
2281  write_svg(
2282  const std::vector<Patch<2, spacedim>> &patches,
2283  const std::vector<std::string> & data_names,
2284  const std::vector<
2285  std::tuple<unsigned int,
2286  unsigned int,
2287  std::string,
2289  & nonscalar_data_ranges,
2290  const SvgFlags &flags,
2291  std::ostream & out);
2292 
2330  template <int dim, int spacedim>
2331  void
2333  const std::vector<Patch<dim, spacedim>> &patches,
2334  const std::vector<std::string> & data_names,
2335  const std::vector<
2336  std::tuple<unsigned int,
2337  unsigned int,
2338  std::string,
2340  & nonscalar_data_ranges,
2341  const Deal_II_IntermediateFlags &flags,
2342  std::ostream & out);
2343 
2348  template <int dim, int spacedim>
2349  void
2350  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2351  const DataOutFilter & data_filter,
2352  const std::string & filename,
2353  MPI_Comm comm);
2354 
2362  template <int dim, int spacedim>
2363  void
2364  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2365  const DataOutFilter & data_filter,
2366  const bool write_mesh_file,
2367  const std::string & mesh_filename,
2368  const std::string &solution_filename,
2369  MPI_Comm comm);
2370 
2377  template <int dim, int spacedim>
2378  void
2380  const std::vector<Patch<dim, spacedim>> &patches,
2381  const std::vector<std::string> & data_names,
2382  const std::vector<
2383  std::tuple<unsigned int,
2384  unsigned int,
2385  std::string,
2387  & nonscalar_data_ranges,
2388  DataOutFilter &filtered_data);
2389 
2401  std::pair<unsigned int, unsigned int>
2402  determine_intermediate_format_dimensions(std::istream &input);
2403 
2415  OutputFormat
2416  parse_output_format(const std::string &format_name);
2417 
2423  std::string
2425 
2446  std::string
2447  default_suffix(const OutputFormat output_format);
2448 
2458  int,
2459  int,
2460  << "The number of points in this data set is " << arg1
2461  << ", but we expected " << arg2
2462  << " in each space direction.");
2467  "You are trying to write graphical data into a file, but "
2468  "no data is available in the intermediate format that "
2469  "the DataOutBase functions require. Did you forget to "
2470  "call a function such as DataOut::build_patches()?");
2475  "The error code of one of the Tecplot functions was "
2476  "not zero as expected.");
2481  char *,
2482  << "There was an error opening Tecplot file " << arg1
2483  << " for output.");
2484 
2486 } // namespace DataOutBase
2487 
2488 
2489 
2597 template <int dim, int spacedim = dim>
2599 {
2600 public:
2604  DataOutInterface();
2605 
2610  virtual ~DataOutInterface() = default;
2611 
2616  void
2617  write_dx(std::ostream &out) const;
2618 
2623  void
2624  write_eps(std::ostream &out) const;
2625 
2630  void
2631  write_gmv(std::ostream &out) const;
2632 
2637  void
2638  write_gnuplot(std::ostream &out) const;
2639 
2644  void
2645  write_povray(std::ostream &out) const;
2646 
2651  void
2652  write_tecplot(std::ostream &out) const;
2653 
2662  void
2663  write_tecplot_binary(std::ostream &out) const;
2664 
2669  void
2670  write_ucd(std::ostream &out) const;
2671 
2683  void
2684  write_vtk(std::ostream &out) const;
2685 
2700  void
2701  write_vtu(std::ostream &out) const;
2702 
2711  void
2712  write_vtu_in_parallel(const std::string &filename, MPI_Comm comm) const;
2713 
2747  void
2748  write_pvtu_record(std::ostream & out,
2749  const std::vector<std::string> &piece_names) const;
2750 
2810  std::string
2811  write_vtu_with_pvtu_record(
2812  const std::string &directory,
2813  const std::string &filename_without_extension,
2814  const unsigned int counter,
2815  const MPI_Comm & mpi_communicator,
2816  const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2817  const unsigned int n_groups = 0) const;
2818 
2823  void
2824  write_svg(std::ostream &out) const;
2825 
2836  void
2837  write_deal_II_intermediate(std::ostream &out) const;
2838 
2844  XDMFEntry
2845  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2846  const std::string & h5_filename,
2847  const double cur_time,
2848  MPI_Comm comm) const;
2849 
2855  XDMFEntry
2856  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2857  const std::string & h5_mesh_filename,
2858  const std::string & h5_solution_filename,
2859  const double cur_time,
2860  MPI_Comm comm) const;
2861 
2886  void
2887  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2888  const std::string & filename,
2889  MPI_Comm comm) const;
2890 
2905  void
2907  const std::string & filename,
2908  MPI_Comm comm) const;
2909 
2917  void
2919  const bool write_mesh_file,
2920  const std::string & mesh_filename,
2921  const std::string & solution_filename,
2922  MPI_Comm comm) const;
2923 
2930  void
2931  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2932 
2933 
2942  void
2943  write(std::ostream & out,
2944  const DataOutBase::OutputFormat output_format =
2946 
2951  void
2952  set_default_format(const DataOutBase::OutputFormat default_format);
2953 
2954 
2959  template <typename FlagType>
2960  void
2961  set_flags(const FlagType &flags);
2962 
2963 
2971  std::string
2972  default_suffix(const DataOutBase::OutputFormat output_format =
2974 
2989  static void
2990  declare_parameters(ParameterHandler &prm);
2991 
2999  void
3000  parse_parameters(ParameterHandler &prm);
3001 
3007  std::size_t
3008  memory_consumption() const;
3009 
3010 protected:
3018  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
3019  get_patches() const = 0;
3020 
3025  virtual std::vector<std::string>
3026  get_dataset_names() const = 0;
3027 
3046  virtual std::vector<
3047  std::tuple<unsigned int,
3048  unsigned int,
3049  std::string,
3051  get_nonscalar_data_ranges() const;
3052 
3059  void
3060  validate_dataset_names() const;
3061 
3062 
3068  unsigned int default_subdivisions;
3069 
3070 private:
3077 
3083 
3089 
3095 
3101 
3107 
3113 
3119 
3125 
3131 
3137 };
3138 
3139 
3140 
3187 template <int dim, int spacedim = dim>
3188 class DataOutReader : public DataOutInterface<dim, spacedim>
3189 {
3190 public:
3196  void
3197  read(std::istream &in);
3198 
3220  void
3221  merge(const DataOutReader<dim, spacedim> &other);
3222 
3227  "You are trying to merge two sets of patches for which the "
3228  "declared names of the variables do not match.");
3233  "You are trying to merge two sets of patches for which the "
3234  "number of subdivisions or the number of vector components "
3235  "do not match.");
3239  DeclException4(ExcIncompatibleDimensions,
3240  int,
3241  int,
3242  int,
3243  int,
3244  << "Either the dimensions <" << arg1 << "> and <" << arg2
3245  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3246  << "> do not match!");
3247 
3248 protected:
3257  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3258  get_patches() const override;
3259 
3266  virtual std::vector<std::string>
3267  get_dataset_names() const override;
3268 
3287  virtual std::vector<
3288  std::tuple<unsigned int,
3289  unsigned int,
3290  std::string,
3292  get_nonscalar_data_ranges() const override;
3293 
3294 private:
3299  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3300  std::vector<std::string> dataset_names;
3301 
3306  std::vector<
3307  std::tuple<unsigned int,
3308  unsigned int,
3309  std::string,
3312 };
3313 
3314 
3315 
3324 {
3325 public:
3329  XDMFEntry();
3330 
3336  XDMFEntry(const std::string &filename,
3337  const double time,
3338  const unsigned int nodes,
3339  const unsigned int cells,
3340  const unsigned int dim);
3341 
3346  XDMFEntry(const std::string &mesh_filename,
3347  const std::string &solution_filename,
3348  const double time,
3349  const unsigned int nodes,
3350  const unsigned int cells,
3351  const unsigned int dim);
3352 
3356  XDMFEntry(const std::string &mesh_filename,
3357  const std::string &solution_filename,
3358  const double time,
3359  const unsigned int nodes,
3360  const unsigned int cells,
3361  const unsigned int dim,
3362  const unsigned int spacedim);
3363 
3367  void
3368  add_attribute(const std::string &attr_name, const unsigned int dimension);
3369 
3373  template <class Archive>
3374  void
3375  serialize(Archive &ar, const unsigned int /*version*/)
3376  {
3377  ar &valid &h5_sol_filename &h5_mesh_filename &entry_time &num_nodes
3378  &num_cells &dimension &space_dimension &attribute_dims;
3379  }
3380 
3385  std::string
3386  get_xdmf_content(const unsigned int indent_level) const;
3387 
3388 private:
3392  bool valid;
3393 
3397  std::string h5_sol_filename;
3398 
3402  std::string h5_mesh_filename;
3403 
3407  double entry_time;
3408 
3412  unsigned int num_nodes;
3413 
3417  unsigned int num_cells;
3418 
3422  unsigned int dimension;
3423 
3428  unsigned int space_dimension;
3429 
3433  std::map<std::string, unsigned int> attribute_dims;
3434 };
3435 
3436 
3437 
3438 /* -------------------- inline functions ------------------- */
3439 
3440 namespace DataOutBase
3441 {
3442  inline bool
3444  {
3445  return (red == green) && (red == blue);
3446  }
3447 
3448 
3449  /* -------------------- template functions ------------------- */
3450 
3459  template <int dim, int spacedim>
3460  std::ostream &
3461  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3462 
3463 
3464 
3473  template <int dim, int spacedim>
3474  std::istream &
3475  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3476 } // namespace DataOutBase
3477 
3478 
3480 
3481 #endif
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:191
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:541
void write_tecplot_binary(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)
std::size_t memory_consumption() const
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)
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)
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
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_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm)
const char * tecplot_binary_file_name
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:518
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:496
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:361
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:12573
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
static const unsigned int space_dim
DataOutBase::GnuplotFlags gnuplot_flags
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:360
T min(const T &t, const MPI_Comm &mpi_communicator)
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:587
unsigned int color_vector
static ::ExceptionBase & ExcInvalidCombinationOfDimensions(int arg1, int arg2)
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 unsigned int n_subdivisions
unsigned int line_thickness
static const bool value
std::string get_output_format_names()
#define DEAL_II_DEPRECATED
Definition: config.h:150
std::vector< std::string > dataset_names
Table< 2, float > data
DataOutBase::UcdFlags ucd_flags
unsigned int height_vector
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
DataOutBase::DXFlags dx_flags
static ::ExceptionBase & ExcTecplotAPIError()