40 #ifdef DEAL_II_WITH_ZLIB
44 #ifdef DEAL_II_WITH_HDF5
48 #include <boost/iostreams/copy.hpp>
49 #include <boost/iostreams/device/back_inserter.hpp>
50 #include <boost/iostreams/filtering_stream.hpp>
51 #ifdef DEAL_II_WITH_ZLIB
52 # include <boost/iostreams/filter/zlib.hpp>
66 <<
"Unexpected input: expected line\n <" << arg1
67 <<
">\nbut got\n <" << arg2 <<
">");
73 #ifdef DEAL_II_WITH_ZLIB
74 constexpr
bool deal_ii_with_zlib =
true;
76 constexpr
bool deal_ii_with_zlib =
false;
80 #ifdef DEAL_II_WITH_ZLIB
91 return Z_NO_COMPRESSION;
95 return Z_BEST_COMPRESSION;
97 return Z_DEFAULT_COMPRESSION;
100 return Z_NO_COMPRESSION;
104 # ifdef DEAL_II_WITH_MPI
115 return boost::iostreams::zlib::no_compression;
117 return boost::iostreams::zlib::best_speed;
119 return boost::iostreams::zlib::best_compression;
121 return boost::iostreams::zlib::default_compression;
124 return boost::iostreams::zlib::no_compression;
134 template <
typename T>
136 compress_array(
const std::vector<T> & data,
139 #ifdef DEAL_II_WITH_ZLIB
140 if (data.size() != 0)
142 const std::size_t uncompressed_size = (data.size() *
sizeof(
T));
154 auto compressed_data_length = compressBound(uncompressed_size);
159 std::vector<unsigned char> compressed_data(compressed_data_length);
161 int err = compress2(&compressed_data[0],
162 &compressed_data_length,
163 reinterpret_cast<const Bytef *
>(data.data()),
165 get_zlib_compression_level(compression_level));
170 compressed_data.resize(compressed_data_length);
173 const std::uint32_t compression_header[4] = {
175 static_cast<std::uint32_t
>(uncompressed_size),
176 static_cast<std::uint32_t
>(
178 static_cast<std::uint32_t
>(
179 compressed_data_length)};
181 const auto header_start =
182 reinterpret_cast<const unsigned char *
>(&compression_header[0]);
185 {header_start, header_start + 4 *
sizeof(std::uint32_t)}) +
192 (void)compression_level;
194 ExcMessage(
"This function can only be called if cmake found "
195 "a working libz installation."));
210 template <
typename T>
212 vtu_stringize_array(
const std::vector<T> & data,
216 if (deal_ii_with_zlib &&
220 return compress_array(data, compression_level);
224 std::ostringstream stream;
225 stream.precision(precision);
226 for (
const T &el : data)
241 struct ParallelIntermediateHeader
244 std::uint64_t version;
245 std::uint64_t compression;
246 std::uint64_t dimension;
247 std::uint64_t space_dimension;
248 std::uint64_t n_ranks;
249 std::uint64_t n_patches;
357 template <
int dim,
int spacedim,
typename Number =
double>
358 std::unique_ptr<Table<2, Number>>
359 create_global_data_table(
const std::vector<Patch<dim, spacedim>> &patches)
362 if (patches.size() == 0)
363 return std::make_unique<Table<2, Number>>();
372 const unsigned int n_data_sets = patches[0].points_are_available ?
373 (patches[0].data.n_rows() - spacedim) :
374 patches[0].data.n_rows();
375 const unsigned int n_data_points =
376 std::accumulate(patches.begin(),
379 [](
const unsigned int count,
381 return count + patch.data.n_cols();
384 std::unique_ptr<Table<2, Number>> global_data_table =
385 std::make_unique<Table<2, Number>>(n_data_sets, n_data_points);
388 unsigned int next_value = 0;
389 for (
const auto &patch : patches)
391 const unsigned int n_subdivisions = patch.n_subdivisions;
392 (void)n_subdivisions;
394 Assert((patch.data.n_rows() == n_data_sets &&
395 !patch.points_are_available) ||
396 (patch.data.n_rows() == n_data_sets + spacedim &&
397 patch.points_are_available),
399 (n_data_sets + spacedim) :
401 patch.data.n_rows()));
402 Assert(patch.reference_cell != ReferenceCells::get_hypercube<dim>() ||
403 (n_data_sets == 0) ||
404 (patch.data.n_cols() ==
405 Utilities::fixed_power<dim>(n_subdivisions + 1)),
407 n_subdivisions + 1));
409 for (
unsigned int i = 0; i < patch.data.n_cols(); ++i, ++next_value)
410 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
411 (*global_data_table)[data_set][next_value] =
412 patch.data(data_set, i);
416 return global_data_table;
445 for (
unsigned int d = 0;
d < dim; ++
d)
449 unsigned int internal_ind;
460 internal_ind = it->second;
470 const unsigned int pt_index)
489 node_data[
node_dim * existing_point.second +
d] =
490 existing_point.first(
d);
498 std::vector<unsigned int> &cell_data)
const
504 cell_data[filtered_cell.first] =
505 filtered_cell.second + local_node_offset;
574 const unsigned int start,
575 const std::array<unsigned int, dim> &offsets)
579 const unsigned int base_entry =
592 const unsigned int d1 = offsets[0];
601 const unsigned int d1 = offsets[0];
602 const unsigned int d2 = offsets[1];
613 const unsigned int d1 = offsets[0];
614 const unsigned int d2 = offsets[1];
615 const unsigned int d3 = offsets[2];
637 const unsigned int start,
638 const unsigned int n_points,
643 const unsigned int base_entry = index * n_points;
645 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
647 for (
unsigned int i = 0; i < n_points; ++i)
658 const unsigned int dimension,
659 const unsigned int set_num,
662 unsigned int new_dim;
681 for (
unsigned int d = 0;
d < new_dim; ++
d)
684 data_sets.back()[r * new_dim +
d] = data_vectors(set_num +
d, i);
700 const char *gmv_cell_type[4] = {
"",
"line 2",
"quad 4",
"hex 8"};
702 const char *ucd_cell_type[4] = {
"pt",
"line",
"quad",
"hex"};
704 const char *tecplot_cell_type[4] = {
"",
"lineseg",
"quadrilateral",
"brick"};
706 #ifdef DEAL_II_HAVE_TECPLOT
707 const unsigned int tecplot_binary_cell_type[4] = {0, 0, 1, 3};
724 template <
int dim,
int spacedim>
725 std::array<unsigned int, 3>
727 const bool write_higher_order_cells)
729 std::array<unsigned int, 3> vtk_cell_id = {
735 if (write_higher_order_cells)
738 vtk_cell_id[2] = patch.
data.n_cols();
744 patch.
data.n_cols() == 6)
748 vtk_cell_id[2] = patch.
data.n_cols();
751 patch.
data.n_cols() == 10)
755 vtk_cell_id[2] = patch.
data.n_cols();
780 template <
int dim,
int spacedim>
782 get_equispaced_location(
784 const std::initializer_list<unsigned int> &lattice_location,
785 const unsigned int n_subdivisions)
792 const unsigned int xstep = (dim > 0 ? *(lattice_location.begin() + 0) : 0);
793 const unsigned int ystep = (dim > 1 ? *(lattice_location.begin() + 1) : 0);
794 const unsigned int zstep = (dim > 2 ? *(lattice_location.begin() + 2) : 0);
802 unsigned int point_no = 0;
807 point_no += (n_subdivisions + 1) * (n_subdivisions + 1) * zstep;
811 point_no += (n_subdivisions + 1) * ystep;
825 for (
unsigned int d = 0;
d < spacedim; ++
d)
826 node[
d] = patch.
data(patch.
data.size(0) - spacedim +
d, point_no);
838 const double stepsize = 1. / n_subdivisions;
839 const double xfrac = xstep * stepsize;
845 const double yfrac = ystep * stepsize;
847 node += ((patch.
vertices[3] * xfrac) +
848 (patch.
vertices[2] * (1 - xfrac))) *
852 const double zfrac = zstep * stepsize;
854 node += (((patch.
vertices[5] * xfrac) +
855 (patch.
vertices[4] * (1 - xfrac))) *
858 (patch.
vertices[6] * (1 - xfrac))) *
871 template <
int dim,
int spacedim>
874 const unsigned int node_index)
879 unsigned int point_no_actual = node_index;
884 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
885 point_no_actual = table[node_index];
893 for (
unsigned int d = 0;
d < spacedim; ++
d)
895 patch.
data(patch.
data.size(0) - spacedim +
d, point_no_actual);
908 return patch.
vertices[point_no_actual];
919 template <
int dim,
int spacedim>
920 std::tuple<unsigned int, unsigned int>
921 count_nodes_and_cells(
924 unsigned int n_nodes = 0;
926 for (
const auto &patch : patches)
930 "The reference cell for this patch is set to 'Invalid', "
931 "but that is clearly not a valid choice. Did you forget "
932 "to set the reference cell for the patch?"));
947 return std::make_tuple(n_nodes,
n_cells);
957 template <
int dim,
int spacedim>
958 std::tuple<unsigned int, unsigned int, unsigned int>
959 count_nodes_and_cells_and_points(
961 const bool write_higher_order_cells)
963 unsigned int n_nodes = 0;
965 unsigned int n_points_and_n_cells = 0;
967 for (
const auto &patch : patches)
973 if (write_higher_order_cells)
979 n_points_and_n_cells +=
988 const unsigned int n_subcells =
991 n_points_and_n_cells +=
997 n_nodes += patch.
data.n_cols();
999 n_points_and_n_cells += patch.
data.n_cols() + 1;
1003 return std::make_tuple(n_nodes,
n_cells, n_points_and_n_cells);
1011 template <
typename FlagsType>
1018 StreamBase(std::ostream &stream,
const FlagsType &flags)
1030 write_point(
const unsigned int,
const Point<dim> &)
1033 ExcMessage(
"The derived class you are using needs to "
1034 "reimplement this function if you want to call "
1054 write_cell(
const unsigned int ,
1055 const unsigned int ,
1056 std::array<unsigned int, dim> & )
1059 ExcMessage(
"The derived class you are using needs to "
1060 "reimplement this function if you want to call "
1071 write_cell_single(
const unsigned int index,
1072 const unsigned int start,
1073 const unsigned int n_points,
1082 ExcMessage(
"The derived class you are using needs to "
1083 "reimplement this function if you want to call "
1101 template <
typename T>
1115 unsigned int selected_component;
1122 std::ostream &stream;
1127 const FlagsType flags;
1133 class DXStream :
public StreamBase<DataOutBase::DXFlags>
1140 write_point(
const unsigned int index,
const Point<dim> &);
1152 write_cell(
const unsigned int index,
1153 const unsigned int start,
1154 const std::array<unsigned int, dim> &offsets);
1162 template <
typename data>
1164 write_dataset(
const unsigned int index,
const std::vector<data> &
values);
1170 class GmvStream :
public StreamBase<DataOutBase::GmvFlags>
1177 write_point(
const unsigned int index,
const Point<dim> &);
1189 write_cell(
const unsigned int index,
1190 const unsigned int start,
1191 const std::array<unsigned int, dim> &offsets);
1197 class TecplotStream :
public StreamBase<DataOutBase::TecplotFlags>
1204 write_point(
const unsigned int index,
const Point<dim> &);
1216 write_cell(
const unsigned int index,
1217 const unsigned int start,
1218 const std::array<unsigned int, dim> &offsets);
1224 class UcdStream :
public StreamBase<DataOutBase::UcdFlags>
1231 write_point(
const unsigned int index,
const Point<dim> &);
1245 write_cell(
const unsigned int index,
1246 const unsigned int start,
1247 const std::array<unsigned int, dim> &offsets);
1255 template <
typename data>
1257 write_dataset(
const unsigned int index,
const std::vector<data> &
values);
1263 class VtkStream :
public StreamBase<DataOutBase::VtkFlags>
1270 write_point(
const unsigned int index,
const Point<dim> &);
1282 write_cell(
const unsigned int index,
1283 const unsigned int start,
1284 const std::array<unsigned int, dim> &offsets);
1290 write_cell_single(
const unsigned int index,
1291 const unsigned int start,
1292 const unsigned int n_points,
1304 write_high_order_cell(
const unsigned int start,
1305 const std::vector<unsigned> &connectivity);
1318 DXStream::write_point(
const unsigned int,
const Point<dim> &p)
1320 if (flags.coordinates_binary)
1323 for (
unsigned int d = 0;
d < dim; ++
d)
1325 stream.write(
reinterpret_cast<const char *
>(data), dim *
sizeof(*data));
1329 for (
unsigned int d = 0;
d < dim; ++
d)
1330 stream << p(
d) <<
'\t';
1344 std::array<unsigned int, GeometryInfo<0>::vertices_per_cell>
1345 set_node_numbers(
const unsigned int ,
1346 const std::array<unsigned int, 0> & )
1354 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell>
1355 set_node_numbers(
const unsigned int start,
1356 const std::array<unsigned int, 1> &offsets)
1358 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell> nodes;
1360 nodes[1] = start + offsets[0];
1366 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell>
1367 set_node_numbers(
const unsigned int start,
1368 const std::array<unsigned int, 2> &offsets)
1371 const unsigned int d1 = offsets[0];
1372 const unsigned int d2 = offsets[1];
1374 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell> nodes;
1376 nodes[1] = start + d1;
1377 nodes[2] = start + d2;
1378 nodes[3] = start + d2 + d1;
1384 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell>
1385 set_node_numbers(
const unsigned int start,
1386 const std::array<unsigned int, 3> &offsets)
1388 const unsigned int d1 = offsets[0];
1389 const unsigned int d2 = offsets[1];
1390 const unsigned int d3 = offsets[2];
1392 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell> nodes;
1394 nodes[1] = start + d1;
1395 nodes[2] = start + d2;
1396 nodes[3] = start + d2 + d1;
1397 nodes[4] = start + d3;
1398 nodes[5] = start + d3 + d1;
1399 nodes[6] = start + d3 + d2;
1400 nodes[7] = start + d3 + d2 + d1;
1409 DXStream::write_cell(
const unsigned int,
1410 const unsigned int start,
1411 const std::array<unsigned int, dim> &offsets)
1414 DataOutBaseImplementation::set_node_numbers(start, offsets);
1416 if (flags.int_binary)
1418 std::array<unsigned int, GeometryInfo<dim>::vertices_per_cell> temp;
1419 for (
unsigned int i = 0; i < nodes.size(); ++i)
1421 stream.write(
reinterpret_cast<const char *
>(temp.data()),
1422 temp.size() *
sizeof(temp[0]));
1426 for (
unsigned int i = 0; i < nodes.size() - 1; ++i)
1428 stream << nodes[GeometryInfo<dim>::dx_to_deal[nodes.size() - 1]]
1435 template <
typename data>
1437 DXStream::write_dataset(
const unsigned int,
const std::vector<data> &
values)
1439 if (flags.data_binary)
1441 stream.write(
reinterpret_cast<const char *
>(
values.data()),
1442 values.size() *
sizeof(data));
1446 for (
unsigned int i = 0; i <
values.size(); ++i)
1447 stream <<
'\t' <<
values[i];
1463 GmvStream::write_point(
const unsigned int,
const Point<dim> &p)
1467 stream << p(selected_component) <<
' ';
1474 GmvStream::write_cell(
const unsigned int,
1475 const unsigned int s,
1476 const std::array<unsigned int, dim> &offsets)
1479 const unsigned int start = s + 1;
1480 stream << gmv_cell_type[dim] <<
'\n';
1492 const unsigned int d1 = offsets[0];
1494 stream <<
'\t' << start + d1;
1500 const unsigned int d1 = offsets[0];
1501 const unsigned int d2 = offsets[1];
1503 stream <<
'\t' << start + d1;
1504 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1510 const unsigned int d1 = offsets[0];
1511 const unsigned int d2 = offsets[1];
1512 const unsigned int d3 = offsets[2];
1514 stream <<
'\t' << start + d1;
1515 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1516 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1517 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1529 TecplotStream::TecplotStream(std::ostream & out,
1537 TecplotStream::write_point(
const unsigned int,
const Point<dim> &p)
1541 stream << p(selected_component) <<
'\n';
1548 TecplotStream::write_cell(
const unsigned int,
1549 const unsigned int s,
1550 const std::array<unsigned int, dim> &offsets)
1552 const unsigned int start = s + 1;
1564 const unsigned int d1 = offsets[0];
1566 stream <<
'\t' << start + d1;
1572 const unsigned int d1 = offsets[0];
1573 const unsigned int d2 = offsets[1];
1575 stream <<
'\t' << start + d1;
1576 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1582 const unsigned int d1 = offsets[0];
1583 const unsigned int d2 = offsets[1];
1584 const unsigned int d3 = offsets[2];
1586 stream <<
'\t' << start + d1;
1587 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1588 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1589 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1608 UcdStream::write_point(
const unsigned int index,
const Point<dim> &p)
1610 stream <<
index + 1 <<
" ";
1612 for (
unsigned int i = 0; i < dim; ++i)
1613 stream << p(i) <<
' ';
1615 for (
unsigned int i = dim; i < 3; ++i)
1624 UcdStream::write_cell(
const unsigned int index,
1625 const unsigned int start,
1626 const std::array<unsigned int, dim> &offsets)
1629 DataOutBaseImplementation::set_node_numbers(start, offsets);
1632 stream <<
index + 1 <<
"\t0 " << ucd_cell_type[dim];
1633 for (
unsigned int i = 0; i < nodes.size(); ++i)
1640 template <
typename data>
1642 UcdStream::write_dataset(
const unsigned int index,
1643 const std::vector<data> &
values)
1645 stream <<
index + 1;
1646 for (
unsigned int i = 0; i <
values.size(); ++i)
1647 stream <<
'\t' <<
values[i];
1662 VtkStream::write_point(
const unsigned int,
const Point<dim> &p)
1667 for (
unsigned int i = dim; i < 3; ++i)
1676 VtkStream::write_cell(
const unsigned int,
1677 const unsigned int start,
1678 const std::array<unsigned int, dim> &offsets)
1680 stream << GeometryInfo<dim>::vertices_per_cell <<
'\t';
1692 const unsigned int d1 = offsets[0];
1694 stream <<
'\t' << start + d1;
1700 const unsigned int d1 = offsets[0];
1701 const unsigned int d2 = offsets[1];
1703 stream <<
'\t' << start + d1;
1704 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1710 const unsigned int d1 = offsets[0];
1711 const unsigned int d2 = offsets[1];
1712 const unsigned int d3 = offsets[2];
1714 stream <<
'\t' << start + d1;
1715 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1716 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1717 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1730 VtkStream::write_cell_single(
const unsigned int index,
1731 const unsigned int start,
1732 const unsigned int n_points,
1737 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
1739 stream <<
'\t' << n_points;
1740 for (
unsigned int i = 0; i < n_points; ++i)
1749 VtkStream::write_high_order_cell(
const unsigned int start,
1750 const std::vector<unsigned> &connectivity)
1752 stream << connectivity.size();
1753 for (
const auto &c : connectivity)
1754 stream <<
'\t' << start + c;
1766 template <
int dim,
int spacedim>
1770 template <
int dim,
int spacedim>
1774 template <
int dim,
int spacedim>
1776 : patch_index(no_neighbor)
1778 , points_are_available(false)
1792 template <
int dim,
int spacedim>
1818 if (data.n_rows() != patch.
data.n_rows())
1821 if (data.n_cols() != patch.
data.n_cols())
1824 for (
unsigned int i = 0; i < data.n_rows(); ++i)
1825 for (
unsigned int j = 0; j < data.n_cols(); ++j)
1826 if (data[i][j] != patch.
data[i][j])
1834 template <
int dim,
int spacedim>
1840 sizeof(neighbors) /
sizeof(neighbors[0]) *
1851 template <
int dim,
int spacedim>
1859 data.swap(other_patch.
data);
1866 template <
int spacedim>
1870 template <
int spacedim>
1874 template <
int spacedim>
1878 template <
int spacedim>
1881 template <
int spacedim>
1885 template <
int spacedim>
1887 : patch_index(no_neighbor)
1888 , points_are_available(false)
1895 template <
int spacedim>
1899 const unsigned int dim = 0;
1913 if (
data.n_rows() != patch.
data.n_rows())
1916 if (
data.n_cols() != patch.
data.n_cols())
1919 for (
unsigned int i = 0; i <
data.n_rows(); ++i)
1920 for (
unsigned int j = 0; j <
data.n_cols(); ++j)
1921 if (
data[i][j] != patch.
data[i][j])
1929 template <
int spacedim>
1941 template <
int spacedim>
1954 : write_preamble(write_preamble)
1969 : space_dimension_labels(labels)
1983 const bool bicubic_patch,
1984 const bool external_data)
1986 , bicubic_patch(bicubic_patch)
1987 , external_data(external_data)
1992 const bool xdmf_hdf5_output)
1993 : filter_duplicate_vertices(filter_duplicate_vertices)
1994 , xdmf_hdf5_output(xdmf_hdf5_output)
2002 "Filter duplicate vertices",
2005 "Whether to remove duplicate vertex values. deal.II duplicates "
2006 "vertices once for each adjacent cell so that it can output "
2007 "discontinuous quantities for which there may be more than one "
2008 "value for each vertex position. Setting this flag to "
2009 "'true' will merge all of these values by selecting a "
2010 "random one and outputting this as 'the' value for the vertex. "
2011 "As long as the data to be output corresponds to continuous "
2012 "fields, merging vertices has no effect. On the other hand, "
2013 "if the data to be output corresponds to discontinuous fields "
2014 "(either because you are using a discontinuous finite element, "
2015 "or because you are using a DataPostprocessor that yields "
2016 "discontinuous data, or because the data to be output has been "
2017 "produced by entirely different means), then the data in the "
2018 "output file no longer faithfully represents the underlying data "
2019 "because the discontinuous field has been replaced by a "
2020 "continuous one. Note also that the filtering can not occur "
2021 "on processor boundaries. Thus, a filtered discontinuous field "
2022 "looks like a continuous field inside of a subdomain, "
2023 "but like a discontinuous field at the subdomain boundary."
2025 "In any case, filtering results in drastically smaller output "
2026 "files (smaller by about a factor of 2^dim).");
2031 "Whether the data will be used in an XDMF/HDF5 combination.");
2046 const bool int_binary,
2047 const bool coordinates_binary,
2048 const bool data_binary)
2049 : write_neighbors(write_neighbors)
2050 , int_binary(int_binary)
2051 , coordinates_binary(coordinates_binary)
2052 , data_binary(data_binary)
2053 , data_double(false)
2063 "A boolean field indicating whether neighborship "
2064 "information between cells is to be written to the "
2065 "OpenDX output file");
2069 "Output format of integer numbers, which is "
2070 "either a text representation (ascii) or binary integer "
2071 "values of 32 or 64 bits length");
2075 "Output format of vertex coordinates, which is "
2076 "either a text representation (ascii) or binary "
2077 "floating point values of 32 or 64 bits length");
2081 "Output format of data values, which is "
2082 "either a text representation (ascii) or binary "
2083 "floating point values of 32 or 64 bits length");
2103 "A flag indicating whether a comment should be "
2104 "written to the beginning of the output file "
2105 "indicating date and time of creation as well "
2106 "as the creating program");
2120 const int azimuth_angle,
2121 const int polar_angle,
2122 const unsigned int line_thickness,
2124 const bool draw_colorbar)
2127 , height_vector(height_vector)
2128 , azimuth_angle(azimuth_angle)
2129 , polar_angle(polar_angle)
2130 , line_thickness(line_thickness)
2132 , draw_colorbar(draw_colorbar)
2143 "A flag indicating whether POVRAY should use smoothed "
2144 "triangles instead of the usual ones");
2148 "Whether POVRAY should use bicubic patches");
2152 "Whether camera and lighting information should "
2153 "be put into an external file \"data.inc\" or into "
2154 "the POVRAY input file");
2170 const unsigned int color_vector,
2172 const unsigned int size,
2173 const double line_width,
2174 const double azimut_angle,
2175 const double turn_angle,
2176 const double z_scaling,
2177 const bool draw_mesh,
2178 const bool draw_cells,
2179 const bool shade_cells,
2181 : height_vector(height_vector)
2182 , color_vector(color_vector)
2185 , line_width(line_width)
2186 , azimut_angle(azimut_angle)
2187 , turn_angle(turn_angle)
2188 , z_scaling(z_scaling)
2189 , draw_mesh(draw_mesh)
2190 , draw_cells(draw_cells)
2191 , shade_cells(shade_cells)
2192 , color_function(color_function)
2231 double sum = xmax + xmin;
2232 double sum13 = xmin + 3 * xmax;
2233 double sum22 = 2 * xmin + 2 * xmax;
2234 double sum31 = 3 * xmin + xmax;
2235 double dif = xmax - xmin;
2236 double rezdif = 1.0 / dif;
2240 if (x < (sum31) / 4)
2242 else if (x < (sum22) / 4)
2244 else if (x < (sum13) / 4)
2255 rgb_values.
green = 0;
2256 rgb_values.
blue = (x - xmin) * 4. * rezdif;
2260 rgb_values.
green = (4 * x - 3 * xmin - xmax) * rezdif;
2261 rgb_values.
blue = (sum22 - 4. * x) * rezdif;
2264 rgb_values.
red = (4 * x - 2 *
sum) * rezdif;
2265 rgb_values.
green = (xmin + 3 * xmax - 4 * x) * rezdif;
2266 rgb_values.
blue = 0;
2270 rgb_values.
green = (4 * x - xmin - 3 * xmax) * rezdif;
2271 rgb_values.
blue = (4. * x - sum13) * rezdif;
2278 rgb_values.
red = rgb_values.
green = rgb_values.
blue = 1;
2292 (x - xmin) / (xmax - xmin);
2305 1 - (x - xmin) / (xmax - xmin);
2317 "Number of the input vector that is to be used to "
2318 "generate height information");
2322 "Number of the input vector that is to be used to "
2323 "generate color information");
2327 "Whether width or height should be scaled to match "
2332 "The size (width or height) to which the eps output "
2333 "file is to be scaled");
2337 "The width in which the postscript renderer is to "
2342 "Angle of the viewing position against the vertical "
2347 "Angle of the viewing direction against the y-axis");
2351 "Scaling for the z-direction relative to the scaling "
2352 "used in x- and y-directions");
2356 "Whether the mesh lines, or only the surface should be "
2361 "Whether only the mesh lines, or also the interior of "
2362 "cells should be plotted. If this flag is false, then "
2363 "one can see through the mesh");
2367 "Whether the interior of cells shall be shaded");
2371 "default|grey scale|reverse grey scale"),
2372 "Name of a color function used to colorize mesh lines "
2373 "and/or cell interiors");
2383 if (prm.
get(
"Scale to width or height") ==
"width")
2395 if (prm.
get(
"Color function") ==
"default")
2397 else if (prm.
get(
"Color function") ==
"grey scale")
2399 else if (prm.
get(
"Color function") ==
"reverse grey scale")
2410 : zone_name(zone_name)
2411 , solution_time(solution_time)
2425 const unsigned int cycle,
2426 const bool print_date_and_time,
2428 const bool write_higher_order_cells,
2429 const std::map<std::string, std::string> &physical_units)
2432 , print_date_and_time(print_date_and_time)
2433 , compression_level(compression_level)
2434 , write_higher_order_cells(write_higher_order_cells)
2435 , physical_units(physical_units)
2443 if (format_name ==
"none")
2446 if (format_name ==
"dx")
2449 if (format_name ==
"ucd")
2452 if (format_name ==
"gnuplot")
2455 if (format_name ==
"povray")
2458 if (format_name ==
"eps")
2461 if (format_name ==
"gmv")
2464 if (format_name ==
"tecplot")
2467 if (format_name ==
"tecplot_binary")
2470 if (format_name ==
"vtk")
2473 if (format_name ==
"vtu")
2476 if (format_name ==
"deal.II intermediate")
2479 if (format_name ==
"hdf5")
2483 ExcMessage(
"The given file format name is not recognized: <" +
2484 format_name +
">"));
2495 return "none|dx|ucd|gnuplot|povray|eps|gmv|tecplot|tecplot_binary|vtk|vtu|hdf5|svg|deal.II intermediate";
2503 switch (output_format)
2547 template <
int dim,
int spacedim>
2548 std::vector<Point<spacedim>>
2552 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
2554 std::vector<Point<spacedim>> node_positions;
2555 for (
const auto &patch : patches)
2558 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2560 for (
unsigned int point_no = 0; point_no < patch.
data.n_cols();
2562 node_positions.emplace_back(get_node_location(
2571 const unsigned int n = n_subdivisions + 1;
2576 node_positions.emplace_back(
2577 get_equispaced_location(patch, {}, n_subdivisions));
2580 for (
unsigned int i1 = 0; i1 < n; ++i1)
2581 node_positions.emplace_back(
2582 get_equispaced_location(patch, {i1}, n_subdivisions));
2585 for (
unsigned int i2 = 0; i2 < n; ++i2)
2586 for (
unsigned int i1 = 0; i1 < n; ++i1)
2587 node_positions.emplace_back(get_equispaced_location(
2588 patch, {i1, i2}, n_subdivisions));
2591 for (
unsigned int i3 = 0; i3 < n; ++i3)
2592 for (
unsigned int i2 = 0; i2 < n; ++i2)
2593 for (
unsigned int i1 = 0; i1 < n; ++i1)
2594 node_positions.emplace_back(get_equispaced_location(
2595 patch, {i1, i2, i3}, n_subdivisions));
2604 return node_positions;
2608 template <
int dim,
int spacedim,
typename StreamType>
2614 const std::vector<Point<spacedim>> node_positions =
2618 for (
const auto &node : node_positions)
2619 out.write_point(count++, node);
2625 template <
int dim,
int spacedim,
typename StreamType>
2630 unsigned int count = 0;
2631 unsigned int first_vertex_of_patch = 0;
2632 for (
const auto &patch : patches)
2635 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2637 out.write_cell_single(count++,
2638 first_vertex_of_patch,
2639 patch.
data.n_cols(),
2641 first_vertex_of_patch += patch.
data.n_cols();
2646 const unsigned int n = n_subdivisions + 1;
2652 const unsigned int offset = first_vertex_of_patch;
2653 out.template write_cell<0>(count++, offset, {});
2659 constexpr
unsigned int d1 = 1;
2661 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2663 const unsigned int offset =
2664 first_vertex_of_patch + i1 * d1;
2665 out.template write_cell<1>(count++, offset, {{d1}});
2673 constexpr
unsigned int d1 = 1;
2674 const unsigned int d2 = n;
2676 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2677 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2679 const unsigned int offset =
2680 first_vertex_of_patch + i2 * d2 + i1 * d1;
2681 out.template write_cell<2>(count++,
2691 constexpr
unsigned int d1 = 1;
2692 const unsigned int d2 = n;
2693 const unsigned int d3 = n * n;
2695 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
2696 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2697 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2699 const unsigned int offset = first_vertex_of_patch +
2702 out.template write_cell<3>(count++,
2714 first_vertex_of_patch +=
2715 Utilities::fixed_power<dim>(n_subdivisions + 1);
2724 template <
int dim,
int spacedim,
typename StreamType>
2728 const bool legacy_format)
2731 unsigned int first_vertex_of_patch = 0;
2733 std::vector<unsigned> connectivity;
2735 for (
const auto &patch : patches)
2737 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2739 connectivity.resize(patch.
data.n_cols());
2741 for (
unsigned int i = 0; i < patch.
data.n_cols(); ++i)
2742 connectivity[i] = i;
2744 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2747 first_vertex_of_patch += patch.
data.n_cols();
2752 const unsigned int n = n_subdivisions + 1;
2754 connectivity.resize(Utilities::fixed_power<dim>(n));
2761 ExcMessage(
"Point-like cells should not be possible "
2762 "when writing higher-order cells."));
2767 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2769 const unsigned int local_index = i1;
2770 const unsigned int connectivity_index =
2772 .template vtk_lexicographic_to_node_index<1>(
2773 {{i1}}, {{n_subdivisions}}, legacy_format);
2774 connectivity[connectivity_index] = local_index;
2781 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2782 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2784 const unsigned int local_index = i2 * n + i1;
2785 const unsigned int connectivity_index =
2787 .template vtk_lexicographic_to_node_index<2>(
2789 {{n_subdivisions, n_subdivisions}},
2791 connectivity[connectivity_index] = local_index;
2798 for (
unsigned int i3 = 0; i3 < n_subdivisions + 1; ++i3)
2799 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2800 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2802 const unsigned int local_index =
2803 i3 * n * n + i2 * n + i1;
2804 const unsigned int connectivity_index =
2806 .template vtk_lexicographic_to_node_index<3>(
2812 connectivity[connectivity_index] = local_index;
2823 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2827 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
2835 template <
int dim,
int spacedim,
class StreamType>
2838 unsigned int n_data_sets,
2839 const bool double_precision,
2843 unsigned int count = 0;
2845 for (
const auto &patch : patches)
2848 const unsigned int n = n_subdivisions + 1;
2850 Assert((patch.
data.n_rows() == n_data_sets &&
2852 (patch.
data.n_rows() == n_data_sets + spacedim &&
2855 (n_data_sets + spacedim) :
2857 patch.
data.n_rows()));
2858 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
2861 std::vector<float> floats(n_data_sets);
2862 std::vector<double> doubles(n_data_sets);
2865 for (
unsigned int i = 0; i < Utilities::fixed_power<dim>(n);
2867 if (double_precision)
2869 for (
unsigned int data_set = 0; data_set < n_data_sets;
2871 doubles[data_set] = patch.
data(data_set, i);
2872 out.write_dataset(count, doubles);
2876 for (
unsigned int data_set = 0; data_set < n_data_sets;
2878 floats[data_set] = patch.
data(data_set, i);
2879 out.write_dataset(count, floats);
2904 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
2905 camera_horizontal[2] * camera_direction[1];
2906 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
2907 camera_horizontal[0] * camera_direction[2];
2908 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
2909 camera_horizontal[1] * camera_direction[0];
2913 phi /= (
point[0] - camera_position[0]) * camera_direction[0] +
2914 (
point[1] - camera_position[1]) * camera_direction[1] +
2915 (
point[2] - camera_position[2]) * camera_direction[2];
2919 camera_position[0] + phi * (
point[0] - camera_position[0]);
2921 camera_position[1] + phi * (
point[1] - camera_position[1]);
2923 camera_position[2] + phi * (
point[2] - camera_position[2]);
2926 projection_decomposition[0] = (projection[0] - camera_position[0] -
2927 camera_focus * camera_direction[0]) *
2928 camera_horizontal[0];
2929 projection_decomposition[0] += (projection[1] - camera_position[1] -
2930 camera_focus * camera_direction[1]) *
2931 camera_horizontal[1];
2932 projection_decomposition[0] += (projection[2] - camera_position[2] -
2933 camera_focus * camera_direction[2]) *
2934 camera_horizontal[2];
2936 projection_decomposition[1] = (projection[0] - camera_position[0] -
2937 camera_focus * camera_direction[0]) *
2939 projection_decomposition[1] += (projection[1] - camera_position[1] -
2940 camera_focus * camera_direction[1]) *
2942 projection_decomposition[1] += (projection[2] - camera_position[2] -
2943 camera_focus * camera_direction[2]) *
2946 return projection_decomposition;
2955 svg_get_gradient_parameters(
Point<3> points[])
2961 for (
int i = 0; i < 2; ++i)
2963 for (
int j = 0; j < 2 - i; ++j)
2965 if (points[j][2] > points[j + 1][2])
2968 points[j] = points[j + 1];
2969 points[j + 1] = temp;
2976 v_inter = points[1];
2983 A[0][0] = v_max[0] - v_min[0];
2984 A[0][1] = v_inter[0] - v_min[0];
2985 A[1][0] = v_max[1] - v_min[1];
2986 A[1][1] = v_inter[1] - v_min[1];
2992 bool col_change =
false;
3001 double temp =
A[1][0];
3006 for (
unsigned int k = 0; k < 1; ++k)
3008 for (
unsigned int i = k + 1; i < 2; ++i)
3010 x =
A[i][k] /
A[k][k];
3012 for (
unsigned int j = k + 1; j < 2; ++j)
3013 A[i][j] =
A[i][j] -
A[k][j] * x;
3015 b[i] =
b[i] -
b[k] * x;
3021 for (
int i = 0; i >= 0; i--)
3025 for (
unsigned int j = i + 1; j < 2; ++j)
3028 b[i] =
sum /
A[i][i];
3038 double c =
b[0] * (v_max[2] - v_min[2]) +
b[1] * (v_inter[2] - v_min[2]) +
3042 A[0][0] = v_max[0] - v_min[0];
3043 A[0][1] = v_inter[0] - v_min[0];
3044 A[1][0] = v_max[1] - v_min[1];
3045 A[1][1] = v_inter[1] - v_min[1];
3047 b[0] = 1.0 - v_min[0];
3059 double temp =
A[1][0];
3064 for (
unsigned int k = 0; k < 1; ++k)
3066 for (
unsigned int i = k + 1; i < 2; ++i)
3068 x =
A[i][k] /
A[k][k];
3070 for (
unsigned int j = k + 1; j < 2; ++j)
3071 A[i][j] =
A[i][j] -
A[k][j] * x;
3073 b[i] =
b[i] -
b[k] * x;
3077 b[1] =
b[1] /
A[1][1];
3079 for (
int i = 0; i >= 0; i--)
3083 for (
unsigned int j = i + 1; j < 2; ++j)
3086 b[i] =
sum /
A[i][i];
3096 gradient[0] =
b[0] * (v_max[2] - v_min[2]) +
3097 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3100 A[0][0] = v_max[0] - v_min[0];
3101 A[0][1] = v_inter[0] - v_min[0];
3102 A[1][0] = v_max[1] - v_min[1];
3103 A[1][1] = v_inter[1] - v_min[1];
3106 b[1] = 1.0 - v_min[1];
3117 double temp =
A[1][0];
3122 for (
unsigned int k = 0; k < 1; ++k)
3124 for (
unsigned int i = k + 1; i < 2; ++i)
3126 x =
A[i][k] /
A[k][k];
3128 for (
unsigned int j = k + 1; j < 2; ++j)
3129 A[i][j] =
A[i][j] -
A[k][j] * x;
3131 b[i] =
b[i] -
b[k] * x;
3135 b[1] =
b[1] /
A[1][1];
3137 for (
int i = 0; i >= 0; i--)
3141 for (
unsigned int j = i + 1; j < 2; ++j)
3144 b[i] =
sum /
A[i][i];
3154 gradient[1] =
b[0] * (v_max[2] - v_min[2]) +
3155 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3161 gradient[1] * (v_min[1] - v_max[1]);
3165 gradient_parameters[0] = v_min[0];
3166 gradient_parameters[1] = v_min[1];
3171 gradient_parameters[4] = v_min[2];
3172 gradient_parameters[5] = v_max[2];
3174 return gradient_parameters;
3180 template <
int dim,
int spacedim>
3184 const std::vector<std::string> & data_names,
3186 std::tuple<
unsigned int,
3199 #ifndef DEAL_II_WITH_MPI
3208 if (patches.size() == 0)
3212 const unsigned int n_data_sets = data_names.size();
3214 UcdStream ucd_out(out, flags);
3217 unsigned int n_nodes;
3219 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
3225 <<
"# This file was generated by the deal.II library." <<
'\n'
3229 <<
"# For a description of the UCD format see the AVS Developer's guide."
3235 out << n_nodes <<
' ' <<
n_cells <<
' ' << n_data_sets <<
' ' << 0
3248 if (n_data_sets != 0)
3250 out << n_data_sets <<
" ";
3251 for (
unsigned int i = 0; i < n_data_sets; ++i)
3256 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3257 out << data_names[data_set]
3261 write_data(patches, n_data_sets,
true, ucd_out);
3271 template <
int dim,
int spacedim>
3275 const std::vector<std::string> & data_names,
3277 std::tuple<
unsigned int,
3289 #ifndef DEAL_II_WITH_MPI
3298 if (patches.size() == 0)
3302 DXStream dx_out(out, flags);
3305 unsigned int offset = 0;
3307 const unsigned int n_data_sets = data_names.size();
3310 unsigned int n_nodes;
3312 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
3315 out <<
"object \"vertices\" class array type float rank 1 shape "
3316 << spacedim <<
" items " << n_nodes;
3320 out <<
" lsb ieee data 0" <<
'\n';
3321 offset += n_nodes * spacedim *
sizeof(float);
3325 out <<
" data follows" <<
'\n';
3334 out <<
"object \"cells\" class array type int rank 1 shape "
3339 out <<
" lsb binary data " << offset <<
'\n';
3340 offset +=
n_cells *
sizeof(int);
3344 out <<
" data follows" <<
'\n';
3350 out <<
"attribute \"element type\" string \"";
3357 out <<
"\"" <<
'\n' <<
"attribute \"ref\" string \"positions\"" <<
'\n';
3364 out <<
"object \"neighbors\" class array type int rank 1 shape "
3368 for (
const auto &patch : patches)
3371 const unsigned int n1 = (dim > 0) ? n : 1;
3372 const unsigned int n2 = (dim > 1) ? n : 1;
3373 const unsigned int n3 = (dim > 2) ? n : 1;
3374 const unsigned int x_minus = (dim > 0) ? 0 : 0;
3375 const unsigned int x_plus = (dim > 0) ? 1 : 0;
3376 const unsigned int y_minus = (dim > 1) ? 2 : 0;
3377 const unsigned int y_plus = (dim > 1) ? 3 : 0;
3378 const unsigned int z_minus = (dim > 2) ? 4 : 0;
3379 const unsigned int z_plus = (dim > 2) ? 5 : 0;
3380 unsigned int cells_per_patch = Utilities::fixed_power<dim>(n);
3381 unsigned int dx = 1;
3382 unsigned int dy = n;
3383 unsigned int dz = n * n;
3385 const unsigned int patch_start =
3388 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3389 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3390 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3392 const unsigned int nx = i1 *
dx;
3393 const unsigned int ny = i2 * dy;
3394 const unsigned int nz = i3 * dz;
3406 const unsigned int nn = patch.
neighbors[x_minus];
3410 << (nn * cells_per_patch + ny + nz +
dx * (n - 1));
3416 out <<
'\t' << patch_start + nx -
dx + ny + nz;
3421 const unsigned int nn = patch.
neighbors[x_plus];
3424 out << (nn * cells_per_patch + ny + nz);
3430 out <<
'\t' << patch_start + nx +
dx + ny + nz;
3437 const unsigned int nn = patch.
neighbors[y_minus];
3441 << (nn * cells_per_patch + nx + nz + dy * (n - 1));
3447 out <<
'\t' << patch_start + nx + ny - dy + nz;
3452 const unsigned int nn = patch.
neighbors[y_plus];
3455 out << (nn * cells_per_patch + nx + nz);
3461 out <<
'\t' << patch_start + nx + ny + dy + nz;
3469 const unsigned int nn = patch.
neighbors[z_minus];
3473 << (nn * cells_per_patch + nx + ny + dz * (n - 1));
3479 out <<
'\t' << patch_start + nx + ny + nz - dz;
3484 const unsigned int nn = patch.
neighbors[z_plus];
3487 out << (nn * cells_per_patch + nx + ny);
3493 out <<
'\t' << patch_start + nx + ny + nz + dz;
3501 if (n_data_sets != 0)
3503 out <<
"object \"data\" class array type float rank 1 shape "
3504 << n_data_sets <<
" items " << n_nodes;
3508 out <<
" lsb ieee data " << offset <<
'\n';
3509 offset += n_data_sets * n_nodes *
3510 ((flags.
data_double) ?
sizeof(
double) :
sizeof(float));
3514 out <<
" data follows" <<
'\n';
3519 out <<
"attribute \"dep\" string \"positions\"" <<
'\n';
3523 out <<
"object \"data\" class constantarray type float rank 0 items "
3524 << n_nodes <<
" data follows" <<
'\n'
3530 out <<
"object \"deal data\" class field" <<
'\n'
3531 <<
"component \"positions\" value \"vertices\"" <<
'\n'
3532 <<
"component \"connections\" value \"cells\"" <<
'\n'
3533 <<
"component \"data\" value \"data\"" <<
'\n';
3536 out <<
"component \"neighbors\" value \"neighbors\"" <<
'\n';
3543 out <<
"end" <<
'\n';
3561 template <
int dim,
int spacedim>
3565 const std::vector<std::string> & data_names,
3567 std::tuple<
unsigned int,
3576 #ifndef DEAL_II_WITH_MPI
3586 if (patches.size() == 0)
3590 const unsigned int n_data_sets = data_names.size();
3594 out <<
"# This file was generated by the deal.II library." <<
'\n'
3598 <<
"# For a description of the GNUPLOT format see the GNUPLOT manual."
3605 for (
unsigned int spacedim_n = 0; spacedim_n < spacedim; ++spacedim_n)
3610 for (
const auto &data_name : data_names)
3611 out <<
'<' << data_name <<
"> ";
3617 for (
const auto &patch : patches)
3620 const unsigned int n_points_per_direction = n_subdivisions + 1;
3622 Assert((patch.
data.n_rows() == n_data_sets &&
3624 (patch.
data.n_rows() == n_data_sets + spacedim &&
3627 (n_data_sets + spacedim) :
3629 patch.
data.n_rows()));
3631 auto output_point_data =
3632 [&out, &patch, n_data_sets](
const unsigned int point_index)
mutable {
3633 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3634 out << patch.data(data_set, point_index) <<
' ';
3643 Assert(patch.data.n_cols() == 1,
3645 n_subdivisions + 1));
3649 out << get_equispaced_location(patch, {}, n_subdivisions)
3651 output_point_data(0);
3661 Assert(patch.data.n_cols() ==
3662 Utilities::fixed_power<dim>(n_points_per_direction),
3664 n_subdivisions + 1));
3666 for (
unsigned int i1 = 0; i1 < n_points_per_direction; ++i1)
3669 out << get_equispaced_location(patch, {i1}, n_subdivisions)
3672 output_point_data(i1);
3685 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3686 n_points_per_direction),
3688 n_subdivisions + 1));
3690 for (
unsigned int i2 = 0; i2 < n_points_per_direction; ++i2)
3692 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3696 out << get_equispaced_location(patch,
3701 output_point_data(i1 + i2 * n_points_per_direction);
3726 out << get_node_location(patch, 0) <<
' ';
3727 output_point_data(0);
3730 out << get_node_location(patch, 1) <<
' ';
3731 output_point_data(1);
3735 out << get_node_location(patch, 2) <<
' ';
3736 output_point_data(2);
3739 out << get_node_location(patch, 2) <<
' ';
3740 output_point_data(2);
3760 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3761 n_points_per_direction),
3763 n_subdivisions + 1));
3768 for (
unsigned int i3 = 0; i3 < n_points_per_direction; ++i3)
3769 for (
unsigned int i2 = 0; i2 < n_points_per_direction;
3771 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3776 get_equispaced_location(patch,
3780 if (i1 < n_subdivisions)
3783 out << this_point <<
' ';
3784 output_point_data(i1 +
3785 i2 * n_points_per_direction +
3786 i3 * n_points_per_direction *
3787 n_points_per_direction);
3791 out << get_equispaced_location(patch,
3796 output_point_data((i1 + 1) +
3797 i2 * n_points_per_direction +
3798 i3 * n_points_per_direction *
3799 n_points_per_direction);
3803 out <<
'\n' <<
'\n';
3807 if (i2 < n_subdivisions)
3810 out << this_point <<
' ';
3811 output_point_data(i1 +
3812 i2 * n_points_per_direction +
3813 i3 * n_points_per_direction *
3814 n_points_per_direction);
3818 out << get_equispaced_location(patch,
3824 i1 + (i2 + 1) * n_points_per_direction +
3825 i3 * n_points_per_direction *
3826 n_points_per_direction);
3830 out <<
'\n' <<
'\n';
3834 if (i3 < n_subdivisions)
3837 out << this_point <<
' ';
3838 output_point_data(i1 +
3839 i2 * n_points_per_direction +
3840 i3 * n_points_per_direction *
3841 n_points_per_direction);
3845 out << get_equispaced_location(patch,
3851 i1 + i2 * n_points_per_direction +
3852 (i3 + 1) * n_points_per_direction *
3853 n_points_per_direction);
3856 out <<
'\n' <<
'\n';
3865 for (
const unsigned int v : {0, 1, 2, 0, 3, 2})
3867 out << get_node_location(patch, v) <<
' ';
3868 output_point_data(v);
3873 for (
const unsigned int v : {3, 1})
3875 out << get_node_location(patch, v) <<
' ';
3876 output_point_data(v);
3886 for (
const unsigned int v : {0, 1, 3, 2, 0, 4, 1})
3888 out << get_node_location(patch, v) <<
' ';
3889 output_point_data(v);
3894 for (
const unsigned int v : {2, 4, 3})
3896 out << get_node_location(patch, v) <<
' ';
3897 output_point_data(v);
3911 for (
const unsigned int v : {0, 1, 2, 0, 3, 4, 5, 3})
3913 out << get_node_location(patch, v) <<
' ';
3914 output_point_data(v);
3919 for (
const unsigned int v : {1, 4})
3921 out << get_node_location(patch, v) <<
' ';
3922 output_point_data(v);
3927 for (
const unsigned int v : {2, 5})
3929 out << get_node_location(patch, v) <<
' ';
3930 output_point_data(v);
3955 template <
int dim,
int spacedim>
3957 do_write_povray(
const std::vector<Patch<dim, spacedim>> &,
3958 const std::vector<std::string> &,
3959 const PovrayFlags &,
3963 ExcMessage(
"Writing files in POVRAY format is only supported "
3964 "for two-dimensional meshes."));
3970 do_write_povray(
const std::vector<Patch<2, 2>> &patches,
3971 const std::vector<std::string> &data_names,
3972 const PovrayFlags & flags,
3977 #ifndef DEAL_II_WITH_MPI
3986 if (patches.size() == 0)
3989 constexpr
int dim = 2;
3991 constexpr
int spacedim = 2;
3993 const unsigned int n_data_sets = data_names.size();
3999 <<
"/* This file was generated by the deal.II library." <<
'\n'
4003 <<
" For a description of the POVRAY format see the POVRAY manual."
4008 out <<
"#include \"colors.inc\" " <<
'\n'
4009 <<
"#include \"textures.inc\" " <<
'\n';
4013 if (flags.external_data)
4014 out <<
"#include \"data.inc\" " <<
'\n';
4020 <<
"camera {" <<
'\n'
4021 <<
" location <1,4,-7>" <<
'\n'
4022 <<
" look_at <0,0,0>" <<
'\n'
4023 <<
" angle 30" <<
'\n'
4028 <<
"light_source {" <<
'\n'
4029 <<
" <1,4,-7>" <<
'\n'
4030 <<
" color Grey" <<
'\n'
4033 <<
"light_source {" <<
'\n'
4034 <<
" <0,20,0>" <<
'\n'
4035 <<
" color White" <<
'\n'
4042 double hmin = patches[0].data(0, 0);
4043 double hmax = patches[0].data(0, 0);
4045 for (
const auto &patch : patches)
4049 Assert((patch.
data.n_rows() == n_data_sets &&
4051 (patch.
data.n_rows() == n_data_sets + spacedim &&
4054 (n_data_sets + spacedim) :
4056 patch.
data.n_rows()));
4058 Utilities::fixed_power<dim>(n_subdivisions + 1),
4060 n_subdivisions + 1));
4062 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
4063 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
4065 const int dl = i * (n_subdivisions + 1) + j;
4066 if (patch.
data(0, dl) < hmin)
4067 hmin = patch.
data(0, dl);
4068 if (patch.
data(0, dl) > hmax)
4069 hmax = patch.
data(0, dl);
4073 out <<
"#declare HMIN=" << hmin <<
";" <<
'\n'
4074 <<
"#declare HMAX=" << hmax <<
";" <<
'\n'
4077 if (!flags.external_data)
4080 out <<
"#declare Tex=texture{" <<
'\n'
4081 <<
" pigment {" <<
'\n'
4082 <<
" gradient y" <<
'\n'
4083 <<
" scale y*(HMAX-HMIN)*" << 0.1 <<
'\n'
4084 <<
" color_map {" <<
'\n'
4085 <<
" [0.00 color Light_Purple] " <<
'\n'
4086 <<
" [0.95 color Light_Purple] " <<
'\n'
4087 <<
" [1.00 color White] " <<
'\n'
4092 if (!flags.bicubic_patch)
4095 out <<
'\n' <<
"mesh {" <<
'\n';
4099 for (
const auto &patch : patches)
4102 const unsigned int n = n_subdivisions + 1;
4103 const unsigned int d1 = 1;
4104 const unsigned int d2 = n;
4106 Assert((patch.
data.n_rows() == n_data_sets &&
4108 (patch.
data.n_rows() == n_data_sets + spacedim &&
4111 (n_data_sets + spacedim) :
4113 patch.
data.n_rows()));
4114 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
4116 n_subdivisions + 1));
4119 std::vector<Point<spacedim>> ver(n * n);
4121 for (
unsigned int i2 = 0; i2 < n; ++i2)
4122 for (
unsigned int i1 = 0; i1 < n; ++i1)
4125 ver[i1 * d1 + i2 * d2] =
4126 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4130 if (!flags.bicubic_patch)
4133 std::vector<Point<3>> nrml;
4143 for (
unsigned int i = 0; i < n; ++i)
4144 for (
unsigned int j = 0; j < n; ++j)
4146 const unsigned int il = (i == 0) ? i : (i - 1);
4147 const unsigned int ir =
4148 (i == n_subdivisions) ? i : (i + 1);
4149 const unsigned int jl = (j == 0) ? j : (j - 1);
4150 const unsigned int jr =
4151 (j == n_subdivisions) ? j : (j + 1);
4154 ver[ir * d1 + j * d2](0) - ver[il * d1 + j * d2](0);
4155 h1(1) = patch.
data(0, ir * d1 + j * d2) -
4156 patch.
data(0, il * d1 + j * d2);
4158 ver[ir * d1 + j * d2](1) - ver[il * d1 + j * d2](1);
4161 ver[i * d1 + jr * d2](0) - ver[i * d1 + jl * d2](0);
4162 h2(1) = patch.
data(0, i * d1 + jr * d2) -
4163 patch.
data(0, i * d1 + jl * d2);
4165 ver[i * d1 + jr * d2](1) - ver[i * d1 + jl * d2](1);
4167 nrml[i * d1 + j * d2](0) =
4168 h1(1) * h2(2) - h1(2) * h2(1);
4169 nrml[i * d1 + j * d2](1) =
4170 h1(2) * h2(0) - h1(0) * h2(2);
4171 nrml[i * d1 + j * d2](2) =
4172 h1(0) * h2(1) - h1(1) * h2(0);
4176 std::sqrt(std::pow(nrml[i * d1 + j * d2](0), 2.) +
4177 std::pow(nrml[i * d1 + j * d2](1), 2.) +
4178 std::pow(nrml[i * d1 + j * d2](2), 2.));
4180 if (nrml[i * d1 + j * d2](1) < 0)
4183 for (
unsigned int k = 0; k < 3; ++k)
4184 nrml[i * d1 + j * d2](k) /=
norm;
4189 for (
unsigned int i = 0; i < n_subdivisions; ++i)
4190 for (
unsigned int j = 0; j < n_subdivisions; ++j)
4193 const int dl = i * d1 + j * d2;
4199 out <<
"smooth_triangle {" <<
'\n'
4200 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4201 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0)
4202 <<
", " << nrml[dl](1) <<
", " << nrml[dl](2)
4204 out <<
" \t<" << ver[dl + d1](0) <<
","
4205 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
4206 <<
">, <" << nrml[dl + d1](0) <<
", "
4207 << nrml[dl + d1](1) <<
", " << nrml[dl + d1](2)
4209 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4210 << patch.
data(0, dl + d1 + d2) <<
","
4211 << ver[dl + d1 + d2](1) <<
">, <"
4212 << nrml[dl + d1 + d2](0) <<
", "
4213 << nrml[dl + d1 + d2](1) <<
", "
4214 << nrml[dl + d1 + d2](2) <<
">}" <<
'\n';
4217 out <<
"smooth_triangle {" <<
'\n'
4218 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4219 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0)
4220 <<
", " << nrml[dl](1) <<
", " << nrml[dl](2)
4222 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4223 << patch.
data(0, dl + d1 + d2) <<
","
4224 << ver[dl + d1 + d2](1) <<
">, <"
4225 << nrml[dl + d1 + d2](0) <<
", "
4226 << nrml[dl + d1 + d2](1) <<
", "
4227 << nrml[dl + d1 + d2](2) <<
">," <<
'\n';
4228 out <<
"\t<" << ver[dl + d2](0) <<
","
4229 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
4230 <<
">, <" << nrml[dl + d2](0) <<
", "
4231 << nrml[dl + d2](1) <<
", " << nrml[dl + d2](2)
4237 out <<
"triangle {" <<
'\n'
4238 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4239 <<
"," << ver[dl](1) <<
">," <<
'\n';
4240 out <<
"\t<" << ver[dl + d1](0) <<
","
4241 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
4243 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4244 << patch.
data(0, dl + d1 + d2) <<
","
4245 << ver[dl + d1 + d2](1) <<
">}" <<
'\n';
4248 out <<
"triangle {" <<
'\n'
4249 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4250 <<
"," << ver[dl](1) <<
">," <<
'\n';
4251 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4252 << patch.
data(0, dl + d1 + d2) <<
","
4253 << ver[dl + d1 + d2](1) <<
">," <<
'\n';
4254 out <<
"\t<" << ver[dl + d2](0) <<
","
4255 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
4263 Assert(n_subdivisions == 3,
4266 <<
"bicubic_patch {" <<
'\n'
4267 <<
" type 0" <<
'\n'
4268 <<
" flatness 0" <<
'\n'
4269 <<
" u_steps 0" <<
'\n'
4270 <<
" v_steps 0" <<
'\n';
4271 for (
int i = 0; i < 16; ++i)
4273 out <<
"\t<" << ver[i](0) <<
"," << patch.
data(0, i) <<
","
4274 << ver[i](1) <<
">";
4279 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n';
4283 if (!flags.bicubic_patch)
4286 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n' <<
'\n';
4298 template <
int dim,
int spacedim>
4302 const std::vector<std::string> & data_names,
4304 std::tuple<
unsigned int,
4311 do_write_povray(patches, data_names, flags, out);
4316 template <
int dim,
int spacedim>
4320 const std::vector<std::string> & ,
4322 std::tuple<
unsigned int,
4334 template <
int spacedim>
4338 const std::vector<std::string> & ,
4340 std::tuple<
unsigned int,
4349 #ifndef DEAL_II_WITH_MPI
4358 if (patches.size() == 0)
4368 std::multiset<EpsCell2d> cells;
4377 double heights[4] = {0, 0, 0, 0};
4381 for (
const auto &patch : patches)
4384 const unsigned int n = n_subdivisions + 1;
4385 const unsigned int d1 = 1;
4386 const unsigned int d2 = n;
4388 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
4389 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
4393 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4395 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
4397 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
4398 points[3] = get_equispaced_location(patch,
4406 patch.
data.n_rows() == 0,
4409 patch.
data.n_rows()));
4411 patch.
data.n_rows() != 0 ?
4415 heights[1] = patch.
data.n_rows() != 0 ?
4417 (i1 + 1) * d1 + i2 * d2) *
4420 heights[2] = patch.
data.n_rows() != 0 ?
4422 i1 * d1 + (i2 + 1) * d2) *
4425 heights[3] = patch.
data.n_rows() != 0 ?
4427 (i1 + 1) * d1 + (i2 + 1) * d2) *
4434 for (
unsigned int i = 0; i < 4; ++i)
4435 heights[i] = points[i](2);
4456 cz = -std::cos(flags.
turn_angle * 2 * pi / 360.),
4459 sz = std::sin(flags.
turn_angle * 2 * pi / 360.);
4460 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4462 const double x = points[vertex](0), y = points[vertex](1),
4463 z = -heights[vertex];
4465 eps_cell.vertices[vertex](0) = -cz * x + sz * y;
4466 eps_cell.vertices[vertex](1) =
4467 -cx * sz * x - cx * cz * y - sx * z;
4491 (points[0] + points[1] + points[2] + points[3]) / 4;
4492 const double center_height =
4493 -(heights[0] + heights[1] + heights[2] + heights[3]) / 4;
4496 eps_cell.depth = -sx * sz * center_point(0) -
4497 sx * cz * center_point(1) + cx * center_height;
4502 patch.
data.n_rows() == 0,
4505 patch.
data.n_rows()));
4506 const double color_values[4] = {
4507 patch.
data.n_rows() != 0 ?
4511 patch.
data.n_rows() != 0 ?
4515 patch.
data.n_rows() != 0 ?
4519 patch.
data.n_rows() != 0 ?
4521 (i1 + 1) * d1 + (i2 + 1) * d2) :
4525 eps_cell.color_value = (color_values[0] + color_values[1] +
4526 color_values[3] + color_values[2]) /
4531 std::min(min_color_value, eps_cell.color_value);
4533 std::max(max_color_value, eps_cell.color_value);
4537 cells.insert(eps_cell);
4543 double x_min = cells.begin()->vertices[0](0);
4544 double x_max = x_min;
4545 double y_min = cells.begin()->vertices[0](1);
4546 double y_max = y_min;
4548 for (
const auto &cell : cells)
4549 for (
const auto &vertex : cell.vertices)
4551 x_min =
std::min(x_min, vertex(0));
4552 x_max =
std::max(x_max, vertex(0));
4553 y_min =
std::min(y_min, vertex(1));
4554 y_max =
std::max(y_max, vertex(1));
4559 const double scale =
4563 const Point<2> offset(x_min, y_min);
4568 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n'
4569 <<
"%%Title: deal.II Output" <<
'\n'
4570 <<
"%%Creator: the deal.II library" <<
'\n'
4573 <<
"%%BoundingBox: "
4577 <<
static_cast<unsigned int>((x_max - x_min) *
scale + 0.5) <<
' '
4578 <<
static_cast<unsigned int>((y_max - y_min) *
scale + 0.5) <<
'\n';
4587 out <<
"/m {moveto} bind def" <<
'\n'
4588 <<
"/l {lineto} bind def" <<
'\n'
4589 <<
"/s {setrgbcolor} bind def" <<
'\n'
4590 <<
"/sg {setgray} bind def" <<
'\n'
4591 <<
"/lx {lineto closepath stroke} bind def" <<
'\n'
4592 <<
"/lf {lineto closepath fill} bind def" <<
'\n';
4594 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4596 out << flags.
line_width <<
" setlinewidth" <<
'\n';
4604 if (max_color_value == min_color_value)
4605 max_color_value = min_color_value + 1;
4609 for (
const auto &cell : cells)
4622 out << rgb_values.
red <<
" sg ";
4624 out << rgb_values.
red <<
' ' << rgb_values.
green <<
' '
4625 << rgb_values.
blue <<
" s ";
4630 out << (cell.vertices[0] - offset) *
scale <<
" m "
4631 << (cell.vertices[1] - offset) *
scale <<
" l "
4632 << (cell.vertices[3] - offset) *
scale <<
" l "
4633 << (cell.vertices[2] - offset) *
scale <<
" lf" <<
'\n';
4638 << (cell.vertices[0] - offset) *
scale <<
" m "
4639 << (cell.vertices[1] - offset) *
scale <<
" l "
4640 << (cell.vertices[3] - offset) *
scale <<
" l "
4641 << (cell.vertices[2] - offset) *
scale <<
" lx" <<
'\n';
4643 out <<
"showpage" <<
'\n';
4652 template <
int dim,
int spacedim>
4656 const std::vector<std::string> & data_names,
4658 std::tuple<
unsigned int,
4674 #ifndef DEAL_II_WITH_MPI
4683 if (patches.size() == 0)
4687 GmvStream gmv_out(out, flags);
4688 const unsigned int n_data_sets = data_names.size();
4691 Assert((patches[0].data.n_rows() == n_data_sets &&
4692 !patches[0].points_are_available) ||
4693 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4694 patches[0].points_are_available),
4696 (n_data_sets + spacedim) :
4698 patches[0].data.n_rows()));
4702 out <<
"gmvinput ascii" <<
'\n' <<
'\n';
4705 unsigned int n_nodes;
4707 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
4722 [&patches]() {
return create_global_data_table(patches); });
4728 out <<
"nodes " << n_nodes <<
'\n';
4729 for (
unsigned int d = 0;
d < spacedim; ++
d)
4731 gmv_out.selected_component =
d;
4737 for (
unsigned int d = spacedim;
d < 3; ++
d)
4739 for (
unsigned int i = 0; i < n_nodes; ++i)
4746 out <<
"cells " <<
n_cells <<
'\n';
4751 out <<
"variable" <<
'\n';
4755 std::move(*create_global_data_table_task.
return_value());
4759 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4761 out << data_names[data_set] <<
" 1" <<
'\n';
4763 data_vectors[data_set].
end(),
4764 std::ostream_iterator<double>(out,
" "));
4765 out <<
'\n' <<
'\n';
4771 out <<
"endvars" <<
'\n';
4774 out <<
"endgmv" <<
'\n';
4785 template <
int dim,
int spacedim>
4789 const std::vector<std::string> & data_names,
4791 std::tuple<
unsigned int,
4805 #ifndef DEAL_II_WITH_MPI
4814 if (patches.size() == 0)
4818 TecplotStream tecplot_out(out, flags);
4820 const unsigned int n_data_sets = data_names.size();
4823 Assert((patches[0].data.n_rows() == n_data_sets &&
4824 !patches[0].points_are_available) ||
4825 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4826 patches[0].points_are_available),
4828 (n_data_sets + spacedim) :
4830 patches[0].data.n_rows()));
4833 unsigned int n_nodes;
4835 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
4841 <<
"# This file was generated by the deal.II library." <<
'\n'
4845 <<
"# For a description of the Tecplot format see the Tecplot documentation."
4850 out <<
"Variables=";
4858 out <<
"\"x\", \"y\"";
4861 out <<
"\"x\", \"y\", \"z\"";
4867 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4868 out <<
", \"" << data_names[data_set] <<
"\"";
4874 out <<
"t=\"" << flags.
zone_name <<
"\" ";
4877 out <<
"strandid=1, solutiontime=" << flags.
solution_time <<
", ";
4879 out <<
"f=feblock, n=" << n_nodes <<
", e=" <<
n_cells
4880 <<
", et=" << tecplot_cell_type[dim] <<
'\n';
4897 [&patches]() {
return create_global_data_table(patches); });
4903 for (
unsigned int d = 0;
d < spacedim; ++
d)
4905 tecplot_out.selected_component =
d;
4916 std::move(*create_global_data_table_task.
return_value());
4919 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4922 data_vectors[data_set].
end(),
4923 std::ostream_iterator<double>(out,
"\n"));
4941 #ifdef DEAL_II_HAVE_TECPLOT
4948 TecplotMacros(
const unsigned int n_nodes = 0,
4949 const unsigned int n_vars = 0,
4950 const unsigned int n_cells = 0,
4951 const unsigned int n_vert = 0);
4954 nd(
const unsigned int i,
const unsigned int j);
4956 cd(
const unsigned int i,
const unsigned int j);
4957 std::vector<float> nodalData;
4958 std::vector<int> connData;
4961 unsigned int n_nodes;
4962 unsigned int n_vars;
4964 unsigned int n_vert;
4968 inline TecplotMacros::TecplotMacros(
const unsigned int n_nodes,
4969 const unsigned int n_vars,
4971 const unsigned int n_vert)
4977 nodalData.resize(n_nodes * n_vars);
4978 connData.resize(
n_cells * n_vert);
4983 inline TecplotMacros::~TecplotMacros()
4989 TecplotMacros::nd(
const unsigned int i,
const unsigned int j)
4991 return nodalData[i * n_nodes + j];
4997 TecplotMacros::cd(
const unsigned int i,
const unsigned int j)
4999 return connData[i + j * n_vert];
5010 template <
int dim,
int spacedim>
5014 const std::vector<std::string> & data_names,
5016 std::tuple<
unsigned int,
5020 & nonscalar_data_ranges,
5029 #ifndef DEAL_II_HAVE_TECPLOT
5032 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5040 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5047 char *file_name = (
char *)flags.tecplot_binary_file_name;
5049 if (file_name ==
nullptr)
5054 ExcMessage(
"Specify the name of the tecplot_binary"
5055 " file through the TecplotFlags interface."));
5056 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5063 # ifndef DEAL_II_WITH_MPI
5072 if (patches.size() == 0)
5076 const unsigned int n_data_sets = data_names.size();
5079 Assert((patches[0].data.n_rows() == n_data_sets &&
5080 !patches[0].points_are_available) ||
5081 (patches[0].data.n_rows() == n_data_sets + spacedim &&
5082 patches[0].points_are_available),
5084 (n_data_sets + spacedim) :
5086 patches[0].data.n_rows()));
5089 unsigned int n_nodes;
5091 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
5093 const unsigned int vars_per_node = (spacedim + n_data_sets),
5096 TecplotMacros tm(n_nodes, vars_per_node,
n_cells, nodes_per_cell);
5098 int is_double = 0, tec_debug = 0, cell_type = tecplot_binary_cell_type[dim];
5100 std::string tec_var_names;
5104 tec_var_names =
"x y";
5107 tec_var_names =
"x y z";
5113 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5115 tec_var_names +=
" ";
5116 tec_var_names += data_names[data_set];
5132 [&patches]() {
return create_global_data_table(patches); });
5136 for (
unsigned int d = 1;
d <= spacedim; ++
d)
5138 unsigned int entry = 0;
5140 for (
const auto &patch : patches)
5148 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5149 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5151 const double x_frac = i * 1. / n_subdivisions,
5152 y_frac = j * 1. / n_subdivisions;
5154 tm.nd((
d - 1), entry) =
static_cast<float>(
5156 (patch.
vertices[0](
d - 1) * (1 - x_frac))) *
5159 (patch.
vertices[2](
d - 1) * (1 - x_frac))) *
5168 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5169 for (
unsigned int k = 0; k < n_subdivisions + 1; ++k)
5170 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5172 const double x_frac = i * 1. / n_subdivisions,
5173 y_frac = k * 1. / n_subdivisions,
5174 z_frac = j * 1. / n_subdivisions;
5177 tm.nd((
d - 1), entry) =
static_cast<float>(
5178 ((((patch.
vertices[1](
d - 1) * x_frac) +
5179 (patch.
vertices[0](
d - 1) * (1 - x_frac))) *
5182 (patch.
vertices[2](
d - 1) * (1 - x_frac))) *
5186 (patch.
vertices[4](
d - 1) * (1 - x_frac))) *
5189 (patch.
vertices[6](
d - 1) * (1 - x_frac))) *
5207 std::move(*create_global_data_table_task.
return_value());
5210 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5211 for (
unsigned int entry = 0; entry < data_vectors[data_set].size();
5213 tm.nd((spacedim + data_set), entry) =
5214 static_cast<float>(data_vectors[data_set][entry]);
5220 unsigned int first_vertex_of_patch = 0;
5221 unsigned int elem = 0;
5223 for (
const auto &patch : patches)
5226 const unsigned int n = n_subdivisions + 1;
5227 const unsigned int d1 = 1;
5228 const unsigned int d2 = n;
5229 const unsigned int d3 = n * n;
5235 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5236 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5239 first_vertex_of_patch + (i1)*d1 + (i2)*d2 + 1;
5241 first_vertex_of_patch + (i1 + 1) * d1 + (i2)*d2 + 1;
5242 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5245 first_vertex_of_patch + (i1)*d1 + (i2 + 1) * d2 + 1;
5254 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5255 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5256 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5261 tm.cd(0, elem) = first_vertex_of_patch + (i1)*d1 +
5262 (i2)*d2 + (i3)*d3 + 1;
5263 tm.cd(1, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5264 (i2)*d2 + (i3)*d3 + 1;
5265 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5266 (i2 + 1) * d2 + (i3)*d3 + 1;
5267 tm.cd(3, elem) = first_vertex_of_patch + (i1)*d1 +
5268 (i2 + 1) * d2 + (i3)*d3 + 1;
5269 tm.cd(4, elem) = first_vertex_of_patch + (i1)*d1 +
5270 (i2)*d2 + (i3 + 1) * d3 + 1;
5271 tm.cd(5, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5272 (i2)*d2 + (i3 + 1) * d3 + 1;
5273 tm.cd(6, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5274 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5275 tm.cd(7, elem) = first_vertex_of_patch + (i1)*d1 +
5276 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5289 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
5294 int ierr = 0, num_nodes =
static_cast<int>(n_nodes),
5295 num_cells =
static_cast<int>(
n_cells);
5297 char dot[2] = {
'.', 0};
5301 char *var_names =
const_cast<char *
>(tec_var_names.c_str());
5302 ierr = TECINI(
nullptr, var_names, file_name, dot, &tec_debug, &is_double);
5306 char FEBLOCK[] = {
'F',
'E',
'B',
'L',
'O',
'C',
'K', 0};
5308 TECZNE(
nullptr, &num_nodes, &num_cells, &cell_type, FEBLOCK,
nullptr);
5312 int total = (vars_per_node * num_nodes);
5314 ierr = TECDAT(&total, tm.nodalData.data(), &is_double);
5318 ierr = TECNOD(tm.connData.data());
5331 template <
int dim,
int spacedim>
5335 const std::vector<std::string> & data_names,
5337 std::tuple<
unsigned int,
5341 & nonscalar_data_ranges,
5347 #ifndef DEAL_II_WITH_MPI
5356 if (patches.size() == 0)
5360 VtkStream vtk_out(out, flags);
5362 const unsigned int n_data_sets = data_names.size();
5364 if (patches[0].points_are_available)
5376 out <<
"# vtk DataFile Version 3.0" <<
'\n'
5377 <<
"#This file was generated by the deal.II library";
5385 out <<
'\n' <<
"ASCII" <<
'\n';
5387 out <<
"DATASET UNSTRUCTURED_GRID\n" <<
'\n';
5394 const unsigned int n_metadata =
5399 out <<
"FIELD FieldData " << n_metadata <<
'\n';
5403 out <<
"CYCLE 1 1 int\n" << flags.
cycle <<
'\n';
5407 out <<
"TIME 1 1 double\n" << flags.
time <<
'\n';
5413 unsigned int n_nodes;
5415 unsigned int n_points_and_n_cells;
5416 std::tie(n_nodes,
n_cells, n_points_and_n_cells) =
5432 [&patches]() {
return create_global_data_table(patches); });
5438 out <<
"POINTS " << n_nodes <<
" double" <<
'\n';
5443 out <<
"CELLS " <<
n_cells <<
' ' << n_points_and_n_cells <<
'\n';
5451 out <<
"CELL_TYPES " <<
n_cells <<
'\n';
5455 for (
const auto &patch : patches)
5457 const auto vtk_cell_id =
5460 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
5461 out <<
' ' << vtk_cell_id[0];
5470 std::move(*create_global_data_table_task.
return_value());
5475 out <<
"POINT_DATA " << n_nodes <<
'\n';
5479 std::vector<bool> data_set_written(n_data_sets,
false);
5480 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5485 "The VTK writer does not currently support outputting "
5486 "tensor data. Use the VTU writer instead."));
5489 std::get<0>(nonscalar_data_range),
5491 std::get<0>(nonscalar_data_range)));
5492 AssertThrow(std::get<1>(nonscalar_data_range) < n_data_sets,
5496 AssertThrow(std::get<1>(nonscalar_data_range) + 1 -
5497 std::get<0>(nonscalar_data_range) <=
5500 "Can't declare a vector with more than 3 components "
5504 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5505 i <= std::get<1>(nonscalar_data_range);
5507 data_set_written[i] =
true;
5513 if (!std::get<2>(nonscalar_data_range).empty())
5514 out << std::get<2>(nonscalar_data_range);
5517 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5518 i < std::get<1>(nonscalar_data_range);
5520 out << data_names[i] <<
"__";
5521 out << data_names[std::get<1>(nonscalar_data_range)];
5524 out <<
" double" <<
'\n';
5527 for (
unsigned int n = 0; n < n_nodes; ++n)
5529 switch (std::get<1>(nonscalar_data_range) -
5530 std::get<0>(nonscalar_data_range))
5533 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5538 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5540 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5544 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5546 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5548 << data_vectors(std::get<0>(nonscalar_data_range) + 2, n)
5561 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5562 if (data_set_written[data_set] ==
false)
5564 out <<
"SCALARS " << data_names[data_set] <<
" double 1" <<
'\n'
5565 <<
"LOOKUP_TABLE default" <<
'\n';
5567 data_vectors[data_set].
end(),
5568 std::ostream_iterator<double>(out,
" "));
5584 out <<
"<?xml version=\"1.0\" ?> \n";
5586 out <<
"# vtk DataFile Version 3.0" <<
'\n'
5587 <<
"#This file was generated by the deal.II library";
5598 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"2.2\"";
5600 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"";
5601 if (deal_ii_with_zlib &&
5603 out <<
" compressor=\"vtkZLibDataCompressor\"";
5604 #ifdef DEAL_II_WORDS_BIGENDIAN
5605 out <<
" byte_order=\"BigEndian\"";
5607 out <<
" byte_order=\"LittleEndian\"";
5611 out <<
"<UnstructuredGrid>";
5621 out <<
" </UnstructuredGrid>\n";
5622 out <<
"</VTKFile>\n";
5627 template <
int dim,
int spacedim>
5631 const std::vector<std::string> & data_names,
5633 std::tuple<
unsigned int,
5637 & nonscalar_data_ranges,
5642 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5649 template <
int dim,
int spacedim>
5653 const std::vector<std::string> & data_names,
5655 std::tuple<
unsigned int,
5659 & nonscalar_data_ranges,
5673 unit.second.find(
'\"') == std::string::npos,
5675 "A physical unit you provided, <" + unit.second +
5676 ">, contained a quotation mark character. This is not allowed."));
5679 #ifndef DEAL_II_WITH_MPI
5688 if (patches.size() == 0)
5693 out <<
"<Piece NumberOfPoints=\"0\" NumberOfCells=\"0\" >\n"
5695 <<
"<DataArray type=\"UInt8\" Name=\"types\"></DataArray>\n"
5697 <<
" <PointData Scalars=\"scalars\">\n";
5698 std::vector<bool> data_set_written(data_names.size(),
false);
5699 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5702 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5703 i <= std::get<1>(nonscalar_data_range);
5705 data_set_written[i] =
true;
5709 out <<
" <DataArray type=\"Float32\" Name=\"";
5711 if (!std::get<2>(nonscalar_data_range).empty())
5712 out << std::get<2>(nonscalar_data_range);
5715 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5716 i < std::get<1>(nonscalar_data_range);
5718 out << data_names[i] <<
"__";
5719 out << data_names[std::get<1>(nonscalar_data_range)];
5722 out <<
"\" NumberOfComponents=\"3\"></DataArray>\n";
5725 for (
unsigned int data_set = 0; data_set < data_names.size();
5727 if (data_set_written[data_set] ==
false)
5729 out <<
" <DataArray type=\"Float32\" Name=\""
5730 << data_names[data_set] <<
"\"></DataArray>\n";
5733 out <<
" </PointData>\n";
5734 out <<
"</Piece>\n";
5748 const unsigned int n_metadata =
5752 out <<
"<FieldData>\n";
5757 <<
"<DataArray type=\"Float32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
5758 << flags.
cycle <<
"</DataArray>\n";
5763 <<
"<DataArray type=\"Float32\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
5764 << flags.
time <<
"</DataArray>\n";
5768 out <<
"</FieldData>\n";
5772 const unsigned int n_data_sets = data_names.size();
5775 if (patches[0].points_are_available)
5784 const char *ascii_or_binary =
5785 (deal_ii_with_zlib &&
5792 unsigned int n_nodes;
5794 std::tie(n_nodes,
n_cells, std::ignore) =
5802 const auto stringize_vertex_information = [&patches,
5806 ascii_or_binary]() {
5807 std::ostringstream o;
5809 o <<
" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\""
5810 << ascii_or_binary <<
"\">\n";
5811 const std::vector<Point<spacedim>> node_positions =
5816 std::vector<float> node_coordinates_3d;
5817 node_coordinates_3d.reserve(node_positions.size() * 3);
5818 for (
const auto &node_position : node_positions)
5820 for (
unsigned int d = 0;
d < 3; ++
d)
5822 node_coordinates_3d.emplace_back(node_position[
d]);
5824 node_coordinates_3d.emplace_back(0.0f);
5826 o << vtu_stringize_array(node_coordinates_3d,
5830 o <<
" </DataArray>\n";
5831 o <<
" </Points>\n\n";
5840 const auto stringize_cell_to_vertex_information = [&patches,
5844 out.precision()]() {
5845 std::ostringstream o;
5848 o <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\""
5849 << ascii_or_binary <<
"\">\n";
5851 std::vector<int32_t> cells;
5854 unsigned int first_vertex_of_patch = 0;
5856 for (
const auto &patch : patches)
5868 const unsigned int n_points = patch.
data.n_cols();
5869 Assert((dim == 2 && n_points == 6) ||
5870 (dim == 3 && n_points == 10),
5873 if (deal_ii_with_zlib &&
5877 for (
unsigned int i = 0; i < n_points; ++i)
5878 cells.push_back(first_vertex_of_patch + i);
5882 for (
unsigned int i = 0; i < n_points; ++i)
5883 o <<
'\t' << first_vertex_of_patch + i;
5887 first_vertex_of_patch += n_points;
5892 else if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
5896 const unsigned int n_points = patch.
data.n_cols();
5898 if (deal_ii_with_zlib &&
5902 for (
unsigned int i = 0; i < n_points; ++i)
5904 first_vertex_of_patch +
5909 for (
unsigned int i = 0; i < n_points; ++i)
5911 << (first_vertex_of_patch +
5916 first_vertex_of_patch += n_points;
5921 const unsigned int n_points_per_direction = n_subdivisions + 1;
5923 std::vector<unsigned> local_vertex_order;
5927 const auto flush_current_cell = [&flags,
5930 first_vertex_of_patch,
5931 &local_vertex_order]() {
5932 if (deal_ii_with_zlib &&
5936 for (
const auto &c : local_vertex_order)
5937 cells.push_back(first_vertex_of_patch + c);
5941 for (
const auto &c : local_vertex_order)
5942 o <<
'\t' << first_vertex_of_patch + c;
5946 local_vertex_order.clear();
5951 local_vertex_order.reserve(Utilities::fixed_power<dim>(2));
5957 local_vertex_order.emplace_back(0);
5958 flush_current_cell();
5964 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5966 const unsigned int starting_offset = i1;
5967 local_vertex_order.emplace_back(starting_offset);
5968 local_vertex_order.emplace_back(starting_offset +
5970 flush_current_cell();
5977 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5978 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5980 const unsigned int starting_offset =
5981 i2 * n_points_per_direction + i1;
5982 local_vertex_order.emplace_back(
5984 local_vertex_order.emplace_back(
5985 starting_offset + 1);
5986 local_vertex_order.emplace_back(
5987 starting_offset + n_points_per_direction + 1);
5988 local_vertex_order.emplace_back(
5989 starting_offset + n_points_per_direction);
5990 flush_current_cell();
5997 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5998 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5999 for (
unsigned int i1 = 0; i1 < n_subdivisions;
6002 const unsigned int starting_offset =
6003 i3 * n_points_per_direction *
6004 n_points_per_direction +
6005 i2 * n_points_per_direction + i1;
6006 local_vertex_order.emplace_back(
6008 local_vertex_order.emplace_back(
6009 starting_offset + 1);
6010 local_vertex_order.emplace_back(
6011 starting_offset + n_points_per_direction +
6013 local_vertex_order.emplace_back(
6014 starting_offset + n_points_per_direction);
6015 local_vertex_order.emplace_back(
6016 starting_offset + n_points_per_direction *
6017 n_points_per_direction);
6018 local_vertex_order.emplace_back(
6020 n_points_per_direction *
6021 n_points_per_direction +
6023 local_vertex_order.emplace_back(
6025 n_points_per_direction *
6026 n_points_per_direction +
6027 n_points_per_direction + 1);
6028 local_vertex_order.emplace_back(
6030 n_points_per_direction *
6031 n_points_per_direction +
6032 n_points_per_direction);
6033 flush_current_cell();
6044 local_vertex_order.resize(
6045 Utilities::fixed_power<dim>(n_points_per_direction));
6053 "Point-like cells should not be possible "
6054 "when writing higher-order cells."));
6059 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
6062 const unsigned int local_index = i1;
6063 const unsigned int connectivity_index =
6065 .template vtk_lexicographic_to_node_index<1>(
6069 local_vertex_order[connectivity_index] =
6071 flush_current_cell();
6078 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1;
6080 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
6083 const unsigned int local_index =
6084 i2 * n_points_per_direction + i1;
6085 const unsigned int connectivity_index =
6087 .template vtk_lexicographic_to_node_index<
6089 {{n_subdivisions, n_subdivisions}},
6091 local_vertex_order[connectivity_index] =
6094 flush_current_cell();
6100 for (
unsigned int i3 = 0; i3 < n_subdivisions + 1;
6102 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1;
6104 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1;
6107 const unsigned int local_index =
6108 i3 * n_points_per_direction *
6109 n_points_per_direction +
6110 i2 * n_points_per_direction + i1;
6111 const unsigned int connectivity_index =
6113 .template vtk_lexicographic_to_node_index<
6119 local_vertex_order[connectivity_index] =
6123 flush_current_cell();
6133 first_vertex_of_patch +=
6142 o << vtu_stringize_array(cells,
6147 o <<
" </DataArray>\n";
6167 const auto stringize_cell_offset_and_type_information =
6172 output_precision = out.precision()]() {
6173 std::ostringstream o;
6175 o <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\""
6176 << ascii_or_binary <<
"\">\n";
6178 std::vector<int32_t> offsets;
6183 std::vector<unsigned int> cell_types;
6186 unsigned int first_vertex_of_patch = 0;
6188 for (
const auto &patch : patches)
6190 const auto vtk_cell_id =
6193 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
6195 cell_types.push_back(vtk_cell_id[0]);
6196 first_vertex_of_patch += vtk_cell_id[2];
6197 offsets.push_back(first_vertex_of_patch);
6201 o << vtu_stringize_array(offsets,
6205 o <<
" </DataArray>\n";
6207 o <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\""
6208 << ascii_or_binary <<
"\">\n";
6210 if (deal_ii_with_zlib &&
6213 std::vector<uint8_t> cell_types_uint8_t(cell_types.size());
6214 for (
unsigned int i = 0; i < cell_types.size(); ++i)
6215 cell_types_uint8_t[i] =
static_cast<std::uint8_t
>(cell_types[i]);
6217 o << vtu_stringize_array(cell_types_uint8_t,
6223 o << vtu_stringize_array(cell_types,
6229 o <<
" </DataArray>\n";
6239 const auto stringize_nonscalar_data_range =
6245 output_precision = out.precision()](
const Table<2, float> &data_vectors,
6246 const auto & range) {
6247 std::ostringstream o;
6249 const auto first_component = std::get<0>(range);
6250 const auto last_component = std::get<1>(range);
6251 const auto &name = std::get<2>(range);
6252 const bool is_tensor =
6253 (std::get<3>(range) ==
6255 const unsigned int n_components = (is_tensor ? 9 : 3);
6262 AssertThrow((last_component + 1 - first_component <= 9),
6264 "Can't declare a tensor with more than 9 components "
6265 "in VTK/VTU format."));
6269 AssertThrow((last_component + 1 - first_component <= 3),
6271 "Can't declare a vector with more than 3 components "
6272 "in VTK/VTU format."));
6277 o <<
" <DataArray type=\"Float32\" Name=\"";
6283 for (
unsigned int i = first_component; i < last_component; ++i)
6284 o << data_names[i] <<
"__";
6285 o << data_names[last_component];
6288 o <<
"\" NumberOfComponents=\"" << n_components <<
"\" format=\""
6289 << ascii_or_binary <<
"\"";
6308 std::vector<float> data;
6309 data.reserve(n_nodes * n_components);
6311 for (
unsigned int n = 0; n < n_nodes; ++n)
6315 switch (last_component - first_component)
6318 data.push_back(data_vectors(first_component, n));
6324 data.push_back(data_vectors(first_component, n));
6325 data.push_back(data_vectors(first_component + 1, n));
6330 data.push_back(data_vectors(first_component, n));
6331 data.push_back(data_vectors(first_component + 1, n));
6332 data.push_back(data_vectors(first_component + 2, n));
6345 const unsigned int size = last_component - first_component + 1;
6349 vtk_data[0][0] = data_vectors(first_component, n);
<