39#ifdef DEAL_II_WITH_ZLIB
43#ifdef DEAL_II_WITH_HDF5
47#include <boost/iostreams/copy.hpp>
48#include <boost/iostreams/device/back_inserter.hpp>
49#include <boost/iostreams/filtering_stream.hpp>
50#ifdef DEAL_II_WITH_ZLIB
51# include <boost/iostreams/filter/zlib.hpp>
65 <<
"Unexpected input: expected line\n <" << arg1
66 <<
">\nbut got\n <" << arg2 <<
">");
72#ifdef DEAL_II_WITH_ZLIB
73 constexpr bool deal_ii_with_zlib =
true;
75 constexpr bool deal_ii_with_zlib =
false;
79#ifdef DEAL_II_WITH_ZLIB
90 return Z_NO_COMPRESSION;
94 return Z_BEST_COMPRESSION;
96 return Z_DEFAULT_COMPRESSION;
99 return Z_NO_COMPRESSION;
103# ifdef DEAL_II_WITH_MPI
114 return boost::iostreams::zlib::no_compression;
116 return boost::iostreams::zlib::best_speed;
118 return boost::iostreams::zlib::best_compression;
120 return boost::iostreams::zlib::default_compression;
123 return boost::iostreams::zlib::no_compression;
133 template <
typename T>
135 compress_array(
const std::vector<T> &data,
138#ifdef DEAL_II_WITH_ZLIB
139 if (data.size() != 0)
141 const std::size_t uncompressed_size = (data.size() *
sizeof(T));
149 std::numeric_limits<std::uint32_t>::max(),
153 auto compressed_data_length = compressBound(uncompressed_size);
155 std::numeric_limits<std::uint32_t>::max(),
158 std::vector<unsigned char> compressed_data(compressed_data_length);
160 int err = compress2(&compressed_data[0],
161 &compressed_data_length,
162 reinterpret_cast<const Bytef *
>(data.data()),
164 get_zlib_compression_level(compression_level));
169 compressed_data.resize(compressed_data_length);
172 const std::uint32_t compression_header[4] = {
174 static_cast<std::uint32_t
>(uncompressed_size),
175 static_cast<std::uint32_t
>(
177 static_cast<std::uint32_t
>(
178 compressed_data_length)};
180 const auto *
const header_start =
181 reinterpret_cast<const unsigned char *
>(&compression_header[0]);
184 {header_start, header_start + 4 *
sizeof(std::uint32_t)}) +
191 (void)compression_level;
193 ExcMessage(
"This function can only be called if cmake found "
194 "a working libz installation."));
209 template <
typename T>
211 vtu_stringize_array(
const std::vector<T> &data,
215 if (deal_ii_with_zlib &&
219 return compress_array(data, compression_level);
223 std::ostringstream stream;
224 stream.precision(precision);
225 for (
const T &el : data)
240 struct ParallelIntermediateHeader
243 std::uint64_t version;
244 std::uint64_t compression;
245 std::uint64_t dimension;
246 std::uint64_t space_dimension;
247 std::uint64_t n_ranks;
248 std::uint64_t n_patches;
296 SvgCell::operator<(
const SvgCell &e)
const
337 EpsCell2d::operator<(
const EpsCell2d &e)
const
356 template <
int dim,
int spacedim,
typename Number =
double>
357 std::unique_ptr<Table<2, Number>>
358 create_global_data_table(
const std::vector<Patch<dim, spacedim>> &patches)
362 return std::make_unique<Table<2, Number>>();
371 const unsigned int n_data_sets = patches[0].points_are_available ?
372 (patches[0].data.n_rows() - spacedim) :
373 patches[0].data.n_rows();
374 const unsigned int n_data_points =
375 std::accumulate(patches.begin(),
378 [](
const unsigned int count,
380 return count + patch.data.n_cols();
383 std::unique_ptr<Table<2, Number>> global_data_table =
384 std::make_unique<Table<2, Number>>(n_data_sets, n_data_points);
387 unsigned int next_value = 0;
388 for (
const auto &patch : patches)
390 const unsigned int n_subdivisions = patch.n_subdivisions;
391 (void)n_subdivisions;
393 Assert((patch.data.n_rows() == n_data_sets &&
394 !patch.points_are_available) ||
395 (patch.data.n_rows() == n_data_sets + spacedim &&
396 patch.points_are_available),
398 (n_data_sets + spacedim) :
400 patch.data.n_rows()));
402 (n_data_sets == 0) ||
403 (patch.data.n_cols() ==
406 n_subdivisions + 1));
408 for (
unsigned int i = 0; i < patch.data.n_cols(); ++i, ++next_value)
409 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
410 (*global_data_table)[data_set][next_value] =
411 patch.data(data_set, i);
415 return global_data_table;
423 , node_dim(
numbers::invalid_unsigned_int)
431 , node_dim(
numbers::invalid_unsigned_int)
444 for (
unsigned int d = 0; d < dim; ++d)
448 unsigned int internal_ind;
459 internal_ind = it->second;
469 const unsigned int pt_index)
487 for (
unsigned int d = 0; d <
node_dim; ++d)
488 node_data[
node_dim * existing_point.second + d] =
489 existing_point.first[d];
497 std::vector<unsigned int> &cell_data)
const
503 cell_data[filtered_cell.first] =
504 filtered_cell.second + local_node_offset;
573 const unsigned int start,
574 const std::array<unsigned int, dim> &offsets)
578 const unsigned int base_entry =
591 const unsigned int d1 = offsets[0];
600 const unsigned int d1 = offsets[0];
601 const unsigned int d2 = offsets[1];
612 const unsigned int d1 = offsets[0];
613 const unsigned int d2 = offsets[1];
614 const unsigned int d3 = offsets[2];
636 const unsigned int start,
637 const unsigned int n_points,
642 const unsigned int base_entry = index * n_points;
644 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
646 for (
unsigned int i = 0; i < n_points; ++i)
657 const unsigned int dimension,
658 const unsigned int set_num,
661 unsigned int new_dim;
680 for (
unsigned int d = 0; d < new_dim; ++d)
683 data_sets.back()[r * new_dim + d] = data_vectors(set_num + d, i);
699 const char *gmv_cell_type[4] = {
"",
"line 2",
"quad 4",
"hex 8"};
701 const char *ucd_cell_type[4] = {
"pt",
"line",
"quad",
"hex"};
703 const char *tecplot_cell_type[4] = {
"",
"lineseg",
"quadrilateral",
"brick"};
718 template <
int dim,
int spacedim>
719 std::array<unsigned int, 3>
721 const bool write_higher_order_cells)
723 std::array<unsigned int, 3> vtk_cell_id = {
729 if (write_higher_order_cells)
732 vtk_cell_id[2] = patch.
data.n_cols();
738 patch.
data.n_cols() == 6)
742 vtk_cell_id[2] = patch.
data.n_cols();
745 patch.
data.n_cols() == 10)
749 vtk_cell_id[2] = patch.
data.n_cols();
774 template <
int dim,
int spacedim>
776 get_equispaced_location(
778 const std::initializer_list<unsigned int> &lattice_location,
779 const unsigned int n_subdivisions)
786 const unsigned int xstep = (dim > 0 ? *(lattice_location.begin() + 0) : 0);
787 const unsigned int ystep = (dim > 1 ? *(lattice_location.begin() + 1) : 0);
788 const unsigned int zstep = (dim > 2 ? *(lattice_location.begin() + 2) : 0);
796 unsigned int point_no = 0;
801 point_no += (n_subdivisions + 1) * (n_subdivisions + 1) * zstep;
805 point_no += (n_subdivisions + 1) * ystep;
819 for (
unsigned int d = 0;
d < spacedim; ++
d)
820 node[d] = patch.
data(patch.
data.size(0) - spacedim + d, point_no);
832 const double stepsize = 1. / n_subdivisions;
833 const double xfrac = xstep * stepsize;
839 const double yfrac = ystep * stepsize;
841 node += ((patch.
vertices[3] * xfrac) +
842 (patch.
vertices[2] * (1 - xfrac))) *
846 const double zfrac = zstep * stepsize;
848 node += (((patch.
vertices[5] * xfrac) +
849 (patch.
vertices[4] * (1 - xfrac))) *
852 (patch.
vertices[6] * (1 - xfrac))) *
865 template <
int dim,
int spacedim>
868 const unsigned int node_index)
873 unsigned int point_no_actual = node_index;
878 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
879 point_no_actual = table[node_index];
887 for (
unsigned int d = 0;
d < spacedim; ++
d)
889 patch.
data(patch.
data.size(0) - spacedim + d, point_no_actual);
902 return patch.
vertices[point_no_actual];
913 template <
int dim,
int spacedim>
914 std::tuple<unsigned int, unsigned int>
915 count_nodes_and_cells(
918 unsigned int n_nodes = 0;
920 for (
const auto &patch : patches)
924 "The reference cell for this patch is set to 'Invalid', "
925 "but that is clearly not a valid choice. Did you forget "
926 "to set the reference cell for the patch?"));
941 return std::make_tuple(n_nodes, n_cells);
951 template <
int dim,
int spacedim>
952 std::tuple<unsigned int, unsigned int, unsigned int>
953 count_nodes_and_cells_and_points(
955 const bool write_higher_order_cells)
957 unsigned int n_nodes = 0;
959 unsigned int n_points_and_n_cells = 0;
961 for (
const auto &patch : patches)
967 if (write_higher_order_cells)
973 n_points_and_n_cells +=
982 const unsigned int n_subcells =
985 n_points_and_n_cells +=
991 n_nodes += patch.
data.n_cols();
993 n_points_and_n_cells += patch.
data.n_cols() + 1;
997 return std::make_tuple(n_nodes, n_cells, n_points_and_n_cells);
1005 template <
typename FlagsType>
1012 StreamBase(std::ostream &stream,
const FlagsType &flags)
1013 : selected_component(
numbers::invalid_unsigned_int)
1024 write_point(
const unsigned int,
const Point<dim> &)
1027 ExcMessage(
"The derived class you are using needs to "
1028 "reimplement this function if you want to call "
1048 write_cell(
const unsigned int ,
1049 const unsigned int ,
1050 std::array<unsigned int, dim> & )
1053 ExcMessage(
"The derived class you are using needs to "
1054 "reimplement this function if you want to call "
1065 write_cell_single(
const unsigned int index,
1066 const unsigned int start,
1067 const unsigned int n_points,
1073 (void)reference_cell;
1076 ExcMessage(
"The derived class you are using needs to "
1077 "reimplement this function if you want to call "
1095 template <
typename T>
1109 unsigned int selected_component;
1116 std::ostream &stream;
1121 const FlagsType flags;
1127 class DXStream :
public StreamBase<DataOutBase::DXFlags>
1134 write_point(
const unsigned int index,
const Point<dim> &);
1146 write_cell(
const unsigned int index,
1147 const unsigned int start,
1148 const std::array<unsigned int, dim> &offsets);
1156 template <
typename data>
1158 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1164 class GmvStream :
public StreamBase<DataOutBase::GmvFlags>
1171 write_point(
const unsigned int index,
const Point<dim> &);
1183 write_cell(
const unsigned int index,
1184 const unsigned int start,
1185 const std::array<unsigned int, dim> &offsets);
1191 class TecplotStream :
public StreamBase<DataOutBase::TecplotFlags>
1198 write_point(
const unsigned int index,
const Point<dim> &);
1210 write_cell(
const unsigned int index,
1211 const unsigned int start,
1212 const std::array<unsigned int, dim> &offsets);
1218 class UcdStream :
public StreamBase<DataOutBase::UcdFlags>
1225 write_point(
const unsigned int index,
const Point<dim> &);
1239 write_cell(
const unsigned int index,
1240 const unsigned int start,
1241 const std::array<unsigned int, dim> &offsets);
1249 template <
typename data>
1251 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1257 class VtkStream :
public StreamBase<DataOutBase::VtkFlags>
1264 write_point(
const unsigned int index,
const Point<dim> &);
1276 write_cell(
const unsigned int index,
1277 const unsigned int start,
1278 const std::array<unsigned int, dim> &offsets);
1284 write_cell_single(
const unsigned int index,
1285 const unsigned int start,
1286 const unsigned int n_points,
1298 write_high_order_cell(
const unsigned int start,
1299 const std::vector<unsigned> &connectivity);
1312 DXStream::write_point(
const unsigned int,
const Point<dim> &p)
1314 if (flags.coordinates_binary)
1317 for (
unsigned int d = 0;
d < dim; ++
d)
1319 stream.write(
reinterpret_cast<const char *
>(data), dim *
sizeof(*data));
1323 for (
unsigned int d = 0;
d < dim; ++
d)
1324 stream << p[d] <<
'\t';
1338 std::array<unsigned int, GeometryInfo<0>::vertices_per_cell>
1339 set_node_numbers(
const unsigned int ,
1340 const std::array<unsigned int, 0> & )
1348 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell>
1349 set_node_numbers(
const unsigned int start,
1350 const std::array<unsigned int, 1> &offsets)
1352 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell> nodes;
1354 nodes[1] = start + offsets[0];
1360 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell>
1361 set_node_numbers(
const unsigned int start,
1362 const std::array<unsigned int, 2> &offsets)
1365 const unsigned int d1 = offsets[0];
1366 const unsigned int d2 = offsets[1];
1368 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell> nodes;
1370 nodes[1] = start + d1;
1371 nodes[2] = start + d2;
1372 nodes[3] = start + d2 + d1;
1378 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell>
1379 set_node_numbers(
const unsigned int start,
1380 const std::array<unsigned int, 3> &offsets)
1382 const unsigned int d1 = offsets[0];
1383 const unsigned int d2 = offsets[1];
1384 const unsigned int d3 = offsets[2];
1386 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell> nodes;
1388 nodes[1] = start + d1;
1389 nodes[2] = start + d2;
1390 nodes[3] = start + d2 + d1;
1391 nodes[4] = start + d3;
1392 nodes[5] = start + d3 + d1;
1393 nodes[6] = start + d3 + d2;
1394 nodes[7] = start + d3 + d2 + d1;
1403 DXStream::write_cell(
const unsigned int,
1404 const unsigned int start,
1405 const std::array<unsigned int, dim> &offsets)
1408 DataOutBaseImplementation::set_node_numbers(start, offsets);
1410 if (flags.int_binary)
1412 std::array<unsigned int, GeometryInfo<dim>::vertices_per_cell> temp;
1413 for (
unsigned int i = 0; i < nodes.size(); ++i)
1415 stream.write(
reinterpret_cast<const char *
>(temp.data()),
1416 temp.size() *
sizeof(temp[0]));
1420 for (
unsigned int i = 0; i < nodes.size() - 1; ++i)
1422 stream << nodes[GeometryInfo<dim>::dx_to_deal[nodes.size() - 1]]
1429 template <
typename data>
1431 DXStream::write_dataset(
const unsigned int,
const std::vector<data> &values)
1433 if (flags.data_binary)
1435 stream.write(
reinterpret_cast<const char *
>(values.data()),
1436 values.size() *
sizeof(data));
1440 for (
unsigned int i = 0; i < values.size(); ++i)
1441 stream <<
'\t' << values[i];
1457 GmvStream::write_point(
const unsigned int,
const Point<dim> &p)
1461 stream << p[selected_component] <<
' ';
1468 GmvStream::write_cell(
const unsigned int,
1469 const unsigned int s,
1470 const std::array<unsigned int, dim> &offsets)
1473 const unsigned int start = s + 1;
1474 stream << gmv_cell_type[dim] <<
'\n';
1486 const unsigned int d1 = offsets[0];
1488 stream <<
'\t' << start + d1;
1494 const unsigned int d1 = offsets[0];
1495 const unsigned int d2 = offsets[1];
1497 stream <<
'\t' << start + d1;
1498 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1504 const unsigned int d1 = offsets[0];
1505 const unsigned int d2 = offsets[1];
1506 const unsigned int d3 = offsets[2];
1508 stream <<
'\t' << start + d1;
1509 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1510 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1511 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1523 TecplotStream::TecplotStream(std::ostream &out,
1531 TecplotStream::write_point(
const unsigned int,
const Point<dim> &p)
1535 stream << p[selected_component] <<
'\n';
1542 TecplotStream::write_cell(
const unsigned int,
1543 const unsigned int s,
1544 const std::array<unsigned int, dim> &offsets)
1546 const unsigned int start = s + 1;
1558 const unsigned int d1 = offsets[0];
1560 stream <<
'\t' << start + d1;
1566 const unsigned int d1 = offsets[0];
1567 const unsigned int d2 = offsets[1];
1569 stream <<
'\t' << start + d1;
1570 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1576 const unsigned int d1 = offsets[0];
1577 const unsigned int d2 = offsets[1];
1578 const unsigned int d3 = offsets[2];
1580 stream <<
'\t' << start + d1;
1581 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1582 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1583 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1602 UcdStream::write_point(
const unsigned int index,
const Point<dim> &p)
1604 stream <<
index + 1 <<
" ";
1606 for (
unsigned int i = 0; i < dim; ++i)
1607 stream << p[i] <<
' ';
1609 for (
unsigned int i = dim; i < 3; ++i)
1618 UcdStream::write_cell(
const unsigned int index,
1619 const unsigned int start,
1620 const std::array<unsigned int, dim> &offsets)
1623 DataOutBaseImplementation::set_node_numbers(start, offsets);
1626 stream <<
index + 1 <<
"\t0 " << ucd_cell_type[dim];
1627 for (
unsigned int i = 0; i < nodes.size(); ++i)
1634 template <
typename data>
1636 UcdStream::write_dataset(
const unsigned int index,
1637 const std::vector<data> &values)
1639 stream <<
index + 1;
1640 for (
unsigned int i = 0; i < values.size(); ++i)
1641 stream <<
'\t' << values[i];
1656 VtkStream::write_point(
const unsigned int,
const Point<dim> &p)
1661 for (
unsigned int i = dim; i < 3; ++i)
1670 VtkStream::write_cell(
const unsigned int,
1671 const unsigned int start,
1672 const std::array<unsigned int, dim> &offsets)
1674 stream << GeometryInfo<dim>::vertices_per_cell <<
'\t';
1686 const unsigned int d1 = offsets[0];
1688 stream <<
'\t' << start + d1;
1694 const unsigned int d1 = offsets[0];
1695 const unsigned int d2 = offsets[1];
1697 stream <<
'\t' << start + d1;
1698 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1704 const unsigned int d1 = offsets[0];
1705 const unsigned int d2 = offsets[1];
1706 const unsigned int d3 = offsets[2];
1708 stream <<
'\t' << start + d1;
1709 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1710 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1711 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1724 VtkStream::write_cell_single(
const unsigned int index,
1725 const unsigned int start,
1726 const unsigned int n_points,
1731 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
1733 stream <<
'\t' << n_points;
1734 for (
unsigned int i = 0; i < n_points; ++i)
1743 VtkStream::write_high_order_cell(
const unsigned int start,
1744 const std::vector<unsigned> &connectivity)
1746 stream << connectivity.size();
1747 for (
const auto &c : connectivity)
1748 stream <<
'\t' << start + c;
1757 const unsigned int Deal_II_IntermediateFlags::format_version = 4;
1760 template <
int dim,
int spacedim>
1761 const unsigned int Patch<dim, spacedim>::space_dim;
1764 template <
int dim,
int spacedim>
1765 const unsigned int Patch<dim, spacedim>::no_neighbor;
1768 template <
int dim,
int spacedim>
1770 : patch_index(no_neighbor)
1772 , points_are_available(false)
1786 template <
int dim,
int spacedim>
1794 const double epsilon = 3e-16;
1812 if (data.n_rows() != patch.
data.n_rows())
1815 if (data.n_cols() != patch.
data.n_cols())
1818 for (
unsigned int i = 0; i < data.n_rows(); ++i)
1819 for (
unsigned int j = 0; j < data.n_cols(); ++j)
1820 if (data[i][j] != patch.
data[i][j])
1828 template <
int dim,
int spacedim>
1834 sizeof(neighbors) /
sizeof(neighbors[0]) *
1840 sizeof(reference_cell));
1845 template <
int dim,
int spacedim>
1849 std::swap(
vertices, other_patch.vertices);
1850 std::swap(neighbors, other_patch.neighbors);
1851 std::swap(patch_index, other_patch.patch_index);
1852 std::swap(n_subdivisions, other_patch.n_subdivisions);
1853 data.swap(other_patch.data);
1854 std::swap(points_are_available, other_patch.points_are_available);
1855 std::swap(reference_cell, other_patch.reference_cell);
1860 template <
int spacedim>
1864 template <
int spacedim>
1868 template <
int spacedim>
1872 template <
int spacedim>
1875 template <
int spacedim>
1879 template <
int spacedim>
1881 : patch_index(no_neighbor)
1882 , points_are_available(false)
1889 template <
int spacedim>
1893 const unsigned int dim = 0;
1896 const double epsilon = 3e-16;
1907 if (data.n_rows() != patch.
data.n_rows())
1910 if (data.n_cols() != patch.
data.n_cols())
1913 for (
unsigned int i = 0; i < data.n_rows(); ++i)
1914 for (
unsigned int j = 0; j < data.n_cols(); ++j)
1915 if (data[i][j] != patch.
data[i][j])
1923 template <
int spacedim>
1935 template <
int spacedim>
1939 std::swap(
vertices, other_patch.vertices);
1940 std::swap(patch_index, other_patch.patch_index);
1941 data.swap(other_patch.data);
1942 std::swap(points_are_available, other_patch.points_are_available);
1948 : write_preamble(write_preamble)
1963 : space_dimension_labels(labels)
1977 const bool bicubic_patch,
1978 const bool external_data)
1980 , bicubic_patch(bicubic_patch)
1981 , external_data(external_data)
1986 const bool xdmf_hdf5_output)
1987 : filter_duplicate_vertices(filter_duplicate_vertices)
1988 , xdmf_hdf5_output(xdmf_hdf5_output)
1996 "Filter duplicate vertices",
1999 "Whether to remove duplicate vertex values. deal.II duplicates "
2000 "vertices once for each adjacent cell so that it can output "
2001 "discontinuous quantities for which there may be more than one "
2002 "value for each vertex position. Setting this flag to "
2003 "'true' will merge all of these values by selecting a "
2004 "random one and outputting this as 'the' value for the vertex. "
2005 "As long as the data to be output corresponds to continuous "
2006 "fields, merging vertices has no effect. On the other hand, "
2007 "if the data to be output corresponds to discontinuous fields "
2008 "(either because you are using a discontinuous finite element, "
2009 "or because you are using a DataPostprocessor that yields "
2010 "discontinuous data, or because the data to be output has been "
2011 "produced by entirely different means), then the data in the "
2012 "output file no longer faithfully represents the underlying data "
2013 "because the discontinuous field has been replaced by a "
2014 "continuous one. Note also that the filtering can not occur "
2015 "on processor boundaries. Thus, a filtered discontinuous field "
2016 "looks like a continuous field inside of a subdomain, "
2017 "but like a discontinuous field at the subdomain boundary."
2019 "In any case, filtering results in drastically smaller output "
2020 "files (smaller by about a factor of 2^dim).");
2025 "Whether the data will be used in an XDMF/HDF5 combination.");
2040 const bool int_binary,
2041 const bool coordinates_binary,
2042 const bool data_binary)
2043 : write_neighbors(write_neighbors)
2044 , int_binary(int_binary)
2045 , coordinates_binary(coordinates_binary)
2046 , data_binary(data_binary)
2047 , data_double(false)
2057 "A boolean field indicating whether neighborship "
2058 "information between cells is to be written to the "
2059 "OpenDX output file");
2063 "Output format of integer numbers, which is "
2064 "either a text representation (ascii) or binary integer "
2065 "values of 32 or 64 bits length");
2069 "Output format of vertex coordinates, which is "
2070 "either a text representation (ascii) or binary "
2071 "floating point values of 32 or 64 bits length");
2075 "Output format of data values, which is "
2076 "either a text representation (ascii) or binary "
2077 "floating point values of 32 or 64 bits length");
2097 "A flag indicating whether a comment should be "
2098 "written to the beginning of the output file "
2099 "indicating date and time of creation as well "
2100 "as the creating program");
2114 const int azimuth_angle,
2115 const int polar_angle,
2116 const unsigned int line_thickness,
2118 const bool draw_colorbar)
2121 , height_vector(height_vector)
2122 , azimuth_angle(azimuth_angle)
2123 , polar_angle(polar_angle)
2124 , line_thickness(line_thickness)
2126 , draw_colorbar(draw_colorbar)
2137 "A flag indicating whether POVRAY should use smoothed "
2138 "triangles instead of the usual ones");
2142 "Whether POVRAY should use bicubic patches");
2146 "Whether camera and lighting information should "
2147 "be put into an external file \"data.inc\" or into "
2148 "the POVRAY input file");
2164 const unsigned int color_vector,
2166 const unsigned int size,
2167 const double line_width,
2168 const double azimut_angle,
2169 const double turn_angle,
2170 const double z_scaling,
2171 const bool draw_mesh,
2172 const bool draw_cells,
2173 const bool shade_cells,
2175 : height_vector(height_vector)
2176 , color_vector(color_vector)
2177 , size_type(size_type)
2179 , line_width(line_width)
2180 , azimut_angle(azimut_angle)
2181 , turn_angle(turn_angle)
2182 , z_scaling(z_scaling)
2183 , draw_mesh(draw_mesh)
2184 , draw_cells(draw_cells)
2185 , shade_cells(shade_cells)
2186 , color_function(color_function)
2225 double sum = xmax + xmin;
2226 double sum13 = xmin + 3 * xmax;
2227 double sum22 = 2 * xmin + 2 * xmax;
2228 double sum31 = 3 * xmin + xmax;
2229 double dif = xmax - xmin;
2230 double rezdif = 1.0 / dif;
2234 if (x < (sum31) / 4)
2236 else if (x < (sum22) / 4)
2238 else if (x < (sum13) / 4)
2249 rgb_values.
green = 0;
2250 rgb_values.
blue = (x - xmin) * 4. * rezdif;
2254 rgb_values.
green = (4 * x - 3 * xmin - xmax) * rezdif;
2255 rgb_values.
blue = (sum22 - 4. * x) * rezdif;
2258 rgb_values.
red = (4 * x - 2 * sum) * rezdif;
2259 rgb_values.
green = (xmin + 3 * xmax - 4 * x) * rezdif;
2260 rgb_values.
blue = 0;
2264 rgb_values.
green = (4 * x - xmin - 3 * xmax) * rezdif;
2265 rgb_values.
blue = (4. * x - sum13) * rezdif;
2272 rgb_values.
red = rgb_values.
green = rgb_values.
blue = 1;
2286 (x - xmin) / (xmax - xmin);
2299 1 - (x - xmin) / (xmax - xmin);
2311 "Number of the input vector that is to be used to "
2312 "generate height information");
2316 "Number of the input vector that is to be used to "
2317 "generate color information");
2321 "Whether width or height should be scaled to match "
2326 "The size (width or height) to which the eps output "
2327 "file is to be scaled");
2331 "The width in which the postscript renderer is to "
2336 "Angle of the viewing position against the vertical "
2341 "Angle of the viewing direction against the y-axis");
2345 "Scaling for the z-direction relative to the scaling "
2346 "used in x- and y-directions");
2350 "Whether the mesh lines, or only the surface should be "
2355 "Whether only the mesh lines, or also the interior of "
2356 "cells should be plotted. If this flag is false, then "
2357 "one can see through the mesh");
2361 "Whether the interior of cells shall be shaded");
2365 "default|grey scale|reverse grey scale"),
2366 "Name of a color function used to colorize mesh lines "
2367 "and/or cell interiors");
2377 if (prm.
get(
"Scale to width or height") ==
"width")
2389 if (prm.
get(
"Color function") ==
"default")
2391 else if (prm.
get(
"Color function") ==
"grey scale")
2393 else if (prm.
get(
"Color function") ==
"reverse grey scale")
2403 : compression_level(compression_level)
2408 : zone_name(zone_name)
2409 , solution_time(solution_time)
2423 const unsigned int cycle,
2424 const bool print_date_and_time,
2426 const bool write_higher_order_cells,
2427 const std::map<std::string, std::string> &physical_units)
2430 , print_date_and_time(print_date_and_time)
2431 , compression_level(compression_level)
2432 , write_higher_order_cells(write_higher_order_cells)
2433 , physical_units(physical_units)
2441 if (format_name ==
"none")
2444 if (format_name ==
"dx")
2447 if (format_name ==
"ucd")
2450 if (format_name ==
"gnuplot")
2453 if (format_name ==
"povray")
2456 if (format_name ==
"eps")
2459 if (format_name ==
"gmv")
2462 if (format_name ==
"tecplot")
2465 if (format_name ==
"vtk")
2468 if (format_name ==
"vtu")
2471 if (format_name ==
"deal.II intermediate")
2474 if (format_name ==
"hdf5")
2478 ExcMessage(
"The given file format name is not recognized: <" +
2479 format_name +
">"));
2490 return "none|dx|ucd|gnuplot|povray|eps|gmv|tecplot|vtk|vtu|hdf5|svg|deal.II intermediate";
2498 switch (output_format)
2540 template <
int dim,
int spacedim>
2541 std::vector<Point<spacedim>>
2545 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
2547 std::vector<Point<spacedim>> node_positions;
2548 for (
const auto &patch : patches)
2553 for (
unsigned int point_no = 0; point_no < patch.
data.n_cols();
2555 node_positions.emplace_back(get_node_location(
2564 const unsigned int n = n_subdivisions + 1;
2569 node_positions.emplace_back(
2570 get_equispaced_location(patch, {}, n_subdivisions));
2573 for (
unsigned int i1 = 0; i1 < n; ++i1)
2574 node_positions.emplace_back(
2575 get_equispaced_location(patch, {i1}, n_subdivisions));
2578 for (
unsigned int i2 = 0; i2 < n; ++i2)
2579 for (
unsigned int i1 = 0; i1 < n; ++i1)
2580 node_positions.emplace_back(get_equispaced_location(
2581 patch, {i1, i2}, n_subdivisions));
2584 for (
unsigned int i3 = 0; i3 < n; ++i3)
2585 for (
unsigned int i2 = 0; i2 < n; ++i2)
2586 for (
unsigned int i1 = 0; i1 < n; ++i1)
2587 node_positions.emplace_back(get_equispaced_location(
2588 patch, {i1, i2, i3}, n_subdivisions));
2597 return node_positions;
2601 template <
int dim,
int spacedim,
typename StreamType>
2607 const std::vector<Point<spacedim>> node_positions =
2611 for (
const auto &node : node_positions)
2612 out.write_point(count++, node);
2618 template <
int dim,
int spacedim,
typename StreamType>
2623 unsigned int count = 0;
2624 unsigned int first_vertex_of_patch = 0;
2625 for (
const auto &patch : patches)
2630 out.write_cell_single(count++,
2631 first_vertex_of_patch,
2632 patch.
data.n_cols(),
2634 first_vertex_of_patch += patch.
data.n_cols();
2639 const unsigned int n = n_subdivisions + 1;
2645 const unsigned int offset = first_vertex_of_patch;
2646 out.template write_cell<0>(count++, offset, {});
2652 constexpr unsigned int d1 = 1;
2654 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2656 const unsigned int offset =
2657 first_vertex_of_patch + i1 * d1;
2658 out.template write_cell<1>(count++, offset, {{d1}});
2666 constexpr unsigned int d1 = 1;
2667 const unsigned int d2 = n;
2669 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2670 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2672 const unsigned int offset =
2673 first_vertex_of_patch + i2 * d2 + i1 * d1;
2674 out.template write_cell<2>(count++,
2684 constexpr unsigned int d1 = 1;
2685 const unsigned int d2 = n;
2686 const unsigned int d3 = n * n;
2688 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
2689 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2690 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2692 const unsigned int offset = first_vertex_of_patch +
2695 out.template write_cell<3>(count++,
2707 first_vertex_of_patch +=
2717 template <
int dim,
int spacedim,
typename StreamType>
2721 const bool legacy_format)
2724 unsigned int first_vertex_of_patch = 0;
2726 std::vector<unsigned> connectivity;
2728 for (
const auto &patch : patches)
2732 connectivity.resize(patch.
data.n_cols());
2734 for (
unsigned int i = 0; i < patch.
data.n_cols(); ++i)
2735 connectivity[i] = i;
2737 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2740 first_vertex_of_patch += patch.
data.n_cols();
2745 const unsigned int n = n_subdivisions + 1;
2754 ExcMessage(
"Point-like cells should not be possible "
2755 "when writing higher-order cells."));
2760 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2762 const unsigned int local_index = i1;
2763 const unsigned int connectivity_index =
2765 .template vtk_lexicographic_to_node_index<1>(
2766 {{i1}}, {{n_subdivisions}}, legacy_format);
2767 connectivity[connectivity_index] = local_index;
2774 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2775 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2777 const unsigned int local_index = i2 * n + i1;
2778 const unsigned int connectivity_index =
2780 .template vtk_lexicographic_to_node_index<2>(
2782 {{n_subdivisions, n_subdivisions}},
2784 connectivity[connectivity_index] = local_index;
2791 for (
unsigned int i3 = 0; i3 < n_subdivisions + 1; ++i3)
2792 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2793 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2795 const unsigned int local_index =
2796 i3 * n * n + i2 * n + i1;
2797 const unsigned int connectivity_index =
2799 .template vtk_lexicographic_to_node_index<3>(
2805 connectivity[connectivity_index] = local_index;
2816 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2828 template <
int dim,
int spacedim,
typename StreamType>
2831 unsigned int n_data_sets,
2832 const bool double_precision,
2836 unsigned int count = 0;
2838 for (
const auto &patch : patches)
2841 const unsigned int n = n_subdivisions + 1;
2843 Assert((patch.
data.n_rows() == n_data_sets &&
2845 (patch.
data.n_rows() == n_data_sets + spacedim &&
2848 (n_data_sets + spacedim) :
2850 patch.data.n_rows()));
2854 std::vector<float> floats(n_data_sets);
2855 std::vector<double> doubles(n_data_sets);
2858 for (
unsigned int i = 0; i < Utilities::fixed_power<dim>(n);
2860 if (double_precision)
2862 for (
unsigned int data_set = 0; data_set < n_data_sets;
2864 doubles[data_set] = patch.
data(data_set, i);
2865 out.write_dataset(count, doubles);
2869 for (
unsigned int data_set = 0; data_set < n_data_sets;
2871 floats[data_set] = patch.
data(data_set, i);
2872 out.write_dataset(count, floats);
2897 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
2898 camera_horizontal[2] * camera_direction[1];
2899 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
2900 camera_horizontal[0] * camera_direction[2];
2901 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
2902 camera_horizontal[1] * camera_direction[0];
2906 phi /= (point[0] - camera_position[0]) * camera_direction[0] +
2907 (point[1] - camera_position[1]) * camera_direction[1] +
2908 (point[2] - camera_position[2]) * camera_direction[2];
2912 camera_position[0] + phi * (point[0] - camera_position[0]);
2914 camera_position[1] + phi * (point[1] - camera_position[1]);
2916 camera_position[2] + phi * (point[2] - camera_position[2]);
2919 projection_decomposition[0] = (projection[0] - camera_position[0] -
2920 camera_focus * camera_direction[0]) *
2921 camera_horizontal[0];
2922 projection_decomposition[0] += (projection[1] - camera_position[1] -
2923 camera_focus * camera_direction[1]) *
2924 camera_horizontal[1];
2925 projection_decomposition[0] += (projection[2] - camera_position[2] -
2926 camera_focus * camera_direction[2]) *
2927 camera_horizontal[2];
2929 projection_decomposition[1] = (projection[0] - camera_position[0] -
2930 camera_focus * camera_direction[0]) *
2932 projection_decomposition[1] += (projection[1] - camera_position[1] -
2933 camera_focus * camera_direction[1]) *
2935 projection_decomposition[1] += (projection[2] - camera_position[2] -
2936 camera_focus * camera_direction[2]) *
2939 return projection_decomposition;
2948 svg_get_gradient_parameters(
Point<3> points[])
2954 for (
int i = 0; i < 2; ++i)
2956 for (
int j = 0; j < 2 - i; ++j)
2958 if (points[j][2] > points[j + 1][2])
2961 points[j] = points[j + 1];
2962 points[j + 1] = temp;
2969 v_inter = points[1];
2976 A[0][0] = v_max[0] - v_min[0];
2977 A[0][1] = v_inter[0] - v_min[0];
2978 A[1][0] = v_max[1] - v_min[1];
2979 A[1][1] = v_inter[1] - v_min[1];
2985 bool col_change =
false;
2994 double temp = A[1][0];
2999 for (
unsigned int k = 0; k < 1; ++k)
3001 for (
unsigned int i = k + 1; i < 2; ++i)
3003 x = A[i][k] / A[k][k];
3005 for (
unsigned int j = k + 1; j < 2; ++j)
3006 A[i][j] = A[i][j] - A[k][j] * x;
3008 b[i] = b[i] - b[k] * x;
3012 b[1] = b[1] / A[1][1];
3014 for (
int i = 0; i >= 0; i--)
3018 for (
unsigned int j = i + 1; j < 2; ++j)
3019 sum = sum - A[i][j] * b[j];
3021 b[i] = sum / A[i][i];
3031 double c =
b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) +
3035 A[0][0] = v_max[0] - v_min[0];
3036 A[0][1] = v_inter[0] - v_min[0];
3037 A[1][0] = v_max[1] - v_min[1];
3038 A[1][1] = v_inter[1] - v_min[1];
3040 b[0] = 1.0 - v_min[0];
3052 double temp = A[1][0];
3057 for (
unsigned int k = 0; k < 1; ++k)
3059 for (
unsigned int i = k + 1; i < 2; ++i)
3061 x = A[i][k] / A[k][k];
3063 for (
unsigned int j = k + 1; j < 2; ++j)
3064 A[i][j] = A[i][j] - A[k][j] * x;
3066 b[i] = b[i] - b[k] * x;
3070 b[1] = b[1] / A[1][1];
3072 for (
int i = 0; i >= 0; i--)
3076 for (
unsigned int j = i + 1; j < 2; ++j)
3077 sum = sum - A[i][j] * b[j];
3079 b[i] = sum / A[i][i];
3089 gradient[0] =
b[0] * (v_max[2] - v_min[2]) +
3090 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3093 A[0][0] = v_max[0] - v_min[0];
3094 A[0][1] = v_inter[0] - v_min[0];
3095 A[1][0] = v_max[1] - v_min[1];
3096 A[1][1] = v_inter[1] - v_min[1];
3099 b[1] = 1.0 - v_min[1];
3110 double temp = A[1][0];
3115 for (
unsigned int k = 0; k < 1; ++k)
3117 for (
unsigned int i = k + 1; i < 2; ++i)
3119 x = A[i][k] / A[k][k];
3121 for (
unsigned int j = k + 1; j < 2; ++j)
3122 A[i][j] = A[i][j] - A[k][j] * x;
3124 b[i] = b[i] - b[k] * x;
3128 b[1] =
b[1] / A[1][1];
3130 for (
int i = 0; i >= 0; i--)
3134 for (
unsigned int j = i + 1; j < 2; ++j)
3135 sum = sum - A[i][j] * b[j];
3137 b[i] =
sum / A[i][i];
3147 gradient[1] =
b[0] * (v_max[2] - v_min[2]) +
3148 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3154 gradient[1] * (v_min[1] - v_max[1]);
3158 gradient_parameters[0] = v_min[0];
3159 gradient_parameters[1] = v_min[1];
3164 gradient_parameters[4] = v_min[2];
3165 gradient_parameters[5] = v_max[2];
3167 return gradient_parameters;
3173 template <
int dim,
int spacedim>
3177 const std::vector<std::string> &data_names,
3179 std::tuple<
unsigned int,
3192#ifndef DEAL_II_WITH_MPI
3201 if (patches.empty())
3205 const unsigned int n_data_sets = data_names.size();
3207 UcdStream ucd_out(out, flags);
3210 unsigned int n_nodes;
3211 unsigned int n_cells;
3212 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
3218 <<
"# This file was generated by the deal.II library." <<
'\n'
3222 <<
"# For a description of the UCD format see the AVS Developer's guide."
3228 out << n_nodes <<
' ' << n_cells <<
' ' << n_data_sets <<
' ' << 0
3241 if (n_data_sets != 0)
3243 out << n_data_sets <<
" ";
3244 for (
unsigned int i = 0; i < n_data_sets; ++i)
3249 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3250 out << data_names[data_set]
3254 write_data(patches, n_data_sets,
true, ucd_out);
3264 template <
int dim,
int spacedim>
3268 const std::vector<std::string> &data_names,
3270 std::tuple<
unsigned int,
3282#ifndef DEAL_II_WITH_MPI
3291 if (patches.empty())
3295 DXStream dx_out(out, flags);
3298 unsigned int offset = 0;
3300 const unsigned int n_data_sets = data_names.size();
3303 unsigned int n_nodes;
3304 unsigned int n_cells;
3305 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
3308 out <<
"object \"vertices\" class array type float rank 1 shape "
3309 << spacedim <<
" items " << n_nodes;
3313 out <<
" lsb ieee data 0" <<
'\n';
3314 offset += n_nodes * spacedim *
sizeof(float);
3318 out <<
" data follows" <<
'\n';
3327 out <<
"object \"cells\" class array type int rank 1 shape "
3332 out <<
" lsb binary data " << offset <<
'\n';
3333 offset += n_cells *
sizeof(
int);
3337 out <<
" data follows" <<
'\n';
3343 out <<
"attribute \"element type\" string \"";
3350 out <<
"\"" <<
'\n' <<
"attribute \"ref\" string \"positions\"" <<
'\n';
3357 out <<
"object \"neighbors\" class array type int rank 1 shape "
3361 for (
const auto &patch : patches)
3364 const unsigned int n1 = (dim > 0) ? n : 1;
3365 const unsigned int n2 = (dim > 1) ? n : 1;
3366 const unsigned int n3 = (dim > 2) ? n : 1;
3367 const unsigned int x_minus = (dim > 0) ? 0 : 0;
3368 const unsigned int x_plus = (dim > 0) ? 1 : 0;
3369 const unsigned int y_minus = (dim > 1) ? 2 : 0;
3370 const unsigned int y_plus = (dim > 1) ? 3 : 0;
3371 const unsigned int z_minus = (dim > 2) ? 4 : 0;
3372 const unsigned int z_plus = (dim > 2) ? 5 : 0;
3374 unsigned int dx = 1;
3375 unsigned int dy = n;
3376 unsigned int dz = n * n;
3378 const unsigned int patch_start =
3381 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3382 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3383 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3385 const unsigned int nx = i1 *
dx;
3386 const unsigned int ny = i2 * dy;
3387 const unsigned int nz = i3 * dz;
3399 const unsigned int nn = patch.
neighbors[x_minus];
3403 << (nn * cells_per_patch + ny + nz +
dx * (n - 1));
3409 out <<
'\t' << patch_start + nx -
dx + ny + nz;
3414 const unsigned int nn = patch.
neighbors[x_plus];
3417 out << (nn * cells_per_patch + ny + nz);
3423 out <<
'\t' << patch_start + nx +
dx + ny + nz;
3430 const unsigned int nn = patch.
neighbors[y_minus];
3434 << (nn * cells_per_patch + nx + nz + dy * (n - 1));
3440 out <<
'\t' << patch_start + nx + ny - dy + nz;
3445 const unsigned int nn = patch.
neighbors[y_plus];
3448 out << (nn * cells_per_patch + nx + nz);
3454 out <<
'\t' << patch_start + nx + ny + dy + nz;
3462 const unsigned int nn = patch.
neighbors[z_minus];
3466 << (nn * cells_per_patch + nx + ny + dz * (n - 1));
3472 out <<
'\t' << patch_start + nx + ny + nz - dz;
3477 const unsigned int nn = patch.
neighbors[z_plus];
3480 out << (nn * cells_per_patch + nx + ny);
3486 out <<
'\t' << patch_start + nx + ny + nz + dz;
3494 if (n_data_sets != 0)
3496 out <<
"object \"data\" class array type float rank 1 shape "
3497 << n_data_sets <<
" items " << n_nodes;
3501 out <<
" lsb ieee data " << offset <<
'\n';
3502 offset += n_data_sets * n_nodes *
3503 ((flags.
data_double) ?
sizeof(
double) :
sizeof(float));
3507 out <<
" data follows" <<
'\n';
3512 out <<
"attribute \"dep\" string \"positions\"" <<
'\n';
3516 out <<
"object \"data\" class constantarray type float rank 0 items "
3517 << n_nodes <<
" data follows" <<
'\n'
3523 out <<
"object \"deal data\" class field" <<
'\n'
3524 <<
"component \"positions\" value \"vertices\"" <<
'\n'
3525 <<
"component \"connections\" value \"cells\"" <<
'\n'
3526 <<
"component \"data\" value \"data\"" <<
'\n';
3529 out <<
"component \"neighbors\" value \"neighbors\"" <<
'\n';
3536 out <<
"end" <<
'\n';
3554 template <
int dim,
int spacedim>
3558 const std::vector<std::string> &data_names,
3560 std::tuple<
unsigned int,
3569#ifndef DEAL_II_WITH_MPI
3579 if (patches.empty())
3583 const unsigned int n_data_sets = data_names.size();
3587 out <<
"# This file was generated by the deal.II library." <<
'\n'
3591 <<
"# For a description of the GNUPLOT format see the GNUPLOT manual."
3598 for (
unsigned int spacedim_n = 0; spacedim_n < spacedim; ++spacedim_n)
3603 for (
const auto &data_name : data_names)
3604 out <<
'<' << data_name <<
"> ";
3610 for (
const auto &patch : patches)
3613 const unsigned int n_points_per_direction = n_subdivisions + 1;
3615 Assert((patch.
data.n_rows() == n_data_sets &&
3617 (patch.
data.n_rows() == n_data_sets + spacedim &&
3620 (n_data_sets + spacedim) :
3622 patch.
data.n_rows()));
3624 auto output_point_data =
3625 [&out, &patch, n_data_sets](
const unsigned int point_index)
mutable {
3626 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3627 out << patch.data(data_set, point_index) <<
' ';
3636 Assert(patch.data.n_cols() == 1,
3638 n_subdivisions + 1));
3642 out << get_equispaced_location(patch, {}, n_subdivisions)
3644 output_point_data(0);
3654 Assert(patch.data.n_cols() ==
3657 n_subdivisions + 1));
3659 for (
unsigned int i1 = 0; i1 < n_points_per_direction; ++i1)
3662 out << get_equispaced_location(patch, {i1}, n_subdivisions)
3665 output_point_data(i1);
3679 n_points_per_direction),
3681 n_subdivisions + 1));
3683 for (
unsigned int i2 = 0; i2 < n_points_per_direction; ++i2)
3685 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3689 out << get_equispaced_location(patch,
3694 output_point_data(i1 + i2 * n_points_per_direction);
3719 out << get_node_location(patch, 0) <<
' ';
3720 output_point_data(0);
3723 out << get_node_location(patch, 1) <<
' ';
3724 output_point_data(1);
3728 out << get_node_location(patch, 2) <<
' ';
3729 output_point_data(2);
3732 out << get_node_location(patch, 2) <<
' ';
3733 output_point_data(2);
3754 n_points_per_direction),
3756 n_subdivisions + 1));
3761 for (
unsigned int i3 = 0; i3 < n_points_per_direction; ++i3)
3762 for (
unsigned int i2 = 0; i2 < n_points_per_direction;
3764 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3769 get_equispaced_location(patch,
3773 if (i1 < n_subdivisions)
3776 out << this_point <<
' ';
3777 output_point_data(i1 +
3778 i2 * n_points_per_direction +
3779 i3 * n_points_per_direction *
3780 n_points_per_direction);
3784 out << get_equispaced_location(patch,
3789 output_point_data((i1 + 1) +
3790 i2 * n_points_per_direction +
3791 i3 * n_points_per_direction *
3792 n_points_per_direction);
3796 out <<
'\n' <<
'\n';
3800 if (i2 < n_subdivisions)
3803 out << this_point <<
' ';
3804 output_point_data(i1 +
3805 i2 * n_points_per_direction +
3806 i3 * n_points_per_direction *
3807 n_points_per_direction);
3811 out << get_equispaced_location(patch,
3817 i1 + (i2 + 1) * n_points_per_direction +
3818 i3 * n_points_per_direction *
3819 n_points_per_direction);
3823 out <<
'\n' <<
'\n';
3827 if (i3 < n_subdivisions)
3830 out << this_point <<
' ';
3831 output_point_data(i1 +
3832 i2 * n_points_per_direction +
3833 i3 * n_points_per_direction *
3834 n_points_per_direction);
3838 out << get_equispaced_location(patch,
3844 i1 + i2 * n_points_per_direction +
3845 (i3 + 1) * n_points_per_direction *
3846 n_points_per_direction);
3849 out <<
'\n' <<
'\n';
3858 for (
const unsigned int v : {0, 1, 2, 0, 3, 2})
3860 out << get_node_location(patch, v) <<
' ';
3861 output_point_data(v);
3866 for (
const unsigned int v : {3, 1})
3868 out << get_node_location(patch, v) <<
' ';
3869 output_point_data(v);
3879 for (
const unsigned int v : {0, 1, 3, 2, 0, 4, 1})
3881 out << get_node_location(patch, v) <<
' ';
3882 output_point_data(v);
3887 for (
const unsigned int v : {2, 4, 3})
3889 out << get_node_location(patch, v) <<
' ';
3890 output_point_data(v);
3904 for (
const unsigned int v : {0, 1, 2, 0, 3, 4, 5, 3})
3906 out << get_node_location(patch, v) <<
' ';
3907 output_point_data(v);
3912 for (
const unsigned int v : {1, 4})
3914 out << get_node_location(patch, v) <<
' ';
3915 output_point_data(v);
3920 for (
const unsigned int v : {2, 5})
3922 out << get_node_location(patch, v) <<
' ';
3923 output_point_data(v);
3948 template <
int dim,
int spacedim>
3950 do_write_povray(
const std::vector<Patch<dim, spacedim>> &,
3951 const std::vector<std::string> &,
3952 const PovrayFlags &,
3956 ExcMessage(
"Writing files in POVRAY format is only supported "
3957 "for two-dimensional meshes."));
3963 do_write_povray(
const std::vector<Patch<2, 2>> &patches,
3964 const std::vector<std::string> &data_names,
3965 const PovrayFlags &flags,
3970#ifndef DEAL_II_WITH_MPI
3979 if (patches.empty())
3982 constexpr int dim = 2;
3984 constexpr int spacedim = 2;
3986 const unsigned int n_data_sets = data_names.size();
3992 <<
"/* This file was generated by the deal.II library." <<
'\n'
3996 <<
" For a description of the POVRAY format see the POVRAY manual."
4001 out <<
"#include \"colors.inc\" " <<
'\n'
4002 <<
"#include \"textures.inc\" " <<
'\n';
4006 if (flags.external_data)
4007 out <<
"#include \"data.inc\" " <<
'\n';
4013 <<
"camera {" <<
'\n'
4014 <<
" location <1,4,-7>" <<
'\n'
4015 <<
" look_at <0,0,0>" <<
'\n'
4016 <<
" angle 30" <<
'\n'
4021 <<
"light_source {" <<
'\n'
4022 <<
" <1,4,-7>" <<
'\n'
4023 <<
" color Grey" <<
'\n'
4026 <<
"light_source {" <<
'\n'
4027 <<
" <0,20,0>" <<
'\n'
4028 <<
" color White" <<
'\n'
4035 double hmin = patches[0].data(0, 0);
4036 double hmax = patches[0].data(0, 0);
4038 for (
const auto &patch : patches)
4042 Assert((patch.
data.n_rows() == n_data_sets &&
4044 (patch.
data.n_rows() == n_data_sets + spacedim &&
4047 (n_data_sets + spacedim) :
4049 patch.data.n_rows()));
4053 n_subdivisions + 1));
4055 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
4056 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
4058 const int dl = i * (n_subdivisions + 1) + j;
4059 if (patch.
data(0, dl) < hmin)
4060 hmin = patch.
data(0, dl);
4061 if (patch.
data(0, dl) > hmax)
4062 hmax = patch.
data(0, dl);
4066 out <<
"#declare HMIN=" << hmin <<
";" <<
'\n'
4067 <<
"#declare HMAX=" << hmax <<
";" <<
'\n'
4070 if (!flags.external_data)
4073 out <<
"#declare Tex=texture{" <<
'\n'
4074 <<
" pigment {" <<
'\n'
4075 <<
" gradient y" <<
'\n'
4076 <<
" scale y*(HMAX-HMIN)*" << 0.1 <<
'\n'
4077 <<
" color_map {" <<
'\n'
4078 <<
" [0.00 color Light_Purple] " <<
'\n'
4079 <<
" [0.95 color Light_Purple] " <<
'\n'
4080 <<
" [1.00 color White] " <<
'\n'
4085 if (!flags.bicubic_patch)
4088 out <<
'\n' <<
"mesh {" <<
'\n';
4092 for (
const auto &patch : patches)
4095 const unsigned int n = n_subdivisions + 1;
4096 const unsigned int d1 = 1;
4097 const unsigned int d2 = n;
4099 Assert((patch.
data.n_rows() == n_data_sets &&
4101 (patch.
data.n_rows() == n_data_sets + spacedim &&
4104 (n_data_sets + spacedim) :
4106 patch.data.n_rows()));
4109 n_subdivisions + 1));
4112 std::vector<Point<spacedim>> ver(n * n);
4114 for (
unsigned int i2 = 0; i2 < n; ++i2)
4115 for (
unsigned int i1 = 0; i1 < n; ++i1)
4118 ver[i1 * d1 + i2 * d2] =
4119 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4123 if (!flags.bicubic_patch)
4126 std::vector<Point<3>> nrml;
4136 for (
unsigned int i = 0; i < n; ++i)
4137 for (
unsigned int j = 0; j < n; ++j)
4139 const unsigned int il = (i == 0) ? i : (i - 1);
4140 const unsigned int ir =
4141 (i == n_subdivisions) ? i : (i + 1);
4142 const unsigned int jl = (j == 0) ? j : (j - 1);
4143 const unsigned int jr =
4144 (j == n_subdivisions) ? j : (j + 1);
4147 ver[ir * d1 + j * d2][0] - ver[il * d1 + j * d2][0];
4148 h1[1] = patch.
data(0, ir * d1 + j * d2) -
4149 patch.
data(0, il * d1 + j * d2);
4151 ver[ir * d1 + j * d2][1] - ver[il * d1 + j * d2][1];
4154 ver[i * d1 + jr * d2][0] - ver[i * d1 + jl * d2][0];
4155 h2[1] = patch.
data(0, i * d1 + jr * d2) -
4156 patch.
data(0, i * d1 + jl * d2);
4158 ver[i * d1 + jr * d2][1] - ver[i * d1 + jl * d2][1];
4160 nrml[i * d1 + j * d2][0] =
4161 h1[1] * h2[2] - h1[2] * h2[1];
4162 nrml[i * d1 + j * d2][1] =
4163 h1[2] * h2[0] - h1[0] * h2[2];
4164 nrml[i * d1 + j * d2][2] =
4165 h1[0] * h2[1] - h1[1] * h2[0];
4168 double norm = std::hypot(nrml[i * d1 + j * d2][0],
4169 nrml[i * d1 + j * d2][1],
4170 nrml[i * d1 + j * d2][2]);
4172 if (nrml[i * d1 + j * d2][1] < 0)
4175 for (
unsigned int k = 0; k < 3; ++k)
4176 nrml[i * d1 + j * d2][k] /= norm;
4181 for (
unsigned int i = 0; i < n_subdivisions; ++i)
4182 for (
unsigned int j = 0; j < n_subdivisions; ++j)
4185 const int dl = i * d1 + j * d2;
4191 out <<
"smooth_triangle {" <<
'\n'
4192 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4193 <<
"," << ver[dl][1] <<
">, <" << nrml[dl][0]
4194 <<
", " << nrml[dl][1] <<
", " << nrml[dl][2]
4196 out <<
" \t<" << ver[dl + d1][0] <<
","
4197 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1][1]
4198 <<
">, <" << nrml[dl + d1][0] <<
", "
4199 << nrml[dl + d1][1] <<
", " << nrml[dl + d1][2]
4201 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4202 << patch.
data(0, dl + d1 + d2) <<
","
4203 << ver[dl + d1 + d2][1] <<
">, <"
4204 << nrml[dl + d1 + d2][0] <<
", "
4205 << nrml[dl + d1 + d2][1] <<
", "
4206 << nrml[dl + d1 + d2][2] <<
">}" <<
'\n';
4209 out <<
"smooth_triangle {" <<
'\n'
4210 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4211 <<
"," << ver[dl][1] <<
">, <" << nrml[dl][0]
4212 <<
", " << nrml[dl][1] <<
", " << nrml[dl][2]
4214 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4215 << patch.
data(0, dl + d1 + d2) <<
","
4216 << ver[dl + d1 + d2][1] <<
">, <"
4217 << nrml[dl + d1 + d2][0] <<
", "
4218 << nrml[dl + d1 + d2][1] <<
", "
4219 << nrml[dl + d1 + d2][2] <<
">," <<
'\n';
4220 out <<
"\t<" << ver[dl + d2][0] <<
","
4221 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2][1]
4222 <<
">, <" << nrml[dl + d2][0] <<
", "
4223 << nrml[dl + d2][1] <<
", " << nrml[dl + d2][2]
4229 out <<
"triangle {" <<
'\n'
4230 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4231 <<
"," << ver[dl][1] <<
">," <<
'\n';
4232 out <<
"\t<" << ver[dl + d1][0] <<
","
4233 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1][1]
4235 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4236 << patch.
data(0, dl + d1 + d2) <<
","
4237 << ver[dl + d1 + d2][1] <<
">}" <<
'\n';
4240 out <<
"triangle {" <<
'\n'
4241 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4242 <<
"," << ver[dl][1] <<
">," <<
'\n';
4243 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4244 << patch.
data(0, dl + d1 + d2) <<
","
4245 << ver[dl + d1 + d2][1] <<
">," <<
'\n';
4246 out <<
"\t<" << ver[dl + d2][0] <<
","
4247 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2][1]
4255 Assert(n_subdivisions == 3,
4258 <<
"bicubic_patch {" <<
'\n'
4259 <<
" type 0" <<
'\n'
4260 <<
" flatness 0" <<
'\n'
4261 <<
" u_steps 0" <<
'\n'
4262 <<
" v_steps 0" <<
'\n';
4263 for (
int i = 0; i < 16; ++i)
4265 out <<
"\t<" << ver[i][0] <<
"," << patch.
data(0, i) <<
","
4266 << ver[i][1] <<
">";
4271 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n';
4275 if (!flags.bicubic_patch)
4278 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n' <<
'\n';
4290 template <
int dim,
int spacedim>
4294 const std::vector<std::string> &data_names,
4296 std::tuple<
unsigned int,
4303 do_write_povray(patches, data_names, flags, out);
4308 template <
int dim,
int spacedim>
4312 const std::vector<std::string> & ,
4314 std::tuple<
unsigned int,
4326 template <
int spacedim>
4330 const std::vector<std::string> & ,
4332 std::tuple<
unsigned int,
4341#ifndef DEAL_II_WITH_MPI
4350 if (patches.empty())
4360 std::multiset<EpsCell2d> cells;
4364 float min_color_value = std::numeric_limits<float>::max();
4365 float max_color_value = std::numeric_limits<float>::min();
4369 double heights[4] = {0, 0, 0, 0};
4373 for (
const auto &patch : patches)
4376 const unsigned int n = n_subdivisions + 1;
4377 const unsigned int d1 = 1;
4378 const unsigned int d2 = n;
4380 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
4381 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
4385 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4387 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
4389 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
4390 points[3] = get_equispaced_location(patch,
4398 patch.
data.n_rows() == 0,
4401 patch.
data.n_rows()));
4403 patch.
data.n_rows() != 0 ?
4407 heights[1] = patch.
data.n_rows() != 0 ?
4409 (i1 + 1) * d1 + i2 * d2) *
4412 heights[2] = patch.
data.n_rows() != 0 ?
4414 i1 * d1 + (i2 + 1) * d2) *
4417 heights[3] = patch.
data.n_rows() != 0 ?
4419 (i1 + 1) * d1 + (i2 + 1) * d2) *
4426 for (
unsigned int i = 0; i < 4; ++i)
4427 heights[i] = points[i][2];
4452 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4454 const double x = points[vertex][0], y = points[vertex][1],
4455 z = -heights[vertex];
4457 eps_cell.vertices[vertex][0] = -cz * x + sz * y;
4458 eps_cell.vertices[vertex][1] =
4459 -cx * sz * x - cx * cz * y - sx * z;
4483 (points[0] + points[1] + points[2] + points[3]) / 4;
4484 const double center_height =
4485 -(heights[0] + heights[1] + heights[2] + heights[3]) / 4;
4488 eps_cell.depth = -sx * sz * center_point[0] -
4489 sx * cz * center_point[1] + cx * center_height;
4494 patch.
data.n_rows() == 0,
4497 patch.
data.n_rows()));
4498 const double color_values[4] = {
4499 patch.
data.n_rows() != 0 ?
4503 patch.
data.n_rows() != 0 ?
4507 patch.
data.n_rows() != 0 ?
4511 patch.
data.n_rows() != 0 ?
4513 (i1 + 1) * d1 + (i2 + 1) * d2) :
4517 eps_cell.color_value = (color_values[0] + color_values[1] +
4518 color_values[3] + color_values[2]) /
4523 std::min(min_color_value, eps_cell.color_value);
4525 std::max(max_color_value, eps_cell.color_value);
4529 cells.insert(eps_cell);
4535 double x_min = cells.begin()->vertices[0][0];
4536 double x_max = x_min;
4537 double y_min = cells.begin()->vertices[0][1];
4538 double y_max = y_min;
4540 for (
const auto &cell : cells)
4541 for (
const auto &vertex : cell.vertices)
4543 x_min =
std::min(x_min, vertex[0]);
4544 x_max =
std::max(x_max, vertex[0]);
4545 y_min =
std::min(y_min, vertex[1]);
4546 y_max =
std::max(y_max, vertex[1]);
4551 const double scale =
4555 const Point<2> offset(x_min, y_min);
4560 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n'
4561 <<
"%%Title: deal.II Output" <<
'\n'
4562 <<
"%%Creator: the deal.II library" <<
'\n'
4565 <<
"%%BoundingBox: "
4569 <<
static_cast<unsigned int>((x_max - x_min) * scale + 0.5) <<
' '
4570 <<
static_cast<unsigned int>((y_max - y_min) * scale + 0.5) <<
'\n';
4579 out <<
"/m {moveto} bind def" <<
'\n'
4580 <<
"/l {lineto} bind def" <<
'\n'
4581 <<
"/s {setrgbcolor} bind def" <<
'\n'
4582 <<
"/sg {setgray} bind def" <<
'\n'
4583 <<
"/lx {lineto closepath stroke} bind def" <<
'\n'
4584 <<
"/lf {lineto closepath fill} bind def" <<
'\n';
4586 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4588 out << flags.
line_width <<
" setlinewidth" <<
'\n';
4596 if (max_color_value == min_color_value)
4597 max_color_value = min_color_value + 1;
4601 for (
const auto &cell : cells)
4614 out << rgb_values.
red <<
" sg ";
4616 out << rgb_values.
red <<
' ' << rgb_values.
green <<
' '
4617 << rgb_values.
blue <<
" s ";
4622 out << (cell.vertices[0] - offset) * scale <<
" m "
4623 << (cell.vertices[1] - offset) * scale <<
" l "
4624 << (cell.vertices[3] - offset) * scale <<
" l "
4625 << (cell.vertices[2] - offset) * scale <<
" lf" <<
'\n';
4630 << (cell.vertices[0] - offset) * scale <<
" m "
4631 << (cell.vertices[1] - offset) * scale <<
" l "
4632 << (cell.vertices[3] - offset) * scale <<
" l "
4633 << (cell.vertices[2] - offset) * scale <<
" lx" <<
'\n';
4635 out <<
"showpage" <<
'\n';
4644 template <
int dim,
int spacedim>
4648 const std::vector<std::string> &data_names,
4650 std::tuple<
unsigned int,
4666#ifndef DEAL_II_WITH_MPI
4675 if (patches.empty())
4679 GmvStream gmv_out(out, flags);
4680 const unsigned int n_data_sets = data_names.size();
4683 Assert((patches[0].data.n_rows() == n_data_sets &&
4684 !patches[0].points_are_available) ||
4685 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4686 patches[0].points_are_available),
4688 (n_data_sets + spacedim) :
4690 patches[0].data.n_rows()));
4694 out <<
"gmvinput ascii" <<
'\n' <<
'\n';
4697 unsigned int n_nodes;
4698 unsigned int n_cells;
4699 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
4714 [&patches]() {
return create_global_data_table(patches); });
4720 out <<
"nodes " << n_nodes <<
'\n';
4721 for (
unsigned int d = 0; d < spacedim; ++d)
4723 gmv_out.selected_component = d;
4729 for (
unsigned int d = spacedim; d < 3; ++d)
4731 for (
unsigned int i = 0; i < n_nodes; ++i)
4738 out <<
"cells " << n_cells <<
'\n';
4743 out <<
"variable" <<
'\n';
4747 std::move(*create_global_data_table_task.
return_value());
4751 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4753 out << data_names[data_set] <<
" 1" <<
'\n';
4754 std::copy(data_vectors[data_set].begin(),
4755 data_vectors[data_set].end(),
4756 std::ostream_iterator<double>(out,
" "));
4757 out <<
'\n' <<
'\n';
4763 out <<
"endvars" <<
'\n';
4766 out <<
"endgmv" <<
'\n';
4777 template <
int dim,
int spacedim>
4781 const std::vector<std::string> &data_names,
4783 std::tuple<
unsigned int,
4797#ifndef DEAL_II_WITH_MPI
4806 if (patches.empty())
4810 TecplotStream tecplot_out(out, flags);
4812 const unsigned int n_data_sets = data_names.size();
4815 Assert((patches[0].data.n_rows() == n_data_sets &&
4816 !patches[0].points_are_available) ||
4817 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4818 patches[0].points_are_available),
4820 (n_data_sets + spacedim) :
4822 patches[0].data.n_rows()));
4825 unsigned int n_nodes;
4826 unsigned int n_cells;
4827 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
4833 <<
"# This file was generated by the deal.II library." <<
'\n'
4837 <<
"# For a description of the Tecplot format see the Tecplot documentation."
4842 out <<
"Variables=";
4850 out <<
"\"x\", \"y\"";
4853 out <<
"\"x\", \"y\", \"z\"";
4859 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4860 out <<
", \"" << data_names[data_set] <<
"\"";
4866 out <<
"t=\"" << flags.
zone_name <<
"\" ";
4869 out <<
"strandid=1, solutiontime=" << flags.
solution_time <<
", ";
4871 out <<
"f=feblock, n=" << n_nodes <<
", e=" << n_cells
4872 <<
", et=" << tecplot_cell_type[dim] <<
'\n';
4889 [&patches]() {
return create_global_data_table(patches); });
4895 for (
unsigned int d = 0; d < spacedim; ++d)
4897 tecplot_out.selected_component = d;
4908 std::move(*create_global_data_table_task.
return_value());
4911 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4913 std::copy(data_vectors[data_set].begin(),
4914 data_vectors[data_set].end(),
4915 std::ostream_iterator<double>(out,
"\n"));
4930 template <
int dim,
int spacedim>
4934 const std::vector<std::string> &data_names,
4936 std::tuple<
unsigned int,
4940 &nonscalar_data_ranges,
4946#ifndef DEAL_II_WITH_MPI
4955 if (patches.empty())
4959 VtkStream vtk_out(out, flags);
4961 const unsigned int n_data_sets = data_names.size();
4963 if (patches[0].points_are_available)
4975 out <<
"# vtk DataFile Version 3.0" <<
'\n'
4976 <<
"#This file was generated by the deal.II library";
4984 out <<
'\n' <<
"ASCII" <<
'\n';
4986 out <<
"DATASET UNSTRUCTURED_GRID\n" <<
'\n';
4993 const unsigned int n_metadata =
4994 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
4995 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
4998 out <<
"FIELD FieldData " << n_metadata <<
'\n';
5000 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5002 out <<
"CYCLE 1 1 int\n" << flags.
cycle <<
'\n';
5004 if (flags.
time != std::numeric_limits<double>::min())
5006 out <<
"TIME 1 1 double\n" << flags.
time <<
'\n';
5012 unsigned int n_nodes;
5013 unsigned int n_cells;
5014 unsigned int n_points_and_n_cells;
5015 std::tie(n_nodes, n_cells, n_points_and_n_cells) =
5031 [&patches]() {
return create_global_data_table(patches); });
5037 out <<
"POINTS " << n_nodes <<
" double" <<
'\n';
5042 out <<
"CELLS " << n_cells <<
' ' << n_points_and_n_cells <<
'\n';
5050 out <<
"CELL_TYPES " << n_cells <<
'\n';
5054 for (
const auto &patch : patches)
5056 const auto vtk_cell_id =
5059 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
5060 out <<
' ' << vtk_cell_id[0];
5069 std::move(*create_global_data_table_task.
return_value());
5074 out <<
"POINT_DATA " << n_nodes <<
'\n';
5078 std::vector<bool> data_set_written(n_data_sets,
false);
5079 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5084 "The VTK writer does not currently support outputting "
5085 "tensor data. Use the VTU writer instead."));
5088 std::get<0>(nonscalar_data_range),
5090 std::get<0>(nonscalar_data_range)));
5091 AssertThrow(std::get<1>(nonscalar_data_range) < n_data_sets,
5095 AssertThrow(std::get<1>(nonscalar_data_range) + 1 -
5096 std::get<0>(nonscalar_data_range) <=
5099 "Can't declare a vector with more than 3 components "
5103 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5104 i <= std::get<1>(nonscalar_data_range);
5106 data_set_written[i] =
true;
5112 if (!std::get<2>(nonscalar_data_range).empty())
5113 out << std::get<2>(nonscalar_data_range);
5116 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5117 i < std::get<1>(nonscalar_data_range);
5119 out << data_names[i] <<
"__";
5120 out << data_names[std::get<1>(nonscalar_data_range)];
5123 out <<
" double" <<
'\n';
5126 for (
unsigned int n = 0; n < n_nodes; ++n)
5128 switch (std::get<1>(nonscalar_data_range) -
5129 std::get<0>(nonscalar_data_range))
5132 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5137 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5139 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5143 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5145 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5147 << data_vectors(std::get<0>(nonscalar_data_range) + 2, n)
5160 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5161 if (data_set_written[data_set] ==
false)
5163 out <<
"SCALARS " << data_names[data_set] <<
" double 1" <<
'\n'
5164 <<
"LOOKUP_TABLE default" <<
'\n';
5165 std::copy(data_vectors[data_set].begin(),
5166 data_vectors[data_set].end(),
5167 std::ostream_iterator<double>(out,
" "));
5183 out <<
"<?xml version=\"1.0\" ?> \n";
5185 out <<
"# vtk DataFile Version 3.0" <<
'\n'
5186 <<
"#This file was generated by the deal.II library";
5197 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"2.2\"";
5199 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"";
5200 if (deal_ii_with_zlib &&
5202 out <<
" compressor=\"vtkZLibDataCompressor\"";
5203#ifdef DEAL_II_WORDS_BIGENDIAN
5204 out <<
" byte_order=\"BigEndian\"";
5206 out <<
" byte_order=\"LittleEndian\"";
5210 out <<
"<UnstructuredGrid>";
5220 out <<
" </UnstructuredGrid>\n";
5221 out <<
"</VTKFile>\n";
5226 template <
int dim,
int spacedim>
5230 const std::vector<std::string> &data_names,
5232 std::tuple<
unsigned int,
5236 &nonscalar_data_ranges,
5241 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5248 template <
int dim,
int spacedim>
5252 const std::vector<std::string> &data_names,
5254 std::tuple<
unsigned int,
5258 &nonscalar_data_ranges,
5272 unit.second.find(
'\"') == std::string::npos,
5274 "A physical unit you provided, <" + unit.second +
5275 ">, contained a quotation mark character. This is not allowed."));
5278#ifndef DEAL_II_WITH_MPI
5287 if (patches.empty())
5292 out <<
"<Piece NumberOfPoints=\"0\" NumberOfCells=\"0\" >\n"
5294 <<
"<DataArray type=\"UInt8\" Name=\"types\"></DataArray>\n"
5296 <<
" <PointData Scalars=\"scalars\">\n";
5297 std::vector<bool> data_set_written(data_names.size(),
false);
5298 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5301 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5302 i <= std::get<1>(nonscalar_data_range);
5304 data_set_written[i] =
true;
5308 out <<
" <DataArray type=\"Float32\" Name=\"";
5310 if (!std::get<2>(nonscalar_data_range).empty())
5311 out << std::get<2>(nonscalar_data_range);
5314 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5315 i < std::get<1>(nonscalar_data_range);
5317 out << data_names[i] <<
"__";
5318 out << data_names[std::get<1>(nonscalar_data_range)];
5321 out <<
"\" NumberOfComponents=\"3\"></DataArray>\n";
5324 for (
unsigned int data_set = 0; data_set < data_names.size();
5326 if (data_set_written[data_set] ==
false)
5328 out <<
" <DataArray type=\"Float32\" Name=\""
5329 << data_names[data_set] <<
"\"></DataArray>\n";
5332 out <<
" </PointData>\n";
5333 out <<
"</Piece>\n";
5347 const unsigned int n_metadata =
5348 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5349 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5351 out <<
"<FieldData>\n";
5353 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5356 <<
"<DataArray type=\"Float32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
5357 << flags.
cycle <<
"</DataArray>\n";
5359 if (flags.
time != std::numeric_limits<double>::min())
5362 <<
"<DataArray type=\"Float32\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
5363 << flags.
time <<
"</DataArray>\n";
5367 out <<
"</FieldData>\n";
5371 const unsigned int n_data_sets = data_names.size();
5374 if (patches[0].points_are_available)
5383 const char *ascii_or_binary =
5384 (deal_ii_with_zlib &&
5391 unsigned int n_nodes;
5392 unsigned int n_cells;
5393 std::tie(n_nodes, n_cells, std::ignore) =
5401 const auto stringize_vertex_information = [&patches,
5405 ascii_or_binary]() {
5406 std::ostringstream o;
5408 o <<
" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\""
5409 << ascii_or_binary <<
"\">\n";
5410 const std::vector<Point<spacedim>> node_positions =
5415 std::vector<float> node_coordinates_3d;
5416 node_coordinates_3d.reserve(node_positions.size() * 3);
5417 for (
const auto &node_position : node_positions)
5419 for (
unsigned int d = 0; d < 3; ++d)
5421 node_coordinates_3d.emplace_back(node_position[d]);
5423 node_coordinates_3d.emplace_back(0.0f);
5425 o << vtu_stringize_array(node_coordinates_3d,
5429 o <<
" </DataArray>\n";
5430 o <<
" </Points>\n\n";
5439 const auto stringize_cell_to_vertex_information = [&patches,
5443 out.precision()]() {
5444 std::ostringstream o;
5447 o <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\""
5448 << ascii_or_binary <<
"\">\n";
5450 std::vector<int32_t> cells;
5453 unsigned int first_vertex_of_patch = 0;
5455 for (
const auto &patch : patches)
5467 const unsigned int n_points = patch.
data.n_cols();
5468 Assert((dim == 2 && n_points == 6) ||
5469 (dim == 3 && n_points == 10),
5472 if (deal_ii_with_zlib &&
5476 for (
unsigned int i = 0; i < n_points; ++i)
5477 cells.push_back(first_vertex_of_patch + i);
5481 for (
unsigned int i = 0; i < n_points; ++i)
5482 o <<
'\t' << first_vertex_of_patch + i;
5486 first_vertex_of_patch += n_points;
5495 const unsigned int n_points = patch.
data.n_cols();
5497 if (deal_ii_with_zlib &&
5501 for (
unsigned int i = 0; i < n_points; ++i)
5503 first_vertex_of_patch +
5508 for (
unsigned int i = 0; i < n_points; ++i)
5510 << (first_vertex_of_patch +
5515 first_vertex_of_patch += n_points;
5520 const unsigned int n_points_per_direction = n_subdivisions + 1;
5522 std::vector<unsigned> local_vertex_order;
5526 const auto flush_current_cell = [&flags,
5529 first_vertex_of_patch,
5530 &local_vertex_order]() {
5531 if (deal_ii_with_zlib &&
5535 for (
const auto &c : local_vertex_order)
5536 cells.push_back(first_vertex_of_patch + c);
5540 for (
const auto &c : local_vertex_order)
5541 o <<
'\t' << first_vertex_of_patch + c;
5545 local_vertex_order.clear();
5556 local_vertex_order.emplace_back(0);
5557 flush_current_cell();
5563 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5565 const unsigned int starting_offset = i1;
5566 local_vertex_order.emplace_back(starting_offset);
5567 local_vertex_order.emplace_back(starting_offset +
5569 flush_current_cell();
5576 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5577 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5579 const unsigned int starting_offset =
5580 i2 * n_points_per_direction + i1;
5581 local_vertex_order.emplace_back(
5583 local_vertex_order.emplace_back(
5584 starting_offset + 1);
5585 local_vertex_order.emplace_back(
5586 starting_offset + n_points_per_direction + 1);
5587 local_vertex_order.emplace_back(
5588 starting_offset + n_points_per_direction);
5589 flush_current_cell();
5596 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5597 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5598 for (
unsigned int i1 = 0; i1 < n_subdivisions;
5601 const unsigned int starting_offset =
5602 i3 * n_points_per_direction *
5603 n_points_per_direction +
5604 i2 * n_points_per_direction + i1;
5605 local_vertex_order.emplace_back(
5607 local_vertex_order.emplace_back(
5608 starting_offset + 1);
5609 local_vertex_order.emplace_back(
5610 starting_offset + n_points_per_direction +
5612 local_vertex_order.emplace_back(
5613 starting_offset + n_points_per_direction);
5614 local_vertex_order.emplace_back(
5615 starting_offset + n_points_per_direction *
5616 n_points_per_direction);
5617 local_vertex_order.emplace_back(
5619 n_points_per_direction *
5620 n_points_per_direction +
5622 local_vertex_order.emplace_back(
5624 n_points_per_direction *
5625 n_points_per_direction +
5626 n_points_per_direction + 1);
5627 local_vertex_order.emplace_back(
5629 n_points_per_direction *
5630 n_points_per_direction +
5631 n_points_per_direction);
5632 flush_current_cell();
5643 local_vertex_order.resize(
5652 "Point-like cells should not be possible "
5653 "when writing higher-order cells."));
5658 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
5661 const unsigned int local_index = i1;
5662 const unsigned int connectivity_index =
5664 .template vtk_lexicographic_to_node_index<1>(
5668 local_vertex_order[connectivity_index] =
5670 flush_current_cell();
5677 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1;
5679 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
5682 const unsigned int local_index =
5683 i2 * n_points_per_direction + i1;
5684 const unsigned int connectivity_index =
5686 .template vtk_lexicographic_to_node_index<
5688 {{n_subdivisions, n_subdivisions}},
5690 local_vertex_order[connectivity_index] =
5693 flush_current_cell();
5699 for (
unsigned int i3 = 0; i3 < n_subdivisions + 1;
5701 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1;
5703 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
5706 const unsigned int local_index =
5707 i3 * n_points_per_direction *
5708 n_points_per_direction +
5709 i2 * n_points_per_direction + i1;
5710 const unsigned int connectivity_index =
5712 .template vtk_lexicographic_to_node_index<
5718 local_vertex_order[connectivity_index] =
5722 flush_current_cell();
5732 first_vertex_of_patch +=
5741 o << vtu_stringize_array(cells,
5746 o <<
" </DataArray>\n";
5766 const auto stringize_cell_offset_and_type_information =
5771 output_precision = out.precision()]() {
5772 std::ostringstream o;
5774 o <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\""
5775 << ascii_or_binary <<
"\">\n";
5777 std::vector<int32_t> offsets;
5778 offsets.reserve(n_cells);
5782 std::vector<unsigned int> cell_types;
5783 cell_types.reserve(n_cells);
5785 unsigned int first_vertex_of_patch = 0;
5787 for (
const auto &patch : patches)
5789 const auto vtk_cell_id =
5792 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
5794 cell_types.push_back(vtk_cell_id[0]);
5795 first_vertex_of_patch += vtk_cell_id[2];
5796 offsets.push_back(first_vertex_of_patch);
5800 o << vtu_stringize_array(offsets,
5804 o <<
" </DataArray>\n";
5806 o <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\""
5807 << ascii_or_binary <<
"\">\n";
5809 if (deal_ii_with_zlib &&
5812 std::vector<uint8_t> cell_types_uint8_t(cell_types.size());
5813 for (
unsigned int i = 0; i < cell_types.size(); ++i)
5814 cell_types_uint8_t[i] =
static_cast<std::uint8_t
>(cell_types[i]);
5816 o << vtu_stringize_array(cell_types_uint8_t,
5822 o << vtu_stringize_array(cell_types,
5828 o <<
" </DataArray>\n";
5838 const auto stringize_nonscalar_data_range =
5844 output_precision = out.precision()](
const Table<2, float> &data_vectors,
5845 const auto &range) {
5846 std::ostringstream o;
5848 const auto first_component = std::get<0>(range);
5849 const auto last_component = std::get<1>(range);
5850 const auto &name = std::get<2>(range);
5851 const bool is_tensor =
5852 (std::get<3>(range) ==
5854 const unsigned int n_components = (is_tensor ? 9 : 3);
5861 AssertThrow((last_component + 1 - first_component <= 9),
5863 "Can't declare a tensor with more than 9 components "
5864 "in VTK/VTU format."));
5868 AssertThrow((last_component + 1 - first_component <= 3),
5870 "Can't declare a vector with more than 3 components "
5871 "in VTK/VTU format."));
5876 o <<
" <DataArray type=\"Float32\" Name=\"";
5882 for (
unsigned int i = first_component; i < last_component; ++i)
5883 o << data_names[i] <<
"__";
5884 o << data_names[last_component];
5887 o <<
"\" NumberOfComponents=\"" << n_components <<
"\" format=\""
5888 << ascii_or_binary <<
"\"";
5907 std::vector<float> data;
5908 data.reserve(n_nodes * n_components);
5910 for (
unsigned int n = 0; n < n_nodes; ++n)
5914 switch (last_component - first_component)
5917 data.push_back(data_vectors(first_component, n));
5923 data.push_back(data_vectors(first_component, n));
5924 data.push_back(data_vectors(first_component + 1, n));
5929 data.push_back(data_vectors(first_component, n));
5930 data.push_back(data_vectors(first_component + 1, n));
5931 data.push_back(data_vectors(first_component + 2, n));
5944 const unsigned int size = last_component - first_component + 1;
5948 vtk_data[0][0] = data_vectors(first_component, n);
5953 for (
unsigned int c = 0; c < size; ++c)
5957 vtk_data[ind[0]][ind[1]] =
5958 data_vectors(first_component + c, n);
5964 for (
unsigned int c = 0; c < size; ++c)
5968 vtk_data[ind[0]][ind[1]] =
5969 data_vectors(first_component + c, n);
5980 for (
unsigned int i = 0; i < 3; ++i)
5981 for (
unsigned int j = 0; j < 3; ++j)
5982 data.push_back(vtk_data[i][j]);
5986 o << vtu_stringize_array(data,
5990 o <<
" </DataArray>\n";
5995 const auto stringize_scalar_data_set =
5999 output_precision = out.precision()](
const Table<2, float> &data_vectors,
6000 const unsigned int data_set) {
6001 std::ostringstream o;
6003 o <<
" <DataArray type=\"Float32\" Name=\"" << data_names[data_set]
6004 <<
"\" format=\"" << ascii_or_binary <<
"\"";
6008 o <<
" units=\"" << flags.
physical_units.at(data_names[data_set])
6013 const std::vector<float> data(data_vectors[data_set].begin(),
6014 data_vectors[data_set].end());
6015 o << vtu_stringize_array(data,
6019 o <<
" </DataArray>\n";
6038 return create_global_data_table<dim, spacedim, float>(patches);
6052 std::move(*create_global_data_table_task.
return_value());
6058 std::vector<bool> data_set_handled(n_data_sets,
false);
6059 for (
const auto &range : nonscalar_data_ranges)
6062 const auto first_component = std::get<0>(range);
6063 const auto last_component = std::get<1>(range);
6064 for (
unsigned int i = first_component; i <= last_component; ++i)
6065 data_set_handled[i] =
true;
6068 return stringize_nonscalar_data_range(data_vectors, range);
6073 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6074 if (data_set_handled[data_set] ==
false)
6077 return stringize_scalar_data_set(data_vectors, data_set);
6083 out <<
"<Piece NumberOfPoints=\"" << n_nodes <<
"\" NumberOfCells=\""
6084 << n_cells <<
"\" >\n";
6085 for (
const auto &s : mesh_tasks.return_values())
6087 out <<
" <PointData Scalars=\"scalars\">\n";
6090 out <<
" </PointData>\n";
6091 out <<
" </Piece>\n";
6105 const std::vector<std::string> &piece_names,
6106 const std::vector<std::string> &data_names,
6108 std::tuple<
unsigned int,
6112 &nonscalar_data_ranges,
6125 unit.second.find(
'\"') == std::string::npos,
6127 "A physical unit you provided, <" + unit.second +
6128 ">, contained a quotation mark character. This is not allowed."));
6131 const unsigned int n_data_sets = data_names.size();
6133 out <<
"<?xml version=\"1.0\"?>\n";
6136 out <<
"#This file was generated by the deal.II library"
6141 <<
"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
6142 out <<
" <PUnstructuredGrid GhostLevel=\"0\">\n";
6143 out <<
" <PPointData Scalars=\"scalars\">\n";
6146 std::vector<bool> data_set_written(n_data_sets,
false);
6147 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
6149 const auto first_component = std::get<0>(nonscalar_data_range);
6150 const auto last_component = std::get<1>(nonscalar_data_range);
6151 const bool is_tensor =
6152 (std::get<3>(nonscalar_data_range) ==
6154 const unsigned int n_components = (is_tensor ? 9 : 3);
6161 AssertThrow((last_component + 1 - first_component <= 9),
6163 "Can't declare a tensor with more than 9 components "
6168 Assert((last_component + 1 - first_component <= 3),
6170 "Can't declare a vector with more than 3 components "
6175 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6176 i <= std::get<1>(nonscalar_data_range);
6178 data_set_written[i] =
true;
6182 out <<
" <PDataArray type=\"Float32\" Name=\"";
6184 const std::string &name = std::get<2>(nonscalar_data_range);
6189 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6190 i < std::get<1>(nonscalar_data_range);
6192 out << data_names[i] <<
"__";
6193 out << data_names[std::get<1>(nonscalar_data_range)];
6196 out <<
"\" NumberOfComponents=\"" << n_components
6197 <<
"\" format=\"ascii\"";
6209 data_names[std::get<1>(nonscalar_data_range)]) !=
6213 data_names[std::get<1>(nonscalar_data_range)])
6221 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6222 if (data_set_written[data_set] ==
false)
6224 out <<
" <PDataArray type=\"Float32\" Name=\""
6225 << data_names[data_set] <<
"\" format=\"ascii\"";
6229 out <<
" units=\"" << flags.
physical_units.at(data_names[data_set])
6235 out <<
" </PPointData>\n";
6237 out <<
" <PPoints>\n";
6238 out <<
" <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
6239 out <<
" </PPoints>\n";
6241 for (
const auto &piece_name : piece_names)
6242 out <<
" <Piece Source=\"" << piece_name <<
"\"/>\n";
6244 out <<
" </PUnstructuredGrid>\n";
6245 out <<
"</VTKFile>\n";
6258 const std::vector<std::pair<double, std::string>> ×_and_names)
6262 out <<
"<?xml version=\"1.0\"?>\n";
6265 out <<
"#This file was generated by the deal.II library"
6270 <<
"<VTKFile type=\"Collection\" version=\"0.1\" ByteOrder=\"LittleEndian\">\n";
6271 out <<
" <Collection>\n";
6273 std::streamsize ss = out.precision();
6276 for (
const auto &time_and_name : times_and_names)
6277 out <<
" <DataSet timestep=\"" << time_and_name.first
6278 <<
"\" group=\"\" part=\"0\" file=\"" << time_and_name.second
6281 out <<
" </Collection>\n";
6282 out <<
"</VTKFile>\n";
6294 const std::vector<std::string> &piece_names)
6296 out <<
"!NBLOCKS " << piece_names.size() <<
'\n';
6297 for (
const auto &piece_name : piece_names)
6298 out << piece_name <<
'\n';
6307 const std::vector<std::vector<std::string>> &piece_names)
6311 if (piece_names.empty())
6314 const double nblocks = piece_names[0].size();
6316 ExcMessage(
"piece_names should be a vector of nonempty vectors."));
6318 out <<
"!NBLOCKS " << nblocks <<
'\n';
6319 for (
const auto &domain : piece_names)
6321 Assert(domain.size() == nblocks,
6323 "piece_names should be a vector of equal sized vectors."));
6324 for (
const auto &subdomain : domain)
6325 out << subdomain <<
'\n';
6336 const std::vector<std::pair<
double, std::vector<std::string>>>
6337 ×_and_piece_names)
6341 if (times_and_piece_names.empty())
6344 const double nblocks = times_and_piece_names[0].second.size();
6348 "time_and_piece_names should contain nonempty vectors of filenames for every timestep."));
6350 for (
const auto &domain : times_and_piece_names)
6351 out <<
"!TIME " << domain.first <<
'\n';
6353 out <<
"!NBLOCKS " << nblocks <<
'\n';
6354 for (
const auto &domain : times_and_piece_names)
6356 Assert(domain.second.size() == nblocks,
6358 "piece_names should be a vector of equal sized vectors."));
6359 for (
const auto &subdomain : domain.second)
6360 out << subdomain <<
'\n';
6368 template <
int dim,
int spacedim>
6372 const std::vector<std::string> &,
6374 std::tuple<
unsigned int,
6384 template <
int spacedim>
6388 const std::vector<std::string> & ,
6390 std::tuple<
unsigned int,
6398 const unsigned int height = flags.
height;
6399 unsigned int width = flags.
width;
6402 unsigned int margin_in_percent = 0;
6404 margin_in_percent = 5;
6408 double x_dimension, y_dimension, z_dimension;
6410 const auto &first_patch = patches[0];
6412 unsigned int n_subdivisions = first_patch.n_subdivisions;
6413 unsigned int n = n_subdivisions + 1;
6414 const unsigned int d1 = 1;
6415 const unsigned int d2 = n;
6418 std::array<Point<spacedim>, 4> projected_points;
6421 std::array<Point<2>, 4> projection_decompositions;
6424 get_equispaced_location(first_patch, {0, 0}, n_subdivisions);
6426 if (first_patch.data.n_rows() != 0)
6431 double x_min = projected_point[0];
6432 double x_max = x_min;
6433 double y_min = projected_point[1];
6434 double y_max = y_min;
6435 double z_min = first_patch.data.n_rows() != 0 ?
6438 double z_max = z_min;
6441 for (
const auto &patch : patches)
6444 n = n_subdivisions + 1;
6446 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6448 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6450 projected_points[0] =
6451 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
6452 projected_points[1] =
6453 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
6454 projected_points[2] =
6455 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
6456 projected_points[3] = get_equispaced_location(patch,
6460 x_min =
std::min(x_min, projected_points[0][0]);
6461 x_min =
std::min(x_min, projected_points[1][0]);
6462 x_min =
std::min(x_min, projected_points[2][0]);
6463 x_min =
std::min(x_min, projected_points[3][0]);
6465 x_max =
std::max(x_max, projected_points[0][0]);
6466 x_max =
std::max(x_max, projected_points[1][0]);
6467 x_max =
std::max(x_max, projected_points[2][0]);
6468 x_max =
std::max(x_max, projected_points[3][0]);
6470 y_min =
std::min(y_min, projected_points[0][1]);
6471 y_min =
std::min(y_min, projected_points[1][1]);
6472 y_min =
std::min(y_min, projected_points[2][1]);
6473 y_min =
std::min(y_min, projected_points[3][1]);
6475 y_max =
std::max(y_max, projected_points[0][1]);
6476 y_max =
std::max(y_max, projected_points[1][1]);
6477 y_max =
std::max(y_max, projected_points[2][1]);
6478 y_max =
std::max(y_max, projected_points[3][1]);
6481 patch.
data.n_rows() == 0,
6484 patch.
data.n_rows()));
6488 i1 * d1 + i2 * d2));
6491 (i1 + 1) * d1 + i2 * d2));
6494 i1 * d1 + (i2 + 1) * d2));
6498 (i1 + 1) * d1 + (i2 + 1) * d2));
6502 i1 * d1 + i2 * d2));
6505 (i1 + 1) * d1 + i2 * d2));
6508 i1 * d1 + (i2 + 1) * d2));
6512 (i1 + 1) * d1 + (i2 + 1) * d2));
6517 x_dimension = x_max - x_min;
6518 y_dimension = y_max - y_min;
6519 z_dimension = z_max - z_min;
6526 float camera_focus = 0;
6529 camera_position[0] = 0.;
6530 camera_position[1] = 0.;
6531 camera_position[2] = z_min + 2. * z_dimension;
6533 camera_direction[0] = 0.;
6534 camera_direction[1] = 0.;
6535 camera_direction[2] = -1.;
6537 camera_horizontal[0] = 1.;
6538 camera_horizontal[1] = 0.;
6539 camera_horizontal[2] = 0.;
6541 camera_focus = .5 * z_dimension;
6547 const float angle_factor = 3.14159265f / 180.f;
6550 camera_position_temp[1] =
6553 camera_position_temp[2] =
6557 camera_direction_temp[1] =
6560 camera_direction_temp[2] =
6564 camera_horizontal_temp[1] =
6567 camera_horizontal_temp[2] =
6571 camera_position[1] = camera_position_temp[1];
6572 camera_position[2] = camera_position_temp[2];
6574 camera_direction[1] = camera_direction_temp[1];
6575 camera_direction[2] = camera_direction_temp[2];
6577 camera_horizontal[1] = camera_horizontal_temp[1];
6578 camera_horizontal[2] = camera_horizontal_temp[2];
6581 camera_position_temp[0] =
6584 camera_position_temp[1] =
6588 camera_direction_temp[0] =
6591 camera_direction_temp[1] =
6595 camera_horizontal_temp[0] =
6598 camera_horizontal_temp[1] =
6602 camera_position[0] = camera_position_temp[0];
6603 camera_position[1] = camera_position_temp[1];
6605 camera_direction[0] = camera_direction_temp[0];
6606 camera_direction[1] = camera_direction_temp[1];
6608 camera_horizontal[0] = camera_horizontal_temp[0];
6609 camera_horizontal[1] = camera_horizontal_temp[1];
6612 camera_position[0] = x_min + .5 * x_dimension;
6613 camera_position[1] = y_min + .5 * y_dimension;
6615 camera_position[0] += (z_min + 2. * z_dimension) *
6618 camera_position[1] -= (z_min + 2. * z_dimension) *
6624 double x_min_perspective, y_min_perspective;
6625 double x_max_perspective, y_max_perspective;
6626 double x_dimension_perspective, y_dimension_perspective;
6628 n_subdivisions = first_patch.n_subdivisions;
6629 n = n_subdivisions + 1;
6634 get_equispaced_location(first_patch, {0, 0}, n_subdivisions);
6636 if (first_patch.data.n_rows() != 0)
6641 point[0] = projected_point[0];
6642 point[1] = projected_point[1];
6643 point[2] = first_patch.data.n_rows() != 0 ?
6647 projection_decomposition = svg_project_point(point,
6653 x_min_perspective = projection_decomposition[0];
6654 x_max_perspective = projection_decomposition[0];
6655 y_min_perspective = projection_decomposition[1];
6656 y_max_perspective = projection_decomposition[1];
6659 for (
const auto &patch : patches)
6662 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6664 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6667 {get_equispaced_location(patch, {i1, i2}, n_subdivisions),
6668 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions),
6669 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions),
6670 get_equispaced_location(patch,
6675 patch.
data.n_rows() == 0,
6678 patch.
data.n_rows()));
6680 const std::array<Point<3>, 4>
vertices = {
6683 patch.
data.n_rows() != 0 ?
6684 patch.
data(0, i1 * d1 + i2 * d2) :
6688 patch.
data.n_rows() != 0 ?
6689 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6693 patch.
data.n_rows() != 0 ?
6694 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6698 patch.
data.n_rows() != 0 ?
6699 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6702 projection_decompositions = {
6726 static_cast<double>(
6727 projection_decompositions[0][0]));
6730 static_cast<double>(
6731 projection_decompositions[1][0]));
6734 static_cast<double>(
6735 projection_decompositions[2][0]));
6738 static_cast<double>(
6739 projection_decompositions[3][0]));
6743 static_cast<double>(
6744 projection_decompositions[0][0]));
6747 static_cast<double>(
6748 projection_decompositions[1][0]));
6751 static_cast<double>(
6752 projection_decompositions[2][0]));
6755 static_cast<double>(
6756 projection_decompositions[3][0]));
6760 static_cast<double>(
6761 projection_decompositions[0][1]));
6764 static_cast<double>(
6765 projection_decompositions[1][1]));
6768 static_cast<double>(
6769 projection_decompositions[2][1]));
6772 static_cast<double>(
6773 projection_decompositions[3][1]));
6777 static_cast<double>(
6778 projection_decompositions[0][1]));
6781 static_cast<double>(
6782 projection_decompositions[1][1]));
6785 static_cast<double>(
6786 projection_decompositions[2][1]));
6789 static_cast<double>(
6790 projection_decompositions[3][1]));
6795 x_dimension_perspective = x_max_perspective - x_min_perspective;
6796 y_dimension_perspective = y_max_perspective - y_min_perspective;
6798 std::multiset<SvgCell> cells;
6801 for (
const auto &patch : patches)
6805 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6807 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6810 {get_equispaced_location(patch, {i1, i2}, n_subdivisions),
6811 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions),
6812 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions),
6813 get_equispaced_location(patch,
6818 patch.
data.n_rows() == 0,
6821 patch.
data.n_rows()));
6827 cell.vertices[0][2] = patch.
data.n_rows() != 0 ?
6828 patch.
data(0, i1 * d1 + i2 * d2) :
6833 cell.vertices[1][2] = patch.
data.n_rows() != 0 ?
6834 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6839 cell.vertices[2][2] = patch.
data.n_rows() != 0 ?
6840 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6845 cell.vertices[3][2] =
6846 patch.
data.n_rows() != 0 ?
6847 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6850 cell.projected_vertices[0] =
6851 svg_project_point(cell.vertices[0],
6856 cell.projected_vertices[1] =
6857 svg_project_point(cell.vertices[1],
6862 cell.projected_vertices[2] =
6863 svg_project_point(cell.vertices[2],
6868 cell.projected_vertices[3] =
6869 svg_project_point(cell.vertices[3],
6875 cell.center = .25 * (cell.vertices[0] + cell.vertices[1] +
6876 cell.vertices[2] + cell.vertices[3]);
6877 cell.projected_center = svg_project_point(cell.center,
6883 cell.depth = cell.center.distance(camera_position);
6893 width =
static_cast<unsigned int>(
6894 .5 + height * (x_dimension_perspective / y_dimension_perspective));
6895 unsigned int additional_width = 0;
6898 additional_width =
static_cast<unsigned int>(
6902 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\""
6903 << height <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">"
6905 <<
" <rect width=\"" << width + additional_width <<
"\" height=\""
6906 << height <<
"\" style=\"fill:white\"/>" <<
'\n'
6909 unsigned int triangle_counter = 0;
6912 for (
const auto &cell : cells)
6916 for (
unsigned int triangle_index = 0; triangle_index < 4;
6919 switch (triangle_index)
6922 points3d_triangle[0] = cell.vertices[0],
6923 points3d_triangle[1] = cell.vertices[1],
6924 points3d_triangle[2] = cell.center;
6927 points3d_triangle[0] = cell.vertices[1],
6928 points3d_triangle[1] = cell.vertices[3],
6929 points3d_triangle[2] = cell.center;
6932 points3d_triangle[0] = cell.vertices[3],
6933 points3d_triangle[1] = cell.vertices[2],
6934 points3d_triangle[2] = cell.center;
6937 points3d_triangle[0] = cell.vertices[2],
6938 points3d_triangle[1] = cell.vertices[0],
6939 points3d_triangle[2] = cell.center;
6946 svg_get_gradient_parameters(points3d_triangle);
6949 .667 - ((gradient_param[4] - z_min) / z_dimension) * .667;
6951 .667 - ((gradient_param[5] - z_min) / z_dimension) * .667;
6953 unsigned int start_r = 0;
6954 unsigned int start_g = 0;
6955 unsigned int start_b = 0;
6957 unsigned int stop_r = 0;
6958 unsigned int stop_g = 0;
6959 unsigned int stop_b = 0;
6961 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
6962 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
6964 double start_f = start_h * 6. - start_i;
6965 double start_q = 1. - start_f;
6967 double stop_f = stop_h * 6. - stop_i;
6968 double stop_q = 1. - stop_f;
6970 switch (start_i % 6)
6974 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
6977 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
6982 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
6985 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
6989 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
6994 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7004 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7007 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7012 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7015 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7019 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7024 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7030 Point<3> gradient_start_point_3d, gradient_stop_point_3d;
7032 gradient_start_point_3d[0] = gradient_param[0];
7033 gradient_start_point_3d[1] = gradient_param[1];
7034 gradient_start_point_3d[2] = gradient_param[4];
7036 gradient_stop_point_3d[0] = gradient_param[2];
7037 gradient_stop_point_3d[1] = gradient_param[3];
7038 gradient_stop_point_3d[2] = gradient_param[5];
7041 svg_project_point(gradient_start_point_3d,
7047 svg_project_point(gradient_stop_point_3d,
7054 out <<
" <linearGradient id=\"" << triangle_counter
7055 <<
"\" gradientUnits=\"userSpaceOnUse\" "
7057 <<
static_cast<unsigned int>(
7059 ((gradient_start_point[0] - x_min_perspective) /
7060 x_dimension_perspective) *
7061 (width - (width / 100.) * 2. * margin_in_percent) +
7062 ((width / 100.) * margin_in_percent))
7065 <<
static_cast<unsigned int>(
7066 .5 + height - (height / 100.) * margin_in_percent -
7067 ((gradient_start_point[1] - y_min_perspective) /
7068 y_dimension_perspective) *
7069 (height - (height / 100.) * 2. * margin_in_percent))
7072 <<
static_cast<unsigned int>(
7074 ((gradient_stop_point[0] - x_min_perspective) /
7075 x_dimension_perspective) *
7076 (width - (width / 100.) * 2. * margin_in_percent) +
7077 ((width / 100.) * margin_in_percent))
7080 <<
static_cast<unsigned int>(
7081 .5 + height - (height / 100.) * margin_in_percent -
7082 ((gradient_stop_point[1] - y_min_perspective) /
7083 y_dimension_perspective) *
7084 (height - (height / 100.) * 2. * margin_in_percent))
7087 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7088 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n'
7089 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7090 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n'
7091 <<
" </linearGradient>" <<
'\n';
7094 double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
7095 double x3 = cell.projected_center[0];
7096 double y3 = cell.projected_center[1];
7098 switch (triangle_index)
7101 x1 = cell.projected_vertices[0][0],
7102 y1 = cell.projected_vertices[0][1],
7103 x2 = cell.projected_vertices[1][0],
7104 y2 = cell.projected_vertices[1][1];
7107 x1 = cell.projected_vertices[1][0],
7108 y1 = cell.projected_vertices[1][1],
7109 x2 = cell.projected_vertices[3][0],
7110 y2 = cell.projected_vertices[3][1];
7113 x1 = cell.projected_vertices[3][0],
7114 y1 = cell.projected_vertices[3][1],
7115 x2 = cell.projected_vertices[2][0],
7116 y2 = cell.projected_vertices[2][1];
7119 x1 = cell.projected_vertices[2][0],
7120 y1 = cell.projected_vertices[2][1],
7121 x2 = cell.projected_vertices[0][0],
7122 y2 = cell.projected_vertices[0][1];
7128 out <<
" <path d=\"M "
7129 <<
static_cast<unsigned int>(
7131 ((x1 - x_min_perspective) / x_dimension_perspective) *
7132 (width - (width / 100.) * 2. * margin_in_percent) +
7133 ((width / 100.) * margin_in_percent))
7135 <<
static_cast<unsigned int>(
7136 .5 + height - (height / 100.) * margin_in_percent -
7137 ((y1 - y_min_perspective) / y_dimension_perspective) *
7138 (height - (height / 100.) * 2. * margin_in_percent))
7140 <<
static_cast<unsigned int>(
7142 ((x2 - x_min_perspective) / x_dimension_perspective) *
7143 (width - (width / 100.) * 2. * margin_in_percent) +
7144 ((width / 100.) * margin_in_percent))
7146 <<
static_cast<unsigned int>(
7147 .5 + height - (height / 100.) * margin_in_percent -
7148 ((y2 - y_min_perspective) / y_dimension_perspective) *
7149 (height - (height / 100.) * 2. * margin_in_percent))
7151 <<
static_cast<unsigned int>(
7153 ((x3 - x_min_perspective) / x_dimension_perspective) *
7154 (width - (width / 100.) * 2. * margin_in_percent) +
7155 ((width / 100.) * margin_in_percent))
7157 <<
static_cast<unsigned int>(
7158 .5 + height - (height / 100.) * margin_in_percent -
7159 ((y3 - y_min_perspective) / y_dimension_perspective) *
7160 (height - (height / 100.) * 2. * margin_in_percent))
7162 <<
static_cast<unsigned int>(
7164 ((x1 - x_min_perspective) / x_dimension_perspective) *
7165 (width - (width / 100.) * 2. * margin_in_percent) +
7166 ((width / 100.) * margin_in_percent))
7168 <<
static_cast<unsigned int>(
7169 .5 + height - (height / 100.) * margin_in_percent -
7170 ((y1 - y_min_perspective) / y_dimension_perspective) *
7171 (height - (height / 100.) * 2. * margin_in_percent))
7172 <<
"\" style=\"stroke:black; fill:url(#" << triangle_counter
7183 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
7185 unsigned int element_height =
static_cast<unsigned int>(
7186 ((height / 100.) * (71. - 2. * margin_in_percent)) / 4);
7187 unsigned int element_width =
7188 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7190 additional_width = 0;
7193 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7195 for (
unsigned int index = 0; index < 4; ++index)
7197 double start_h = .667 - ((index + 1) / 4.) * .667;
7198 double stop_h = .667 - (index / 4.) * .667;
7200 unsigned int start_r = 0;
7201 unsigned int start_g = 0;
7202 unsigned int start_b = 0;
7204 unsigned int stop_r = 0;
7205 unsigned int stop_g = 0;
7206 unsigned int stop_b = 0;
7208 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
7209 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
7211 double start_f = start_h * 6. - start_i;
7212 double start_q = 1. - start_f;
7214 double stop_f = stop_h * 6. - stop_i;
7215 double stop_q = 1. - stop_f;
7217 switch (start_i % 6)
7221 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
7224 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
7229 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
7232 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
7236 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
7241 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7251 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7254 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7259 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7262 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7266 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7271 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7278 out <<
" <linearGradient id=\"colorbar_" << index
7279 <<
"\" gradientUnits=\"userSpaceOnUse\" "
7280 <<
"x1=\"" << width + additional_width <<
"\" "
7282 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7283 (margin_in_percent + 29)) +
7284 (3 - index) * element_height
7286 <<
"x2=\"" << width + additional_width <<
"\" "
7288 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7289 (margin_in_percent + 29)) +
7290 (4 - index) * element_height
7293 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7294 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n'
7295 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7296 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n'
7297 <<
" </linearGradient>" <<
'\n';
7302 <<
" x=\"" << width + additional_width <<
"\" y=\""
7303 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7304 (margin_in_percent + 29)) +
7305 (3 - index) * element_height
7306 <<
"\" width=\"" << element_width <<
"\" height=\""
7308 <<
"\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_"
7309 << index <<
")\"/>" <<
'\n';
7312 for (
unsigned int index = 0; index < 5; ++index)
7316 << width + additional_width +
7317 static_cast<unsigned int>(1.5 * element_width)
7319 <<
static_cast<unsigned int>(
7320 .5 + (height / 100.) * (margin_in_percent + 29) +
7321 (4. - index) * element_height + 30.)
7323 <<
" style=\"text-anchor:start; font-size:80; font-family:Helvetica";
7325 if (index == 0 || index == 4)
7326 out <<
"; font-weight:bold";
7329 <<
static_cast<float>(
7330 (
static_cast<int>((z_min + index * (z_dimension / 4.)) *
7339 out <<
"</text>" <<
'\n';
7344 out <<
'\n' <<
"</svg>";
7350 template <
int dim,
int spacedim>
7354 const std::vector<std::string> &data_names,
7356 std::tuple<
unsigned int,
7360 &nonscalar_data_ranges,
7369 out << dim <<
' ' << spacedim <<
'\n';
7372 out <<
"[deal.II intermediate format graphics data]" <<
'\n'
7378 out << data_names.size() <<
'\n';
7379 for (
const auto &data_name : data_names)
7380 out << data_name <<
'\n';
7382 out << patches.size() <<
'\n';
7383 for (
unsigned int i = 0; i < patches.size(); ++i)
7384 out << patches[i] <<
'\n';
7386 out << nonscalar_data_ranges.size() <<
'\n';
7387 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
7388 out << std::get<0>(nonscalar_data_range) <<
' '
7389 << std::get<1>(nonscalar_data_range) <<
'\n'
7390 << std::get<2>(nonscalar_data_range) <<
'\n';
7398 template <
int dim,
int spacedim>
7402 const std::vector<std::string> &data_names,
7404 std::tuple<
unsigned int,
7408 &nonscalar_data_ranges,
7410 const std::string &filename,
7414#ifndef DEAL_II_WITH_MPI
7417 (void)nonscalar_data_ranges;
7424 ExcMessage(
"This functionality requires MPI to be enabled."));
7443 std::vector<char> my_buffer;
7445 boost::iostreams::filtering_ostream f;
7451# ifdef DEAL_II_WITH_ZLIB
7452 f.push(boost::iostreams::zlib_compressor(
7453 get_boost_zlib_compression_level(compression)));
7458 "Compression requires deal.II to be configured with ZLIB support."));
7461 boost::iostreams::back_insert_device<std::vector<char>> inserter(
7466 patches, data_names, nonscalar_data_ranges, flags, f);
7468 const std::uint64_t my_size = my_buffer.size();
7474 const ParallelIntermediateHeader header{
7477 static_cast<std::uint64_t
>(compression),
7487 std::vector<std::uint64_t> chunk_sizes(n_ranks);
7488 int ierr = MPI_Gather(&my_size,
7491 static_cast<std::uint64_t *
>(chunk_sizes.data()),
7499 ierr = MPI_Info_create(&info);
7502 ierr = MPI_File_open(
7503 comm, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh);
7505 ierr = MPI_Info_free(&info);
7509 ierr = MPI_File_set_size(fh, 0);
7513 ierr = MPI_Barrier(
comm);
7520 fh, 0, &header,
sizeof(header), MPI_CHAR, MPI_STATUS_IGNORE);
7535 std::uint64_t prefix_sum = 0;
7536 ierr = MPI_Exscan(&my_size, &prefix_sum, 1, MPI_UINT64_T, MPI_SUM,
comm);
7540 const MPI_Offset offset =
static_cast<MPI_Offset
>(
sizeof(header)) +
7541 n_ranks *
sizeof(std::uint64_t) + prefix_sum;
7544 fh, offset, my_buffer.data(), my_size, MPI_CHAR, MPI_STATUS_IGNORE);
7553 ierr = MPI_File_sync(fh);
7556 ierr = MPI_File_close(&fh);
7563 std::pair<unsigned int, unsigned int>
7568 unsigned int dim, spacedim;
7569 input >> dim >> spacedim;
7571 return std::make_pair(dim, spacedim);
7580template <
int dim,
int spacedim>
7582 : default_subdivisions(1)
7588template <
int dim,
int spacedim>
7593 get_dataset_names(),
7594 get_nonscalar_data_ranges(),
7601template <
int dim,
int spacedim>
7606 get_dataset_names(),
7607 get_nonscalar_data_ranges(),
7614template <
int dim,
int spacedim>
7619 get_dataset_names(),
7620 get_nonscalar_data_ranges(),
7627template <
int dim,
int spacedim>
7632 get_dataset_names(),
7633 get_nonscalar_data_ranges(),
7640template <
int dim,
int spacedim>
7645 get_dataset_names(),
7646 get_nonscalar_data_ranges(),
7653template <
int dim,
int spacedim>
7658 get_dataset_names(),
7659 get_nonscalar_data_ranges(),
7666template <
int dim,
int spacedim>
7671 get_dataset_names(),
7672 get_nonscalar_data_ranges(),
7679template <
int dim,
int spacedim>
7684 get_dataset_names(),
7685 get_nonscalar_data_ranges(),
7690template <
int dim,
int spacedim>
7695 get_dataset_names(),
7696 get_nonscalar_data_ranges(),
7701template <
int dim,
int spacedim>
7706 get_dataset_names(),
7707 get_nonscalar_data_ranges(),
7713template <
int dim,
int spacedim>
7716 const std::string &filename,
7719#ifndef DEAL_II_WITH_MPI
7723 std::ofstream f(filename);
7731 int ierr = MPI_Info_create(&info);
7734 ierr = MPI_File_open(
7735 comm, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh);
7738 ierr = MPI_File_set_size(fh, 0);
7742 ierr = MPI_Barrier(
comm);
7744 ierr = MPI_Info_free(&info);
7748 unsigned int header_size;
7749 std::uint64_t footer_offset;
7754 std::stringstream ss;
7756 header_size = ss.str().size();
7759 fh, 0, ss.str().c_str(), header_size, MPI_CHAR, MPI_STATUS_IGNORE);
7763 ierr = MPI_Bcast(&header_size, 1, MPI_UNSIGNED, 0,
comm);
7767 const auto &patches = get_patches();
7776 std::stringstream ss;
7777 if (my_n_patches > 0 || (global_n_patches == 0 && myrank == 0))
7779 get_dataset_names(),
7780 get_nonscalar_data_ranges(),
7785 const std::uint64_t size_on_proc = ss.str().size();
7786 std::uint64_t prefix_sum = 0;
7788 MPI_Exscan(&size_on_proc, &prefix_sum, 1, MPI_UINT64_T, MPI_SUM,
comm);
7792 const MPI_Offset offset =
static_cast<MPI_Offset
>(header_size) + prefix_sum;
7802 if (myrank == n_ranks - 1)
7805 footer_offset = size_on_proc + offset;
7807 std::stringstream ss;
7809 const unsigned int footer_size = ss.str().size();
7827 ierr = MPI_File_sync(fh);
7830 ierr = MPI_File_close(&fh);
7837template <
int dim,
int spacedim>
7841 const std::vector<std::string> &piece_names)
const
7845 get_dataset_names(),
7846 get_nonscalar_data_ranges(),
7852template <
int dim,
int spacedim>
7855 const std::string &directory,
7856 const std::string &filename_without_extension,
7857 const unsigned int counter,
7859 const unsigned int n_digits_for_counter,
7860 const unsigned int n_groups)
const
7863 const unsigned int n_ranks =
7865 const unsigned int n_files_written =
7866 (n_groups == 0 || n_groups > n_ranks) ? n_ranks : n_groups;
7871 const unsigned int n_digits =
7874 const unsigned int color = rank % n_files_written;
7875 const std::string filename =
7876 directory + filename_without_extension +
"_" +
7880 if (n_groups == 0 || n_groups > n_ranks)
7883 std::ofstream output(filename);
7885 this->write_vtu(output);
7887 else if (n_groups == 1)
7890 this->write_vtu_in_parallel(filename, mpi_communicator);
7894#ifdef DEAL_II_WITH_MPI
7897 int ierr = MPI_Comm_split(mpi_communicator, color, rank, &comm_group);
7899 this->write_vtu_in_parallel(filename, comm_group);
7907 const std::string pvtu_filename =
7908 filename_without_extension +
"_" +
7913 std::vector<std::string> filename_vector;
7914 for (
unsigned int i = 0; i < n_files_written; ++i)
7916 const std::string filename =
7917 filename_without_extension +
"_" +
7921 filename_vector.emplace_back(filename);
7924 std::ofstream pvtu_output(directory + pvtu_filename);
7925 this->write_pvtu_record(pvtu_output, filename_vector);
7928 return pvtu_filename;
7933template <
int dim,
int spacedim>
7936 std::ostream &out)
const
7939 get_dataset_names(),
7940 get_nonscalar_data_ranges(),
7941 deal_II_intermediate_flags,
7947template <
int dim,
int spacedim>
7950 const std::string &filename,
7956 get_dataset_names(),
7957 get_nonscalar_data_ranges(),
7958 deal_II_intermediate_flags,
7966template <
int dim,
int spacedim>
7970 const std::string &h5_filename,
7971 const double cur_time,
7974 return create_xdmf_entry(
7975 data_filter, h5_filename, h5_filename, cur_time,
comm);
7980template <
int dim,
int spacedim>
7984 const std::string &h5_mesh_filename,
7985 const std::string &h5_solution_filename,
7986 const double cur_time,
7990 ExcMessage(
"XDMF only supports 2 or 3 space dimensions."));
7992#ifndef DEAL_II_WITH_HDF5
7996 (void)h5_mesh_filename;
7997 (void)h5_solution_filename;
8006 std::uint64_t local_node_cell_count[2], global_node_cell_count[2];
8008 local_node_cell_count[0] = data_filter.
n_nodes();
8009 local_node_cell_count[1] = data_filter.
n_cells();
8013 int ierr = MPI_Allreduce(local_node_cell_count,
8014 global_node_cell_count,
8028 const bool have_data = (data_filter.
n_nodes() > 0);
8031 const int key = myrank;
8032 const int color = (have_data ? 1 : 0);
8033 const int ierr = MPI_Comm_split(
comm, color, key, &split_comm);
8037 const bool am_i_first_rank_with_data =
8040 ierr = MPI_Comm_free(&split_comm);
8043 const int tag = 47381;
8046 if (am_i_first_rank_with_data)
8048 const auto &patches = get_patches();
8053 for (
const auto &patch : patches)
8059 h5_solution_filename,
8061 global_node_cell_count[0],
8062 global_node_cell_count[1],
8065 patches[0].reference_cell);
8066 const unsigned int n_data_sets = data_filter.
n_data_sets();
8070 for (
unsigned int i = 0; i < n_data_sets; ++i)
8080 ierr = MPI_Send(buffer.data(), buffer.size(), MPI_BYTE, 0, tag,
comm);
8089 if (myrank == 0 && !am_i_first_rank_with_data)
8094 int ierr = MPI_Probe(MPI_ANY_SOURCE, tag,
comm, &status);
8098 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
8101 std::vector<char> buffer(len);
8102 ierr = MPI_Recv(buffer.data(),
8119template <
int dim,
int spacedim>
8122 const std::vector<XDMFEntry> &entries,
8123 const std::string &filename,
8126#ifdef DEAL_II_WITH_MPI
8130 const int myrank = 0;
8136 std::ofstream xdmf_file(filename);
8138 xdmf_file <<
"<?xml version=\"1.0\" ?>\n";
8139 xdmf_file <<
"<!DOCTYPE Xdmf SYSTEM \"Xdmf.dtd\" []>\n";
8140 xdmf_file <<
"<Xdmf Version=\"2.0\">\n";
8141 xdmf_file <<
" <Domain>\n";
8143 <<
" <Grid Name=\"CellTime\" GridType=\"Collection\" CollectionType=\"Temporal\">\n";
8145 for (
const auto &entry : entries)
8147 xdmf_file << entry.get_xdmf_content(3);
8150 xdmf_file <<
" </Grid>\n";
8151 xdmf_file <<
" </Domain>\n";
8152 xdmf_file <<
"</Xdmf>\n";
8164template <
int dim,
int spacedim>
8170 get_dataset_names(),
8171 get_nonscalar_data_ranges(),
8178#ifdef DEAL_II_WITH_HDF5
8182 template <
int dim,
int spacedim>
8187 const bool write_mesh_file,
8188 const std::string &mesh_filename,
8189 const std::string &solution_filename,
8192 hid_t h5_mesh_file_id = -1, h5_solution_file_id, file_plist_id, plist_id;
8193 hid_t node_dataspace, node_dataset, node_file_dataspace,
8194 node_memory_dataspace, node_dataset_id;
8195 hid_t cell_dataspace, cell_dataset, cell_file_dataspace,
8196 cell_memory_dataspace;
8197 hid_t pt_data_dataspace, pt_data_dataset, pt_data_file_dataspace,
8198 pt_data_memory_dataspace;
8200 std::uint64_t local_node_cell_count[2];
8201 hsize_t count[2], offset[2], node_ds_dim[2], cell_ds_dim[2];
8202 std::vector<double> node_data_vec;
8203 std::vector<unsigned int> cell_data_vec;
8207 local_node_cell_count[0] = data_filter.
n_nodes();
8208 local_node_cell_count[1] = data_filter.
n_cells();
8211 file_plist_id = H5Pcreate(H5P_FILE_ACCESS);
8214# ifdef DEAL_II_WITH_MPI
8215# ifdef H5_HAVE_PARALLEL
8217 status = H5Pset_fapl_mpio(file_plist_id,
comm, MPI_INFO_NULL);
8222# ifndef DEAL_II_WITH_ZLIB
8229 std::uint64_t global_node_cell_count[2] = {0, 0};
8230 std::uint64_t global_node_cell_offsets[2] = {0, 0};
8232# ifdef DEAL_II_WITH_MPI
8233 int ierr = MPI_Allreduce(local_node_cell_count,
8234 global_node_cell_count,
8240 ierr = MPI_Exscan(local_node_cell_count,
8241 global_node_cell_offsets,
8248 global_node_cell_count[0] = local_node_cell_count[0];
8249 global_node_cell_count[1] = local_node_cell_count[1];
8250 global_node_cell_offsets[0] = global_node_cell_offsets[1] = 0;
8254 plist_id = H5Pcreate(H5P_DATASET_XFER);
8256# ifdef DEAL_II_WITH_MPI
8257# ifdef H5_HAVE_PARALLEL
8258 status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
8263 if (write_mesh_file)
8266 h5_mesh_file_id = H5Fcreate(mesh_filename.c_str(),
8274 node_ds_dim[0] = global_node_cell_count[0];
8275 node_ds_dim[1] = (spacedim < 2) ? 2 : spacedim;
8276 node_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8279 cell_ds_dim[0] = global_node_cell_count[1];
8280 cell_ds_dim[1] = patches[0].reference_cell.n_vertices();
8281 cell_dataspace = H5Screate_simple(2, cell_ds_dim,
nullptr);
8285# if H5Gcreate_vers == 1
8286 node_dataset = H5Dcreate(h5_mesh_file_id,
8292 node_dataset_id = H5Pcreate(H5P_DATASET_CREATE);
8293# ifdef DEAL_II_WITH_ZLIB
8294 H5Pset_deflate(node_dataset_id,
8296 H5Pset_chunk(node_dataset_id, 2, node_ds_dim);
8298 node_dataset = H5Dcreate(h5_mesh_file_id,
8305 H5Pclose(node_dataset_id);
8308# if H5Gcreate_vers == 1
8309 cell_dataset = H5Dcreate(h5_mesh_file_id,
8315 node_dataset_id = H5Pcreate(H5P_DATASET_CREATE);
8316# ifdef DEAL_II_WITH_ZLIB
8317 H5Pset_deflate(node_dataset_id,
8319 H5Pset_chunk(node_dataset_id, 2, cell_ds_dim);
8321 cell_dataset = H5Dcreate(h5_mesh_file_id,
8328 H5Pclose(node_dataset_id);
8333 status = H5Sclose(node_dataspace);
8335 status = H5Sclose(cell_dataspace);
8340 count[0] = local_node_cell_count[0];
8341 count[1] = (spacedim < 2) ? 2 : spacedim;
8343 offset[0] = global_node_cell_offsets[0];
8346 node_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8350 node_file_dataspace = H5Dget_space(node_dataset);
8352 status = H5Sselect_hyperslab(
8353 node_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8357 count[0] = local_node_cell_count[1];
8358 count[1] = patches[0].reference_cell.n_vertices();
8359 offset[0] = global_node_cell_offsets[1];
8361 cell_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8364 cell_file_dataspace = H5Dget_space(cell_dataset);
8366 status = H5Sselect_hyperslab(
8367 cell_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8372 status = H5Dwrite(node_dataset,
8374 node_memory_dataspace,
8375 node_file_dataspace,
8377 node_data_vec.data());
8379 node_data_vec.clear();
8382 data_filter.
fill_cell_data(global_node_cell_offsets[0], cell_data_vec);
8383 status = H5Dwrite(cell_dataset,
8385 cell_memory_dataspace,
8386 cell_file_dataspace,
8388 cell_data_vec.data());
8390 cell_data_vec.clear();
8393 status = H5Sclose(node_file_dataspace);
8395 status = H5Sclose(cell_file_dataspace);
8399 status = H5Sclose(node_memory_dataspace);
8401 status = H5Sclose(cell_memory_dataspace);
8405 status = H5Dclose(node_dataset);
8407 status = H5Dclose(cell_dataset);
8411 if (mesh_filename != solution_filename)
8413 status = H5Fclose(h5_mesh_file_id);
8419 if (mesh_filename == solution_filename && write_mesh_file)
8421 h5_solution_file_id = h5_mesh_file_id;
8426 h5_solution_file_id = H5Fcreate(solution_filename.c_str(),
8436 std::string vector_name;
8445 node_ds_dim[0] = global_node_cell_count[0];
8446 node_ds_dim[1] = pt_data_vector_dim;
8447 pt_data_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8450# if H5Gcreate_vers == 1
8451 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8452 vector_name.c_str(),
8457 node_dataset_id = H5Pcreate(H5P_DATASET_CREATE);
8458# ifdef DEAL_II_WITH_ZLIB
8459 H5Pset_deflate(node_dataset_id,
8461 H5Pset_chunk(node_dataset_id, 2, node_ds_dim);
8463 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8464 vector_name.c_str(),
8470 H5Pclose(node_dataset_id);
8475 count[0] = local_node_cell_count[0];
8476 count[1] = pt_data_vector_dim;
8477 offset[0] = global_node_cell_offsets[0];
8479 pt_data_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8483 pt_data_file_dataspace = H5Dget_space(pt_data_dataset);
8485 status = H5Sselect_hyperslab(pt_data_file_dataspace,
8494 status = H5Dwrite(pt_data_dataset,
8496 pt_data_memory_dataspace,
8497 pt_data_file_dataspace,
8503 status = H5Sclose(pt_data_dataspace);
8505 status = H5Sclose(pt_data_memory_dataspace);
8507 status = H5Sclose(pt_data_file_dataspace);
8510 status = H5Dclose(pt_data_dataset);
8515 status = H5Pclose(file_plist_id);
8519 status = H5Pclose(plist_id);
8523 status = H5Fclose(h5_solution_file_id);
8531template <
int dim,
int spacedim>
8535 const std::vector<std::string> &data_names,
8537 std::tuple<
unsigned int,
8541 &nonscalar_data_ranges,
8544 const unsigned int n_data_sets = data_names.size();
8546#ifndef DEAL_II_WITH_MPI
8553 Assert(patches.size() > 0, ExcNoPatches());
8555 if (patches.empty())
8559 unsigned int n_nodes;
8560 std::tie(n_nodes, std::ignore) = count_nodes_and_cells(patches);
8575 [&patches]() {
return create_global_data_table(patches); });
8583 std::move(*create_global_data_table_task.
return_value());
8587 unsigned int i, n_th_vector, data_set, pt_data_vector_dim;
8588 std::string vector_name;
8589 for (n_th_vector = 0, data_set = 0; data_set < n_data_sets;)
8592 while (n_th_vector < nonscalar_data_ranges.size() &&
8593 std::get<0>(nonscalar_data_ranges[n_th_vector]) < data_set)
8597 if (n_th_vector < nonscalar_data_ranges.size() &&
8598 std::get<0>(nonscalar_data_ranges[n_th_vector]) == data_set)
8601 pt_data_vector_dim = std::get<1>(nonscalar_data_ranges[n_th_vector]) -
8602 std::get<0>(nonscalar_data_ranges[n_th_vector]) +
8607 std::get<1>(nonscalar_data_ranges[n_th_vector]) >=
8608 std::get<0>(nonscalar_data_ranges[n_th_vector]),
8609 ExcLowerRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
8610 std::get<0>(nonscalar_data_ranges[n_th_vector])));
8612 std::get<1>(nonscalar_data_ranges[n_th_vector]) < n_data_sets,
8613 ExcIndexRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
8619 if (!std::get<2>(nonscalar_data_ranges[n_th_vector]).empty())
8621 vector_name = std::get<2>(nonscalar_data_ranges[n_th_vector]);
8626 for (i = std::get<0>(nonscalar_data_ranges[n_th_vector]);
8627 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
8629 vector_name += data_names[i] +
"__";
8631 data_names[std::get<1>(nonscalar_data_ranges[n_th_vector])];
8637 pt_data_vector_dim = 1;
8638 vector_name = data_names[data_set];
8648 data_set += pt_data_vector_dim;
8654template <
int dim,
int spacedim>
8658 const std::string &filename,
8662 get_patches(), data_filter, hdf5_flags, filename,
comm);
8667template <
int dim,
int spacedim>
8671 const bool write_mesh_file,
8672 const std::string &mesh_filename,
8673 const std::string &solution_filename,
8687template <
int dim,
int spacedim>
8693 const std::string &filename,
8697 patches, data_filter, flags,
true, filename, filename,
comm);
8702template <
int dim,
int spacedim>
8708 const bool write_mesh_file,
8709 const std::string &mesh_filename,
8710 const std::string &solution_filename,
8716 "DataOutBase was asked to write HDF5 output for a space dimension of 1. "
8717 "HDF5 only supports datasets that live in 2 or 3 dimensions."));
8719#ifndef DEAL_II_WITH_HDF5
8725 (void)write_mesh_file;
8726 (void)mesh_filename;
8727 (void)solution_filename;
8736# ifndef H5_HAVE_PARALLEL
8740 "Serial HDF5 output on multiple processes is not yet supported."));
8750 Assert((patches.size() > 0) || (n_ranks > 1), ExcNoPatches());
8757 const bool have_patches = (patches.size() > 0);
8761 const int color = (have_patches ? 1 : 0);
8762 const int ierr = MPI_Comm_split(
comm, color, key, &split_comm);
8768 do_write_hdf5<dim, spacedim>(patches,
8777 const int ierr = MPI_Comm_free(&split_comm);
8785template <
int dim,
int spacedim>
8793 output_format = default_fmt;
8795 switch (output_format)
8841 write_deal_II_intermediate(out);
8851template <
int dim,
int spacedim>
8860template <
int dim,
int spacedim>
8861template <
typename FlagType>
8867 if (
typeid(flags) ==
typeid(dx_flags))
8869 else if (
typeid(flags) ==
typeid(ucd_flags))
8871 else if (
typeid(flags) ==
typeid(povray_flags))
8873 else if (
typeid(flags) ==
typeid(eps_flags))
8875 else if (
typeid(flags) ==
typeid(gmv_flags))
8877 else if (
typeid(flags) ==
typeid(hdf5_flags))
8879 else if (
typeid(flags) ==
typeid(tecplot_flags))
8882 else if (
typeid(flags) ==
typeid(vtk_flags))
8884 else if (
typeid(flags) ==
typeid(svg_flags))
8886 else if (
typeid(flags) ==
typeid(gnuplot_flags))
8889 else if (
typeid(flags) ==
typeid(deal_II_intermediate_flags))
8890 deal_II_intermediate_flags =
8898template <
int dim,
int spacedim>
8911template <
int dim,
int spacedim>
8918 "A name for the output format to be used");
8922 "Number of subdivisions of each mesh cell");
8968template <
int dim,
int spacedim>
8972 const std::string &output_name = prm.
get(
"Output format");
8974 default_subdivisions = prm.
get_integer(
"Subdivisions");
8977 dx_flags.parse_parameters(prm);
8981 ucd_flags.parse_parameters(prm);
8985 gnuplot_flags.parse_parameters(prm);
8989 povray_flags.parse_parameters(prm);
8993 eps_flags.parse_parameters(prm);
8997 gmv_flags.parse_parameters(prm);
9001 hdf5_flags.parse_parameters(prm);
9005 tecplot_flags.parse_parameters(prm);
9009 vtk_flags.parse_parameters(prm);
9013 deal_II_intermediate_flags.parse_parameters(prm);
9019template <
int dim,
int spacedim>
9023 return (
sizeof(default_fmt) +
9039template <
int dim,
int spacedim>
9041 std::tuple<
unsigned int,
9048 std::tuple<
unsigned int,
9055template <
int dim,
int spacedim>
9063 std::set<std::string> all_names;
9066 std::tuple<
unsigned int,
9070 ranges = this->get_nonscalar_data_ranges();
9071 const std::vector<std::string> data_names = this->get_dataset_names();
9072 const unsigned int n_data_sets = data_names.size();
9073 std::vector<bool> data_set_written(n_data_sets,
false);
9075 for (
const auto &range : ranges)
9077 const std::string &name = std::get<2>(range);
9080 Assert(all_names.find(name) == all_names.end(),
9082 "Error: names of fields in DataOut need to be unique, "
9084 name +
"' is used more than once."));
9085 all_names.insert(name);
9086 for (
unsigned int i = std::get<0>(range); i <= std::get<1>(range);
9088 data_set_written[i] =
true;
9092 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
9093 if (data_set_written[data_set] ==
false)
9095 const std::string &name = data_names[data_set];
9096 Assert(all_names.find(name) == all_names.end(),
9098 "Error: names of fields in DataOut need to be unique, "
9100 name +
"' is used more than once."));
9101 all_names.insert(name);
9111template <
int dim,
int spacedim>
9119 std::vector<typename ::DataOutBase::Patch<dim, spacedim>> tmp;
9123 std::vector<std::string> tmp;
9124 tmp.swap(dataset_names);
9128 std::tuple<
unsigned int,
9133 tmp.swap(nonscalar_data_ranges);
9140 std::pair<unsigned int, unsigned int> dimension_info =
9143 (dimension_info.second == spacedim),
9144 ExcIncompatibleDimensions(
9145 dimension_info.first, dim, dimension_info.second, spacedim));
9154 getline(in, header);
9156 std::ostringstream s;
9157 s <<
"[deal.II intermediate format graphics data]";
9159 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9163 getline(in, header);
9165 std::ostringstream s;
9169 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9173 getline(in, header);
9175 std::ostringstream s;
9179 Assert(header == s.str(),
9181 "Invalid or incompatible file format. Intermediate format "
9182 "files can only be read by the same deal.II version as they "
9183 "are written by."));
9187 unsigned int n_datasets;
9189 dataset_names.resize(n_datasets);
9190 for (
unsigned int i = 0; i < n_datasets; ++i)
9191 in >> dataset_names[i];
9193 unsigned int n_patches;
9195 patches.resize(n_patches);
9196 for (
unsigned int i = 0; i < n_patches; ++i)
9199 unsigned int n_nonscalar_data_ranges;
9200 in >> n_nonscalar_data_ranges;
9201 nonscalar_data_ranges.resize(n_nonscalar_data_ranges);
9202 for (
unsigned int i = 0; i < n_nonscalar_data_ranges; ++i)
9204 in >> std::get<0>(nonscalar_data_ranges[i]) >>
9205 std::get<1>(nonscalar_data_ranges[i]);
9214 std::get<2>(nonscalar_data_ranges[i]) = name;
9222template <
int dim,
int spacedim>
9228 ParallelIntermediateHeader header;
9229 in.read(
reinterpret_cast<char *
>(&header),
sizeof(header));
9231 header.magic == 0x00dea111,
9233 "Invalid header of parallel deal.II intermediate format encountered."));
9237 "Incorrect header version of parallel deal.II intermediate format."));
9239 std::vector<std::uint64_t> chunk_sizes(header.n_ranks);
9240 in.read(
reinterpret_cast<char *
>(chunk_sizes.data()),
9241 header.n_ranks *
sizeof(std::uint64_t));
9243 for (
unsigned int n = 0; n < header.n_ranks; ++n)
9247 std::vector<char> temp_buffer(chunk_sizes[n]);
9248 in.read(temp_buffer.data(), chunk_sizes[n]);
9251 header.compression) !=
9255 boost::iostreams::filtering_istreambuf f;
9258#ifdef DEAL_II_WITH_ZLIB
9259 f.push(boost::iostreams::zlib_decompressor());
9264 "Decompression requires deal.II to be configured with ZLIB support."));
9267 boost::iostreams::basic_array_source<char> source(temp_buffer.data(),
9268 temp_buffer.size());
9271 std::stringstream datastream;
9272 boost::iostreams::copy(f, datastream);
9282 temp_reader.
read(datastream);
9290template <
int dim,
int spacedim>
9294 using Patch = typename ::DataOutBase::Patch<dim, spacedim>;
9297 const std::vector<Patch> &source_patches = source.
get_patches();
9302 ExcIncompatibleDatasetNames());
9305 Assert(get_nonscalar_data_ranges().size() ==
9307 ExcMessage(
"Both sources need to declare the same components "
9309 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
9311 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
9313 ExcMessage(
"Both sources need to declare the same components "
9315 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
9317 ExcMessage(
"Both sources need to declare the same components "
9319 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
9321 ExcMessage(
"Both sources need to declare the same components "
9326 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
9327 ExcIncompatiblePatchLists());
9328 Assert(patches[0].data.n_rows() == source_patches[0].data.n_rows(),
9329 ExcIncompatiblePatchLists());
9330 Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(),
9331 ExcIncompatiblePatchLists());
9335 const unsigned int old_n_patches = patches.size();
9336 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
9339 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
9340 patches[i].patch_index += old_n_patches;
9343 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
9345 if (patches[i].neighbors[n] !=
9347 patches[i].neighbors[n] += old_n_patches;
9352template <
int dim,
int spacedim>
9353const std::vector<typename ::DataOutBase::Patch<dim, spacedim>> &
9361template <
int dim,
int spacedim>
9362std::vector<std::string>
9365 return dataset_names;
9370template <
int dim,
int spacedim>
9372 std::tuple<
unsigned int,
9378 return nonscalar_data_ranges;
9387 , h5_sol_filename(
"")
9388 , h5_mesh_filename(
"")
9390 , num_nodes(
numbers::invalid_unsigned_int)
9391 , num_cells(
numbers::invalid_unsigned_int)
9392 , dimension(
numbers::invalid_unsigned_int)
9393 , space_dimension(
numbers::invalid_unsigned_int)
9401 const std::uint64_t nodes,
9402 const std::uint64_t cells,
9403 const unsigned int dim)
9409 const std::uint64_t nodes,
9410 const std::uint64_t cells,
9411 const unsigned int dim,
9413 :
XDMFEntry(filename, filename, time, nodes, cells, dim, dim, cell_type)
9419 const std::string &solution_filename,
9421 const std::uint64_t nodes,
9422 const std::uint64_t cells,
9423 const unsigned int dim)
9437 const std::string &solution_filename,
9439 const std::uint64_t nodes,
9440 const std::uint64_t cells,
9441 const unsigned int dim,
9456 const std::string &solution_filename,
9458 const std::uint64_t nodes,
9459 const std::uint64_t cells,
9460 const unsigned int dim,
9461 const unsigned int spacedim)
9482 const unsigned int dimension)
9508 const std::string &solution_filename,
9510 const std::uint64_t nodes,
9511 const std::uint64_t cells,
9512 const unsigned int dim,
9513 const unsigned int spacedim,
9516 , h5_sol_filename(solution_filename)
9517 , h5_mesh_filename(mesh_filename)
9522 , space_dimension(spacedim)
9523 , cell_type(cell_type_hex_if_invalid(cell_type_, dim))
9530 const unsigned int dimension)
9543 indent(
const unsigned int indent_level)
9545 std::string res =
"";
9546 for (
unsigned int i = 0; i < indent_level; ++i)
9559 (void)reference_cell;
9573 std::stringstream ss;
9575 ss << indent(indent_level + 0)
9576 <<
"<Grid Name=\"mesh\" GridType=\"Uniform\">\n";
9577 ss << indent(indent_level + 1) <<
"<Time Value=\"" <<
entry_time <<
"\"/>\n";
9578 ss << indent(indent_level + 1) <<
"<Geometry GeometryType=\""
9580 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes
9582 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9584 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9585 ss << indent(indent_level + 1) <<
"</Geometry>\n";
9590 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"";
9608 ss <<
"Quadrilateral";
9627 ss <<
"Tetrahedron";
9631 ss <<
"\" NumberOfElements=\"" <<
num_cells;
9633 ss <<
"\" NodesPerElement=\"1\">\n";
9635 ss <<
"\" NodesPerElement=\"2\">\n";
9640 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_cells
9642 <<
"\" NumberType=\"UInt\" Format=\"HDF\">\n";
9645 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9646 ss << indent(indent_level + 1) <<
"</Topology>\n";
9652 ss << indent(indent_level + 1)
9653 <<
"<Topology TopologyType=\"Polyvertex\" NumberOfElements=\""
9655 ss << indent(indent_level + 1) <<
"</Topology>\n";
9660 ss << indent(indent_level + 1) <<
"<Attribute Name=\""
9661 << attribute_dim.first <<
"\" AttributeType=\""
9662 << (attribute_dim.second > 1 ?
"Vector" :
"Scalar")
9663 <<
"\" Center=\"Node\">\n";
9665 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes
9666 <<
" " << (attribute_dim.second > 1 ? 3 : 1)
9667 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9669 << attribute_dim.first <<
'\n';
9670 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9671 ss << indent(indent_level + 1) <<
"</Attribute>\n";
9674 ss << indent(indent_level + 0) <<
"</Grid>\n";
9683 template <
int dim,
int spacedim>
9688 out <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]"
9707 out << patch.
data.n_rows() <<
' ' << patch.
data.n_cols() <<
'\n';
9708 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9709 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9710 out << patch.
data[i][j] <<
' ';
9719 template <
int dim,
int spacedim>
9731 getline(in, header);
9732 while ((header.size() != 0) && (header.back() ==
' '))
9733 header.erase(header.size() - 1);
9735 while ((header.empty()) && in);
9737 std::ostringstream s;
9738 s <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]";
9740 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9744 if constexpr (dim > 0)
9758 unsigned int n_subdivisions;
9759 in >> n_subdivisions;
9760 if constexpr (dim > 1)
9765 unsigned int n_rows, n_cols;
9766 in >> n_rows >> n_cols;
9767 patch.
data.reinit(n_rows, n_cols);
9768 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9769 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9770 in >> patch.
data[i][j];
9781#include "data_out_base.inst"
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
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
Map3DPoint existing_points
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
void parse_parameters(ParameterHandler &prm)
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)
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
std::size_t memory_consumption() const
void set_default_format(const DataOutBase::OutputFormat default_format)
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
void write_gnuplot(std::ostream &out) const
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
void validate_dataset_names() const
void set_flags(const FlagType &flags)
void write_vtk(std::ostream &out) const
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
void write_eps(std::ostream &out) const
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)
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
void enter_subsection(const std::string &subsection, const bool create_path_if_needed=true)
long int get_integer(const std::string &entry_string) const
bool get_bool(const std::string &entry_name) const
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation="", const bool has_to_be_set=false)
std::string get(const std::string &entry_string) const
double get_double(const std::string &entry_name) const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices() const
unsigned int n_vertices() const
bool is_hyper_cube() const
unsigned int vtk_linear_type() const
unsigned int vtk_vertex_to_deal_vertex(const unsigned int vertex_index) const
unsigned int vtk_quadratic_type() const
unsigned int vtk_lagrange_type() const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices() const
static constexpr TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
std::vector< RT > return_values()
internal::return_value< RT >::reference_type return_value()
std::string h5_sol_filename
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::map< std::string, unsigned int > attribute_dims
unsigned int space_dimension
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_PACKAGE_VERSION
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_FALLTHROUGH
#define DEAL_II_PACKAGE_NAME
Point< 2 > projected_vertices[4]
Point< 2 > projected_center
static ::ExceptionBase & ExcNonMatchingReferenceCellTypes(ReferenceCell arg1, ReferenceCell arg2)
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcFileNotOpen(std::string arg1)
static ::ExceptionBase & ExcNotEnoughSpaceDimensionLabels()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcNoPatches()
#define DeclException2(Exception2, type1, type2, outsequence)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcLowerRange(int arg1, int arg2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNeedsHDF5()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
Task< RT > new_task(const std::function< RT()> &function)
#define DEAL_II_ASSERT_UNREACHABLE()
#define DEAL_II_NOT_IMPLEMENTED()
DataComponentInterpretation
@ component_is_part_of_tensor
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_nodes(const std::vector< Patch< dim, spacedim > > &patches, StreamType &out)
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_data(const std::vector< Patch< dim, spacedim > > &patches, unsigned int n_data_sets, const bool double_precision, StreamType &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 > > ×_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_cells(const std::vector< Patch< dim, spacedim > > &patches, StreamType &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)
std::vector< Point< spacedim > > get_node_positions(const std::vector< Patch< dim, spacedim > > &patches)
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)
void write_high_order_cells(const std::vector< Patch< dim, spacedim > > &patches, StreamType &out, const bool legacy_format)
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)
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
constexpr const ReferenceCell Tetrahedron
constexpr const ReferenceCell Quadrilateral
constexpr const ReferenceCell Wedge
constexpr const ReferenceCell Pyramid
constexpr const ReferenceCell Invalid
constexpr const ReferenceCell Triangle
constexpr const ReferenceCell Hexahedron
constexpr const ReferenceCell & get_hypercube()
constexpr const ReferenceCell Vertex
constexpr const ReferenceCell Line
constexpr const ReferenceCell & get_simplex()
int File_write_at_c(MPI_File fh, MPI_Offset offset, const void *buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status)
int File_write_at_all_c(MPI_File fh, MPI_Offset offset, const void *buf, MPI_Count count, MPI_Datatype datatype, MPI_Status *status)
T sum(const T &t, const MPI_Comm mpi_communicator)
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
void free_communicator(MPI_Comm mpi_communicator)
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
std::string encode_base64(const std::vector< unsigned char > &binary_input)
constexpr T fixed_power(const T t)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
unsigned int needed_digits(const unsigned int max_number)
constexpr T pow(const T base, const int iexp)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
static constexpr double PI
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
*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)
void parse_parameters(const ParameterHandler &prm)
bool filter_duplicate_vertices
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
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)
static void declare_parameters(ParameterHandler &prm)
static const unsigned int n_subdivisions
static const ReferenceCell reference_cell
std::size_t memory_consumption() const
ReferenceCell reference_cell
static const unsigned int no_neighbor
bool operator==(const Patch &patch) const
void swap(Patch< dim, spacedim > &other_patch) noexcept
unsigned int n_subdivisions
std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > vertices
bool points_are_available
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)
unsigned int height_vector
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
bool write_higher_order_cells
DataOutBase::CompressionLevel compression_level
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices()
bool operator<(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)