Reference documentation for deal.II version GIT 9c452b2474 2022-05-26 18:30: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 
1541  unsigned int num_cells;
1542 
1547 
1551  std::map<unsigned int, unsigned int> filtered_points;
1552 
1556  std::map<unsigned int, unsigned int> filtered_cells;
1557 
1561  std::vector<std::string> data_set_names;
1562 
1566  std::vector<unsigned int> data_set_dims;
1567 
1571  std::vector<std::vector<double>> data_sets;
1572 
1576  void
1577  internal_add_cell(const unsigned int cell_index,
1578  const unsigned int pt_index);
1579  };
1580 
1581 
1586  {
1591 
1596 
1601 
1606 
1611 
1616 
1621 
1626 
1631 
1639 
1644 
1649 
1654 
1659 
1663  hdf5
1664  };
1665 
1666 
1670  template <int dim, int spacedim>
1671  void
1672  write_dx(
1673  const std::vector<Patch<dim, spacedim>> &patches,
1674  const std::vector<std::string> & data_names,
1675  const std::vector<
1676  std::tuple<unsigned int,
1677  unsigned int,
1678  std::string,
1680  & nonscalar_data_ranges,
1681  const DXFlags &flags,
1682  std::ostream & out);
1683 
1728  template <int spacedim>
1729  void
1730  write_eps(
1731  const std::vector<Patch<2, spacedim>> &patches,
1732  const std::vector<std::string> & data_names,
1733  const std::vector<
1734  std::tuple<unsigned int,
1735  unsigned int,
1736  std::string,
1738  & nonscalar_data_ranges,
1739  const EpsFlags &flags,
1740  std::ostream & out);
1741 
1747  template <int dim, int spacedim>
1748  void
1749  write_eps(
1750  const std::vector<Patch<dim, spacedim>> &patches,
1751  const std::vector<std::string> & data_names,
1752  const std::vector<
1753  std::tuple<unsigned int,
1754  unsigned int,
1755  std::string,
1757  & nonscalar_data_ranges,
1758  const EpsFlags &flags,
1759  std::ostream & out);
1760 
1761 
1771  template <int dim, int spacedim>
1772  void
1773  write_gmv(
1774  const std::vector<Patch<dim, spacedim>> &patches,
1775  const std::vector<std::string> & data_names,
1776  const std::vector<
1777  std::tuple<unsigned int,
1778  unsigned int,
1779  std::string,
1781  & nonscalar_data_ranges,
1782  const GmvFlags &flags,
1783  std::ostream & out);
1784 
1840  template <int dim, int spacedim>
1841  void
1842  write_gnuplot(
1843  const std::vector<Patch<dim, spacedim>> &patches,
1844  const std::vector<std::string> & data_names,
1845  const std::vector<
1846  std::tuple<unsigned int,
1847  unsigned int,
1848  std::string,
1850  & nonscalar_data_ranges,
1851  const GnuplotFlags &flags,
1852  std::ostream & out);
1853 
1899  template <int dim, int spacedim>
1900  void
1901  write_povray(
1902  const std::vector<Patch<dim, spacedim>> &patches,
1903  const std::vector<std::string> & data_names,
1904  const std::vector<
1905  std::tuple<unsigned int,
1906  unsigned int,
1907  std::string,
1909  & nonscalar_data_ranges,
1910  const PovrayFlags &flags,
1911  std::ostream & out);
1912 
1919  template <int dim, int spacedim>
1920  void
1921  write_tecplot(
1922  const std::vector<Patch<dim, spacedim>> &patches,
1923  const std::vector<std::string> & data_names,
1924  const std::vector<
1925  std::tuple<unsigned int,
1926  unsigned int,
1927  std::string,
1929  & nonscalar_data_ranges,
1930  const TecplotFlags &flags,
1931  std::ostream & out);
1932 
1947  template <int dim, int spacedim>
1948  void
1949  write_ucd(
1950  const std::vector<Patch<dim, spacedim>> &patches,
1951  const std::vector<std::string> & data_names,
1952  const std::vector<
1953  std::tuple<unsigned int,
1954  unsigned int,
1955  std::string,
1957  & nonscalar_data_ranges,
1958  const UcdFlags &flags,
1959  std::ostream & out);
1960 
1980  template <int dim, int spacedim>
1981  void
1982  write_vtk(
1983  const std::vector<Patch<dim, spacedim>> &patches,
1984  const std::vector<std::string> & data_names,
1985  const std::vector<
1986  std::tuple<unsigned int,
1987  unsigned int,
1988  std::string,
1990  & nonscalar_data_ranges,
1991  const VtkFlags &flags,
1992  std::ostream & out);
1993 
1994 
2018  template <int dim, int spacedim>
2019  void
2020  write_vtu(
2021  const std::vector<Patch<dim, spacedim>> &patches,
2022  const std::vector<std::string> & data_names,
2023  const std::vector<
2024  std::tuple<unsigned int,
2025  unsigned int,
2026  std::string,
2028  & nonscalar_data_ranges,
2029  const VtkFlags &flags,
2030  std::ostream & out);
2031 
2037  void
2038  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2039 
2046  void
2047  write_vtu_footer(std::ostream &out);
2048 
2055  template <int dim, int spacedim>
2056  void
2058  const std::vector<Patch<dim, spacedim>> &patches,
2059  const std::vector<std::string> & data_names,
2060  const std::vector<
2061  std::tuple<unsigned int,
2062  unsigned int,
2063  std::string,
2065  & nonscalar_data_ranges,
2066  const VtkFlags &flags,
2067  std::ostream & out);
2068 
2110  void
2112  std::ostream & out,
2113  const std::vector<std::string> &piece_names,
2114  const std::vector<std::string> &data_names,
2115  const std::vector<
2116  std::tuple<unsigned int,
2117  unsigned int,
2118  std::string,
2120  & nonscalar_data_ranges,
2121  const VtkFlags &flags);
2122 
2171  void
2173  std::ostream & out,
2174  const std::vector<std::pair<double, std::string>> &times_and_names);
2175 
2187  void
2188  write_visit_record(std::ostream & out,
2189  const std::vector<std::string> &piece_names);
2190 
2218  void
2219  write_visit_record(std::ostream & out,
2220  const std::vector<std::vector<std::string>> &piece_names);
2221 
2254  void
2256  std::ostream &out,
2257  const std::vector<std::pair<double, std::vector<std::string>>>
2258  &times_and_piece_names);
2259 
2280  template <int spacedim>
2281  void
2282  write_svg(
2283  const std::vector<Patch<2, spacedim>> &patches,
2284  const std::vector<std::string> & data_names,
2285  const std::vector<
2286  std::tuple<unsigned int,
2287  unsigned int,
2288  std::string,
2290  & nonscalar_data_ranges,
2291  const SvgFlags &flags,
2292  std::ostream & out);
2293 
2331  template <int dim, int spacedim>
2332  void
2334  const std::vector<Patch<dim, spacedim>> &patches,
2335  const std::vector<std::string> & data_names,
2336  const std::vector<
2337  std::tuple<unsigned int,
2338  unsigned int,
2339  std::string,
2341  & nonscalar_data_ranges,
2342  const Deal_II_IntermediateFlags &flags,
2343  std::ostream & out);
2344 
2349  template <int dim, int spacedim>
2350  void
2351  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2352  const DataOutFilter & data_filter,
2353  const std::string & filename,
2354  const MPI_Comm & comm);
2355 
2363  template <int dim, int spacedim>
2364  void
2365  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2366  const DataOutFilter & data_filter,
2367  const bool write_mesh_file,
2368  const std::string & mesh_filename,
2369  const std::string &solution_filename,
2370  const MPI_Comm & comm);
2371 
2378  template <int dim, int spacedim>
2379  void
2381  const std::vector<Patch<dim, spacedim>> &patches,
2382  const std::vector<std::string> & data_names,
2383  const std::vector<
2384  std::tuple<unsigned int,
2385  unsigned int,
2386  std::string,
2388  & nonscalar_data_ranges,
2389  DataOutFilter &filtered_data);
2390 
2402  std::pair<unsigned int, unsigned int>
2403  determine_intermediate_format_dimensions(std::istream &input);
2404 
2416  OutputFormat
2417  parse_output_format(const std::string &format_name);
2418 
2424  std::string
2426 
2447  std::string
2448  default_suffix(const OutputFormat output_format);
2449 
2459  int,
2460  int,
2461  << "The number of points in this data set is " << arg1
2462  << ", but we expected " << arg2
2463  << " in each space direction.");
2468  "You are trying to write graphical data into a file, but "
2469  "no data is available in the intermediate format that "
2470  "the DataOutBase functions require. Did you forget to "
2471  "call a function such as DataOut::build_patches()?");
2476  "The error code of one of the Tecplot functions was "
2477  "not zero as expected.");
2482  char *,
2483  << "There was an error opening Tecplot file " << arg1
2484  << " for output.");
2485 
2487 } // namespace DataOutBase
2488 
2489 
2490 
2597 template <int dim, int spacedim = dim>
2599 {
2600 public:
2604  DataOutInterface();
2605 
2610  virtual ~DataOutInterface() = default;
2611 
2616  void
2617  write_dx(std::ostream &out) const;
2618 
2623  void
2624  write_eps(std::ostream &out) const;
2625 
2630  void
2631  write_gmv(std::ostream &out) const;
2632 
2637  void
2638  write_gnuplot(std::ostream &out) const;
2639 
2644  void
2645  write_povray(std::ostream &out) const;
2646 
2651  void
2652  write_tecplot(std::ostream &out) const;
2653 
2658  void
2659  write_ucd(std::ostream &out) const;
2660 
2672  void
2673  write_vtk(std::ostream &out) const;
2674 
2689  void
2690  write_vtu(std::ostream &out) const;
2691 
2700  void
2701  write_vtu_in_parallel(const std::string &filename,
2702  const MPI_Comm & comm) const;
2703 
2737  void
2738  write_pvtu_record(std::ostream & out,
2739  const std::vector<std::string> &piece_names) const;
2740 
2799  std::string
2801  const std::string &directory,
2802  const std::string &filename_without_extension,
2803  const unsigned int counter,
2804  const MPI_Comm & mpi_communicator,
2805  const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2806  const unsigned int n_groups = 0) const;
2807 
2812  void
2813  write_svg(std::ostream &out) const;
2814 
2825  void
2826  write_deal_II_intermediate(std::ostream &out) const;
2827 
2833  XDMFEntry
2834  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2835  const std::string & h5_filename,
2836  const double cur_time,
2837  const MPI_Comm & comm) const;
2838 
2844  XDMFEntry
2845  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
2846  const std::string & h5_mesh_filename,
2847  const std::string & h5_solution_filename,
2848  const double cur_time,
2849  const MPI_Comm & comm) const;
2850 
2875  void
2876  write_xdmf_file(const std::vector<XDMFEntry> &entries,
2877  const std::string & filename,
2878  const MPI_Comm & comm) const;
2879 
2894  void
2896  const std::string & filename,
2897  const MPI_Comm & comm) const;
2898 
2906  void
2908  const bool write_mesh_file,
2909  const std::string & mesh_filename,
2910  const std::string & solution_filename,
2911  const MPI_Comm & comm) const;
2912 
2919  void
2920  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2921 
2922 
2931  void
2932  write(std::ostream & out,
2933  const DataOutBase::OutputFormat output_format =
2935 
2940  void
2942 
2943 
2948  template <typename FlagType>
2949  void
2950  set_flags(const FlagType &flags);
2951 
2952 
2960  std::string
2961  default_suffix(const DataOutBase::OutputFormat output_format =
2963 
2978  static void
2980 
2988  void
2990 
2996  std::size_t
2997  memory_consumption() const;
2998 
2999 protected:
3007  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
3008  get_patches() const = 0;
3009 
3014  virtual std::vector<std::string>
3015  get_dataset_names() const = 0;
3016 
3035  virtual std::vector<
3036  std::tuple<unsigned int,
3037  unsigned int,
3038  std::string,
3040  get_nonscalar_data_ranges() const;
3041 
3048  void
3049  validate_dataset_names() const;
3050 
3051 
3057  unsigned int default_subdivisions;
3058 
3059 private:
3066 
3072 
3078 
3084 
3090 
3096 
3102 
3108 
3114 
3120 
3126 };
3127 
3128 
3129 
3175 template <int dim, int spacedim = dim>
3176 class DataOutReader : public DataOutInterface<dim, spacedim>
3177 {
3178 public:
3184  void
3185  read(std::istream &in);
3186 
3208  void
3209  merge(const DataOutReader<dim, spacedim> &other);
3210 
3215  "You are trying to merge two sets of patches for which the "
3216  "declared names of the variables do not match.");
3221  "You are trying to merge two sets of patches for which the "
3222  "number of subdivisions or the number of vector components "
3223  "do not match.");
3228  int,
3229  int,
3230  int,
3231  int,
3232  << "Either the dimensions <" << arg1 << "> and <" << arg2
3233  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3234  << "> do not match!");
3235 
3236 protected:
3245  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3246  get_patches() const override;
3247 
3254  virtual std::vector<std::string>
3255  get_dataset_names() const override;
3256 
3275  virtual std::vector<
3276  std::tuple<unsigned int,
3277  unsigned int,
3278  std::string,
3280  get_nonscalar_data_ranges() const override;
3281 
3282 private:
3287  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3288  std::vector<std::string> dataset_names;
3289 
3294  std::vector<
3295  std::tuple<unsigned int,
3296  unsigned int,
3297  std::string,
3300 };
3301 
3302 
3303 
3312 {
3313 public:
3317  XDMFEntry();
3318 
3324  XDMFEntry(const std::string & filename,
3325  const double time,
3326  const std::uint64_t nodes,
3327  const std::uint64_t cells,
3328  const unsigned int dim);
3329 
3334  XDMFEntry(const std::string & mesh_filename,
3335  const std::string & solution_filename,
3336  const double time,
3337  const std::uint64_t nodes,
3338  const std::uint64_t cells,
3339  const unsigned int dim);
3340 
3344  XDMFEntry(const std::string & mesh_filename,
3345  const std::string & solution_filename,
3346  const double time,
3347  const std::uint64_t nodes,
3348  const std::uint64_t cells,
3349  const unsigned int dim,
3350  const unsigned int spacedim);
3351 
3355  void
3356  add_attribute(const std::string &attr_name, const unsigned int dimension);
3357 
3363  template <class Archive>
3364  void
3365  serialize(Archive &ar, const unsigned int /*version*/)
3366  {
3369  }
3370 
3379  std::string
3380  get_xdmf_content(const unsigned int indent_level) const;
3381 
3386  std::string
3387  get_xdmf_content(const unsigned int indent_level,
3388  const ReferenceCell &reference_cell) const;
3389 
3390 private:
3394  bool valid;
3395 
3399  std::string h5_sol_filename;
3400 
3404  std::string h5_mesh_filename;
3405 
3409  double entry_time;
3410 
3414  std::uint64_t num_nodes;
3415 
3419  std::uint64_t num_cells;
3420 
3424  unsigned int dimension;
3425 
3430  unsigned int space_dimension;
3431 
3435  std::map<std::string, unsigned int> attribute_dims;
3436 };
3437 
3438 
3439 
3440 /* -------------------- inline functions ------------------- */
3441 
3442 namespace DataOutBase
3443 {
3444  inline bool
3446  {
3447  return (red == green) && (red == blue);
3448  }
3449 
3450 
3451  /* -------------------- template functions ------------------- */
3452 
3459  template <int dim, int spacedim>
3460  std::ostream &
3461  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3462 
3463 
3464 
3471  template <int dim, int spacedim>
3472  std::istream &
3473  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3474 } // namespace DataOutBase
3475 
3476 
3478 
3479 #endif
#define DEAL_II_DEPRECATED
Definition: config.h:164
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:416
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:417
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
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::string get_xdmf_content(const unsigned int indent_level) const
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