Reference documentation for deal.II version 8.5.1
data_out_base.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2016 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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/point.h>
22 #include <deal.II/base/table.h>
23 #include <deal.II/base/geometry_info.h>
24 #include <deal.II/base/std_cxx11/tuple.h>
25 
26 #include <vector>
27 #include <string>
28 #include <limits>
29 #include <typeinfo>
30 
31 #include <deal.II/base/mpi.h>
32 
33 // Only include the Tecplot API header if the appropriate files
34 // were detected by configure
35 #ifdef DEAL_II_HAVE_TECPLOT
36 # include "TECIO.h"
37 # include <string.h>
38 #endif
39 
40 #include <ostream>
41 
42 DEAL_II_NAMESPACE_OPEN
43 
44 
45 class ParameterHandler;
46 class XDMFEntry;
47 
211 namespace DataOutBase
212 {
237  template <int dim, int spacedim=dim>
238  struct Patch
239  {
243  static const unsigned int space_dim=spacedim;
244 
258 
265  unsigned int neighbors[dim > 0
266  ?
268  :
269  1];
270 
275  unsigned int patch_index;
276 
282  unsigned int n_subdivisions;
283 
306 
320 
325  Patch ();
326 
331  bool operator == (const Patch &patch) const;
332 
339  std::size_t memory_consumption () const;
340 
344  void swap (Patch<dim,spacedim> &other_patch);
345 
349  static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
359  int, int,
360  << "It is not possible to have a structural dimension of " << arg1
361  << " to be larger than the space dimension of the surrounding"
362  << " space " << arg2);
364  };
365 
366 
378  template<typename FlagsType>
380  {
388  static void declare_parameters (ParameterHandler &prm);
389 
397  void parse_parameters (const ParameterHandler &prm);
398 
405  std::size_t memory_consumption () const;
406  };
407 
408 
409  template<typename FlagsType>
411  {}
412 
413 
414  template<typename FlagsType>
416  {}
417 
418 
419  template<typename FlagsType>
421  {
422  return sizeof(FlagsType);
423  }
424 
425 
431  struct DXFlags : public OutputFlagsBase<DXFlags>
432  {
447 
452 
458 
462  DXFlags (const bool write_neighbors = false,
463  const bool int_binary = false,
464  const bool coordinates_binary = false,
465  const bool data_binary = false);
466 
471  static void declare_parameters (ParameterHandler &prm);
472 
479  void parse_parameters (const ParameterHandler &prm);
480  };
481 
487  struct UcdFlags : public OutputFlagsBase<UcdFlags>
488  {
499 
503  UcdFlags (const bool write_preamble = false);
504 
509  static void declare_parameters (ParameterHandler &prm);
510 
517  void parse_parameters (const ParameterHandler &prm);
518  };
519 
525  struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
526  {
531  GnuplotFlags();
532 
536  GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
537 
553  std::vector<std::string> space_dimension_labels;
554 
559  std::size_t memory_consumption () const;
560 
566  "There should be at least one space dimension per spatial "
567  "dimension (extras are ignored).");
568  };
569 
576  struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
577  {
583  bool smooth;
584 
591 
599 
603  PovrayFlags (const bool smooth = false,
604  const bool bicubic_patch = false,
605  const bool external_data = false);
606 
611  static void declare_parameters (ParameterHandler &prm);
612 
619  void parse_parameters (const ParameterHandler &prm);
620  };
621 
622 
629  struct EpsFlags : public OutputFlagsBase<EpsFlags>
630  {
637  unsigned int height_vector;
638 
643  unsigned int color_vector;
644 
650  enum SizeType
651  {
656  };
657 
662 
670  unsigned int size;
671 
675  double line_width;
676 
682  double azimut_angle;
683 
707  double turn_angle;
708 
719  double z_scaling;
720 
727  bool draw_mesh;
728 
746 
756 
760  struct RgbValues
761  {
762  float red;
763  float green;
764  float blue;
765 
770  bool is_grey () const;
771  };
772 
780  typedef RgbValues (*ColorFunction) (const double value,
781  const double min_value,
782  const double max_value);
783 
790 
791 
800  static RgbValues
801  default_color_function (const double value,
802  const double min_value,
803  const double max_value);
804 
810  static RgbValues
811  grey_scale_color_function (const double value,
812  const double min_value,
813  const double max_value);
814 
821  static RgbValues
822  reverse_grey_scale_color_function (const double value,
823  const double min_value,
824  const double max_value);
825 
829  EpsFlags (const unsigned int height_vector = 0,
830  const unsigned int color_vector = 0,
831  const SizeType size_type = width,
832  const unsigned int size = 300,
833  const double line_width = 0.5,
834  const double azimut_angle = 60,
835  const double turn_angle = 30,
836  const double z_scaling = 1.0,
837  const bool draw_mesh = true,
838  const bool draw_cells = true,
839  const bool shade_cells = true,
841 
849  static void declare_parameters (ParameterHandler &prm);
850 
857  void parse_parameters (const ParameterHandler &prm);
858  };
859 
866  struct GmvFlags : public OutputFlagsBase<GmvFlags>
867  {};
868 
874  struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
875  {
882 
887  const char *zone_name;
888 
895 
899  TecplotFlags (const char *tecplot_binary_file_name = NULL,
900  const char *zone_name = NULL,
901  const double solution_time = -1.0);
902 
907  std::size_t memory_consumption () const;
908  };
909 
915  struct VtkFlags : public OutputFlagsBase<VtkFlags>
916  {
927  double time;
928 
939  unsigned int cycle;
940 
948 
954  {
973  };
974 
980 
984  VtkFlags (const double time = std::numeric_limits<double>::min(),
985  const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
986  const bool print_date_and_time = true,
988  };
989 
990 
996  struct SvgFlags : public OutputFlagsBase<SvgFlags>
997  {
1001  unsigned int height;
1002 
1007  unsigned int width;
1008 
1015  unsigned int height_vector;
1016 
1020  int azimuth_angle, polar_angle;
1021 
1022  unsigned int line_thickness;
1023 
1027  bool margin;
1028 
1033 
1037  SvgFlags(const unsigned int height_vector = 0,
1038  const int azimuth_angle = 37,
1039  const int polar_angle = 45,
1040  const unsigned int line_thickness = 1,
1041  const bool margin = true,
1042  const bool draw_colorbar = true);
1043  };
1044 
1045 
1052  struct Deal_II_IntermediateFlags : public OutputFlagsBase<Deal_II_IntermediateFlags>
1053  {
1060  static const unsigned int format_version;
1061  };
1062 
1070  {
1077 
1083 
1087  DataOutFilterFlags (const bool filter_duplicate_vertices = false,
1088  const bool xdmf_hdf5_output = false);
1089 
1094  static void declare_parameters (ParameterHandler &prm);
1095 
1102  void parse_parameters (const ParameterHandler &prm);
1103 
1108  std::size_t memory_consumption () const;
1109  };
1110 
1133  {
1134  private:
1138  struct Point3Comp
1139  {
1140  bool operator() (const Point<3> &lhs, const Point<3> &rhs) const
1141  {
1142  return (lhs(0) < rhs(0) || (!(rhs(0) < lhs(0)) && (lhs(1) < rhs(1) || (!(rhs(1) < lhs(1)) && lhs(2) < rhs(2)))));
1143  }
1144  };
1145 
1146  typedef std::multimap<Point<3>, unsigned int, Point3Comp> Map3DPoint;
1147 
1150 
1157  unsigned int node_dim;
1158 
1165  unsigned int vertices_per_cell;
1166 
1168  Map3DPoint existing_points;
1169 
1171  std::map<unsigned int, unsigned int> filtered_points;
1172 
1174  std::map<unsigned int, unsigned int> filtered_cells;
1175 
1177  std::vector<std::string> data_set_names;
1178 
1180  std::vector<unsigned int> data_set_dims;
1181 
1183  std::vector<std::vector<double> > data_sets;
1184 
1188  void internal_add_cell(const unsigned int &cell_index, const unsigned int &pt_index);
1189 
1190  public:
1191  DataOutFilter()
1192  :
1193  flags(false, true),
1194  node_dim (numbers::invalid_unsigned_int),
1195  vertices_per_cell (numbers::invalid_unsigned_int)
1196  {}
1197 
1199  :
1200  flags(flags),
1201  node_dim (numbers::invalid_unsigned_int),
1202  vertices_per_cell (numbers::invalid_unsigned_int)
1203  {}
1204 
1210  template<int dim>
1211  void write_point(const unsigned int &index, const Point<dim> &p);
1212 
1216  template<int dim>
1217  void write_cell(unsigned int index, unsigned int start, unsigned int d1, unsigned int d2, unsigned int d3);
1218 
1225  void write_data_set(const std::string &name, const unsigned int &dimension, const unsigned int &set_num, const Table<2,double> &data_vectors);
1226 
1231  void fill_node_data(std::vector<double> &node_data) const;
1232 
1237  void fill_cell_data(const unsigned int &local_node_offset, std::vector<unsigned int> &cell_data) const;
1238 
1242  std::string get_data_set_name(const unsigned int &set_num) const
1243  {
1244  return data_set_names.at(set_num);
1245  };
1246 
1250  unsigned int get_data_set_dim(const unsigned int &set_num) const
1251  {
1252  return data_set_dims.at(set_num);
1253  };
1254 
1259  const double *get_data_set(const unsigned int &set_num) const
1260  {
1261  return &data_sets[set_num][0];
1262  };
1263 
1268  unsigned int n_nodes() const
1269  {
1270  return existing_points.size();
1271  };
1272 
1277  unsigned int n_cells() const
1278  {
1279  return filtered_cells.size()/vertices_per_cell;
1280  };
1281 
1286  unsigned int n_data_sets() const
1287  {
1288  return data_set_names.size();
1289  };
1290 
1294  void flush_points () {};
1295 
1299  void flush_cells () {};
1300 
1301  };
1302 
1303 
1308  {
1351 
1356 
1361 
1366 
1371 
1376  };
1377 
1378 
1382  template <int dim, int spacedim>
1383  void write_dx (const std::vector<Patch<dim,spacedim> > &patches,
1384  const std::vector<std::string> &data_names,
1385  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1386  const DXFlags &flags,
1387  std::ostream &out);
1388 
1433  template <int spacedim>
1434  void write_eps (const std::vector<Patch<2,spacedim> > &patches,
1435  const std::vector<std::string> &data_names,
1436  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1437  const EpsFlags &flags,
1438  std::ostream &out);
1439 
1445  template <int dim, int spacedim>
1446  void write_eps (const std::vector<Patch<dim,spacedim> > &patches,
1447  const std::vector<std::string> &data_names,
1448  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1449  const EpsFlags &flags,
1450  std::ostream &out);
1451 
1452 
1462  template <int dim, int spacedim>
1463  void write_gmv (const std::vector<Patch<dim,spacedim> > &patches,
1464  const std::vector<std::string> &data_names,
1465  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1466  const GmvFlags &flags,
1467  std::ostream &out);
1468 
1525  template <int dim, int spacedim>
1526  void write_gnuplot (const std::vector<Patch<dim,spacedim> > &patches,
1527  const std::vector<std::string> &data_names,
1528  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1529  const GnuplotFlags &flags,
1530  std::ostream &out);
1531 
1577  template <int dim, int spacedim>
1578  void write_povray (const std::vector<Patch<dim,spacedim> > &patches,
1579  const std::vector<std::string> &data_names,
1580  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1581  const PovrayFlags &flags,
1582  std::ostream &out);
1583 
1590  template <int dim, int spacedim>
1591  void write_tecplot (const std::vector<Patch<dim,spacedim> > &patches,
1592  const std::vector<std::string> &data_names,
1593  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1594  const TecplotFlags &flags,
1595  std::ostream &out);
1596 
1616  template <int dim, int spacedim>
1617  void write_tecplot_binary (
1618  const std::vector<Patch<dim,spacedim> > &patches,
1619  const std::vector<std::string> &data_names,
1620  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1621  const TecplotFlags &flags,
1622  std::ostream &out);
1623 
1638  template <int dim, int spacedim>
1639  void write_ucd (const std::vector<Patch<dim,spacedim> > &patches,
1640  const std::vector<std::string> &data_names,
1641  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1642  const UcdFlags &flags,
1643  std::ostream &out);
1644 
1664  template <int dim, int spacedim>
1665  void write_vtk (const std::vector<Patch<dim,spacedim> > &patches,
1666  const std::vector<std::string> &data_names,
1667  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1668  const VtkFlags &flags,
1669  std::ostream &out);
1670 
1671 
1695  template <int dim, int spacedim>
1696  void write_vtu (const std::vector<Patch<dim,spacedim> > &patches,
1697  const std::vector<std::string> &data_names,
1698  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1699  const VtkFlags &flags,
1700  std::ostream &out);
1701 
1707  void write_vtu_header (std::ostream &out,
1708  const VtkFlags &flags);
1709 
1715  void write_vtu_footer (std::ostream &out);
1716 
1722  template <int dim, int spacedim>
1723  void write_vtu_main (const std::vector<Patch<dim,spacedim> > &patches,
1724  const std::vector<std::string> &data_names,
1725  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1726  const VtkFlags &flags,
1727  std::ostream &out);
1728 
1770  void
1771  write_pvtu_record (std::ostream &out,
1772  const std::vector<std::string> &piece_names,
1773  const std::vector<std::string> &data_names,
1774  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges);
1775 
1826  void write_pvd_record (std::ostream &out,
1827  const std::vector<std::pair<double,std::string> > &times_and_names);
1828 
1840  void write_visit_record (std::ostream &out,
1841  const std::vector<std::string> &piece_names);
1842 
1870  void write_visit_record (std::ostream &out,
1871  const std::vector<std::vector<std::string> > &piece_names);
1872 
1904  void write_visit_record (std::ostream &out,
1905  const std::vector<std::pair<double,std::vector<std::string> > > &times_and_piece_names);
1906 
1927  template <int spacedim>
1928  void write_svg (const std::vector<Patch<2,spacedim> > &patches,
1929  const std::vector<std::string> &data_names,
1930  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1931  const SvgFlags &flags,
1932  std::ostream &out);
1933 
1971  template <int dim, int spacedim>
1973  const std::vector<Patch<dim,spacedim> > &patches,
1974  const std::vector<std::string> &data_names,
1975  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
1976  const Deal_II_IntermediateFlags &flags,
1977  std::ostream &out);
1978 
1983  template <int dim, int spacedim>
1984  void write_hdf5_parallel (const std::vector<Patch<dim,spacedim> > &patches,
1985  const DataOutFilter &data_filter,
1986  const std::string &filename,
1987  MPI_Comm comm);
1988 
1996  template <int dim, int spacedim>
1997  void write_hdf5_parallel (const std::vector<Patch<dim,spacedim> > &patches,
1998  const DataOutFilter &data_filter,
1999  const bool write_mesh_file,
2000  const std::string &mesh_filename,
2001  const std::string &solution_filename,
2002  MPI_Comm comm);
2003 
2010  template <int dim, int spacedim>
2011  void write_filtered_data (const std::vector<Patch<dim,spacedim> > &patches,
2012  const std::vector<std::string> &data_names,
2013  const std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
2014  DataOutFilter &filtered_data);
2015 
2027  std::pair<unsigned int, unsigned int>
2028  determine_intermediate_format_dimensions (std::istream &input);
2029 
2041  OutputFormat parse_output_format (const std::string &format_name);
2042 
2048  std::string get_output_format_names ();
2049 
2068  std::string default_suffix (const OutputFormat output_format);
2069 
2079  int, int,
2080  << "The number of points in this data set is " << arg1
2081  << ", but we expected " << arg2 << " in each space direction.");
2086  "You are trying to write graphical data into a file, but "
2087  "no data is available in the intermediate format that "
2088  "the DataOutBase functions require. Did you forget to "
2089  "call a function such as DataOut::build_patches()?");
2094  "The error code of one of the Tecplot functions was "
2095  "not zero as expected.");
2100  char *,
2101  << "There was an error opening Tecplot file " << arg1
2102  << " for output.");
2103 
2105 }
2106 
2107 
2108 
2109 
2221 template <int dim, int spacedim=dim>
2223 {
2224 public:
2228  DataOutInterface ();
2229 
2234  virtual ~DataOutInterface ();
2235 
2240  void write_dx (std::ostream &out) const;
2241 
2246  void write_eps (std::ostream &out) const;
2247 
2252  void write_gmv (std::ostream &out) const;
2253 
2258  void write_gnuplot (std::ostream &out) const;
2259 
2264  void write_povray (std::ostream &out) const;
2265 
2270  void write_tecplot (std::ostream &out) const;
2271 
2277  void write_tecplot_binary (std::ostream &out) const;
2278 
2283  void write_ucd (std::ostream &out) const;
2284 
2296  void write_vtk (std::ostream &out) const;
2297 
2312  void write_vtu (std::ostream &out) const;
2313 
2322  void write_vtu_in_parallel (const char *filename,
2323  MPI_Comm comm) const;
2324 
2358  void write_pvtu_record (std::ostream &out,
2359  const std::vector<std::string> &piece_names) const;
2360 
2364  static void write_pvd_record (std::ostream &out,
2365  const std::vector<std::pair<double,std::string> > &times_and_names) DEAL_II_DEPRECATED;
2366 
2370  static
2371  void
2372  write_visit_record (std::ostream &out,
2373  const std::vector<std::string> &piece_names) DEAL_II_DEPRECATED;
2374 
2378  static
2379  void
2380  write_visit_record (std::ostream &out,
2381  const std::vector<std::vector<std::string> > &piece_names) DEAL_II_DEPRECATED;
2382 
2386  static
2387  void
2388  write_visit_record (std::ostream &out,
2389  const std::vector<std::pair<double,std::vector<std::string> > > &times_and_piece_names) DEAL_II_DEPRECATED;
2390 
2395  void write_svg(std::ostream &out) const;
2396 
2407  void write_deal_II_intermediate (std::ostream &out) const;
2408 
2415  const std::string &h5_filename,
2416  const double cur_time,
2417  MPI_Comm comm) const;
2418 
2425  const std::string &h5_mesh_filename,
2426  const std::string &h5_solution_filename,
2427  const double cur_time,
2428  MPI_Comm comm) const;
2429 
2450  void write_xdmf_file (const std::vector<XDMFEntry> &entries,
2451  const std::string &filename,
2452  MPI_Comm comm) const;
2453 
2467  void write_hdf5_parallel (const DataOutBase::DataOutFilter &data_filter,
2468  const std::string &filename,
2469  MPI_Comm comm) const;
2470 
2478  void write_hdf5_parallel (const DataOutBase::DataOutFilter &data_filter,
2479  const bool write_mesh_file,
2480  const std::string &mesh_filename,
2481  const std::string &solution_filename,
2482  MPI_Comm comm) const;
2483 
2490  void write_filtered_data (DataOutBase::DataOutFilter &filtered_data) const;
2491 
2492 
2501  void write (std::ostream &out,
2502  const DataOutBase::OutputFormat output_format = DataOutBase::default_format) const;
2503 
2508  void set_default_format (const DataOutBase::OutputFormat default_format);
2509 
2510 
2515  template<typename FlagType>
2516  void set_flags (const FlagType &flags);
2517 
2518 
2526  std::string
2528 
2543  static void declare_parameters (ParameterHandler &prm);
2544 
2552  void parse_parameters (ParameterHandler &prm);
2553 
2559  std::size_t memory_consumption () const;
2560 
2561 protected:
2569  virtual
2570  const std::vector<DataOutBase::Patch<dim,spacedim> > &
2571  get_patches () const = 0;
2572 
2577  virtual
2578  std::vector<std::string>
2579  get_dataset_names () const = 0;
2580 
2599  virtual
2600  std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> >
2601  get_vector_data_ranges () const;
2602 
2609  void validate_dataset_names () const;
2610 
2611 
2617  unsigned int default_subdivisions;
2618 
2619 private:
2626 
2632 
2638 
2644 
2650 
2656 
2662 
2668 
2674 
2680 
2686 };
2687 
2688 
2689 
2738 template <int dim, int spacedim=dim>
2739 class DataOutReader : public DataOutInterface<dim,spacedim>
2740 {
2741 public:
2747  void read (std::istream &in);
2748 
2772  void merge (const DataOutReader<dim,spacedim> &other);
2773 
2778  "You are trying to merge two sets of patches for which the "
2779  "declared names of the variables do not match.");
2784  "You are trying to merge two sets of patches for which the "
2785  "number of subdivisions or the number of vector components "
2786  "do not match.");
2791  int, int, int, int,
2792  << "Either the dimensions <" << arg1 << "> and <"
2793  << arg2 << "> or the space dimensions <"
2794  << arg3 << "> and <" << arg4
2795  << "> do not match!");
2796 
2797 protected:
2806  virtual const std::vector<::DataOutBase::Patch<dim,spacedim> > &
2807  get_patches () const;
2808 
2815  virtual std::vector<std::string> get_dataset_names () const;
2816 
2835  virtual
2836  std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> >
2837  get_vector_data_ranges () const;
2838 
2839 private:
2844  std::vector<::DataOutBase::Patch<dim,spacedim> > patches;
2845  std::vector<std::string> dataset_names;
2846 
2851  std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> >
2853 };
2854 
2855 
2856 
2857 
2867 {
2868 private:
2870  bool valid;
2872  std::string h5_sol_filename, h5_mesh_filename;
2874  double entry_time;
2876  unsigned int num_nodes, num_cells, dimension;
2878  std::map<std::string, unsigned int> attribute_dims;
2879 
2881  std::string indent(const unsigned int indent_level) const
2882  {
2883  std::string res = "";
2884  for (unsigned int i=0; i<indent_level; ++i) res += " ";
2885  return res;
2886  }
2887 
2888 public:
2889  XDMFEntry() : valid(false) {};
2890  XDMFEntry(const std::string filename, const double time, const unsigned int nodes, const unsigned int cells, const unsigned int dim) : valid(true), h5_sol_filename(filename), h5_mesh_filename(filename), entry_time(time), num_nodes(nodes), num_cells(cells), dimension(dim) {};
2891  XDMFEntry(const std::string mesh_filename, const std::string solution_filename, const double time, const unsigned int nodes, const unsigned int cells, const unsigned int dim) : valid(true), h5_sol_filename(solution_filename), h5_mesh_filename(mesh_filename), entry_time(time), num_nodes(nodes), num_cells(cells), dimension(dim) {};
2892 
2896  void add_attribute(const std::string &attr_name, const unsigned int dimension)
2897  {
2898  attribute_dims[attr_name] = dimension;
2899  }
2900 
2904  template <class Archive>
2905  void serialize(Archive &ar, const unsigned int /*version*/)
2906  {
2907  ar &valid
2909  &h5_mesh_filename
2910  &entry_time
2911  &num_nodes
2912  &num_cells
2913  &dimension
2914  &attribute_dims;
2915  }
2916 
2919  std::string get_xdmf_content(const unsigned int indent_level) const;
2920 };
2921 
2922 
2923 
2924 /* -------------------- inline functions ------------------- */
2925 
2926 namespace DataOutBase
2927 {
2928  inline
2929  bool
2931  {
2932  return (red == green) && (red == blue);
2933  }
2934 
2935 
2936  /* -------------------- template functions ------------------- */
2937 
2946  template <int dim, int spacedim>
2947  std::ostream &
2948  operator << (std::ostream &out,
2949  const Patch<dim,spacedim> &patch);
2950 
2951 
2952 
2961  template <int dim, int spacedim>
2962  std::istream &
2963  operator >> (std::istream &in,
2964  Patch<dim,spacedim> &patch);
2965 }
2966 
2967 
2968 DEAL_II_NAMESPACE_CLOSE
2969 
2970 #endif
void write_gmv(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const GmvFlags &flags, std::ostream &out)
virtual std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges() const
static void declare_parameters(ParameterHandler &prm)
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names) const
static const unsigned int invalid_unsigned_int
Definition: types.h:170
Map3DPoint existing_points
Map of points to an internal index.
unsigned int height_vector
void write_vtu_footer(std::ostream &out)
virtual std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges() const
static void declare_parameters(ParameterHandler &prm)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:576
void parse_parameters(const ParameterHandler &prm)
void write_ucd(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const UcdFlags &flags, std::ostream &out)
void write_hdf5_parallel(const DataOutBase::DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm) const
void write_tecplot_binary(std::ostream &out) const
std::size_t memory_consumption() const
void set_flags(const FlagType &flags)
virtual std::vector< std::string > get_dataset_names() const =0
virtual const std::vector<::DataOutBase::Patch< dim, spacedim > > & get_patches() const
static ::ExceptionBase & ExcIncompatibleDatasetNames()
std::map< unsigned int, unsigned int > filtered_cells
Map of cells to the filtered points.
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
std::pair< unsigned int, unsigned int > determine_intermediate_format_dimensions(std::istream &input)
void write_cell(unsigned int index, unsigned int start, unsigned int d1, unsigned int d2, unsigned int d3)
void parse_parameters(const ParameterHandler &prm)
void swap(Patch< dim, spacedim > &other_patch)
void merge(const DataOutReader< dim, spacedim > &other)
bool valid
Whether this entry is valid and contains data to be written.
unsigned int neighbors[dim > 0 ? GeometryInfo< dim >::faces_per_cell :1]
void write_vtu_header(std::ostream &out, const VtkFlags &flags)
unsigned int n_nodes() const
static RgbValues default_color_function(const double value, const double min_value, const double max_value)
double entry_time
The simulation time associated with this entry.
ZlibCompressionLevel compression_level
std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > vector_data_ranges
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)
void write_vtk(std::ostream &out) const
void write_filtered_data(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, DataOutFilter &filtered_data)
unsigned int default_subdivisions
std::vector< unsigned int > data_set_dims
Data set dimensions.
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
std::string get_xdmf_content(const unsigned int indent_level) const
std::vector< std::vector< double > > data_sets
Data set data.
static void declare_parameters(ParameterHandler &prm)
virtual const std::vector< DataOutBase::Patch< dim, spacedim > > & get_patches() const =0
std::map< std::string, unsigned int > attribute_dims
The attributes associated with this entry and their dimension.
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
void parse_parameters(ParameterHandler &prm)
void write_ucd(std::ostream &out) const
std::string default_suffix(const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
Scale to given height.
const char * tecplot_binary_file_name
static ::ExceptionBase & ExcNoPatches()
DataOutBase::PovrayFlags povray_flags
std::string get_data_set_name(const unsigned int &set_num) const
DataOutBase::DataOutFilterFlags flags
Flags used to specify filtering behavior.
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)
unsigned int n_data_sets() const
std::string default_suffix(const OutputFormat output_format)
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)
unsigned int patch_index
static ::ExceptionBase & ExcNotEnoughSpaceDimensionLabels()
std::istream & operator>>(std::istream &in, Patch< dim, spacedim > &patch)
std::vector< std::string > space_dimension_labels
static RgbValues reverse_grey_scale_color_function(const double value, const double min_value, const double max_value)
std::string indent(const unsigned int indent_level) const
Small function to create indentation for XML file.
unsigned int n_cells() const
std::size_t memory_consumption() const
void serialize(Archive &ar, const unsigned int)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:564
static void write_pvd_record(std::ostream &out, const std::vector< std::pair< double, std::string > > &times_and_names) 1
std::vector< std::string > data_set_names
Data set names.
void add_attribute(const std::string &attr_name, const unsigned int dimension)
void write_tecplot(std::ostream &out) const
void write_povray(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const PovrayFlags &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_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const EpsFlags &flags, std::ostream &out)
DXFlags(const bool write_neighbors=false, const bool int_binary=false, const bool coordinates_binary=false, const bool data_binary=false)
void parse_parameters(const ParameterHandler &prm)
void write_pvd_record(std::ostream &out, const std::vector< std::pair< double, std::string > > &times_and_names)
std::size_t memory_consumption() const
DataOutBase::Deal_II_IntermediateFlags deal_II_intermediate_flags
void read(std::istream &in)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:553
void internal_add_cell(const unsigned int &cell_index, const unsigned int &pt_index)
OutputFormat parse_output_format(const std::string &format_name)
void write_svg(const std::vector< Patch< 2, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const SvgFlags &flags, std::ostream &out)
void write_xdmf_file(const std::vector< XDMFEntry > &entries, const std::string &filename, MPI_Comm comm) const
void write_dx(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const DXFlags &flags, std::ostream &out)
ColorFunction color_function
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
void write_svg(std::ostream &out) const
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_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges)
DataOutBase::TecplotFlags tecplot_flags
void parse_parameters(const ParameterHandler &prm)
Scale to given width.
std::ostream & operator<<(std::ostream &out, const Patch< dim, spacedim > &patch)
DataOutBase::SvgFlags svg_flags
void fill_cell_data(const unsigned int &local_node_offset, std::vector< unsigned int > &cell_data) const
std::string h5_sol_filename
The name of the HDF5 heavy data solution and/or mesh files this entry references. ...
static ::ExceptionBase & ExcIncompatiblePatchLists()
virtual ~DataOutInterface()
void parse_parameters(const ParameterHandler &prm)
const double * get_data_set(const unsigned int &set_num) const
TecplotFlags(const char *tecplot_binary_file_name=NULL, const char *zone_name=NULL, const double solution_time=-1.0)
void fill_node_data(std::vector< double > &node_data) const
unsigned int get_data_set_dim(const unsigned int &set_num) const
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
static void declare_parameters(ParameterHandler &prm)
void write_vtk(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const VtkFlags &flags, std::ostream &out)
static void declare_parameters(ParameterHandler &prm)
bool operator==(const Patch &patch) const
void write_eps(std::ostream &out) const
void write_vtu(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const VtkFlags &flags, std::ostream &out)
void write_deal_II_intermediate(std::ostream &out) const
static void declare_parameters(ParameterHandler &prm)
static const unsigned int no_neighbor
DataOutBase::GmvFlags gmv_flags
void write_point(const unsigned int &index, const Point< dim > &p)
DataOutBase::VtkFlags vtk_flags
std::size_t memory_consumption() const
void write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const
static const unsigned int format_version
std::vector<::DataOutBase::Patch< dim, spacedim > > patches
void write_tecplot_binary(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const TecplotFlags &flags, std::ostream &out)
void write_povray(std::ostream &out) const
static const unsigned int space_dim
DataOutBase::GnuplotFlags gnuplot_flags
void set_default_format(const DataOutBase::OutputFormat default_format)
void write_gmv(std::ostream &out) const
unsigned int num_nodes
The number of nodes, cells and dimensionality associated with the data.
PovrayFlags(const bool smooth=false, const bool bicubic_patch=false, const bool external_data=false)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition: exceptions.h:600
void write_tecplot(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const TecplotFlags &flags, std::ostream &out)
unsigned int color_vector
void write_vtu_main(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const VtkFlags &flags, std::ostream &out)
static ::ExceptionBase & ExcInvalidCombinationOfDimensions(int arg1, int arg2)
DataOutBase::OutputFormat default_fmt
std::size_t memory_consumption() const
RgbValues(* ColorFunction)(const double value, const double min_value, const double max_value)
void validate_dataset_names() const
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim > > &patches, const DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm)
static void declare_parameters(ParameterHandler &prm)
void write_vtu_in_parallel(const char *filename, MPI_Comm comm) const
DataOutBase::EpsFlags eps_flags
void write_dx(std::ostream &out) const
void write_deal_II_intermediate(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const Deal_II_IntermediateFlags &flags, std::ostream &out)
static ::ExceptionBase & ExcIncompatibleDimensions(int arg1, int arg2, int arg3, int arg4)
void write_gnuplot(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std_cxx11::tuple< unsigned int, unsigned int, std::string > > &vector_data_ranges, const GnuplotFlags &flags, std::ostream &out)
virtual std::vector< std::string > get_dataset_names() const
std::size_t memory_consumption() const
std::map< unsigned int, unsigned int > filtered_points
Map of actual point index to internal point index.
void write_gnuplot(std::ostream &out) const
void write_data_set(const std::string &name, const unsigned int &dimension, const unsigned int &set_num, const Table< 2, double > &data_vectors)
void write_vtu(std::ostream &out) const
UcdFlags(const bool write_preamble=false)
void parse_parameters(const ParameterHandler &prm)
std::string get_output_format_names()
DataOutBase::UcdFlags ucd_flags
Table< 2, float > data
unsigned int height_vector
static void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names) 1
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
DataOutBase::DXFlags dx_flags
static ::ExceptionBase & ExcTecplotAPIError()
XDMFEntry create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, MPI_Comm comm) const