Reference documentation for deal.II version GIT 6da2e5d553 2022-07-01 18:55:02+00:00
\(\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 - 2022 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_data_out_base_h
17 #define dealii_data_out_base_h
18 
19 
20 #include <deal.II/base/config.h>
21 
23 #include <deal.II/base/mpi.h>
24 #include <deal.II/base/point.h>
25 #include <deal.II/base/table.h>
26 
28 
30 
31 // To be able to serialize XDMFEntry
32 #include <boost/serialization/map.hpp>
33 
34 #include <limits>
35 #include <string>
36 #include <tuple>
37 #include <typeinfo>
38 #include <vector>
39 
40 // Only include the Tecplot API header if the appropriate files
41 // were detected by configure
42 #ifdef DEAL_II_HAVE_TECPLOT
43 # include <string.h>
44 
45 # include "TECIO.h"
46 #endif
47 
48 #include <ostream>
49 
51 
52 // Forward declarations
53 #ifndef DOXYGEN
54 class ParameterHandler;
55 class XDMFEntry;
56 #endif
57 
221 namespace DataOutBase
222 {
245  template <int dim, int spacedim = dim>
246  struct Patch
247  {
251  static const unsigned int space_dim = spacedim;
252 
266 
272  std::array<unsigned int, GeometryInfo<dim>::faces_per_cell> neighbors;
273 
278  unsigned int patch_index;
279 
285  unsigned int n_subdivisions;
286 
309 
323 
328 
333  Patch();
334 
339  bool
340  operator==(const Patch &patch) const;
341 
348  std::size_t
349  memory_consumption() const;
350 
354  void
355  swap(Patch<dim, spacedim> &other_patch);
356 
360  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
361 
372  int,
373  int,
374  << "It is not possible to have a structural dimension of " << arg1
375  << " to be larger than the space dimension of the surrounding"
376  << " space " << arg2);
378  };
379 
380 
381 
397  template <int spacedim>
398  struct Patch<0, spacedim>
399  {
403  static const unsigned int space_dim = spacedim;
404 
414 
419  static unsigned int neighbors[1];
420 
425  unsigned int patch_index;
426 
436  static const unsigned int n_subdivisions;
437 
459 
473 
480 
485  Patch();
486 
491  bool
492  operator==(const Patch &patch) const;
493 
500  std::size_t
501  memory_consumption() const;
502 
506  void
507  swap(Patch<0, spacedim> &other_patch);
508 
512  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
513 
524  int,
525  int,
526  << "It is not possible to have a structural dimension of " << arg1
527  << " to be larger than the space dimension of the surrounding"
528  << " space " << arg2);
530  };
531 
532 
544  template <typename FlagsType>
546  {
554  static void
556 
564  void
566 
573  std::size_t
575  };
576 
577 
578  template <typename FlagsType>
579  void
581  {}
582 
583 
584  template <typename FlagsType>
585  void
587  {}
588 
589 
590  template <typename FlagsType>
591  std::size_t
593  {
594  return sizeof(FlagsType);
595  }
596 
597 
603  struct DXFlags : public OutputFlagsBase<DXFlags>
604  {
619 
624 
630 
634  DXFlags(const bool write_neighbors = false,
635  const bool int_binary = false,
636  const bool coordinates_binary = false,
637  const bool data_binary = false);
638 
643  static void
645 
652  void
654  };
655 
661  struct UcdFlags : public OutputFlagsBase<UcdFlags>
662  {
673 
677  UcdFlags(const bool write_preamble = false);
678 
683  static void
685 
692  void
694  };
695 
701  struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
702  {
707  GnuplotFlags();
708 
712  GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
713 
729  std::vector<std::string> space_dimension_labels;
730 
735  std::size_t
736  memory_consumption() const;
737 
743  "There should be at least one space dimension per spatial "
744  "dimension (extras are ignored).");
745  };
746 
753  struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
754  {
760  bool smooth;
761 
768 
776 
780  PovrayFlags(const bool smooth = false,
781  const bool bicubic_patch = false,
782  const bool external_data = false);
783 
788  static void
790 
797  void
799  };
800 
801 
808  struct EpsFlags : public OutputFlagsBase<EpsFlags>
809  {
816  unsigned int height_vector;
817 
822  unsigned int color_vector;
823 
829  enum SizeType
830  {
834  height
835  };
836 
841 
849  unsigned int size;
850 
854  double line_width;
855 
861  double azimut_angle;
862 
886  double turn_angle;
887 
898  double z_scaling;
899 
906  bool draw_mesh;
907 
925 
935 
939  struct RgbValues
940  {
941  float red;
942  float green;
943  float blue;
944 
949  bool
950  is_grey() const;
951  };
952 
960  using ColorFunction = RgbValues (*)(const double value,
961  const double min_value,
962  const double max_value);
963 
970 
971 
980  static RgbValues
981  default_color_function(const double value,
982  const double min_value,
983  const double max_value);
984 
990  static RgbValues
991  grey_scale_color_function(const double value,
992  const double min_value,
993  const double max_value);
994 
1001  static RgbValues
1002  reverse_grey_scale_color_function(const double value,
1003  const double min_value,
1004  const double max_value);
1005 
1009  EpsFlags(const unsigned int height_vector = 0,
1010  const unsigned int color_vector = 0,
1011  const SizeType size_type = width,
1012  const unsigned int size = 300,
1013  const double line_width = 0.5,
1014  const double azimut_angle = 60,
1015  const double turn_angle = 30,
1016  const double z_scaling = 1.0,
1017  const bool draw_mesh = true,
1018  const bool draw_cells = true,
1019  const bool shade_cells = true,
1021 
1029  static void
1031 
1038  void
1039  parse_parameters(const ParameterHandler &prm);
1040  };
1041 
1048  struct GmvFlags : public OutputFlagsBase<GmvFlags>
1049  {};
1050 
1056  struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
1057  {
1062  const char *zone_name;
1063 
1070 
1074  TecplotFlags(const char * zone_name = nullptr,
1075  const double solution_time = -1.0);
1076 
1081  std::size_t
1082  memory_consumption() const;
1083  };
1084 
1090  struct VtkFlags : public OutputFlagsBase<VtkFlags>
1091  {
1102  double time;
1103 
1114  unsigned int cycle;
1115 
1123 
1129  {
1148  };
1149 
1155 
1174 
1196  std::map<std::string, std::string> physical_units;
1197 
1202  VtkFlags(
1203  const double time = std::numeric_limits<double>::min(),
1204  const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
1205  const bool print_date_and_time = true,
1207  const bool write_higher_order_cells = false,
1208  const std::map<std::string, std::string> &physical_units = {});
1209  };
1210 
1211 
1217  struct SvgFlags : public OutputFlagsBase<SvgFlags>
1218  {
1222  unsigned int height;
1223 
1228  unsigned int width;
1229 
1236  unsigned int height_vector;
1237 
1242 
1243  unsigned int line_thickness;
1244 
1248  bool margin;
1249 
1254 
1258  SvgFlags(const unsigned int height_vector = 0,
1259  const int azimuth_angle = 37,
1260  const int polar_angle = 45,
1261  const unsigned int line_thickness = 1,
1262  const bool margin = true,
1263  const bool draw_colorbar = true);
1264  };
1265 
1266 
1274  : public OutputFlagsBase<Deal_II_IntermediateFlags>
1275  {
1282  static const unsigned int format_version;
1283  };
1284 
1291  {
1302 
1308 
1312  DataOutFilterFlags(const bool filter_duplicate_vertices = false,
1313  const bool xdmf_hdf5_output = false);
1314 
1319  static void
1321 
1328  void
1329  parse_parameters(const ParameterHandler &prm);
1330 
1335  std::size_t
1337  };
1338 
1371  {
1372  public:
1376  DataOutFilter();
1377 
1383 
1389  template <int dim>
1390  void
1391  write_point(const unsigned int index, const Point<dim> &p);
1392 
1396  template <int dim>
1397  void
1398  write_cell(const unsigned int index,
1399  const unsigned int start,
1400  const unsigned int d1,
1401  const unsigned int d2,
1402  const unsigned int d3);
1403 
1408  void
1409  write_cell_single(const unsigned int index,
1410  const unsigned int start,
1411  const unsigned int n_points,
1412  const ReferenceCell &reference_cell);
1413 
1420  void
1421  write_data_set(const std::string & name,
1422  const unsigned int dimension,
1423  const unsigned int set_num,
1424  const Table<2, double> &data_vectors);
1425 
1430  void
1431  fill_node_data(std::vector<double> &node_data) const;
1432 
1437  void
1438  fill_cell_data(const unsigned int local_node_offset,
1439  std::vector<unsigned int> &cell_data) const;
1440 
1444  std::string
1445  get_data_set_name(const unsigned int set_num) const;
1446 
1450  unsigned int
1451  get_data_set_dim(const unsigned int set_num) const;
1452 
1457  const double *
1458  get_data_set(const unsigned int set_num) const;
1459 
1464  unsigned int
1465  n_nodes() const;
1466 
1471  unsigned int
1472  n_cells() const;
1473 
1478  unsigned int
1479  n_data_sets() const;
1480 
1484  void
1485  flush_points();
1486 
1490  void
1491  flush_cells();
1492 
1493 
1494  private:
1498  struct Point3Comp
1499  {
1500  bool
1501  operator()(const Point<3> &one, const Point<3> &two) const
1502  {
1503  /*
1504  * The return statement below is an optimized version of the following
1505  * code:
1506  *
1507  * for (unsigned int d=0; d<3; ++d)
1508  * {
1509  * if (one(d) < two(d))
1510  * return true;
1511  * else if (one(d) > two(d))
1512  * return false;
1513  * }
1514  * return false;
1515  */
1516 
1517  return (one(0) < two(0) ||
1518  (!(two(0) < one(0)) &&
1519  (one(1) < two(1) || (!(two(1) < one(1)) && one(2) < two(2)))));
1520  }
1521  };
1522 
1523  using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1524 
1529 
1536  unsigned int node_dim;
1537 
1542  unsigned int num_cells;
1543 
1548 
1552  std::map<unsigned int, unsigned int> filtered_points;
1553 
1557  std::map<unsigned int, unsigned int> filtered_cells;
1558 
1562  std::vector<std::string> data_set_names;
1563 
1567  std::vector<unsigned int> data_set_dims;
1568 
1572  std::vector<std::vector<double>> data_sets;
1573 
1577  void
1578  internal_add_cell(const unsigned int cell_index,
1579  const unsigned int pt_index);
1580  };
1581 
1582 
1587  {
1592 
1597 
1602 
1607 
1612 
1617 
1622 
1627 
1632 
1640 
1645 
1650 
1655 
1660 
1664  hdf5
1665  };
1666 
1667 
1671  template <int dim, int spacedim>
1672  void
1673  write_dx(
1674  const std::vector<Patch<dim, spacedim>> &patches,
1675  const std::vector<std::string> & data_names,
1676  const std::vector<
1677  std::tuple<unsigned int,
1678  unsigned int,
1679  std::string,
1681  & nonscalar_data_ranges,
1682  const DXFlags &flags,
1683  std::ostream & out);
1684 
1729  template <int spacedim>
1730  void
1731  write_eps(
1732  const std::vector<Patch<2, spacedim>> &patches,
1733  const std::vector<std::string> & data_names,
1734  const std::vector<
1735  std::tuple<unsigned int,
1736  unsigned int,
1737  std::string,
1739  & nonscalar_data_ranges,
1740  const EpsFlags &flags,
1741  std::ostream & out);
1742 
1748  template <int dim, int spacedim>
1749  void
1750  write_eps(
1751  const std::vector<Patch<dim, spacedim>> &patches,
1752  const std::vector<std::string> & data_names,
1753  const std::vector<
1754  std::tuple<unsigned int,
1755  unsigned int,
1756  std::string,
1758  & nonscalar_data_ranges,
1759  const EpsFlags &flags,
1760  std::ostream & out);
1761 
1762 
1772  template <int dim, int spacedim>
1773  void
1774  write_gmv(
1775  const std::vector<Patch<dim, spacedim>> &patches,
1776  const std::vector<std::string> & data_names,
1777  const std::vector<
1778  std::tuple<unsigned int,
1779  unsigned int,
1780  std::string,
1782  & nonscalar_data_ranges,
1783  const GmvFlags &flags,
1784  std::ostream & out);
1785 
1841  template <int dim, int spacedim>
1842  void
1843  write_gnuplot(
1844  const std::vector<Patch<dim, spacedim>> &patches,
1845  const std::vector<std::string> & data_names,
1846  const std::vector<
1847  std::tuple<unsigned int,
1848  unsigned int,
1849  std::string,
1851  & nonscalar_data_ranges,
1852  const GnuplotFlags &flags,
1853  std::ostream & out);
1854 
1900  template <int dim, int spacedim>
1901  void
1902  write_povray(
1903  const std::vector<Patch<dim, spacedim>> &patches,
1904  const std::vector<std::string> & data_names,
1905  const std::vector<
1906  std::tuple<unsigned int,
1907  unsigned int,
1908  std::string,
1910  & nonscalar_data_ranges,
1911  const PovrayFlags &flags,
1912  std::ostream & out);
1913 
1920  template <int dim, int spacedim>
1921  void
1922  write_tecplot(
1923  const std::vector<Patch<dim, spacedim>> &patches,
1924  const std::vector<std::string> & data_names,
1925  const std::vector<
1926  std::tuple<unsigned int,
1927  unsigned int,
1928  std::string,
1930  & nonscalar_data_ranges,
1931  const TecplotFlags &flags,
1932  std::ostream & out);
1933 
1948  template <int dim, int spacedim>
1949  void
1950  write_ucd(
1951  const std::vector<Patch<dim, spacedim>> &patches,
1952  const std::vector<std::string> & data_names,
1953  const std::vector<
1954  std::tuple<unsigned int,
1955  unsigned int,
1956  std::string,
1958  & nonscalar_data_ranges,
1959  const UcdFlags &flags,
1960  std::ostream & out);
1961 
1981  template <int dim, int spacedim>
1982  void
1983  write_vtk(
1984  const std::vector<Patch<dim, spacedim>> &patches,
1985  const std::vector<std::string> & data_names,
1986  const std::vector<
1987  std::tuple<unsigned int,
1988  unsigned int,
1989  std::string,
1991  & nonscalar_data_ranges,
1992  const VtkFlags &flags,
1993  std::ostream & out);
1994 
1995 
2019  template <int dim, int spacedim>
2020  void
2021  write_vtu(
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 
2038  void
2039  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2040 
2047  void
2048  write_vtu_footer(std::ostream &out);
2049 
2056  template <int dim, int spacedim>
2057  void
2059  const std::vector<Patch<dim, spacedim>> &patches,
2060  const std::vector<std::string> & data_names,
2061  const std::vector<
2062  std::tuple<unsigned int,
2063  unsigned int,
2064  std::string,
2066  & nonscalar_data_ranges,
2067  const VtkFlags &flags,
2068  std::ostream & out);
2069 
2111  void
2113  std::ostream & out,
2114  const std::vector<std::string> &piece_names,
2115  const std::vector<std::string> &data_names,
2116  const std::vector<
2117  std::tuple<unsigned int,
2118  unsigned int,
2119  std::string,
2121  & nonscalar_data_ranges,
2122  const VtkFlags &flags);
2123 
2172  void
2174  std::ostream & out,
2175  const std::vector<std::pair<double, std::string>> &times_and_names);
2176 
2188  void
2189  write_visit_record(std::ostream & out,
2190  const std::vector<std::string> &piece_names);
2191 
2219  void
2220  write_visit_record(std::ostream & out,
2221  const std::vector<std::vector<std::string>> &piece_names);
2222 
2255  void
2257  std::ostream &out,
2258  const std::vector<std::pair<double, std::vector<std::string>>>
2259  &times_and_piece_names);
2260 
2281  template <int spacedim>
2282  void
2283  write_svg(
2284  const std::vector<Patch<2, spacedim>> &patches,
2285  const std::vector<std::string> & data_names,
2286  const std::vector<
2287  std::tuple<unsigned int,
2288  unsigned int,
2289  std::string,
2291  & nonscalar_data_ranges,
2292  const SvgFlags &flags,
2293  std::ostream & out);
2294 
2332  template <int dim, int spacedim>
2333  void
2335  const std::vector<Patch<dim, spacedim>> &patches,
2336  const std::vector<std::string> & data_names,
2337  const std::vector<
2338  std::tuple<unsigned int,
2339  unsigned int,
2340  std::string,
2342  & nonscalar_data_ranges,
2343  const Deal_II_IntermediateFlags &flags,
2344  std::ostream & out);
2345 
2350  template <int dim, int spacedim>
2351  void
2352  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2353  const DataOutFilter & data_filter,
2354  const std::string & filename,
2355  const MPI_Comm & comm);
2356 
2364  template <int dim, int spacedim>
2365  void
2366  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2367  const DataOutFilter & data_filter,
2368  const bool write_mesh_file,
2369  const std::string & mesh_filename,
2370  const std::string &solution_filename,
2371  const MPI_Comm & comm);
2372 
2379  template <int dim, int spacedim>
2380  void
2382  const std::vector<Patch<dim, spacedim>> &patches,
2383  const std::vector<std::string> & data_names,
2384  const std::vector<
2385  std::tuple<unsigned int,
2386  unsigned int,
2387  std::string,
2389  & nonscalar_data_ranges,
2390  DataOutFilter &filtered_data);
2391 
2403  std::pair<unsigned int, unsigned int>
2404  determine_intermediate_format_dimensions(std::istream &input);
2405 
2417  OutputFormat
2418  parse_output_format(const std::string &format_name);
2419 
2425  std::string
2427 
2448  std::string
2449  default_suffix(const OutputFormat output_format);
2450 
2460  int,
2461  int,
2462  << "The number of points in this data set is " << arg1
2463  << ", but we expected " << arg2
2464  << " in each space direction.");
2469  "You are trying to write graphical data into a file, but "
2470  "no data is available in the intermediate format that "
2471  "the DataOutBase functions require. Did you forget to "
2472  "call a function such as DataOut::build_patches()?");
2477  "The error code of one of the Tecplot functions was "
2478  "not zero as expected.");
2483  char *,
2484  << "There was an error opening Tecplot file " << arg1
2485  << " for output.");
2486 
2488 } // namespace DataOutBase
2489 
2490 
2491 
2598 template <int dim, int spacedim = dim>
2600 {
2601 public:
2605  DataOutInterface();
2606 
2611  virtual ~DataOutInterface() = default;
2612 
2617  void
2618  write_dx(std::ostream &out) const;
2619 
2624  void
2625  write_eps(std::ostream &out) const;
2626 
2631  void
2632  write_gmv(std::ostream &out) const;
2633 
2638  void
2639  write_gnuplot(std::ostream &out) const;
2640 
2645  void
2646  write_povray(std::ostream &out) const;
2647 
2652  void
2653  write_tecplot(std::ostream &out) const;
2654 
2659  void
2660  write_ucd(std::ostream &out) const;
2661 
2673  void
2674  write_vtk(std::ostream &out) const;
2675 
2690  void
2691  write_vtu(std::ostream &out) const;
2692 
2701  void
2702  write_vtu_in_parallel(const std::string &filename,
2703  const MPI_Comm & comm) const;
2704 
2738  void
2739  write_pvtu_record(std::ostream & out,
2740  const std::vector<std::string> &piece_names) const;
2741 
2800  std::string
2802  const std::string &directory,
2803  const std::string &filename_without_extension,
2804  const unsigned int counter,
2805  const MPI_Comm & mpi_communicator,
2806  const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2807  const unsigned int n_groups = 0) const;
2808 
2813  void
2814  write_svg(std::ostream &out) const;
2815 
2826  void
2827  write_deal_II_intermediate(std::ostream &out) const;
2828 
2834  XDMFEntry
2835  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2836  const std::string & h5_filename,
2837  const double cur_time,
2838  const MPI_Comm & comm) const;
2839 
2845  XDMFEntry
2846  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2847  const std::string & h5_mesh_filename,
2848  const std::string & h5_solution_filename,
2849  const double cur_time,
2850  const MPI_Comm & comm) const;
2851 
2876  void
2877  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2878  const std::string & filename,
2879  const MPI_Comm & comm) const;
2880 
2895  void
2897  const std::string & filename,
2898  const MPI_Comm & comm) const;
2899 
2907  void
2909  const bool write_mesh_file,
2910  const std::string & mesh_filename,
2911  const std::string & solution_filename,
2912  const MPI_Comm & comm) const;
2913 
2920  void
2921  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2922 
2923 
2932  void
2933  write(std::ostream & out,
2934  const DataOutBase::OutputFormat output_format =
2936 
2941  void
2943 
2944 
2949  template <typename FlagType>
2950  void
2951  set_flags(const FlagType &flags);
2952 
2953 
2961  std::string
2962  default_suffix(const DataOutBase::OutputFormat output_format =
2964 
2979  static void
2981 
2989  void
2991 
2997  std::size_t
2998  memory_consumption() const;
2999 
3000 protected:
3008  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
3009  get_patches() const = 0;
3010 
3015  virtual std::vector<std::string>
3016  get_dataset_names() const = 0;
3017 
3036  virtual std::vector<
3037  std::tuple<unsigned int,
3038  unsigned int,
3039  std::string,
3041  get_nonscalar_data_ranges() const;
3042 
3049  void
3050  validate_dataset_names() const;
3051 
3052 
3058  unsigned int default_subdivisions;
3059 
3060 private:
3067 
3073 
3079 
3085 
3091 
3097 
3103 
3109 
3115 
3121 
3127 };
3128 
3129 
3130 
3176 template <int dim, int spacedim = dim>
3177 class DataOutReader : public DataOutInterface<dim, spacedim>
3178 {
3179 public:
3185  void
3186  read(std::istream &in);
3187 
3209  void
3210  merge(const DataOutReader<dim, spacedim> &other);
3211 
3216  "You are trying to merge two sets of patches for which the "
3217  "declared names of the variables do not match.");
3222  "You are trying to merge two sets of patches for which the "
3223  "number of subdivisions or the number of vector components "
3224  "do not match.");
3229  int,
3230  int,
3231  int,
3232  int,
3233  << "Either the dimensions <" << arg1 << "> and <" << arg2
3234  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3235  << "> do not match!");
3236 
3237 protected:
3246  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3247  get_patches() const override;
3248 
3255  virtual std::vector<std::string>
3256  get_dataset_names() const override;
3257 
3276  virtual std::vector<
3277  std::tuple<unsigned int,
3278  unsigned int,
3279  std::string,
3281  get_nonscalar_data_ranges() const override;
3282 
3283 private:
3288  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3289  std::vector<std::string> dataset_names;
3290 
3295  std::vector<
3296  std::tuple<unsigned int,
3297  unsigned int,
3298  std::string,
3301 };
3302 
3303 
3304 
3313 {
3314 public:
3318  XDMFEntry();
3319 
3325  XDMFEntry(const std::string & filename,
3326  const double time,
3327  const std::uint64_t nodes,
3328  const std::uint64_t cells,
3329  const unsigned int dim);
3330 
3335  XDMFEntry(const std::string & mesh_filename,
3336  const std::string & solution_filename,
3337  const double time,
3338  const std::uint64_t nodes,
3339  const std::uint64_t cells,
3340  const unsigned int dim);
3341 
3345  XDMFEntry(const std::string & mesh_filename,
3346  const std::string & solution_filename,
3347  const double time,
3348  const std::uint64_t nodes,
3349  const std::uint64_t cells,
3350  const unsigned int dim,
3351  const unsigned int spacedim);
3352 
3356  void
3357  add_attribute(const std::string &attr_name, const unsigned int dimension);
3358 
3364  template <class Archive>
3365  void
3366  serialize(Archive &ar, const unsigned int /*version*/)
3367  {
3370  }
3371 
3376  std::string
3377  get_xdmf_content(const unsigned int indent_level,
3378  const ReferenceCell &reference_cell) const;
3379 
3380 private:
3384  bool valid;
3385 
3389  std::string h5_sol_filename;
3390 
3394  std::string h5_mesh_filename;
3395 
3399  double entry_time;
3400 
3404  std::uint64_t num_nodes;
3405 
3409  std::uint64_t num_cells;
3410 
3414  unsigned int dimension;
3415 
3420  unsigned int space_dimension;
3421 
3425  std::map<std::string, unsigned int> attribute_dims;
3426 };
3427 
3428 
3429 
3430 /* -------------------- inline functions ------------------- */
3431 
3432 namespace DataOutBase
3433 {
3434  inline bool
3436  {
3437  return (red == green) && (red == blue);
3438  }
3439 
3440 
3441  /* -------------------- template functions ------------------- */
3442 
3449  template <int dim, int spacedim>
3450  std::ostream &
3451  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3452 
3453 
3454 
3461  template <int dim, int spacedim>
3462  std::istream &
3463  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3464 } // namespace DataOutBase
3465 
3466 
3468 
3469 #endif
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
unsigned int cell_index
Definition: grid_tools.cc:1129
std::size_t memory_consumption() const
static void declare_parameters(ParameterHandler &prm)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const
const double * get_data_set(const unsigned int set_num) const
unsigned int default_subdivisions
std::size_t memory_consumption() const
static void declare_parameters(ParameterHandler &prm)
std::string write_vtu_with_pvtu_record(const std::string &directory, const std::string &filename_without_extension, const unsigned int counter, const MPI_Comm &mpi_communicator, const unsigned int n_digits_for_counter=numbers::invalid_unsigned_int, const unsigned int n_groups=0) const
static void declare_parameters(ParameterHandler &prm)
void parse_parameters(ParameterHandler &prm)
DataOutBase::Deal_II_IntermediateFlags deal_II_intermediate_flags
static ::ExceptionBase & ExcIncompatiblePatchLists()
static RgbValues default_color_function(const double value, const double min_value, const double max_value)
std::map< unsigned int, unsigned int > filtered_points
virtual std::vector< std::string > get_dataset_names() const =0
void write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const
static ::ExceptionBase & ExcIncompatibleDimensions(int arg1, int arg2, int arg3, int arg4)
std::ostream & operator<<(std::ostream &out, const Patch< dim, spacedim > &patch)
std::vector< std::string > space_dimension_labels
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names) const
static void declare_parameters(ParameterHandler &prm)
std::size_t memory_consumption() const
void write_hdf5_parallel(const DataOutBase::DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm) const
DataOutBase::TecplotFlags tecplot_flags
void parse_parameters(const ParameterHandler &prm)
ColorFunction color_function
std::string get_data_set_name(const unsigned int set_num) const
void write_ucd(std::ostream &out) const
void merge(const DataOutReader< dim, spacedim > &other)
unsigned int patch_index
ReferenceCell reference_cell
void write_povray(std::ostream &out) const
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
std::string default_suffix(const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
Table< 2, float > data
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
std::multimap< Point< 3 >, unsigned int, Point3Comp > Map3DPoint
void internal_add_cell(const unsigned int cell_index, const unsigned int pt_index)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:578
static void declare_parameters(ParameterHandler &prm)
void write_cell(const unsigned int index, const unsigned int start, const unsigned int d1, const unsigned int d2, const unsigned int d3)
ZlibCompressionLevel compression_level
VtkFlags(const double time=std::numeric_limits< double >::min(), const unsigned int cycle=std::numeric_limits< unsigned int >::min(), const bool print_date_and_time=true, const ZlibCompressionLevel compression_level=best_compression, const bool write_higher_order_cells=false, const std::map< std::string, std::string > &physical_units={})
bool operator()(const Point< 3 > &one, const Point< 3 > &two) const
XDMFEntry create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, const MPI_Comm &comm) const
std::uint64_t num_nodes
static const unsigned int format_version
static const unsigned int no_neighbor
unsigned int dimension
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > nonscalar_data_ranges
PovrayFlags(const bool smooth=false, const bool bicubic_patch=false, const bool external_data=false)
std::size_t memory_consumption() const
std::string get_xdmf_content(const unsigned int indent_level, const ReferenceCell &reference_cell) const
void write_vtu_in_parallel(const std::string &filename, const MPI_Comm &comm) const
virtual const std::vector<::DataOutBase::Patch< dim, spacedim > > & get_patches() const override
unsigned int height_vector
DataOutBase::GmvFlags gmv_flags
EpsFlags(const unsigned int height_vector=0, const unsigned int color_vector=0, const SizeType size_type=width, const unsigned int size=300, const double line_width=0.5, const double azimut_angle=60, const double turn_angle=30, const double z_scaling=1.0, const bool draw_mesh=true, const bool draw_cells=true, const bool shade_cells=true, const ColorFunction color_function=&default_color_function)
void parse_parameters(const ParameterHandler &prm)
std::vector< unsigned int > data_set_dims
std::size_t memory_consumption() const
void set_default_format(const DataOutBase::OutputFormat default_format)
unsigned int n_nodes() const
std::map< std::string, std::string > physical_units
void parse_parameters(const ParameterHandler &prm)
unsigned int color_vector
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
DataOutBase::PovrayFlags povray_flags
DataOutBase::UcdFlags ucd_flags
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
static void declare_parameters(ParameterHandler &prm)
void fill_node_data(std::vector< double > &node_data) const
virtual const std::vector< DataOutBase::Patch< dim, spacedim > > & get_patches() const =0
std::vector< std::vector< double > > data_sets
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
bool operator==(const Patch &patch) const
std::string h5_sol_filename
static const unsigned int n_subdivisions
DataOutBase::OutputFormat default_fmt
DataOutBase::GnuplotFlags gnuplot_flags
unsigned int get_data_set_dim(const unsigned int set_num) const
void write_gnuplot(std::ostream &out) const
virtual ~DataOutInterface()=default
static ::ExceptionBase & ExcInvalidCombinationOfDimensions(int arg1, int arg2)
void read(std::istream &in)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:532
void serialize(Archive &ar, const unsigned int)
SvgFlags(const unsigned int height_vector=0, const int azimuth_angle=37, const int polar_angle=45, const unsigned int line_thickness=1, const bool margin=true, const bool draw_colorbar=true)
static RgbValues reverse_grey_scale_color_function(const double value, const double min_value, const double max_value)
void write_vtu(std::ostream &out) const
static ::ExceptionBase & ExcNotEnoughSpaceDimensionLabels()
static const unsigned int space_dim
void write_tecplot(std::ostream &out) const
static const ReferenceCell reference_cell
TecplotFlags(const char *zone_name=nullptr, const double solution_time=-1.0)
void write_data_set(const std::string &name, const unsigned int dimension, const unsigned int set_num, const Table< 2, double > &data_vectors)
void parse_parameters(const ParameterHandler &prm)
static ::ExceptionBase & ExcIncompatibleDatasetNames()
double entry_time
static ::ExceptionBase & ExcTecplotAPIError()
std::string h5_mesh_filename
void parse_parameters(const ParameterHandler &prm)
std::map< unsigned int, unsigned int > filtered_cells
void add_attribute(const std::string &attr_name, const unsigned int dimension)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
std::uint64_t num_cells
std::map< std::string, unsigned int > attribute_dims
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:487
virtual std::vector< std::string > get_dataset_names() const override
void write_svg(std::ostream &out) const
void write_cell_single(const unsigned int index, const unsigned int start, const unsigned int n_points, const ReferenceCell &reference_cell)
unsigned int height_vector
DataOutBase::SvgFlags svg_flags
unsigned int n_subdivisions
void write_xdmf_file(const std::vector< XDMFEntry > &entries, const std::string &filename, const MPI_Comm &comm) const
void validate_dataset_names() const
std::vector< std::string > dataset_names
void set_flags(const FlagType &flags)
std::vector< std::string > data_set_names
void write_vtk(std::ostream &out) const
unsigned int line_thickness
static ::ExceptionBase & ExcNoPatches()
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:509
std::vector<::DataOutBase::Patch< dim, spacedim > > patches
void swap(Patch< dim, spacedim > &other_patch)
void fill_cell_data(const unsigned int local_node_offset, std::vector< unsigned int > &cell_data) const
std::istream & operator>>(std::istream &in, Patch< dim, spacedim > &patch)
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
void write_point(const unsigned int index, const Point< dim > &p)
UcdFlags(const bool write_preamble=false)
std::size_t memory_consumption() const
void parse_parameters(const ParameterHandler &prm)
DXFlags(const bool write_neighbors=false, const bool int_binary=false, const bool coordinates_binary=false, const bool data_binary=false)
DataOutBase::VtkFlags vtk_flags
std::array< unsigned int, GeometryInfo< dim >::faces_per_cell > neighbors
void write_gmv(std::ostream &out) const
DataOutBase::EpsFlags eps_flags
void write_eps(std::ostream &out) const
DataOutBase::DXFlags dx_flags
unsigned int n_cells() const
unsigned int space_dimension
static void declare_parameters(ParameterHandler &prm)
DataOutBase::DataOutFilterFlags flags
void write_dx(std::ostream &out) const
unsigned int n_data_sets() const
void write_deal_II_intermediate(std::ostream &out) const
@ width
Scale to given width.
@ height
Scale to given height.
std::pair< unsigned int, unsigned int > determine_intermediate_format_dimensions(std::istream &input)
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)
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_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)
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const VtkFlags &flags)
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 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)
void write_vtu_header(std::ostream &out, const VtkFlags &flags)
void write_pvd_record(std::ostream &out, const std::vector< std::pair< double, std::string >> &times_and_names)
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)
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)
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)
void write_vtu_footer(std::ostream &out)
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)
OutputFormat parse_output_format(const std::string &format_name)
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)
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)
std::string get_output_format_names()
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
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)
std::string default_suffix(const OutputFormat output_format)
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm)
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)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
static const types::blas_int one
static const unsigned int invalid_unsigned_int
Definition: types.h:201
const MPI_Comm & comm