Reference documentation for deal.II version Git 20c3758ecc 2020-10-30 06:09:42 +0100
\(\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 
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 unsigned int n_subdivisions;
437 
459 
473 
478 
483  Patch();
484 
489  bool
490  operator==(const Patch &patch) const;
491 
498  std::size_t
499  memory_consumption() const;
500 
504  void swap(Patch<0, spacedim> &other_patch);
505 
509  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
510 
521  int,
522  int,
523  << "It is not possible to have a structural dimension of " << arg1
524  << " to be larger than the space dimension of the surrounding"
525  << " space " << arg2);
527  };
528 
529 
541  template <typename FlagsType>
543  {
551  static void
552  declare_parameters(ParameterHandler &prm);
553 
561  void
562  parse_parameters(const ParameterHandler &prm);
563 
570  std::size_t
571  memory_consumption() const;
572  };
573 
574 
575  template <typename FlagsType>
576  void
578  {}
579 
580 
581  template <typename FlagsType>
582  void
584  {}
585 
586 
587  template <typename FlagsType>
588  std::size_t
590  {
591  return sizeof(FlagsType);
592  }
593 
594 
600  struct DXFlags : public OutputFlagsBase<DXFlags>
601  {
616 
621 
627 
631  DXFlags(const bool write_neighbors = false,
632  const bool int_binary = false,
633  const bool coordinates_binary = false,
634  const bool data_binary = false);
635 
640  static void
641  declare_parameters(ParameterHandler &prm);
642 
649  void
650  parse_parameters(const ParameterHandler &prm);
651  };
652 
658  struct UcdFlags : public OutputFlagsBase<UcdFlags>
659  {
670 
674  UcdFlags(const bool write_preamble = false);
675 
680  static void
681  declare_parameters(ParameterHandler &prm);
682 
689  void
690  parse_parameters(const ParameterHandler &prm);
691  };
692 
698  struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
699  {
704  GnuplotFlags();
705 
709  GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
710 
726  std::vector<std::string> space_dimension_labels;
727 
732  std::size_t
733  memory_consumption() const;
734 
739  DeclExceptionMsg(ExcNotEnoughSpaceDimensionLabels,
740  "There should be at least one space dimension per spatial "
741  "dimension (extras are ignored).");
742  };
743 
750  struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
751  {
757  bool smooth;
758 
765 
773 
777  PovrayFlags(const bool smooth = false,
778  const bool bicubic_patch = false,
779  const bool external_data = false);
780 
785  static void
786  declare_parameters(ParameterHandler &prm);
787 
794  void
795  parse_parameters(const ParameterHandler &prm);
796  };
797 
798 
805  struct EpsFlags : public OutputFlagsBase<EpsFlags>
806  {
813  unsigned int height_vector;
814 
819  unsigned int color_vector;
820 
826  enum SizeType
827  {
831  height
832  };
833 
838 
846  unsigned int size;
847 
851  double line_width;
852 
858  double azimut_angle;
859 
883  double turn_angle;
884 
895  double z_scaling;
896 
903  bool draw_mesh;
904 
922 
932 
936  struct RgbValues
937  {
938  float red;
939  float green;
940  float blue;
941 
946  bool
947  is_grey() const;
948  };
949 
957  using ColorFunction = RgbValues (*)(const double value,
958  const double min_value,
959  const double max_value);
960 
967 
968 
977  static RgbValues
978  default_color_function(const double value,
979  const double min_value,
980  const double max_value);
981 
987  static RgbValues
988  grey_scale_color_function(const double value,
989  const double min_value,
990  const double max_value);
991 
998  static RgbValues
999  reverse_grey_scale_color_function(const double value,
1000  const double min_value,
1001  const double max_value);
1002 
1006  EpsFlags(const unsigned int height_vector = 0,
1007  const unsigned int color_vector = 0,
1008  const SizeType size_type = width,
1009  const unsigned int size = 300,
1010  const double line_width = 0.5,
1011  const double azimut_angle = 60,
1012  const double turn_angle = 30,
1013  const double z_scaling = 1.0,
1014  const bool draw_mesh = true,
1015  const bool draw_cells = true,
1016  const bool shade_cells = true,
1017  const ColorFunction color_function = &default_color_function);
1018 
1026  static void
1027  declare_parameters(ParameterHandler &prm);
1028 
1035  void
1036  parse_parameters(const ParameterHandler &prm);
1037  };
1038 
1045  struct GmvFlags : public OutputFlagsBase<GmvFlags>
1046  {};
1047 
1053  struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
1054  {
1059  const char *zone_name;
1060 
1067 
1071  TecplotFlags(const char * zone_name = nullptr,
1072  const double solution_time = -1.0);
1073 
1078  std::size_t
1079  memory_consumption() const;
1080  };
1081 
1087  struct VtkFlags : public OutputFlagsBase<VtkFlags>
1088  {
1099  double time;
1100 
1111  unsigned int cycle;
1112 
1120 
1126  {
1144  default_compression
1145  };
1146 
1152 
1171 
1175  VtkFlags(
1176  const double time = std::numeric_limits<double>::min(),
1177  const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
1178  const bool print_date_and_time = true,
1179  const ZlibCompressionLevel compression_level = best_compression,
1180  const bool write_higher_order_cells = false);
1181  };
1182 
1183 
1189  struct SvgFlags : public OutputFlagsBase<SvgFlags>
1190  {
1194  unsigned int height;
1195 
1200  unsigned int width;
1201 
1208  unsigned int height_vector;
1209 
1213  int azimuth_angle, polar_angle;
1214 
1215  unsigned int line_thickness;
1216 
1220  bool margin;
1221 
1226 
1230  SvgFlags(const unsigned int height_vector = 0,
1231  const int azimuth_angle = 37,
1232  const int polar_angle = 45,
1233  const unsigned int line_thickness = 1,
1234  const bool margin = true,
1235  const bool draw_colorbar = true);
1236  };
1237 
1238 
1246  : public OutputFlagsBase<Deal_II_IntermediateFlags>
1247  {
1254  static const unsigned int format_version;
1255  };
1256 
1263  {
1273 
1279 
1283  DataOutFilterFlags(const bool filter_duplicate_vertices = false,
1284  const bool xdmf_hdf5_output = false);
1285 
1290  static void
1291  declare_parameters(ParameterHandler &prm);
1292 
1299  void
1300  parse_parameters(const ParameterHandler &prm);
1301 
1306  std::size_t
1307  memory_consumption() const;
1308  };
1309 
1332  {
1333  public:
1337  DataOutFilter();
1338 
1344 
1350  template <int dim>
1351  void
1352  write_point(const unsigned int index, const Point<dim> &p);
1353 
1357  template <int dim>
1358  void
1359  write_cell(const unsigned int index,
1360  const unsigned int start,
1361  const unsigned int d1,
1362  const unsigned int d2,
1363  const unsigned int d3);
1364 
1369  void
1370  write_cell_single(const unsigned int index,
1371  const unsigned int start,
1372  const unsigned int n_points);
1373 
1380  void
1381  write_data_set(const std::string & name,
1382  const unsigned int dimension,
1383  const unsigned int set_num,
1384  const Table<2, double> &data_vectors);
1385 
1390  void
1391  fill_node_data(std::vector<double> &node_data) const;
1392 
1397  void
1398  fill_cell_data(const unsigned int local_node_offset,
1399  std::vector<unsigned int> &cell_data) const;
1400 
1404  std::string
1405  get_data_set_name(const unsigned int set_num) const;
1406 
1410  unsigned int
1411  get_data_set_dim(const unsigned int set_num) const;
1412 
1417  const double *
1418  get_data_set(const unsigned int set_num) const;
1419 
1424  unsigned int
1425  n_nodes() const;
1426 
1431  unsigned int
1432  n_cells() const;
1433 
1438  unsigned int
1439  n_data_sets() const;
1440 
1444  void
1445  flush_points();
1446 
1450  void
1451  flush_cells();
1452 
1453 
1454  private:
1458  struct Point3Comp
1459  {
1460  bool
1461  operator()(const Point<3> &one, const Point<3> &two) const
1462  {
1463  /*
1464  * The return statement below is an optimized version of the following
1465  * code:
1466  *
1467  * for (unsigned int d=0; d<3; ++d)
1468  * {
1469  * if (one(d) < two(d))
1470  * return true;
1471  * else if (one(d) > two(d))
1472  * return false;
1473  * }
1474  * return false;
1475  */
1476 
1477  return (one(0) < two(0) ||
1478  (!(two(0) < one(0)) &&
1479  (one(1) < two(1) || (!(two(1) < one(1)) && one(2) < two(2)))));
1480  }
1481  };
1482 
1483  using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1484 
1489 
1496  unsigned int node_dim;
1497 
1501  unsigned int num_cells;
1502 
1507 
1511  std::map<unsigned int, unsigned int> filtered_points;
1512 
1516  std::map<unsigned int, unsigned int> filtered_cells;
1517 
1521  std::vector<std::string> data_set_names;
1522 
1526  std::vector<unsigned int> data_set_dims;
1527 
1531  std::vector<std::vector<double>> data_sets;
1532 
1536  void
1537  internal_add_cell(const unsigned int cell_index,
1538  const unsigned int pt_index);
1539  };
1540 
1541 
1546  {
1551 
1556 
1561 
1566 
1571 
1576 
1581 
1586 
1591 
1599 
1604 
1609 
1614 
1619 
1624  };
1625 
1626 
1630  template <int dim, int spacedim>
1631  void
1632  write_dx(
1633  const std::vector<Patch<dim, spacedim>> &patches,
1634  const std::vector<std::string> & data_names,
1635  const std::vector<
1636  std::tuple<unsigned int,
1637  unsigned int,
1638  std::string,
1640  & nonscalar_data_ranges,
1641  const DXFlags &flags,
1642  std::ostream & out);
1643 
1688  template <int spacedim>
1689  void
1690  write_eps(
1691  const std::vector<Patch<2, spacedim>> &patches,
1692  const std::vector<std::string> & data_names,
1693  const std::vector<
1694  std::tuple<unsigned int,
1695  unsigned int,
1696  std::string,
1698  & nonscalar_data_ranges,
1699  const EpsFlags &flags,
1700  std::ostream & out);
1701 
1707  template <int dim, int spacedim>
1708  void
1709  write_eps(
1710  const std::vector<Patch<dim, spacedim>> &patches,
1711  const std::vector<std::string> & data_names,
1712  const std::vector<
1713  std::tuple<unsigned int,
1714  unsigned int,
1715  std::string,
1717  & nonscalar_data_ranges,
1718  const EpsFlags &flags,
1719  std::ostream & out);
1720 
1721 
1731  template <int dim, int spacedim>
1732  void
1733  write_gmv(
1734  const std::vector<Patch<dim, spacedim>> &patches,
1735  const std::vector<std::string> & data_names,
1736  const std::vector<
1737  std::tuple<unsigned int,
1738  unsigned int,
1739  std::string,
1741  & nonscalar_data_ranges,
1742  const GmvFlags &flags,
1743  std::ostream & out);
1744 
1801  template <int dim, int spacedim>
1802  void
1803  write_gnuplot(
1804  const std::vector<Patch<dim, spacedim>> &patches,
1805  const std::vector<std::string> & data_names,
1806  const std::vector<
1807  std::tuple<unsigned int,
1808  unsigned int,
1809  std::string,
1811  & nonscalar_data_ranges,
1812  const GnuplotFlags &flags,
1813  std::ostream & out);
1814 
1860  template <int dim, int spacedim>
1861  void
1862  write_povray(
1863  const std::vector<Patch<dim, spacedim>> &patches,
1864  const std::vector<std::string> & data_names,
1865  const std::vector<
1866  std::tuple<unsigned int,
1867  unsigned int,
1868  std::string,
1870  & nonscalar_data_ranges,
1871  const PovrayFlags &flags,
1872  std::ostream & out);
1873 
1880  template <int dim, int spacedim>
1881  void
1882  write_tecplot(
1883  const std::vector<Patch<dim, spacedim>> &patches,
1884  const std::vector<std::string> & data_names,
1885  const std::vector<
1886  std::tuple<unsigned int,
1887  unsigned int,
1888  std::string,
1890  & nonscalar_data_ranges,
1891  const TecplotFlags &flags,
1892  std::ostream & out);
1893 
1908  template <int dim, int spacedim>
1909  void
1910  write_ucd(
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 UcdFlags &flags,
1920  std::ostream & out);
1921 
1941  template <int dim, int spacedim>
1942  void
1943  write_vtk(
1944  const std::vector<Patch<dim, spacedim>> &patches,
1945  const std::vector<std::string> & data_names,
1946  const std::vector<
1947  std::tuple<unsigned int,
1948  unsigned int,
1949  std::string,
1951  & nonscalar_data_ranges,
1952  const VtkFlags &flags,
1953  std::ostream & out);
1954 
1955 
1979  template <int dim, int spacedim>
1980  void
1981  write_vtu(
1982  const std::vector<Patch<dim, spacedim>> &patches,
1983  const std::vector<std::string> & data_names,
1984  const std::vector<
1985  std::tuple<unsigned int,
1986  unsigned int,
1987  std::string,
1989  & nonscalar_data_ranges,
1990  const VtkFlags &flags,
1991  std::ostream & out);
1992 
1998  void
1999  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2000 
2007  void
2008  write_vtu_footer(std::ostream &out);
2009 
2016  template <int dim, int spacedim>
2017  void
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 
2071  void
2073  std::ostream & out,
2074  const std::vector<std::string> &piece_names,
2075  const std::vector<std::string> &data_names,
2076  const std::vector<
2077  std::tuple<unsigned int,
2078  unsigned int,
2079  std::string,
2081  &nonscalar_data_ranges);
2082 
2131  void
2133  std::ostream & out,
2134  const std::vector<std::pair<double, std::string>> &times_and_names);
2135 
2147  void
2148  write_visit_record(std::ostream & out,
2149  const std::vector<std::string> &piece_names);
2150 
2178  void
2179  write_visit_record(std::ostream & out,
2180  const std::vector<std::vector<std::string>> &piece_names);
2181 
2214  void
2216  std::ostream &out,
2217  const std::vector<std::pair<double, std::vector<std::string>>>
2218  &times_and_piece_names);
2219 
2240  template <int spacedim>
2241  void
2242  write_svg(
2243  const std::vector<Patch<2, spacedim>> &patches,
2244  const std::vector<std::string> & data_names,
2245  const std::vector<
2246  std::tuple<unsigned int,
2247  unsigned int,
2248  std::string,
2250  & nonscalar_data_ranges,
2251  const SvgFlags &flags,
2252  std::ostream & out);
2253 
2291  template <int dim, int spacedim>
2292  void
2294  const std::vector<Patch<dim, spacedim>> &patches,
2295  const std::vector<std::string> & data_names,
2296  const std::vector<
2297  std::tuple<unsigned int,
2298  unsigned int,
2299  std::string,
2301  & nonscalar_data_ranges,
2302  const Deal_II_IntermediateFlags &flags,
2303  std::ostream & out);
2304 
2309  template <int dim, int spacedim>
2310  void
2311  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2312  const DataOutFilter & data_filter,
2313  const std::string & filename,
2314  MPI_Comm comm);
2315 
2323  template <int dim, int spacedim>
2324  void
2325  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2326  const DataOutFilter & data_filter,
2327  const bool write_mesh_file,
2328  const std::string & mesh_filename,
2329  const std::string &solution_filename,
2330  MPI_Comm comm);
2331 
2338  template <int dim, int spacedim>
2339  void
2341  const std::vector<Patch<dim, spacedim>> &patches,
2342  const std::vector<std::string> & data_names,
2343  const std::vector<
2344  std::tuple<unsigned int,
2345  unsigned int,
2346  std::string,
2348  & nonscalar_data_ranges,
2349  DataOutFilter &filtered_data);
2350 
2362  std::pair<unsigned int, unsigned int>
2363  determine_intermediate_format_dimensions(std::istream &input);
2364 
2376  OutputFormat
2377  parse_output_format(const std::string &format_name);
2378 
2384  std::string
2386 
2407  std::string
2408  default_suffix(const OutputFormat output_format);
2409 
2419  int,
2420  int,
2421  << "The number of points in this data set is " << arg1
2422  << ", but we expected " << arg2
2423  << " in each space direction.");
2428  "You are trying to write graphical data into a file, but "
2429  "no data is available in the intermediate format that "
2430  "the DataOutBase functions require. Did you forget to "
2431  "call a function such as DataOut::build_patches()?");
2436  "The error code of one of the Tecplot functions was "
2437  "not zero as expected.");
2442  char *,
2443  << "There was an error opening Tecplot file " << arg1
2444  << " for output.");
2445 
2447 } // namespace DataOutBase
2448 
2449 
2450 
2557 template <int dim, int spacedim = dim>
2559 {
2560 public:
2564  DataOutInterface();
2565 
2570  virtual ~DataOutInterface() = default;
2571 
2576  void
2577  write_dx(std::ostream &out) const;
2578 
2583  void
2584  write_eps(std::ostream &out) const;
2585 
2590  void
2591  write_gmv(std::ostream &out) const;
2592 
2597  void
2598  write_gnuplot(std::ostream &out) const;
2599 
2604  void
2605  write_povray(std::ostream &out) const;
2606 
2611  void
2612  write_tecplot(std::ostream &out) const;
2613 
2618  void
2619  write_ucd(std::ostream &out) const;
2620 
2632  void
2633  write_vtk(std::ostream &out) const;
2634 
2649  void
2650  write_vtu(std::ostream &out) const;
2651 
2660  void
2661  write_vtu_in_parallel(const std::string &filename, MPI_Comm comm) const;
2662 
2696  void
2697  write_pvtu_record(std::ostream & out,
2698  const std::vector<std::string> &piece_names) const;
2699 
2758  std::string
2759  write_vtu_with_pvtu_record(
2760  const std::string &directory,
2761  const std::string &filename_without_extension,
2762  const unsigned int counter,
2763  const MPI_Comm & mpi_communicator,
2764  const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2765  const unsigned int n_groups = 0) const;
2766 
2771  void
2772  write_svg(std::ostream &out) const;
2773 
2784  void
2785  write_deal_II_intermediate(std::ostream &out) const;
2786 
2792  XDMFEntry
2793  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2794  const std::string & h5_filename,
2795  const double cur_time,
2796  MPI_Comm comm) const;
2797 
2803  XDMFEntry
2804  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2805  const std::string & h5_mesh_filename,
2806  const std::string & h5_solution_filename,
2807  const double cur_time,
2808  MPI_Comm comm) const;
2809 
2834  void
2835  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2836  const std::string & filename,
2837  MPI_Comm comm) const;
2838 
2853  void
2855  const std::string & filename,
2856  MPI_Comm comm) const;
2857 
2865  void
2867  const bool write_mesh_file,
2868  const std::string & mesh_filename,
2869  const std::string & solution_filename,
2870  MPI_Comm comm) const;
2871 
2878  void
2879  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2880 
2881 
2890  void
2891  write(std::ostream & out,
2892  const DataOutBase::OutputFormat output_format =
2894 
2899  void
2900  set_default_format(const DataOutBase::OutputFormat default_format);
2901 
2902 
2907  template <typename FlagType>
2908  void
2909  set_flags(const FlagType &flags);
2910 
2911 
2919  std::string
2920  default_suffix(const DataOutBase::OutputFormat output_format =
2922 
2937  static void
2938  declare_parameters(ParameterHandler &prm);
2939 
2947  void
2948  parse_parameters(ParameterHandler &prm);
2949 
2955  std::size_t
2956  memory_consumption() const;
2957 
2958 protected:
2966  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
2967  get_patches() const = 0;
2968 
2973  virtual std::vector<std::string>
2974  get_dataset_names() const = 0;
2975 
2994  virtual std::vector<
2995  std::tuple<unsigned int,
2996  unsigned int,
2997  std::string,
2999  get_nonscalar_data_ranges() const;
3000 
3007  void
3008  validate_dataset_names() const;
3009 
3010 
3016  unsigned int default_subdivisions;
3017 
3018 private:
3025 
3031 
3037 
3043 
3049 
3055 
3061 
3067 
3073 
3079 
3085 };
3086 
3087 
3088 
3134 template <int dim, int spacedim = dim>
3135 class DataOutReader : public DataOutInterface<dim, spacedim>
3136 {
3137 public:
3143  void
3144  read(std::istream &in);
3145 
3167  void
3168  merge(const DataOutReader<dim, spacedim> &other);
3169 
3174  "You are trying to merge two sets of patches for which the "
3175  "declared names of the variables do not match.");
3180  "You are trying to merge two sets of patches for which the "
3181  "number of subdivisions or the number of vector components "
3182  "do not match.");
3186  DeclException4(ExcIncompatibleDimensions,
3187  int,
3188  int,
3189  int,
3190  int,
3191  << "Either the dimensions <" << arg1 << "> and <" << arg2
3192  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3193  << "> do not match!");
3194 
3195 protected:
3204  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3205  get_patches() const override;
3206 
3213  virtual std::vector<std::string>
3214  get_dataset_names() const override;
3215 
3234  virtual std::vector<
3235  std::tuple<unsigned int,
3236  unsigned int,
3237  std::string,
3239  get_nonscalar_data_ranges() const override;
3240 
3241 private:
3246  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3247  std::vector<std::string> dataset_names;
3248 
3253  std::vector<
3254  std::tuple<unsigned int,
3255  unsigned int,
3256  std::string,
3259 };
3260 
3261 
3262 
3271 {
3272 public:
3276  XDMFEntry();
3277 
3283  XDMFEntry(const std::string &filename,
3284  const double time,
3285  const unsigned int nodes,
3286  const unsigned int cells,
3287  const unsigned int dim);
3288 
3293  XDMFEntry(const std::string &mesh_filename,
3294  const std::string &solution_filename,
3295  const double time,
3296  const unsigned int nodes,
3297  const unsigned int cells,
3298  const unsigned int dim);
3299 
3303  XDMFEntry(const std::string &mesh_filename,
3304  const std::string &solution_filename,
3305  const double time,
3306  const unsigned int nodes,
3307  const unsigned int cells,
3308  const unsigned int dim,
3309  const unsigned int spacedim);
3310 
3314  void
3315  add_attribute(const std::string &attr_name, const unsigned int dimension);
3316 
3320  template <class Archive>
3321  void
3322  serialize(Archive &ar, const unsigned int /*version*/)
3323  {
3324  ar &valid &h5_sol_filename &h5_mesh_filename &entry_time &num_nodes
3325  &num_cells &dimension &space_dimension &attribute_dims;
3326  }
3327 
3336  std::string
3337  get_xdmf_content(const unsigned int indent_level) const;
3338 
3343  std::string
3344  get_xdmf_content(const unsigned int indent_level,
3346 
3347 private:
3351  bool valid;
3352 
3356  std::string h5_sol_filename;
3357 
3361  std::string h5_mesh_filename;
3362 
3366  double entry_time;
3367 
3371  unsigned int num_nodes;
3372 
3376  unsigned int num_cells;
3377 
3381  unsigned int dimension;
3382 
3387  unsigned int space_dimension;
3388 
3392  std::map<std::string, unsigned int> attribute_dims;
3393 };
3394 
3395 
3396 
3397 /* -------------------- inline functions ------------------- */
3398 
3399 namespace DataOutBase
3400 {
3401  inline bool
3403  {
3404  return (red == green) && (red == blue);
3405  }
3406 
3407 
3408  /* -------------------- template functions ------------------- */
3409 
3416  template <int dim, int spacedim>
3417  std::ostream &
3418  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3419 
3420 
3421 
3428  template <int dim, int spacedim>
3429  std::istream &
3430  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3431 } // namespace DataOutBase
3432 
3433 
3435 
3436 #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: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:538
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)
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()
ReferenceCell::Type reference_cell_type
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:515
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:493
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:369
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:11759
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
*braid_SplitCommworld & comm
static const unsigned int format_version
static const unsigned int space_dim
DataOutBase::GnuplotFlags gnuplot_flags
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:368
T min(const T &t, const MPI_Comm &mpi_communicator)
unsigned int num_nodes
ReferenceCell::Type reference_cell_type
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:584
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
std::string get_output_format_names()
#define DEAL_II_DEPRECATED
Definition: config.h:152
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()