41#ifdef DEAL_II_WITH_ZLIB
45#ifdef DEAL_II_WITH_HDF5
49#include <boost/iostreams/copy.hpp>
50#include <boost/iostreams/device/back_inserter.hpp>
51#include <boost/iostreams/filtering_stream.hpp>
52#ifdef DEAL_II_WITH_ZLIB
53# include <boost/iostreams/filter/zlib.hpp>
68 <<
"Unexpected input: expected line\n <" << arg1
69 <<
">\nbut got\n <" << arg2 <<
">");
71# ifdef DEAL_II_WITH_ZLIB
72 constexpr bool deal_ii_with_zlib =
true;
74 constexpr bool deal_ii_with_zlib =
false;
78# ifdef DEAL_II_WITH_ZLIB
89 return Z_NO_COMPRESSION;
93 return Z_BEST_COMPRESSION;
95 return Z_DEFAULT_COMPRESSION;
98 return Z_NO_COMPRESSION;
102# ifdef DEAL_II_WITH_MPI
113 return boost::iostreams::zlib::no_compression;
115 return boost::iostreams::zlib::best_speed;
117 return boost::iostreams::zlib::best_compression;
119 return boost::iostreams::zlib::default_compression;
122 return boost::iostreams::zlib::no_compression;
132 template <
typename T>
134 compress_array(
const std::vector<T> &
data,
137# ifdef DEAL_II_WITH_ZLIB
138 if (
data.size() != 0)
140 const std::size_t uncompressed_size = (
data.size() *
sizeof(
T));
148 std::numeric_limits<std::uint32_t>::max(),
152 auto compressed_data_length = compressBound(uncompressed_size);
154 std::numeric_limits<std::uint32_t>::max(),
157 std::vector<unsigned char> compressed_data(compressed_data_length);
159 int err = compress2(&compressed_data[0],
160 &compressed_data_length,
161 reinterpret_cast<const Bytef *
>(
data.data()),
163 get_zlib_compression_level(compression_level));
168 compressed_data.resize(compressed_data_length);
171 const std::uint32_t compression_header[4] = {
173 static_cast<std::uint32_t
>(uncompressed_size),
174 static_cast<std::uint32_t
>(
176 static_cast<std::uint32_t
>(
177 compressed_data_length)};
179 const auto *
const header_start =
180 reinterpret_cast<const unsigned char *
>(&compression_header[0]);
183 {header_start, header_start + 4 *
sizeof(std::uint32_t)}) +
190 (void)compression_level;
192 ExcMessage(
"This function can only be called if cmake found "
193 "a working libz installation."));
208 template <
typename T>
210 vtu_stringize_array(
const std::vector<T> &
data,
214 if (deal_ii_with_zlib &&
218 return compress_array(
data, compression_level);
222 std::ostringstream stream;
223 stream.precision(precision);
224 for (
const T &el :
data)
239 struct ParallelIntermediateHeader
242 std::uint64_t version;
243 std::uint64_t compression;
244 std::uint64_t dimension;
245 std::uint64_t space_dimension;
246 std::uint64_t n_ranks;
247 std::uint64_t n_patches;
297 SvgCell::operator<(
const SvgCell &e)
const
300 return depth >
e.depth;
338 EpsCell2d::operator<(
const EpsCell2d &e)
const
341 return depth >
e.depth;
357 template <
int dim,
int spacedim,
typename Number =
double>
358 std::unique_ptr<Table<2, Number>>
363 return std::make_unique<Table<2, Number>>();
372 const unsigned int n_data_sets = patches[0].points_are_available ?
373 (patches[0].data.n_rows() - spacedim) :
375 const unsigned int n_data_points =
376 std::accumulate(patches.begin(),
379 [](
const unsigned int count,
381 return count + patch.data.n_cols();
384 std::unique_ptr<Table<2, Number>> global_data_table =
385 std::make_unique<Table<2, Number>>(n_data_sets, n_data_points);
388 unsigned int next_value = 0;
389 for (
const auto &patch : patches)
391 const unsigned int n_subdivisions = patch.n_subdivisions;
392 (void)n_subdivisions;
394 Assert((patch.data.n_rows() == n_data_sets &&
395 !patch.points_are_available) ||
396 (patch.data.n_rows() == n_data_sets + spacedim &&
397 patch.points_are_available),
399 (n_data_sets + spacedim) :
401 patch.
data.n_rows()));
402 Assert(patch.reference_cell != ReferenceCells::get_hypercube<dim>() ||
403 (n_data_sets == 0) ||
404 (patch.data.n_cols() ==
405 Utilities::fixed_power<dim>(n_subdivisions + 1)),
407 n_subdivisions + 1));
409 for (
unsigned int i = 0; i < patch.data.n_cols(); ++i, ++next_value)
410 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
411 (*global_data_table)[data_set][next_value] =
412 patch.data(data_set, i);
416 return global_data_table;
426 , node_dim(
numbers::invalid_unsigned_int)
434 , node_dim(
numbers::invalid_unsigned_int)
447 for (
unsigned int d = 0; d < dim; ++d)
451 unsigned int internal_ind;
462 internal_ind = it->second;
472 const unsigned int pt_index)
490 for (
unsigned int d = 0; d <
node_dim; ++d)
491 node_data[
node_dim * existing_point.second + d] =
492 existing_point.first[d];
500 std::vector<unsigned int> &cell_data)
const
506 cell_data[filtered_cell.first] =
507 filtered_cell.second + local_node_offset;
576 const unsigned int start,
577 const std::array<unsigned int, dim> &offsets)
581 const unsigned int base_entry =
594 const unsigned int d1 = offsets[0];
603 const unsigned int d1 = offsets[0];
604 const unsigned int d2 = offsets[1];
615 const unsigned int d1 = offsets[0];
616 const unsigned int d2 = offsets[1];
617 const unsigned int d3 = offsets[2];
639 const unsigned int start,
640 const unsigned int n_points,
645 const unsigned int base_entry = index * n_points;
647 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
649 for (
unsigned int i = 0; i < n_points; ++i)
660 const unsigned int dimension,
661 const unsigned int set_num,
664 unsigned int new_dim;
683 for (
unsigned int d = 0; d < new_dim; ++d)
686 data_sets.back()[r * new_dim + d] = data_vectors(set_num + d, i);
702 const char *gmv_cell_type[4] = {
"",
"line 2",
"quad 4",
"hex 8"};
704 const char *ucd_cell_type[4] = {
"pt",
"line",
"quad",
"hex"};
706 const char *tecplot_cell_type[4] = {
"",
"lineseg",
"quadrilateral",
"brick"};
721 template <
int dim,
int spacedim>
722 std::array<unsigned int, 3>
724 const bool write_higher_order_cells)
726 std::array<unsigned int, 3> vtk_cell_id = {
732 if (write_higher_order_cells)
735 vtk_cell_id[2] = patch.
data.n_cols();
741 patch.
data.n_cols() == 6)
745 vtk_cell_id[2] = patch.
data.n_cols();
748 patch.
data.n_cols() == 10)
752 vtk_cell_id[2] = patch.
data.n_cols();
763 vtk_cell_id[2] = patch.
data.n_cols();
782 template <
int dim,
int spacedim>
784 get_equispaced_location(
786 const std::initializer_list<unsigned int> &lattice_location,
787 const unsigned int n_subdivisions)
794 const unsigned int xstep = (dim > 0 ? *(lattice_location.begin() + 0) : 0);
795 const unsigned int ystep = (dim > 1 ? *(lattice_location.begin() + 1) : 0);
796 const unsigned int zstep = (dim > 2 ? *(lattice_location.begin() + 2) : 0);
804 unsigned int point_no = 0;
809 point_no += (n_subdivisions + 1) * (n_subdivisions + 1) * zstep;
813 point_no += (n_subdivisions + 1) * ystep;
827 for (
unsigned int d = 0;
d < spacedim; ++
d)
828 node[d] = patch.
data(patch.
data.size(0) - spacedim + d, point_no);
835 if constexpr (dim == 0)
840 const double stepsize = 1. / n_subdivisions;
841 const double xfrac = xstep * stepsize;
847 const double yfrac = ystep * stepsize;
849 node += ((patch.
vertices[3] * xfrac) +
850 (patch.
vertices[2] * (1 - xfrac))) *
854 const double zfrac = zstep * stepsize;
856 node += (((patch.
vertices[5] * xfrac) +
857 (patch.
vertices[4] * (1 - xfrac))) *
860 (patch.
vertices[6] * (1 - xfrac))) *
873 template <
int dim,
int spacedim>
876 const unsigned int node_index)
881 unsigned int point_no_actual = node_index;
886 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
887 point_no_actual = table[node_index];
895 for (
unsigned int d = 0;
d < spacedim; ++
d)
897 patch.
data(patch.
data.size(0) - spacedim + d, point_no_actual);
910 return patch.
vertices[point_no_actual];
921 template <
int dim,
int spacedim>
922 std::tuple<unsigned int, unsigned int>
923 count_nodes_and_cells(
926 unsigned int n_nodes = 0;
928 for (
const auto &patch : patches)
932 "The reference cell for this patch is set to 'Invalid', "
933 "but that is clearly not a valid choice. Did you forget "
934 "to set the reference cell for the patch?"));
949 return std::make_tuple(n_nodes, n_cells);
959 template <
int dim,
int spacedim>
960 std::tuple<unsigned int, unsigned int, unsigned int>
961 count_nodes_and_cells_and_points(
963 const bool write_higher_order_cells)
965 unsigned int n_nodes = 0;
967 unsigned int n_points_and_n_cells = 0;
969 for (
const auto &patch : patches)
975 if (write_higher_order_cells)
981 n_points_and_n_cells +=
990 const unsigned int n_subcells =
993 n_points_and_n_cells +=
999 n_nodes += patch.
data.n_cols();
1001 n_points_and_n_cells += patch.
data.n_cols() + 1;
1005 return std::make_tuple(n_nodes, n_cells, n_points_and_n_cells);
1013 template <
typename FlagsType>
1020 StreamBase(std::ostream &stream,
const FlagsType &flags)
1032 write_point(
const unsigned int,
const Point<dim> &)
1035 ExcMessage(
"The derived class you are using needs to "
1036 "reimplement this function if you want to call "
1056 write_cell(
const unsigned int ,
1057 const unsigned int ,
1058 std::array<unsigned int, dim> & )
1061 ExcMessage(
"The derived class you are using needs to "
1062 "reimplement this function if you want to call "
1073 write_cell_single(
const unsigned int index,
1074 const unsigned int start,
1075 const unsigned int n_points,
1081 (void)reference_cell;
1084 ExcMessage(
"The derived class you are using needs to "
1085 "reimplement this function if you want to call "
1103 template <
typename T>
1117 unsigned int selected_component;
1124 std::ostream &stream;
1129 const FlagsType flags;
1135 class DXStream :
public StreamBase<DataOutBase::DXFlags>
1142 write_point(
const unsigned int index,
const Point<dim> &);
1154 write_cell(
const unsigned int index,
1155 const unsigned int start,
1156 const std::array<unsigned int, dim> &offsets);
1164 template <
typename data>
1166 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1172 class GmvStream :
public StreamBase<DataOutBase::GmvFlags>
1179 write_point(
const unsigned int index,
const Point<dim> &);
1191 write_cell(
const unsigned int index,
1192 const unsigned int start,
1193 const std::array<unsigned int, dim> &offsets);
1199 class TecplotStream :
public StreamBase<DataOutBase::TecplotFlags>
1206 write_point(
const unsigned int index,
const Point<dim> &);
1218 write_cell(
const unsigned int index,
1219 const unsigned int start,
1220 const std::array<unsigned int, dim> &offsets);
1226 class UcdStream :
public StreamBase<DataOutBase::UcdFlags>
1233 write_point(
const unsigned int index,
const Point<dim> &);
1247 write_cell(
const unsigned int index,
1248 const unsigned int start,
1249 const std::array<unsigned int, dim> &offsets);
1257 template <
typename data>
1259 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1265 class VtkStream :
public StreamBase<DataOutBase::VtkFlags>
1272 write_point(
const unsigned int index,
const Point<dim> &);
1284 write_cell(
const unsigned int index,
1285 const unsigned int start,
1286 const std::array<unsigned int, dim> &offsets);
1292 write_cell_single(
const unsigned int index,
1293 const unsigned int start,
1294 const unsigned int n_points,
1306 write_high_order_cell(
const unsigned int start,
1307 const std::vector<unsigned> &connectivity);
1320 DXStream::write_point(
const unsigned int,
const Point<dim> &p)
1322 if (flags.coordinates_binary)
1325 for (
unsigned int d = 0;
d < dim; ++
d)
1327 stream.write(
reinterpret_cast<const char *
>(
data), dim *
sizeof(*
data));
1331 for (
unsigned int d = 0;
d < dim; ++
d)
1332 stream << p[d] <<
'\t';
1346 std::array<unsigned int, GeometryInfo<0>::vertices_per_cell>
1347 set_node_numbers(
const unsigned int ,
1348 const std::array<unsigned int, 0> & )
1356 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell>
1357 set_node_numbers(
const unsigned int start,
1358 const std::array<unsigned int, 1> &offsets)
1360 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell> nodes;
1362 nodes[1] = start + offsets[0];
1368 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell>
1369 set_node_numbers(
const unsigned int start,
1370 const std::array<unsigned int, 2> &offsets)
1373 const unsigned int d1 = offsets[0];
1374 const unsigned int d2 = offsets[1];
1376 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell> nodes;
1378 nodes[1] = start + d1;
1379 nodes[2] = start + d2;
1380 nodes[3] = start + d2 + d1;
1386 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell>
1387 set_node_numbers(
const unsigned int start,
1388 const std::array<unsigned int, 3> &offsets)
1390 const unsigned int d1 = offsets[0];
1391 const unsigned int d2 = offsets[1];
1392 const unsigned int d3 = offsets[2];
1394 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell> nodes;
1396 nodes[1] = start + d1;
1397 nodes[2] = start + d2;
1398 nodes[3] = start + d2 + d1;
1399 nodes[4] = start + d3;
1400 nodes[5] = start + d3 + d1;
1401 nodes[6] = start + d3 + d2;
1402 nodes[7] = start + d3 + d2 + d1;
1411 DXStream::write_cell(
const unsigned int,
1412 const unsigned int start,
1413 const std::array<unsigned int, dim> &offsets)
1416 DataOutBaseImplementation::set_node_numbers(start, offsets);
1418 if (flags.int_binary)
1420 std::array<unsigned int, GeometryInfo<dim>::vertices_per_cell> temp;
1421 for (
unsigned int i = 0; i < nodes.size(); ++i)
1423 stream.write(
reinterpret_cast<const char *
>(temp.data()),
1424 temp.size() *
sizeof(temp[0]));
1428 for (
unsigned int i = 0; i < nodes.size() - 1; ++i)
1430 stream << nodes[GeometryInfo<dim>::dx_to_deal[nodes.size() - 1]]
1437 template <
typename data>
1439 DXStream::write_dataset(
const unsigned int,
const std::vector<data> &values)
1441 if (flags.data_binary)
1443 stream.write(
reinterpret_cast<const char *
>(
values.data()),
1448 for (
unsigned int i = 0; i <
values.size(); ++i)
1449 stream <<
'\t' << values[i];
1465 GmvStream::write_point(
const unsigned int,
const Point<dim> &p)
1469 stream << p[selected_component] <<
' ';
1476 GmvStream::write_cell(
const unsigned int,
1477 const unsigned int s,
1478 const std::array<unsigned int, dim> &offsets)
1481 const unsigned int start = s + 1;
1482 stream << gmv_cell_type[dim] <<
'\n';
1494 const unsigned int d1 = offsets[0];
1496 stream <<
'\t' << start + d1;
1502 const unsigned int d1 = offsets[0];
1503 const unsigned int d2 = offsets[1];
1505 stream <<
'\t' << start + d1;
1506 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1512 const unsigned int d1 = offsets[0];
1513 const unsigned int d2 = offsets[1];
1514 const unsigned int d3 = offsets[2];
1516 stream <<
'\t' << start + d1;
1517 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1518 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1519 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1531 TecplotStream::TecplotStream(std::ostream &out,
1539 TecplotStream::write_point(
const unsigned int,
const Point<dim> &p)
1543 stream << p[selected_component] <<
'\n';
1550 TecplotStream::write_cell(
const unsigned int,
1551 const unsigned int s,
1552 const std::array<unsigned int, dim> &offsets)
1554 const unsigned int start = s + 1;
1566 const unsigned int d1 = offsets[0];
1568 stream <<
'\t' << start + d1;
1574 const unsigned int d1 = offsets[0];
1575 const unsigned int d2 = offsets[1];
1577 stream <<
'\t' << start + d1;
1578 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1584 const unsigned int d1 = offsets[0];
1585 const unsigned int d2 = offsets[1];
1586 const unsigned int d3 = offsets[2];
1588 stream <<
'\t' << start + d1;
1589 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1590 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1591 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1610 UcdStream::write_point(
const unsigned int index,
const Point<dim> &p)
1612 stream <<
index + 1 <<
" ";
1614 for (
unsigned int i = 0; i < dim; ++i)
1615 stream << p[i] <<
' ';
1617 for (
unsigned int i = dim; i < 3; ++i)
1626 UcdStream::write_cell(
const unsigned int index,
1627 const unsigned int start,
1628 const std::array<unsigned int, dim> &offsets)
1631 DataOutBaseImplementation::set_node_numbers(start, offsets);
1634 stream <<
index + 1 <<
"\t0 " << ucd_cell_type[dim];
1635 for (
unsigned int i = 0; i < nodes.size(); ++i)
1642 template <
typename data>
1644 UcdStream::write_dataset(
const unsigned int index,
1645 const std::vector<data> &values)
1647 stream <<
index + 1;
1648 for (
unsigned int i = 0; i <
values.size(); ++i)
1649 stream <<
'\t' << values[i];
1664 VtkStream::write_point(
const unsigned int,
const Point<dim> &p)
1669 for (
unsigned int i = dim; i < 3; ++i)
1678 VtkStream::write_cell(
const unsigned int,
1679 const unsigned int start,
1680 const std::array<unsigned int, dim> &offsets)
1682 stream << GeometryInfo<dim>::vertices_per_cell <<
'\t';
1694 const unsigned int d1 = offsets[0];
1696 stream <<
'\t' << start + d1;
1702 const unsigned int d1 = offsets[0];
1703 const unsigned int d2 = offsets[1];
1705 stream <<
'\t' << start + d1;
1706 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1712 const unsigned int d1 = offsets[0];
1713 const unsigned int d2 = offsets[1];
1714 const unsigned int d3 = offsets[2];
1716 stream <<
'\t' << start + d1;
1717 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1718 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1719 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1732 VtkStream::write_cell_single(
const unsigned int index,
1733 const unsigned int start,
1734 const unsigned int n_points,
1739 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
1741 stream <<
'\t' << n_points;
1742 for (
unsigned int i = 0; i < n_points; ++i)
1751 VtkStream::write_high_order_cell(
const unsigned int start,
1752 const std::vector<unsigned> &connectivity)
1754 stream << connectivity.size();
1755 for (
const auto &c : connectivity)
1756 stream <<
'\t' << start + c;
1768 template <
int dim,
int spacedim>
1772 template <
int dim,
int spacedim>
1776 template <
int dim,
int spacedim>
1778 : patch_index(no_neighbor)
1780 , points_are_available(false)
1794 template <
int dim,
int spacedim>
1802 const double epsilon = 3e-16;
1804 if (vertices[i].distance(patch.
vertices[i]) > epsilon)
1820 if (
data.n_rows() != patch.
data.n_rows())
1823 if (
data.n_cols() != patch.
data.n_cols())
1826 for (
unsigned int i = 0; i <
data.n_rows(); ++i)
1827 for (
unsigned int j = 0; j <
data.n_cols(); ++j)
1828 if (
data[i][j] != patch.
data[i][j])
1836 template <
int dim,
int spacedim>
1840 return (
sizeof(vertices) /
sizeof(vertices[0]) *
1842 sizeof(neighbors) /
sizeof(neighbors[0]) *
1848 sizeof(reference_cell));
1853 template <
int dim,
int spacedim>
1857 std::swap(vertices, other_patch.vertices);
1858 std::swap(neighbors, other_patch.neighbors);
1859 std::swap(patch_index, other_patch.patch_index);
1860 std::swap(n_subdivisions, other_patch.n_subdivisions);
1861 data.swap(other_patch.data);
1862 std::swap(points_are_available, other_patch.points_are_available);
1863 std::swap(reference_cell, other_patch.reference_cell);
1868 template <
int spacedim>
1872 template <
int spacedim>
1876 template <
int spacedim>
1880 template <
int spacedim>
1883 template <
int spacedim>
1887 template <
int spacedim>
1889 : patch_index(no_neighbor)
1890 , points_are_available(false)
1897 template <
int spacedim>
1901 const unsigned int dim = 0;
1904 const double epsilon = 3e-16;
1906 if (vertices[i].distance(patch.
vertices[i]) > epsilon)
1915 if (
data.n_rows() != patch.
data.n_rows())
1918 if (
data.n_cols() != patch.
data.n_cols())
1921 for (
unsigned int i = 0; i <
data.n_rows(); ++i)
1922 for (
unsigned int j = 0; j <
data.n_cols(); ++j)
1923 if (
data[i][j] != patch.
data[i][j])
1931 template <
int spacedim>
1935 return (
sizeof(vertices) /
sizeof(vertices[0]) *
1943 template <
int spacedim>
1947 std::swap(vertices, other_patch.vertices);
1948 std::swap(patch_index, other_patch.patch_index);
1949 data.swap(other_patch.data);
1950 std::swap(points_are_available, other_patch.points_are_available);
1956 : write_preamble(write_preamble)
1971 : space_dimension_labels(labels)
1985 const bool bicubic_patch,
1986 const bool external_data)
1988 , bicubic_patch(bicubic_patch)
1989 , external_data(external_data)
1994 const bool xdmf_hdf5_output)
1995 : filter_duplicate_vertices(filter_duplicate_vertices)
1996 , xdmf_hdf5_output(xdmf_hdf5_output)
2004 "Filter duplicate vertices",
2007 "Whether to remove duplicate vertex values. deal.II duplicates "
2008 "vertices once for each adjacent cell so that it can output "
2009 "discontinuous quantities for which there may be more than one "
2010 "value for each vertex position. Setting this flag to "
2011 "'true' will merge all of these values by selecting a "
2012 "random one and outputting this as 'the' value for the vertex. "
2013 "As long as the data to be output corresponds to continuous "
2014 "fields, merging vertices has no effect. On the other hand, "
2015 "if the data to be output corresponds to discontinuous fields "
2016 "(either because you are using a discontinuous finite element, "
2017 "or because you are using a DataPostprocessor that yields "
2018 "discontinuous data, or because the data to be output has been "
2019 "produced by entirely different means), then the data in the "
2020 "output file no longer faithfully represents the underlying data "
2021 "because the discontinuous field has been replaced by a "
2022 "continuous one. Note also that the filtering can not occur "
2023 "on processor boundaries. Thus, a filtered discontinuous field "
2024 "looks like a continuous field inside of a subdomain, "
2025 "but like a discontinuous field at the subdomain boundary."
2027 "In any case, filtering results in drastically smaller output "
2028 "files (smaller by about a factor of 2^dim).");
2033 "Whether the data will be used in an XDMF/HDF5 combination.");
2048 const bool int_binary,
2049 const bool coordinates_binary,
2050 const bool data_binary)
2051 : write_neighbors(write_neighbors)
2052 , int_binary(int_binary)
2053 , coordinates_binary(coordinates_binary)
2054 , data_binary(data_binary)
2055 , data_double(false)
2065 "A boolean field indicating whether neighborship "
2066 "information between cells is to be written to the "
2067 "OpenDX output file");
2071 "Output format of integer numbers, which is "
2072 "either a text representation (ascii) or binary integer "
2073 "values of 32 or 64 bits length");
2077 "Output format of vertex coordinates, which is "
2078 "either a text representation (ascii) or binary "
2079 "floating point values of 32 or 64 bits length");
2083 "Output format of data values, which is "
2084 "either a text representation (ascii) or binary "
2085 "floating point values of 32 or 64 bits length");
2105 "A flag indicating whether a comment should be "
2106 "written to the beginning of the output file "
2107 "indicating date and time of creation as well "
2108 "as the creating program");
2122 const int azimuth_angle,
2123 const int polar_angle,
2124 const unsigned int line_thickness,
2126 const bool draw_colorbar)
2129 , height_vector(height_vector)
2130 , azimuth_angle(azimuth_angle)
2131 , polar_angle(polar_angle)
2132 , line_thickness(line_thickness)
2134 , draw_colorbar(draw_colorbar)
2145 "A flag indicating whether POVRAY should use smoothed "
2146 "triangles instead of the usual ones");
2150 "Whether POVRAY should use bicubic patches");
2154 "Whether camera and lighting information should "
2155 "be put into an external file \"data.inc\" or into "
2156 "the POVRAY input file");
2172 const unsigned int color_vector,
2174 const unsigned int size,
2175 const double line_width,
2176 const double azimut_angle,
2177 const double turn_angle,
2178 const double z_scaling,
2179 const bool draw_mesh,
2180 const bool draw_cells,
2181 const bool shade_cells,
2183 : height_vector(height_vector)
2184 , color_vector(color_vector)
2185 , size_type(size_type)
2187 , line_width(line_width)
2188 , azimut_angle(azimut_angle)
2189 , turn_angle(turn_angle)
2190 , z_scaling(z_scaling)
2191 , draw_mesh(draw_mesh)
2192 , draw_cells(draw_cells)
2193 , shade_cells(shade_cells)
2194 , color_function(color_function)
2233 double sum = xmax + xmin;
2234 double sum13 = xmin + 3 * xmax;
2235 double sum22 = 2 * xmin + 2 * xmax;
2236 double sum31 = 3 * xmin + xmax;
2237 double dif = xmax - xmin;
2238 double rezdif = 1.0 / dif;
2242 if (x < (sum31) / 4)
2244 else if (x < (sum22) / 4)
2246 else if (x < (sum13) / 4)
2257 rgb_values.
green = 0;
2258 rgb_values.
blue = (x - xmin) * 4. * rezdif;
2262 rgb_values.
green = (4 * x - 3 * xmin - xmax) * rezdif;
2263 rgb_values.
blue = (sum22 - 4. * x) * rezdif;
2266 rgb_values.
red = (4 * x - 2 * sum) * rezdif;
2267 rgb_values.
green = (xmin + 3 * xmax - 4 * x) * rezdif;
2268 rgb_values.
blue = 0;
2272 rgb_values.
green = (4 * x - xmin - 3 * xmax) * rezdif;
2273 rgb_values.
blue = (4. * x - sum13) * rezdif;
2280 rgb_values.
red = rgb_values.
green = rgb_values.
blue = 1;
2294 (x - xmin) / (xmax - xmin);
2307 1 - (x - xmin) / (xmax - xmin);
2319 "Number of the input vector that is to be used to "
2320 "generate height information");
2324 "Number of the input vector that is to be used to "
2325 "generate color information");
2329 "Whether width or height should be scaled to match "
2334 "The size (width or height) to which the eps output "
2335 "file is to be scaled");
2339 "The width in which the postscript renderer is to "
2344 "Angle of the viewing position against the vertical "
2349 "Angle of the viewing direction against the y-axis");
2353 "Scaling for the z-direction relative to the scaling "
2354 "used in x- and y-directions");
2358 "Whether the mesh lines, or only the surface should be "
2363 "Whether only the mesh lines, or also the interior of "
2364 "cells should be plotted. If this flag is false, then "
2365 "one can see through the mesh");
2369 "Whether the interior of cells shall be shaded");
2373 "default|grey scale|reverse grey scale"),
2374 "Name of a color function used to colorize mesh lines "
2375 "and/or cell interiors");
2385 if (prm.
get(
"Scale to width or height") ==
"width")
2397 if (prm.
get(
"Color function") ==
"default")
2399 else if (prm.
get(
"Color function") ==
"grey scale")
2401 else if (prm.
get(
"Color function") ==
"reverse grey scale")
2411 : compression_level(compression_level)
2416 : zone_name(zone_name)
2417 , solution_time(solution_time)
2431 const unsigned int cycle,
2432 const bool print_date_and_time,
2434 const bool write_higher_order_cells,
2435 const std::map<std::string, std::string> &physical_units)
2438 , print_date_and_time(print_date_and_time)
2439 , compression_level(compression_level)
2440 , write_higher_order_cells(write_higher_order_cells)
2441 , physical_units(physical_units)
2449 if (format_name ==
"none")
2452 if (format_name ==
"dx")
2455 if (format_name ==
"ucd")
2458 if (format_name ==
"gnuplot")
2461 if (format_name ==
"povray")
2464 if (format_name ==
"eps")
2467 if (format_name ==
"gmv")
2470 if (format_name ==
"tecplot")
2473 if (format_name ==
"vtk")
2476 if (format_name ==
"vtu")
2479 if (format_name ==
"deal.II intermediate")
2482 if (format_name ==
"hdf5")
2486 ExcMessage(
"The given file format name is not recognized: <" +
2487 format_name +
">"));
2498 return "none|dx|ucd|gnuplot|povray|eps|gmv|tecplot|vtk|vtu|hdf5|svg|deal.II intermediate";
2506 switch (output_format)
2548 template <
int dim,
int spacedim>
2549 std::vector<Point<spacedim>>
2553 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
2555 std::vector<Point<spacedim>> node_positions;
2556 for (
const auto &patch : patches)
2559 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2561 for (
unsigned int point_no = 0; point_no < patch.
data.n_cols();
2563 node_positions.emplace_back(get_node_location(
2572 const unsigned int n = n_subdivisions + 1;
2577 node_positions.emplace_back(
2578 get_equispaced_location(patch, {}, n_subdivisions));
2581 for (
unsigned int i1 = 0; i1 < n; ++i1)
2582 node_positions.emplace_back(
2583 get_equispaced_location(patch, {i1}, n_subdivisions));
2586 for (
unsigned int i2 = 0; i2 < n; ++i2)
2587 for (
unsigned int i1 = 0; i1 < n; ++i1)
2588 node_positions.emplace_back(get_equispaced_location(
2589 patch, {i1, i2}, n_subdivisions));
2592 for (
unsigned int i3 = 0; i3 < n; ++i3)
2593 for (
unsigned int i2 = 0; i2 < n; ++i2)
2594 for (
unsigned int i1 = 0; i1 < n; ++i1)
2595 node_positions.emplace_back(get_equispaced_location(
2596 patch, {i1, i2, i3}, n_subdivisions));
2605 return node_positions;
2609 template <
int dim,
int spacedim,
typename StreamType>
2615 const std::vector<Point<spacedim>> node_positions =
2619 for (
const auto &node : node_positions)
2620 out.write_point(count++, node);
2626 template <
int dim,
int spacedim,
typename StreamType>
2631 unsigned int count = 0;
2632 unsigned int first_vertex_of_patch = 0;
2633 for (
const auto &patch : patches)
2636 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2638 out.write_cell_single(count++,
2639 first_vertex_of_patch,
2640 patch.
data.n_cols(),
2642 first_vertex_of_patch += patch.
data.n_cols();
2647 const unsigned int n = n_subdivisions + 1;
2653 const unsigned int offset = first_vertex_of_patch;
2654 out.template write_cell<0>(count++, offset, {});
2660 constexpr unsigned int d1 = 1;
2662 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2664 const unsigned int offset =
2665 first_vertex_of_patch + i1 * d1;
2666 out.template write_cell<1>(count++, offset, {{d1}});
2674 constexpr unsigned int d1 = 1;
2675 const unsigned int d2 = n;
2677 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2678 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2680 const unsigned int offset =
2681 first_vertex_of_patch + i2 * d2 + i1 * d1;
2682 out.template write_cell<2>(count++,
2692 constexpr unsigned int d1 = 1;
2693 const unsigned int d2 = n;
2694 const unsigned int d3 = n * n;
2696 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
2697 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2698 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2700 const unsigned int offset = first_vertex_of_patch +
2703 out.template write_cell<3>(count++,
2715 first_vertex_of_patch +=
2716 Utilities::fixed_power<dim>(n_subdivisions + 1);
2725 template <
int dim,
int spacedim,
typename StreamType>
2729 const bool legacy_format)
2732 unsigned int first_vertex_of_patch = 0;
2734 std::vector<unsigned> connectivity;
2736 for (
const auto &patch : patches)
2738 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2740 connectivity.resize(patch.
data.n_cols());
2742 for (
unsigned int i = 0; i < patch.
data.n_cols(); ++i)
2743 connectivity[i] = i;
2745 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2748 first_vertex_of_patch += patch.
data.n_cols();
2753 const unsigned int n = n_subdivisions + 1;
2755 connectivity.resize(Utilities::fixed_power<dim>(n));
2762 ExcMessage(
"Point-like cells should not be possible "
2763 "when writing higher-order cells."));
2768 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2770 const unsigned int local_index = i1;
2771 const unsigned int connectivity_index =
2773 .template vtk_lexicographic_to_node_index<1>(
2774 {{i1}}, {{n_subdivisions}}, legacy_format);
2775 connectivity[connectivity_index] = local_index;
2782 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2783 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2785 const unsigned int local_index = i2 * n + i1;
2786 const unsigned int connectivity_index =
2788 .template vtk_lexicographic_to_node_index<2>(
2790 {{n_subdivisions, n_subdivisions}},
2792 connectivity[connectivity_index] = local_index;
2799 for (
unsigned int i3 = 0; i3 < n_subdivisions + 1; ++i3)
2800 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2801 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2803 const unsigned int local_index =
2804 i3 * n * n + i2 * n + i1;
2805 const unsigned int connectivity_index =
2807 .template vtk_lexicographic_to_node_index<3>(
2813 connectivity[connectivity_index] = local_index;
2824 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2828 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
2836 template <
int dim,
int spacedim,
typename StreamType>
2839 unsigned int n_data_sets,
2840 const bool double_precision,
2844 unsigned int count = 0;
2846 for (
const auto &patch : patches)
2849 const unsigned int n = n_subdivisions + 1;
2851 Assert((patch.
data.n_rows() == n_data_sets &&
2853 (patch.
data.n_rows() == n_data_sets + spacedim &&
2856 (n_data_sets + spacedim) :
2858 patch.
data.n_rows()));
2859 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
2862 std::vector<float> floats(n_data_sets);
2863 std::vector<double> doubles(n_data_sets);
2866 for (
unsigned int i = 0; i < Utilities::fixed_power<dim>(n);
2868 if (double_precision)
2870 for (
unsigned int data_set = 0; data_set < n_data_sets;
2872 doubles[data_set] = patch.
data(data_set, i);
2873 out.write_dataset(count, doubles);
2877 for (
unsigned int data_set = 0; data_set < n_data_sets;
2879 floats[data_set] = patch.
data(data_set, i);
2880 out.write_dataset(count, floats);
2905 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
2906 camera_horizontal[2] * camera_direction[1];
2907 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
2908 camera_horizontal[0] * camera_direction[2];
2909 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
2910 camera_horizontal[1] * camera_direction[0];
2914 phi /= (point[0] - camera_position[0]) * camera_direction[0] +
2915 (point[1] - camera_position[1]) * camera_direction[1] +
2916 (point[2] - camera_position[2]) * camera_direction[2];
2920 camera_position[0] + phi * (point[0] - camera_position[0]);
2922 camera_position[1] + phi * (point[1] - camera_position[1]);
2924 camera_position[2] + phi * (point[2] - camera_position[2]);
2927 projection_decomposition[0] = (projection[0] - camera_position[0] -
2928 camera_focus * camera_direction[0]) *
2929 camera_horizontal[0];
2930 projection_decomposition[0] += (projection[1] - camera_position[1] -
2931 camera_focus * camera_direction[1]) *
2932 camera_horizontal[1];
2933 projection_decomposition[0] += (projection[2] - camera_position[2] -
2934 camera_focus * camera_direction[2]) *
2935 camera_horizontal[2];
2937 projection_decomposition[1] = (projection[0] - camera_position[0] -
2938 camera_focus * camera_direction[0]) *
2940 projection_decomposition[1] += (projection[1] - camera_position[1] -
2941 camera_focus * camera_direction[1]) *
2943 projection_decomposition[1] += (projection[2] - camera_position[2] -
2944 camera_focus * camera_direction[2]) *
2947 return projection_decomposition;
2956 svg_get_gradient_parameters(
Point<3> points[])
2962 for (
int i = 0; i < 2; ++i)
2964 for (
int j = 0; j < 2 - i; ++j)
2966 if (points[j][2] > points[j + 1][2])
2969 points[j] = points[j + 1];
2970 points[j + 1] = temp;
2977 v_inter = points[1];
2984 A[0][0] = v_max[0] - v_min[0];
2985 A[0][1] = v_inter[0] - v_min[0];
2986 A[1][0] = v_max[1] - v_min[1];
2987 A[1][1] = v_inter[1] - v_min[1];
2993 bool col_change =
false;
3002 double temp = A[1][0];
3007 for (
unsigned int k = 0; k < 1; ++k)
3009 for (
unsigned int i = k + 1; i < 2; ++i)
3011 x = A[i][k] / A[k][k];
3013 for (
unsigned int j = k + 1; j < 2; ++j)
3014 A[i][j] = A[i][j] - A[k][j] * x;
3016 b[i] = b[i] - b[k] * x;
3020 b[1] =
b[1] /
A[1][1];
3022 for (
int i = 0; i >= 0; i--)
3026 for (
unsigned int j = i + 1; j < 2; ++j)
3027 sum = sum - A[i][j] * b[j];
3029 b[i] = sum / A[i][i];
3039 double c = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) +
3043 A[0][0] = v_max[0] - v_min[0];
3044 A[0][1] = v_inter[0] - v_min[0];
3045 A[1][0] = v_max[1] - v_min[1];
3046 A[1][1] = v_inter[1] - v_min[1];
3048 b[0] = 1.0 - v_min[0];
3060 double temp = A[1][0];
3065 for (
unsigned int k = 0; k < 1; ++k)
3067 for (
unsigned int i = k + 1; i < 2; ++i)
3069 x = A[i][k] / A[k][k];
3071 for (
unsigned int j = k + 1; j < 2; ++j)
3072 A[i][j] = A[i][j] - A[k][j] * x;
3074 b[i] = b[i] - b[k] * x;
3078 b[1] =
b[1] /
A[1][1];
3080 for (
int i = 0; i >= 0; i--)
3084 for (
unsigned int j = i + 1; j < 2; ++j)
3085 sum = sum - A[i][j] * b[j];
3087 b[i] = sum / A[i][i];
3097 gradient[0] = b[0] * (v_max[2] - v_min[2]) +
3098 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3101 A[0][0] = v_max[0] - v_min[0];
3102 A[0][1] = v_inter[0] - v_min[0];
3103 A[1][0] = v_max[1] - v_min[1];
3104 A[1][1] = v_inter[1] - v_min[1];
3107 b[1] = 1.0 - v_min[1];
3118 double temp = A[1][0];
3123 for (
unsigned int k = 0; k < 1; ++k)
3125 for (
unsigned int i = k + 1; i < 2; ++i)
3127 x =
A[i][k] /
A[k][k];
3129 for (
unsigned int j = k + 1; j < 2; ++j)
3130 A[i][j] = A[i][j] - A[k][j] * x;
3132 b[i] =
b[i] -
b[k] * x;
3136 b[1] =
b[1] /
A[1][1];
3138 for (
int i = 0; i >= 0; i--)
3142 for (
unsigned int j = i + 1; j < 2; ++j)
3143 sum = sum - A[i][j] * b[j];
3145 b[i] =
sum /
A[i][i];
3155 gradient[1] =
b[0] * (v_max[2] - v_min[2]) +
3156 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3162 gradient[1] * (v_min[1] - v_max[1]);
3166 gradient_parameters[0] = v_min[0];
3167 gradient_parameters[1] = v_min[1];
3172 gradient_parameters[4] = v_min[2];
3173 gradient_parameters[5] = v_max[2];
3175 return gradient_parameters;
3181 template <
int dim,
int spacedim>
3185 const std::vector<std::string> &data_names,
3187 std::tuple<
unsigned int,
3200#ifndef DEAL_II_WITH_MPI
3209 if (patches.empty())
3213 const unsigned int n_data_sets = data_names.size();
3215 UcdStream ucd_out(out, flags);
3218 unsigned int n_nodes;
3219 unsigned int n_cells;
3220 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
3226 <<
"# This file was generated by the deal.II library." <<
'\n'
3230 <<
"# For a description of the UCD format see the AVS Developer's guide."
3236 out << n_nodes <<
' ' << n_cells <<
' ' << n_data_sets <<
' ' << 0
3249 if (n_data_sets != 0)
3251 out << n_data_sets <<
" ";
3252 for (
unsigned int i = 0; i < n_data_sets; ++i)
3257 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3258 out << data_names[data_set]
3262 write_data(patches, n_data_sets,
true, ucd_out);
3272 template <
int dim,
int spacedim>
3276 const std::vector<std::string> &data_names,
3278 std::tuple<
unsigned int,
3290#ifndef DEAL_II_WITH_MPI
3299 if (patches.empty())
3303 DXStream dx_out(out, flags);
3306 unsigned int offset = 0;
3308 const unsigned int n_data_sets = data_names.size();
3311 unsigned int n_nodes;
3312 unsigned int n_cells;
3313 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
3316 out <<
"object \"vertices\" class array type float rank 1 shape "
3317 << spacedim <<
" items " << n_nodes;
3321 out <<
" lsb ieee data 0" <<
'\n';
3322 offset += n_nodes * spacedim *
sizeof(float);
3326 out <<
" data follows" <<
'\n';
3335 out <<
"object \"cells\" class array type int rank 1 shape "
3340 out <<
" lsb binary data " << offset <<
'\n';
3341 offset += n_cells *
sizeof(
int);
3345 out <<
" data follows" <<
'\n';
3351 out <<
"attribute \"element type\" string \"";
3352 if constexpr (dim == 1)
3354 else if constexpr (dim == 2)
3356 else if constexpr (dim == 3)
3358 out <<
"\"" <<
'\n' <<
"attribute \"ref\" string \"positions\"" <<
'\n';
3365 out <<
"object \"neighbors\" class array type int rank 1 shape "
3369 for (
const auto &patch : patches)
3372 const unsigned int n1 = (dim > 0) ? n : 1;
3373 const unsigned int n2 = (dim > 1) ? n : 1;
3374 const unsigned int n3 = (dim > 2) ? n : 1;
3375 const unsigned int x_minus = (dim > 0) ? 0 : 0;
3376 const unsigned int x_plus = (dim > 0) ? 1 : 0;
3377 const unsigned int y_minus = (dim > 1) ? 2 : 0;
3378 const unsigned int y_plus = (dim > 1) ? 3 : 0;
3379 const unsigned int z_minus = (dim > 2) ? 4 : 0;
3380 const unsigned int z_plus = (dim > 2) ? 5 : 0;
3381 unsigned int cells_per_patch = Utilities::fixed_power<dim>(n);
3382 unsigned int dx = 1;
3383 unsigned int dy = n;
3384 unsigned int dz = n * n;
3386 const unsigned int patch_start =
3389 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3390 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3391 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3393 const unsigned int nx = i1 *
dx;
3394 const unsigned int ny = i2 * dy;
3395 const unsigned int nz = i3 * dz;
3407 const unsigned int nn = patch.
neighbors[x_minus];
3411 << (nn * cells_per_patch + ny + nz +
dx * (n - 1));
3417 out <<
'\t' << patch_start + nx -
dx + ny + nz;
3422 const unsigned int nn = patch.
neighbors[x_plus];
3425 out << (nn * cells_per_patch + ny + nz);
3431 out <<
'\t' << patch_start + nx +
dx + ny + nz;
3438 const unsigned int nn = patch.
neighbors[y_minus];
3442 << (nn * cells_per_patch + nx + nz + dy * (n - 1));
3448 out <<
'\t' << patch_start + nx + ny - dy + nz;
3453 const unsigned int nn = patch.
neighbors[y_plus];
3456 out << (nn * cells_per_patch + nx + nz);
3462 out <<
'\t' << patch_start + nx + ny + dy + nz;
3470 const unsigned int nn = patch.
neighbors[z_minus];
3474 << (nn * cells_per_patch + nx + ny + dz * (n - 1));
3480 out <<
'\t' << patch_start + nx + ny + nz - dz;
3485 const unsigned int nn = patch.
neighbors[z_plus];
3488 out << (nn * cells_per_patch + nx + ny);
3494 out <<
'\t' << patch_start + nx + ny + nz + dz;
3502 if (n_data_sets != 0)
3504 out <<
"object \"data\" class array type float rank 1 shape "
3505 << n_data_sets <<
" items " << n_nodes;
3509 out <<
" lsb ieee data " << offset <<
'\n';
3510 offset += n_data_sets * n_nodes *
3511 ((flags.
data_double) ?
sizeof(
double) :
sizeof(float));
3515 out <<
" data follows" <<
'\n';
3520 out <<
"attribute \"dep\" string \"positions\"" <<
'\n';
3524 out <<
"object \"data\" class constantarray type float rank 0 items "
3525 << n_nodes <<
" data follows" <<
'\n'
3531 out <<
"object \"deal data\" class field" <<
'\n'
3532 <<
"component \"positions\" value \"vertices\"" <<
'\n'
3533 <<
"component \"connections\" value \"cells\"" <<
'\n'
3534 <<
"component \"data\" value \"data\"" <<
'\n';
3537 out <<
"component \"neighbors\" value \"neighbors\"" <<
'\n';
3544 out <<
"end" <<
'\n';
3562 template <
int dim,
int spacedim>
3566 const std::vector<std::string> &data_names,
3568 std::tuple<
unsigned int,
3577#ifndef DEAL_II_WITH_MPI
3587 if (patches.empty())
3591 const unsigned int n_data_sets = data_names.size();
3595 out <<
"# This file was generated by the deal.II library." <<
'\n'
3599 <<
"# For a description of the GNUPLOT format see the GNUPLOT manual."
3606 for (
unsigned int spacedim_n = 0; spacedim_n < spacedim; ++spacedim_n)
3611 for (
const auto &data_name : data_names)
3612 out <<
'<' << data_name <<
"> ";
3618 for (
const auto &patch : patches)
3621 const unsigned int n_points_per_direction = n_subdivisions + 1;
3623 Assert((patch.
data.n_rows() == n_data_sets &&
3625 (patch.
data.n_rows() == n_data_sets + spacedim &&
3628 (n_data_sets + spacedim) :
3630 patch.
data.n_rows()));
3632 auto output_point_data =
3633 [&out, &patch, n_data_sets](
const unsigned int point_index)
mutable {
3634 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3635 out << patch.data(data_set, point_index) <<
' ';
3644 Assert(patch.data.n_cols() == 1,
3646 n_subdivisions + 1));
3650 out << get_equispaced_location(patch, {}, n_subdivisions)
3652 output_point_data(0);
3662 Assert(patch.data.n_cols() ==
3663 Utilities::fixed_power<dim>(n_points_per_direction),
3665 n_subdivisions + 1));
3667 for (
unsigned int i1 = 0; i1 < n_points_per_direction; ++i1)
3670 out << get_equispaced_location(patch, {i1}, n_subdivisions)
3673 output_point_data(i1);
3686 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3687 n_points_per_direction),
3689 n_subdivisions + 1));
3691 for (
unsigned int i2 = 0; i2 < n_points_per_direction; ++i2)
3693 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3697 out << get_equispaced_location(patch,
3702 output_point_data(i1 + i2 * n_points_per_direction);
3727 out << get_node_location(patch, 0) <<
' ';
3728 output_point_data(0);
3731 out << get_node_location(patch, 1) <<
' ';
3732 output_point_data(1);
3736 out << get_node_location(patch, 2) <<
' ';
3737 output_point_data(2);
3740 out << get_node_location(patch, 2) <<
' ';
3741 output_point_data(2);
3761 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3762 n_points_per_direction),
3764 n_subdivisions + 1));
3769 for (
unsigned int i3 = 0; i3 < n_points_per_direction; ++i3)
3770 for (
unsigned int i2 = 0; i2 < n_points_per_direction;
3772 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3777 get_equispaced_location(patch,
3781 if (i1 < n_subdivisions)
3784 out << this_point <<
' ';
3785 output_point_data(i1 +
3786 i2 * n_points_per_direction +
3787 i3 * n_points_per_direction *
3788 n_points_per_direction);
3792 out << get_equispaced_location(patch,
3797 output_point_data((i1 + 1) +
3798 i2 * n_points_per_direction +
3799 i3 * n_points_per_direction *
3800 n_points_per_direction);
3804 out <<
'\n' <<
'\n';
3808 if (i2 < n_subdivisions)
3811 out << this_point <<
' ';
3812 output_point_data(i1 +
3813 i2 * n_points_per_direction +
3814 i3 * n_points_per_direction *
3815 n_points_per_direction);
3819 out << get_equispaced_location(patch,
3825 i1 + (i2 + 1) * n_points_per_direction +
3826 i3 * n_points_per_direction *
3827 n_points_per_direction);
3831 out <<
'\n' <<
'\n';
3835 if (i3 < n_subdivisions)
3838 out << this_point <<
' ';
3839 output_point_data(i1 +
3840 i2 * n_points_per_direction +
3841 i3 * n_points_per_direction *
3842 n_points_per_direction);
3846 out << get_equispaced_location(patch,
3852 i1 + i2 * n_points_per_direction +
3853 (i3 + 1) * n_points_per_direction *
3854 n_points_per_direction);
3857 out <<
'\n' <<
'\n';
3866 for (
const unsigned int v : {0, 1, 2, 0, 3, 2})
3868 out << get_node_location(patch, v) <<
' ';
3869 output_point_data(v);
3874 for (
const unsigned int v : {3, 1})
3876 out << get_node_location(patch, v) <<
' ';
3877 output_point_data(v);
3887 for (
const unsigned int v : {0, 1, 3, 2, 0, 4, 1})
3889 out << get_node_location(patch, v) <<
' ';
3890 output_point_data(v);
3895 for (
const unsigned int v : {2, 4, 3})
3897 out << get_node_location(patch, v) <<
' ';
3898 output_point_data(v);
3912 for (
const unsigned int v : {0, 1, 2, 0, 3, 4, 5, 3})
3914 out << get_node_location(patch, v) <<
' ';
3915 output_point_data(v);
3920 for (
const unsigned int v : {1, 4})
3922 out << get_node_location(patch, v) <<
' ';
3923 output_point_data(v);
3928 for (
const unsigned int v : {2, 5})
3930 out << get_node_location(patch, v) <<
' ';
3931 output_point_data(v);
3956 template <
int dim,
int spacedim>
3958 do_write_povray(
const std::vector<Patch<dim, spacedim>> &,
3959 const std::vector<std::string> &,
3960 const PovrayFlags &,
3964 ExcMessage(
"Writing files in POVRAY format is only supported "
3965 "for two-dimensional meshes."));
3971 do_write_povray(
const std::vector<Patch<2, 2>> &patches,
3972 const std::vector<std::string> &data_names,
3973 const PovrayFlags &flags,
3978#ifndef DEAL_II_WITH_MPI
3987 if (patches.empty())
3990 constexpr int dim = 2;
3992 constexpr int spacedim = 2;
3994 const unsigned int n_data_sets = data_names.size();
4000 <<
"/* This file was generated by the deal.II library." <<
'\n'
4004 <<
" For a description of the POVRAY format see the POVRAY manual."
4009 out <<
"#include \"colors.inc\" " <<
'\n'
4010 <<
"#include \"textures.inc\" " <<
'\n';
4014 if (flags.external_data)
4015 out <<
"#include \"data.inc\" " <<
'\n';
4021 <<
"camera {" <<
'\n'
4022 <<
" location <1,4,-7>" <<
'\n'
4023 <<
" look_at <0,0,0>" <<
'\n'
4024 <<
" angle 30" <<
'\n'
4029 <<
"light_source {" <<
'\n'
4030 <<
" <1,4,-7>" <<
'\n'
4031 <<
" color Grey" <<
'\n'
4034 <<
"light_source {" <<
'\n'
4035 <<
" <0,20,0>" <<
'\n'
4036 <<
" color White" <<
'\n'
4043 double hmin = patches[0].data(0, 0);
4044 double hmax = patches[0].data(0, 0);
4046 for (
const auto &patch : patches)
4050 Assert((patch.
data.n_rows() == n_data_sets &&
4052 (patch.
data.n_rows() == n_data_sets + spacedim &&
4055 (n_data_sets + spacedim) :
4057 patch.
data.n_rows()));
4059 Utilities::fixed_power<dim>(n_subdivisions + 1),
4061 n_subdivisions + 1));
4063 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
4064 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
4066 const int dl = i * (n_subdivisions + 1) + j;
4067 if (patch.
data(0, dl) < hmin)
4068 hmin = patch.
data(0, dl);
4069 if (patch.
data(0, dl) > hmax)
4070 hmax = patch.
data(0, dl);
4074 out <<
"#declare HMIN=" << hmin <<
";" <<
'\n'
4075 <<
"#declare HMAX=" << hmax <<
";" <<
'\n'
4078 if (!flags.external_data)
4081 out <<
"#declare Tex=texture{" <<
'\n'
4082 <<
" pigment {" <<
'\n'
4083 <<
" gradient y" <<
'\n'
4084 <<
" scale y*(HMAX-HMIN)*" << 0.1 <<
'\n'
4085 <<
" color_map {" <<
'\n'
4086 <<
" [0.00 color Light_Purple] " <<
'\n'
4087 <<
" [0.95 color Light_Purple] " <<
'\n'
4088 <<
" [1.00 color White] " <<
'\n'
4093 if (!flags.bicubic_patch)
4096 out <<
'\n' <<
"mesh {" <<
'\n';
4100 for (
const auto &patch : patches)
4103 const unsigned int n = n_subdivisions + 1;
4104 const unsigned int d1 = 1;
4105 const unsigned int d2 = n;
4107 Assert((patch.
data.n_rows() == n_data_sets &&
4109 (patch.
data.n_rows() == n_data_sets + spacedim &&
4112 (n_data_sets + spacedim) :
4114 patch.
data.n_rows()));
4115 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
4117 n_subdivisions + 1));
4120 std::vector<Point<spacedim>> ver(n * n);
4122 for (
unsigned int i2 = 0; i2 < n; ++i2)
4123 for (
unsigned int i1 = 0; i1 < n; ++i1)
4126 ver[i1 * d1 + i2 * d2] =
4127 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4131 if (!flags.bicubic_patch)
4134 std::vector<Point<3>> nrml;
4144 for (
unsigned int i = 0; i < n; ++i)
4145 for (
unsigned int j = 0; j < n; ++j)
4147 const unsigned int il = (i == 0) ? i : (i - 1);
4148 const unsigned int ir =
4149 (i == n_subdivisions) ? i : (i + 1);
4150 const unsigned int jl = (j == 0) ? j : (j - 1);
4151 const unsigned int jr =
4152 (j == n_subdivisions) ? j : (j + 1);
4155 ver[ir * d1 + j * d2][0] - ver[il * d1 + j * d2][0];
4156 h1[1] = patch.
data(0, ir * d1 + j * d2) -
4157 patch.
data(0, il * d1 + j * d2);
4159 ver[ir * d1 + j * d2][1] - ver[il * d1 + j * d2][1];
4162 ver[i * d1 + jr * d2][0] - ver[i * d1 + jl * d2][0];
4163 h2[1] = patch.
data(0, i * d1 + jr * d2) -
4164 patch.
data(0, i * d1 + jl * d2);
4166 ver[i * d1 + jr * d2][1] - ver[i * d1 + jl * d2][1];
4168 nrml[i * d1 + j * d2][0] =
4169 h1[1] * h2[2] - h1[2] * h2[1];
4170 nrml[i * d1 + j * d2][1] =
4171 h1[2] * h2[0] - h1[0] * h2[2];
4172 nrml[i * d1 + j * d2][2] =
4173 h1[0] * h2[1] - h1[1] * h2[0];
4176 double norm = std::hypot(nrml[i * d1 + j * d2][0],
4177 nrml[i * d1 + j * d2][1],
4178 nrml[i * d1 + j * d2][2]);
4180 if (nrml[i * d1 + j * d2][1] < 0)
4183 for (
unsigned int k = 0; k < 3; ++k)
4184 nrml[i * d1 + j * d2][k] /= norm;
4189 for (
unsigned int i = 0; i < n_subdivisions; ++i)
4190 for (
unsigned int j = 0; j < n_subdivisions; ++j)
4193 const int dl = i * d1 + j * d2;
4199 out <<
"smooth_triangle {" <<
'\n'
4200 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4201 <<
"," << ver[dl][1] <<
">, <" << nrml[dl][0]
4202 <<
", " << nrml[dl][1] <<
", " << nrml[dl][2]
4204 out <<
" \t<" << ver[dl + d1][0] <<
","
4205 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1][1]
4206 <<
">, <" << nrml[dl + d1][0] <<
", "
4207 << nrml[dl + d1][1] <<
", " << nrml[dl + d1][2]
4209 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4210 << patch.
data(0, dl + d1 + d2) <<
","
4211 << ver[dl + d1 + d2][1] <<
">, <"
4212 << nrml[dl + d1 + d2][0] <<
", "
4213 << nrml[dl + d1 + d2][1] <<
", "
4214 << nrml[dl + d1 + d2][2] <<
">}" <<
'\n';
4217 out <<
"smooth_triangle {" <<
'\n'
4218 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4219 <<
"," << ver[dl][1] <<
">, <" << nrml[dl][0]
4220 <<
", " << nrml[dl][1] <<
", " << nrml[dl][2]
4222 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4223 << patch.
data(0, dl + d1 + d2) <<
","
4224 << ver[dl + d1 + d2][1] <<
">, <"
4225 << nrml[dl + d1 + d2][0] <<
", "
4226 << nrml[dl + d1 + d2][1] <<
", "
4227 << nrml[dl + d1 + d2][2] <<
">," <<
'\n';
4228 out <<
"\t<" << ver[dl + d2][0] <<
","
4229 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2][1]
4230 <<
">, <" << nrml[dl + d2][0] <<
", "
4231 << nrml[dl + d2][1] <<
", " << nrml[dl + d2][2]
4237 out <<
"triangle {" <<
'\n'
4238 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4239 <<
"," << ver[dl][1] <<
">," <<
'\n';
4240 out <<
"\t<" << ver[dl + d1][0] <<
","
4241 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1][1]
4243 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4244 << patch.
data(0, dl + d1 + d2) <<
","
4245 << ver[dl + d1 + d2][1] <<
">}" <<
'\n';
4248 out <<
"triangle {" <<
'\n'
4249 <<
"\t<" << ver[dl][0] <<
"," << patch.
data(0, dl)
4250 <<
"," << ver[dl][1] <<
">," <<
'\n';
4251 out <<
"\t<" << ver[dl + d1 + d2][0] <<
","
4252 << patch.
data(0, dl + d1 + d2) <<
","
4253 << ver[dl + d1 + d2][1] <<
">," <<
'\n';
4254 out <<
"\t<" << ver[dl + d2][0] <<
","
4255 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2][1]
4263 Assert(n_subdivisions == 3,
4266 <<
"bicubic_patch {" <<
'\n'
4267 <<
" type 0" <<
'\n'
4268 <<
" flatness 0" <<
'\n'
4269 <<
" u_steps 0" <<
'\n'
4270 <<
" v_steps 0" <<
'\n';
4271 for (
int i = 0; i < 16; ++i)
4273 out <<
"\t<" << ver[i][0] <<
"," << patch.
data(0, i) <<
","
4274 << ver[i][1] <<
">";
4279 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n';
4283 if (!flags.bicubic_patch)
4286 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n' <<
'\n';
4298 template <
int dim,
int spacedim>
4302 const std::vector<std::string> &data_names,
4304 std::tuple<
unsigned int,
4311 do_write_povray(patches, data_names, flags, out);
4316 template <
int dim,
int spacedim>
4320 const std::vector<std::string> & ,
4322 std::tuple<
unsigned int,
4334 template <
int spacedim>
4338 const std::vector<std::string> & ,
4340 std::tuple<
unsigned int,
4349#ifndef DEAL_II_WITH_MPI
4358 if (patches.empty())
4368 std::multiset<EpsCell2d> cells;
4372 float min_color_value = std::numeric_limits<float>::max();
4373 float max_color_value = std::numeric_limits<float>::min();
4377 double heights[4] = {0, 0, 0, 0};
4381 for (
const auto &patch : patches)
4384 const unsigned int n = n_subdivisions + 1;
4385 const unsigned int d1 = 1;
4386 const unsigned int d2 = n;
4388 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
4389 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
4393 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4395 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
4397 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
4398 points[3] = get_equispaced_location(patch,
4406 patch.
data.n_rows() == 0,
4409 patch.
data.n_rows()));
4411 patch.
data.n_rows() != 0 ?
4415 heights[1] = patch.
data.n_rows() != 0 ?
4417 (i1 + 1) * d1 + i2 * d2) *
4420 heights[2] = patch.
data.n_rows() != 0 ?
4422 i1 * d1 + (i2 + 1) * d2) *
4425 heights[3] = patch.
data.n_rows() != 0 ?
4427 (i1 + 1) * d1 + (i2 + 1) * d2) *
4434 for (
unsigned int i = 0; i < 4; ++i)
4435 heights[i] = points[i][2];
4460 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4462 const double x = points[vertex][0], y = points[vertex][1],
4463 z = -heights[vertex];
4465 eps_cell.vertices[vertex][0] = -cz * x + sz * y;
4466 eps_cell.vertices[vertex][1] =
4467 -cx * sz * x - cx * cz * y - sx * z;
4491 (points[0] + points[1] + points[2] + points[3]) / 4;
4492 const double center_height =
4493 -(heights[0] + heights[1] + heights[2] + heights[3]) / 4;
4496 eps_cell.depth = -sx * sz * center_point[0] -
4497 sx * cz * center_point[1] + cx * center_height;
4502 patch.
data.n_rows() == 0,
4505 patch.
data.n_rows()));
4506 const double color_values[4] = {
4507 patch.
data.n_rows() != 0 ?
4511 patch.
data.n_rows() != 0 ?
4515 patch.
data.n_rows() != 0 ?
4519 patch.
data.n_rows() != 0 ?
4521 (i1 + 1) * d1 + (i2 + 1) * d2) :
4525 eps_cell.color_value = (color_values[0] + color_values[1] +
4526 color_values[3] + color_values[2]) /
4531 std::min(min_color_value, eps_cell.color_value);
4533 std::max(max_color_value, eps_cell.color_value);
4537 cells.insert(eps_cell);
4543 double x_min = cells.begin()->vertices[0][0];
4544 double x_max = x_min;
4545 double y_min = cells.begin()->vertices[0][1];
4546 double y_max = y_min;
4548 for (
const auto &cell : cells)
4549 for (
const auto &vertex : cell.vertices)
4551 x_min =
std::min(x_min, vertex[0]);
4552 x_max =
std::max(x_max, vertex[0]);
4553 y_min =
std::min(y_min, vertex[1]);
4554 y_max =
std::max(y_max, vertex[1]);
4559 const double scale =
4563 const Point<2> offset(x_min, y_min);
4568 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n'
4569 <<
"%%Title: deal.II Output" <<
'\n'
4570 <<
"%%Creator: the deal.II library" <<
'\n'
4573 <<
"%%BoundingBox: "
4577 <<
static_cast<unsigned int>((x_max - x_min) * scale + 0.5) <<
' '
4578 <<
static_cast<unsigned int>((y_max - y_min) * scale + 0.5) <<
'\n';
4587 out <<
"/m {moveto} bind def" <<
'\n'
4588 <<
"/l {lineto} bind def" <<
'\n'
4589 <<
"/s {setrgbcolor} bind def" <<
'\n'
4590 <<
"/sg {setgray} bind def" <<
'\n'
4591 <<
"/lx {lineto closepath stroke} bind def" <<
'\n'
4592 <<
"/lf {lineto closepath fill} bind def" <<
'\n';
4594 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4596 out << flags.
line_width <<
" setlinewidth" <<
'\n';
4604 if (max_color_value == min_color_value)
4605 max_color_value = min_color_value + 1;
4609 for (
const auto &cell : cells)
4622 out << rgb_values.
red <<
" sg ";
4624 out << rgb_values.
red <<
' ' << rgb_values.
green <<
' '
4625 << rgb_values.
blue <<
" s ";
4630 out << (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 <<
" lf" <<
'\n';
4638 << (cell.vertices[0] - offset) * scale <<
" m "
4639 << (cell.vertices[1] - offset) * scale <<
" l "
4640 << (cell.vertices[3] - offset) * scale <<
" l "
4641 << (cell.vertices[2] - offset) * scale <<
" lx" <<
'\n';
4643 out <<
"showpage" <<
'\n';
4652 template <
int dim,
int spacedim>
4656 const std::vector<std::string> &data_names,
4658 std::tuple<
unsigned int,
4674#ifndef DEAL_II_WITH_MPI
4683 if (patches.empty())
4687 GmvStream gmv_out(out, flags);
4688 const unsigned int n_data_sets = data_names.size();
4691 Assert((patches[0].
data.n_rows() == n_data_sets &&
4692 !patches[0].points_are_available) ||
4693 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4694 patches[0].points_are_available),
4696 (n_data_sets + spacedim) :
4698 patches[0].data.n_rows()));
4702 out <<
"gmvinput ascii" <<
'\n' <<
'\n';
4705 unsigned int n_nodes;
4706 unsigned int n_cells;
4707 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
4722 [&patches]() {
return create_global_data_table(patches); });
4728 out <<
"nodes " << n_nodes <<
'\n';
4729 for (
unsigned int d = 0; d < spacedim; ++d)
4731 gmv_out.selected_component = d;
4737 for (
unsigned int d = spacedim; d < 3; ++d)
4739 for (
unsigned int i = 0; i < n_nodes; ++i)
4746 out <<
"cells " << n_cells <<
'\n';
4751 out <<
"variable" <<
'\n';
4755 std::move(*create_global_data_table_task.
return_value());
4759 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4761 out << data_names[data_set] <<
" 1" <<
'\n';
4762 std::copy(data_vectors[data_set].begin(),
4763 data_vectors[data_set].end(),
4764 std::ostream_iterator<double>(out,
" "));
4765 out <<
'\n' <<
'\n';
4771 out <<
"endvars" <<
'\n';
4774 out <<
"endgmv" <<
'\n';
4785 template <
int dim,
int spacedim>
4789 const std::vector<std::string> &data_names,
4791 std::tuple<
unsigned int,
4805#ifndef DEAL_II_WITH_MPI
4814 if (patches.empty())
4818 TecplotStream tecplot_out(out, flags);
4820 const unsigned int n_data_sets = data_names.size();
4823 Assert((patches[0].
data.n_rows() == n_data_sets &&
4824 !patches[0].points_are_available) ||
4825 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4826 patches[0].points_are_available),
4828 (n_data_sets + spacedim) :
4830 patches[0].data.n_rows()));
4833 unsigned int n_nodes;
4834 unsigned int n_cells;
4835 std::tie(n_nodes, n_cells) = count_nodes_and_cells(patches);
4841 <<
"# This file was generated by the deal.II library." <<
'\n'
4845 <<
"# For a description of the Tecplot format see the Tecplot documentation."
4850 out <<
"Variables=";
4858 out <<
"\"x\", \"y\"";
4861 out <<
"\"x\", \"y\", \"z\"";
4867 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4868 out <<
", \"" << data_names[data_set] <<
"\"";
4874 out <<
"t=\"" << flags.
zone_name <<
"\" ";
4877 out <<
"strandid=1, solutiontime=" << flags.
solution_time <<
", ";
4879 out <<
"f=feblock, n=" << n_nodes <<
", e=" << n_cells
4880 <<
", et=" << tecplot_cell_type[dim] <<
'\n';
4897 [&patches]() {
return create_global_data_table(patches); });
4903 for (
unsigned int d = 0; d < spacedim; ++d)
4905 tecplot_out.selected_component = d;
4916 std::move(*create_global_data_table_task.
return_value());
4919 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4921 std::copy(data_vectors[data_set].begin(),
4922 data_vectors[data_set].end(),
4923 std::ostream_iterator<double>(out,
"\n"));
4938 template <
int dim,
int spacedim>
4942 const std::vector<std::string> &data_names,
4944 std::tuple<
unsigned int,
4948 &nonscalar_data_ranges,
4954#ifndef DEAL_II_WITH_MPI
4963 if (patches.empty())
4967 VtkStream vtk_out(out, flags);
4969 const unsigned int n_data_sets = data_names.size();
4971 if (patches[0].points_are_available)
4983 out <<
"# vtk DataFile Version 3.0" <<
'\n'
4984 <<
"#This file was generated by the deal.II library";
4992 out <<
'\n' <<
"ASCII" <<
'\n';
4994 out <<
"DATASET UNSTRUCTURED_GRID\n" <<
'\n';
5001 const unsigned int n_metadata =
5002 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5003 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5006 out <<
"FIELD FieldData " << n_metadata <<
'\n';
5008 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5010 out <<
"CYCLE 1 1 int\n" << flags.
cycle <<
'\n';
5012 if (flags.
time != std::numeric_limits<double>::min())
5014 out <<
"TIME 1 1 double\n" << flags.
time <<
'\n';
5020 unsigned int n_nodes;
5021 unsigned int n_cells;
5022 unsigned int n_points_and_n_cells;
5023 std::tie(n_nodes, n_cells, n_points_and_n_cells) =
5039 [&patches]() {
return create_global_data_table(patches); });
5045 out <<
"POINTS " << n_nodes <<
" double" <<
'\n';
5050 out <<
"CELLS " << n_cells <<
' ' << n_points_and_n_cells <<
'\n';
5058 out <<
"CELL_TYPES " << n_cells <<
'\n';
5062 for (
const auto &patch : patches)
5064 const auto vtk_cell_id =
5067 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
5068 out <<
' ' << vtk_cell_id[0];
5077 std::move(*create_global_data_table_task.
return_value());
5082 out <<
"POINT_DATA " << n_nodes <<
'\n';
5086 std::vector<bool> data_set_written(n_data_sets,
false);
5087 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5092 "The VTK writer does not currently support outputting "
5093 "tensor data. Use the VTU writer instead."));
5096 std::get<0>(nonscalar_data_range),
5098 std::get<0>(nonscalar_data_range)));
5099 AssertThrow(std::get<1>(nonscalar_data_range) < n_data_sets,
5103 AssertThrow(std::get<1>(nonscalar_data_range) + 1 -
5104 std::get<0>(nonscalar_data_range) <=
5107 "Can't declare a vector with more than 3 components "
5111 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5112 i <= std::get<1>(nonscalar_data_range);
5114 data_set_written[i] =
true;
5120 if (!std::get<2>(nonscalar_data_range).empty())
5121 out << std::get<2>(nonscalar_data_range);
5124 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5125 i < std::get<1>(nonscalar_data_range);
5127 out << data_names[i] <<
"__";
5128 out << data_names[std::get<1>(nonscalar_data_range)];
5131 out <<
" double" <<
'\n';
5134 for (
unsigned int n = 0; n < n_nodes; ++n)
5136 switch (std::get<1>(nonscalar_data_range) -
5137 std::get<0>(nonscalar_data_range))
5140 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5145 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5147 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5151 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5153 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5155 << data_vectors(std::get<0>(nonscalar_data_range) + 2, n)
5168 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5169 if (data_set_written[data_set] ==
false)
5171 out <<
"SCALARS " << data_names[data_set] <<
" double 1" <<
'\n'
5172 <<
"LOOKUP_TABLE default" <<
'\n';
5173 std::copy(data_vectors[data_set].begin(),
5174 data_vectors[data_set].end(),
5175 std::ostream_iterator<double>(out,
" "));
5191 out <<
"<?xml version=\"1.0\" ?> \n";
5193 out <<
"# vtk DataFile Version 3.0" <<
'\n'
5194 <<
"#This file was generated by the deal.II library";
5205 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"2.2\"";
5207 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"";
5208 if (deal_ii_with_zlib &&
5210 out <<
" compressor=\"vtkZLibDataCompressor\"";
5211#ifdef DEAL_II_WORDS_BIGENDIAN
5212 out <<
" byte_order=\"BigEndian\"";
5214 out <<
" byte_order=\"LittleEndian\"";
5218 out <<
"<UnstructuredGrid>";
5228 out <<
" </UnstructuredGrid>\n";
5229 out <<
"</VTKFile>\n";
5234 template <
int dim,
int spacedim>
5238 const std::vector<std::string> &data_names,
5240 std::tuple<
unsigned int,
5244 &nonscalar_data_ranges,
5249 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5256 template <
int dim,
int spacedim>
5260 const std::vector<std::string> &data_names,
5262 std::tuple<
unsigned int,
5266 &nonscalar_data_ranges,
5280 unit.second.find(
'\"') == std::string::npos,
5282 "A physical unit you provided, <" + unit.second +
5283 ">, contained a quotation mark character. This is not allowed."));
5286#ifndef DEAL_II_WITH_MPI
5295 if (patches.empty())
5300 out <<
"<Piece NumberOfPoints=\"0\" NumberOfCells=\"0\" >\n"
5302 <<
"<DataArray type=\"UInt8\" Name=\"types\"></DataArray>\n"
5304 <<
" <PointData Scalars=\"scalars\">\n";
5305 std::vector<bool> data_set_written(data_names.size(),
false);
5306 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5309 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5310 i <= std::get<1>(nonscalar_data_range);
5312 data_set_written[i] =
true;
5316 out <<
" <DataArray type=\"Float32\" Name=\"";
5318 if (!std::get<2>(nonscalar_data_range).empty())
5319 out << std::get<2>(nonscalar_data_range);
5322 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5323 i < std::get<1>(nonscalar_data_range);
5325 out << data_names[i] <<
"__";
5326 out << data_names[std::get<1>(nonscalar_data_range)];
5329 out <<
"\" NumberOfComponents=\"3\"></DataArray>\n";
5332 for (
unsigned int data_set = 0; data_set < data_names.size();
5334 if (data_set_written[data_set] ==
false)
5336 out <<
" <DataArray type=\"Float32\" Name=\""
5337 << data_names[data_set] <<
"\"></DataArray>\n";
5340 out <<
" </PointData>\n";
5341 out <<
"</Piece>\n";
5355 const unsigned int n_metadata =
5356 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5357 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5359 out <<
"<FieldData>\n";
5361 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5364 <<
"<DataArray type=\"Float32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
5365 << flags.
cycle <<
"</DataArray>\n";
5367 if (flags.
time != std::numeric_limits<double>::min())
5370 <<
"<DataArray type=\"Float32\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
5371 << flags.
time <<
"</DataArray>\n";
5375 out <<
"</FieldData>\n";
5379 const unsigned int n_data_sets = data_names.size();
5382 if (patches[0].points_are_available)
5391 const char *ascii_or_binary =
5392 (deal_ii_with_zlib &&
5399 unsigned int n_nodes;
5400 unsigned int n_cells;
5401 std::tie(n_nodes, n_cells, std::ignore) =
5409 const auto stringize_vertex_information = [&patches,
5413 ascii_or_binary]() {
5414 std::ostringstream o;
5416 o <<
" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\""
5417 << ascii_or_binary <<
"\">\n";
5418 const std::vector<Point<spacedim>> node_positions =
5423 std::vector<float> node_coordinates_3d;
5424 node_coordinates_3d.reserve(node_positions.size() * 3);
5425 for (
const auto &node_position : node_positions)
5427 for (
unsigned int d = 0; d < 3; ++d)
5429 node_coordinates_3d.emplace_back(node_position[d]);
5431 node_coordinates_3d.emplace_back(0.0f);
5433 o << vtu_stringize_array(node_coordinates_3d,
5437 o <<
" </DataArray>\n";
5438 o <<
" </Points>\n\n";
5447 const auto stringize_cell_to_vertex_information = [&patches,
5451 out.precision()]() {
5452 std::ostringstream o;
5455 o <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\""
5456 << ascii_or_binary <<
"\">\n";
5458 std::vector<std::int32_t> cells;
5461 unsigned int first_vertex_of_patch = 0;
5463 for (
const auto &patch : patches)
5475 const unsigned int n_points = patch.
data.n_cols();
5476 Assert((dim == 2 && n_points == 6) ||
5477 (dim == 3 && n_points == 10),
5480 if (deal_ii_with_zlib &&
5484 for (
unsigned int i = 0; i < n_points; ++i)
5485 cells.push_back(first_vertex_of_patch + i);
5489 for (
unsigned int i = 0; i < n_points; ++i)
5490 o <<
'\t' << first_vertex_of_patch + i;
5494 first_vertex_of_patch += n_points;
5499 else if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
5503 const unsigned int n_points = patch.
data.n_cols();
5505 if (deal_ii_with_zlib &&
5509 for (
unsigned int i = 0; i < n_points; ++i)
5511 first_vertex_of_patch +
5516 for (
unsigned int i = 0; i < n_points; ++i)
5518 << (first_vertex_of_patch +
5523 first_vertex_of_patch += n_points;
5528 const unsigned int n_points_per_direction = n_subdivisions + 1;
5530 std::vector<unsigned> local_vertex_order;
5534 const auto flush_current_cell = [&flags,
5537 first_vertex_of_patch,
5538 &local_vertex_order]() {
5539 if (deal_ii_with_zlib &&
5543 for (
const auto &c : local_vertex_order)
5544 cells.push_back(first_vertex_of_patch + c);
5548 for (
const auto &c : local_vertex_order)
5549 o <<
'\t' << first_vertex_of_patch + c;
5553 local_vertex_order.clear();
5558 local_vertex_order.reserve(Utilities::fixed_power<dim>(2));
5564 local_vertex_order.emplace_back(0);
5565 flush_current_cell();
5571 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5573 const unsigned int starting_offset = i1;
5574 local_vertex_order.emplace_back(starting_offset);
5575 local_vertex_order.emplace_back(starting_offset +
5577 flush_current_cell();
5584 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5585 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5587 const unsigned int starting_offset =
5588 i2 * n_points_per_direction + i1;
5589 local_vertex_order.emplace_back(
5591 local_vertex_order.emplace_back(
5592 starting_offset + 1);
5593 local_vertex_order.emplace_back(
5594 starting_offset + n_points_per_direction + 1);
5595 local_vertex_order.emplace_back(
5596 starting_offset + n_points_per_direction);
5597 flush_current_cell();
5604 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5605 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5606 for (
unsigned int i1 = 0; i1 < n_subdivisions;
5609 const unsigned int starting_offset =
5610 i3 * n_points_per_direction *
5611 n_points_per_direction +
5612 i2 * n_points_per_direction + i1;
5613 local_vertex_order.emplace_back(
5615 local_vertex_order.emplace_back(
5616 starting_offset + 1);
5617 local_vertex_order.emplace_back(
5618 starting_offset + n_points_per_direction +
5620 local_vertex_order.emplace_back(
5621 starting_offset + n_points_per_direction);
5622 local_vertex_order.emplace_back(
5623 starting_offset + n_points_per_direction *
5624 n_points_per_direction);
5625 local_vertex_order.emplace_back(
5627 n_points_per_direction *
5628 n_points_per_direction +
5630 local_vertex_order.emplace_back(
5632 n_points_per_direction *
5633 n_points_per_direction +
5634 n_points_per_direction + 1);
5635 local_vertex_order.emplace_back(
5637 n_points_per_direction *
5638 n_points_per_direction +
5639 n_points_per_direction);
5640 flush_current_cell();
5651 local_vertex_order.resize(
5652 Utilities::fixed_power<dim>(n_points_per_direction));
5660 "Point-like cells should not be possible "
5661 "when writing higher-order cells."));
5666 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
5669 const unsigned int local_index = i1;
5670 const unsigned int connectivity_index =
5672 .template vtk_lexicographic_to_node_index<1>(
5676 local_vertex_order[connectivity_index] =
5678 flush_current_cell();
5685 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1;
5687 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
5690 const unsigned int local_index =
5691 i2 * n_points_per_direction + i1;
5692 const unsigned int connectivity_index =
5694 .template vtk_lexicographic_to_node_index<
5696 {{n_subdivisions, n_subdivisions}},
5698 local_vertex_order[connectivity_index] =
5701 flush_current_cell();
5707 for (
unsigned int i3 = 0; i3 < n_subdivisions + 1;
5709 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1;
5711 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
5714 const unsigned int local_index =
5715 i3 * n_points_per_direction *
5716 n_points_per_direction +
5717 i2 * n_points_per_direction + i1;
5718 const unsigned int connectivity_index =
5720 .template vtk_lexicographic_to_node_index<
5726 local_vertex_order[connectivity_index] =
5730 flush_current_cell();
5740 first_vertex_of_patch +=
5749 o << vtu_stringize_array(cells,
5754 o <<
" </DataArray>\n";
5774 const auto stringize_cell_offset_and_type_information =
5779 output_precision = out.precision()]() {
5780 std::ostringstream o;
5782 o <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\""
5783 << ascii_or_binary <<
"\">\n";
5785 std::vector<std::int32_t> offsets;
5786 offsets.reserve(n_cells);
5790 std::vector<unsigned int> cell_types;
5791 cell_types.reserve(n_cells);
5793 unsigned int first_vertex_of_patch = 0;
5795 for (
const auto &patch : patches)
5797 const auto vtk_cell_id =
5800 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
5802 cell_types.push_back(vtk_cell_id[0]);
5803 first_vertex_of_patch += vtk_cell_id[2];
5804 offsets.push_back(first_vertex_of_patch);
5808 o << vtu_stringize_array(offsets,
5812 o <<
" </DataArray>\n";
5814 o <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\""
5815 << ascii_or_binary <<
"\">\n";
5817 if (deal_ii_with_zlib &&
5820 std::vector<std::uint8_t> cell_types_uint8_t(cell_types.size());
5821 for (
unsigned int i = 0; i < cell_types.size(); ++i)
5822 cell_types_uint8_t[i] =
static_cast<std::uint8_t
>(cell_types[i]);
5824 o << vtu_stringize_array(cell_types_uint8_t,
5830 o << vtu_stringize_array(cell_types,
5836 o <<
" </DataArray>\n";
5846 const auto stringize_nonscalar_data_range =
5852 output_precision = out.precision()](
const Table<2, float> &data_vectors,
5853 const auto &range) {
5854 std::ostringstream o;
5856 const auto first_component = std::get<0>(range);
5857 const auto last_component = std::get<1>(range);
5858 const auto &name = std::get<2>(range);
5859 const bool is_tensor =
5860 (std::get<3>(range) ==
5862 const unsigned int n_components = (is_tensor ? 9 : 3);
5869 AssertThrow((last_component + 1 - first_component <= 9),
5871 "Can't declare a tensor with more than 9 components "
5872 "in VTK/VTU format."));
5876 AssertThrow((last_component + 1 - first_component <= 3),
5878 "Can't declare a vector with more than 3 components "
5879 "in VTK/VTU format."));
5884 o <<
" <DataArray type=\"Float32\" Name=\"";
5890 for (
unsigned int i = first_component; i < last_component; ++i)
5891 o << data_names[i] <<
"__";
5892 o << data_names[last_component];
5895 o <<
"\" NumberOfComponents=\"" << n_components <<
"\" format=\""
5896 << ascii_or_binary <<
"\"";
5915 std::vector<float>
data;
5916 data.reserve(n_nodes * n_components);
5918 for (
unsigned int n = 0; n < n_nodes; ++n)
5922 switch (last_component - first_component)
5925 data.push_back(data_vectors(first_component, n));
5931 data.push_back(data_vectors(first_component, n));
5932 data.push_back(data_vectors(first_component + 1, n));
5937 data.push_back(data_vectors(first_component, n));
5938 data.push_back(data_vectors(first_component + 1, n));
5939 data.push_back(data_vectors(first_component + 2, n));
5952 const unsigned int size = last_component - first_component + 1;
5956 vtk_data[0][0] = data_vectors(first_component, n);
5961 for (
unsigned int c = 0; c <
size; ++c)
5965 vtk_data[ind[0]][ind[1]] =
5966 data_vectors(first_component + c, n);
5972 for (
unsigned int c = 0; c <
size; ++c)
5976 vtk_data[ind[0]][ind[1]] =
5977 data_vectors(first_component + c, n);
5988 for (
unsigned int i = 0; i < 3; ++i)
5989 for (
unsigned int j = 0; j < 3; ++j)
5990 data.push_back(vtk_data[i][j]);
5994 o << vtu_stringize_array(
data,
5998 o <<
" </DataArray>\n";
6003 const auto stringize_scalar_data_set =
6007 output_precision = out.precision()](
const Table<2, float> &data_vectors,
6008 const unsigned int data_set) {
6009 std::ostringstream o;
6011 o <<
" <DataArray type=\"Float32\" Name=\"" << data_names[data_set]
6012 <<
"\" format=\"" << ascii_or_binary <<
"\"";
6016 o <<
" units=\"" << flags.
physical_units.at(data_names[data_set])
6021 const std::vector<float>
data(data_vectors[data_set].begin(),
6022 data_vectors[data_set].end());
6023 o << vtu_stringize_array(
data,
6027 o <<
" </DataArray>\n";
6046 return create_global_data_table<dim, spacedim, float>(patches);
6060 std::move(*create_global_data_table_task.
return_value());
6066 std::vector<bool> data_set_handled(n_data_sets,
false);
6067 for (
const auto &range : nonscalar_data_ranges)
6070 const auto first_component = std::get<0>(range);
6071 const auto last_component = std::get<1>(range);
6072 for (
unsigned int i = first_component; i <= last_component; ++i)
6073 data_set_handled[i] =
true;
6076 return stringize_nonscalar_data_range(data_vectors, range);
6081 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6082 if (data_set_handled[data_set] ==
false)
6085 return stringize_scalar_data_set(data_vectors, data_set);
6091 out <<
"<Piece NumberOfPoints=\"" << n_nodes <<
"\" NumberOfCells=\""
6092 << n_cells <<
"\" >\n";
6093 for (
const auto &s : mesh_tasks.return_values())
6095 out <<
" <PointData Scalars=\"scalars\">\n";
6098 out <<
" </PointData>\n";
6099 out <<
" </Piece>\n";
6113 const std::vector<std::string> &piece_names,
6114 const std::vector<std::string> &data_names,
6116 std::tuple<
unsigned int,
6120 &nonscalar_data_ranges,
6133 unit.second.find(
'\"') == std::string::npos,
6135 "A physical unit you provided, <" + unit.second +
6136 ">, contained a quotation mark character. This is not allowed."));
6139 const unsigned int n_data_sets = data_names.size();
6141 out <<
"<?xml version=\"1.0\"?>\n";
6144 out <<
"#This file was generated by the deal.II library"
6149 <<
"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
6150 out <<
" <PUnstructuredGrid GhostLevel=\"0\">\n";
6151 out <<
" <PPointData Scalars=\"scalars\">\n";
6154 std::vector<bool> data_set_written(n_data_sets,
false);
6155 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
6157 const auto first_component = std::get<0>(nonscalar_data_range);
6158 const auto last_component = std::get<1>(nonscalar_data_range);
6159 const bool is_tensor =
6160 (std::get<3>(nonscalar_data_range) ==
6162 const unsigned int n_components = (is_tensor ? 9 : 3);
6169 AssertThrow((last_component + 1 - first_component <= 9),
6171 "Can't declare a tensor with more than 9 components "
6176 Assert((last_component + 1 - first_component <= 3),
6178 "Can't declare a vector with more than 3 components "
6183 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6184 i <= std::get<1>(nonscalar_data_range);
6186 data_set_written[i] =
true;
6190 out <<
" <PDataArray type=\"Float32\" Name=\"";
6192 const std::string &name = std::get<2>(nonscalar_data_range);
6197 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6198 i < std::get<1>(nonscalar_data_range);
6200 out << data_names[i] <<
"__";
6201 out << data_names[std::get<1>(nonscalar_data_range)];
6204 out <<
"\" NumberOfComponents=\"" << n_components
6205 <<
"\" format=\"ascii\"";
6217 data_names[std::get<1>(nonscalar_data_range)]) !=
6221 data_names[std::get<1>(nonscalar_data_range)])
6229 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6230 if (data_set_written[data_set] ==
false)
6232 out <<
" <PDataArray type=\"Float32\" Name=\""
6233 << data_names[data_set] <<
"\" format=\"ascii\"";
6237 out <<
" units=\"" << flags.
physical_units.at(data_names[data_set])
6243 out <<
" </PPointData>\n";
6245 out <<
" <PPoints>\n";
6246 out <<
" <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
6247 out <<
" </PPoints>\n";
6249 for (
const auto &piece_name : piece_names)
6250 out <<
" <Piece Source=\"" << piece_name <<
"\"/>\n";
6252 out <<
" </PUnstructuredGrid>\n";
6253 out <<
"</VTKFile>\n";
6266 const std::vector<std::pair<double, std::string>> ×_and_names)
6270 out <<
"<?xml version=\"1.0\"?>\n";
6273 out <<
"#This file was generated by the deal.II library"
6278 <<
"<VTKFile type=\"Collection\" version=\"0.1\" ByteOrder=\"LittleEndian\">\n";
6279 out <<
" <Collection>\n";
6281 std::streamsize ss = out.precision();
6284 for (
const auto &time_and_name : times_and_names)
6285 out <<
" <DataSet timestep=\"" << time_and_name.first
6286 <<
"\" group=\"\" part=\"0\" file=\"" << time_and_name.second
6289 out <<
" </Collection>\n";
6290 out <<
"</VTKFile>\n";
6302 const std::vector<std::string> &piece_names)
6304 out <<
"!NBLOCKS " << piece_names.size() <<
'\n';
6305 for (
const auto &piece_name : piece_names)
6306 out << piece_name <<
'\n';
6315 const std::vector<std::vector<std::string>> &piece_names)
6319 if (piece_names.empty())
6322 const double nblocks = piece_names[0].size();
6324 ExcMessage(
"piece_names should be a vector of nonempty vectors."));
6326 out <<
"!NBLOCKS " << nblocks <<
'\n';
6327 for (
const auto &domain : piece_names)
6329 Assert(domain.size() == nblocks,
6331 "piece_names should be a vector of equal sized vectors."));
6332 for (
const auto &subdomain : domain)
6333 out << subdomain <<
'\n';
6344 const std::vector<std::pair<
double, std::vector<std::string>>>
6345 ×_and_piece_names)
6349 if (times_and_piece_names.empty())
6352 const double nblocks = times_and_piece_names[0].second.size();
6356 "time_and_piece_names should contain nonempty vectors of filenames for every timestep."));
6358 for (
const auto &domain : times_and_piece_names)
6359 out <<
"!TIME " << domain.first <<
'\n';
6361 out <<
"!NBLOCKS " << nblocks <<
'\n';
6362 for (
const auto &domain : times_and_piece_names)
6364 Assert(domain.second.size() == nblocks,
6366 "piece_names should be a vector of equal sized vectors."));
6367 for (
const auto &subdomain : domain.second)
6368 out << subdomain <<
'\n';
6376 template <
int dim,
int spacedim>
6380 const std::vector<std::string> &,
6382 std::tuple<
unsigned int,
6392 template <
int spacedim>
6396 const std::vector<std::string> & ,
6398 std::tuple<
unsigned int,
6406 const unsigned int height = flags.
height;
6407 unsigned int width = flags.
width;
6410 unsigned int margin_in_percent = 0;
6412 margin_in_percent = 5;
6416 double x_dimension, y_dimension, z_dimension;
6418 const auto &first_patch = patches[0];
6420 unsigned int n_subdivisions = first_patch.n_subdivisions;
6421 unsigned int n = n_subdivisions + 1;
6422 const unsigned int d1 = 1;
6423 const unsigned int d2 = n;
6426 std::array<Point<spacedim>, 4> projected_points;
6429 std::array<Point<2>, 4> projection_decompositions;
6432 get_equispaced_location(first_patch, {0, 0}, n_subdivisions);
6434 if (first_patch.data.n_rows() != 0)
6439 double x_min = projected_point[0];
6440 double x_max = x_min;
6441 double y_min = projected_point[1];
6442 double y_max = y_min;
6443 double z_min = first_patch.data.n_rows() != 0 ?
6446 double z_max = z_min;
6449 for (
const auto &patch : patches)
6452 n = n_subdivisions + 1;
6454 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6456 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6458 projected_points[0] =
6459 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
6460 projected_points[1] =
6461 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
6462 projected_points[2] =
6463 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
6464 projected_points[3] = get_equispaced_location(patch,
6468 x_min =
std::min(x_min, projected_points[0][0]);
6469 x_min =
std::min(x_min, projected_points[1][0]);
6470 x_min =
std::min(x_min, projected_points[2][0]);
6471 x_min =
std::min(x_min, projected_points[3][0]);
6473 x_max =
std::max(x_max, projected_points[0][0]);
6474 x_max =
std::max(x_max, projected_points[1][0]);
6475 x_max =
std::max(x_max, projected_points[2][0]);
6476 x_max =
std::max(x_max, projected_points[3][0]);
6478 y_min =
std::min(y_min, projected_points[0][1]);
6479 y_min =
std::min(y_min, projected_points[1][1]);
6480 y_min =
std::min(y_min, projected_points[2][1]);
6481 y_min =
std::min(y_min, projected_points[3][1]);
6483 y_max =
std::max(y_max, projected_points[0][1]);
6484 y_max =
std::max(y_max, projected_points[1][1]);
6485 y_max =
std::max(y_max, projected_points[2][1]);
6486 y_max =
std::max(y_max, projected_points[3][1]);
6489 patch.
data.n_rows() == 0,
6492 patch.
data.n_rows()));
6494 z_min = std::min<double>(z_min,
6496 i1 * d1 + i2 * d2));
6497 z_min = std::min<double>(z_min,
6499 (i1 + 1) * d1 + i2 * d2));
6500 z_min = std::min<double>(z_min,
6502 i1 * d1 + (i2 + 1) * d2));
6504 std::min<double>(z_min,
6506 (i1 + 1) * d1 + (i2 + 1) * d2));
6508 z_max = std::max<double>(z_max,
6510 i1 * d1 + i2 * d2));
6511 z_max = std::max<double>(z_max,
6513 (i1 + 1) * d1 + i2 * d2));
6514 z_max = std::max<double>(z_max,
6516 i1 * d1 + (i2 + 1) * d2));
6518 std::max<double>(z_max,
6520 (i1 + 1) * d1 + (i2 + 1) * d2));
6525 x_dimension = x_max - x_min;
6526 y_dimension = y_max - y_min;
6527 z_dimension = z_max - z_min;
6534 float camera_focus = 0;
6537 camera_position[0] = 0.;
6538 camera_position[1] = 0.;
6539 camera_position[2] = z_min + 2. * z_dimension;
6541 camera_direction[0] = 0.;
6542 camera_direction[1] = 0.;
6543 camera_direction[2] = -1.;
6545 camera_horizontal[0] = 1.;
6546 camera_horizontal[1] = 0.;
6547 camera_horizontal[2] = 0.;
6549 camera_focus = .5 * z_dimension;
6555 const float angle_factor = 3.14159265f / 180.f;
6558 camera_position_temp[1] =
6561 camera_position_temp[2] =
6565 camera_direction_temp[1] =
6568 camera_direction_temp[2] =
6572 camera_horizontal_temp[1] =
6575 camera_horizontal_temp[2] =
6579 camera_position[1] = camera_position_temp[1];
6580 camera_position[2] = camera_position_temp[2];
6582 camera_direction[1] = camera_direction_temp[1];
6583 camera_direction[2] = camera_direction_temp[2];
6585 camera_horizontal[1] = camera_horizontal_temp[1];
6586 camera_horizontal[2] = camera_horizontal_temp[2];
6589 camera_position_temp[0] =
6592 camera_position_temp[1] =
6596 camera_direction_temp[0] =
6599 camera_direction_temp[1] =
6603 camera_horizontal_temp[0] =
6606 camera_horizontal_temp[1] =
6610 camera_position[0] = camera_position_temp[0];
6611 camera_position[1] = camera_position_temp[1];
6613 camera_direction[0] = camera_direction_temp[0];
6614 camera_direction[1] = camera_direction_temp[1];
6616 camera_horizontal[0] = camera_horizontal_temp[0];
6617 camera_horizontal[1] = camera_horizontal_temp[1];
6620 camera_position[0] = x_min + .5 * x_dimension;
6621 camera_position[1] = y_min + .5 * y_dimension;
6623 camera_position[0] += (z_min + 2. * z_dimension) *
6626 camera_position[1] -= (z_min + 2. * z_dimension) *
6632 double x_min_perspective, y_min_perspective;
6633 double x_max_perspective, y_max_perspective;
6634 double x_dimension_perspective, y_dimension_perspective;
6636 n_subdivisions = first_patch.n_subdivisions;
6637 n = n_subdivisions + 1;
6642 get_equispaced_location(first_patch, {0, 0}, n_subdivisions);
6644 if (first_patch.data.n_rows() != 0)
6649 point[0] = projected_point[0];
6650 point[1] = projected_point[1];
6651 point[2] = first_patch.data.n_rows() != 0 ?
6655 projection_decomposition = svg_project_point(point,
6661 x_min_perspective = projection_decomposition[0];
6662 x_max_perspective = projection_decomposition[0];
6663 y_min_perspective = projection_decomposition[1];
6664 y_max_perspective = projection_decomposition[1];
6667 for (
const auto &patch : patches)
6670 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6672 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6674 const std::array<Point<spacedim>, 4> projected_vertices{
6675 {get_equispaced_location(patch, {i1, i2}, n_subdivisions),
6676 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions),
6677 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions),
6678 get_equispaced_location(patch,
6683 patch.
data.n_rows() == 0,
6686 patch.
data.n_rows()));
6688 const std::array<Point<3>, 4> vertices = {
6689 {
Point<3>{projected_vertices[0][0],
6690 projected_vertices[0][1],
6691 patch.
data.n_rows() != 0 ?
6692 patch.
data(0, i1 * d1 + i2 * d2) :
6695 projected_vertices[1][1],
6696 patch.
data.n_rows() != 0 ?
6697 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6700 projected_vertices[2][1],
6701 patch.
data.n_rows() != 0 ?
6702 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6705 projected_vertices[3][1],
6706 patch.
data.n_rows() != 0 ?
6707 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6710 projection_decompositions = {
6711 {svg_project_point(vertices[0],
6716 svg_project_point(vertices[1],
6721 svg_project_point(vertices[2],
6726 svg_project_point(vertices[3],
6734 static_cast<double>(
6735 projection_decompositions[0][0]));
6738 static_cast<double>(
6739 projection_decompositions[1][0]));
6742 static_cast<double>(
6743 projection_decompositions[2][0]));
6746 static_cast<double>(
6747 projection_decompositions[3][0]));
6751 static_cast<double>(
6752 projection_decompositions[0][0]));
6755 static_cast<double>(
6756 projection_decompositions[1][0]));
6759 static_cast<double>(
6760 projection_decompositions[2][0]));
6763 static_cast<double>(
6764 projection_decompositions[3][0]));
6768 static_cast<double>(
6769 projection_decompositions[0][1]));
6772 static_cast<double>(
6773 projection_decompositions[1][1]));
6776 static_cast<double>(
6777 projection_decompositions[2][1]));
6780 static_cast<double>(
6781 projection_decompositions[3][1]));
6785 static_cast<double>(
6786 projection_decompositions[0][1]));
6789 static_cast<double>(
6790 projection_decompositions[1][1]));
6793 static_cast<double>(
6794 projection_decompositions[2][1]));
6797 static_cast<double>(
6798 projection_decompositions[3][1]));
6803 x_dimension_perspective = x_max_perspective - x_min_perspective;
6804 y_dimension_perspective = y_max_perspective - y_min_perspective;
6806 std::multiset<SvgCell> cells;
6809 for (
const auto &patch : patches)
6813 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6815 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6817 const std::array<Point<spacedim>, 4> projected_vertices = {
6818 {get_equispaced_location(patch, {i1, i2}, n_subdivisions),
6819 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions),
6820 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions),
6821 get_equispaced_location(patch,
6826 patch.
data.n_rows() == 0,
6829 patch.
data.n_rows()));
6833 cell.vertices[0][0] = projected_vertices[0][0];
6834 cell.vertices[0][1] = projected_vertices[0][1];
6835 cell.vertices[0][2] = patch.
data.n_rows() != 0 ?
6836 patch.
data(0, i1 * d1 + i2 * d2) :
6839 cell.vertices[1][0] = projected_vertices[1][0];
6840 cell.vertices[1][1] = projected_vertices[1][1];
6841 cell.vertices[1][2] = patch.
data.n_rows() != 0 ?
6842 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6845 cell.vertices[2][0] = projected_vertices[2][0];
6846 cell.vertices[2][1] = projected_vertices[2][1];
6847 cell.vertices[2][2] = patch.
data.n_rows() != 0 ?
6848 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6851 cell.vertices[3][0] = projected_vertices[3][0];
6852 cell.vertices[3][1] = projected_vertices[3][1];
6853 cell.vertices[3][2] =
6854 patch.
data.n_rows() != 0 ?
6855 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6858 cell.projected_vertices[0] =
6859 svg_project_point(cell.vertices[0],
6864 cell.projected_vertices[1] =
6865 svg_project_point(cell.vertices[1],
6870 cell.projected_vertices[2] =
6871 svg_project_point(cell.vertices[2],
6876 cell.projected_vertices[3] =
6877 svg_project_point(cell.vertices[3],
6883 cell.center = .25 * (cell.vertices[0] + cell.vertices[1] +
6884 cell.vertices[2] + cell.vertices[3]);
6885 cell.projected_center = svg_project_point(cell.center,
6891 cell.depth = cell.center.distance(camera_position);
6901 width =
static_cast<unsigned int>(
6902 .5 + height * (x_dimension_perspective / y_dimension_perspective));
6903 unsigned int additional_width = 0;
6906 additional_width =
static_cast<unsigned int>(
6910 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\""
6911 << height <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">"
6913 <<
" <rect width=\"" << width + additional_width <<
"\" height=\""
6914 << height <<
"\" style=\"fill:white\"/>" <<
'\n'
6917 unsigned int triangle_counter = 0;
6920 for (
const auto &cell : cells)
6924 for (
unsigned int triangle_index = 0; triangle_index < 4;
6927 switch (triangle_index)
6930 points3d_triangle[0] = cell.vertices[0],
6931 points3d_triangle[1] = cell.vertices[1],
6932 points3d_triangle[2] = cell.center;
6935 points3d_triangle[0] = cell.vertices[1],
6936 points3d_triangle[1] = cell.vertices[3],
6937 points3d_triangle[2] = cell.center;
6940 points3d_triangle[0] = cell.vertices[3],
6941 points3d_triangle[1] = cell.vertices[2],
6942 points3d_triangle[2] = cell.center;
6945 points3d_triangle[0] = cell.vertices[2],
6946 points3d_triangle[1] = cell.vertices[0],
6947 points3d_triangle[2] = cell.center;
6954 svg_get_gradient_parameters(points3d_triangle);
6957 .667 - ((gradient_param[4] - z_min) / z_dimension) * .667;
6959 .667 - ((gradient_param[5] - z_min) / z_dimension) * .667;
6961 unsigned int start_r = 0;
6962 unsigned int start_g = 0;
6963 unsigned int start_b = 0;
6965 unsigned int stop_r = 0;
6966 unsigned int stop_g = 0;
6967 unsigned int stop_b = 0;
6969 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
6970 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
6972 double start_f = start_h * 6. - start_i;
6973 double start_q = 1. - start_f;
6975 double stop_f = stop_h * 6. - stop_i;
6976 double stop_q = 1. - stop_f;
6978 switch (start_i % 6)
6982 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
6985 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
6990 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
6993 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
6997 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
7002 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7012 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7015 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7020 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7023 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7027 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7032 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7038 Point<3> gradient_start_point_3d, gradient_stop_point_3d;
7040 gradient_start_point_3d[0] = gradient_param[0];
7041 gradient_start_point_3d[1] = gradient_param[1];
7042 gradient_start_point_3d[2] = gradient_param[4];
7044 gradient_stop_point_3d[0] = gradient_param[2];
7045 gradient_stop_point_3d[1] = gradient_param[3];
7046 gradient_stop_point_3d[2] = gradient_param[5];
7049 svg_project_point(gradient_start_point_3d,
7055 svg_project_point(gradient_stop_point_3d,
7062 out <<
" <linearGradient id=\"" << triangle_counter
7063 <<
"\" gradientUnits=\"userSpaceOnUse\" "
7065 <<
static_cast<unsigned int>(
7067 ((gradient_start_point[0] - x_min_perspective) /
7068 x_dimension_perspective) *
7069 (width - (width / 100.) * 2. * margin_in_percent) +
7070 ((width / 100.) * margin_in_percent))
7073 <<
static_cast<unsigned int>(
7074 .5 + height - (height / 100.) * margin_in_percent -
7075 ((gradient_start_point[1] - y_min_perspective) /
7076 y_dimension_perspective) *
7077 (height - (height / 100.) * 2. * margin_in_percent))
7080 <<
static_cast<unsigned int>(
7082 ((gradient_stop_point[0] - x_min_perspective) /
7083 x_dimension_perspective) *
7084 (width - (width / 100.) * 2. * margin_in_percent) +
7085 ((width / 100.) * margin_in_percent))
7088 <<
static_cast<unsigned int>(
7089 .5 + height - (height / 100.) * margin_in_percent -
7090 ((gradient_stop_point[1] - y_min_perspective) /
7091 y_dimension_perspective) *
7092 (height - (height / 100.) * 2. * margin_in_percent))
7095 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7096 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n'
7097 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7098 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n'
7099 <<
" </linearGradient>" <<
'\n';
7102 double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
7103 double x3 = cell.projected_center[0];
7104 double y3 = cell.projected_center[1];
7106 switch (triangle_index)
7109 x1 = cell.projected_vertices[0][0],
7110 y1 = cell.projected_vertices[0][1],
7111 x2 = cell.projected_vertices[1][0],
7112 y2 = cell.projected_vertices[1][1];
7115 x1 = cell.projected_vertices[1][0],
7116 y1 = cell.projected_vertices[1][1],
7117 x2 = cell.projected_vertices[3][0],
7118 y2 = cell.projected_vertices[3][1];
7121 x1 = cell.projected_vertices[3][0],
7122 y1 = cell.projected_vertices[3][1],
7123 x2 = cell.projected_vertices[2][0],
7124 y2 = cell.projected_vertices[2][1];
7127 x1 = cell.projected_vertices[2][0],
7128 y1 = cell.projected_vertices[2][1],
7129 x2 = cell.projected_vertices[0][0],
7130 y2 = cell.projected_vertices[0][1];
7136 out <<
" <path d=\"M "
7137 <<
static_cast<unsigned int>(
7139 ((x1 - x_min_perspective) / x_dimension_perspective) *
7140 (width - (width / 100.) * 2. * margin_in_percent) +
7141 ((width / 100.) * margin_in_percent))
7143 <<
static_cast<unsigned int>(
7144 .5 + height - (height / 100.) * margin_in_percent -
7145 ((y1 - y_min_perspective) / y_dimension_perspective) *
7146 (height - (height / 100.) * 2. * margin_in_percent))
7148 <<
static_cast<unsigned int>(
7150 ((x2 - x_min_perspective) / x_dimension_perspective) *
7151 (width - (width / 100.) * 2. * margin_in_percent) +
7152 ((width / 100.) * margin_in_percent))
7154 <<
static_cast<unsigned int>(
7155 .5 + height - (height / 100.) * margin_in_percent -
7156 ((y2 - y_min_perspective) / y_dimension_perspective) *
7157 (height - (height / 100.) * 2. * margin_in_percent))
7159 <<
static_cast<unsigned int>(
7161 ((x3 - x_min_perspective) / x_dimension_perspective) *
7162 (width - (width / 100.) * 2. * margin_in_percent) +
7163 ((width / 100.) * margin_in_percent))
7165 <<
static_cast<unsigned int>(
7166 .5 + height - (height / 100.) * margin_in_percent -
7167 ((y3 - y_min_perspective) / y_dimension_perspective) *
7168 (height - (height / 100.) * 2. * margin_in_percent))
7170 <<
static_cast<unsigned int>(
7172 ((x1 - x_min_perspective) / x_dimension_perspective) *
7173 (width - (width / 100.) * 2. * margin_in_percent) +
7174 ((width / 100.) * margin_in_percent))
7176 <<
static_cast<unsigned int>(
7177 .5 + height - (height / 100.) * margin_in_percent -
7178 ((y1 - y_min_perspective) / y_dimension_perspective) *
7179 (height - (height / 100.) * 2. * margin_in_percent))
7180 <<
"\" style=\"stroke:black; fill:url(#" << triangle_counter
7191 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
7193 unsigned int element_height =
static_cast<unsigned int>(
7194 ((height / 100.) * (71. - 2. * margin_in_percent)) / 4);
7195 unsigned int element_width =
7196 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7198 additional_width = 0;
7201 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7203 for (
unsigned int index = 0; index < 4; ++index)
7205 double start_h = .667 - ((index + 1) / 4.) * .667;
7206 double stop_h = .667 - (index / 4.) * .667;
7208 unsigned int start_r = 0;
7209 unsigned int start_g = 0;
7210 unsigned int start_b = 0;
7212 unsigned int stop_r = 0;
7213 unsigned int stop_g = 0;
7214 unsigned int stop_b = 0;
7216 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
7217 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
7219 double start_f = start_h * 6. - start_i;
7220 double start_q = 1. - start_f;
7222 double stop_f = stop_h * 6. - stop_i;
7223 double stop_q = 1. - stop_f;
7225 switch (start_i % 6)
7229 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
7232 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
7237 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
7240 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
7244 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
7249 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7259 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7262 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7267 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7270 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7274 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7279 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7286 out <<
" <linearGradient id=\"colorbar_" << index
7287 <<
"\" gradientUnits=\"userSpaceOnUse\" "
7288 <<
"x1=\"" << width + additional_width <<
"\" "
7290 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7291 (margin_in_percent + 29)) +
7292 (3 - index) * element_height
7294 <<
"x2=\"" << width + additional_width <<
"\" "
7296 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7297 (margin_in_percent + 29)) +
7298 (4 - index) * element_height
7301 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7302 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n'
7303 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7304 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n'
7305 <<
" </linearGradient>" <<
'\n';
7310 <<
" x=\"" << width + additional_width <<
"\" y=\""
7311 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7312 (margin_in_percent + 29)) +
7313 (3 - index) * element_height
7314 <<
"\" width=\"" << element_width <<
"\" height=\""
7316 <<
"\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_"
7317 << index <<
")\"/>" <<
'\n';
7320 for (
unsigned int index = 0; index < 5; ++index)
7324 << width + additional_width +
7325 static_cast<unsigned int>(1.5 * element_width)
7327 <<
static_cast<unsigned int>(
7328 .5 + (height / 100.) * (margin_in_percent + 29) +
7329 (4. - index) * element_height + 30.)
7331 <<
" style=\"text-anchor:start; font-size:80; font-family:Helvetica";
7333 if (index == 0 || index == 4)
7334 out <<
"; font-weight:bold";
7337 <<
static_cast<float>(
7338 (
static_cast<int>((z_min + index * (z_dimension / 4.)) *
7347 out <<
"</text>" <<
'\n';
7352 out <<
'\n' <<
"</svg>";
7358 template <
int dim,
int spacedim>
7362 const std::vector<std::string> &data_names,
7364 std::tuple<
unsigned int,
7368 &nonscalar_data_ranges,
7377 out << dim <<
' ' << spacedim <<
'\n';
7380 out <<
"[deal.II intermediate format graphics data]" <<
'\n'
7386 out << data_names.size() <<
'\n';
7387 for (
const auto &data_name : data_names)
7388 out << data_name <<
'\n';
7390 out << patches.size() <<
'\n';
7391 for (
unsigned int i = 0; i < patches.size(); ++i)
7392 out << patches[i] <<
'\n';
7394 out << nonscalar_data_ranges.size() <<
'\n';
7395 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
7396 out << std::get<0>(nonscalar_data_range) <<
' '
7397 << std::get<1>(nonscalar_data_range) <<
'\n'
7398 << std::get<2>(nonscalar_data_range) <<
'\n';
7406 template <
int dim,
int spacedim>
7410 const std::vector<std::string> &data_names,
7412 std::tuple<
unsigned int,
7416 &nonscalar_data_ranges,
7418 const std::string &filename,
7422#ifndef DEAL_II_WITH_MPI
7425 (void)nonscalar_data_ranges;
7432 ExcMessage(
"This functionality requires MPI to be enabled."));
7451 std::vector<char> my_buffer;
7453 boost::iostreams::filtering_ostream f;
7459# ifdef DEAL_II_WITH_ZLIB
7460 f.push(boost::iostreams::zlib_compressor(
7461 get_boost_zlib_compression_level(compression)));
7466 "Compression requires deal.II to be configured with ZLIB support."));
7469 boost::iostreams::back_insert_device<std::vector<char>> inserter(
7473 write_deal_II_intermediate<dim, spacedim>(
7474 patches, data_names, nonscalar_data_ranges, flags, f);
7476 const std::uint64_t my_size = my_buffer.size();
7482 const ParallelIntermediateHeader header{
7485 static_cast<std::uint64_t
>(compression),
7495 std::vector<std::uint64_t> chunk_sizes(n_ranks);
7496 int ierr = MPI_Gather(&my_size,
7499 static_cast<std::uint64_t *
>(chunk_sizes.data()),
7507 ierr = MPI_Info_create(&info);
7510 ierr = MPI_File_open(
7511 comm, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh);
7513 ierr = MPI_Info_free(&info);
7517 ierr = MPI_File_set_size(fh, 0);
7521 ierr = MPI_Barrier(
comm);
7528 fh, 0, &header,
sizeof(header), MPI_CHAR, MPI_STATUS_IGNORE);
7543 std::uint64_t prefix_sum = 0;
7544 ierr = MPI_Exscan(&my_size, &prefix_sum, 1, MPI_UINT64_T, MPI_SUM,
comm);
7548 const MPI_Offset offset =
static_cast<MPI_Offset
>(
sizeof(header)) +
7549 n_ranks *
sizeof(std::uint64_t) + prefix_sum;
7552 fh, offset, my_buffer.data(), my_size, MPI_CHAR, MPI_STATUS_IGNORE);
7561 ierr = MPI_File_sync(fh);
7564 ierr = MPI_File_close(&fh);
7571 std::pair<unsigned int, unsigned int>
7576 unsigned int dim, spacedim;
7577 input >> dim >> spacedim;
7579 return std::make_pair(dim, spacedim);
7588template <
int dim,
int spacedim>
7590 : default_subdivisions(1)
7596template <
int dim,
int spacedim>
7601 get_dataset_names(),
7602 get_nonscalar_data_ranges(),
7609template <
int dim,
int spacedim>
7614 get_dataset_names(),
7615 get_nonscalar_data_ranges(),
7622template <
int dim,
int spacedim>
7627 get_dataset_names(),
7628 get_nonscalar_data_ranges(),
7635template <
int dim,
int spacedim>
7640 get_dataset_names(),
7641 get_nonscalar_data_ranges(),
7648template <
int dim,
int spacedim>
7653 get_dataset_names(),
7654 get_nonscalar_data_ranges(),
7661template <
int dim,
int spacedim>
7666 get_dataset_names(),
7667 get_nonscalar_data_ranges(),
7674template <
int dim,
int spacedim>
7679 get_dataset_names(),
7680 get_nonscalar_data_ranges(),
7687template <
int dim,
int spacedim>
7692 get_dataset_names(),
7693 get_nonscalar_data_ranges(),
7698template <
int dim,
int spacedim>
7703 get_dataset_names(),
7704 get_nonscalar_data_ranges(),
7709template <
int dim,
int spacedim>
7714 get_dataset_names(),
7715 get_nonscalar_data_ranges(),
7721template <
int dim,
int spacedim>
7724 const std::string &filename,
7727#ifndef DEAL_II_WITH_MPI
7731 std::ofstream f(filename);
7739 int ierr = MPI_Info_create(&info);
7742 ierr = MPI_File_open(
7743 comm, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh);
7746 ierr = MPI_File_set_size(fh, 0);
7750 ierr = MPI_Barrier(
comm);
7752 ierr = MPI_Info_free(&info);
7756 unsigned int header_size;
7757 std::uint64_t footer_offset;
7762 std::stringstream ss;
7764 header_size = ss.str().size();
7767 fh, 0, ss.str().c_str(), header_size, MPI_CHAR, MPI_STATUS_IGNORE);
7771 ierr = MPI_Bcast(&header_size, 1, MPI_UNSIGNED, 0,
comm);
7775 const auto &patches = get_patches();
7784 std::stringstream ss;
7785 if (my_n_patches > 0 || (global_n_patches == 0 && myrank == 0))
7787 get_dataset_names(),
7788 get_nonscalar_data_ranges(),
7793 const std::uint64_t size_on_proc = ss.str().size();
7794 std::uint64_t prefix_sum = 0;
7796 MPI_Exscan(&size_on_proc, &prefix_sum, 1, MPI_UINT64_T, MPI_SUM,
comm);
7800 const MPI_Offset offset =
static_cast<MPI_Offset
>(header_size) + prefix_sum;
7810 if (myrank == n_ranks - 1)
7813 footer_offset = size_on_proc + offset;
7815 std::stringstream ss;
7817 const unsigned int footer_size = ss.str().size();
7835 ierr = MPI_File_sync(fh);
7838 ierr = MPI_File_close(&fh);
7845template <
int dim,
int spacedim>
7849 const std::vector<std::string> &piece_names)
const
7853 get_dataset_names(),
7854 get_nonscalar_data_ranges(),
7860template <
int dim,
int spacedim>
7863 const std::string &directory,
7864 const std::string &filename_without_extension,
7865 const unsigned int counter,
7867 const unsigned int n_digits_for_counter,
7868 const unsigned int n_groups)
const
7871 const unsigned int n_ranks =
7873 const unsigned int n_files_written =
7874 (n_groups == 0 || n_groups > n_ranks) ? n_ranks : n_groups;
7879 const unsigned int n_digits =
7882 const unsigned int color = rank % n_files_written;
7883 const std::string filename =
7884 directory + filename_without_extension +
"_" +
7888 if (n_groups == 0 || n_groups > n_ranks)
7891 std::ofstream output(filename);
7893 this->write_vtu(output);
7895 else if (n_groups == 1)
7898 this->write_vtu_in_parallel(filename, mpi_communicator);
7902#ifdef DEAL_II_WITH_MPI
7905 int ierr = MPI_Comm_split(mpi_communicator, color, rank, &comm_group);
7907 this->write_vtu_in_parallel(filename, comm_group);
7915 const std::string pvtu_filename =
7916 filename_without_extension +
"_" +
7921 std::vector<std::string> filename_vector;
7922 for (
unsigned int i = 0; i < n_files_written; ++i)
7924 const std::string filename =
7925 filename_without_extension +
"_" +
7929 filename_vector.emplace_back(filename);
7932 std::ofstream pvtu_output(directory + pvtu_filename);
7933 this->write_pvtu_record(pvtu_output, filename_vector);
7936 return pvtu_filename;
7941template <
int dim,
int spacedim>
7944 std::ostream &out)
const
7947 get_dataset_names(),
7948 get_nonscalar_data_ranges(),
7949 deal_II_intermediate_flags,
7955template <
int dim,
int spacedim>
7958 const std::string &filename,
7964 get_dataset_names(),
7965 get_nonscalar_data_ranges(),
7966 deal_II_intermediate_flags,
7974template <
int dim,
int spacedim>
7978 const std::string &h5_filename,
7979 const double cur_time,
7982 return create_xdmf_entry(
7983 data_filter, h5_filename, h5_filename, cur_time,
comm);
7988template <
int dim,
int spacedim>
7992 const std::string &h5_mesh_filename,
7993 const std::string &h5_solution_filename,
7994 const double cur_time,
7998 ExcMessage(
"XDMF only supports 2 or 3 space dimensions."));
8000#ifndef DEAL_II_WITH_HDF5
8004 (void)h5_mesh_filename;
8005 (void)h5_solution_filename;
8014 std::uint64_t local_node_cell_count[2], global_node_cell_count[2];
8016 local_node_cell_count[0] = data_filter.
n_nodes();
8017 local_node_cell_count[1] = data_filter.
n_cells();
8021 int ierr = MPI_Allreduce(local_node_cell_count,
8022 global_node_cell_count,
8036 const bool have_data = (data_filter.
n_nodes() > 0);
8039 const int key = myrank;
8040 const int color = (have_data ? 1 : 0);
8041 const int ierr = MPI_Comm_split(
comm, color, key, &split_comm);
8045 const bool am_i_first_rank_with_data =
8048 ierr = MPI_Comm_free(&split_comm);
8051 const int tag = 47381;
8054 if (am_i_first_rank_with_data)
8056 const auto &patches = get_patches();
8062 for (
const auto &patch : patches)
8068 h5_solution_filename,
8070 global_node_cell_count[0],
8071 global_node_cell_count[1],
8074 patches[0].reference_cell);
8075 const unsigned int n_data_sets = data_filter.
n_data_sets();
8079 for (
unsigned int i = 0; i < n_data_sets; ++i)
8089 ierr = MPI_Send(buffer.data(), buffer.size(), MPI_BYTE, 0, tag,
comm);
8098 if (myrank == 0 && !am_i_first_rank_with_data)
8103 int ierr = MPI_Probe(MPI_ANY_SOURCE, tag,
comm, &status);
8107 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
8110 std::vector<char> buffer(len);
8111 ierr = MPI_Recv(buffer.data(),
8120 return Utilities::unpack<XDMFEntry>(buffer,
false);
8128template <
int dim,
int spacedim>
8131 const std::vector<XDMFEntry> &entries,
8132 const std::string &filename,
8135#ifdef DEAL_II_WITH_MPI
8139 const int myrank = 0;
8145 std::ofstream xdmf_file(filename);
8147 xdmf_file <<
"<?xml version=\"1.0\" ?>\n";
8148 xdmf_file <<
"<!DOCTYPE Xdmf SYSTEM \"Xdmf.dtd\" []>\n";
8149 xdmf_file <<
"<Xdmf Version=\"2.0\">\n";
8150 xdmf_file <<
" <Domain>\n";
8152 <<
" <Grid Name=\"CellTime\" GridType=\"Collection\" CollectionType=\"Temporal\">\n";
8154 for (
const auto &entry : entries)
8156 xdmf_file << entry.get_xdmf_content(3);
8159 xdmf_file <<
" </Grid>\n";
8160 xdmf_file <<
" </Domain>\n";
8161 xdmf_file <<
"</Xdmf>\n";
8173template <
int dim,
int spacedim>
8179 get_dataset_names(),
8180 get_nonscalar_data_ranges(),
8187#ifdef DEAL_II_WITH_HDF5
8191 template <
int dim,
int spacedim>
8196 const bool write_mesh_file,
8197 const std::string &mesh_filename,
8198 const std::string &solution_filename,
8201 hid_t h5_mesh_file_id = -1, h5_solution_file_id, file_plist_id, plist_id;
8202 hid_t node_dataspace, node_dataset, node_file_dataspace,
8203 node_memory_dataspace, node_dataset_id;
8204 hid_t cell_dataspace, cell_dataset, cell_file_dataspace,
8205 cell_memory_dataspace;
8206 hid_t pt_data_dataspace, pt_data_dataset, pt_data_file_dataspace,
8207 pt_data_memory_dataspace;
8209 std::uint64_t local_node_cell_count[2];
8210 hsize_t count[2], offset[2], node_ds_dim[2], cell_ds_dim[2];
8211 std::vector<double> node_data_vec;
8212 std::vector<unsigned int> cell_data_vec;
8216 local_node_cell_count[0] = data_filter.
n_nodes();
8217 local_node_cell_count[1] = data_filter.
n_cells();
8220 file_plist_id = H5Pcreate(H5P_FILE_ACCESS);
8223# ifdef DEAL_II_WITH_MPI
8224# ifdef H5_HAVE_PARALLEL
8226 status = H5Pset_fapl_mpio(file_plist_id,
comm, MPI_INFO_NULL);
8231# ifndef DEAL_II_WITH_ZLIB
8238 std::uint64_t global_node_cell_count[2] = {0, 0};
8239 std::uint64_t global_node_cell_offsets[2] = {0, 0};
8241# ifdef DEAL_II_WITH_MPI
8242 int ierr = MPI_Allreduce(local_node_cell_count,
8243 global_node_cell_count,
8249 ierr = MPI_Exscan(local_node_cell_count,
8250 global_node_cell_offsets,
8257 global_node_cell_count[0] = local_node_cell_count[0];
8258 global_node_cell_count[1] = local_node_cell_count[1];
8259 global_node_cell_offsets[0] = global_node_cell_offsets[1] = 0;
8263 plist_id = H5Pcreate(H5P_DATASET_XFER);
8265# ifdef DEAL_II_WITH_MPI
8266# ifdef H5_HAVE_PARALLEL
8267 status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
8272 if (write_mesh_file)
8275 h5_mesh_file_id = H5Fcreate(mesh_filename.c_str(),
8283 node_ds_dim[0] = global_node_cell_count[0];
8284 node_ds_dim[1] = (spacedim < 2) ? 2 : spacedim;
8285 node_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8288 cell_ds_dim[0] = global_node_cell_count[1];
8289 cell_ds_dim[1] = patches[0].reference_cell.n_vertices();
8290 cell_dataspace = H5Screate_simple(2, cell_ds_dim,
nullptr);
8294# if H5Gcreate_vers == 1
8295 node_dataset = H5Dcreate(h5_mesh_file_id,
8301 node_dataset_id = H5Pcreate(H5P_DATASET_CREATE);
8302# ifdef DEAL_II_WITH_ZLIB
8303 H5Pset_deflate(node_dataset_id,
8305 H5Pset_chunk(node_dataset_id, 2, node_ds_dim);
8307 node_dataset = H5Dcreate(h5_mesh_file_id,
8314 H5Pclose(node_dataset_id);
8317# if H5Gcreate_vers == 1
8318 cell_dataset = H5Dcreate(h5_mesh_file_id,
8324 node_dataset_id = H5Pcreate(H5P_DATASET_CREATE);
8325# ifdef DEAL_II_WITH_ZLIB
8326 H5Pset_deflate(node_dataset_id,
8328 H5Pset_chunk(node_dataset_id, 2, cell_ds_dim);
8330 cell_dataset = H5Dcreate(h5_mesh_file_id,
8337 H5Pclose(node_dataset_id);
8342 status = H5Sclose(node_dataspace);
8344 status = H5Sclose(cell_dataspace);
8349 count[0] = local_node_cell_count[0];
8350 count[1] = (spacedim < 2) ? 2 : spacedim;
8352 offset[0] = global_node_cell_offsets[0];
8355 node_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8359 node_file_dataspace = H5Dget_space(node_dataset);
8361 status = H5Sselect_hyperslab(
8362 node_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8366 count[0] = local_node_cell_count[1];
8367 count[1] = patches[0].reference_cell.n_vertices();
8368 offset[0] = global_node_cell_offsets[1];
8370 cell_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8373 cell_file_dataspace = H5Dget_space(cell_dataset);
8375 status = H5Sselect_hyperslab(
8376 cell_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8381 status = H5Dwrite(node_dataset,
8383 node_memory_dataspace,
8384 node_file_dataspace,
8386 node_data_vec.data());
8388 node_data_vec.clear();
8391 data_filter.
fill_cell_data(global_node_cell_offsets[0], cell_data_vec);
8392 status = H5Dwrite(cell_dataset,
8394 cell_memory_dataspace,
8395 cell_file_dataspace,
8397 cell_data_vec.data());
8399 cell_data_vec.clear();
8402 status = H5Sclose(node_file_dataspace);
8404 status = H5Sclose(cell_file_dataspace);
8408 status = H5Sclose(node_memory_dataspace);
8410 status = H5Sclose(cell_memory_dataspace);
8414 status = H5Dclose(node_dataset);
8416 status = H5Dclose(cell_dataset);
8420 if (mesh_filename != solution_filename)
8422 status = H5Fclose(h5_mesh_file_id);
8428 if (mesh_filename == solution_filename && write_mesh_file)
8430 h5_solution_file_id = h5_mesh_file_id;
8435 h5_solution_file_id = H5Fcreate(solution_filename.c_str(),
8445 std::string vector_name;
8454 node_ds_dim[0] = global_node_cell_count[0];
8455 node_ds_dim[1] = pt_data_vector_dim;
8456 pt_data_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8459# if H5Gcreate_vers == 1
8460 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8461 vector_name.c_str(),
8466 node_dataset_id = H5Pcreate(H5P_DATASET_CREATE);
8467# ifdef DEAL_II_WITH_ZLIB
8468 H5Pset_deflate(node_dataset_id,
8470 H5Pset_chunk(node_dataset_id, 2, node_ds_dim);
8472 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8473 vector_name.c_str(),
8479 H5Pclose(node_dataset_id);
8484 count[0] = local_node_cell_count[0];
8485 count[1] = pt_data_vector_dim;
8486 offset[0] = global_node_cell_offsets[0];
8488 pt_data_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8492 pt_data_file_dataspace = H5Dget_space(pt_data_dataset);
8494 status = H5Sselect_hyperslab(pt_data_file_dataspace,
8503 status = H5Dwrite(pt_data_dataset,
8505 pt_data_memory_dataspace,
8506 pt_data_file_dataspace,
8512 status = H5Sclose(pt_data_dataspace);
8514 status = H5Sclose(pt_data_memory_dataspace);
8516 status = H5Sclose(pt_data_file_dataspace);
8519 status = H5Dclose(pt_data_dataset);
8524 status = H5Pclose(file_plist_id);
8528 status = H5Pclose(plist_id);
8532 status = H5Fclose(h5_solution_file_id);
8540template <
int dim,
int spacedim>
8544 const std::vector<std::string> &data_names,
8546 std::tuple<
unsigned int,
8550 &nonscalar_data_ranges,
8553 const unsigned int n_data_sets = data_names.size();
8555#ifndef DEAL_II_WITH_MPI
8562 Assert(patches.size() > 0, ExcNoPatches());
8564 if (patches.empty())
8568 unsigned int n_nodes;
8569 std::tie(n_nodes, std::ignore) = count_nodes_and_cells(patches);
8584 [&patches]() {
return create_global_data_table(patches); });
8592 std::move(*create_global_data_table_task.
return_value());
8596 unsigned int i, n_th_vector, data_set, pt_data_vector_dim;
8597 std::string vector_name;
8598 for (n_th_vector = 0, data_set = 0; data_set < n_data_sets;)
8601 while (n_th_vector < nonscalar_data_ranges.size() &&
8602 std::get<0>(nonscalar_data_ranges[n_th_vector]) < data_set)
8606 if (n_th_vector < nonscalar_data_ranges.size() &&
8607 std::get<0>(nonscalar_data_ranges[n_th_vector]) == data_set)
8610 pt_data_vector_dim = std::get<1>(nonscalar_data_ranges[n_th_vector]) -
8611 std::get<0>(nonscalar_data_ranges[n_th_vector]) +
8616 std::get<1>(nonscalar_data_ranges[n_th_vector]) >=
8617 std::get<0>(nonscalar_data_ranges[n_th_vector]),
8618 ExcLowerRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
8619 std::get<0>(nonscalar_data_ranges[n_th_vector])));
8621 std::get<1>(nonscalar_data_ranges[n_th_vector]) < n_data_sets,
8622 ExcIndexRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
8628 if (!std::get<2>(nonscalar_data_ranges[n_th_vector]).empty())
8630 vector_name = std::get<2>(nonscalar_data_ranges[n_th_vector]);
8635 for (i = std::get<0>(nonscalar_data_ranges[n_th_vector]);
8636 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
8638 vector_name += data_names[i] +
"__";
8640 data_names[std::get<1>(nonscalar_data_ranges[n_th_vector])];
8646 pt_data_vector_dim = 1;
8647 vector_name = data_names[data_set];
8657 data_set += pt_data_vector_dim;
8663template <
int dim,
int spacedim>
8667 const std::string &filename,
8671 get_patches(), data_filter, hdf5_flags, filename,
comm);
8676template <
int dim,
int spacedim>
8680 const bool write_mesh_file,
8681 const std::string &mesh_filename,
8682 const std::string &solution_filename,
8696template <
int dim,
int spacedim>
8702 const std::string &filename,
8706 patches, data_filter, flags,
true, filename, filename,
comm);
8711template <
int dim,
int spacedim>
8717 const bool write_mesh_file,
8718 const std::string &mesh_filename,
8719 const std::string &solution_filename,
8725 "DataOutBase was asked to write HDF5 output for a space dimension of 1. "
8726 "HDF5 only supports datasets that live in 2 or 3 dimensions."));
8728#ifndef DEAL_II_WITH_HDF5
8734 (void)write_mesh_file;
8735 (void)mesh_filename;
8736 (void)solution_filename;
8745# ifndef H5_HAVE_PARALLEL
8749 "Serial HDF5 output on multiple processes is not yet supported."));
8759 Assert((patches.size() > 0) || (n_ranks > 1), ExcNoPatches());
8766 const bool have_patches = (patches.size() > 0);
8770 const int color = (have_patches ? 1 : 0);
8771 const int ierr = MPI_Comm_split(
comm, color, key, &split_comm);
8777 do_write_hdf5<dim, spacedim>(patches,
8786 const int ierr = MPI_Comm_free(&split_comm);
8794template <
int dim,
int spacedim>
8802 output_format = default_fmt;
8804 switch (output_format)
8850 write_deal_II_intermediate(out);
8860template <
int dim,
int spacedim>
8869template <
int dim,
int spacedim>
8870template <
typename FlagType>
8874 if constexpr (std::is_same_v<FlagType, DataOutBase::DXFlags>)
8876 else if constexpr (std::is_same_v<FlagType, DataOutBase::UcdFlags>)
8878 else if constexpr (std::is_same_v<FlagType, DataOutBase::PovrayFlags>)
8879 povray_flags = flags;
8880 else if constexpr (std::is_same_v<FlagType, DataOutBase::EpsFlags>)
8882 else if constexpr (std::is_same_v<FlagType, DataOutBase::GmvFlags>)
8884 else if constexpr (std::is_same_v<FlagType, DataOutBase::Hdf5Flags>)
8886 else if constexpr (std::is_same_v<FlagType, DataOutBase::TecplotFlags>)
8887 tecplot_flags = flags;
8888 else if constexpr (std::is_same_v<FlagType, DataOutBase::VtkFlags>)
8890 else if constexpr (std::is_same_v<FlagType, DataOutBase::SvgFlags>)
8892 else if constexpr (std::is_same_v<FlagType, DataOutBase::GnuplotFlags>)
8893 gnuplot_flags = flags;
8894 else if constexpr (std::is_same_v<FlagType,
8896 deal_II_intermediate_flags = flags;
8903template <
int dim,
int spacedim>
8916template <
int dim,
int spacedim>
8923 "A name for the output format to be used");
8927 "Number of subdivisions of each mesh cell");
8973template <
int dim,
int spacedim>
8977 const std::string &output_name = prm.
get(
"Output format");
8979 default_subdivisions = prm.
get_integer(
"Subdivisions");
8982 dx_flags.parse_parameters(prm);
8986 ucd_flags.parse_parameters(prm);
8990 gnuplot_flags.parse_parameters(prm);
8994 povray_flags.parse_parameters(prm);
8998 eps_flags.parse_parameters(prm);
9002 gmv_flags.parse_parameters(prm);
9006 hdf5_flags.parse_parameters(prm);
9010 tecplot_flags.parse_parameters(prm);
9014 vtk_flags.parse_parameters(prm);
9018 deal_II_intermediate_flags.parse_parameters(prm);
9024template <
int dim,
int spacedim>
9028 return (
sizeof(default_fmt) +
9044template <
int dim,
int spacedim>
9046 std::tuple<
unsigned int,
9053 std::tuple<
unsigned int,
9060template <
int dim,
int spacedim>
9069 std::set<std::string> all_names;
9072 std::tuple<
unsigned int,
9076 ranges = this->get_nonscalar_data_ranges();
9077 const std::vector<std::string> data_names = this->get_dataset_names();
9078 const unsigned int n_data_sets = data_names.size();
9079 std::vector<bool> data_set_written(n_data_sets,
false);
9081 for (
const auto &range : ranges)
9083 const std::string &name = std::get<2>(range);
9086 Assert(all_names.find(name) == all_names.end(),
9088 "Error: names of fields in DataOut need to be unique, "
9090 name +
"' is used more than once."));
9091 all_names.insert(name);
9092 for (
unsigned int i = std::get<0>(range);
9093 i <= std::get<1>(range);
9095 data_set_written[i] =
true;
9099 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
9100 if (data_set_written[data_set] ==
false)
9102 const std::string &name = data_names[data_set];
9103 Assert(all_names.find(name) == all_names.end(),
9105 "Error: names of fields in DataOut need to be unique, "
9107 name +
"' is used more than once."));
9108 all_names.insert(name);
9118template <
int dim,
int spacedim>
9126 std::vector<typename ::DataOutBase::Patch<dim, spacedim>> tmp;
9130 std::vector<std::string> tmp;
9131 tmp.swap(dataset_names);
9135 std::tuple<
unsigned int,
9140 tmp.swap(nonscalar_data_ranges);
9147 std::pair<unsigned int, unsigned int> dimension_info =
9150 (dimension_info.second == spacedim),
9151 ExcIncompatibleDimensions(
9152 dimension_info.first, dim, dimension_info.second, spacedim));
9161 getline(in, header);
9163 std::ostringstream s;
9164 s <<
"[deal.II intermediate format graphics data]";
9166 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9170 getline(in, header);
9172 std::ostringstream s;
9176 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9180 getline(in, header);
9182 std::ostringstream s;
9186 Assert(header == s.str(),
9188 "Invalid or incompatible file format. Intermediate format "
9189 "files can only be read by the same deal.II version as they "
9190 "are written by."));
9194 unsigned int n_datasets;
9196 dataset_names.resize(n_datasets);
9197 for (
unsigned int i = 0; i < n_datasets; ++i)
9198 in >> dataset_names[i];
9200 unsigned int n_patches;
9202 patches.resize(n_patches);
9203 for (
unsigned int i = 0; i < n_patches; ++i)
9206 unsigned int n_nonscalar_data_ranges;
9207 in >> n_nonscalar_data_ranges;
9208 nonscalar_data_ranges.resize(n_nonscalar_data_ranges);
9209 for (
unsigned int i = 0; i < n_nonscalar_data_ranges; ++i)
9211 in >> std::get<0>(nonscalar_data_ranges[i]) >>
9212 std::get<1>(nonscalar_data_ranges[i]);
9221 std::get<2>(nonscalar_data_ranges[i]) = name;
9229template <
int dim,
int spacedim>
9235 ParallelIntermediateHeader header;
9236 in.read(
reinterpret_cast<char *
>(&header),
sizeof(header));
9238 header.magic == 0x00dea111,
9240 "Invalid header of parallel deal.II intermediate format encountered."));
9244 "Incorrect header version of parallel deal.II intermediate format."));
9246 std::vector<std::uint64_t> chunk_sizes(header.n_ranks);
9247 in.read(
reinterpret_cast<char *
>(chunk_sizes.data()),
9248 header.n_ranks *
sizeof(std::uint64_t));
9250 for (
unsigned int n = 0; n < header.n_ranks; ++n)
9254 std::vector<char> temp_buffer(chunk_sizes[n]);
9255 in.read(temp_buffer.data(), chunk_sizes[n]);
9258 header.compression) !=
9262 boost::iostreams::filtering_istreambuf f;
9265#ifdef DEAL_II_WITH_ZLIB
9266 f.push(boost::iostreams::zlib_decompressor());
9271 "Decompression requires deal.II to be configured with ZLIB support."));
9274 boost::iostreams::basic_array_source<char> source(temp_buffer.data(),
9275 temp_buffer.size());
9278 std::stringstream datastream;
9279 boost::iostreams::copy(f, datastream);
9289 temp_reader.
read(datastream);
9297template <
int dim,
int spacedim>
9301 using Patch = typename ::DataOutBase::Patch<dim, spacedim>;
9304 const std::vector<Patch> &source_patches = source.
get_patches();
9309 ExcIncompatibleDatasetNames());
9314 ExcMessage(
"Both sources need to declare the same components "
9316 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
9318 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
9320 ExcMessage(
"Both sources need to declare the same components "
9322 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
9324 ExcMessage(
"Both sources need to declare the same components "
9326 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
9328 ExcMessage(
"Both sources need to declare the same components "
9333 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
9334 ExcIncompatiblePatchLists());
9335 Assert(patches[0].
data.n_rows() == source_patches[0].data.n_rows(),
9336 ExcIncompatiblePatchLists());
9337 Assert(patches[0].
data.n_cols() == source_patches[0].data.n_cols(),
9338 ExcIncompatiblePatchLists());
9342 const unsigned int old_n_patches = patches.size();
9343 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
9346 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
9347 patches[i].patch_index += old_n_patches;
9350 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
9352 if (patches[i].neighbors[n] !=
9354 patches[i].neighbors[n] += old_n_patches;
9359template <
int dim,
int spacedim>
9360const std::vector<typename ::DataOutBase::Patch<dim, spacedim>> &
9368template <
int dim,
int spacedim>
9369std::vector<std::string>
9372 return dataset_names;
9377template <
int dim,
int spacedim>
9379 std::tuple<
unsigned int,
9385 return nonscalar_data_ranges;
9394 , h5_sol_filename(
"")
9395 , h5_mesh_filename(
"")
9397 , num_nodes(
numbers::invalid_unsigned_int)
9398 , num_cells(
numbers::invalid_unsigned_int)
9399 , dimension(
numbers::invalid_unsigned_int)
9400 , space_dimension(
numbers::invalid_unsigned_int)
9408 const std::uint64_t nodes,
9409 const std::uint64_t cells,
9410 const unsigned int dim,
9412 :
XDMFEntry(filename, filename, time, nodes, cells, dim, dim, cell_type)
9418 const std::string &solution_filename,
9420 const std::uint64_t nodes,
9421 const std::uint64_t cells,
9422 const unsigned int dim,
9444 const unsigned int dimension)
9451 return ReferenceCells::get_hypercube<0>();
9453 return ReferenceCells::get_hypercube<1>();
9455 return ReferenceCells::get_hypercube<2>();
9457 return ReferenceCells::get_hypercube<3>();
9470 const std::string &solution_filename,
9472 const std::uint64_t nodes,
9473 const std::uint64_t cells,
9474 const unsigned int dim,
9475 const unsigned int spacedim,
9478 , h5_sol_filename(solution_filename)
9479 , h5_mesh_filename(mesh_filename)
9484 , space_dimension(spacedim)
9485 , cell_type(cell_type_hex_if_invalid(cell_type_, dim))
9492 const unsigned int dimension)
9505 indent(
const unsigned int indent_level)
9507 std::string res =
"";
9508 for (
unsigned int i = 0; i < indent_level; ++i)
9522 std::stringstream ss;
9524 ss << indent(indent_level + 0)
9525 <<
"<Grid Name=\"mesh\" GridType=\"Uniform\">\n";
9526 ss << indent(indent_level + 1) <<
"<Time Value=\"" <<
entry_time <<
"\"/>\n";
9527 ss << indent(indent_level + 1) <<
"<Geometry GeometryType=\""
9529 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes
9531 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9533 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9534 ss << indent(indent_level + 1) <<
"</Geometry>\n";
9539 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"";
9557 ss <<
"Quadrilateral";
9576 ss <<
"Tetrahedron";
9580 ss <<
"\" NumberOfElements=\"" <<
num_cells;
9582 ss <<
"\" NodesPerElement=\"1\">\n";
9584 ss <<
"\" NodesPerElement=\"2\">\n";
9589 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_cells
9591 <<
"\" NumberType=\"UInt\" Format=\"HDF\">\n";
9594 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9595 ss << indent(indent_level + 1) <<
"</Topology>\n";
9601 ss << indent(indent_level + 1)
9602 <<
"<Topology TopologyType=\"Polyvertex\" NumberOfElements=\""
9604 ss << indent(indent_level + 1) <<
"</Topology>\n";
9609 ss << indent(indent_level + 1) <<
"<Attribute Name=\""
9610 << attribute_dim.first <<
"\" AttributeType=\""
9611 << (attribute_dim.second > 1 ?
"Vector" :
"Scalar")
9612 <<
"\" Center=\"Node\">\n";
9614 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes
9615 <<
" " << (attribute_dim.second > 1 ? 3 : 1)
9616 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9618 << attribute_dim.first <<
'\n';
9619 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9620 ss << indent(indent_level + 1) <<
"</Attribute>\n";
9623 ss << indent(indent_level + 0) <<
"</Grid>\n";
9632 template <
int dim,
int spacedim>
9637 out <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]"
9656 out << patch.
data.n_rows() <<
' ' << patch.
data.n_cols() <<
'\n';
9657 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9658 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9659 out << patch.
data[i][j] <<
' ';
9668 template <
int dim,
int spacedim>
9680 getline(in, header);
9681 while ((header.size() != 0) && (header.back() ==
' '))
9682 header.erase(header.size() - 1);
9684 while ((header.empty()) && in);
9686 std::ostringstream s;
9687 s <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]";
9689 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9693 if constexpr (dim > 0)
9707 unsigned int n_subdivisions;
9708 in >> n_subdivisions;
9709 if constexpr (dim > 1)
9714 unsigned int n_rows, n_cols;
9715 in >> n_rows >> n_cols;
9716 patch.
data.reinit(n_rows, n_cols);
9717 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9718 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9719 in >> patch.
data[i][j];
9730#include "base/data_out_base.inst"
3039 double c = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) + {
…}
3003 A[1][0] = A[1][1]; {
…}
2962 for (
int i = 0; i < 2; ++i) {
…}
2937 projection_decomposition[1] = (projection[0] - camera_position[0] - {
…}
2856 (n_data_sets + spacedim) : {
…}
2729 const bool legacy_format) {
…}
2716 Utilities::fixed_power<dim>(n_subdivisions + 1); {
…}
2678 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1) {
…}
2664 const unsigned int offset = {
…}
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
constexpr bool running_in_debug_mode()
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_FALLTHROUGH
#define DEAL_II_PACKAGE_NAME
#define DEAL_II_ASSERT_UNREACHABLE()
#define DEAL_II_NOT_IMPLEMENTED()
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)
const unsigned int my_rank
std::vector< index_type > data
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)
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 Vertex
constexpr const ReferenceCell Line
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)
std::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)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
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)
constexpr 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 > &)
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)
static void declare_parameters(ParameterHandler &prm)
static RgbValues default_color_function(const double value, const double min_value, const double max_value)
void parse_parameters(const ParameterHandler &prm)
ColorFunction color_function
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
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)
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
static const unsigned int space_dim
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)