Reference documentation for deal.II version Git e1b67c38dc 2020-08-13 12:19:15 -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 
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 
1504  unsigned int vertices_per_cell;
1505 
1510 
1514  std::map<unsigned int, unsigned int> filtered_points;
1515 
1519  std::map<unsigned int, unsigned int> filtered_cells;
1520 
1524  std::vector<std::string> data_set_names;
1525 
1529  std::vector<unsigned int> data_set_dims;
1530 
1534  std::vector<std::vector<double>> data_sets;
1535 
1539  void
1540  internal_add_cell(const unsigned int cell_index,
1541  const unsigned int pt_index);
1542  };
1543 
1544 
1549  {
1554 
1559 
1564 
1569 
1574 
1579 
1584 
1589 
1594 
1602 
1607 
1612 
1617 
1622 
1627  };
1628 
1629 
1633  template <int dim, int spacedim>
1634  void
1635  write_dx(
1636  const std::vector<Patch<dim, spacedim>> &patches,
1637  const std::vector<std::string> & data_names,
1638  const std::vector<
1639  std::tuple<unsigned int,
1640  unsigned int,
1641  std::string,
1643  & nonscalar_data_ranges,
1644  const DXFlags &flags,
1645  std::ostream & out);
1646 
1691  template <int spacedim>
1692  void
1693  write_eps(
1694  const std::vector<Patch<2, spacedim>> &patches,
1695  const std::vector<std::string> & data_names,
1696  const std::vector<
1697  std::tuple<unsigned int,
1698  unsigned int,
1699  std::string,
1701  & nonscalar_data_ranges,
1702  const EpsFlags &flags,
1703  std::ostream & out);
1704 
1710  template <int dim, int spacedim>
1711  void
1712  write_eps(
1713  const std::vector<Patch<dim, spacedim>> &patches,
1714  const std::vector<std::string> & data_names,
1715  const std::vector<
1716  std::tuple<unsigned int,
1717  unsigned int,
1718  std::string,
1720  & nonscalar_data_ranges,
1721  const EpsFlags &flags,
1722  std::ostream & out);
1723 
1724 
1734  template <int dim, int spacedim>
1735  void
1736  write_gmv(
1737  const std::vector<Patch<dim, spacedim>> &patches,
1738  const std::vector<std::string> & data_names,
1739  const std::vector<
1740  std::tuple<unsigned int,
1741  unsigned int,
1742  std::string,
1744  & nonscalar_data_ranges,
1745  const GmvFlags &flags,
1746  std::ostream & out);
1747 
1804  template <int dim, int spacedim>
1805  void
1806  write_gnuplot(
1807  const std::vector<Patch<dim, spacedim>> &patches,
1808  const std::vector<std::string> & data_names,
1809  const std::vector<
1810  std::tuple<unsigned int,
1811  unsigned int,
1812  std::string,
1814  & nonscalar_data_ranges,
1815  const GnuplotFlags &flags,
1816  std::ostream & out);
1817 
1863  template <int dim, int spacedim>
1864  void
1865  write_povray(
1866  const std::vector<Patch<dim, spacedim>> &patches,
1867  const std::vector<std::string> & data_names,
1868  const std::vector<
1869  std::tuple<unsigned int,
1870  unsigned int,
1871  std::string,
1873  & nonscalar_data_ranges,
1874  const PovrayFlags &flags,
1875  std::ostream & out);
1876 
1883  template <int dim, int spacedim>
1884  void
1885  write_tecplot(
1886  const std::vector<Patch<dim, spacedim>> &patches,
1887  const std::vector<std::string> & data_names,
1888  const std::vector<
1889  std::tuple<unsigned int,
1890  unsigned int,
1891  std::string,
1893  & nonscalar_data_ranges,
1894  const TecplotFlags &flags,
1895  std::ostream & out);
1896 
1911  template <int dim, int spacedim>
1912  void
1913  write_ucd(
1914  const std::vector<Patch<dim, spacedim>> &patches,
1915  const std::vector<std::string> & data_names,
1916  const std::vector<
1917  std::tuple<unsigned int,
1918  unsigned int,
1919  std::string,
1921  & nonscalar_data_ranges,
1922  const UcdFlags &flags,
1923  std::ostream & out);
1924 
1944  template <int dim, int spacedim>
1945  void
1946  write_vtk(
1947  const std::vector<Patch<dim, spacedim>> &patches,
1948  const std::vector<std::string> & data_names,
1949  const std::vector<
1950  std::tuple<unsigned int,
1951  unsigned int,
1952  std::string,
1954  & nonscalar_data_ranges,
1955  const VtkFlags &flags,
1956  std::ostream & out);
1957 
1958 
1982  template <int dim, int spacedim>
1983  void
1984  write_vtu(
1985  const std::vector<Patch<dim, spacedim>> &patches,
1986  const std::vector<std::string> & data_names,
1987  const std::vector<
1988  std::tuple<unsigned int,
1989  unsigned int,
1990  std::string,
1992  & nonscalar_data_ranges,
1993  const VtkFlags &flags,
1994  std::ostream & out);
1995 
2001  void
2002  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2003 
2010  void
2011  write_vtu_footer(std::ostream &out);
2012 
2019  template <int dim, int spacedim>
2020  void
2022  const std::vector<Patch<dim, spacedim>> &patches,
2023  const std::vector<std::string> & data_names,
2024  const std::vector<
2025  std::tuple<unsigned int,
2026  unsigned int,
2027  std::string,
2029  & nonscalar_data_ranges,
2030  const VtkFlags &flags,
2031  std::ostream & out);
2032 
2074  void
2076  std::ostream & out,
2077  const std::vector<std::string> &piece_names,
2078  const std::vector<std::string> &data_names,
2079  const std::vector<
2080  std::tuple<unsigned int,
2081  unsigned int,
2082  std::string,
2084  &nonscalar_data_ranges);
2085 
2134  void
2136  std::ostream & out,
2137  const std::vector<std::pair<double, std::string>> &times_and_names);
2138 
2150  void
2151  write_visit_record(std::ostream & out,
2152  const std::vector<std::string> &piece_names);
2153 
2181  void
2182  write_visit_record(std::ostream & out,
2183  const std::vector<std::vector<std::string>> &piece_names);
2184 
2217  void
2219  std::ostream &out,
2220  const std::vector<std::pair<double, std::vector<std::string>>>
2221  &times_and_piece_names);
2222 
2243  template <int spacedim>
2244  void
2245  write_svg(
2246  const std::vector<Patch<2, spacedim>> &patches,
2247  const std::vector<std::string> & data_names,
2248  const std::vector<
2249  std::tuple<unsigned int,
2250  unsigned int,
2251  std::string,
2253  & nonscalar_data_ranges,
2254  const SvgFlags &flags,
2255  std::ostream & out);
2256 
2294  template <int dim, int spacedim>
2295  void
2297  const std::vector<Patch<dim, spacedim>> &patches,
2298  const std::vector<std::string> & data_names,
2299  const std::vector<
2300  std::tuple<unsigned int,
2301  unsigned int,
2302  std::string,
2304  & nonscalar_data_ranges,
2305  const Deal_II_IntermediateFlags &flags,
2306  std::ostream & out);
2307 
2312  template <int dim, int spacedim>
2313  void
2314  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2315  const DataOutFilter & data_filter,
2316  const std::string & filename,
2317  MPI_Comm comm);
2318 
2326  template <int dim, int spacedim>
2327  void
2328  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2329  const DataOutFilter & data_filter,
2330  const bool write_mesh_file,
2331  const std::string & mesh_filename,
2332  const std::string &solution_filename,
2333  MPI_Comm comm);
2334 
2341  template <int dim, int spacedim>
2342  void
2344  const std::vector<Patch<dim, spacedim>> &patches,
2345  const std::vector<std::string> & data_names,
2346  const std::vector<
2347  std::tuple<unsigned int,
2348  unsigned int,
2349  std::string,
2351  & nonscalar_data_ranges,
2352  DataOutFilter &filtered_data);
2353 
2365  std::pair<unsigned int, unsigned int>
2366  determine_intermediate_format_dimensions(std::istream &input);
2367 
2379  OutputFormat
2380  parse_output_format(const std::string &format_name);
2381 
2387  std::string
2389 
2410  std::string
2411  default_suffix(const OutputFormat output_format);
2412 
2422  int,
2423  int,
2424  << "The number of points in this data set is " << arg1
2425  << ", but we expected " << arg2
2426  << " in each space direction.");
2431  "You are trying to write graphical data into a file, but "
2432  "no data is available in the intermediate format that "
2433  "the DataOutBase functions require. Did you forget to "
2434  "call a function such as DataOut::build_patches()?");
2439  "The error code of one of the Tecplot functions was "
2440  "not zero as expected.");
2445  char *,
2446  << "There was an error opening Tecplot file " << arg1
2447  << " for output.");
2448 
2450 } // namespace DataOutBase
2451 
2452 
2453 
2560 template <int dim, int spacedim = dim>
2562 {
2563 public:
2567  DataOutInterface();
2568 
2573  virtual ~DataOutInterface() = default;
2574 
2579  void
2580  write_dx(std::ostream &out) const;
2581 
2586  void
2587  write_eps(std::ostream &out) const;
2588 
2593  void
2594  write_gmv(std::ostream &out) const;
2595 
2600  void
2601  write_gnuplot(std::ostream &out) const;
2602 
2607  void
2608  write_povray(std::ostream &out) const;
2609 
2614  void
2615  write_tecplot(std::ostream &out) const;
2616 
2621  void
2622  write_ucd(std::ostream &out) const;
2623 
2635  void
2636  write_vtk(std::ostream &out) const;
2637 
2652  void
2653  write_vtu(std::ostream &out) const;
2654 
2663  void
2664  write_vtu_in_parallel(const std::string &filename, MPI_Comm comm) const;
2665 
2699  void
2700  write_pvtu_record(std::ostream & out,
2701  const std::vector<std::string> &piece_names) const;
2702 
2761  std::string
2762  write_vtu_with_pvtu_record(
2763  const std::string &directory,
2764  const std::string &filename_without_extension,
2765  const unsigned int counter,
2766  const MPI_Comm & mpi_communicator,
2767  const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2768  const unsigned int n_groups = 0) const;
2769 
2774  void
2775  write_svg(std::ostream &out) const;
2776 
2787  void
2788  write_deal_II_intermediate(std::ostream &out) const;
2789 
2795  XDMFEntry
2796  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2797  const std::string & h5_filename,
2798  const double cur_time,
2799  MPI_Comm comm) const;
2800 
2806  XDMFEntry
2807  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2808  const std::string & h5_mesh_filename,
2809  const std::string & h5_solution_filename,
2810  const double cur_time,
2811  MPI_Comm comm) const;
2812 
2837  void
2838  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2839  const std::string & filename,
2840  MPI_Comm comm) const;
2841 
2856  void
2858  const std::string & filename,
2859  MPI_Comm comm) const;
2860 
2868  void
2870  const bool write_mesh_file,
2871  const std::string & mesh_filename,
2872  const std::string & solution_filename,
2873  MPI_Comm comm) const;
2874 
2881  void
2882  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2883 
2884 
2893  void
2894  write(std::ostream & out,
2895  const DataOutBase::OutputFormat output_format =
2897 
2902  void
2903  set_default_format(const DataOutBase::OutputFormat default_format);
2904 
2905 
2910  template <typename FlagType>
2911  void
2912  set_flags(const FlagType &flags);
2913 
2914 
2922  std::string
2923  default_suffix(const DataOutBase::OutputFormat output_format =
2925 
2940  static void
2941  declare_parameters(ParameterHandler &prm);
2942 
2950  void
2951  parse_parameters(ParameterHandler &prm);
2952 
2958  std::size_t
2959  memory_consumption() const;
2960 
2961 protected:
2969  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
2970  get_patches() const = 0;
2971 
2976  virtual std::vector<std::string>
2977  get_dataset_names() const = 0;
2978 
2997  virtual std::vector<
2998  std::tuple<unsigned int,
2999  unsigned int,
3000  std::string,
3002  get_nonscalar_data_ranges() const;
3003 
3010  void
3011  validate_dataset_names() const;
3012 
3013 
3019  unsigned int default_subdivisions;
3020 
3021 private:
3028 
3034 
3040 
3046 
3052 
3058 
3064 
3070 
3076 
3082 
3088 };
3089 
3090 
3091 
3137 template <int dim, int spacedim = dim>
3138 class DataOutReader : public DataOutInterface<dim, spacedim>
3139 {
3140 public:
3146  void
3147  read(std::istream &in);
3148 
3170  void
3171  merge(const DataOutReader<dim, spacedim> &other);
3172 
3177  "You are trying to merge two sets of patches for which the "
3178  "declared names of the variables do not match.");
3183  "You are trying to merge two sets of patches for which the "
3184  "number of subdivisions or the number of vector components "
3185  "do not match.");
3189  DeclException4(ExcIncompatibleDimensions,
3190  int,
3191  int,
3192  int,
3193  int,
3194  << "Either the dimensions <" << arg1 << "> and <" << arg2
3195  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3196  << "> do not match!");
3197 
3198 protected:
3207  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3208  get_patches() const override;
3209 
3216  virtual std::vector<std::string>
3217  get_dataset_names() const override;
3218 
3237  virtual std::vector<
3238  std::tuple<unsigned int,
3239  unsigned int,
3240  std::string,
3242  get_nonscalar_data_ranges() const override;
3243 
3244 private:
3249  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3250  std::vector<std::string> dataset_names;
3251 
3256  std::vector<
3257  std::tuple<unsigned int,
3258  unsigned int,
3259  std::string,
3262 };
3263 
3264 
3265 
3274 {
3275 public:
3279  XDMFEntry();
3280 
3286  XDMFEntry(const std::string &filename,
3287  const double time,
3288  const unsigned int nodes,
3289  const unsigned int cells,
3290  const unsigned int dim);
3291 
3296  XDMFEntry(const std::string &mesh_filename,
3297  const std::string &solution_filename,
3298  const double time,
3299  const unsigned int nodes,
3300  const unsigned int cells,
3301  const unsigned int dim);
3302 
3306  XDMFEntry(const std::string &mesh_filename,
3307  const std::string &solution_filename,
3308  const double time,
3309  const unsigned int nodes,
3310  const unsigned int cells,
3311  const unsigned int dim,
3312  const unsigned int spacedim);
3313 
3317  void
3318  add_attribute(const std::string &attr_name, const unsigned int dimension);
3319 
3323  template <class Archive>
3324  void
3325  serialize(Archive &ar, const unsigned int /*version*/)
3326  {
3327  ar &valid &h5_sol_filename &h5_mesh_filename &entry_time &num_nodes
3328  &num_cells &dimension &space_dimension &attribute_dims;
3329  }
3330 
3335  std::string
3336  get_xdmf_content(const unsigned int indent_level) const;
3337 
3338 private:
3342  bool valid;
3343 
3347  std::string h5_sol_filename;
3348 
3352  std::string h5_mesh_filename;
3353 
3357  double entry_time;
3358 
3362  unsigned int num_nodes;
3363 
3367  unsigned int num_cells;
3368 
3372  unsigned int dimension;
3373 
3378  unsigned int space_dimension;
3379 
3383  std::map<std::string, unsigned int> attribute_dims;
3384 };
3385 
3386 
3387 
3388 /* -------------------- inline functions ------------------- */
3389 
3390 namespace DataOutBase
3391 {
3392  inline bool
3394  {
3395  return (red == green) && (red == blue);
3396  }
3397 
3398 
3399  /* -------------------- template functions ------------------- */
3400 
3407  template <int dim, int spacedim>
3408  std::ostream &
3409  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3410 
3411 
3412 
3419  template <int dim, int spacedim>
3420  std::istream &
3421  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3422 } // namespace DataOutBase
3423 
3424 
3426 
3427 #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:363
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:11744
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:362
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()
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()