Reference documentation for deal.II version Git 7026f387cc 2019-10-15 14:19:01 -0400
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
data_out_base.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2019 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 
22 #include <deal.II/base/geometry_info.h>
23 #include <deal.II/base/mpi.h>
24 #include <deal.II/base/point.h>
25 #include <deal.II/base/table.h>
26 
27 #include <deal.II/numerics/data_component_interpretation.h>
28 
29 // To be able to serialize XDMFEntry
30 #include <boost/serialization/map.hpp>
31 
32 #include <limits>
33 #include <string>
34 #include <tuple>
35 #include <typeinfo>
36 #include <vector>
37 
38 // Only include the Tecplot API header if the appropriate files
39 // were detected by configure
40 #ifdef DEAL_II_HAVE_TECPLOT
41 # include <string.h>
42 
43 # include "TECIO.h"
44 #endif
45 
46 #include <ostream>
47 
48 DEAL_II_NAMESPACE_OPEN
49 
50 // Forward declarations
51 #ifndef DOXYGEN
52 class ParameterHandler;
53 class XDMFEntry;
54 #endif
55 
221 namespace DataOutBase
222 {
247  template <int dim, int spacedim = dim>
248  struct Patch
249  {
253  static const unsigned int space_dim = spacedim;
254 
268 
275  unsigned int neighbors[dim > 0 ? GeometryInfo<dim>::faces_per_cell : 1];
276 
281  unsigned int patch_index;
282 
288  unsigned int n_subdivisions;
289 
312 
326 
331  Patch();
332 
337  bool
338  operator==(const Patch &patch) const;
339 
346  std::size_t
347  memory_consumption() const;
348 
352  void
353  swap(Patch<dim, spacedim> &other_patch);
354 
358  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
359 
370  int,
371  int,
372  << "It is not possible to have a structural dimension of " << arg1
373  << " to be larger than the space dimension of the surrounding"
374  << " space " << arg2);
376  };
377 
378 
379 
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  Patch();
479 
484  bool
485  operator==(const Patch &patch) const;
486 
493  std::size_t
494  memory_consumption() const;
495 
499  void swap(Patch<0, spacedim> &other_patch);
500 
504  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
505 
516  int,
517  int,
518  << "It is not possible to have a structural dimension of " << arg1
519  << " to be larger than the space dimension of the surrounding"
520  << " space " << arg2);
522  };
523 
524 
536  template <typename FlagsType>
538  {
546  static void
547  declare_parameters(ParameterHandler &prm);
548 
556  void
557  parse_parameters(const ParameterHandler &prm);
558 
565  std::size_t
566  memory_consumption() const;
567  };
568 
569 
570  template <typename FlagsType>
571  void
573  {}
574 
575 
576  template <typename FlagsType>
577  void
579  {}
580 
581 
582  template <typename FlagsType>
583  std::size_t
585  {
586  return sizeof(FlagsType);
587  }
588 
589 
595  struct DXFlags : public OutputFlagsBase<DXFlags>
596  {
611 
616 
622 
626  DXFlags(const bool write_neighbors = false,
627  const bool int_binary = false,
628  const bool coordinates_binary = false,
629  const bool data_binary = false);
630 
635  static void
636  declare_parameters(ParameterHandler &prm);
637 
644  void
645  parse_parameters(const ParameterHandler &prm);
646  };
647 
653  struct UcdFlags : public OutputFlagsBase<UcdFlags>
654  {
665 
669  UcdFlags(const bool write_preamble = false);
670 
675  static void
676  declare_parameters(ParameterHandler &prm);
677 
684  void
685  parse_parameters(const ParameterHandler &prm);
686  };
687 
693  struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
694  {
699  GnuplotFlags();
700 
704  GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
705 
721  std::vector<std::string> space_dimension_labels;
722 
727  std::size_t
728  memory_consumption() const;
729 
734  DeclExceptionMsg(ExcNotEnoughSpaceDimensionLabels,
735  "There should be at least one space dimension per spatial "
736  "dimension (extras are ignored).");
737  };
738 
745  struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
746  {
752  bool smooth;
753 
760 
768 
772  PovrayFlags(const bool smooth = false,
773  const bool bicubic_patch = false,
774  const bool external_data = false);
775 
780  static void
781  declare_parameters(ParameterHandler &prm);
782 
789  void
790  parse_parameters(const ParameterHandler &prm);
791  };
792 
793 
800  struct EpsFlags : public OutputFlagsBase<EpsFlags>
801  {
808  unsigned int height_vector;
809 
814  unsigned int color_vector;
815 
821  enum SizeType
822  {
826  height
827  };
828 
833 
841  unsigned int size;
842 
846  double line_width;
847 
853  double azimut_angle;
854 
878  double turn_angle;
879 
890  double z_scaling;
891 
898  bool draw_mesh;
899 
917 
927 
931  struct RgbValues
932  {
933  float red;
934  float green;
935  float blue;
936 
941  bool
942  is_grey() const;
943  };
944 
952  using ColorFunction = RgbValues (*)(const double value,
953  const double min_value,
954  const double max_value);
955 
962 
963 
972  static RgbValues
973  default_color_function(const double value,
974  const double min_value,
975  const double max_value);
976 
982  static RgbValues
983  grey_scale_color_function(const double value,
984  const double min_value,
985  const double max_value);
986 
993  static RgbValues
994  reverse_grey_scale_color_function(const double value,
995  const double min_value,
996  const double max_value);
997 
1001  EpsFlags(const unsigned int height_vector = 0,
1002  const unsigned int color_vector = 0,
1003  const SizeType size_type = width,
1004  const unsigned int size = 300,
1005  const double line_width = 0.5,
1006  const double azimut_angle = 60,
1007  const double turn_angle = 30,
1008  const double z_scaling = 1.0,
1009  const bool draw_mesh = true,
1010  const bool draw_cells = true,
1011  const bool shade_cells = true,
1012  const ColorFunction color_function = &default_color_function);
1013 
1021  static void
1022  declare_parameters(ParameterHandler &prm);
1023 
1030  void
1031  parse_parameters(const ParameterHandler &prm);
1032  };
1033 
1040  struct GmvFlags : public OutputFlagsBase<GmvFlags>
1041  {};
1042 
1048  struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
1049  {
1057  DEAL_II_DEPRECATED const char *tecplot_binary_file_name;
1058 
1063  const char *zone_name;
1064 
1071 
1078  DEAL_II_DEPRECATED
1079  TecplotFlags(const char * tecplot_binary_file_name = nullptr,
1080  const char * zone_name = nullptr,
1081  const double solution_time = -1.0);
1082 
1087  std::size_t
1088  memory_consumption() const;
1089  };
1090 
1096  struct VtkFlags : public OutputFlagsBase<VtkFlags>
1097  {
1108  double time;
1109 
1120  unsigned int cycle;
1121 
1129 
1135  {
1153  default_compression
1154  };
1155 
1161 
1180 
1184  VtkFlags(
1185  const double time = std::numeric_limits<double>::min(),
1186  const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
1187  const bool print_date_and_time = true,
1188  const ZlibCompressionLevel compression_level = best_compression,
1189  const bool write_higher_order_cells = false);
1190  };
1191 
1192 
1198  struct SvgFlags : public OutputFlagsBase<SvgFlags>
1199  {
1203  unsigned int height;
1204 
1209  unsigned int width;
1210 
1217  unsigned int height_vector;
1218 
1222  int azimuth_angle, polar_angle;
1223 
1224  unsigned int line_thickness;
1225 
1229  bool margin;
1230 
1235 
1239  SvgFlags(const unsigned int height_vector = 0,
1240  const int azimuth_angle = 37,
1241  const int polar_angle = 45,
1242  const unsigned int line_thickness = 1,
1243  const bool margin = true,
1244  const bool draw_colorbar = true);
1245  };
1246 
1247 
1255  : public OutputFlagsBase<Deal_II_IntermediateFlags>
1256  {
1263  static const unsigned int format_version;
1264  };
1265 
1272  {
1282 
1288 
1292  DataOutFilterFlags(const bool filter_duplicate_vertices = false,
1293  const bool xdmf_hdf5_output = false);
1294 
1299  static void
1300  declare_parameters(ParameterHandler &prm);
1301 
1308  void
1309  parse_parameters(const ParameterHandler &prm);
1310 
1315  std::size_t
1316  memory_consumption() const;
1317  };
1318 
1341  {
1342  public:
1346  DataOutFilter();
1347 
1353 
1359  template <int dim>
1360  void
1361  write_point(const unsigned int index, const Point<dim> &p);
1362 
1366  template <int dim>
1367  void
1368  write_cell(const unsigned int index,
1369  const unsigned int start,
1370  const unsigned int d1,
1371  const unsigned int d2,
1372  const unsigned int d3);
1373 
1380  void
1381  write_data_set(const std::string & name,
1382  const unsigned int dimension,
1383  const unsigned int set_num,
1384  const Table<2, double> &data_vectors);
1385 
1390  void
1391  fill_node_data(std::vector<double> &node_data) const;
1392 
1397  void
1398  fill_cell_data(const unsigned int local_node_offset,
1399  std::vector<unsigned int> &cell_data) const;
1400 
1404  std::string
1405  get_data_set_name(const unsigned int set_num) const;
1406 
1410  unsigned int
1411  get_data_set_dim(const unsigned int set_num) const;
1412 
1417  const double *
1418  get_data_set(const unsigned int set_num) const;
1419 
1424  unsigned int
1425  n_nodes() const;
1426 
1431  unsigned int
1432  n_cells() const;
1433 
1438  unsigned int
1439  n_data_sets() const;
1440 
1444  void
1445  flush_points();
1446 
1450  void
1451  flush_cells();
1452 
1453 
1454  private:
1458  struct Point3Comp
1459  {
1460  bool
1461  operator()(const Point<3> &one, const Point<3> &two) const
1462  {
1463  /*
1464  * The return statement below is an optimized version of the following
1465  * code:
1466  *
1467  * for (unsigned int d=0; d<3; ++d)
1468  * {
1469  * if (one(d) < two(d))
1470  * return true;
1471  * else if (one(d) > two(d))
1472  * return false;
1473  * }
1474  * return false;
1475  */
1476 
1477  return (one(0) < two(0) ||
1478  (!(two(0) < one(0)) &&
1479  (one(1) < two(1) || (!(two(1) < one(1)) && one(2) < two(2)))));
1480  }
1481  };
1482 
1483  using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1484 
1489 
1496  unsigned int node_dim;
1497 
1504  unsigned int vertices_per_cell;
1505 
1509  Map3DPoint existing_points;
1510 
1514  std::map<unsigned int, unsigned int> filtered_points;
1515 
1519  std::map<unsigned int, unsigned int> filtered_cells;
1520 
1524  std::vector<std::string> data_set_names;
1525 
1529  std::vector<unsigned int> data_set_dims;
1530 
1534  std::vector<std::vector<double>> data_sets;
1535 
1539  void
1540  internal_add_cell(const unsigned int cell_index,
1541  const unsigned int pt_index);
1542  };
1543 
1544 
1549  {
1554 
1559 
1564 
1569 
1574 
1579 
1584 
1589 
1594 
1602 
1607 
1612 
1617 
1622 
1627  };
1628 
1634  template <int dim, int spacedim>
1635  DEAL_II_DEPRECATED void
1636  write_dx(
1637  const std::vector<Patch<dim, spacedim>> &patches,
1638  const std::vector<std::string> & data_names,
1639  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1640  & nonscalar_data_ranges,
1641  const DXFlags &flags,
1642  std::ostream & out);
1643 
1647  template <int dim, int spacedim>
1648  void
1649  write_dx(
1650  const std::vector<Patch<dim, spacedim>> &patches,
1651  const std::vector<std::string> & data_names,
1652  const std::vector<
1653  std::tuple<unsigned int,
1654  unsigned int,
1655  std::string,
1657  & nonscalar_data_ranges,
1658  const DXFlags &flags,
1659  std::ostream & out);
1660 
1666  template <int spacedim>
1667  DEAL_II_DEPRECATED void
1668  write_eps(
1669  const std::vector<Patch<2, spacedim>> &patches,
1670  const std::vector<std::string> & data_names,
1671  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1672  & nonscalar_data_ranges,
1673  const EpsFlags &flags,
1674  std::ostream & out);
1675 
1683  template <int dim, int spacedim>
1684  DEAL_II_DEPRECATED void
1685  write_eps(
1686  const std::vector<Patch<dim, spacedim>> &patches,
1687  const std::vector<std::string> & data_names,
1688  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1689  & nonscalar_data_ranges,
1690  const EpsFlags &flags,
1691  std::ostream & out);
1692 
1737  template <int spacedim>
1738  void
1739  write_eps(
1740  const std::vector<Patch<2, spacedim>> &patches,
1741  const std::vector<std::string> & data_names,
1742  const std::vector<
1743  std::tuple<unsigned int,
1744  unsigned int,
1745  std::string,
1747  & nonscalar_data_ranges,
1748  const EpsFlags &flags,
1749  std::ostream & out);
1750 
1758  template <int dim, int spacedim>
1759  DEAL_II_DEPRECATED void
1760  write_eps(
1761  const std::vector<Patch<dim, spacedim>> &patches,
1762  const std::vector<std::string> & data_names,
1763  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1764  & nonscalar_data_ranges,
1765  const EpsFlags &flags,
1766  std::ostream & out);
1767 
1773  template <int dim, int spacedim>
1774  void
1775  write_eps(
1776  const std::vector<Patch<dim, spacedim>> &patches,
1777  const std::vector<std::string> & data_names,
1778  const std::vector<
1779  std::tuple<unsigned int,
1780  unsigned int,
1781  std::string,
1783  & nonscalar_data_ranges,
1784  const EpsFlags &flags,
1785  std::ostream & out);
1786 
1792  template <int dim, int spacedim>
1793  DEAL_II_DEPRECATED void
1794  write_gmv(
1795  const std::vector<Patch<dim, spacedim>> &patches,
1796  const std::vector<std::string> & data_names,
1797  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1798  & nonscalar_data_ranges,
1799  const GmvFlags &flags,
1800  std::ostream & out);
1801 
1811  template <int dim, int spacedim>
1812  void
1813  write_gmv(
1814  const std::vector<Patch<dim, spacedim>> &patches,
1815  const std::vector<std::string> & data_names,
1816  const std::vector<
1817  std::tuple<unsigned int,
1818  unsigned int,
1819  std::string,
1821  & nonscalar_data_ranges,
1822  const GmvFlags &flags,
1823  std::ostream & out);
1824 
1830  template <int dim, int spacedim>
1831  DEAL_II_DEPRECATED void
1832  write_gnuplot(
1833  const std::vector<Patch<dim, spacedim>> &patches,
1834  const std::vector<std::string> & data_names,
1835  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1836  & nonscalar_data_ranges,
1837  const GnuplotFlags &flags,
1838  std::ostream & out);
1839 
1896  template <int dim, int spacedim>
1897  void
1898  write_gnuplot(
1899  const std::vector<Patch<dim, spacedim>> &patches,
1900  const std::vector<std::string> & data_names,
1901  const std::vector<
1902  std::tuple<unsigned int,
1903  unsigned int,
1904  std::string,
1906  & nonscalar_data_ranges,
1907  const GnuplotFlags &flags,
1908  std::ostream & out);
1909 
1916  template <int dim, int spacedim>
1917  DEAL_II_DEPRECATED void
1918  write_povray(
1919  const std::vector<Patch<dim, spacedim>> &patches,
1920  const std::vector<std::string> & data_names,
1921  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1922  & nonscalar_data_ranges,
1923  const PovrayFlags &flags,
1924  std::ostream & out);
1925 
1971  template <int dim, int spacedim>
1972  void
1973  write_povray(
1974  const std::vector<Patch<dim, spacedim>> &patches,
1975  const std::vector<std::string> & data_names,
1976  const std::vector<
1977  std::tuple<unsigned int,
1978  unsigned int,
1979  std::string,
1981  & nonscalar_data_ranges,
1982  const PovrayFlags &flags,
1983  std::ostream & out);
1984 
1993  template <int dim, int spacedim>
1994  DEAL_II_DEPRECATED void
1995  write_tecplot(
1996  const std::vector<Patch<dim, spacedim>> &patches,
1997  const std::vector<std::string> & data_names,
1998  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
1999  & nonscalar_data_ranges,
2000  const TecplotFlags &flags,
2001  std::ostream & out);
2002 
2009  template <int dim, int spacedim>
2010  void
2011  write_tecplot(
2012  const std::vector<Patch<dim, spacedim>> &patches,
2013  const std::vector<std::string> & data_names,
2014  const std::vector<
2015  std::tuple<unsigned int,
2016  unsigned int,
2017  std::string,
2019  & nonscalar_data_ranges,
2020  const TecplotFlags &flags,
2021  std::ostream & out);
2022 
2029  template <int dim, int spacedim>
2030  DEAL_II_DEPRECATED void
2032  const std::vector<Patch<dim, spacedim>> &patches,
2033  const std::vector<std::string> & data_names,
2034  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2035  & nonscalar_data_ranges,
2036  const TecplotFlags &flags,
2037  std::ostream & out);
2038 
2060  template <int dim, int spacedim>
2061  DEAL_II_DEPRECATED void
2063  const std::vector<Patch<dim, spacedim>> &patches,
2064  const std::vector<std::string> & data_names,
2065  const std::vector<
2066  std::tuple<unsigned int,
2067  unsigned int,
2068  std::string,
2070  & nonscalar_data_ranges,
2071  const TecplotFlags &flags,
2072  std::ostream & out);
2073 
2080  template <int dim, int spacedim>
2081  DEAL_II_DEPRECATED void
2082  write_ucd(
2083  const std::vector<Patch<dim, spacedim>> &patches,
2084  const std::vector<std::string> & data_names,
2085  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2086  & nonscalar_data_ranges,
2087  const UcdFlags &flags,
2088  std::ostream & out);
2089 
2104  template <int dim, int spacedim>
2105  void
2106  write_ucd(
2107  const std::vector<Patch<dim, spacedim>> &patches,
2108  const std::vector<std::string> & data_names,
2109  const std::vector<
2110  std::tuple<unsigned int,
2111  unsigned int,
2112  std::string,
2114  & nonscalar_data_ranges,
2115  const UcdFlags &flags,
2116  std::ostream & out);
2117 
2125  template <int dim, int spacedim>
2126  DEAL_II_DEPRECATED void
2127  write_vtk(
2128  const std::vector<Patch<dim, spacedim>> &patches,
2129  const std::vector<std::string> & data_names,
2130  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2131  & nonscalar_data_ranges,
2132  const VtkFlags &flags,
2133  std::ostream & out);
2134 
2154  template <int dim, int spacedim>
2155  void
2156  write_vtk(
2157  const std::vector<Patch<dim, spacedim>> &patches,
2158  const std::vector<std::string> & data_names,
2159  const std::vector<
2160  std::tuple<unsigned int,
2161  unsigned int,
2162  std::string,
2164  & nonscalar_data_ranges,
2165  const VtkFlags &flags,
2166  std::ostream & out);
2167 
2175  template <int dim, int spacedim>
2176  DEAL_II_DEPRECATED void
2177  write_vtu(
2178  const std::vector<Patch<dim, spacedim>> &patches,
2179  const std::vector<std::string> & data_names,
2180  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2181  & nonscalar_data_ranges,
2182  const VtkFlags &flags,
2183  std::ostream & out);
2184 
2208  template <int dim, int spacedim>
2209  void
2210  write_vtu(
2211  const std::vector<Patch<dim, spacedim>> &patches,
2212  const std::vector<std::string> & data_names,
2213  const std::vector<
2214  std::tuple<unsigned int,
2215  unsigned int,
2216  std::string,
2218  & nonscalar_data_ranges,
2219  const VtkFlags &flags,
2220  std::ostream & out);
2221 
2227  void
2228  write_vtu_header(std::ostream &out, const VtkFlags &flags);
2229 
2236  void
2237  write_vtu_footer(std::ostream &out);
2238 
2247  template <int dim, int spacedim>
2248  DEAL_II_DEPRECATED void
2250  const std::vector<Patch<dim, spacedim>> &patches,
2251  const std::vector<std::string> & data_names,
2252  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2253  & nonscalar_data_ranges,
2254  const VtkFlags &flags,
2255  std::ostream & out);
2256 
2263  template <int dim, int spacedim>
2264  void
2266  const std::vector<Patch<dim, spacedim>> &patches,
2267  const std::vector<std::string> & data_names,
2268  const std::vector<
2269  std::tuple<unsigned int,
2270  unsigned int,
2271  std::string,
2273  & nonscalar_data_ranges,
2274  const VtkFlags &flags,
2275  std::ostream & out);
2276 
2287  DEAL_II_DEPRECATED
2288  void
2290  std::ostream & out,
2291  const std::vector<std::string> &piece_names,
2292  const std::vector<std::string> &data_names,
2293  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2294  &nonscalar_data_ranges);
2295 
2337  void
2339  std::ostream & out,
2340  const std::vector<std::string> &piece_names,
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 
2399  void
2401  std::ostream & out,
2402  const std::vector<std::pair<double, std::string>> &times_and_names);
2403 
2415  void
2416  write_visit_record(std::ostream & out,
2417  const std::vector<std::string> &piece_names);
2418 
2446  void
2447  write_visit_record(std::ostream & out,
2448  const std::vector<std::vector<std::string>> &piece_names);
2449 
2482  void
2484  std::ostream &out,
2485  const std::vector<std::pair<double, std::vector<std::string>>>
2486  &times_and_piece_names);
2487 
2493  template <int spacedim>
2494  DEAL_II_DEPRECATED void
2495  write_svg(
2496  const std::vector<Patch<2, spacedim>> &patches,
2497  const std::vector<std::string> & data_names,
2498  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2499  & nonscalar_data_ranges,
2500  const SvgFlags &flags,
2501  std::ostream & out);
2502 
2523  template <int spacedim>
2524  void
2525  write_svg(
2526  const std::vector<Patch<2, spacedim>> &patches,
2527  const std::vector<std::string> & data_names,
2528  const std::vector<
2529  std::tuple<unsigned int,
2530  unsigned int,
2531  std::string,
2533  & nonscalar_data_ranges,
2534  const SvgFlags &flags,
2535  std::ostream & out);
2536 
2548  template <int dim, int spacedim>
2549  DEAL_II_DEPRECATED void
2551  const std::vector<Patch<dim, spacedim>> &patches,
2552  const std::vector<std::string> & data_names,
2553  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2554  & nonscalar_data_ranges,
2555  const Deal_II_IntermediateFlags &flags,
2556  std::ostream & out);
2557 
2595  template <int dim, int spacedim>
2596  void
2598  const std::vector<Patch<dim, spacedim>> &patches,
2599  const std::vector<std::string> & data_names,
2600  const std::vector<
2601  std::tuple<unsigned int,
2602  unsigned int,
2603  std::string,
2605  & nonscalar_data_ranges,
2606  const Deal_II_IntermediateFlags &flags,
2607  std::ostream & out);
2608 
2613  template <int dim, int spacedim>
2614  void
2615  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2616  const DataOutFilter & data_filter,
2617  const std::string & filename,
2618  MPI_Comm comm);
2619 
2627  template <int dim, int spacedim>
2628  void
2629  write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2630  const DataOutFilter & data_filter,
2631  const bool write_mesh_file,
2632  const std::string & mesh_filename,
2633  const std::string &solution_filename,
2634  MPI_Comm comm);
2635 
2644  template <int dim, int spacedim>
2645  DEAL_II_DEPRECATED void
2647  const std::vector<Patch<dim, spacedim>> &patches,
2648  const std::vector<std::string> & data_names,
2649  const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
2650  & nonscalar_data_ranges,
2651  DataOutFilter &filtered_data);
2652 
2659  template <int dim, int spacedim>
2660  void
2662  const std::vector<Patch<dim, spacedim>> &patches,
2663  const std::vector<std::string> & data_names,
2664  const std::vector<
2665  std::tuple<unsigned int,
2666  unsigned int,
2667  std::string,
2669  & nonscalar_data_ranges,
2670  DataOutFilter &filtered_data);
2671 
2683  std::pair<unsigned int, unsigned int>
2684  determine_intermediate_format_dimensions(std::istream &input);
2685 
2697  OutputFormat
2698  parse_output_format(const std::string &format_name);
2699 
2705  std::string
2707 
2728  std::string
2729  default_suffix(const OutputFormat output_format);
2730 
2740  int,
2741  int,
2742  << "The number of points in this data set is " << arg1
2743  << ", but we expected " << arg2
2744  << " in each space direction.");
2749  "You are trying to write graphical data into a file, but "
2750  "no data is available in the intermediate format that "
2751  "the DataOutBase functions require. Did you forget to "
2752  "call a function such as DataOut::build_patches()?");
2757  "The error code of one of the Tecplot functions was "
2758  "not zero as expected.");
2763  char *,
2764  << "There was an error opening Tecplot file " << arg1
2765  << " for output.");
2766 
2768 } // namespace DataOutBase
2769 
2770 
2771 
2879 template <int dim, int spacedim = dim>
2881 {
2882 public:
2886  DataOutInterface();
2887 
2892  virtual ~DataOutInterface() = default;
2893 
2898  void
2899  write_dx(std::ostream &out) const;
2900 
2905  void
2906  write_eps(std::ostream &out) const;
2907 
2912  void
2913  write_gmv(std::ostream &out) const;
2914 
2919  void
2920  write_gnuplot(std::ostream &out) const;
2921 
2926  void
2927  write_povray(std::ostream &out) const;
2928 
2933  void
2934  write_tecplot(std::ostream &out) const;
2935 
2943  DEAL_II_DEPRECATED
2944  void
2945  write_tecplot_binary(std::ostream &out) const;
2946 
2951  void
2952  write_ucd(std::ostream &out) const;
2953 
2965  void
2966  write_vtk(std::ostream &out) const;
2967 
2982  void
2983  write_vtu(std::ostream &out) const;
2984 
2993  void
2994  write_vtu_in_parallel(const std::string &filename, MPI_Comm comm) const;
2995 
3029  void
3030  write_pvtu_record(std::ostream & out,
3031  const std::vector<std::string> &piece_names) const;
3032 
3037  void
3038  write_svg(std::ostream &out) const;
3039 
3050  void
3051  write_deal_II_intermediate(std::ostream &out) const;
3052 
3058  XDMFEntry
3059  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
3060  const std::string & h5_filename,
3061  const double cur_time,
3062  MPI_Comm comm) const;
3063 
3069  XDMFEntry
3070  create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter,
3071  const std::string & h5_mesh_filename,
3072  const std::string & h5_solution_filename,
3073  const double cur_time,
3074  MPI_Comm comm) const;
3075 
3100  void
3101  write_xdmf_file(const std::vector<XDMFEntry> &entries,
3102  const std::string & filename,
3103  MPI_Comm comm) const;
3104 
3119  void
3121  const std::string & filename,
3122  MPI_Comm comm) const;
3123 
3131  void
3133  const bool write_mesh_file,
3134  const std::string & mesh_filename,
3135  const std::string & solution_filename,
3136  MPI_Comm comm) const;
3137 
3144  void
3145  write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
3146 
3147 
3156  void
3157  write(std::ostream & out,
3158  const DataOutBase::OutputFormat output_format =
3160 
3165  void
3166  set_default_format(const DataOutBase::OutputFormat default_format);
3167 
3168 
3173  template <typename FlagType>
3174  void
3175  set_flags(const FlagType &flags);
3176 
3177 
3185  std::string
3186  default_suffix(const DataOutBase::OutputFormat output_format =
3188 
3203  static void
3204  declare_parameters(ParameterHandler &prm);
3205 
3213  void
3214  parse_parameters(ParameterHandler &prm);
3215 
3221  std::size_t
3222  memory_consumption() const;
3223 
3224 protected:
3232  virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
3233  get_patches() const = 0;
3234 
3239  virtual std::vector<std::string>
3240  get_dataset_names() const = 0;
3241 
3249  DEAL_II_DEPRECATED
3250  virtual std::vector<std::tuple<unsigned int, unsigned int, std::string>>
3251  get_vector_data_ranges() const;
3252 
3271  virtual std::vector<
3272  std::tuple<unsigned int,
3273  unsigned int,
3274  std::string,
3276  get_nonscalar_data_ranges() const;
3277 
3284  void
3285  validate_dataset_names() const;
3286 
3287 
3293  unsigned int default_subdivisions;
3294 
3295 private:
3302 
3308 
3314 
3320 
3326 
3332 
3338 
3344 
3350 
3356 
3362 };
3363 
3364 
3365 
3414 template <int dim, int spacedim = dim>
3415 class DataOutReader : public DataOutInterface<dim, spacedim>
3416 {
3417 public:
3423  void
3424  read(std::istream &in);
3425 
3449  void
3450  merge(const DataOutReader<dim, spacedim> &other);
3451 
3456  "You are trying to merge two sets of patches for which the "
3457  "declared names of the variables do not match.");
3462  "You are trying to merge two sets of patches for which the "
3463  "number of subdivisions or the number of vector components "
3464  "do not match.");
3468  DeclException4(ExcIncompatibleDimensions,
3469  int,
3470  int,
3471  int,
3472  int,
3473  << "Either the dimensions <" << arg1 << "> and <" << arg2
3474  << "> or the space dimensions <" << arg3 << "> and <" << arg4
3475  << "> do not match!");
3476 
3477 protected:
3486  virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3487  get_patches() const override;
3488 
3495  virtual std::vector<std::string>
3496  get_dataset_names() const override;
3497 
3516  virtual std::vector<
3517  std::tuple<unsigned int,
3518  unsigned int,
3519  std::string,
3521  get_nonscalar_data_ranges() const override;
3522 
3523 private:
3528  std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3529  std::vector<std::string> dataset_names;
3530 
3535  std::vector<
3536  std::tuple<unsigned int,
3537  unsigned int,
3538  std::string,
3541 };
3542 
3543 
3544 
3553 {
3554 public:
3558  XDMFEntry();
3559 
3565  XDMFEntry(const std::string &filename,
3566  const double time,
3567  const unsigned int nodes,
3568  const unsigned int cells,
3569  const unsigned int dim);
3570 
3575  XDMFEntry(const std::string &mesh_filename,
3576  const std::string &solution_filename,
3577  const double time,
3578  const unsigned int nodes,
3579  const unsigned int cells,
3580  const unsigned int dim);
3581 
3585  XDMFEntry(const std::string &mesh_filename,
3586  const std::string &solution_filename,
3587  const double time,
3588  const unsigned int nodes,
3589  const unsigned int cells,
3590  const unsigned int dim,
3591  const unsigned int spacedim);
3592 
3596  void
3597  add_attribute(const std::string &attr_name, const unsigned int dimension);
3598 
3602  template <class Archive>
3603  void
3604  serialize(Archive &ar, const unsigned int /*version*/)
3605  {
3606  ar &valid &h5_sol_filename &h5_mesh_filename &entry_time &num_nodes
3607  &num_cells &dimension &space_dimension &attribute_dims;
3608  }
3609 
3614  std::string
3615  get_xdmf_content(const unsigned int indent_level) const;
3616 
3617 private:
3621  bool valid;
3622 
3626  std::string h5_sol_filename;
3627 
3631  std::string h5_mesh_filename;
3632 
3636  double entry_time;
3637 
3641  unsigned int num_nodes;
3642 
3646  unsigned int num_cells;
3647 
3651  unsigned int dimension;
3652 
3657  unsigned int space_dimension;
3658 
3662  std::map<std::string, unsigned int> attribute_dims;
3663 };
3664 
3665 
3666 
3667 /* -------------------- inline functions ------------------- */
3668 
3669 namespace DataOutBase
3670 {
3671  inline bool
3673  {
3674  return (red == green) && (red == blue);
3675  }
3676 
3677 
3678  /* -------------------- template functions ------------------- */
3679 
3688  template <int dim, int spacedim>
3689  std::ostream &
3690  operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3691 
3692 
3693 
3702  template <int dim, int spacedim>
3703  std::istream &
3704  operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3705 } // namespace DataOutBase
3706 
3707 
3708 DEAL_II_NAMESPACE_CLOSE
3709 
3710 #endif
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static const unsigned int invalid_unsigned_int
Definition: types.h:187
unsigned int space_dimension
static ::ExceptionBase & ExcIncompatiblePatchLists()
unsigned int height_vector
void write_vtu_footer(std::ostream &out)
static void declare_parameters(ParameterHandler &prm)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:541
std::size_t memory_consumption() const
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 >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
std::map< unsigned int, unsigned int > filtered_cells
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 >> &nonscalar_data_ranges, const GmvFlags &flags, std::ostream &out)
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)
void swap(Patch< dim, spacedim > &other_patch)
void write_vtu_header(std::ostream &out, const VtkFlags &flags)
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 >> &nonscalar_data_ranges, const SvgFlags &flags, std::ostream &out)
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
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_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 >> &nonscalar_data_ranges, DataOutFilter &filtered_data)
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm)
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 >> &nonscalar_data_ranges, const TecplotFlags &flags, std::ostream &out)
const char * tecplot_binary_file_name
unsigned int neighbors[dim > 0 ? GeometryInfo< dim >::faces_per_cell :1]
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 >> &nonscalar_data_ranges, const Deal_II_IntermediateFlags &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:518
std::vector< std::string > data_set_names
void parse_parameters(const ParameterHandler &prm)
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 >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
void write_tecplot_binary(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 >> &nonscalar_data_ranges, const TecplotFlags &flags, std::ostream &out)
DataOutBase::Deal_II_IntermediateFlags deal_II_intermediate_flags
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
std::vector<::DataOutBase::Patch< dim, spacedim > > patches
OutputFormat parse_output_format(const std::string &format_name)
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 >> &nonscalar_data_ranges, const DXFlags &flags, std::ostream &out)
ColorFunction color_function
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
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
bool operator==(const Patch &patch) const
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 >> &nonscalar_data_ranges, const PovrayFlags &flags, std::ostream &out)
static const unsigned int no_neighbor
DataOutBase::GmvFlags gmv_flags
DataOutBase::VtkFlags vtk_flags
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 >> &nonscalar_data_ranges, const UcdFlags &flags, std::ostream &out)
static const unsigned int format_version
static const unsigned int space_dim
DataOutBase::GnuplotFlags gnuplot_flags
unsigned int num_nodes
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:587
unsigned int color_vector
static ::ExceptionBase & ExcInvalidCombinationOfDimensions(int arg1, int arg2)
DataOutBase::OutputFormat default_fmt
DataOutBase::EpsFlags eps_flags
DEAL_II_CONSTEXPR TableIndices< 2 > merge(const TableIndices< 2 > &previous_indices, const unsigned int new_index, const unsigned int position)
std::size_t memory_consumption() const
std::map< unsigned int, unsigned int > filtered_points
static unsigned int n_subdivisions
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 >> &nonscalar_data_ranges)
std::string get_output_format_names()
Table< 2, float > data
DataOutBase::UcdFlags ucd_flags
unsigned int height_vector
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 >> &nonscalar_data_ranges, const GnuplotFlags &flags, std::ostream &out)
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 >> &nonscalar_data_ranges, const VtkFlags &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 >> &nonscalar_data_ranges, const EpsFlags &flags, std::ostream &out)
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
DataOutBase::DXFlags dx_flags
static ::ExceptionBase & ExcTecplotAPIError()