Reference documentation for deal.II version Git d0adf306fe 2021-04-19 12:46:27 -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 
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 
1800  template <int dim, int spacedim>
1801  void
1802  write_gnuplot(
1803  const std::vector<Patch<dim, spacedim>> &patches,
1804  const std::vector<std::string> & data_names,
1805  const std::vector<
1806  std::tuple<unsigned int,
1807  unsigned int,
1808  std::string,
1810  & nonscalar_data_ranges,
1811  const GnuplotFlags &flags,
1812  std::ostream & out);
1813 
1859  template <int dim, int spacedim>
1860  void
1861  write_povray(
1862  const std::vector<Patch<dim, spacedim>> &patches,
1863  const std::vector<std::string> & data_names,
1864  const std::vector<
1865  std::tuple<unsigned int,
1866  unsigned int,
1867  std::string,
1869  & nonscalar_data_ranges,
1870  const PovrayFlags &flags,
1871  std::ostream & out);
1872 
1879  template <int dim, int spacedim>
1880  void
1881  write_tecplot(
1882  const std::vector<Patch<dim, spacedim>> &patches,
1883  const std::vector<std::string> & data_names,
1884  const std::vector<
1885  std::tuple<unsigned int,
1886  unsigned int,
1887  std::string,
1889  & nonscalar_data_ranges,
1890  const TecplotFlags &flags,
1891  std::ostream & out);
1892 
1907  template <int dim, int spacedim>
1908  void
1909  write_ucd(
1910  const std::vector<Patch<dim, spacedim>> &patches,
1911  const std::vector<std::string> & data_names,
1912  const std::vector<
1913  std::tuple<unsigned int,
1914  unsigned int,
1915  std::string,
1917  & nonscalar_data_ranges,
1918  const UcdFlags &flags,
1919  std::ostream & out);
1920 
1940  template <int dim, int spacedim>
1941  void
1942  write_vtk(
1943  const std::vector<Patch<dim, spacedim>> &patches,
1944  const std::vector<std::string> & data_names,
1945  const std::vector<
1946  std::tuple<unsigned int,
1947  unsigned int,
1948  std::string,
1950  & nonscalar_data_ranges,
1951  const VtkFlags &flags,
1952  std::ostream & out);
1953 
1954 
1978  template <int dim, int spacedim>
1979  void
1980  write_vtu(
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 
1997  void
1998  write_vtu_header(std::ostream &out, const VtkFlags &flags);
1999 
2006  void
2007  write_vtu_footer(std::ostream &out);
2008 
2015  template <int dim, int spacedim>
2016  void
2018  const std::vector<Patch<dim, spacedim>> &patches,
2019  const std::vector<std::string> & data_names,
2020  const std::vector<
2021  std::tuple<unsigned int,
2022  unsigned int,
2023  std::string,
2025  & nonscalar_data_ranges,
2026  const VtkFlags &flags,
2027  std::ostream & out);
2028 
2070  void
2072  std::ostream & out,
2073  const std::vector<std::string> &piece_names,
2074  const std::vector<std::string> &data_names,
2075  const std::vector<
2076  std::tuple<unsigned int,
2077  unsigned int,
2078  std::string,
2080  &nonscalar_data_ranges);
2081 
2130  void
2132  std::ostream & out,
2133  const std::vector<std::pair<double, std::string>> &times_and_names);
2134 
2146  void
2147  write_visit_record(std::ostream & out,
2148  const std::vector<std::string> &piece_names);
2149 
2177  void
2178  write_visit_record(std::ostream & out,
2179  const std::vector<std::vector<std::string>> &piece_names);
2180 
2213  void
2215  std::ostream &out,
2216  const std::vector<std::pair<double, std::vector<std::string>>>
2217  &times_and_piece_names);
2218 
2239  template <int spacedim>
2240  void
2241  write_svg(
2242  const std::vector<Patch<2, spacedim>> &patches,
2243  const std::vector<std::string> & data_names,
2244  const std::vector<
2245  std::tuple<unsigned int,
2246  unsigned int,
2247  std::string,
2249  & nonscalar_data_ranges,
2250  const SvgFlags &flags,
2251  std::ostream & out);
2252 
2290  template <int dim, int spacedim>
2291  void
2293  const std::vector<Patch<dim, spacedim>> &patches,
2294  const std::vector<std::string> & data_names,
2295  const std::vector<
2296  std::tuple<unsigned int,
2297  unsigned int,
2298  std::string,
2300  & nonscalar_data_ranges,
2301  const Deal_II_IntermediateFlags &flags,
2302  std::ostream & out);
2303 
2308  template <int dim, int spacedim>
2309  void
2310  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2311  const DataOutFilter & data_filter,
2312  const std::string & filename,
2313  const MPI_Comm & comm);
2314 
2322  template <int dim, int spacedim>
2323  void
2324  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2325  const DataOutFilter & data_filter,
2326  const bool write_mesh_file,
2327  const std::string & mesh_filename,
2328  const std::string &solution_filename,
2329  const MPI_Comm & comm);
2330 
2337  template <int dim, int spacedim>
2338  void
2340  const std::vector<Patch<dim, spacedim>> &patches,
2341  const std::vector<std::string> & data_names,
2342  const std::vector<
2343  std::tuple<unsigned int,
2344  unsigned int,
2345  std::string,
2347  & nonscalar_data_ranges,
2348  DataOutFilter &filtered_data);
2349 
2361  std::pair<unsigned int, unsigned int>
2362  determine_intermediate_format_dimensions(std::istream &input);
2363 
2375  OutputFormat
2376  parse_output_format(const std::string &format_name);
2377 
2383  std::string
2385 
2406  std::string
2407  default_suffix(const OutputFormat output_format);
2408 
2418  int,
2419  int,
2420  << "The number of points in this data set is " << arg1
2421  << ", but we expected " << arg2
2422  << " in each space direction.");
2427  "You are trying to write graphical data into a file, but "
2428  "no data is available in the intermediate format that "
2429  "the DataOutBase functions require. Did you forget to "
2430  "call a function such as DataOut::build_patches()?");
2435  "The error code of one of the Tecplot functions was "
2436  "not zero as expected.");
2441  char *,
2442  << "There was an error opening Tecplot file " << arg1
2443  << " for output.");
2444 
2446 } // namespace DataOutBase
2447 
2448 
2449 
2556 template <int dim, int spacedim = dim>
2558 {
2559 public:
2563  DataOutInterface();
2564 
2569  virtual ~DataOutInterface() = default;
2570 
2575  void
2576  write_dx(std::ostream &out) const;
2577 
2582  void
2583  write_eps(std::ostream &out) const;
2584 
2589  void
2590  write_gmv(std::ostream &out) const;
2591 
2596  void
2597  write_gnuplot(std::ostream &out) const;
2598 
2603  void
2604  write_povray(std::ostream &out) const;
2605 
2610  void
2611  write_tecplot(std::ostream &out) const;
2612 
2617  void
2618  write_ucd(std::ostream &out) const;
2619 
2631  void
2632  write_vtk(std::ostream &out) const;
2633 
2648  void
2649  write_vtu(std::ostream &out) const;
2650 
2659  void
2660  write_vtu_in_parallel(const std::string &filename,
2661  const 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  const 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  const MPI_Comm & comm) const;
2809 
2834  void
2835  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2836  const std::string & filename,
2837  const MPI_Comm & comm) const;
2838 
2853  void
2855  const std::string & filename,
2856  const 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  const 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 
3322  template <class Archive>
3323  void
3324  serialize(Archive &ar, const unsigned int /*version*/)
3325  {
3326  ar &valid &h5_sol_filename &h5_mesh_filename &entry_time &num_nodes
3327  &num_cells &dimension &space_dimension &attribute_dims;
3328  }
3329 
3338  std::string
3339  get_xdmf_content(const unsigned int indent_level) const;
3340 
3345  std::string
3346  get_xdmf_content(const unsigned int indent_level,
3347  const ReferenceCell &reference_cell) const;
3348 
3349 private:
3353  bool valid;
3354 
3358  std::string h5_sol_filename;
3359 
3363  std::string h5_mesh_filename;
3364 
3368  double entry_time;
3369 
3373  unsigned int num_nodes;
3374 
3378  unsigned int num_cells;
3379 
3383  unsigned int dimension;
3384 
3389  unsigned int space_dimension;
3390 
3394  std::map<std::string, unsigned int> attribute_dims;
3395 };
3396 
3397 
3398 
3399 /* -------------------- inline functions ------------------- */
3400 
3401 namespace DataOutBase
3402 {
3403  inline bool
3405  {
3406  return (red == green) && (red == blue);
3407  }
3408 
3409 
3410  /* -------------------- template functions ------------------- */
3411 
3418  template <int dim, int spacedim>
3419  std::ostream &
3420  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3421 
3422 
3423 
3430  template <int dim, int spacedim>
3431  std::istream &
3432  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3433 } // namespace DataOutBase
3434 
3435 
3437 
3438 #endif
ReferenceCell reference_cell
void write_deal_II_intermediate(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const Deal_II_IntermediateFlags &flags, std::ostream &out)
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static const unsigned int invalid_unsigned_int
Definition: types.h:196
unsigned int space_dimension
static ::ExceptionBase & ExcIncompatiblePatchLists()
unsigned int height_vector
void write_vtu_footer(std::ostream &out)
void write_ucd(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const UcdFlags &flags, std::ostream &out)
static void declare_parameters(ParameterHandler &prm)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:538
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm)
std::size_t memory_consumption() const
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_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: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:396
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:12655
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:395
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: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:158
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()