deal.II version GIT relicensing-2165-gc91f007519 2024-11-20 01:40:00+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\}}\)
Loading...
Searching...
No Matches
data_out_base.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 1999 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_data_out_base_h
16#define dealii_data_out_base_h
17
18
19#include <deal.II/base/config.h>
20
23#include <deal.II/base/point.h>
24#include <deal.II/base/table.h>
25
27
29
30// To be able to serialize XDMFEntry
31#include <boost/serialization/map.hpp>
32
33#include <limits>
34#include <ostream>
35#include <string>
36#include <tuple>
37#include <typeinfo>
38#include <vector>
39
41
42// Forward declarations
43#ifndef DOXYGEN
45class XDMFEntry;
46#endif
47
197namespace DataOutBase
198{
230
231
254 template <int dim, int spacedim = dim>
255 struct Patch
256 {
260 static const unsigned int space_dim = spacedim;
261
279 std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
280
291 std::array<unsigned int, GeometryInfo<dim>::faces_per_cell> neighbors;
292
297 unsigned int patch_index;
298
304 unsigned int n_subdivisions;
305
328
342
347
352 Patch();
353
358 bool
359 operator==(const Patch &patch) const;
360
367 std::size_t
368 memory_consumption() const;
369
373 void
374 swap(Patch<dim, spacedim> &other_patch) noexcept;
375
379 static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
380
391 int,
392 int,
393 << "It is not possible to have a structural dimension of " << arg1
394 << " to be larger than the space dimension of the surrounding"
395 << " space " << arg2);
397 };
398
399
400
416 template <int spacedim>
417 struct Patch<0, spacedim>
418 {
422 static const unsigned int space_dim = spacedim;
423
433
438 static unsigned int neighbors[1];
439
444 unsigned int patch_index;
445
455 static const unsigned int n_subdivisions;
456
478
492
499
504 Patch();
505
510 bool
511 operator==(const Patch &patch) const;
512
519 std::size_t
520 memory_consumption() const;
521
525 void
526 swap(Patch<0, spacedim> &other_patch) noexcept;
527
531 static const unsigned int no_neighbor = numbers::invalid_unsigned_int;
532
543 int,
544 int,
545 << "It is not possible to have a structural dimension of " << arg1
546 << " to be larger than the space dimension of the surrounding"
547 << " space " << arg2);
549 };
550
551
563 template <typename FlagsType>
565 {
573 static void
575
583 void
585
592 std::size_t
594 };
595
596
597 template <typename FlagsType>
598 void
601
602
603 template <typename FlagsType>
604 void
607
608
609 template <typename FlagsType>
610 std::size_t
612 {
613 return sizeof(FlagsType);
614 }
615
616
622 struct DXFlags : public OutputFlagsBase<DXFlags>
623 {
638
643
649
653 DXFlags(const bool write_neighbors = false,
654 const bool int_binary = false,
655 const bool coordinates_binary = false,
656 const bool data_binary = false);
657
662 static void
664
671 void
673 };
674
680 struct UcdFlags : public OutputFlagsBase<UcdFlags>
681 {
692
696 UcdFlags(const bool write_preamble = false);
697
702 static void
704
711 void
713 };
714
720 struct GnuplotFlags : public OutputFlagsBase<GnuplotFlags>
721 {
726 GnuplotFlags();
727
731 GnuplotFlags(const std::vector<std::string> &space_dimension_labels);
732
748 std::vector<std::string> space_dimension_labels;
749
754 std::size_t
755 memory_consumption() const;
756
762 "There should be at least one space dimension per spatial "
763 "dimension (extras are ignored).");
764 };
765
772 struct PovrayFlags : public OutputFlagsBase<PovrayFlags>
773 {
779 bool smooth;
780
787
795
799 PovrayFlags(const bool smooth = false,
800 const bool bicubic_patch = false,
801 const bool external_data = false);
802
807 static void
809
816 void
818 };
819
820
827 struct EpsFlags : public OutputFlagsBase<EpsFlags>
828 {
835 unsigned int height_vector;
836
841 unsigned int color_vector;
842
849 {
853 height
854 };
855
860
868 unsigned int size;
869
874
881
906
917 double z_scaling;
918
926
944
954
959 {
960 float red;
961 float green;
962 float blue;
963
968 bool
969 is_grey() const;
970 };
971
979 using ColorFunction = RgbValues (*)(const double value,
980 const double min_value,
981 const double max_value);
982
989
990
999 static RgbValues
1000 default_color_function(const double value,
1001 const double min_value,
1002 const double max_value);
1003
1009 static RgbValues
1010 grey_scale_color_function(const double value,
1011 const double min_value,
1012 const double max_value);
1013
1020 static RgbValues
1021 reverse_grey_scale_color_function(const double value,
1022 const double min_value,
1023 const double max_value);
1024
1028 EpsFlags(const unsigned int height_vector = 0,
1029 const unsigned int color_vector = 0,
1030 const SizeType size_type = width,
1031 const unsigned int size = 300,
1032 const double line_width = 0.5,
1033 const double azimut_angle = 60,
1034 const double turn_angle = 30,
1035 const double z_scaling = 1.0,
1036 const bool draw_mesh = true,
1037 const bool draw_cells = true,
1038 const bool shade_cells = true,
1040
1048 static void
1050
1057 void
1059 };
1060
1067 struct GmvFlags : public OutputFlagsBase<GmvFlags>
1068 {};
1069
1086
1092 struct TecplotFlags : public OutputFlagsBase<TecplotFlags>
1093 {
1098 const char *zone_name;
1099
1106
1110 TecplotFlags(const char *zone_name = nullptr,
1111 const double solution_time = -1.0);
1112
1117 std::size_t
1118 memory_consumption() const;
1119 };
1120
1126 struct VtkFlags : public OutputFlagsBase<VtkFlags>
1127 {
1138 double time;
1139
1150 unsigned int cycle;
1151
1159
1165
1184
1206 std::map<std::string, std::string> physical_units;
1207
1212 explicit VtkFlags(
1213 const double time = std::numeric_limits<double>::min(),
1214 const unsigned int cycle = std::numeric_limits<unsigned int>::min(),
1215 const bool print_date_and_time = true,
1217 const bool write_higher_order_cells = false,
1218 const std::map<std::string, std::string> &physical_units = {});
1219 };
1220
1221
1227 struct SvgFlags : public OutputFlagsBase<SvgFlags>
1228 {
1232 unsigned int height;
1233
1238 unsigned int width;
1239
1246 unsigned int height_vector;
1247
1252
1253 unsigned int line_thickness;
1254
1259
1264
1268 SvgFlags(const unsigned int height_vector = 0,
1269 const int azimuth_angle = 37,
1270 const int polar_angle = 45,
1271 const unsigned int line_thickness = 1,
1272 const bool margin = true,
1273 const bool draw_colorbar = true);
1274 };
1275
1276
1284 : public OutputFlagsBase<Deal_II_IntermediateFlags>
1285 {
1292 static const unsigned int format_version;
1293 };
1294
1301 {
1312
1318
1323 const bool xdmf_hdf5_output = false);
1324
1329 static void
1331
1338 void
1340
1345 std::size_t
1347 };
1348
1381 {
1382 public:
1386 DataOutFilter();
1387
1393
1399 template <int dim>
1400 void
1401 write_point(const unsigned int index, const Point<dim> &p);
1402
1406 template <int dim>
1407 void
1408 write_cell(const unsigned int index,
1409 const unsigned int start,
1410 const std::array<unsigned int, dim> &offsets);
1411
1416 void
1417 write_cell_single(const unsigned int index,
1418 const unsigned int start,
1419 const unsigned int n_points,
1420 const ReferenceCell &reference_cell);
1421
1428 void
1429 write_data_set(const std::string &name,
1430 const unsigned int dimension,
1431 const unsigned int set_num,
1432 const Table<2, double> &data_vectors);
1433
1438 void
1439 fill_node_data(std::vector<double> &node_data) const;
1440
1445 void
1446 fill_cell_data(const unsigned int local_node_offset,
1447 std::vector<unsigned int> &cell_data) const;
1448
1452 std::string
1453 get_data_set_name(const unsigned int set_num) const;
1454
1458 unsigned int
1459 get_data_set_dim(const unsigned int set_num) const;
1460
1465 const double *
1466 get_data_set(const unsigned int set_num) const;
1467
1472 unsigned int
1473 n_nodes() const;
1474
1479 unsigned int
1480 n_cells() const;
1481
1486 unsigned int
1487 n_data_sets() const;
1488
1492 void
1493 flush_points();
1494
1498 void
1499 flush_cells();
1500
1501
1502 private:
1507 {
1508 bool
1509 operator()(const Point<3> &one, const Point<3> &two) const
1510 {
1511 /*
1512 * The return statement below is an optimized version of the following
1513 * code:
1514 *
1515 * for (unsigned int d=0; d<3; ++d)
1516 * {
1517 * if (one(d) < two(d))
1518 * return true;
1519 * else if (one(d) > two(d))
1520 * return false;
1521 * }
1522 * return false;
1523 */
1524
1525 return (one[0] < two[0] ||
1526 (!(two[0] < one[0]) &&
1527 (one[1] < two[1] || (!(two[1] < one[1]) && one[2] < two[2]))));
1528 }
1529 };
1530
1531 using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1532
1537
1544 unsigned int node_dim;
1545
1550 unsigned int num_cells;
1551
1556
1560 std::map<unsigned int, unsigned int> filtered_points;
1561
1565 std::map<unsigned int, unsigned int> filtered_cells;
1566
1570 std::vector<std::string> data_set_names;
1571
1575 std::vector<unsigned int> data_set_dims;
1576
1580 std::vector<std::vector<double>> data_sets;
1581
1585 void
1586 internal_add_cell(const unsigned int cell_index,
1587 const unsigned int pt_index);
1588 };
1589
1590
1595 {
1600
1605
1610
1615
1620
1625
1630
1635
1640
1645
1650
1655
1660
1664 hdf5
1666
1667
1671 template <int dim, int spacedim>
1672 void
1673 write_dx(
1674 const std::vector<Patch<dim, spacedim>> &patches,
1675 const std::vector<std::string> &data_names,
1676 const std::vector<
1677 std::tuple<unsigned int,
1678 unsigned int,
1679 std::string,
1681 &nonscalar_data_ranges,
1682 const DXFlags &flags,
1683 std::ostream &out);
1684
1729 template <int spacedim>
1730 void
1731 write_eps(
1732 const std::vector<Patch<2, spacedim>> &patches,
1733 const std::vector<std::string> &data_names,
1734 const std::vector<
1735 std::tuple<unsigned int,
1736 unsigned int,
1737 std::string,
1739 &nonscalar_data_ranges,
1740 const EpsFlags &flags,
1741 std::ostream &out);
1742
1748 template <int dim, int spacedim>
1749 void
1750 write_eps(
1751 const std::vector<Patch<dim, spacedim>> &patches,
1752 const std::vector<std::string> &data_names,
1753 const std::vector<
1754 std::tuple<unsigned int,
1755 unsigned int,
1756 std::string,
1758 &nonscalar_data_ranges,
1759 const EpsFlags &flags,
1760 std::ostream &out);
1761
1762
1772 template <int dim, int spacedim>
1773 void
1774 write_gmv(
1775 const std::vector<Patch<dim, spacedim>> &patches,
1776 const std::vector<std::string> &data_names,
1777 const std::vector<
1778 std::tuple<unsigned int,
1779 unsigned int,
1780 std::string,
1782 &nonscalar_data_ranges,
1783 const GmvFlags &flags,
1784 std::ostream &out);
1785
1841 template <int dim, int spacedim>
1842 void
1844 const std::vector<Patch<dim, spacedim>> &patches,
1845 const std::vector<std::string> &data_names,
1846 const std::vector<
1847 std::tuple<unsigned int,
1848 unsigned int,
1849 std::string,
1851 &nonscalar_data_ranges,
1852 const GnuplotFlags &flags,
1853 std::ostream &out);
1854
1900 template <int dim, int spacedim>
1901 void
1903 const std::vector<Patch<dim, spacedim>> &patches,
1904 const std::vector<std::string> &data_names,
1905 const std::vector<
1906 std::tuple<unsigned int,
1907 unsigned int,
1908 std::string,
1910 &nonscalar_data_ranges,
1911 const PovrayFlags &flags,
1912 std::ostream &out);
1913
1920 template <int dim, int spacedim>
1921 void
1923 const std::vector<Patch<dim, spacedim>> &patches,
1924 const std::vector<std::string> &data_names,
1925 const std::vector<
1926 std::tuple<unsigned int,
1927 unsigned int,
1928 std::string,
1930 &nonscalar_data_ranges,
1931 const TecplotFlags &flags,
1932 std::ostream &out);
1933
1948 template <int dim, int spacedim>
1949 void
1950 write_ucd(
1951 const std::vector<Patch<dim, spacedim>> &patches,
1952 const std::vector<std::string> &data_names,
1953 const std::vector<
1954 std::tuple<unsigned int,
1955 unsigned int,
1956 std::string,
1958 &nonscalar_data_ranges,
1959 const UcdFlags &flags,
1960 std::ostream &out);
1961
1981 template <int dim, int spacedim>
1982 void
1983 write_vtk(
1984 const std::vector<Patch<dim, spacedim>> &patches,
1985 const std::vector<std::string> &data_names,
1986 const std::vector<
1987 std::tuple<unsigned int,
1988 unsigned int,
1989 std::string,
1991 &nonscalar_data_ranges,
1992 const VtkFlags &flags,
1993 std::ostream &out);
1994
1995
2019 template <int dim, int spacedim>
2020 void
2021 write_vtu(
2022 const std::vector<Patch<dim, spacedim>> &patches,
2023 const std::vector<std::string> &data_names,
2024 const std::vector<
2025 std::tuple<unsigned int,
2026 unsigned int,
2027 std::string,
2029 &nonscalar_data_ranges,
2030 const VtkFlags &flags,
2031 std::ostream &out);
2032
2038 void
2039 write_vtu_header(std::ostream &out, const VtkFlags &flags);
2040
2047 void
2048 write_vtu_footer(std::ostream &out);
2049
2056 template <int dim, int spacedim>
2057 void
2059 const std::vector<Patch<dim, spacedim>> &patches,
2060 const std::vector<std::string> &data_names,
2061 const std::vector<
2062 std::tuple<unsigned int,
2063 unsigned int,
2064 std::string,
2066 &nonscalar_data_ranges,
2067 const VtkFlags &flags,
2068 std::ostream &out);
2069
2111 void
2113 std::ostream &out,
2114 const std::vector<std::string> &piece_names,
2115 const std::vector<std::string> &data_names,
2116 const std::vector<
2117 std::tuple<unsigned int,
2118 unsigned int,
2119 std::string,
2121 &nonscalar_data_ranges,
2122 const VtkFlags &flags);
2123
2172 void
2174 std::ostream &out,
2175 const std::vector<std::pair<double, std::string>> &times_and_names);
2176
2188 void
2189 write_visit_record(std::ostream &out,
2190 const std::vector<std::string> &piece_names);
2191
2219 void
2220 write_visit_record(std::ostream &out,
2221 const std::vector<std::vector<std::string>> &piece_names);
2222
2255 void
2257 std::ostream &out,
2258 const std::vector<std::pair<double, std::vector<std::string>>>
2259 &times_and_piece_names);
2260
2281 template <int spacedim>
2282 void
2283 write_svg(
2284 const std::vector<Patch<2, spacedim>> &patches,
2285 const std::vector<std::string> &data_names,
2286 const std::vector<
2287 std::tuple<unsigned int,
2288 unsigned int,
2289 std::string,
2291 &nonscalar_data_ranges,
2292 const SvgFlags &flags,
2293 std::ostream &out);
2294
2332 template <int dim, int spacedim>
2333 void
2335 const std::vector<Patch<dim, spacedim>> &patches,
2336 const std::vector<std::string> &data_names,
2337 const std::vector<
2338 std::tuple<unsigned int,
2339 unsigned int,
2340 std::string,
2342 &nonscalar_data_ranges,
2343 const Deal_II_IntermediateFlags &flags,
2344 std::ostream &out);
2345
2354 template <int dim, int spacedim>
2355 void
2357 const std::vector<Patch<dim, spacedim>> &patches,
2358 const std::vector<std::string> &data_names,
2359 const std::vector<
2360 std::tuple<unsigned int,
2361 unsigned int,
2362 std::string,
2364 &nonscalar_data_ranges,
2365 const Deal_II_IntermediateFlags &flags,
2366 const std::string &filename,
2367 const MPI_Comm comm,
2368 const CompressionLevel compression);
2369
2374 template <int dim, int spacedim>
2375 void
2376 write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2377 const DataOutFilter &data_filter,
2378 const DataOutBase::Hdf5Flags &flags,
2379 const std::string &filename,
2380 const MPI_Comm comm);
2381
2389 template <int dim, int spacedim>
2390 void
2391 write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2392 const DataOutFilter &data_filter,
2393 const DataOutBase::Hdf5Flags &flags,
2394 const bool write_mesh_file,
2395 const std::string &mesh_filename,
2396 const std::string &solution_filename,
2397 const MPI_Comm comm);
2398
2405 template <int dim, int spacedim>
2406 void
2408 const std::vector<Patch<dim, spacedim>> &patches,
2409 const std::vector<std::string> &data_names,
2410 const std::vector<
2411 std::tuple<unsigned int,
2412 unsigned int,
2413 std::string,
2415 &nonscalar_data_ranges,
2416 DataOutFilter &filtered_data);
2417
2429 std::pair<unsigned int, unsigned int>
2430 determine_intermediate_format_dimensions(std::istream &input);
2431
2444 parse_output_format(const std::string &format_name);
2445
2451 std::string
2453
2473 std::string
2474 default_suffix(const OutputFormat output_format);
2475
2485 int,
2486 int,
2487 << "The number of points in this data set is " << arg1
2488 << ", but we expected " << arg2
2489 << " in each space direction.");
2494 "You are trying to write graphical data into a file, but "
2495 "no data is available in the intermediate format that "
2496 "the DataOutBase functions require. Did you forget to "
2497 "call a function such as DataOut::build_patches()?");
2502 "The error code of one of the Tecplot functions was "
2503 "not zero as expected.");
2508 char *,
2509 << "There was an error opening Tecplot file " << arg1
2510 << " for output.");
2511
2513} // namespace DataOutBase
2514
2515
2516
2623template <int dim, int spacedim = dim>
2625{
2626public:
2631
2636 virtual ~DataOutInterface() = default;
2637
2642 void
2643 write_dx(std::ostream &out) const;
2644
2649 void
2650 write_eps(std::ostream &out) const;
2651
2656 void
2657 write_gmv(std::ostream &out) const;
2658
2663 void
2664 write_gnuplot(std::ostream &out) const;
2665
2670 void
2671 write_povray(std::ostream &out) const;
2672
2677 void
2678 write_tecplot(std::ostream &out) const;
2679
2684 void
2685 write_ucd(std::ostream &out) const;
2686
2698 void
2699 write_vtk(std::ostream &out) const;
2700
2715 void
2716 write_vtu(std::ostream &out) const;
2717
2728 void
2729 write_vtu_in_parallel(const std::string &filename, const MPI_Comm comm) const;
2730
2764 void
2765 write_pvtu_record(std::ostream &out,
2766 const std::vector<std::string> &piece_names) const;
2767
2829 std::string
2831 const std::string &directory,
2832 const std::string &filename_without_extension,
2833 const unsigned int counter,
2834 const MPI_Comm mpi_communicator,
2835 const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2836 const unsigned int n_groups = 0) const;
2837
2842 void
2843 write_svg(std::ostream &out) const;
2844
2855 void
2856 write_deal_II_intermediate(std::ostream &out) const;
2857
2864 void
2866 const std::string &filename,
2867 const MPI_Comm comm,
2868 const DataOutBase::CompressionLevel compression) const;
2869
2875 XDMFEntry
2877 const std::string &h5_filename,
2878 const double cur_time,
2879 const MPI_Comm comm) const;
2880
2886 XDMFEntry
2888 const std::string &h5_mesh_filename,
2889 const std::string &h5_solution_filename,
2890 const double cur_time,
2891 const MPI_Comm comm) const;
2892
2917 void
2918 write_xdmf_file(const std::vector<XDMFEntry> &entries,
2919 const std::string &filename,
2920 const MPI_Comm comm) const;
2921
2936 void
2938 const std::string &filename,
2939 const MPI_Comm comm) const;
2940
2948 void
2950 const bool write_mesh_file,
2951 const std::string &mesh_filename,
2952 const std::string &solution_filename,
2953 const MPI_Comm comm) const;
2954
2961 void
2962 write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2963
2964
2973 void
2974 write(std::ostream &out,
2975 const DataOutBase::OutputFormat output_format =
2977
2982 void
2983 set_default_format(const DataOutBase::OutputFormat default_format);
2984
2985
2990 template <typename FlagType>
2991 void
2992 set_flags(const FlagType &flags);
2993
2994
3002 std::string
3003 default_suffix(const DataOutBase::OutputFormat output_format =
3005
3020 static void
3022
3030 void
3032
3038 std::size_t
3039 memory_consumption() const;
3040
3041protected:
3049 virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
3050 get_patches() const = 0;
3051
3056 virtual std::vector<std::string>
3058
3077 virtual std::vector<
3078 std::tuple<unsigned int,
3079 unsigned int,
3080 std::string,
3083
3090 void
3091 validate_dataset_names() const;
3092
3093
3100
3101private:
3108
3114
3120
3126
3132
3138
3144
3150
3156
3162
3168
3174};
3175
3176
3177
3223template <int dim, int spacedim = dim>
3224class DataOutReader : public DataOutInterface<dim, spacedim>
3225{
3226public:
3232 void
3233 read(std::istream &in);
3234
3240 void
3241 read_whole_parallel_file(std::istream &in);
3242
3264 void
3265 merge(const DataOutReader<dim, spacedim> &other);
3266
3271 "You are trying to merge two sets of patches for which the "
3272 "declared names of the variables do not match.");
3277 "You are trying to merge two sets of patches for which the "
3278 "number of subdivisions or the number of vector components "
3279 "do not match.");
3284 int,
3285 int,
3286 int,
3287 int,
3288 << "Either the dimensions <" << arg1 << "> and <" << arg2
3289 << "> or the space dimensions <" << arg3 << "> and <" << arg4
3290 << "> do not match!");
3291
3292protected:
3301 virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3302 get_patches() const override;
3303
3310 virtual std::vector<std::string>
3311 get_dataset_names() const override;
3312
3331 virtual std::vector<
3332 std::tuple<unsigned int,
3333 unsigned int,
3334 std::string,
3336 get_nonscalar_data_ranges() const override;
3337
3338private:
3343 std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3344 std::vector<std::string> dataset_names;
3345
3350 std::vector<
3351 std::tuple<unsigned int,
3352 unsigned int,
3353 std::string,
3356};
3357
3358
3359
3368{
3369public:
3373 XDMFEntry();
3374
3380 XDMFEntry(const std::string &filename,
3381 const double time,
3382 const std::uint64_t nodes,
3383 const std::uint64_t cells,
3384 const unsigned int dim,
3385 const ReferenceCell &cell_type);
3386
3391 XDMFEntry(const std::string &mesh_filename,
3392 const std::string &solution_filename,
3393 const double time,
3394 const std::uint64_t nodes,
3395 const std::uint64_t cells,
3396 const unsigned int dim,
3397 const ReferenceCell &cell_type);
3398
3402 XDMFEntry(const std::string &mesh_filename,
3403 const std::string &solution_filename,
3404 const double time,
3405 const std::uint64_t nodes,
3406 const std::uint64_t cells,
3407 const unsigned int dim,
3408 const unsigned int spacedim,
3409 const ReferenceCell &cell_type);
3410
3414 void
3415 add_attribute(const std::string &attr_name, const unsigned int dimension);
3416
3422 template <class Archive>
3423 void
3424 serialize(Archive &ar, const unsigned int /*version*/)
3425 {
3428 }
3429
3434 std::string
3435 get_xdmf_content(const unsigned int indent_level) const;
3436
3437private:
3441 bool valid;
3442
3446 std::string h5_sol_filename;
3447
3451 std::string h5_mesh_filename;
3452
3457
3461 std::uint64_t num_nodes;
3462
3466 std::uint64_t num_cells;
3467
3471 unsigned int dimension;
3472
3477 unsigned int space_dimension;
3478
3484
3488 std::map<std::string, unsigned int> attribute_dims;
3489};
3490
3491
3492
3493/* -------------------- inline functions ------------------- */
3494
3495namespace DataOutBase
3496{
3497 inline bool
3499 {
3500 return (red == green) && (red == blue);
3501 }
3502
3503
3504 /* -------------------- template functions ------------------- */
3505
3512 template <int dim, int spacedim>
3513 std::ostream &
3514 operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3515
3516
3517
3524 template <int dim, int spacedim>
3525 std::istream &
3526 operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3527} // namespace DataOutBase
3528
3529
3531
3532#endif
const double * get_data_set(const unsigned int set_num) const
std::map< unsigned int, unsigned int > filtered_points
std::string get_data_set_name(const unsigned int set_num) const
std::multimap< Point< 3 >, unsigned int, Point3Comp > Map3DPoint
void internal_add_cell(const unsigned int cell_index, const unsigned int pt_index)
void write_cell(const unsigned int index, const unsigned int start, const std::array< unsigned int, dim > &offsets)
std::vector< unsigned int > data_set_dims
unsigned int n_nodes() const
void fill_node_data(std::vector< double > &node_data) const
std::vector< std::vector< double > > data_sets
unsigned int get_data_set_dim(const unsigned int set_num) const
void write_data_set(const std::string &name, const unsigned int dimension, const unsigned int set_num, const Table< 2, double > &data_vectors)
std::map< unsigned int, unsigned int > filtered_cells
void write_cell_single(const unsigned int index, const unsigned int start, const unsigned int n_points, const ReferenceCell &reference_cell)
std::vector< std::string > data_set_names
void fill_cell_data(const unsigned int local_node_offset, std::vector< unsigned int > &cell_data) const
void write_point(const unsigned int index, const Point< dim > &p)
unsigned int n_cells() const
DataOutBase::DataOutFilterFlags flags
unsigned int n_data_sets() const
XDMFEntry create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, const MPI_Comm comm) const
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const
unsigned int default_subdivisions
void parse_parameters(ParameterHandler &prm)
DataOutBase::Deal_II_IntermediateFlags deal_II_intermediate_flags
void write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names) const
static void declare_parameters(ParameterHandler &prm)
virtual std::vector< std::string > get_dataset_names() const =0
DataOutBase::TecplotFlags tecplot_flags
void write_ucd(std::ostream &out) const
void write_povray(std::ostream &out) const
std::string default_suffix(const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
void write_xdmf_file(const std::vector< XDMFEntry > &entries, const std::string &filename, const MPI_Comm comm) const
DataOutBase::GmvFlags gmv_flags
std::size_t memory_consumption() const
void set_default_format(const DataOutBase::OutputFormat default_format)
DataOutBase::Hdf5Flags hdf5_flags
DataOutBase::PovrayFlags povray_flags
DataOutBase::UcdFlags ucd_flags
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
DataOutBase::OutputFormat default_fmt
DataOutBase::GnuplotFlags gnuplot_flags
void write_gnuplot(std::ostream &out) const
virtual ~DataOutInterface()=default
void write_vtu(std::ostream &out) const
void write_hdf5_parallel(const DataOutBase::DataOutFilter &data_filter, const std::string &filename, const MPI_Comm comm) const
void write_tecplot(std::ostream &out) const
void write_deal_II_intermediate_in_parallel(const std::string &filename, const MPI_Comm comm, const DataOutBase::CompressionLevel compression) const
void write_svg(std::ostream &out) const
void write_vtu_in_parallel(const std::string &filename, const MPI_Comm comm) const
DataOutBase::SvgFlags svg_flags
void validate_dataset_names() const
void set_flags(const FlagType &flags)
void write_vtk(std::ostream &out) const
virtual const std::vector< DataOutBase::Patch< dim, spacedim > > & get_patches() const =0
DataOutBase::VtkFlags vtk_flags
void write_gmv(std::ostream &out) const
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
DataOutBase::EpsFlags eps_flags
void write_eps(std::ostream &out) const
DataOutBase::DXFlags dx_flags
void write_dx(std::ostream &out) const
void write_deal_II_intermediate(std::ostream &out) const
void merge(const DataOutReader< dim, spacedim > &other)
void read_whole_parallel_file(std::istream &in)
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > nonscalar_data_ranges
virtual const std::vector<::DataOutBase::Patch< dim, spacedim > > & get_patches() const override
void read(std::istream &in)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
virtual std::vector< std::string > get_dataset_names() const override
std::vector< std::string > dataset_names
std::vector<::DataOutBase::Patch< dim, spacedim > > patches
Definition point.h:111
ReferenceCell cell_type
std::uint64_t num_nodes
unsigned int dimension
std::string h5_sol_filename
void serialize(Archive &ar, const unsigned int)
double entry_time
std::string h5_mesh_filename
std::string get_xdmf_content(const unsigned int indent_level) const
void add_attribute(const std::string &attr_name, const unsigned int dimension)
std::uint64_t num_cells
std::map< std::string, unsigned int > attribute_dims
unsigned int space_dimension
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
unsigned int cell_index
static ::ExceptionBase & ExcIncompatiblePatchLists()
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition exceptions.h:580
static ::ExceptionBase & ExcNotEnoughSpaceDimensionLabels()
static ::ExceptionBase & ExcInvalidCombinationOfDimensions(int arg1, int arg2)
static ::ExceptionBase & ExcNoPatches()
static ::ExceptionBase & ExcTecplotAPIError()
#define DeclException2(Exception2, type1, type2, outsequence)
Definition exceptions.h:534
static ::ExceptionBase & ExcIncompatibleDimensions(int arg1, int arg2, int arg3, int arg4)
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:489
static ::ExceptionBase & ExcIncompatibleDatasetNames()
#define DeclException1(Exception1, type1, outsequence)
Definition exceptions.h:511
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
const MPI_Comm comm
Definition mpi.cc:913
void write_eps(const std::vector< Patch< 2, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > &nonscalar_data_ranges, const EpsFlags &flags, std::ostream &out)
std::pair< unsigned int, unsigned int > determine_intermediate_format_dimensions(std::istream &input)
std::ostream & operator<<(std::ostream &out, const Patch< dim, spacedim > &patch)
void write_deal_II_intermediate_in_parallel(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, const std::string &filename, const MPI_Comm comm, const CompressionLevel compression)
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_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_vtu_header(std::ostream &out, const VtkFlags &flags)
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_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 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_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_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)
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)
OutputFormat parse_output_format(const std::string &format_name)
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim > > &patches, const DataOutFilter &data_filter, const DataOutBase::Hdf5Flags &flags, const std::string &filename, const MPI_Comm comm)
std::istream & operator>>(std::istream &in, Patch< dim, spacedim > &patch)
std::string get_output_format_names()
void write_svg(const std::vector< Patch< 2, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > &nonscalar_data_ranges, const SvgFlags &flags, std::ostream &out)
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
std::string default_suffix(const OutputFormat output_format)
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)
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_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_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)
static const unsigned int invalid_unsigned_int
Definition types.h:220
void parse_parameters(const ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
std::size_t memory_consumption() const
void parse_parameters(const ParameterHandler &prm)
bool operator()(const Point< 3 > &one, const Point< 3 > &two) const
static const unsigned int format_version
static void declare_parameters(ParameterHandler &prm)
static RgbValues default_color_function(const double value, const double min_value, const double max_value)
void parse_parameters(const ParameterHandler &prm)
ColorFunction color_function
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
unsigned int color_vector
static RgbValues reverse_grey_scale_color_function(const double value, const double min_value, const double max_value)
@ width
Scale to given width.
@ height
Scale to given height.
unsigned int height_vector
std::vector< std::string > space_dimension_labels
std::size_t memory_consumption() const
DataOutBase::CompressionLevel compression_level
std::size_t memory_consumption() const
static void declare_parameters(ParameterHandler &prm)
void parse_parameters(const ParameterHandler &prm)
static const unsigned int n_subdivisions
static const ReferenceCell reference_cell
std::size_t memory_consumption() const
unsigned int patch_index
ReferenceCell reference_cell
Table< 2, float > data
static const unsigned int no_neighbor
bool operator==(const Patch &patch) const
void swap(Patch< dim, spacedim > &other_patch) noexcept
static const unsigned int space_dim
unsigned int n_subdivisions
std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > vertices
std::array< unsigned int, GeometryInfo< dim >::faces_per_cell > neighbors
static void declare_parameters(ParameterHandler &prm)
void parse_parameters(const ParameterHandler &prm)
unsigned int line_thickness
std::size_t memory_consumption() const
void parse_parameters(const ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
std::map< std::string, std::string > physical_units
DataOutBase::CompressionLevel compression_level