58#ifdef DEAL_II_WITH_ZLIB
62#ifdef DEAL_II_WITH_HDF5
76 <<
"Unexpected input: expected line\n <" << arg1
77 <<
">\nbut got\n <" << arg2 <<
">");
83#ifdef DEAL_II_WITH_ZLIB
89 get_zlib_compression_level(
95 return Z_NO_COMPRESSION;
99 return Z_BEST_COMPRESSION;
101 return Z_DEFAULT_COMPRESSION;
104 return Z_NO_COMPRESSION;
112 template <
typename T>
114 write_compressed_block(
const std::vector<T> & data,
116 std::ostream & output_stream)
118 if (data.size() != 0)
120 const std::size_t uncompressed_size = (data.size() *
sizeof(T));
128 std::numeric_limits<std::uint32_t>::max(),
132 auto compressed_data_length = compressBound(uncompressed_size);
134 std::numeric_limits<std::uint32_t>::max(),
137 std::vector<unsigned char> compressed_data(compressed_data_length);
140 compress2(&compressed_data[0],
141 &compressed_data_length,
142 reinterpret_cast<const Bytef *
>(data.data()),
149 compressed_data.resize(compressed_data_length);
152 const std::uint32_t compression_header[4] = {
154 static_cast<std::uint32_t
>(uncompressed_size),
155 static_cast<std::uint32_t
>(
157 static_cast<std::uint32_t
>(
158 compressed_data_length)};
160 const auto header_start =
161 reinterpret_cast<const unsigned char *
>(&compression_header[0]);
165 header_start + 4 *
sizeof(std::uint32_t)})
216 SvgCell::operator<(
const SvgCell &e)
const
257 EpsCell2d::operator<(
const EpsCell2d &e)
const
275 template <
int dim,
int spacedim,
typename Number =
double>
277 write_gmv_reorder_data_vectors(
278 const std::vector<Patch<dim, spacedim>> &patches,
282 if (patches.size() == 0)
292 const unsigned int n_data_sets = patches[0].points_are_available ?
293 (patches[0].data.n_rows() - spacedim) :
294 patches[0].data.n_rows();
299 unsigned int next_value = 0;
300 for (
const auto &patch : patches)
302 const unsigned int n_subdivisions = patch.n_subdivisions;
303 (void)n_subdivisions;
305 Assert((patch.data.n_rows() == n_data_sets &&
306 !patch.points_are_available) ||
307 (patch.data.n_rows() == n_data_sets + spacedim &&
308 patch.points_are_available),
310 (n_data_sets + spacedim) :
312 patch.data.n_rows()));
313 Assert(patch.reference_cell != ReferenceCells::get_hypercube<dim>() ||
314 (n_data_sets == 0) ||
315 (patch.data.n_cols() ==
316 Utilities::fixed_power<dim>(n_subdivisions + 1)),
318 n_subdivisions + 1));
320 for (
unsigned int i = 0; i < patch.data.n_cols(); ++i, ++next_value)
321 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
322 data_vectors[data_set][next_value] = patch.data(data_set, i);
325 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
334 , node_dim(
numbers::invalid_unsigned_int)
335 , num_cells(
numbers::invalid_unsigned_int)
342 , node_dim(
numbers::invalid_unsigned_int)
343 , num_cells(
numbers::invalid_unsigned_int)
355 for (
unsigned int d = 0; d < dim; ++d)
359 unsigned int internal_ind;
370 internal_ind = it->second;
380 const unsigned int pt_index)
398 for (
unsigned int d = 0; d <
node_dim; ++d)
399 node_data[
node_dim * existing_point.second + d] =
400 existing_point.first(d);
408 std::vector<unsigned int> &cell_data)
const
414 cell_data[filtered_cell.first] =
415 filtered_cell.second + local_node_offset;
484 const unsigned int start,
485 const unsigned int d1,
486 const unsigned int d2,
487 const unsigned int d3)
491 const unsigned int base_entry =
517 const unsigned int start,
518 const unsigned int n_points,
523 const unsigned int base_entry = index * n_points;
525 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
527 for (
unsigned int i = 0; i < n_points; ++i)
538 const unsigned int dimension,
539 const unsigned int set_num,
542 unsigned int new_dim;
561 for (
unsigned int d = 0; d < new_dim; ++d)
564 data_sets.back()[r * new_dim + d] = data_vectors(set_num + d, i);
580 const char *gmv_cell_type[4] = {
"",
"line 2",
"quad 4",
"hex 8"};
582 const char *ucd_cell_type[4] = {
"pt",
"line",
"quad",
"hex"};
584 const char *tecplot_cell_type[4] = {
"",
"lineseg",
"quadrilateral",
"brick"};
586#ifdef DEAL_II_HAVE_TECPLOT
587 const unsigned int tecplot_binary_cell_type[4] = {0, 0, 1, 3};
592 enum vtk_linear_cell_type
604 enum vtk_quadratic_cell_type
606 VTK_QUADRATIC_EDGE = 21,
607 VTK_QUADRATIC_TRIANGLE = 22,
608 VTK_QUADRATIC_QUAD = 23,
609 VTK_QUADRATIC_TETRA = 24,
610 VTK_QUADRATIC_HEXAHEDRON = 25,
611 VTK_QUADRATIC_WEDGE = 26,
612 VTK_QUADRATIC_PYRAMID = 27
615 enum vtk_lagrange_cell_type
617 VTK_LAGRANGE_CURVE = 68,
618 VTK_LAGRANGE_TRIANGLE = 69,
619 VTK_LAGRANGE_QUADRILATERAL = 70,
620 VTK_LAGRANGE_TETRAHEDRON = 71,
621 VTK_LAGRANGE_HEXAHEDRON = 72,
622 VTK_LAGRANGE_WEDGE = 73,
623 VTK_LAGRANGE_PYRAMID = 74
630 template <
int dim,
int spacedim>
631 std::array<unsigned int, 3>
633 const bool write_higher_order_cells)
635 std::array<unsigned int, 3> vtk_cell_id{};
637 if (write_higher_order_cells)
641 const std::array<unsigned int, 4> cell_type_by_dim{
644 VTK_LAGRANGE_QUADRILATERAL,
645 VTK_LAGRANGE_HEXAHEDRON}};
646 vtk_cell_id[0] = cell_type_by_dim[dim];
651 vtk_cell_id[0] = VTK_LAGRANGE_TRIANGLE;
660 patch.
data.n_cols() == 3)
662 vtk_cell_id[0] = VTK_TRIANGLE;
666 patch.
data.n_cols() == 6)
668 vtk_cell_id[0] = VTK_QUADRATIC_TRIANGLE;
672 patch.
data.n_cols() == 4)
674 vtk_cell_id[0] = VTK_TETRA;
678 patch.
data.n_cols() == 10)
680 vtk_cell_id[0] = VTK_QUADRATIC_TETRA;
684 patch.
data.n_cols() == 6)
686 vtk_cell_id[0] = VTK_WEDGE;
690 patch.
data.n_cols() == 5)
692 vtk_cell_id[0] = VTK_PYRAMID;
695 else if (patch.
reference_cell == ReferenceCells::get_hypercube<dim>())
697 const std::array<unsigned int, 4> cell_type_by_dim{
698 {VTK_VERTEX, VTK_LINE, VTK_QUAD, VTK_HEXAHEDRON}};
699 vtk_cell_id[0] = cell_type_by_dim[dim];
707 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>() ||
708 write_higher_order_cells)
709 vtk_cell_id[2] = patch.
data.n_cols();
725 template <
int dim,
int spacedim>
727 get_equispaced_location(
729 const std::initializer_list<unsigned int> &lattice_location,
730 const unsigned int n_subdivisions)
738 const unsigned int xstep = (dim > 0 ? *(lattice_location.begin() + 0) : 0);
739 const unsigned int ystep = (dim > 1 ? *(lattice_location.begin() + 1) : 0);
740 const unsigned int zstep = (dim > 2 ? *(lattice_location.begin() + 2) : 0);
748 unsigned int point_no = 0;
753 point_no += (n_subdivisions + 1) * (n_subdivisions + 1) * zstep;
757 point_no += (n_subdivisions + 1) * ystep;
771 for (
unsigned int d = 0;
d < spacedim; ++
d)
772 node[d] = patch.
data(patch.
data.size(0) - spacedim + d, point_no);
784 const double stepsize = 1. / n_subdivisions;
785 const double xfrac = xstep * stepsize;
791 const double yfrac = ystep * stepsize;
793 node += ((patch.
vertices[3] * xfrac) +
794 (patch.
vertices[2] * (1 - xfrac))) *
798 const double zfrac = zstep * stepsize;
800 node += (((patch.
vertices[5] * xfrac) +
801 (patch.
vertices[4] * (1 - xfrac))) *
804 (patch.
vertices[6] * (1 - xfrac))) *
817 template <
int dim,
int spacedim>
820 const unsigned int node_index)
825 unsigned int point_no_actual = node_index;
830 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
831 point_no_actual = table[node_index];
839 for (
unsigned int d = 0;
d < spacedim; ++
d)
841 patch.
data(patch.
data.size(0) - spacedim + d, point_no_actual);
854 return patch.
vertices[point_no_actual];
868 vtk_point_index_from_ijk(
const unsigned i,
871 const std::array<unsigned, 2> &order)
873 const bool ibdy = (i == 0 || i == order[0]);
874 const bool jbdy = (j == 0 || j == order[1]);
876 const int nbdy = (ibdy ? 1 : 0) + (jbdy ? 1 : 0);
880 return (i != 0u ? (j != 0u ? 2 : 1) : (j != 0u ? 3 : 0));
888 return (i - 1) + (j != 0u ? order[0] - 1 + order[1] - 1 : 0) +
895 (i != 0u ? order[0] - 1 :
896 2 * (order[0] - 1) + order[1] - 1) +
901 offset += 2 * (order[0] - 1 + order[1] - 1);
903 return offset + (i - 1) + (order[0] - 1) * ((j - 1));
916 vtk_point_index_from_ijk(
const unsigned i,
919 const std::array<unsigned, 3> &order)
921 const bool ibdy = (i == 0 || i == order[0]);
922 const bool jbdy = (j == 0 || j == order[1]);
923 const bool kbdy = (k == 0 || k == order[2]);
925 const int nbdy = (ibdy ? 1 : 0) + (jbdy ? 1 : 0) + (kbdy ? 1 : 0);
929 return (i != 0u ? (j != 0u ? 2 : 1) : (j != 0u ? 3 : 0)) +
938 return (i - 1) + (j != 0u ? order[0] - 1 + order[1] - 1 : 0) +
939 (k != 0u ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset;
944 (i != 0u ? order[0] - 1 :
945 2 * (order[0] - 1) + order[1] - 1) +
946 (k != 0u ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset;
949 offset += 4 * (order[0] - 1) + 4 * (order[1] - 1);
952 (i != 0u ? (j != 0u ? 3 : 1) : (j != 0u ? 2 : 0)) +
956 offset += 4 * (order[0] - 1 + order[1] - 1 + order[2] - 1);
961 return (j - 1) + ((order[1] - 1) * (k - 1)) +
962 (i != 0u ? (order[1] - 1) * (order[2] - 1) : 0) + offset;
964 offset += 2 * (order[1] - 1) * (order[2] - 1);
967 return (i - 1) + ((order[0] - 1) * (k - 1)) +
968 (j != 0u ? (order[2] - 1) * (order[0] - 1) : 0) + offset;
970 offset += 2 * (order[2] - 1) * (order[0] - 1);
972 return (i - 1) + ((order[0] - 1) * (j - 1)) +
973 (k != 0u ? (order[0] - 1) * (order[1] - 1) : 0) + offset;
978 2 * ((order[1] - 1) * (order[2] - 1) + (order[2] - 1) * (order[0] - 1) +
979 (order[0] - 1) * (order[1] - 1));
980 return offset + (i - 1) +
981 (order[0] - 1) * ((j - 1) + (order[1] - 1) * ((k - 1)));
987 vtk_point_index_from_ijk(
const unsigned,
990 const std::array<unsigned, 0> &)
999 vtk_point_index_from_ijk(
const unsigned,
1002 const std::array<unsigned, 1> &)
1010 template <
int dim,
int spacedim>
1013 unsigned int & n_nodes,
1014 unsigned int & n_cells)
1018 for (
const auto &patch : patches)
1022 "The reference cell for this patch is set to 'Invalid', "
1023 "but that is clearly not a valid choice. Did you forget "
1024 "to set the reference cell for the patch?"));
1027 if (patch.
reference_cell == ReferenceCells::get_hypercube<dim>())
1029 n_nodes += Utilities::fixed_power<dim>(patch.
n_subdivisions + 1);
1043 template <
int dim,
int spacedim>
1046 const bool write_higher_order_cells,
1047 unsigned int &n_nodes,
1048 unsigned int &n_cells,
1049 unsigned int &n_points_and_n_cells)
1053 n_points_and_n_cells = 0;
1055 for (
const auto &patch : patches)
1058 if (patch.
reference_cell == ReferenceCells::get_hypercube<dim>())
1060 n_nodes += Utilities::fixed_power<dim>(patch.
n_subdivisions + 1);
1062 if (write_higher_order_cells)
1065 n_points_and_n_cells +=
1071 n_points_and_n_cells +=
1078 n_nodes += patch.
data.n_cols();
1080 n_points_and_n_cells += patch.
data.n_cols() + 1;
1090 template <
typename FlagsType>
1097 StreamBase(std::ostream &stream,
const FlagsType &flags)
1098 : selected_component(
numbers::invalid_unsigned_int)
1109 write_point(
const unsigned int,
const Point<dim> &)
1112 ExcMessage(
"The derived class you are using needs to "
1113 "reimplement this function if you want to call "
1133 write_cell(
const unsigned int ,
1134 const unsigned int ,
1135 const unsigned int ,
1136 const unsigned int ,
1137 const unsigned int )
1140 ExcMessage(
"The derived class you are using needs to "
1141 "reimplement this function if you want to call "
1152 write_cell_single(
const unsigned int index,
1153 const unsigned int start,
1154 const unsigned int n_points,
1160 (void)reference_cell;
1163 ExcMessage(
"The derived class you are using needs to "
1164 "reimplement this function if you want to call "
1182 template <
typename T>
1196 unsigned int selected_component;
1203 std::ostream &stream;
1208 const FlagsType flags;
1214 class DXStream :
public StreamBase<DataOutBase::DXFlags>
1221 write_point(
const unsigned int index,
const Point<dim> &);
1233 write_cell(
const unsigned int index,
1234 const unsigned int start,
1235 const unsigned int x_offset,
1236 const unsigned int y_offset,
1237 const unsigned int z_offset);
1245 template <
typename data>
1247 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1253 class GmvStream :
public StreamBase<DataOutBase::GmvFlags>
1260 write_point(
const unsigned int index,
const Point<dim> &);
1272 write_cell(
const unsigned int index,
1273 const unsigned int start,
1274 const unsigned int x_offset,
1275 const unsigned int y_offset,
1276 const unsigned int z_offset);
1282 class TecplotStream :
public StreamBase<DataOutBase::TecplotFlags>
1289 write_point(
const unsigned int index,
const Point<dim> &);
1301 write_cell(
const unsigned int index,
1302 const unsigned int start,
1303 const unsigned int x_offset,
1304 const unsigned int y_offset,
1305 const unsigned int z_offset);
1311 class UcdStream :
public StreamBase<DataOutBase::UcdFlags>
1318 write_point(
const unsigned int index,
const Point<dim> &);
1332 write_cell(
const unsigned int index,
1333 const unsigned int start,
1334 const unsigned int x_offset,
1335 const unsigned int y_offset,
1336 const unsigned int z_offset);
1344 template <
typename data>
1346 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1352 class VtkStream :
public StreamBase<DataOutBase::VtkFlags>
1359 write_point(
const unsigned int index,
const Point<dim> &);
1371 write_cell(
const unsigned int index,
1372 const unsigned int start,
1373 const unsigned int x_offset,
1374 const unsigned int y_offset,
1375 const unsigned int z_offset);
1381 write_cell_single(
const unsigned int index,
1382 const unsigned int start,
1383 const unsigned int n_points,
1395 write_high_order_cell(
const unsigned int index,
1396 const unsigned int start,
1397 const std::vector<unsigned> &connectivity);
1401 class VtuStream :
public StreamBase<DataOutBase::VtkFlags>
1408 write_point(
const unsigned int index,
const Point<dim> &);
1423 write_cell(
const unsigned int index,
1424 const unsigned int start,
1425 const unsigned int x_offset,
1426 const unsigned int y_offset,
1427 const unsigned int z_offset);
1433 write_cell_single(
const unsigned int index,
1434 const unsigned int start,
1435 const unsigned int n_points,
1447 write_high_order_cell(
const unsigned int index,
1448 const unsigned int start,
1449 const std::vector<unsigned> &connectivity);
1454 template <
typename T>
1465 template <
typename T>
1479 std::vector<int32_t> cells;
1492 DXStream::write_point(
const unsigned int,
const Point<dim> &p)
1494 if (flags.coordinates_binary)
1497 for (
unsigned int d = 0;
d < dim; ++
d)
1499 stream.write(
reinterpret_cast<const char *
>(data), dim *
sizeof(*data));
1503 for (
unsigned int d = 0;
d < dim; ++
d)
1504 stream << p(d) <<
'\t';
1519 std::array<unsigned int, GeometryInfo<dim>::vertices_per_cell>
1520 set_node_numbers(
const unsigned int ,
1521 const unsigned int ,
1522 const unsigned int ,
1523 const unsigned int )
1532 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell>
1533 set_node_numbers<1>(
const unsigned int start,
1534 const unsigned int d1,
1535 const unsigned int ,
1536 const unsigned int )
1539 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell> nodes;
1541 nodes[1] = start + d1;
1548 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell>
1549 set_node_numbers<2>(
const unsigned int start,
1550 const unsigned int d1,
1551 const unsigned int d2,
1552 const unsigned int )
1555 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell> nodes;
1557 nodes[1] = start + d1;
1558 nodes[2] = start + d2;
1559 nodes[3] = start + d2 + d1;
1566 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell>
1567 set_node_numbers<3>(
const unsigned int start,
1568 const unsigned int d1,
1569 const unsigned int d2,
1570 const unsigned int d3)
1572 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell> nodes;
1574 nodes[1] = start + d1;
1575 nodes[2] = start + d2;
1576 nodes[3] = start + d2 + d1;
1577 nodes[4] = start + d3;
1578 nodes[5] = start + d3 + d1;
1579 nodes[6] = start + d3 + d2;
1580 nodes[7] = start + d3 + d2 + d1;
1589 DXStream::write_cell(
unsigned int,
1596 DataOutBaseImplementation::set_node_numbers<dim>(start, d1, d2, d3);
1598 if (flags.int_binary)
1600 std::array<unsigned int, GeometryInfo<dim>::vertices_per_cell> temp;
1601 for (
unsigned int i = 0; i < nodes.size(); ++i)
1603 stream.write(
reinterpret_cast<const char *
>(temp.data()),
1604 temp.size() *
sizeof(temp[0]));
1608 for (
unsigned int i = 0; i < nodes.size() - 1; ++i)
1610 stream << nodes[GeometryInfo<dim>::dx_to_deal[nodes.size() - 1]]
1617 template <
typename data>
1619 DXStream::write_dataset(
const unsigned int,
const std::vector<data> &values)
1621 if (flags.data_binary)
1623 stream.write(
reinterpret_cast<const char *
>(
values.data()),
1624 values.size() *
sizeof(data));
1628 for (
unsigned int i = 0; i <
values.size(); ++i)
1629 stream <<
'\t' << values[i];
1645 GmvStream::write_point(
const unsigned int,
const Point<dim> &p)
1649 stream << p(selected_component) <<
' ';
1656 GmvStream::write_cell(
unsigned int,
1663 const unsigned int start = s + 1;
1664 stream << gmv_cell_type[dim] <<
'\n';
1669 stream <<
'\t' << start + d1;
1672 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1675 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1676 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1685 TecplotStream::TecplotStream(std::ostream & out,
1693 TecplotStream::write_point(
const unsigned int,
const Point<dim> &p)
1697 stream << p(selected_component) <<
'\n';
1704 TecplotStream::write_cell(
unsigned int,
1710 const unsigned int start = s + 1;
1715 stream <<
'\t' << start + d1;
1718 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1721 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1722 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1738 UcdStream::write_point(
const unsigned int index,
const Point<dim> &p)
1740 stream <<
index + 1 <<
" ";
1742 for (
unsigned int i = 0; i < dim; ++i)
1743 stream << p(i) <<
' ';
1745 for (
unsigned int i = dim; i < 3; ++i)
1754 UcdStream::write_cell(
unsigned int index,
1761 DataOutBaseImplementation::set_node_numbers<dim>(start, d1, d2, d3);
1764 stream <<
index + 1 <<
"\t0 " << ucd_cell_type[dim];
1765 for (
unsigned int i = 0; i < nodes.size(); ++i)
1772 template <
typename data>
1774 UcdStream::write_dataset(
const unsigned int index,
1775 const std::vector<data> &values)
1777 stream <<
index + 1;
1778 for (
unsigned int i = 0; i <
values.size(); ++i)
1779 stream <<
'\t' << values[i];
1794 VtkStream::write_point(
const unsigned int,
const Point<dim> &p)
1799 for (
unsigned int i = dim; i < 3; ++i)
1808 VtkStream::write_cell(
unsigned int,
1814 stream << GeometryInfo<dim>::vertices_per_cell <<
'\t' << start;
1817 stream <<
'\t' << start + d1;
1821 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1824 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1825 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1833 VtkStream::write_cell_single(
const unsigned int index,
1834 const unsigned int start,
1835 const unsigned int n_points,
1840 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
1842 stream <<
'\t' << n_points;
1843 for (
unsigned int i = 0; i < n_points; ++i)
1852 VtkStream::write_high_order_cell(
const unsigned int,
1853 const unsigned int start,
1854 const std::vector<unsigned> &connectivity)
1856 stream << connectivity.size();
1857 for (
const auto &c : connectivity)
1858 stream <<
'\t' << start + c;
1869 VtuStream::write_point(
const unsigned int,
const Point<dim> &p)
1871#if !defined(DEAL_II_WITH_ZLIB)
1875 for (
unsigned int i = dim; i < 3; ++i)
1880 for (
unsigned int i = 0; i < dim; ++i)
1882 for (
unsigned int i = dim; i < 3; ++i)
1889 VtuStream::flush_points()
1891#ifdef DEAL_II_WITH_ZLIB
1902 VtuStream::write_cell(
unsigned int,
1908#if !defined(DEAL_II_WITH_ZLIB)
1912 stream <<
'\t' << start + d1;
1915 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1918 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1919 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1925 cells.push_back(start);
1928 cells.push_back(start + d1);
1931 cells.push_back(start + d2 + d1);
1932 cells.push_back(start + d2);
1935 cells.push_back(start + d3);
1936 cells.push_back(start + d3 + d1);
1937 cells.push_back(start + d3 + d2 + d1);
1938 cells.push_back(start + d3 + d2);
1946 VtuStream::write_cell_single(
const unsigned int index,
1947 const unsigned int start,
1948 const unsigned int n_points,
1953 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
1955#if !defined(DEAL_II_WITH_ZLIB)
1956 for (
unsigned int i = 0; i < n_points; ++i)
1962 for (
unsigned int i = 0; i < n_points; ++i)
1970 VtuStream::write_high_order_cell(
const unsigned int,
1971 const unsigned int start,
1972 const std::vector<unsigned> &connectivity)
1974#if !defined(DEAL_II_WITH_ZLIB)
1975 for (
const auto &c : connectivity)
1976 stream <<
'\t' << start + c;
1979 for (
const auto &c : connectivity)
1980 cells.push_back(start + c);
1985 VtuStream::flush_cells()
1987#ifdef DEAL_II_WITH_ZLIB
1990 *
this << cells <<
'\n';
1996 template <
typename T>
1998 VtuStream::operator<<(
const std::vector<T> &data)
2000#ifdef DEAL_II_WITH_ZLIB
2003 write_compressed_block(data, flags, stream);
2005 for (
unsigned int i = 0; i < data.size(); ++i)
2006 stream << data[i] <<
' ';
2020 template <
int dim,
int spacedim>
2024 template <
int dim,
int spacedim>
2028 template <
int dim,
int spacedim>
2030 : patch_index(no_neighbor)
2032 , points_are_available(false)
2046 template <
int dim,
int spacedim>
2054 const double epsilon = 3e-16;
2072 if (data.n_rows() != patch.
data.n_rows())
2075 if (data.n_cols() != patch.
data.n_cols())
2078 for (
unsigned int i = 0; i < data.n_rows(); ++i)
2079 for (
unsigned int j = 0; j < data.n_cols(); ++j)
2080 if (data[i][j] != patch.
data[i][j])
2088 template <
int dim,
int spacedim>
2094 sizeof(neighbors) /
sizeof(neighbors[0]) *
2100 sizeof(reference_cell));
2105 template <
int dim,
int spacedim>
2110 std::swap(neighbors, other_patch.
neighbors);
2113 data.swap(other_patch.
data);
2120 template <
int spacedim>
2124 template <
int spacedim>
2128 template <
int spacedim>
2132 template <
int spacedim>
2135 template <
int spacedim>
2139 template <
int spacedim>
2141 : patch_index(no_neighbor)
2142 , points_are_available(false)
2149 template <
int spacedim>
2153 const unsigned int dim = 0;
2156 const double epsilon = 3e-16;
2167 if (data.n_rows() != patch.
data.n_rows())
2170 if (data.n_cols() != patch.
data.n_cols())
2173 for (
unsigned int i = 0; i < data.n_rows(); ++i)
2174 for (
unsigned int j = 0; j < data.n_cols(); ++j)
2175 if (data[i][j] != patch.
data[i][j])
2183 template <
int spacedim>
2195 template <
int spacedim>
2201 data.swap(other_patch.
data);
2208 : write_preamble(write_preamble)
2223 : space_dimension_labels(labels)
2237 const bool bicubic_patch,
2238 const bool external_data)
2240 , bicubic_patch(bicubic_patch)
2241 , external_data(external_data)
2246 const bool xdmf_hdf5_output)
2247 : filter_duplicate_vertices(filter_duplicate_vertices)
2248 , xdmf_hdf5_output(xdmf_hdf5_output)
2256 "Filter duplicate vertices",
2259 "Whether to remove duplicate vertex values. deal.II duplicates "
2260 "vertices once for each adjacent cell so that it can output "
2261 "discontinuous quantities for which there may be more than one "
2262 "value for each vertex position. Setting this flag to "
2263 "'true' will merge all of these values by selecting a "
2264 "random one and outputting this as 'the' value for the vertex. "
2265 "As long as the data to be output corresponds to continuous "
2266 "fields, merging vertices has no effect. On the other hand, "
2267 "if the data to be output corresponds to discontinuous fields "
2268 "(either because you are using a discontinuous finite element, "
2269 "or because you are using a DataPostprocessor that yields "
2270 "discontinuous data, or because the data to be output has been "
2271 "produced by entirely different means), then the data in the "
2272 "output file no longer faithfully represents the underlying data "
2273 "because the discontinuous field has been replaced by a "
2274 "continuous one. Note also that the filtering can not occur "
2275 "on processor boundaries. Thus, a filtered discontinuous field "
2276 "looks like a continuous field inside of a subdomain, "
2277 "but like a discontinuous field at the subdomain boundary."
2279 "In any case, filtering results in drastically smaller output "
2280 "files (smaller by about a factor of 2^dim).");
2285 "Whether the data will be used in an XDMF/HDF5 combination.");
2300 const bool int_binary,
2301 const bool coordinates_binary,
2302 const bool data_binary)
2303 : write_neighbors(write_neighbors)
2304 , int_binary(int_binary)
2305 , coordinates_binary(coordinates_binary)
2306 , data_binary(data_binary)
2307 , data_double(false)
2317 "A boolean field indicating whether neighborship "
2318 "information between cells is to be written to the "
2319 "OpenDX output file");
2323 "Output format of integer numbers, which is "
2324 "either a text representation (ascii) or binary integer "
2325 "values of 32 or 64 bits length");
2329 "Output format of vertex coordinates, which is "
2330 "either a text representation (ascii) or binary "
2331 "floating point values of 32 or 64 bits length");
2335 "Output format of data values, which is "
2336 "either a text representation (ascii) or binary "
2337 "floating point values of 32 or 64 bits length");
2357 "A flag indicating whether a comment should be "
2358 "written to the beginning of the output file "
2359 "indicating date and time of creation as well "
2360 "as the creating program");
2374 const int azimuth_angle,
2375 const int polar_angle,
2376 const unsigned int line_thickness,
2378 const bool draw_colorbar)
2381 , height_vector(height_vector)
2382 , azimuth_angle(azimuth_angle)
2383 , polar_angle(polar_angle)
2384 , line_thickness(line_thickness)
2386 , draw_colorbar(draw_colorbar)
2397 "A flag indicating whether POVRAY should use smoothed "
2398 "triangles instead of the usual ones");
2402 "Whether POVRAY should use bicubic patches");
2406 "Whether camera and lighting information should "
2407 "be put into an external file \"data.inc\" or into "
2408 "the POVRAY input file");
2424 const unsigned int color_vector,
2426 const unsigned int size,
2427 const double line_width,
2428 const double azimut_angle,
2429 const double turn_angle,
2430 const double z_scaling,
2431 const bool draw_mesh,
2432 const bool draw_cells,
2433 const bool shade_cells,
2435 : height_vector(height_vector)
2436 , color_vector(color_vector)
2437 , size_type(size_type)
2439 , line_width(line_width)
2440 , azimut_angle(azimut_angle)
2441 , turn_angle(turn_angle)
2442 , z_scaling(z_scaling)
2443 , draw_mesh(draw_mesh)
2444 , draw_cells(draw_cells)
2445 , shade_cells(shade_cells)
2446 , color_function(color_function)
2485 double sum = xmax + xmin;
2486 double sum13 = xmin + 3 * xmax;
2487 double sum22 = 2 * xmin + 2 * xmax;
2488 double sum31 = 3 * xmin + xmax;
2489 double dif = xmax - xmin;
2490 double rezdif = 1.0 / dif;
2494 if (x < (sum31) / 4)
2496 else if (x < (sum22) / 4)
2498 else if (x < (sum13) / 4)
2509 rgb_values.
green = 0;
2510 rgb_values.
blue = (x - xmin) * 4. * rezdif;
2514 rgb_values.
green = (4 * x - 3 * xmin - xmax) * rezdif;
2515 rgb_values.
blue = (sum22 - 4. * x) * rezdif;
2518 rgb_values.
red = (4 * x - 2 * sum) * rezdif;
2519 rgb_values.
green = (xmin + 3 * xmax - 4 * x) * rezdif;
2520 rgb_values.
blue = 0;
2524 rgb_values.
green = (4 * x - xmin - 3 * xmax) * rezdif;
2525 rgb_values.
blue = (4. * x - sum13) * rezdif;
2532 rgb_values.
red = rgb_values.
green = rgb_values.
blue = 1;
2546 (x - xmin) / (xmax - xmin);
2559 1 - (x - xmin) / (xmax - xmin);
2571 "Number of the input vector that is to be used to "
2572 "generate height information");
2576 "Number of the input vector that is to be used to "
2577 "generate color information");
2581 "Whether width or height should be scaled to match "
2586 "The size (width or height) to which the eps output "
2587 "file is to be scaled");
2591 "The width in which the postscript renderer is to "
2596 "Angle of the viewing position against the vertical "
2601 "Angle of the viewing direction against the y-axis");
2605 "Scaling for the z-direction relative to the scaling "
2606 "used in x- and y-directions");
2610 "Whether the mesh lines, or only the surface should be "
2615 "Whether only the mesh lines, or also the interior of "
2616 "cells should be plotted. If this flag is false, then "
2617 "one can see through the mesh");
2621 "Whether the interior of cells shall be shaded");
2625 "default|grey scale|reverse grey scale"),
2626 "Name of a color function used to colorize mesh lines "
2627 "and/or cell interiors");
2637 if (prm.
get(
"Scale to width or height") ==
"width")
2649 if (prm.
get(
"Color function") ==
"default")
2651 else if (prm.
get(
"Color function") ==
"grey scale")
2653 else if (prm.
get(
"Color function") ==
"reverse grey scale")
2664 : zone_name(zone_name)
2665 , solution_time(solution_time)
2679 const unsigned int cycle,
2680 const bool print_date_and_time,
2682 const bool write_higher_order_cells,
2683 const std::map<std::string, std::string> &physical_units)
2686 , print_date_and_time(print_date_and_time)
2687 , compression_level(compression_level)
2688 , write_higher_order_cells(write_higher_order_cells)
2689 , physical_units(physical_units)
2697 if (format_name ==
"none")
2700 if (format_name ==
"dx")
2703 if (format_name ==
"ucd")
2706 if (format_name ==
"gnuplot")
2709 if (format_name ==
"povray")
2712 if (format_name ==
"eps")
2715 if (format_name ==
"gmv")
2718 if (format_name ==
"tecplot")
2721 if (format_name ==
"tecplot_binary")
2724 if (format_name ==
"vtk")
2727 if (format_name ==
"vtu")
2730 if (format_name ==
"deal.II intermediate")
2733 if (format_name ==
"hdf5")
2737 ExcMessage(
"The given file format name is not recognized: <" +
2738 format_name +
">"));
2749 return "none|dx|ucd|gnuplot|povray|eps|gmv|tecplot|tecplot_binary|vtk|vtu|hdf5|svg|deal.II intermediate";
2757 switch (output_format)
2796 template <
int dim,
int spacedim,
typename StreamType>
2801 unsigned int count = 0;
2803 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
2805 for (
const auto &patch : patches)
2808 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2810 for (
unsigned int point_no = 0; point_no < patch.
data.n_cols();
2812 out.write_point(count++,
2813 get_node_location(patch,
2822 const unsigned int n = n_subdivisions + 1;
2827 out.write_point(count++,
2828 get_equispaced_location(patch,
2833 for (
unsigned int i1 = 0; i1 < n; ++i1)
2834 out.write_point(count++,
2835 get_equispaced_location(patch,
2840 for (
unsigned int i2 = 0; i2 < n; ++i2)
2841 for (
unsigned int i1 = 0; i1 < n; ++i1)
2842 out.write_point(count++,
2843 get_equispaced_location(patch,
2848 for (
unsigned int i3 = 0; i3 < n; ++i3)
2849 for (
unsigned int i2 = 0; i2 < n; ++i2)
2850 for (
unsigned int i1 = 0; i1 < n; ++i1)
2851 out.write_point(count++,
2852 get_equispaced_location(
2853 patch, {i1, i2, i3}, n_subdivisions));
2864 template <
int dim,
int spacedim,
typename StreamType>
2869 unsigned int count = 0;
2870 unsigned int first_vertex_of_patch = 0;
2871 for (
const auto &patch : patches)
2874 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2876 out.write_cell_single(count++,
2877 first_vertex_of_patch,
2878 patch.
data.n_cols(),
2880 first_vertex_of_patch += patch.
data.n_cols();
2885 const unsigned int n = n_subdivisions + 1;
2887 const unsigned int n1 = (dim > 0) ? n_subdivisions : 1;
2888 const unsigned int n2 = (dim > 1) ? n_subdivisions : 1;
2889 const unsigned int n3 = (dim > 2) ? n_subdivisions : 1;
2891 const unsigned int d1 = 1;
2892 const unsigned int d2 = n;
2893 const unsigned int d3 = n * n;
2894 for (
unsigned int i3 = 0; i3 < n3; ++i3)
2895 for (
unsigned int i2 = 0; i2 < n2; ++i2)
2896 for (
unsigned int i1 = 0; i1 < n1; ++i1)
2898 const unsigned int offset =
2899 first_vertex_of_patch + i3 * d3 + i2 * d2 + i1 * d1;
2901 out.template write_cell<dim>(count++, offset, d1, d2, d3);
2904 first_vertex_of_patch +=
2905 Utilities::fixed_power<dim>(n_subdivisions + 1);
2912 template <
int dim,
int spacedim,
typename StreamType>
2918 unsigned int first_vertex_of_patch = 0;
2919 unsigned int count = 0;
2921 std::vector<unsigned> connectivity;
2923 std::array<unsigned, dim> cell_order;
2925 for (
const auto &patch : patches)
2927 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2929 connectivity.resize(patch.
data.n_cols());
2931 for (
unsigned int i = 0; i < patch.
data.n_cols(); ++i)
2932 connectivity[i] = i;
2934 out.template write_high_order_cell<dim>(count++,
2935 first_vertex_of_patch,
2938 first_vertex_of_patch += patch.
data.n_cols();
2943 const unsigned int n = n_subdivisions + 1;
2945 cell_order.fill(n_subdivisions);
2946 connectivity.resize(Utilities::fixed_power<dim>(n));
2949 const unsigned int n1 = (dim > 0) ? n_subdivisions : 0;
2950 const unsigned int n2 = (dim > 1) ? n_subdivisions : 0;
2951 const unsigned int n3 = (dim > 2) ? n_subdivisions : 0;
2953 const unsigned int d1 = 1;
2954 const unsigned int d2 = n;
2955 const unsigned int d3 = n * n;
2956 for (
unsigned int i3 = 0; i3 <= n3; ++i3)
2957 for (
unsigned int i2 = 0; i2 <= n2; ++i2)
2958 for (
unsigned int i1 = 0; i1 <= n1; ++i1)
2960 const unsigned int local_index =
2961 i3 * d3 + i2 * d2 + i1 * d1;
2962 const unsigned int connectivity_index =
2963 vtk_point_index_from_ijk(i1, i2, i3, cell_order);
2964 connectivity[connectivity_index] = local_index;
2967 out.template write_high_order_cell<dim>(count++,
2968 first_vertex_of_patch,
2972 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
2980 template <
int dim,
int spacedim,
class StreamType>
2983 unsigned int n_data_sets,
2984 const bool double_precision,
2988 unsigned int count = 0;
2990 for (
const auto &patch : patches)
2993 const unsigned int n = n_subdivisions + 1;
2995 Assert((patch.
data.n_rows() == n_data_sets &&
2997 (patch.
data.n_rows() == n_data_sets + spacedim &&
3000 (n_data_sets + spacedim) :
3002 patch.
data.n_rows()));
3003 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
3006 std::vector<float> floats(n_data_sets);
3007 std::vector<double> doubles(n_data_sets);
3010 for (
unsigned int i = 0; i < Utilities::fixed_power<dim>(n);
3012 if (double_precision)
3014 for (
unsigned int data_set = 0; data_set < n_data_sets;
3016 doubles[data_set] = patch.
data(data_set, i);
3017 out.write_dataset(count, doubles);
3021 for (
unsigned int data_set = 0; data_set < n_data_sets;
3023 floats[data_set] = patch.
data(data_set, i);
3024 out.write_dataset(count, floats);
3049 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
3050 camera_horizontal[2] * camera_direction[1];
3051 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
3052 camera_horizontal[0] * camera_direction[2];
3053 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
3054 camera_horizontal[1] * camera_direction[0];
3058 phi /= (point[0] - camera_position[0]) * camera_direction[0] +
3059 (point[1] - camera_position[1]) * camera_direction[1] +
3060 (point[2] - camera_position[2]) * camera_direction[2];
3064 camera_position[0] + phi * (point[0] - camera_position[0]);
3066 camera_position[1] + phi * (point[1] - camera_position[1]);
3068 camera_position[2] + phi * (point[2] - camera_position[2]);
3071 projection_decomposition[0] = (projection[0] - camera_position[0] -
3072 camera_focus * camera_direction[0]) *
3073 camera_horizontal[0];
3074 projection_decomposition[0] += (projection[1] - camera_position[1] -
3075 camera_focus * camera_direction[1]) *
3076 camera_horizontal[1];
3077 projection_decomposition[0] += (projection[2] - camera_position[2] -
3078 camera_focus * camera_direction[2]) *
3079 camera_horizontal[2];
3081 projection_decomposition[1] = (projection[0] - camera_position[0] -
3082 camera_focus * camera_direction[0]) *
3084 projection_decomposition[1] += (projection[1] - camera_position[1] -
3085 camera_focus * camera_direction[1]) *
3087 projection_decomposition[1] += (projection[2] - camera_position[2] -
3088 camera_focus * camera_direction[2]) *
3091 return projection_decomposition;
3100 svg_get_gradient_parameters(
Point<3> points[])
3106 for (
int i = 0; i < 2; ++i)
3108 for (
int j = 0; j < 2 - i; ++j)
3110 if (points[j][2] > points[j + 1][2])
3113 points[j] = points[j + 1];
3114 points[j + 1] = temp;
3121 v_inter = points[1];
3128 A[0][0] = v_max[0] - v_min[0];
3129 A[0][1] = v_inter[0] - v_min[0];
3130 A[1][0] = v_max[1] - v_min[1];
3131 A[1][1] = v_inter[1] - v_min[1];
3137 bool col_change =
false;
3146 double temp = A[1][0];
3151 for (
unsigned int k = 0; k < 1; ++k)
3153 for (
unsigned int i = k + 1; i < 2; ++i)
3155 x = A[i][k] / A[k][k];
3157 for (
unsigned int j = k + 1; j < 2; ++j)
3158 A[i][j] = A[i][j] - A[k][j] * x;
3160 b[i] =
b[i] -
b[k] * x;
3164 b[1] =
b[1] / A[1][1];
3166 for (
int i = 0; i >= 0; i--)
3170 for (
unsigned int j = i + 1; j < 2; ++j)
3171 sum = sum - A[i][j] * b[j];
3173 b[i] =
sum / A[i][i];
3183 double c =
b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) +
3187 A[0][0] = v_max[0] - v_min[0];
3188 A[0][1] = v_inter[0] - v_min[0];
3189 A[1][0] = v_max[1] - v_min[1];
3190 A[1][1] = v_inter[1] - v_min[1];
3192 b[0] = 1.0 - v_min[0];
3204 double temp = A[1][0];
3209 for (
unsigned int k = 0; k < 1; ++k)
3211 for (
unsigned int i = k + 1; i < 2; ++i)
3213 x = A[i][k] / A[k][k];
3215 for (
unsigned int j = k + 1; j < 2; ++j)
3216 A[i][j] = A[i][j] - A[k][j] * x;
3218 b[i] =
b[i] -
b[k] * x;
3222 b[1] =
b[1] / A[1][1];
3224 for (
int i = 0; i >= 0; i--)
3228 for (
unsigned int j = i + 1; j < 2; ++j)
3229 sum = sum - A[i][j] * b[j];
3231 b[i] =
sum / A[i][i];
3241 gradient[0] =
b[0] * (v_max[2] - v_min[2]) +
3242 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3245 A[0][0] = v_max[0] - v_min[0];
3246 A[0][1] = v_inter[0] - v_min[0];
3247 A[1][0] = v_max[1] - v_min[1];
3248 A[1][1] = v_inter[1] - v_min[1];
3251 b[1] = 1.0 - v_min[1];
3262 double temp = A[1][0];
3267 for (
unsigned int k = 0; k < 1; ++k)
3269 for (
unsigned int i = k + 1; i < 2; ++i)
3271 x = A[i][k] / A[k][k];
3273 for (
unsigned int j = k + 1; j < 2; ++j)
3274 A[i][j] = A[i][j] - A[k][j] * x;
3276 b[i] =
b[i] -
b[k] * x;
3280 b[1] =
b[1] / A[1][1];
3282 for (
int i = 0; i >= 0; i--)
3286 for (
unsigned int j = i + 1; j < 2; ++j)
3287 sum = sum - A[i][j] * b[j];
3289 b[i] =
sum / A[i][i];
3299 gradient[1] =
b[0] * (v_max[2] - v_min[2]) +
3300 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3306 gradient[1] * (v_min[1] - v_max[1]);
3310 gradient_parameters[0] = v_min[0];
3311 gradient_parameters[1] = v_min[1];
3316 gradient_parameters[4] = v_min[2];
3317 gradient_parameters[5] = v_max[2];
3319 return gradient_parameters;
3325 template <
int dim,
int spacedim>
3329 const std::vector<std::string> & data_names,
3331 std::tuple<
unsigned int,
3344#ifndef DEAL_II_WITH_MPI
3353 if (patches.size() == 0)
3357 const unsigned int n_data_sets = data_names.size();
3359 UcdStream ucd_out(out, flags);
3362 unsigned int n_nodes;
3363 unsigned int n_cells;
3364 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
3370 <<
"# This file was generated by the deal.II library." <<
'\n'
3374 <<
"# For a description of the UCD format see the AVS Developer's guide."
3380 out << n_nodes <<
' ' << n_cells <<
' ' << n_data_sets <<
' ' << 0
3393 if (n_data_sets != 0)
3395 out << n_data_sets <<
" ";
3396 for (
unsigned int i = 0; i < n_data_sets; ++i)
3401 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3402 out << data_names[data_set]
3406 write_data(patches, n_data_sets,
true, ucd_out);
3416 template <
int dim,
int spacedim>
3420 const std::vector<std::string> & data_names,
3422 std::tuple<
unsigned int,
3434#ifndef DEAL_II_WITH_MPI
3443 if (patches.size() == 0)
3447 DXStream dx_out(out, flags);
3450 unsigned int offset = 0;
3452 const unsigned int n_data_sets = data_names.size();
3455 unsigned int n_nodes;
3456 unsigned int n_cells;
3457 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
3459 out <<
"object \"vertices\" class array type float rank 1 shape "
3460 << spacedim <<
" items " << n_nodes;
3464 out <<
" lsb ieee data 0" <<
'\n';
3465 offset += n_nodes * spacedim *
sizeof(float);
3469 out <<
" data follows" <<
'\n';
3478 out <<
"object \"cells\" class array type int rank 1 shape "
3483 out <<
" lsb binary data " << offset <<
'\n';
3484 offset += n_cells *
sizeof(
int);
3488 out <<
" data follows" <<
'\n';
3494 out <<
"attribute \"element type\" string \"";
3501 out <<
"\"" <<
'\n' <<
"attribute \"ref\" string \"positions\"" <<
'\n';
3508 out <<
"object \"neighbors\" class array type int rank 1 shape "
3512 for (
const auto &patch : patches)
3515 const unsigned int n1 = (dim > 0) ? n : 1;
3516 const unsigned int n2 = (dim > 1) ? n : 1;
3517 const unsigned int n3 = (dim > 2) ? n : 1;
3518 unsigned int cells_per_patch = Utilities::fixed_power<dim>(n);
3519 unsigned int dx = 1;
3520 unsigned int dy = n;
3521 unsigned int dz = n * n;
3523 const unsigned int patch_start =
3526 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3527 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3528 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3530 const unsigned int nx = i1 *
dx;
3531 const unsigned int ny = i2 * dy;
3532 const unsigned int nz = i3 * dz;
3544 const unsigned int nn = patch.
neighbors[0];
3548 << (nn * cells_per_patch + ny + nz +
dx * (n - 1));
3554 out <<
'\t' << patch_start + nx -
dx + ny + nz;
3559 const unsigned int nn = patch.
neighbors[1];
3562 out << (nn * cells_per_patch + ny + nz);
3568 out <<
'\t' << patch_start + nx +
dx + ny + nz;
3575 const unsigned int nn = patch.
neighbors[2];
3579 << (nn * cells_per_patch + nx + nz + dy * (n - 1));
3585 out <<
'\t' << patch_start + nx + ny - dy + nz;
3590 const unsigned int nn = patch.
neighbors[3];
3593 out << (nn * cells_per_patch + nx + nz);
3599 out <<
'\t' << patch_start + nx + ny + dy + nz;
3607 const unsigned int nn = patch.
neighbors[4];
3611 << (nn * cells_per_patch + nx + ny + dz * (n - 1));
3617 out <<
'\t' << patch_start + nx + ny + nz - dz;
3622 const unsigned int nn = patch.
neighbors[5];
3625 out << (nn * cells_per_patch + nx + ny);
3631 out <<
'\t' << patch_start + nx + ny + nz + dz;
3639 if (n_data_sets != 0)
3641 out <<
"object \"data\" class array type float rank 1 shape "
3642 << n_data_sets <<
" items " << n_nodes;
3646 out <<
" lsb ieee data " << offset <<
'\n';
3647 offset += n_data_sets * n_nodes *
3648 ((flags.
data_double) ?
sizeof(
double) :
sizeof(float));
3652 out <<
" data follows" <<
'\n';
3657 out <<
"attribute \"dep\" string \"positions\"" <<
'\n';
3661 out <<
"object \"data\" class constantarray type float rank 0 items "
3662 << n_nodes <<
" data follows" <<
'\n'
3668 out <<
"object \"deal data\" class field" <<
'\n'
3669 <<
"component \"positions\" value \"vertices\"" <<
'\n'
3670 <<
"component \"connections\" value \"cells\"" <<
'\n'
3671 <<
"component \"data\" value \"data\"" <<
'\n';
3674 out <<
"component \"neighbors\" value \"neighbors\"" <<
'\n';
3681 out <<
"end" <<
'\n';
3699 template <
int dim,
int spacedim>
3703 const std::vector<std::string> & data_names,
3705 std::tuple<
unsigned int,
3714#ifndef DEAL_II_WITH_MPI
3724 if (patches.size() == 0)
3728 const unsigned int n_data_sets = data_names.size();
3732 out <<
"# This file was generated by the deal.II library." <<
'\n'
3736 <<
"# For a description of the GNUPLOT format see the GNUPLOT manual."
3743 for (
unsigned int spacedim_n = 0; spacedim_n < spacedim; ++spacedim_n)
3748 for (
const auto &data_name : data_names)
3749 out <<
'<' << data_name <<
"> ";
3755 for (
const auto &patch : patches)
3758 const unsigned int n_points_per_direction = n_subdivisions + 1;
3760 Assert((patch.
data.n_rows() == n_data_sets &&
3762 (patch.
data.n_rows() == n_data_sets + spacedim &&
3765 (n_data_sets + spacedim) :
3767 patch.
data.n_rows()));
3769 auto output_point_data =
3770 [&out, &patch, n_data_sets](
const unsigned int point_index)
mutable {
3771 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3772 out << patch.data(data_set, point_index) <<
' ';
3781 Assert(patch.data.n_cols() == 1,
3783 n_subdivisions + 1));
3787 out << get_equispaced_location(patch, {}, n_subdivisions)
3789 output_point_data(0);
3799 Assert(patch.data.n_cols() ==
3800 Utilities::fixed_power<dim>(n_points_per_direction),
3802 n_subdivisions + 1));
3804 for (
unsigned int i1 = 0; i1 < n_points_per_direction; ++i1)
3807 out << get_equispaced_location(patch, {i1}, n_subdivisions)
3810 output_point_data(i1);
3823 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3824 n_points_per_direction),
3826 n_subdivisions + 1));
3828 for (
unsigned int i2 = 0; i2 < n_points_per_direction; ++i2)
3830 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3834 out << get_equispaced_location(patch,
3839 output_point_data(i1 + i2 * n_points_per_direction);
3864 out << get_node_location(patch, 0) <<
' ';
3865 output_point_data(0);
3868 out << get_node_location(patch, 1) <<
' ';
3869 output_point_data(1);
3873 out << get_node_location(patch, 2) <<
' ';
3874 output_point_data(2);
3877 out << get_node_location(patch, 2) <<
' ';
3878 output_point_data(2);
3898 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3899 n_points_per_direction),
3901 n_subdivisions + 1));
3906 for (
unsigned int i3 = 0; i3 < n_points_per_direction; ++i3)
3907 for (
unsigned int i2 = 0; i2 < n_points_per_direction;
3909 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3914 get_equispaced_location(patch,
3918 if (i1 < n_subdivisions)
3921 out << this_point <<
' ';
3922 output_point_data(i1 +
3923 i2 * n_points_per_direction +
3924 i3 * n_points_per_direction *
3925 n_points_per_direction);
3929 out << get_equispaced_location(patch,
3934 output_point_data((i1 + 1) +
3935 i2 * n_points_per_direction +
3936 i3 * n_points_per_direction *
3937 n_points_per_direction);
3941 out <<
'\n' <<
'\n';
3945 if (i2 < n_subdivisions)
3948 out << this_point <<
' ';
3949 output_point_data(i1 +
3950 i2 * n_points_per_direction +
3951 i3 * n_points_per_direction *
3952 n_points_per_direction);
3956 out << get_equispaced_location(patch,
3962 i1 + (i2 + 1) * n_points_per_direction +
3963 i3 * n_points_per_direction *
3964 n_points_per_direction);
3968 out <<
'\n' <<
'\n';
3972 if (i3 < n_subdivisions)
3975 out << this_point <<
' ';
3976 output_point_data(i1 +
3977 i2 * n_points_per_direction +
3978 i3 * n_points_per_direction *
3979 n_points_per_direction);
3983 out << get_equispaced_location(patch,
3989 i1 + i2 * n_points_per_direction +
3990 (i3 + 1) * n_points_per_direction *
3991 n_points_per_direction);
3994 out <<
'\n' <<
'\n';
4003 for (
const unsigned int v : {0, 1, 2, 0, 3, 2})
4005 out << get_node_location(patch, v) <<
' ';
4006 output_point_data(v);
4011 for (
const unsigned int v : {3, 1})
4013 out << get_node_location(patch, v) <<
' ';
4014 output_point_data(v);
4024 for (
const unsigned int v : {0, 1, 3, 2, 0, 4, 1})
4026 out << get_node_location(patch, v) <<
' ';
4027 output_point_data(v);
4032 for (
const unsigned int v : {2, 4, 3})
4034 out << get_node_location(patch, v) <<
' ';
4035 output_point_data(v);
4049 for (
const unsigned int v : {0, 1, 2, 0, 3, 4, 5, 3})
4051 out << get_node_location(patch, v) <<
' ';
4052 output_point_data(v);
4057 for (
const unsigned int v : {1, 4})
4059 out << get_node_location(patch, v) <<
' ';
4060 output_point_data(v);
4065 for (
const unsigned int v : {2, 5})
4067 out << get_node_location(patch, v) <<
' ';
4068 output_point_data(v);
4093 template <
int dim,
int spacedim>
4095 do_write_povray(
const std::vector<Patch<dim, spacedim>> &,
4096 const std::vector<std::string> &,
4097 const PovrayFlags &,
4101 ExcMessage(
"Writing files in POVRAY format is only supported "
4102 "for two-dimensional meshes."));
4108 do_write_povray(
const std::vector<Patch<2, 2>> &patches,
4109 const std::vector<std::string> &data_names,
4110 const PovrayFlags & flags,
4115#ifndef DEAL_II_WITH_MPI
4124 if (patches.size() == 0)
4127 constexpr int dim = 2;
4129 constexpr int spacedim = 2;
4131 const unsigned int n_data_sets = data_names.size();
4137 <<
"/* This file was generated by the deal.II library." <<
'\n'
4141 <<
" For a description of the POVRAY format see the POVRAY manual."
4146 out <<
"#include \"colors.inc\" " <<
'\n'
4147 <<
"#include \"textures.inc\" " <<
'\n';
4151 if (flags.external_data)
4152 out <<
"#include \"data.inc\" " <<
'\n';
4158 <<
"camera {" <<
'\n'
4159 <<
" location <1,4,-7>" <<
'\n'
4160 <<
" look_at <0,0,0>" <<
'\n'
4161 <<
" angle 30" <<
'\n'
4166 <<
"light_source {" <<
'\n'
4167 <<
" <1,4,-7>" <<
'\n'
4168 <<
" color Grey" <<
'\n'
4171 <<
"light_source {" <<
'\n'
4172 <<
" <0,20,0>" <<
'\n'
4173 <<
" color White" <<
'\n'
4180 double hmin = patches[0].data(0, 0);
4181 double hmax = patches[0].data(0, 0);
4183 for (
const auto &patch : patches)
4187 Assert((patch.
data.n_rows() == n_data_sets &&
4189 (patch.
data.n_rows() == n_data_sets + spacedim &&
4192 (n_data_sets + spacedim) :
4194 patch.
data.n_rows()));
4196 Utilities::fixed_power<dim>(n_subdivisions + 1),
4198 n_subdivisions + 1));
4200 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
4201 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
4203 const int dl = i * (n_subdivisions + 1) + j;
4204 if (patch.
data(0, dl) < hmin)
4205 hmin = patch.
data(0, dl);
4206 if (patch.
data(0, dl) > hmax)
4207 hmax = patch.
data(0, dl);
4211 out <<
"#declare HMIN=" << hmin <<
";" <<
'\n'
4212 <<
"#declare HMAX=" << hmax <<
";" <<
'\n'
4215 if (!flags.external_data)
4218 out <<
"#declare Tex=texture{" <<
'\n'
4219 <<
" pigment {" <<
'\n'
4220 <<
" gradient y" <<
'\n'
4221 <<
" scale y*(HMAX-HMIN)*" << 0.1 <<
'\n'
4222 <<
" color_map {" <<
'\n'
4223 <<
" [0.00 color Light_Purple] " <<
'\n'
4224 <<
" [0.95 color Light_Purple] " <<
'\n'
4225 <<
" [1.00 color White] " <<
'\n'
4230 if (!flags.bicubic_patch)
4233 out <<
'\n' <<
"mesh {" <<
'\n';
4237 for (
const auto &patch : patches)
4240 const unsigned int n = n_subdivisions + 1;
4241 const unsigned int d1 = 1;
4242 const unsigned int d2 = n;
4244 Assert((patch.
data.n_rows() == n_data_sets &&
4246 (patch.
data.n_rows() == n_data_sets + spacedim &&
4249 (n_data_sets + spacedim) :
4251 patch.
data.n_rows()));
4252 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
4254 n_subdivisions + 1));
4257 std::vector<Point<spacedim>> ver(n * n);
4259 for (
unsigned int i2 = 0; i2 < n; ++i2)
4260 for (
unsigned int i1 = 0; i1 < n; ++i1)
4263 ver[i1 * d1 + i2 * d2] =
4264 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4268 if (!flags.bicubic_patch)
4271 std::vector<Point<3>> nrml;
4281 for (
unsigned int i = 0; i < n; ++i)
4282 for (
unsigned int j = 0; j < n; ++j)
4284 const unsigned int il = (i == 0) ? i : (i - 1);
4285 const unsigned int ir =
4286 (i == n_subdivisions) ? i : (i + 1);
4287 const unsigned int jl = (j == 0) ? j : (j - 1);
4288 const unsigned int jr =
4289 (j == n_subdivisions) ? j : (j + 1);
4292 ver[ir * d1 + j * d2](0) - ver[il * d1 + j * d2](0);
4293 h1(1) = patch.
data(0, ir * d1 + j * d2) -
4294 patch.
data(0, il * d1 + j * d2);
4296 ver[ir * d1 + j * d2](1) - ver[il * d1 + j * d2](1);
4299 ver[i * d1 + jr * d2](0) - ver[i * d1 + jl * d2](0);
4300 h2(1) = patch.
data(0, i * d1 + jr * d2) -
4301 patch.
data(0, i * d1 + jl * d2);
4303 ver[i * d1 + jr * d2](1) - ver[i * d1 + jl * d2](1);
4305 nrml[i * d1 + j * d2](0) =
4306 h1(1) * h2(2) - h1(2) * h2(1);
4307 nrml[i * d1 + j * d2](1) =
4308 h1(2) * h2(0) - h1(0) * h2(2);
4309 nrml[i * d1 + j * d2](2) =
4310 h1(0) * h2(1) - h1(1) * h2(0);
4315 std::pow(nrml[i * d1 + j * d2](1), 2.) +
4316 std::pow(nrml[i * d1 + j * d2](2), 2.));
4318 if (nrml[i * d1 + j * d2](1) < 0)
4321 for (
unsigned int k = 0; k < 3; ++k)
4322 nrml[i * d1 + j * d2](k) /=
norm;
4327 for (
unsigned int i = 0; i < n_subdivisions; ++i)
4328 for (
unsigned int j = 0; j < n_subdivisions; ++j)
4331 const int dl = i * d1 + j * d2;
4337 out <<
"smooth_triangle {" <<
'\n'
4338 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4339 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0)
4340 <<
", " << nrml[dl](1) <<
", " << nrml[dl](2)
4342 out <<
" \t<" << ver[dl + d1](0) <<
","
4343 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
4344 <<
">, <" << nrml[dl + d1](0) <<
", "
4345 << nrml[dl + d1](1) <<
", " << nrml[dl + d1](2)
4347 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4348 << patch.
data(0, dl + d1 + d2) <<
","
4349 << ver[dl + d1 + d2](1) <<
">, <"
4350 << nrml[dl + d1 + d2](0) <<
", "
4351 << nrml[dl + d1 + d2](1) <<
", "
4352 << nrml[dl + d1 + d2](2) <<
">}" <<
'\n';
4355 out <<
"smooth_triangle {" <<
'\n'
4356 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4357 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0)
4358 <<
", " << nrml[dl](1) <<
", " << nrml[dl](2)
4360 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4361 << patch.
data(0, dl + d1 + d2) <<
","
4362 << ver[dl + d1 + d2](1) <<
">, <"
4363 << nrml[dl + d1 + d2](0) <<
", "
4364 << nrml[dl + d1 + d2](1) <<
", "
4365 << nrml[dl + d1 + d2](2) <<
">," <<
'\n';
4366 out <<
"\t<" << ver[dl + d2](0) <<
","
4367 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
4368 <<
">, <" << nrml[dl + d2](0) <<
", "
4369 << nrml[dl + d2](1) <<
", " << nrml[dl + d2](2)
4375 out <<
"triangle {" <<
'\n'
4376 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4377 <<
"," << ver[dl](1) <<
">," <<
'\n';
4378 out <<
"\t<" << ver[dl + d1](0) <<
","
4379 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
4381 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4382 << patch.
data(0, dl + d1 + d2) <<
","
4383 << ver[dl + d1 + d2](1) <<
">}" <<
'\n';
4386 out <<
"triangle {" <<
'\n'
4387 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4388 <<
"," << ver[dl](1) <<
">," <<
'\n';
4389 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4390 << patch.
data(0, dl + d1 + d2) <<
","
4391 << ver[dl + d1 + d2](1) <<
">," <<
'\n';
4392 out <<
"\t<" << ver[dl + d2](0) <<
","
4393 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
4401 Assert(n_subdivisions == 3,
4404 <<
"bicubic_patch {" <<
'\n'
4405 <<
" type 0" <<
'\n'
4406 <<
" flatness 0" <<
'\n'
4407 <<
" u_steps 0" <<
'\n'
4408 <<
" v_steps 0" <<
'\n';
4409 for (
int i = 0; i < 16; ++i)
4411 out <<
"\t<" << ver[i](0) <<
"," << patch.
data(0, i) <<
","
4412 << ver[i](1) <<
">";
4417 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n';
4421 if (!flags.bicubic_patch)
4424 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n' <<
'\n';
4436 template <
int dim,
int spacedim>
4440 const std::vector<std::string> & data_names,
4442 std::tuple<
unsigned int,
4449 do_write_povray(patches, data_names, flags, out);
4454 template <
int dim,
int spacedim>
4458 const std::vector<std::string> & ,
4460 std::tuple<
unsigned int,
4472 template <
int spacedim>
4476 const std::vector<std::string> & ,
4478 std::tuple<
unsigned int,
4487#ifndef DEAL_II_WITH_MPI
4496 if (patches.size() == 0)
4506 std::multiset<EpsCell2d> cells;
4510 float min_color_value = std::numeric_limits<float>::max();
4511 float max_color_value = std::numeric_limits<float>::min();
4515 double heights[4] = {0, 0, 0, 0};
4519 for (
const auto &patch : patches)
4522 const unsigned int n = n_subdivisions + 1;
4523 const unsigned int d1 = 1;
4524 const unsigned int d2 = n;
4526 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
4527 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
4531 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4533 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
4535 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
4536 points[3] = get_equispaced_location(patch,
4544 patch.
data.n_rows() == 0,
4547 patch.
data.n_rows()));
4549 patch.
data.n_rows() != 0 ?
4553 heights[1] = patch.
data.n_rows() != 0 ?
4555 (i1 + 1) * d1 + i2 * d2) *
4558 heights[2] = patch.
data.n_rows() != 0 ?
4560 i1 * d1 + (i2 + 1) * d2) *
4563 heights[3] = patch.
data.n_rows() != 0 ?
4565 (i1 + 1) * d1 + (i2 + 1) * d2) *
4572 for (
unsigned int i = 0; i < 4; ++i)
4573 heights[i] = points[i](2);
4598 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4600 const double x = points[vertex](0), y = points[vertex](1),
4601 z = -heights[vertex];
4603 eps_cell.vertices[vertex](0) = -cz * x + sz * y;
4604 eps_cell.vertices[vertex](1) =
4605 -cx * sz * x - cx * cz * y - sx * z;
4629 (points[0] + points[1] + points[2] + points[3]) / 4;
4630 const double center_height =
4631 -(heights[0] + heights[1] + heights[2] + heights[3]) / 4;
4634 eps_cell.depth = -sx * sz * center_point(0) -
4635 sx * cz * center_point(1) + cx * center_height;
4640 patch.
data.n_rows() == 0,
4643 patch.
data.n_rows()));
4644 const double color_values[4] = {
4645 patch.
data.n_rows() != 0 ?
4649 patch.
data.n_rows() != 0 ?
4653 patch.
data.n_rows() != 0 ?
4657 patch.
data.n_rows() != 0 ?
4659 (i1 + 1) * d1 + (i2 + 1) * d2) :
4663 eps_cell.color_value = (color_values[0] + color_values[1] +
4664 color_values[3] + color_values[2]) /
4669 std::min(min_color_value, eps_cell.color_value);
4671 std::max(max_color_value, eps_cell.color_value);
4675 cells.insert(eps_cell);
4681 double x_min = cells.begin()->vertices[0](0);
4682 double x_max = x_min;
4683 double y_min = cells.begin()->vertices[0](1);
4684 double y_max = y_min;
4686 for (
const auto &cell : cells)
4687 for (
const auto &vertex : cell.vertices)
4689 x_min =
std::min(x_min, vertex(0));
4690 x_max =
std::max(x_max, vertex(0));
4691 y_min =
std::min(y_min, vertex(1));
4692 y_max =
std::max(y_max, vertex(1));
4697 const double scale =
4701 const Point<2> offset(x_min, y_min);
4706 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n'
4707 <<
"%%Title: deal.II Output" <<
'\n'
4708 <<
"%%Creator: the deal.II library" <<
'\n'
4711 <<
"%%BoundingBox: "
4715 <<
static_cast<unsigned int>((x_max - x_min) * scale + 0.5) <<
' '
4716 <<
static_cast<unsigned int>((y_max - y_min) * scale + 0.5) <<
'\n';
4725 out <<
"/m {moveto} bind def" <<
'\n'
4726 <<
"/l {lineto} bind def" <<
'\n'
4727 <<
"/s {setrgbcolor} bind def" <<
'\n'
4728 <<
"/sg {setgray} bind def" <<
'\n'
4729 <<
"/lx {lineto closepath stroke} bind def" <<
'\n'
4730 <<
"/lf {lineto closepath fill} bind def" <<
'\n';
4732 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4734 out << flags.
line_width <<
" setlinewidth" <<
'\n';
4742 if (max_color_value == min_color_value)
4743 max_color_value = min_color_value + 1;
4747 for (
const auto &cell : cells)
4760 out << rgb_values.
red <<
" sg ";
4762 out << rgb_values.
red <<
' ' << rgb_values.
green <<
' '
4763 << rgb_values.
blue <<
" s ";
4768 out << (cell.vertices[0] - offset) * scale <<
" m "
4769 << (cell.vertices[1] - offset) * scale <<
" l "
4770 << (cell.vertices[3] - offset) * scale <<
" l "
4771 << (cell.vertices[2] - offset) * scale <<
" lf" <<
'\n';
4776 << (cell.vertices[0] - offset) * scale <<
" m "
4777 << (cell.vertices[1] - offset) * scale <<
" l "
4778 << (cell.vertices[3] - offset) * scale <<
" l "
4779 << (cell.vertices[2] - offset) * scale <<
" lx" <<
'\n';
4781 out <<
"showpage" <<
'\n';
4790 template <
int dim,
int spacedim>
4794 const std::vector<std::string> & data_names,
4796 std::tuple<
unsigned int,
4812#ifndef DEAL_II_WITH_MPI
4821 if (patches.size() == 0)
4825 GmvStream gmv_out(out, flags);
4826 const unsigned int n_data_sets = data_names.size();
4829 Assert((patches[0].data.n_rows() == n_data_sets &&
4830 !patches[0].points_are_available) ||
4831 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4832 patches[0].points_are_available),
4834 (n_data_sets + spacedim) :
4836 patches[0].data.n_rows()));
4840 out <<
"gmvinput ascii" <<
'\n' <<
'\n';
4843 unsigned int n_nodes;
4844 unsigned int n_cells;
4845 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4860 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
4862 &write_gmv_reorder_data_vectors<dim, spacedim>;
4870 out <<
"nodes " << n_nodes <<
'\n';
4871 for (
unsigned int d = 0; d < spacedim; ++d)
4873 gmv_out.selected_component = d;
4879 for (
unsigned int d = spacedim; d < 3; ++d)
4881 for (
unsigned int i = 0; i < n_nodes; ++i)
4888 out <<
"cells " << n_cells <<
'\n';
4893 out <<
"variable" <<
'\n';
4897 reorder_task.
join();
4901 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4903 out << data_names[data_set] <<
" 1" <<
'\n';
4904 std::copy(data_vectors[data_set].begin(),
4905 data_vectors[data_set].end(),
4906 std::ostream_iterator<double>(out,
" "));
4907 out <<
'\n' <<
'\n';
4913 out <<
"endvars" <<
'\n';
4916 out <<
"endgmv" <<
'\n';
4927 template <
int dim,
int spacedim>
4931 const std::vector<std::string> & data_names,
4933 std::tuple<
unsigned int,
4947#ifndef DEAL_II_WITH_MPI
4956 if (patches.size() == 0)
4960 TecplotStream tecplot_out(out, flags);
4962 const unsigned int n_data_sets = data_names.size();
4965 Assert((patches[0].data.n_rows() == n_data_sets &&
4966 !patches[0].points_are_available) ||
4967 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4968 patches[0].points_are_available),
4970 (n_data_sets + spacedim) :
4972 patches[0].data.n_rows()));
4975 unsigned int n_nodes;
4976 unsigned int n_cells;
4977 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4983 <<
"# This file was generated by the deal.II library." <<
'\n'
4987 <<
"# For a description of the Tecplot format see the Tecplot documentation."
4992 out <<
"Variables=";
5000 out <<
"\"x\", \"y\"";
5003 out <<
"\"x\", \"y\", \"z\"";
5009 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5010 out <<
", \"" << data_names[data_set] <<
"\"";
5016 out <<
"t=\"" << flags.
zone_name <<
"\" ";
5019 out <<
"strandid=1, solutiontime=" << flags.
solution_time <<
", ";
5021 out <<
"f=feblock, n=" << n_nodes <<
", e=" << n_cells
5022 <<
", et=" << tecplot_cell_type[dim] <<
'\n';
5041 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5043 &write_gmv_reorder_data_vectors<dim, spacedim>;
5051 for (
unsigned int d = 0; d < spacedim; ++d)
5053 tecplot_out.selected_component = d;
5064 reorder_task.
join();
5067 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5069 std::copy(data_vectors[data_set].begin(),
5070 data_vectors[data_set].end(),
5071 std::ostream_iterator<double>(out,
"\n"));
5089#ifdef DEAL_II_HAVE_TECPLOT
5096 TecplotMacros(
const unsigned int n_nodes = 0,
5097 const unsigned int n_vars = 0,
5098 const unsigned int n_cells = 0,
5099 const unsigned int n_vert = 0);
5102 nd(
const unsigned int i,
const unsigned int j);
5104 cd(
const unsigned int i,
const unsigned int j);
5105 std::vector<float> nodalData;
5106 std::vector<int> connData;
5109 unsigned int n_nodes;
5110 unsigned int n_vars;
5111 unsigned int n_cells;
5112 unsigned int n_vert;
5116 inline TecplotMacros::TecplotMacros(
const unsigned int n_nodes,
5117 const unsigned int n_vars,
5118 const unsigned int n_cells,
5119 const unsigned int n_vert)
5125 nodalData.resize(n_nodes * n_vars);
5126 connData.resize(n_cells * n_vert);
5131 inline TecplotMacros::~TecplotMacros()
5137 TecplotMacros::nd(
const unsigned int i,
const unsigned int j)
5139 return nodalData[i * n_nodes + j];
5145 TecplotMacros::cd(
const unsigned int i,
const unsigned int j)
5147 return connData[i + j * n_vert];
5158 template <
int dim,
int spacedim>
5162 const std::vector<std::string> & data_names,
5164 std::tuple<
unsigned int,
5168 & nonscalar_data_ranges,
5177#ifndef DEAL_II_HAVE_TECPLOT
5180 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5188 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5195 char *file_name = (
char *)flags.tecplot_binary_file_name;
5197 if (file_name ==
nullptr)
5202 ExcMessage(
"Specify the name of the tecplot_binary"
5203 " file through the TecplotFlags interface."));
5204 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5211# ifndef DEAL_II_WITH_MPI
5218 Assert(patches.size() > 0, ExcNoPatches());
5220 if (patches.size() == 0)
5224 const unsigned int n_data_sets = data_names.size();
5227 Assert((patches[0].data.n_rows() == n_data_sets &&
5228 !patches[0].points_are_available) ||
5229 (patches[0].data.n_rows() == n_data_sets + spacedim &&
5230 patches[0].points_are_available),
5232 (n_data_sets + spacedim) :
5234 patches[0].data.n_rows()));
5237 unsigned int n_nodes;
5238 unsigned int n_cells;
5239 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
5241 const unsigned int vars_per_node = (spacedim + n_data_sets),
5244 TecplotMacros tm(n_nodes, vars_per_node, n_cells, nodes_per_cell);
5246 int is_double = 0, tec_debug = 0, cell_type = tecplot_binary_cell_type[dim];
5248 std::string tec_var_names;
5252 tec_var_names =
"x y";
5255 tec_var_names =
"x y z";
5261 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5263 tec_var_names +=
" ";
5264 tec_var_names += data_names[data_set];
5280 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5282 &write_gmv_reorder_data_vectors<dim, spacedim>;
5288 for (
unsigned int d = 1; d <= spacedim; ++d)
5290 unsigned int entry = 0;
5292 for (
const auto &patch : patches)
5300 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5301 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5303 const double x_frac = i * 1. / n_subdivisions,
5304 y_frac = j * 1. / n_subdivisions;
5306 tm.nd((d - 1), entry) =
static_cast<float>(
5307 (((patch.
vertices[1](d - 1) * x_frac) +
5308 (patch.
vertices[0](d - 1) * (1 - x_frac))) *
5310 ((patch.
vertices[3](d - 1) * x_frac) +
5311 (patch.
vertices[2](d - 1) * (1 - x_frac))) *
5320 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5321 for (
unsigned int k = 0; k < n_subdivisions + 1; ++k)
5322 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5324 const double x_frac = i * 1. / n_subdivisions,
5325 y_frac = k * 1. / n_subdivisions,
5326 z_frac = j * 1. / n_subdivisions;
5329 tm.nd((d - 1), entry) =
static_cast<float>(
5330 ((((patch.
vertices[1](d - 1) * x_frac) +
5331 (patch.
vertices[0](d - 1) * (1 - x_frac))) *
5333 ((patch.
vertices[3](d - 1) * x_frac) +
5334 (patch.
vertices[2](d - 1) * (1 - x_frac))) *
5337 (((patch.
vertices[5](d - 1) * x_frac) +
5338 (patch.
vertices[4](d - 1) * (1 - x_frac))) *
5340 ((patch.
vertices[7](d - 1) * x_frac) +
5341 (patch.
vertices[6](d - 1) * (1 - x_frac))) *
5359 reorder_task.
join();
5362 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5363 for (
unsigned int entry = 0; entry < data_vectors[data_set].size();
5365 tm.nd((spacedim + data_set), entry) =
5366 static_cast<float>(data_vectors[data_set][entry]);
5372 unsigned int first_vertex_of_patch = 0;
5373 unsigned int elem = 0;
5375 for (
const auto &patch : patches)
5378 const unsigned int n = n_subdivisions + 1;
5379 const unsigned int d1 = 1;
5380 const unsigned int d2 = n;
5381 const unsigned int d3 = n * n;
5387 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5388 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5391 first_vertex_of_patch + (i1)*d1 + (i2)*d2 + 1;
5393 first_vertex_of_patch + (i1 + 1) * d1 + (i2)*d2 + 1;
5394 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5397 first_vertex_of_patch + (i1)*d1 + (i2 + 1) * d2 + 1;
5406 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5407 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5408 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5413 tm.cd(0, elem) = first_vertex_of_patch + (i1)*d1 +
5414 (i2)*d2 + (i3)*d3 + 1;
5415 tm.cd(1, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5416 (i2)*d2 + (i3)*d3 + 1;
5417 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5418 (i2 + 1) * d2 + (i3)*d3 + 1;
5419 tm.cd(3, elem) = first_vertex_of_patch + (i1)*d1 +
5420 (i2 + 1) * d2 + (i3)*d3 + 1;
5421 tm.cd(4, elem) = first_vertex_of_patch + (i1)*d1 +
5422 (i2)*d2 + (i3 + 1) * d3 + 1;
5423 tm.cd(5, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5424 (i2)*d2 + (i3 + 1) * d3 + 1;
5425 tm.cd(6, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5426 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5427 tm.cd(7, elem) = first_vertex_of_patch + (i1)*d1 +
5428 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5441 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
5446 int ierr = 0, num_nodes =
static_cast<int>(n_nodes),
5447 num_cells =
static_cast<int>(n_cells);
5449 char dot[2] = {
'.', 0};
5453 char *var_names =
const_cast<char *
>(tec_var_names.c_str());
5454 ierr = TECINI(
nullptr, var_names, file_name, dot, &tec_debug, &is_double);
5456 Assert(ierr == 0, ExcErrorOpeningTecplotFile(file_name));
5458 char FEBLOCK[] = {
'F',
'E',
'B',
'L',
'O',
'C',
'K', 0};
5460 TECZNE(
nullptr, &num_nodes, &num_cells, &cell_type, FEBLOCK,
nullptr);
5462 Assert(ierr == 0, ExcTecplotAPIError());
5464 int total = (vars_per_node * num_nodes);
5466 ierr = TECDAT(&total, tm.nodalData.data(), &is_double);
5468 Assert(ierr == 0, ExcTecplotAPIError());
5470 ierr = TECNOD(tm.connData.data());
5472 Assert(ierr == 0, ExcTecplotAPIError());
5476 Assert(ierr == 0, ExcTecplotAPIError());
5483 template <
int dim,
int spacedim>
5487 const std::vector<std::string> & data_names,
5489 std::tuple<
unsigned int,
5493 & nonscalar_data_ranges,
5499#ifndef DEAL_II_WITH_MPI
5506 Assert(patches.size() > 0, ExcNoPatches());
5508 if (patches.size() == 0)
5512 VtkStream vtk_out(out, flags);
5514 const unsigned int n_data_sets = data_names.size();
5516 if (patches[0].points_are_available)
5528 out <<
"# vtk DataFile Version 3.0" <<
'\n'
5529 <<
"#This file was generated by the deal.II library";
5537 out <<
'\n' <<
"ASCII" <<
'\n';
5539 out <<
"DATASET UNSTRUCTURED_GRID\n" <<
'\n';
5546 const unsigned int n_metadata =
5547 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5548 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5551 out <<
"FIELD FieldData " << n_metadata <<
'\n';
5553 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5555 out <<
"CYCLE 1 1 int\n" << flags.
cycle <<
'\n';
5557 if (flags.
time != std::numeric_limits<double>::min())
5559 out <<
"TIME 1 1 double\n" << flags.
time <<
'\n';
5565 unsigned int n_nodes, n_cells, n_points_and_n_cells;
5566 compute_sizes(patches,
5570 n_points_and_n_cells);
5586 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5588 &write_gmv_reorder_data_vectors<dim, spacedim>;
5596 out <<
"POINTS " << n_nodes <<
" double" <<
'\n';
5601 out <<
"CELLS " << n_cells <<
' ' << n_points_and_n_cells <<
'\n';
5609 out <<
"CELL_TYPES " << n_cells <<
'\n';
5613 for (
const auto &patch : patches)
5615 const auto vtk_cell_id =
5618 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
5619 out <<
' ' << vtk_cell_id[0];
5628 reorder_task.
join();
5633 out <<
"POINT_DATA " << n_nodes <<
'\n';
5637 std::vector<bool> data_set_written(n_data_sets,
false);
5638 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5645 std::get<0>(nonscalar_data_range),
5647 std::get<0>(nonscalar_data_range)));
5648 AssertThrow(std::get<1>(nonscalar_data_range) < n_data_sets,
5652 AssertThrow(std::get<1>(nonscalar_data_range) + 1 -
5653 std::get<0>(nonscalar_data_range) <=
5656 "Can't declare a vector with more than 3 components "
5660 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5661 i <= std::get<1>(nonscalar_data_range);
5663 data_set_written[i] =
true;
5669 if (!std::get<2>(nonscalar_data_range).empty())
5670 out << std::get<2>(nonscalar_data_range);
5673 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5674 i < std::get<1>(nonscalar_data_range);
5676 out << data_names[i] <<
"__";
5677 out << data_names[std::get<1>(nonscalar_data_range)];
5680 out <<
" double" <<
'\n';
5683 for (
unsigned int n = 0; n < n_nodes; ++n)
5685 switch (std::get<1>(nonscalar_data_range) -
5686 std::get<0>(nonscalar_data_range))
5689 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5694 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5696 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5700 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5702 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5704 << data_vectors(std::get<0>(nonscalar_data_range) + 2, n)
5717 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5718 if (data_set_written[data_set] ==
false)
5720 out <<
"SCALARS " << data_names[data_set] <<
" double 1" <<
'\n'
5721 <<
"LOOKUP_TABLE default" <<
'\n';
5722 std::copy(data_vectors[data_set].begin(),
5723 data_vectors[data_set].end(),
5724 std::ostream_iterator<double>(out,
" "));
5740 out <<
"<?xml version=\"1.0\" ?> \n";
5742 out <<
"# vtk DataFile Version 3.0" <<
'\n'
5743 <<
"#This file was generated by the deal.II library";
5752 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"";
5753#ifdef DEAL_II_WITH_ZLIB
5754 out <<
" compressor=\"vtkZLibDataCompressor\"";
5756#ifdef DEAL_II_WORDS_BIGENDIAN
5757 out <<
" byte_order=\"BigEndian\"";
5759 out <<
" byte_order=\"LittleEndian\"";
5763 out <<
"<UnstructuredGrid>";
5773 out <<
" </UnstructuredGrid>\n";
5774 out <<
"</VTKFile>\n";
5779 template <
int dim,
int spacedim>
5783 const std::vector<std::string> & data_names,
5785 std::tuple<
unsigned int,
5789 & nonscalar_data_ranges,
5794 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5801 template <
int dim,
int spacedim>
5805 const std::vector<std::string> & data_names,
5807 std::tuple<
unsigned int,
5811 & nonscalar_data_ranges,
5825 unit.second.find(
'\"') == std::string::npos,
5827 "A physical unit you provided, <" + unit.second +
5828 ">, contained a quotation mark character. This is not allowed."));
5831#ifndef DEAL_II_WITH_MPI
5838 Assert(patches.size() > 0, ExcNoPatches());
5840 if (patches.size() == 0)
5845 out <<
"<Piece NumberOfPoints=\"0\" NumberOfCells=\"0\" >\n"
5847 <<
"<DataArray type=\"UInt8\" Name=\"types\"></DataArray>\n"
5849 <<
" <PointData Scalars=\"scalars\">\n";
5850 std::vector<bool> data_set_written(data_names.size(),
false);
5851 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5854 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5855 i <= std::get<1>(nonscalar_data_range);
5857 data_set_written[i] =
true;
5861 out <<
" <DataArray type=\"Float32\" Name=\"";
5863 if (!std::get<2>(nonscalar_data_range).empty())
5864 out << std::get<2>(nonscalar_data_range);
5867 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5868 i < std::get<1>(nonscalar_data_range);
5870 out << data_names[i] <<
"__";
5871 out << data_names[std::get<1>(nonscalar_data_range)];
5874 out <<
"\" NumberOfComponents=\"3\"></DataArray>\n";
5877 for (
unsigned int data_set = 0; data_set < data_names.size();
5879 if (data_set_written[data_set] ==
false)
5881 out <<
" <DataArray type=\"Float32\" Name=\""
5882 << data_names[data_set] <<
"\"></DataArray>\n";
5885 out <<
" </PointData>\n";
5886 out <<
"</Piece>\n";
5900 const unsigned int n_metadata =
5901 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5902 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5904 out <<
"<FieldData>\n";
5906 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5909 <<
"<DataArray type=\"Float32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
5910 << flags.
cycle <<
"</DataArray>\n";
5912 if (flags.
time != std::numeric_limits<double>::min())
5915 <<
"<DataArray type=\"Float32\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
5916 << flags.
time <<
"</DataArray>\n";
5920 out <<
"</FieldData>\n";
5924 VtuStream vtu_out(out, flags);
5926 const unsigned int n_data_sets = data_names.size();
5929 if (patches[0].points_are_available)
5938#ifdef DEAL_II_WITH_ZLIB
5939 const char *ascii_or_binary =
"binary";
5941 const char * ascii_or_binary =
"ascii";
5946 unsigned int n_nodes, n_cells, n_points_and_n_cells;
5947 compute_sizes(patches,
5951 n_points_and_n_cells);
5967 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5969 &write_gmv_reorder_data_vectors<dim, spacedim, float>;
5978 out <<
"<Piece NumberOfPoints=\"" << n_nodes <<
"\" NumberOfCells=\""
5979 << n_cells <<
"\" >\n";
5980 out <<
" <Points>\n";
5981 out <<
" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\""
5982 << ascii_or_binary <<
"\">\n";
5984 out <<
" </DataArray>\n";
5985 out <<
" </Points>\n\n";
5988 out <<
" <Cells>\n";
5989 out <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\""
5990 << ascii_or_binary <<
"\">\n";
5995 out <<
" </DataArray>\n";
5999 out <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\""
6000 << ascii_or_binary <<
"\">\n";
6002 std::vector<int32_t> offsets;
6003 offsets.reserve(n_cells);
6007#ifdef DEAL_II_WITH_ZLIB
6008 std::vector<std::uint8_t> cell_types;
6010 std::vector<unsigned int> cell_types;
6012 cell_types.reserve(n_cells);
6014 unsigned int first_vertex_of_patch = 0;
6016 for (
const auto &patch : patches)
6018 const auto vtk_cell_id =
6021 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
6023 cell_types.push_back(vtk_cell_id[0]);
6024 first_vertex_of_patch += vtk_cell_id[2];
6025 offsets.push_back(first_vertex_of_patch);
6031 out <<
" </DataArray>\n";
6035 out <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\""
6036 << ascii_or_binary <<
"\">\n";
6039 vtu_out << cell_types;
6041 out <<
" </DataArray>\n";
6042 out <<
" </Cells>\n";
6050 reorder_task.
join();
6055 out <<
" <PointData Scalars=\"scalars\">\n";
6059 std::vector<bool> data_set_written(n_data_sets,
false);
6060 for (
const auto &range : nonscalar_data_ranges)
6062 const auto first_component = std::get<0>(range);
6063 const auto last_component = std::get<1>(range);
6064 const auto &name = std::get<2>(range);
6065 const bool is_tensor =
6066 (std::get<3>(range) ==
6068 const unsigned int n_components = (is_tensor ? 9 : 3);
6075 AssertThrow((last_component + 1 - first_component <= 9),
6077 "Can't declare a tensor with more than 9 components "
6078 "in VTK/VTU format."));
6082 AssertThrow((last_component + 1 - first_component <= 3),
6084 "Can't declare a vector with more than 3 components "
6085 "in VTK/VTU format."));
6089 for (
unsigned int i = first_component; i <= last_component; ++i)
6090 data_set_written[i] =
true;
6094 out <<
" <DataArray type=\"Float32\" Name=\"";
6100 for (
unsigned int i = first_component; i < last_component; ++i)
6101 out << data_names[i] <<
"__";
6102 out << data_names[last_component];
6105 out <<
"\" NumberOfComponents=\"" << n_components <<
"\" format=\""
6106 << ascii_or_binary <<
"\"";
6126 std::vector<float> data;
6127 data.reserve(n_nodes * n_components);
6129 for (
unsigned int n = 0; n < n_nodes; ++n)
6133 switch (last_component - first_component)
6136 data.push_back(data_vectors(first_component, n));
6142 data.push_back(data_vectors(first_component, n));
6143 data.push_back(data_vectors(first_component + 1, n));
6148 data.push_back(data_vectors(first_component, n));
6149 data.push_back(data_vectors(first_component + 1, n));
6150 data.push_back(data_vectors(first_component + 2, n));
6163 const unsigned int size = last_component - first_component + 1;
6167 vtk_data[0][0] = data_vectors(first_component, n);
6172 for (
unsigned int c = 0; c < size; ++c)
6176 vtk_data[ind[0]][ind[1]] =
6177 data_vectors(first_component + c, n);
6183 for (
unsigned int c = 0; c < size; ++c)
6187 vtk_data[ind[0]][ind[1]] =
6188 data_vectors(first_component + c, n);
6199 for (
unsigned int i = 0; i < 3; ++i)
6200 for (
unsigned int j = 0; j < 3; ++j)
6201 data.push_back(vtk_data[i][j]);
6207 out <<
" </DataArray>\n";
6212 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6213 if (data_set_written[data_set] ==
false)
6215 out <<
" <DataArray type=\"Float32\" Name=\""
6216 << data_names[data_set] <<
"\" format=\"" << ascii_or_binary
6221 out <<
" units=\"" << flags.
physical_units.at(data_names[data_set])
6226 std::vector<float> data(data_vectors[data_set].begin(),
6227 data_vectors[data_set].end());
6230 out <<
" </DataArray>\n";
6233 out <<
" </PointData>\n";
6236 out <<
" </Piece>\n";
6250 const std::vector<std::string> &piece_names,
6251 const std::vector<std::string> &data_names,
6253 std::tuple<
unsigned int,
6257 & nonscalar_data_ranges,
6270 unit.second.find(
'\"') == std::string::npos,
6272 "A physical unit you provided, <" + unit.second +
6273 ">, contained a quotation mark character. This is not allowed."));
6276 const unsigned int n_data_sets = data_names.size();
6278 out <<
"<?xml version=\"1.0\"?>\n";
6281 out <<
"#This file was generated by the deal.II library"
6286 <<
"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
6287 out <<
" <PUnstructuredGrid GhostLevel=\"0\">\n";
6288 out <<
" <PPointData Scalars=\"scalars\">\n";
6291 std::vector<bool> data_set_written(n_data_sets,
false);
6292 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
6294 const auto first_component = std::get<0>(nonscalar_data_range);
6295 const auto last_component = std::get<1>(nonscalar_data_range);
6296 const bool is_tensor =
6297 (std::get<3>(nonscalar_data_range) ==
6299 const unsigned int n_components = (is_tensor ? 9 : 3);
6306 AssertThrow((last_component + 1 - first_component <= 9),
6308 "Can't declare a tensor with more than 9 components "
6313 Assert((last_component + 1 - first_component <= 3),
6315 "Can't declare a vector with more than 3 components "
6320 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6321 i <= std::get<1>(nonscalar_data_range);
6323 data_set_written[i] =
true;
6327 out <<
" <PDataArray type=\"Float32\" Name=\"";
6329 const std::string &name = std::get<2>(nonscalar_data_range);
6334 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6335 i < std::get<1>(nonscalar_data_range);
6337 out << data_names[i] <<
"__";
6338 out << data_names[std::get<1>(nonscalar_data_range)];
6341 out <<
"\" NumberOfComponents=\"" << n_components
6342 <<
"\" format=\"ascii\"";
6354 data_names[std::get<1>(nonscalar_data_range)]) !=
6358 data_names[std::get<1>(nonscalar_data_range)])
6366 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6367 if (data_set_written[data_set] ==
false)
6369 out <<
" <PDataArray type=\"Float32\" Name=\""
6370 << data_names[data_set] <<
"\" format=\"ascii\"";
6374 out <<
" units=\"" << flags.
physical_units.at(data_names[data_set])
6380 out <<
" </PPointData>\n";
6382 out <<
" <PPoints>\n";
6383 out <<
" <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
6384 out <<
" </PPoints>\n";
6386 for (
const auto &piece_name : piece_names)
6387 out <<
" <Piece Source=\"" << piece_name <<
"\"/>\n";
6389 out <<
" </PUnstructuredGrid>\n";
6390 out <<
"</VTKFile>\n";
6403 const std::vector<std::pair<double, std::string>> ×_and_names)
6407 out <<
"<?xml version=\"1.0\"?>\n";
6410 out <<
"#This file was generated by the deal.II library"
6415 <<
"<VTKFile type=\"Collection\" version=\"0.1\" ByteOrder=\"LittleEndian\">\n";
6416 out <<
" <Collection>\n";
6418 std::streamsize ss = out.precision();
6421 for (
const auto &time_and_name : times_and_names)
6422 out <<
" <DataSet timestep=\"" << time_and_name.first
6423 <<
"\" group=\"\" part=\"0\" file=\"" << time_and_name.second
6426 out <<
" </Collection>\n";
6427 out <<
"</VTKFile>\n";
6439 const std::vector<std::string> &piece_names)
6441 out <<
"!NBLOCKS " << piece_names.size() <<
'\n';
6442 for (
const auto &piece_name : piece_names)
6443 out << piece_name <<
'\n';
6452 const std::vector<std::vector<std::string>> &piece_names)
6456 if (piece_names.size() == 0)
6459 const double nblocks = piece_names[0].size();
6461 ExcMessage(
"piece_names should be a vector of nonempty vectors."));
6463 out <<
"!NBLOCKS " << nblocks <<
'\n';
6464 for (
const auto &domain : piece_names)
6466 Assert(domain.size() == nblocks,
6468 "piece_names should be a vector of equal sized vectors."));
6469 for (
const auto &subdomain : domain)
6470 out << subdomain <<
'\n';
6481 const std::vector<std::pair<
double, std::vector<std::string>>>
6482 ×_and_piece_names)
6486 if (times_and_piece_names.size() == 0)
6489 const double nblocks = times_and_piece_names[0].second.size();
6493 "time_and_piece_names should contain nonempty vectors of filenames for every timestep."));
6495 for (
const auto &domain : times_and_piece_names)
6496 out <<
"!TIME " << domain.first <<
'\n';
6498 out <<
"!NBLOCKS " << nblocks <<
'\n';
6499 for (
const auto &domain : times_and_piece_names)
6501 Assert(domain.second.size() == nblocks,
6503 "piece_names should be a vector of equal sized vectors."));
6504 for (
const auto &subdomain : domain.second)
6505 out << subdomain <<
'\n';
6513 template <
int dim,
int spacedim>
6517 const std::vector<std::string> &,
6519 std::tuple<
unsigned int,
6529 template <
int spacedim>
6533 const std::vector<std::string> & ,
6535 std::tuple<
unsigned int,
6543 const unsigned int height = flags.
height;
6544 unsigned int width = flags.
width;
6547 unsigned int margin_in_percent = 0;
6549 margin_in_percent = 5;
6553 double x_dimension, y_dimension, z_dimension;
6555 const auto &first_patch = patches[0];
6557 unsigned int n_subdivisions = first_patch.n_subdivisions;
6558 unsigned int n = n_subdivisions + 1;
6559 const unsigned int d1 = 1;
6560 const unsigned int d2 = n;
6563 std::array<Point<spacedim>, 4> projected_points;
6566 std::array<Point<2>, 4> projection_decompositions;
6569 get_equispaced_location(first_patch, {0, 0}, n_subdivisions);
6571 if (first_patch.data.n_rows() != 0)
6576 double x_min = projected_point[0];
6577 double x_max = x_min;
6578 double y_min = projected_point[1];
6579 double y_max = y_min;
6580 double z_min = first_patch.data.n_rows() != 0 ?
6583 double z_max = z_min;
6586 for (
const auto &patch : patches)
6589 n = n_subdivisions + 1;
6591 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6593 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6595 projected_points[0] =
6596 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
6597 projected_points[1] =
6598 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
6599 projected_points[2] =
6600 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
6601 projected_points[3] = get_equispaced_location(patch,
6605 x_min =
std::min(x_min, projected_points[0][0]);
6606 x_min =
std::min(x_min, projected_points[1][0]);
6607 x_min =
std::min(x_min, projected_points[2][0]);
6608 x_min =
std::min(x_min, projected_points[3][0]);
6610 x_max =
std::max(x_max, projected_points[0][0]);
6611 x_max =
std::max(x_max, projected_points[1][0]);
6612 x_max =
std::max(x_max, projected_points[2][0]);
6613 x_max =
std::max(x_max, projected_points[3][0]);
6615 y_min =
std::min(y_min, projected_points[0][1]);
6616 y_min =
std::min(y_min, projected_points[1][1]);
6617 y_min =
std::min(y_min, projected_points[2][1]);
6618 y_min =
std::min(y_min, projected_points[3][1]);
6620 y_max =
std::max(y_max, projected_points[0][1]);
6621 y_max =
std::max(y_max, projected_points[1][1]);
6622 y_max =
std::max(y_max, projected_points[2][1]);
6623 y_max =
std::max(y_max, projected_points[3][1]);
6626 patch.
data.n_rows() == 0,
6629 patch.
data.n_rows()));
6631 z_min = std::min<double>(z_min,
6633 i1 * d1 + i2 * d2));
6634 z_min = std::min<double>(z_min,
6636 (i1 + 1) * d1 + i2 * d2));
6637 z_min = std::min<double>(z_min,
6639 i1 * d1 + (i2 + 1) * d2));
6641 std::min<double>(z_min,
6643 (i1 + 1) * d1 + (i2 + 1) * d2));
6645 z_max = std::max<double>(z_max,
6647 i1 * d1 + i2 * d2));
6648 z_max = std::max<double>(z_max,
6650 (i1 + 1) * d1 + i2 * d2));
6651 z_max = std::max<double>(z_max,
6653 i1 * d1 + (i2 + 1) * d2));
6655 std::max<double>(z_max,
6657 (i1 + 1) * d1 + (i2 + 1) * d2));
6662 x_dimension = x_max - x_min;
6663 y_dimension = y_max - y_min;
6664 z_dimension = z_max - z_min;
6671 float camera_focus = 0;
6674 camera_position[0] = 0.;
6675 camera_position[1] = 0.;
6676 camera_position[2] = z_min + 2. * z_dimension;
6678 camera_direction[0] = 0.;
6679 camera_direction[1] = 0.;
6680 camera_direction[2] = -1.;
6682 camera_horizontal[0] = 1.;
6683 camera_horizontal[1] = 0.;
6684 camera_horizontal[2] = 0.;
6686 camera_focus = .5 * z_dimension;
6692 const float angle_factor = 3.14159265f / 180.f;
6695 camera_position_temp[1] =
6698 camera_position_temp[2] =
6702 camera_direction_temp[1] =
6705 camera_direction_temp[2] =
6709 camera_horizontal_temp[1] =
6712 camera_horizontal_temp[2] =
6716 camera_position[1] = camera_position_temp[1];
6717 camera_position[2] = camera_position_temp[2];
6719 camera_direction[1] = camera_direction_temp[1];
6720 camera_direction[2] = camera_direction_temp[2];
6722 camera_horizontal[1] = camera_horizontal_temp[1];
6723 camera_horizontal[2] = camera_horizontal_temp[2];
6726 camera_position_temp[0] =
6729 camera_position_temp[1] =
6733 camera_direction_temp[0] =
6736 camera_direction_temp[1] =
6740 camera_horizontal_temp[0] =
6743 camera_horizontal_temp[1] =
6747 camera_position[0] = camera_position_temp[0];
6748 camera_position[1] = camera_position_temp[1];
6750 camera_direction[0] = camera_direction_temp[0];
6751 camera_direction[1] = camera_direction_temp[1];
6753 camera_horizontal[0] = camera_horizontal_temp[0];
6754 camera_horizontal[1] = camera_horizontal_temp[1];
6757 camera_position[0] = x_min + .5 * x_dimension;
6758 camera_position[1] = y_min + .5 * y_dimension;
6760 camera_position[0] += (z_min + 2. * z_dimension) *
6763 camera_position[1] -= (z_min + 2. * z_dimension) *
6769 double x_min_perspective, y_min_perspective;
6770 double x_max_perspective, y_max_perspective;
6771 double x_dimension_perspective, y_dimension_perspective;
6773 n_subdivisions = first_patch.n_subdivisions;
6774 n = n_subdivisions + 1;
6779 get_equispaced_location(first_patch, {0, 0}, n_subdivisions);
6781 if (first_patch.data.n_rows() != 0)
6786 point[0] = projected_point[0];
6787 point[1] = projected_point[1];
6788 point[2] = first_patch.data.n_rows() != 0 ?
6792 projection_decomposition = svg_project_point(point,
6798 x_min_perspective = projection_decomposition[0];
6799 x_max_perspective = projection_decomposition[0];
6800 y_min_perspective = projection_decomposition[1];
6801 y_max_perspective = projection_decomposition[1];
6804 for (
const auto &patch : patches)
6807 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6809 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6812 {get_equispaced_location(patch, {i1, i2}, n_subdivisions),
6813 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions),
6814 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions),
6815 get_equispaced_location(patch,
6820 patch.
data.n_rows() == 0,
6823 patch.
data.n_rows()));
6825 const std::array<Point<3>, 4>
vertices = {
6828 patch.
data.n_rows() != 0 ?
6829 patch.
data(0, i1 * d1 + i2 * d2) :
6833 patch.
data.n_rows() != 0 ?
6834 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6838 patch.
data.n_rows() != 0 ?
6839 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6843 patch.
data.n_rows() != 0 ?
6844 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6847 projection_decompositions = {
6871 static_cast<double>(
6872 projection_decompositions[0][0]));
6875 static_cast<double>(
6876 projection_decompositions[1][0]));
6879 static_cast<double>(
6880 projection_decompositions[2][0]));
6883 static_cast<double>(
6884 projection_decompositions[3][0]));
6888 static_cast<double>(
6889 projection_decompositions[0][0]));
6892 static_cast<double>(
6893 projection_decompositions[1][0]));
6896 static_cast<double>(
6897 projection_decompositions[2][0]));
6900 static_cast<double>(
6901 projection_decompositions[3][0]));
6905 static_cast<double>(
6906 projection_decompositions[0][1]));
6909 static_cast<double>(
6910 projection_decompositions[1][1]));
6913 static_cast<double>(
6914 projection_decompositions[2][1]));
6917 static_cast<double>(
6918 projection_decompositions[3][1]));
6922 static_cast<double>(
6923 projection_decompositions[0][1]));
6926 static_cast<double>(
6927 projection_decompositions[1][1]));
6930 static_cast<double>(
6931 projection_decompositions[2][1]));
6934 static_cast<double>(
6935 projection_decompositions[3][1]));
6940 x_dimension_perspective = x_max_perspective - x_min_perspective;
6941 y_dimension_perspective = y_max_perspective - y_min_perspective;
6943 std::multiset<SvgCell> cells;
6946 for (
const auto &patch : patches)
6950 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6952 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6955 {get_equispaced_location(patch, {i1, i2}, n_subdivisions),
6956 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions),
6957 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions),
6958 get_equispaced_location(patch,
6963 patch.
data.n_rows() == 0,
6966 patch.
data.n_rows()));
6972 cell.vertices[0][2] = patch.
data.n_rows() != 0 ?
6973 patch.
data(0, i1 * d1 + i2 * d2) :
6978 cell.vertices[1][2] = patch.
data.n_rows() != 0 ?
6979 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6984 cell.vertices[2][2] = patch.
data.n_rows() != 0 ?
6985 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6990 cell.vertices[3][2] =
6991 patch.
data.n_rows() != 0 ?
6992 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6995 cell.projected_vertices[0] =
6996 svg_project_point(cell.vertices[0],
7001 cell.projected_vertices[1] =
7002 svg_project_point(cell.vertices[1],
7007 cell.projected_vertices[2] =
7008 svg_project_point(cell.vertices[2],
7013 cell.projected_vertices[3] =
7014 svg_project_point(cell.vertices[3],
7020 cell.center = .25 * (cell.vertices[0] + cell.vertices[1] +
7021 cell.vertices[2] + cell.vertices[3]);
7022 cell.projected_center = svg_project_point(cell.center,
7028 cell.depth = cell.center.distance(camera_position);
7038 width =
static_cast<unsigned int>(
7039 .5 + height * (x_dimension_perspective / y_dimension_perspective));
7040 unsigned int additional_width = 0;
7043 additional_width =
static_cast<unsigned int>(
7047 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\""
7048 << height <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">"
7050 <<
" <rect width=\"" << width + additional_width <<
"\" height=\""
7051 << height <<
"\" style=\"fill:white\"/>" <<
'\n'
7054 unsigned int triangle_counter = 0;
7057 for (
const auto &cell : cells)
7061 for (
unsigned int triangle_index = 0; triangle_index < 4;
7064 switch (triangle_index)
7067 points3d_triangle[0] = cell.vertices[0],
7068 points3d_triangle[1] = cell.vertices[1],
7069 points3d_triangle[2] = cell.center;
7072 points3d_triangle[0] = cell.vertices[1],
7073 points3d_triangle[1] = cell.vertices[3],
7074 points3d_triangle[2] = cell.center;
7077 points3d_triangle[0] = cell.vertices[3],
7078 points3d_triangle[1] = cell.vertices[2],
7079 points3d_triangle[2] = cell.center;
7082 points3d_triangle[0] = cell.vertices[2],
7083 points3d_triangle[1] = cell.vertices[0],
7084 points3d_triangle[2] = cell.center;
7091 svg_get_gradient_parameters(points3d_triangle);
7094 .667 - ((gradient_param[4] - z_min) / z_dimension) * .667;
7096 .667 - ((gradient_param[5] - z_min) / z_dimension) * .667;
7098 unsigned int start_r = 0;
7099 unsigned int start_g = 0;
7100 unsigned int start_b = 0;
7102 unsigned int stop_r = 0;
7103 unsigned int stop_g = 0;
7104 unsigned int stop_b = 0;
7106 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
7107 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
7109 double start_f = start_h * 6. - start_i;
7110 double start_q = 1. - start_f;
7112 double stop_f = stop_h * 6. - stop_i;
7113 double stop_q = 1. - stop_f;
7115 switch (start_i % 6)
7119 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
7122 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
7127 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
7130 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
7134 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
7139 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7149 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7152 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7157 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7160 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7164 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7169 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7175 Point<3> gradient_start_point_3d, gradient_stop_point_3d;
7177 gradient_start_point_3d[0] = gradient_param[0];
7178 gradient_start_point_3d[1] = gradient_param[1];
7179 gradient_start_point_3d[2] = gradient_param[4];
7181 gradient_stop_point_3d[0] = gradient_param[2];
7182 gradient_stop_point_3d[1] = gradient_param[3];
7183 gradient_stop_point_3d[2] = gradient_param[5];
7186 svg_project_point(gradient_start_point_3d,
7192 svg_project_point(gradient_stop_point_3d,
7199 out <<
" <linearGradient id=\"" << triangle_counter
7200 <<
"\" gradientUnits=\"userSpaceOnUse\" "
7202 <<
static_cast<unsigned int>(
7204 ((gradient_start_point[0] - x_min_perspective) /
7205 x_dimension_perspective) *
7206 (width - (width / 100.) * 2. * margin_in_percent) +
7207 ((width / 100.) * margin_in_percent))
7210 <<
static_cast<unsigned int>(
7211 .5 + height - (height / 100.) * margin_in_percent -
7212 ((gradient_start_point[1] - y_min_perspective) /
7213 y_dimension_perspective) *
7214 (height - (height / 100.) * 2. * margin_in_percent))
7217 <<
static_cast<unsigned int>(
7219 ((gradient_stop_point[0] - x_min_perspective) /
7220 x_dimension_perspective) *
7221 (width - (width / 100.) * 2. * margin_in_percent) +
7222 ((width / 100.) * margin_in_percent))
7225 <<
static_cast<unsigned int>(
7226 .5 + height - (height / 100.) * margin_in_percent -
7227 ((gradient_stop_point[1] - y_min_perspective) /
7228 y_dimension_perspective) *
7229 (height - (height / 100.) * 2. * margin_in_percent))
7232 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7233 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n'
7234 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7235 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n'
7236 <<
" </linearGradient>" <<
'\n';
7239 double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
7240 double x3 = cell.projected_center[0];
7241 double y3 = cell.projected_center[1];
7243 switch (triangle_index)
7246 x1 = cell.projected_vertices[0][0],
7247 y1 = cell.projected_vertices[0][1],
7248 x2 = cell.projected_vertices[1][0],
7249 y2 = cell.projected_vertices[1][1];
7252 x1 = cell.projected_vertices[1][0],
7253 y1 = cell.projected_vertices[1][1],
7254 x2 = cell.projected_vertices[3][0],
7255 y2 = cell.projected_vertices[3][1];
7258 x1 = cell.projected_vertices[3][0],
7259 y1 = cell.projected_vertices[3][1],
7260 x2 = cell.projected_vertices[2][0],
7261 y2 = cell.projected_vertices[2][1];
7264 x1 = cell.projected_vertices[2][0],
7265 y1 = cell.projected_vertices[2][1],
7266 x2 = cell.projected_vertices[0][0],
7267 y2 = cell.projected_vertices[0][1];
7273 out <<
" <path d=\"M "
7274 <<
static_cast<unsigned int>(
7276 ((x1 - x_min_perspective) / x_dimension_perspective) *
7277 (width - (width / 100.) * 2. * margin_in_percent) +
7278 ((width / 100.) * margin_in_percent))
7280 <<
static_cast<unsigned int>(
7281 .5 + height - (height / 100.) * margin_in_percent -
7282 ((y1 - y_min_perspective) / y_dimension_perspective) *
7283 (height - (height / 100.) * 2. * margin_in_percent))
7285 <<
static_cast<unsigned int>(
7287 ((x2 - x_min_perspective) / x_dimension_perspective) *
7288 (width - (width / 100.) * 2. * margin_in_percent) +
7289 ((width / 100.) * margin_in_percent))
7291 <<
static_cast<unsigned int>(
7292 .5 + height - (height / 100.) * margin_in_percent -
7293 ((y2 - y_min_perspective) / y_dimension_perspective) *
7294 (height - (height / 100.) * 2. * margin_in_percent))
7296 <<
static_cast<unsigned int>(
7298 ((x3 - x_min_perspective) / x_dimension_perspective) *
7299 (width - (width / 100.) * 2. * margin_in_percent) +
7300 ((width / 100.) * margin_in_percent))
7302 <<
static_cast<unsigned int>(
7303 .5 + height - (height / 100.) * margin_in_percent -
7304 ((y3 - y_min_perspective) / y_dimension_perspective) *
7305 (height - (height / 100.) * 2. * margin_in_percent))
7307 <<
static_cast<unsigned int>(
7309 ((x1 - x_min_perspective) / x_dimension_perspective) *
7310 (width - (width / 100.) * 2. * margin_in_percent) +
7311 ((width / 100.) * margin_in_percent))
7313 <<
static_cast<unsigned int>(
7314 .5 + height - (height / 100.) * margin_in_percent -
7315 ((y1 - y_min_perspective) / y_dimension_perspective) *
7316 (height - (height / 100.) * 2. * margin_in_percent))
7317 <<
"\" style=\"stroke:black; fill:url(#" << triangle_counter
7328 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
7330 unsigned int element_height =
static_cast<unsigned int>(
7331 ((height / 100.) * (71. - 2. * margin_in_percent)) / 4);
7332 unsigned int element_width =
7333 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7335 additional_width = 0;
7338 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7340 for (
unsigned int index = 0; index < 4; ++index)
7342 double start_h = .667 - ((index + 1) / 4.) * .667;
7343 double stop_h = .667 - (index / 4.) * .667;
7345 unsigned int start_r = 0;
7346 unsigned int start_g = 0;
7347 unsigned int start_b = 0;
7349 unsigned int stop_r = 0;
7350 unsigned int stop_g = 0;
7351 unsigned int stop_b = 0;
7353 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
7354 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
7356 double start_f = start_h * 6. - start_i;
7357 double start_q = 1. - start_f;
7359 double stop_f = stop_h * 6. - stop_i;
7360 double stop_q = 1. - stop_f;
7362 switch (start_i % 6)
7366 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
7369 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
7374 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
7377 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
7381 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
7386 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7396 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7399 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7404 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7407 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7411 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7416 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7423 out <<
" <linearGradient id=\"colorbar_" << index
7424 <<
"\" gradientUnits=\"userSpaceOnUse\" "
7425 <<
"x1=\"" << width + additional_width <<
"\" "
7427 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7428 (margin_in_percent + 29)) +
7429 (3 - index) * element_height
7431 <<
"x2=\"" << width + additional_width <<
"\" "
7433 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7434 (margin_in_percent + 29)) +
7435 (4 - index) * element_height
7438 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7439 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n'
7440 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7441 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n'
7442 <<
" </linearGradient>" <<
'\n';
7447 <<
" x=\"" << width + additional_width <<
"\" y=\""
7448 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7449 (margin_in_percent + 29)) +
7450 (3 - index) * element_height
7451 <<
"\" width=\"" << element_width <<
"\" height=\""
7453 <<
"\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_"
7454 << index <<
")\"/>" <<
'\n';
7457 for (
unsigned int index = 0; index < 5; ++index)
7461 << width + additional_width +
7462 static_cast<unsigned int>(1.5 * element_width)
7464 <<
static_cast<unsigned int>(
7465 .5 + (height / 100.) * (margin_in_percent + 29) +
7466 (4. - index) * element_height + 30.)
7468 <<
" style=\"text-anchor:start; font-size:80; font-family:Helvetica";
7470 if (index == 0 || index == 4)
7471 out <<
"; font-weight:bold";
7474 <<
static_cast<float>(
7475 (
static_cast<int>((z_min + index * (z_dimension / 4.)) *
7484 out <<
"</text>" <<
'\n';
7489 out <<
'\n' <<
"</svg>";
7495 template <
int dim,
int spacedim>
7499 const std::vector<std::string> & data_names,
7501 std::tuple<
unsigned int,
7505 &nonscalar_data_ranges,
7514 out << dim <<
' ' << spacedim <<
'\n';
7517 out <<
"[deal.II intermediate format graphics data]" <<
'\n'
7520 <<
"[Version: " << Deal_II_IntermediateFlags::format_version <<
"]"
7523 out << data_names.size() <<
'\n';
7524 for (
const auto &data_name : data_names)
7525 out << data_name <<
'\n';
7527 out << patches.size() <<
'\n';
7528 for (
unsigned int i = 0; i < patches.size(); ++i)
7529 out << patches[i] <<
'\n';
7531 out << nonscalar_data_ranges.size() <<
'\n';
7532 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
7533 out << std::get<0>(nonscalar_data_range) <<
' '
7534 << std::get<1>(nonscalar_data_range) <<
'\n'
7535 << std::get<2>(nonscalar_data_range) <<
'\n';
7544 std::pair<unsigned int, unsigned int>
7549 unsigned int dim, spacedim;
7550 input >> dim >> spacedim;
7552 return std::make_pair(dim, spacedim);
7561template <
int dim,
int spacedim>
7563 : default_subdivisions(1)
7569template <
int dim,
int spacedim>
7574 get_dataset_names(),
7575 get_nonscalar_data_ranges(),
7582template <
int dim,
int spacedim>
7587 get_dataset_names(),
7588 get_nonscalar_data_ranges(),
7595template <
int dim,
int spacedim>
7600 get_dataset_names(),
7601 get_nonscalar_data_ranges(),
7608template <
int dim,
int spacedim>
7613 get_dataset_names(),
7614 get_nonscalar_data_ranges(),
7621template <
int dim,
int spacedim>
7626 get_dataset_names(),
7627 get_nonscalar_data_ranges(),
7634template <
int dim,
int spacedim>
7639 get_dataset_names(),
7640 get_nonscalar_data_ranges(),
7647template <
int dim,
int spacedim>
7652 get_dataset_names(),
7653 get_nonscalar_data_ranges(),
7660template <
int dim,
int spacedim>
7665 get_dataset_names(),
7666 get_nonscalar_data_ranges(),
7671template <
int dim,
int spacedim>
7676 get_dataset_names(),
7677 get_nonscalar_data_ranges(),
7682template <
int dim,
int spacedim>
7687 get_dataset_names(),
7688 get_nonscalar_data_ranges(),
7694template <
int dim,
int spacedim>
7697 const std::string &filename,
7700#ifndef DEAL_II_WITH_MPI
7704 std::ofstream f(filename);
7712 int ierr = MPI_Info_create(&info);
7715 ierr = MPI_File_open(
7716 comm, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh);
7719 ierr = MPI_File_set_size(fh, 0);
7723 ierr = MPI_Barrier(
comm);
7725 ierr = MPI_Info_free(&info);
7729 unsigned int header_size;
7730 std::uint64_t footer_offset;
7735 std::stringstream ss;
7737 header_size = ss.str().size();
7740 fh, 0, ss.str().c_str(), header_size, MPI_CHAR, MPI_STATUS_IGNORE);
7744 ierr = MPI_Bcast(&header_size, 1, MPI_UNSIGNED, 0,
comm);
7748 const auto &patches = get_patches();
7757 std::stringstream ss;
7758 if (my_n_patches > 0 || (global_n_patches == 0 && myrank == 0))
7760 get_dataset_names(),
7761 get_nonscalar_data_ranges(),
7766 const std::uint64_t size_on_proc = ss.str().size();
7767 std::uint64_t prefix_sum = 0;
7769 MPI_Exscan(&size_on_proc, &prefix_sum, 1, MPI_UINT64_T, MPI_SUM,
comm);
7773 const MPI_Offset offset =
static_cast<MPI_Offset
>(header_size) + prefix_sum;
7783 if (myrank == n_ranks - 1)
7786 footer_offset = size_on_proc + offset;
7788 std::stringstream ss;
7790 const unsigned int footer_size = ss.str().size();
7808 ierr = MPI_File_sync(fh);
7811 ierr = MPI_File_close(&fh);
7818template <
int dim,
int spacedim>
7822 const std::vector<std::string> &piece_names)
const
7826 get_dataset_names(),
7827 get_nonscalar_data_ranges(),
7833template <
int dim,
int spacedim>
7836 const std::string &directory,
7837 const std::string &filename_without_extension,
7838 const unsigned int counter,
7840 const unsigned int n_digits_for_counter,
7841 const unsigned int n_groups)
const
7844 const unsigned int n_ranks =
7846 const unsigned int n_files_written =
7847 (n_groups == 0 || n_groups > n_ranks) ? n_ranks : n_groups;
7852 const unsigned int n_digits =
7855 const unsigned int color = rank % n_files_written;
7856 const std::string filename =
7857 directory + filename_without_extension +
"_" +
7861 if (n_groups == 0 || n_groups > n_ranks)
7864 std::ofstream output(filename.c_str());
7866 this->write_vtu(output);
7868 else if (n_groups == 1)
7871 this->write_vtu_in_parallel(filename.c_str(), mpi_communicator);
7875#ifdef DEAL_II_WITH_MPI
7878 int ierr = MPI_Comm_split(mpi_communicator, color, rank, &comm_group);
7880 this->write_vtu_in_parallel(filename.c_str(), comm_group);
7888 const std::string pvtu_filename =
7889 filename_without_extension +
"_" +
7894 std::vector<std::string> filename_vector;
7895 for (
unsigned int i = 0; i < n_files_written; ++i)
7897 const std::string filename =
7898 filename_without_extension +
"_" +
7902 filename_vector.emplace_back(filename);
7905 std::ofstream pvtu_output((directory + pvtu_filename).c_str());
7906 this->write_pvtu_record(pvtu_output, filename_vector);
7909 return pvtu_filename;
7914template <
int dim,
int spacedim>
7917 std::ostream &out)
const
7920 get_dataset_names(),
7921 get_nonscalar_data_ranges(),
7922 deal_II_intermediate_flags,
7927template <
int dim,
int spacedim>
7931 const std::string & h5_filename,
7932 const double cur_time,
7935 return create_xdmf_entry(
7936 data_filter, h5_filename, h5_filename, cur_time,
comm);
7941template <
int dim,
int spacedim>
7945 const std::string & h5_mesh_filename,
7946 const std::string & h5_solution_filename,
7947 const double cur_time,
7950 std::uint64_t local_node_cell_count[2], global_node_cell_count[2];
7952#ifndef DEAL_II_WITH_HDF5
7956 (void)h5_mesh_filename;
7957 (void)h5_solution_filename;
7963 ExcMessage(
"XDMF only supports 2 or 3 space dimensions."));
7965 local_node_cell_count[0] = data_filter.
n_nodes();
7966 local_node_cell_count[1] = data_filter.
n_cells();
7969#ifdef DEAL_II_WITH_MPI
7971 int ierr = MPI_Allreduce(local_node_cell_count,
7972 global_node_cell_count,
7980 const int myrank = 0;
7981 global_node_cell_count[0] = local_node_cell_count[0];
7982 global_node_cell_count[1] = local_node_cell_count[1];
7989 h5_solution_filename,
7991 global_node_cell_count[0],
7992 global_node_cell_count[1],
7995 unsigned int n_data_sets = data_filter.
n_data_sets();
8000 for (i = 0; i < n_data_sets; ++i)
8014template <
int dim,
int spacedim>
8017 const std::vector<XDMFEntry> &entries,
8018 const std::string & filename,
8021#ifdef DEAL_II_WITH_MPI
8025 const int myrank = 0;
8031 std::ofstream xdmf_file(filename);
8033 xdmf_file <<
"<?xml version=\"1.0\" ?>\n";
8034 xdmf_file <<
"<!DOCTYPE Xdmf SYSTEM \"Xdmf.dtd\" []>\n";
8035 xdmf_file <<
"<Xdmf Version=\"2.0\">\n";
8036 xdmf_file <<
" <Domain>\n";
8038 <<
" <Grid Name=\"CellTime\" GridType=\"Collection\" CollectionType=\"Temporal\">\n";
8041 const auto &patches = get_patches();
8046 for (
const auto &patch : patches)
8051 for (
const auto &entry : entries)
8053 xdmf_file << entry.get_xdmf_content(3, patches[0].reference_cell);
8056 xdmf_file <<
" </Grid>\n";
8057 xdmf_file <<
" </Domain>\n";
8058 xdmf_file <<
"</Xdmf>\n";
8070template <
int dim,
int spacedim>
8076 get_dataset_names(),
8077 get_nonscalar_data_ranges(),
8083template <
int dim,
int spacedim>
8087 const std::vector<std::string> & data_names,
8089 std::tuple<
unsigned int,
8093 & nonscalar_data_ranges,
8096 const unsigned int n_data_sets = data_names.size();
8097 unsigned int n_node, n_cell;
8101#ifndef DEAL_II_WITH_MPI
8108 Assert(patches.size() > 0, ExcNoPatches());
8110 if (patches.size() == 0)
8114 compute_sizes<dim, spacedim>(patches, n_node, n_cell);
8117 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
8119 &DataOutBase::template write_gmv_reorder_data_vectors<dim, spacedim>;
8127 reorder_task.
join();
8131 unsigned int i, n_th_vector, data_set, pt_data_vector_dim;
8132 std::string vector_name;
8133 for (n_th_vector = 0, data_set = 0; data_set < n_data_sets;)
8136 while (n_th_vector < nonscalar_data_ranges.size() &&
8137 std::get<0>(nonscalar_data_ranges[n_th_vector]) < data_set)
8141 if (n_th_vector < nonscalar_data_ranges.size() &&
8142 std::get<0>(nonscalar_data_ranges[n_th_vector]) == data_set)
8145 pt_data_vector_dim = std::get<1>(nonscalar_data_ranges[n_th_vector]) -
8146 std::get<0>(nonscalar_data_ranges[n_th_vector]) +
8151 std::get<1>(nonscalar_data_ranges[n_th_vector]) >=
8152 std::get<0>(nonscalar_data_ranges[n_th_vector]),
8153 ExcLowerRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
8154 std::get<0>(nonscalar_data_ranges[n_th_vector])));
8156 std::get<1>(nonscalar_data_ranges[n_th_vector]) < n_data_sets,
8157 ExcIndexRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
8163 if (!std::get<2>(nonscalar_data_ranges[n_th_vector]).empty())
8165 vector_name = std::get<2>(nonscalar_data_ranges[n_th_vector]);
8170 for (i = std::get<0>(nonscalar_data_ranges[n_th_vector]);
8171 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
8173 vector_name += data_names[i] +
"__";
8175 data_names[std::get<1>(nonscalar_data_ranges[n_th_vector])];
8181 pt_data_vector_dim = 1;
8182 vector_name = data_names[data_set];
8192 data_set += pt_data_vector_dim;
8198template <
int dim,
int spacedim>
8202 const std::string & filename,
8210template <
int dim,
int spacedim>
8214 const bool write_mesh_file,
8215 const std::string & mesh_filename,
8216 const std::string & solution_filename,
8229template <
int dim,
int spacedim>
8234 const std::string & filename,
8242template <
int dim,
int spacedim>
8247 const bool write_mesh_file,
8248 const std::string & mesh_filename,
8249 const std::string & solution_filename,
8255 "DataOutBase was asked to write HDF5 output for a space dimension of 1. "
8256 "HDF5 only supports datasets that live in 2 or 3 dimensions."));
8260#ifndef DEAL_II_WITH_HDF5
8265 (void)write_mesh_file;
8266 (void)mesh_filename;
8267 (void)solution_filename;
8271# ifndef DEAL_II_WITH_MPI
8281 Assert(patches.size() > 0, ExcNoPatches());
8283 hid_t h5_mesh_file_id = -1, h5_solution_file_id, file_plist_id, plist_id;
8284 hid_t node_dataspace, node_dataset, node_file_dataspace,
8285 node_memory_dataspace;
8286 hid_t cell_dataspace, cell_dataset, cell_file_dataspace,
8287 cell_memory_dataspace;
8288 hid_t pt_data_dataspace, pt_data_dataset, pt_data_file_dataspace,
8289 pt_data_memory_dataspace;
8291 std::uint64_t local_node_cell_count[2];
8292 hsize_t count[2], offset[2], node_ds_dim[2], cell_ds_dim[2];
8293 std::vector<double> node_data_vec;
8294 std::vector<unsigned int> cell_data_vec;
8297# ifndef H5_HAVE_PARALLEL
8298# ifdef DEAL_II_WITH_MPI
8303 "Serial HDF5 output on multiple processes is not yet supported."));
8307 local_node_cell_count[0] = data_filter.
n_nodes();
8308 local_node_cell_count[1] = data_filter.
n_cells();
8311 file_plist_id = H5Pcreate(H5P_FILE_ACCESS);
8314# ifdef DEAL_II_WITH_MPI
8315# ifdef H5_HAVE_PARALLEL
8317 status = H5Pset_fapl_mpio(file_plist_id,
comm, MPI_INFO_NULL);
8325 std::uint64_t global_node_cell_count[2] = {0, 0};
8326 std::uint64_t global_node_cell_offsets[2] = {0, 0};
8328# ifdef DEAL_II_WITH_MPI
8329 ierr = MPI_Allreduce(local_node_cell_count,
8330 global_node_cell_count,
8336 ierr = MPI_Exscan(local_node_cell_count,
8337 global_node_cell_offsets,
8344 global_node_cell_count[0] = local_node_cell_count[0];
8345 global_node_cell_count[1] = local_node_cell_count[1];
8346 global_node_cell_offsets[0] = global_node_cell_offsets[1] = 0;
8350 plist_id = H5Pcreate(H5P_DATASET_XFER);
8352# ifdef DEAL_II_WITH_MPI
8353# ifdef H5_HAVE_PARALLEL
8354 status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
8359 if (write_mesh_file)
8362 h5_mesh_file_id = H5Fcreate(mesh_filename.c_str(),
8370 node_ds_dim[0] = global_node_cell_count[0];
8371 node_ds_dim[1] = (spacedim < 2) ? 2 : spacedim;
8372 node_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8375 cell_ds_dim[0] = global_node_cell_count[1];
8376 cell_ds_dim[1] = patches[0].reference_cell.n_vertices();
8377 cell_dataspace = H5Screate_simple(2, cell_ds_dim,
nullptr);
8381# if H5Gcreate_vers == 1
8382 node_dataset = H5Dcreate(h5_mesh_file_id,
8388 node_dataset = H5Dcreate(h5_mesh_file_id,
8397# if H5Gcreate_vers == 1
8398 cell_dataset = H5Dcreate(
8399 h5_mesh_file_id,
"cells", H5T_NATIVE_UINT, cell_dataspace, H5P_DEFAULT);
8401 cell_dataset = H5Dcreate(h5_mesh_file_id,
8412 status = H5Sclose(node_dataspace);
8414 status = H5Sclose(cell_dataspace);
8419 count[0] = local_node_cell_count[0];
8420 count[1] = (spacedim < 2) ? 2 : spacedim;
8422 offset[0] = global_node_cell_offsets[0];
8425 node_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8429 node_file_dataspace = H5Dget_space(node_dataset);
8431 status = H5Sselect_hyperslab(
8432 node_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8436 count[0] = local_node_cell_count[1];
8437 count[1] = patches[0].reference_cell.n_vertices();
8438 offset[0] = global_node_cell_offsets[1];
8440 cell_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8443 cell_file_dataspace = H5Dget_space(cell_dataset);
8445 status = H5Sselect_hyperslab(
8446 cell_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8451 status = H5Dwrite(node_dataset,
8453 node_memory_dataspace,
8454 node_file_dataspace,
8456 node_data_vec.data());
8458 node_data_vec.clear();
8461 data_filter.
fill_cell_data(global_node_cell_offsets[0], cell_data_vec);
8462 status = H5Dwrite(cell_dataset,
8464 cell_memory_dataspace,
8465 cell_file_dataspace,
8467 cell_data_vec.data());
8469 cell_data_vec.clear();
8472 status = H5Sclose(node_file_dataspace);
8474 status = H5Sclose(cell_file_dataspace);
8478 status = H5Sclose(node_memory_dataspace);
8480 status = H5Sclose(cell_memory_dataspace);
8484 status = H5Dclose(node_dataset);
8486 status = H5Dclose(cell_dataset);
8490 if (mesh_filename != solution_filename)
8492 status = H5Fclose(h5_mesh_file_id);
8498 if (mesh_filename == solution_filename && write_mesh_file)
8500 h5_solution_file_id = h5_mesh_file_id;
8505 h5_solution_file_id = H5Fcreate(solution_filename.c_str(),
8515 std::string vector_name;
8524 node_ds_dim[0] = global_node_cell_count[0];
8525 node_ds_dim[1] = pt_data_vector_dim;
8526 pt_data_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8529# if H5Gcreate_vers == 1
8530 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8531 vector_name.c_str(),
8536 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8537 vector_name.c_str(),
8547 count[0] = local_node_cell_count[0];
8548 count[1] = pt_data_vector_dim;
8549 offset[0] = global_node_cell_offsets[0];
8551 pt_data_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8555 pt_data_file_dataspace = H5Dget_space(pt_data_dataset);
8557 status = H5Sselect_hyperslab(pt_data_file_dataspace,
8566 status = H5Dwrite(pt_data_dataset,
8568 pt_data_memory_dataspace,
8569 pt_data_file_dataspace,
8575 status = H5Sclose(pt_data_dataspace);
8577 status = H5Sclose(pt_data_memory_dataspace);
8579 status = H5Sclose(pt_data_file_dataspace);
8582 status = H5Dclose(pt_data_dataset);
8587 status = H5Pclose(file_plist_id);
8591 status = H5Pclose(plist_id);
8595 status = H5Fclose(h5_solution_file_id);
8602template <
int dim,
int spacedim>
8610 output_format = default_fmt;
8612 switch (output_format)
8658 write_deal_II_intermediate(out);
8668template <
int dim,
int spacedim>
8677template <
int dim,
int spacedim>
8678template <
typename FlagType>
8684 if (
typeid(flags) ==
typeid(dx_flags))
8686 else if (
typeid(flags) ==
typeid(ucd_flags))
8688 else if (
typeid(flags) ==
typeid(povray_flags))
8690 else if (
typeid(flags) ==
typeid(eps_flags))
8692 else if (
typeid(flags) ==
typeid(gmv_flags))
8694 else if (
typeid(flags) ==
typeid(tecplot_flags))
8697 else if (
typeid(flags) ==
typeid(vtk_flags))
8699 else if (
typeid(flags) ==
typeid(svg_flags))
8701 else if (
typeid(flags) ==
typeid(gnuplot_flags))
8704 else if (
typeid(flags) ==
typeid(deal_II_intermediate_flags))
8705 deal_II_intermediate_flags =
8713template <
int dim,
int spacedim>
8726template <
int dim,
int spacedim>
8733 "A name for the output format to be used");
8737 "Number of subdivisions of each mesh cell");
8779template <
int dim,
int spacedim>
8783 const std::string &output_name = prm.
get(
"Output format");
8785 default_subdivisions = prm.
get_integer(
"Subdivisions");
8788 dx_flags.parse_parameters(prm);
8792 ucd_flags.parse_parameters(prm);
8796 gnuplot_flags.parse_parameters(prm);
8800 povray_flags.parse_parameters(prm);
8804 eps_flags.parse_parameters(prm);
8808 gmv_flags.parse_parameters(prm);
8812 tecplot_flags.parse_parameters(prm);
8816 vtk_flags.parse_parameters(prm);
8820 deal_II_intermediate_flags.parse_parameters(prm);
8826template <
int dim,
int spacedim>
8830 return (
sizeof(default_fmt) +
8845template <
int dim,
int spacedim>
8847 std::tuple<
unsigned int,
8854 std::tuple<
unsigned int,
8861template <
int dim,
int spacedim>
8869 std::set<std::string> all_names;
8872 std::tuple<
unsigned int,
8876 ranges = this->get_nonscalar_data_ranges();
8877 const std::vector<std::string> data_names = this->get_dataset_names();
8878 const unsigned int n_data_sets = data_names.size();
8879 std::vector<bool> data_set_written(n_data_sets,
false);
8881 for (
const auto &range : ranges)
8883 const std::string &name = std::get<2>(range);
8886 Assert(all_names.find(name) == all_names.end(),
8888 "Error: names of fields in DataOut need to be unique, "
8890 name +
"' is used more than once."));
8891 all_names.insert(name);
8892 for (
unsigned int i = std::get<0>(range); i <= std::get<1>(range);
8894 data_set_written[i] =
true;
8898 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
8899 if (data_set_written[data_set] ==
false)
8901 const std::string &name = data_names[data_set];
8902 Assert(all_names.find(name) == all_names.end(),
8904 "Error: names of fields in DataOut need to be unique, "
8906 name +
"' is used more than once."));
8907 all_names.insert(name);
8917template <
int dim,
int spacedim>
8925 std::vector<typename ::DataOutBase::Patch<dim, spacedim>> tmp;
8929 std::vector<std::string> tmp;
8930 tmp.swap(dataset_names);
8934 std::tuple<
unsigned int,
8939 tmp.swap(nonscalar_data_ranges);
8946 std::pair<unsigned int, unsigned int> dimension_info =
8949 (dimension_info.second == spacedim),
8950 ExcIncompatibleDimensions(
8951 dimension_info.first, dim, dimension_info.second, spacedim));
8960 getline(in, header);
8962 std::ostringstream s;
8963 s <<
"[deal.II intermediate format graphics data]";
8965 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
8969 getline(in, header);
8971 std::ostringstream s;
8975 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
8979 getline(in, header);
8981 std::ostringstream s;
8985 Assert(header == s.str(),
8987 "Invalid or incompatible file format. Intermediate format "
8988 "files can only be read by the same deal.II version as they "
8989 "are written by."));
8993 unsigned int n_datasets;
8995 dataset_names.resize(n_datasets);
8996 for (
unsigned int i = 0; i < n_datasets; ++i)
8997 in >> dataset_names[i];
8999 unsigned int n_patches;
9001 patches.resize(n_patches);
9002 for (
unsigned int i = 0; i < n_patches; ++i)
9005 unsigned int n_nonscalar_data_ranges;
9006 in >> n_nonscalar_data_ranges;
9007 nonscalar_data_ranges.resize(n_nonscalar_data_ranges);
9008 for (
unsigned int i = 0; i < n_nonscalar_data_ranges; ++i)
9010 in >> std::get<0>(nonscalar_data_ranges[i]) >>
9011 std::get<1>(nonscalar_data_ranges[i]);
9020 std::get<2>(nonscalar_data_ranges[i]) = name;
9028template <
int dim,
int spacedim>
9032 using Patch = typename ::DataOutBase::Patch<dim, spacedim>;
9035 const std::vector<Patch> &source_patches = source.
get_patches();
9040 ExcIncompatibleDatasetNames());
9043 Assert(get_nonscalar_data_ranges().size() ==
9045 ExcMessage(
"Both sources need to declare the same components "
9047 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
9049 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
9051 ExcMessage(
"Both sources need to declare the same components "
9053 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
9055 ExcMessage(
"Both sources need to declare the same components "
9057 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
9059 ExcMessage(
"Both sources need to declare the same components "
9064 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
9065 ExcIncompatiblePatchLists());
9066 Assert(patches[0].data.n_rows() == source_patches[0].data.n_rows(),
9067 ExcIncompatiblePatchLists());
9068 Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(),
9069 ExcIncompatiblePatchLists());
9073 const unsigned int old_n_patches = patches.size();
9074 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
9077 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
9078 patches[i].patch_index += old_n_patches;
9081 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
9083 if (patches[i].neighbors[n] !=
9085 patches[i].neighbors[n] += old_n_patches;
9090template <
int dim,
int spacedim>
9091const std::vector<typename ::DataOutBase::Patch<dim, spacedim>> &
9099template <
int dim,
int spacedim>
9100std::vector<std::string>
9103 return dataset_names;
9108template <
int dim,
int spacedim>
9110 std::tuple<
unsigned int,
9116 return nonscalar_data_ranges;
9125 , h5_sol_filename(
"")
9126 , h5_mesh_filename(
"")
9128 , num_nodes(
numbers::invalid_unsigned_int)
9129 , num_cells(
numbers::invalid_unsigned_int)
9130 , dimension(
numbers::invalid_unsigned_int)
9131 , space_dimension(
numbers::invalid_unsigned_int)
9138 const std::uint64_t nodes,
9139 const std::uint64_t cells,
9140 const unsigned int dim)
9141 :
XDMFEntry(filename, filename, time, nodes, cells, dim, dim)
9147 const std::string & solution_filename,
9149 const std::uint64_t nodes,
9150 const std::uint64_t cells,
9151 const unsigned int dim)
9152 :
XDMFEntry(mesh_filename, solution_filename, time, nodes, cells, dim, dim)
9158 const std::string & solution_filename,
9160 const std::uint64_t nodes,
9161 const std::uint64_t cells,
9162 const unsigned int dim,
9163 const unsigned int spacedim)
9165 , h5_sol_filename(solution_filename)
9166 , h5_mesh_filename(mesh_filename)
9171 , space_dimension(spacedim)
9178 const unsigned int dimension)
9191 indent(
const unsigned int indent_level)
9193 std::string res =
"";
9194 for (
unsigned int i = 0; i < indent_level; ++i)
9209 ReferenceCells::get_hypercube<0>());
9212 ReferenceCells::get_hypercube<1>());
9215 ReferenceCells::get_hypercube<2>());
9218 ReferenceCells::get_hypercube<3>());
9235 std::stringstream ss;
9236 ss << indent(indent_level + 0)
9237 <<
"<Grid Name=\"mesh\" GridType=\"Uniform\">\n";
9238 ss << indent(indent_level + 1) <<
"<Time Value=\"" <<
entry_time <<
"\"/>\n";
9239 ss << indent(indent_level + 1) <<
"<Geometry GeometryType=\""
9241 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes
9243 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9245 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9246 ss << indent(indent_level + 1) <<
"</Geometry>\n";
9251 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"";
9269 ss <<
"Quadrilateral";
9288 ss <<
"Tetrahedron";
9292 ss <<
"\" NumberOfElements=\"" <<
num_cells;
9294 ss <<
"\" NodesPerElement=\"1\">\n";
9296 ss <<
"\" NodesPerElement=\"2\">\n";
9301 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_cells
9302 <<
" " << reference_cell.n_vertices()
9303 <<
"\" NumberType=\"UInt\" Format=\"HDF\">\n";
9306 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9307 ss << indent(indent_level + 1) <<
"</Topology>\n";
9313 ss << indent(indent_level + 1)
9314 <<
"<Topology TopologyType=\"Polyvertex\" NumberOfElements=\""
9316 ss << indent(indent_level + 1) <<
"</Topology>\n";
9321 ss << indent(indent_level + 1) <<
"<Attribute Name=\""
9322 << attribute_dim.first <<
"\" AttributeType=\""
9323 << (attribute_dim.second > 1 ?
"Vector" :
"Scalar")
9324 <<
"\" Center=\"Node\">\n";
9326 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes
9327 <<
" " << (attribute_dim.second > 1 ? 3 : 1)
9328 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9330 << attribute_dim.first <<
'\n';
9331 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9332 ss << indent(indent_level + 1) <<
"</Attribute>\n";
9335 ss << indent(indent_level + 0) <<
"</Grid>\n";
9344 template <
int dim,
int spacedim>
9349 out <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]"
9368 out << patch.
data.n_rows() <<
' ' << patch.
data.n_cols() <<
'\n';
9369 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9370 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9371 out << patch.
data[i][j] <<
' ';
9380 template <
int dim,
int spacedim>
9392 getline(in, header);
9393 while ((header.size() != 0) && (header.back() ==
' '))
9394 header.erase(header.size() - 1);
9396 while ((header.empty()) && in);
9398 std::ostringstream s;
9399 s <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]";
9401 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9405#ifdef DEAL_II_HAVE_CXX17
9406 if constexpr (dim > 0)
9427 unsigned int n_subdivisions;
9428 in >> n_subdivisions;
9430 if constexpr (dim > 1)
9437 const_cast<unsigned int &
>(patch.
n_subdivisions) = n_subdivisions;
9442 unsigned int n_rows, n_cols;
9443 in >> n_rows >> n_cols;
9444 patch.
data.reinit(n_rows, n_cols);
9445 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9446 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9447 in >> patch.
data[i][j];
9458#include "data_out_base.inst"
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
void enter_subsection(const std::string &subsection)
std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices() const
unsigned int n_vertices() 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)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_PACKAGE_VERSION
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_FALLTHROUGH
#define DEAL_II_HAVE_CXX17
#define DEAL_II_PACKAGE_NAME
Point< 2 > projected_vertices[4]
Point< 2 > projected_center
std::size_t memory_consumption() const
static void declare_parameters(ParameterHandler &prm)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const
const double * get_data_set(const unsigned int set_num) const
static void declare_parameters(ParameterHandler &prm)
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
static void declare_parameters(ParameterHandler &prm)
void parse_parameters(ParameterHandler &prm)
static RgbValues default_color_function(const double value, const double min_value, const double max_value)
std::map< unsigned int, unsigned int > filtered_points
void write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const
std::ostream & operator<<(std::ostream &out, const Patch< dim, spacedim > &patch)
std::vector< std::string > space_dimension_labels
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names) const
static void declare_parameters(ParameterHandler &prm)
std::size_t memory_consumption() const
static ::ExceptionBase & ExcIO()
void write_hdf5_parallel(const DataOutBase::DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm) const
void parse_parameters(const ParameterHandler &prm)
ColorFunction color_function
std::string get_data_set_name(const unsigned int set_num) const
void write_ucd(std::ostream &out) const
void merge(const DataOutReader< dim, spacedim > &other)
static ::ExceptionBase & ExcFileNotOpen(std::string arg1)
ReferenceCell reference_cell
void write_povray(std::ostream &out) const
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
std::string default_suffix(const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
void internal_add_cell(const unsigned int cell_index, const unsigned int pt_index)
static void declare_parameters(ParameterHandler &prm)
void write_cell(const unsigned int index, const unsigned int start, const unsigned int d1, const unsigned int d2, const unsigned int d3)
ZlibCompressionLevel compression_level
VtkFlags(const double time=std::numeric_limits< double >::min(), const unsigned int cycle=std::numeric_limits< unsigned int >::min(), const bool print_date_and_time=true, const ZlibCompressionLevel compression_level=best_compression, const bool write_higher_order_cells=false, const std::map< std::string, std::string > &physical_units={})
static ::ExceptionBase & ExcNotEnoughSpaceDimensionLabels()
XDMFEntry create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, const MPI_Comm &comm) const
static const unsigned int format_version
static const unsigned int no_neighbor
PovrayFlags(const bool smooth=false, const bool bicubic_patch=false, const bool external_data=false)
static ::ExceptionBase & ExcNotImplemented()
void write_vtu_in_parallel(const std::string &filename, const MPI_Comm &comm) const
virtual const std::vector<::DataOutBase::Patch< dim, spacedim > > & get_patches() const override
unsigned int height_vector
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)
void parse_parameters(const ParameterHandler &prm)
std::vector< unsigned int > data_set_dims
std::size_t memory_consumption() const
void set_default_format(const DataOutBase::OutputFormat default_format)
unsigned int n_nodes() const
std::map< std::string, std::string > physical_units
#define Assert(cond, exc)
void parse_parameters(const ParameterHandler &prm)
unsigned int color_vector
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
static void declare_parameters(ParameterHandler &prm)
void fill_node_data(std::vector< double > &node_data) const
std::vector< std::vector< double > > data_sets
bool operator==(const Patch &patch) const
std::string h5_sol_filename
unsigned int get_data_set_dim(const unsigned int set_num) const
void write_gnuplot(std::ostream &out) const
static ::ExceptionBase & ExcNoPatches()
void read(std::istream &in)
#define DeclException2(Exception2, type1, type2, outsequence)
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)
static RgbValues reverse_grey_scale_color_function(const double value, const double min_value, const double max_value)
void write_vtu(std::ostream &out) const
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcLowerRange(int arg1, int arg2)
#define AssertThrowMPI(error_code)
static const unsigned int space_dim
void write_tecplot(std::ostream &out) const
TecplotFlags(const char *zone_name=nullptr, const double solution_time=-1.0)
void write_data_set(const std::string &name, const unsigned int dimension, const unsigned int set_num, const Table< 2, double > &data_vectors)
void parse_parameters(const ParameterHandler &prm)
std::string h5_mesh_filename
std::string get_xdmf_content(const unsigned int indent_level) const
bool write_higher_order_cells
std::map< unsigned int, unsigned int > filtered_cells
void add_attribute(const std::string &attr_name, const unsigned int dimension)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
std::map< std::string, unsigned int > attribute_dims
#define AssertIndexRange(index, range)
virtual std::vector< std::string > get_dataset_names() const override
void write_svg(std::ostream &out) const
void write_cell_single(const unsigned int index, const unsigned int start, const unsigned int n_points, const ReferenceCell &reference_cell)
static ::ExceptionBase & ExcInternalError()
unsigned int height_vector
unsigned int n_subdivisions
void write_xdmf_file(const std::vector< XDMFEntry > &entries, const std::string &filename, const MPI_Comm &comm) const
void validate_dataset_names() const
void set_flags(const FlagType &flags)
std::vector< std::string > data_set_names
void write_vtk(std::ostream &out) const
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()
unsigned int line_thickness
void swap(Patch< dim, spacedim > &other_patch)
void fill_cell_data(const unsigned int local_node_offset, std::vector< unsigned int > &cell_data) const
bool filter_duplicate_vertices
std::istream & operator>>(std::istream &in, Patch< dim, spacedim > &patch)
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
void write_point(const unsigned int index, const Point< dim > &p)
bool points_are_available
UcdFlags(const bool write_preamble=false)
std::size_t memory_consumption() const
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)
std::array< unsigned int, GeometryInfo< dim >::faces_per_cell > neighbors
void write_gmv(std::ostream &out) const
void write_eps(std::ostream &out) const
unsigned int n_cells() const
unsigned int space_dimension
static ::ExceptionBase & ExcMessage(std::string arg1)
static void declare_parameters(ParameterHandler &prm)
DataOutBase::DataOutFilterFlags flags
Map3DPoint existing_points
void write_dx(std::ostream &out) const
#define AssertThrow(cond, exc)
unsigned int n_data_sets() const
void write_deal_II_intermediate(std::ostream &out) const
@ width
Scale to given width.
@ height
Scale to given height.
Task< RT > new_task(const std::function< RT()> &function)
LogStream & operator<<(LogStream &log, const T &t)
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)
void write_nodes(const std::vector< Patch< dim, spacedim > > &patches, StreamType &out)
void write_high_order_cells(const std::vector< Patch< dim, spacedim > > &patches, StreamType &out)
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim > > &patches, const DataOutFilter &data_filter, const std::string &filename, const MPI_Comm &comm)
void write_tecplot_binary(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_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::string get_output_format_names()
void write_svg(const std::vector< Patch< 2, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > &nonscalar_data_ranges, const SvgFlags &flags, std::ostream &out)
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
std::string default_suffix(const OutputFormat output_format)
void write_povray(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > &nonscalar_data_ranges, const PovrayFlags &flags, std::ostream &out)
void write_gnuplot(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > &nonscalar_data_ranges, const GnuplotFlags &flags, std::ostream &out)
void write_vtk(const std::vector< Patch< dim, spacedim > > &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > &nonscalar_data_ranges, const VtkFlags &flags)
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type 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)
void free_communicator(MPI_Comm &mpi_communicator)
unsigned int this_mpi_process(const MPI_Comm &mpi_communicator)
T sum(const T &t, const MPI_Comm &mpi_communicator)
unsigned int n_mpi_processes(const MPI_Comm &mpi_communicator)
constexpr T pow(const T base, const int iexp)
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)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
static constexpr double PI
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
bool operator<(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)