Reference documentation for deal.II version 9.6.0
\(\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
1238
1239
1245 struct SvgFlags : public OutputFlagsBase<SvgFlags>
1246 {
1250 unsigned int height;
1251
1256 unsigned int width;
1257
1264 unsigned int height_vector;
1265
1270
1271 unsigned int line_thickness;
1272
1277
1282
1286 SvgFlags(const unsigned int height_vector = 0,
1287 const int azimuth_angle = 37,
1288 const int polar_angle = 45,
1289 const unsigned int line_thickness = 1,
1290 const bool margin = true,
1291 const bool draw_colorbar = true);
1292 };
1293
1294
1302 : public OutputFlagsBase<Deal_II_IntermediateFlags>
1303 {
1310 static const unsigned int format_version;
1311 };
1312
1319 {
1330
1336
1341 const bool xdmf_hdf5_output = false);
1342
1347 static void
1349
1356 void
1358
1363 std::size_t
1365 };
1366
1399 {
1400 public:
1404 DataOutFilter();
1405
1411
1417 template <int dim>
1418 void
1419 write_point(const unsigned int index, const Point<dim> &p);
1420
1424 template <int dim>
1425 void
1426 write_cell(const unsigned int index,
1427 const unsigned int start,
1428 const std::array<unsigned int, dim> &offsets);
1429
1434 void
1435 write_cell_single(const unsigned int index,
1436 const unsigned int start,
1437 const unsigned int n_points,
1438 const ReferenceCell &reference_cell);
1439
1446 void
1447 write_data_set(const std::string &name,
1448 const unsigned int dimension,
1449 const unsigned int set_num,
1450 const Table<2, double> &data_vectors);
1451
1456 void
1457 fill_node_data(std::vector<double> &node_data) const;
1458
1463 void
1464 fill_cell_data(const unsigned int local_node_offset,
1465 std::vector<unsigned int> &cell_data) const;
1466
1470 std::string
1471 get_data_set_name(const unsigned int set_num) const;
1472
1476 unsigned int
1477 get_data_set_dim(const unsigned int set_num) const;
1478
1483 const double *
1484 get_data_set(const unsigned int set_num) const;
1485
1490 unsigned int
1491 n_nodes() const;
1492
1497 unsigned int
1498 n_cells() const;
1499
1504 unsigned int
1505 n_data_sets() const;
1506
1510 void
1511 flush_points();
1512
1516 void
1517 flush_cells();
1518
1519
1520 private:
1525 {
1526 bool
1527 operator()(const Point<3> &one, const Point<3> &two) const
1528 {
1529 /*
1530 * The return statement below is an optimized version of the following
1531 * code:
1532 *
1533 * for (unsigned int d=0; d<3; ++d)
1534 * {
1535 * if (one(d) < two(d))
1536 * return true;
1537 * else if (one(d) > two(d))
1538 * return false;
1539 * }
1540 * return false;
1541 */
1542
1543 return (one[0] < two[0] ||
1544 (!(two[0] < one[0]) &&
1545 (one[1] < two[1] || (!(two[1] < one[1]) && one[2] < two[2]))));
1546 }
1547 };
1548
1549 using Map3DPoint = std::multimap<Point<3>, unsigned int, Point3Comp>;
1550
1555
1562 unsigned int node_dim;
1563
1568 unsigned int num_cells;
1569
1574
1578 std::map<unsigned int, unsigned int> filtered_points;
1579
1583 std::map<unsigned int, unsigned int> filtered_cells;
1584
1588 std::vector<std::string> data_set_names;
1589
1593 std::vector<unsigned int> data_set_dims;
1594
1598 std::vector<std::vector<double>> data_sets;
1599
1603 void
1604 internal_add_cell(const unsigned int cell_index,
1605 const unsigned int pt_index);
1606 };
1607
1608
1613 {
1618
1623
1628
1633
1638
1643
1648
1653
1658
1663
1668
1673
1678
1682 hdf5
1684
1685
1689 template <int dim, int spacedim>
1690 void
1691 write_dx(
1692 const std::vector<Patch<dim, spacedim>> &patches,
1693 const std::vector<std::string> &data_names,
1694 const std::vector<
1695 std::tuple<unsigned int,
1696 unsigned int,
1697 std::string,
1699 &nonscalar_data_ranges,
1700 const DXFlags &flags,
1701 std::ostream &out);
1702
1747 template <int spacedim>
1748 void
1749 write_eps(
1750 const std::vector<Patch<2, spacedim>> &patches,
1751 const std::vector<std::string> &data_names,
1752 const std::vector<
1753 std::tuple<unsigned int,
1754 unsigned int,
1755 std::string,
1757 &nonscalar_data_ranges,
1758 const EpsFlags &flags,
1759 std::ostream &out);
1760
1766 template <int dim, int spacedim>
1767 void
1768 write_eps(
1769 const std::vector<Patch<dim, spacedim>> &patches,
1770 const std::vector<std::string> &data_names,
1771 const std::vector<
1772 std::tuple<unsigned int,
1773 unsigned int,
1774 std::string,
1776 &nonscalar_data_ranges,
1777 const EpsFlags &flags,
1778 std::ostream &out);
1779
1780
1790 template <int dim, int spacedim>
1791 void
1792 write_gmv(
1793 const std::vector<Patch<dim, spacedim>> &patches,
1794 const std::vector<std::string> &data_names,
1795 const std::vector<
1796 std::tuple<unsigned int,
1797 unsigned int,
1798 std::string,
1800 &nonscalar_data_ranges,
1801 const GmvFlags &flags,
1802 std::ostream &out);
1803
1859 template <int dim, int spacedim>
1860 void
1862 const std::vector<Patch<dim, spacedim>> &patches,
1863 const std::vector<std::string> &data_names,
1864 const std::vector<
1865 std::tuple<unsigned int,
1866 unsigned int,
1867 std::string,
1869 &nonscalar_data_ranges,
1870 const GnuplotFlags &flags,
1871 std::ostream &out);
1872
1918 template <int dim, int spacedim>
1919 void
1921 const std::vector<Patch<dim, spacedim>> &patches,
1922 const std::vector<std::string> &data_names,
1923 const std::vector<
1924 std::tuple<unsigned int,
1925 unsigned int,
1926 std::string,
1928 &nonscalar_data_ranges,
1929 const PovrayFlags &flags,
1930 std::ostream &out);
1931
1938 template <int dim, int spacedim>
1939 void
1941 const std::vector<Patch<dim, spacedim>> &patches,
1942 const std::vector<std::string> &data_names,
1943 const std::vector<
1944 std::tuple<unsigned int,
1945 unsigned int,
1946 std::string,
1948 &nonscalar_data_ranges,
1949 const TecplotFlags &flags,
1950 std::ostream &out);
1951
1966 template <int dim, int spacedim>
1967 void
1968 write_ucd(
1969 const std::vector<Patch<dim, spacedim>> &patches,
1970 const std::vector<std::string> &data_names,
1971 const std::vector<
1972 std::tuple<unsigned int,
1973 unsigned int,
1974 std::string,
1976 &nonscalar_data_ranges,
1977 const UcdFlags &flags,
1978 std::ostream &out);
1979
1999 template <int dim, int spacedim>
2000 void
2001 write_vtk(
2002 const std::vector<Patch<dim, spacedim>> &patches,
2003 const std::vector<std::string> &data_names,
2004 const std::vector<
2005 std::tuple<unsigned int,
2006 unsigned int,
2007 std::string,
2009 &nonscalar_data_ranges,
2010 const VtkFlags &flags,
2011 std::ostream &out);
2012
2013
2037 template <int dim, int spacedim>
2038 void
2039 write_vtu(
2040 const std::vector<Patch<dim, spacedim>> &patches,
2041 const std::vector<std::string> &data_names,
2042 const std::vector<
2043 std::tuple<unsigned int,
2044 unsigned int,
2045 std::string,
2047 &nonscalar_data_ranges,
2048 const VtkFlags &flags,
2049 std::ostream &out);
2050
2056 void
2057 write_vtu_header(std::ostream &out, const VtkFlags &flags);
2058
2065 void
2066 write_vtu_footer(std::ostream &out);
2067
2074 template <int dim, int spacedim>
2075 void
2077 const std::vector<Patch<dim, spacedim>> &patches,
2078 const std::vector<std::string> &data_names,
2079 const std::vector<
2080 std::tuple<unsigned int,
2081 unsigned int,
2082 std::string,
2084 &nonscalar_data_ranges,
2085 const VtkFlags &flags,
2086 std::ostream &out);
2087
2129 void
2131 std::ostream &out,
2132 const std::vector<std::string> &piece_names,
2133 const std::vector<std::string> &data_names,
2134 const std::vector<
2135 std::tuple<unsigned int,
2136 unsigned int,
2137 std::string,
2139 &nonscalar_data_ranges,
2140 const VtkFlags &flags);
2141
2190 void
2192 std::ostream &out,
2193 const std::vector<std::pair<double, std::string>> &times_and_names);
2194
2206 void
2207 write_visit_record(std::ostream &out,
2208 const std::vector<std::string> &piece_names);
2209
2237 void
2238 write_visit_record(std::ostream &out,
2239 const std::vector<std::vector<std::string>> &piece_names);
2240
2273 void
2275 std::ostream &out,
2276 const std::vector<std::pair<double, std::vector<std::string>>>
2277 &times_and_piece_names);
2278
2299 template <int spacedim>
2300 void
2301 write_svg(
2302 const std::vector<Patch<2, spacedim>> &patches,
2303 const std::vector<std::string> &data_names,
2304 const std::vector<
2305 std::tuple<unsigned int,
2306 unsigned int,
2307 std::string,
2309 &nonscalar_data_ranges,
2310 const SvgFlags &flags,
2311 std::ostream &out);
2312
2350 template <int dim, int spacedim>
2351 void
2353 const std::vector<Patch<dim, spacedim>> &patches,
2354 const std::vector<std::string> &data_names,
2355 const std::vector<
2356 std::tuple<unsigned int,
2357 unsigned int,
2358 std::string,
2360 &nonscalar_data_ranges,
2361 const Deal_II_IntermediateFlags &flags,
2362 std::ostream &out);
2363
2372 template <int dim, int spacedim>
2373 void
2375 const std::vector<Patch<dim, spacedim>> &patches,
2376 const std::vector<std::string> &data_names,
2377 const std::vector<
2378 std::tuple<unsigned int,
2379 unsigned int,
2380 std::string,
2382 &nonscalar_data_ranges,
2383 const Deal_II_IntermediateFlags &flags,
2384 const std::string &filename,
2385 const MPI_Comm comm,
2386 const CompressionLevel compression);
2387
2392 template <int dim, int spacedim>
2393 void
2394 write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2395 const DataOutFilter &data_filter,
2396 const DataOutBase::Hdf5Flags &flags,
2397 const std::string &filename,
2398 const MPI_Comm comm);
2399
2407 template <int dim, int spacedim>
2408 void
2409 write_hdf5_parallel(const std::vector<Patch<dim, spacedim>> &patches,
2410 const DataOutFilter &data_filter,
2411 const DataOutBase::Hdf5Flags &flags,
2412 const bool write_mesh_file,
2413 const std::string &mesh_filename,
2414 const std::string &solution_filename,
2415 const MPI_Comm comm);
2416
2423 template <int dim, int spacedim>
2424 void
2426 const std::vector<Patch<dim, spacedim>> &patches,
2427 const std::vector<std::string> &data_names,
2428 const std::vector<
2429 std::tuple<unsigned int,
2430 unsigned int,
2431 std::string,
2433 &nonscalar_data_ranges,
2434 DataOutFilter &filtered_data);
2435
2447 std::pair<unsigned int, unsigned int>
2448 determine_intermediate_format_dimensions(std::istream &input);
2449
2461 OutputFormat
2462 parse_output_format(const std::string &format_name);
2463
2469 std::string
2471
2491 std::string
2492 default_suffix(const OutputFormat output_format);
2493
2503 int,
2504 int,
2505 << "The number of points in this data set is " << arg1
2506 << ", but we expected " << arg2
2507 << " in each space direction.");
2512 "You are trying to write graphical data into a file, but "
2513 "no data is available in the intermediate format that "
2514 "the DataOutBase functions require. Did you forget to "
2515 "call a function such as DataOut::build_patches()?");
2520 "The error code of one of the Tecplot functions was "
2521 "not zero as expected.");
2526 char *,
2527 << "There was an error opening Tecplot file " << arg1
2528 << " for output.");
2529
2531} // namespace DataOutBase
2532
2533
2534
2641template <int dim, int spacedim = dim>
2643{
2644public:
2649
2654 virtual ~DataOutInterface() = default;
2655
2660 void
2661 write_dx(std::ostream &out) const;
2662
2667 void
2668 write_eps(std::ostream &out) const;
2669
2674 void
2675 write_gmv(std::ostream &out) const;
2676
2681 void
2682 write_gnuplot(std::ostream &out) const;
2683
2688 void
2689 write_povray(std::ostream &out) const;
2690
2695 void
2696 write_tecplot(std::ostream &out) const;
2697
2702 void
2703 write_ucd(std::ostream &out) const;
2704
2716 void
2717 write_vtk(std::ostream &out) const;
2718
2733 void
2734 write_vtu(std::ostream &out) const;
2735
2746 void
2747 write_vtu_in_parallel(const std::string &filename, const MPI_Comm comm) const;
2748
2782 void
2783 write_pvtu_record(std::ostream &out,
2784 const std::vector<std::string> &piece_names) const;
2785
2847 std::string
2849 const std::string &directory,
2850 const std::string &filename_without_extension,
2851 const unsigned int counter,
2852 const MPI_Comm mpi_communicator,
2853 const unsigned int n_digits_for_counter = numbers::invalid_unsigned_int,
2854 const unsigned int n_groups = 0) const;
2855
2860 void
2861 write_svg(std::ostream &out) const;
2862
2873 void
2874 write_deal_II_intermediate(std::ostream &out) const;
2875
2882 void
2884 const std::string &filename,
2885 const MPI_Comm comm,
2886 const DataOutBase::CompressionLevel compression) const;
2887
2893 XDMFEntry
2895 const std::string &h5_filename,
2896 const double cur_time,
2897 const MPI_Comm comm) const;
2898
2904 XDMFEntry
2906 const std::string &h5_mesh_filename,
2907 const std::string &h5_solution_filename,
2908 const double cur_time,
2909 const MPI_Comm comm) const;
2910
2935 void
2936 write_xdmf_file(const std::vector<XDMFEntry> &entries,
2937 const std::string &filename,
2938 const MPI_Comm comm) const;
2939
2954 void
2956 const std::string &filename,
2957 const MPI_Comm comm) const;
2958
2966 void
2968 const bool write_mesh_file,
2969 const std::string &mesh_filename,
2970 const std::string &solution_filename,
2971 const MPI_Comm comm) const;
2972
2979 void
2980 write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const;
2981
2982
2991 void
2992 write(std::ostream &out,
2993 const DataOutBase::OutputFormat output_format =
2995
3000 void
3001 set_default_format(const DataOutBase::OutputFormat default_format);
3002
3003
3008 template <typename FlagType>
3009 void
3010 set_flags(const FlagType &flags);
3011
3012
3020 std::string
3021 default_suffix(const DataOutBase::OutputFormat output_format =
3023
3038 static void
3040
3048 void
3050
3056 std::size_t
3057 memory_consumption() const;
3058
3059protected:
3067 virtual const std::vector<DataOutBase::Patch<dim, spacedim>> &
3068 get_patches() const = 0;
3069
3074 virtual std::vector<std::string>
3076
3095 virtual std::vector<
3096 std::tuple<unsigned int,
3097 unsigned int,
3098 std::string,
3101
3108 void
3109 validate_dataset_names() const;
3110
3111
3118
3119private:
3126
3132
3138
3144
3150
3156
3162
3168
3174
3180
3186
3192};
3193
3194
3195
3241template <int dim, int spacedim = dim>
3242class DataOutReader : public DataOutInterface<dim, spacedim>
3243{
3244public:
3250 void
3251 read(std::istream &in);
3252
3258 void
3259 read_whole_parallel_file(std::istream &in);
3260
3282 void
3283 merge(const DataOutReader<dim, spacedim> &other);
3284
3289 "You are trying to merge two sets of patches for which the "
3290 "declared names of the variables do not match.");
3295 "You are trying to merge two sets of patches for which the "
3296 "number of subdivisions or the number of vector components "
3297 "do not match.");
3302 int,
3303 int,
3304 int,
3305 int,
3306 << "Either the dimensions <" << arg1 << "> and <" << arg2
3307 << "> or the space dimensions <" << arg3 << "> and <" << arg4
3308 << "> do not match!");
3309
3310protected:
3319 virtual const std::vector<::DataOutBase::Patch<dim, spacedim>> &
3320 get_patches() const override;
3321
3328 virtual std::vector<std::string>
3329 get_dataset_names() const override;
3330
3349 virtual std::vector<
3350 std::tuple<unsigned int,
3351 unsigned int,
3352 std::string,
3354 get_nonscalar_data_ranges() const override;
3355
3356private:
3361 std::vector<::DataOutBase::Patch<dim, spacedim>> patches;
3362 std::vector<std::string> dataset_names;
3363
3368 std::vector<
3369 std::tuple<unsigned int,
3370 unsigned int,
3371 std::string,
3374};
3375
3376
3377
3386{
3387public:
3391 XDMFEntry();
3392
3398 XDMFEntry(const std::string &filename,
3399 const double time,
3400 const std::uint64_t nodes,
3401 const std::uint64_t cells,
3402 const unsigned int dim,
3403 const ReferenceCell &cell_type);
3404
3410 XDMFEntry(const std::string &filename,
3411 const double time,
3412 const std::uint64_t nodes,
3413 const std::uint64_t cells,
3414 const unsigned int dim);
3415
3421 XDMFEntry(const std::string &mesh_filename,
3422 const std::string &solution_filename,
3423 const double time,
3424 const std::uint64_t nodes,
3425 const std::uint64_t cells,
3426 const unsigned int dim);
3427
3432 XDMFEntry(const std::string &mesh_filename,
3433 const std::string &solution_filename,
3434 const double time,
3435 const std::uint64_t nodes,
3436 const std::uint64_t cells,
3437 const unsigned int dim,
3438 const ReferenceCell &cell_type);
3439
3446 XDMFEntry(const std::string &mesh_filename,
3447 const std::string &solution_filename,
3448 const double time,
3449 const std::uint64_t nodes,
3450 const std::uint64_t cells,
3451 const unsigned int dim,
3452 const unsigned int spacedim);
3453
3457 XDMFEntry(const std::string &mesh_filename,
3458 const std::string &solution_filename,
3459 const double time,
3460 const std::uint64_t nodes,
3461 const std::uint64_t cells,
3462 const unsigned int dim,
3463 const unsigned int spacedim,
3464 const ReferenceCell &cell_type);
3465
3469 void
3470 add_attribute(const std::string &attr_name, const unsigned int dimension);
3471
3477 template <class Archive>
3478 void
3479 serialize(Archive &ar, const unsigned int /*version*/)
3480 {
3483 }
3484
3489 std::string
3490 get_xdmf_content(const unsigned int indent_level) const;
3491
3499 std::string
3500 get_xdmf_content(const unsigned int indent_level,
3501 const ReferenceCell &reference_cell) const;
3502
3503private:
3507 bool valid;
3508
3512 std::string h5_sol_filename;
3513
3517 std::string h5_mesh_filename;
3518
3523
3527 std::uint64_t num_nodes;
3528
3532 std::uint64_t num_cells;
3533
3537 unsigned int dimension;
3538
3543 unsigned int space_dimension;
3544
3550
3554 std::map<std::string, unsigned int> attribute_dims;
3555};
3556
3557
3558
3559/* -------------------- inline functions ------------------- */
3560
3561namespace DataOutBase
3562{
3563 inline bool
3565 {
3566 return (red == green) && (red == blue);
3567 }
3568
3569
3570 /* -------------------- template functions ------------------- */
3571
3578 template <int dim, int spacedim>
3579 std::ostream &
3580 operator<<(std::ostream &out, const Patch<dim, spacedim> &patch);
3581
3582
3583
3590 template <int dim, int spacedim>
3591 std::istream &
3592 operator>>(std::istream &in, Patch<dim, spacedim> &patch);
3593} // namespace DataOutBase
3594
3595
3597
3598#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_DEPRECATED
Definition config.h:207
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
unsigned int cell_index
static ::ExceptionBase & ExcIncompatiblePatchLists()
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
Definition exceptions.h:585
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:539
static ::ExceptionBase & ExcIncompatibleDimensions(int arg1, int arg2, int arg3, int arg4)
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:494
static ::ExceptionBase & ExcIncompatibleDatasetNames()
#define DeclException1(Exception1, type1, outsequence)
Definition exceptions.h:516
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
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
*braid_SplitCommworld & comm
void parse_parameters(const ParameterHandler &prm)
DXFlags(const bool write_neighbors=false, const bool int_binary=false, const bool coordinates_binary=false, const bool data_binary=false)
static void declare_parameters(ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
std::size_t memory_consumption() const
void parse_parameters(const ParameterHandler &prm)
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
bool operator()(const Point< 3 > &one, const Point< 3 > &two) const
static const unsigned int format_version
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
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
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
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 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
Hdf5Flags(const CompressionLevel compression_level=CompressionLevel::best_speed)
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)
PovrayFlags(const bool smooth=false, const bool bicubic_patch=false, const bool external_data=false)
void parse_parameters(const ParameterHandler &prm)
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 line_thickness
std::size_t memory_consumption() const
TecplotFlags(const char *zone_name=nullptr, const double solution_time=-1.0)
void parse_parameters(const ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
UcdFlags(const bool write_preamble=false)
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 CompressionLevel compression_level=CompressionLevel::best_speed, const bool write_higher_order_cells=false, const std::map< std::string, std::string > &physical_units={})
std::map< std::string, std::string > physical_units
static const DataOutBase::CompressionLevel default_compression
static const DataOutBase::CompressionLevel best_compression
static const DataOutBase::CompressionLevel best_speed
DataOutBase::CompressionLevel compression_level
static const DataOutBase::CompressionLevel no_compression