40 #ifdef DEAL_II_WITH_ZLIB
44 #ifdef DEAL_II_WITH_HDF5
49 #include <boost/iostreams/copy.hpp>
50 #include <boost/iostreams/device/back_inserter.hpp>
51 #include <boost/iostreams/filtering_stream.hpp>
52 #ifdef DEAL_II_WITH_ZLIB
53 # include <boost/iostreams/filter/zlib.hpp>
68 <<
"Unexpected input: expected line\n <" << arg1
69 <<
">\nbut got\n <" << arg2 <<
">");
75 #ifdef DEAL_II_WITH_ZLIB
76 constexpr
bool deal_ii_with_zlib =
true;
78 constexpr
bool deal_ii_with_zlib =
false;
82 #ifdef DEAL_II_WITH_ZLIB
93 return Z_NO_COMPRESSION;
97 return Z_BEST_COMPRESSION;
99 return Z_DEFAULT_COMPRESSION;
102 return Z_NO_COMPRESSION;
106 # ifdef DEAL_II_WITH_MPI
117 return boost::iostreams::zlib::no_compression;
119 return boost::iostreams::zlib::best_speed;
121 return boost::iostreams::zlib::best_compression;
123 return boost::iostreams::zlib::default_compression;
126 return boost::iostreams::zlib::no_compression;
136 template <
typename T>
138 compress_array(
const std::vector<T> & data,
141 #ifdef DEAL_II_WITH_ZLIB
142 if (data.size() != 0)
144 const std::size_t uncompressed_size = (data.size() *
sizeof(
T));
156 auto compressed_data_length = compressBound(uncompressed_size);
161 std::vector<unsigned char> compressed_data(compressed_data_length);
163 int err = compress2(&compressed_data[0],
164 &compressed_data_length,
165 reinterpret_cast<const Bytef *
>(data.data()),
167 get_zlib_compression_level(compression_level));
172 compressed_data.resize(compressed_data_length);
175 const std::uint32_t compression_header[4] = {
177 static_cast<std::uint32_t
>(uncompressed_size),
178 static_cast<std::uint32_t
>(
180 static_cast<std::uint32_t
>(
181 compressed_data_length)};
183 const auto header_start =
184 reinterpret_cast<const unsigned char *
>(&compression_header[0]);
187 {header_start, header_start + 4 *
sizeof(std::uint32_t)}) +
194 (void)compression_level;
196 ExcMessage(
"This function can only be called if cmake found "
197 "a working libz installation."));
212 template <
typename T>
214 vtu_stringize_array(
const std::vector<T> & data,
218 if (deal_ii_with_zlib &&
222 return compress_array(data, compression_level);
226 std::ostringstream stream;
227 stream.precision(precision);
228 for (
const T &el : data)
243 struct ParallelIntermediateHeader
246 std::uint64_t version;
247 std::uint64_t compression;
248 std::uint64_t dimension;
249 std::uint64_t space_dimension;
250 std::uint64_t n_ranks;
251 std::uint64_t n_patches;
359 template <
int dim,
int spacedim,
typename Number =
double>
360 std::unique_ptr<Table<2, Number>>
361 create_global_data_table(
const std::vector<Patch<dim, spacedim>> &patches)
364 if (patches.size() == 0)
365 return std::make_unique<Table<2, Number>>();
374 const unsigned int n_data_sets = patches[0].points_are_available ?
375 (patches[0].data.n_rows() - spacedim) :
376 patches[0].data.n_rows();
377 const unsigned int n_data_points =
378 std::accumulate(patches.begin(),
381 [](
const unsigned int count,
383 return count + patch.data.n_cols();
386 std::unique_ptr<Table<2, Number>> global_data_table =
387 std::make_unique<Table<2, Number>>(n_data_sets, n_data_points);
390 unsigned int next_value = 0;
391 for (
const auto &patch : patches)
393 const unsigned int n_subdivisions = patch.n_subdivisions;
394 (void)n_subdivisions;
396 Assert((patch.data.n_rows() == n_data_sets &&
397 !patch.points_are_available) ||
398 (patch.data.n_rows() == n_data_sets + spacedim &&
399 patch.points_are_available),
401 (n_data_sets + spacedim) :
403 patch.data.n_rows()));
404 Assert(patch.reference_cell != ReferenceCells::get_hypercube<dim>() ||
405 (n_data_sets == 0) ||
406 (patch.data.n_cols() ==
407 Utilities::fixed_power<dim>(n_subdivisions + 1)),
409 n_subdivisions + 1));
411 for (
unsigned int i = 0; i < patch.data.n_cols(); ++i, ++next_value)
412 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
413 (*global_data_table)[data_set][next_value] =
414 patch.data(data_set, i);
418 return global_data_table;
447 for (
unsigned int d = 0;
d < dim; ++
d)
451 unsigned int internal_ind;
462 internal_ind = it->second;
472 const unsigned int pt_index)
491 node_data[
node_dim * existing_point.second +
d] =
492 existing_point.first(
d);
500 std::vector<unsigned int> &cell_data)
const
506 cell_data[filtered_cell.first] =
507 filtered_cell.second + local_node_offset;
576 const unsigned int start,
577 const std::array<unsigned int, dim> &offsets)
581 const unsigned int base_entry =
594 const unsigned int d1 = offsets[0];
603 const unsigned int d1 = offsets[0];
604 const unsigned int d2 = offsets[1];
615 const unsigned int d1 = offsets[0];
616 const unsigned int d2 = offsets[1];
617 const unsigned int d3 = offsets[2];
639 const unsigned int start,
640 const unsigned int n_points,
645 const unsigned int base_entry = index * n_points;
647 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
649 for (
unsigned int i = 0; i < n_points; ++i)
660 const unsigned int dimension,
661 const unsigned int set_num,
664 unsigned int new_dim;
683 for (
unsigned int d = 0;
d < new_dim; ++
d)
686 data_sets.back()[r * new_dim +
d] = data_vectors(set_num +
d, i);
702 const char *gmv_cell_type[4] = {
"",
"line 2",
"quad 4",
"hex 8"};
704 const char *ucd_cell_type[4] = {
"pt",
"line",
"quad",
"hex"};
706 const char *tecplot_cell_type[4] = {
"",
"lineseg",
"quadrilateral",
"brick"};
708 #ifdef DEAL_II_HAVE_TECPLOT
709 const unsigned int tecplot_binary_cell_type[4] = {0, 0, 1, 3};
726 template <
int dim,
int spacedim>
727 std::array<unsigned int, 3>
729 const bool write_higher_order_cells)
731 std::array<unsigned int, 3> vtk_cell_id = {
737 if (write_higher_order_cells)
740 vtk_cell_id[2] = patch.
data.n_cols();
746 patch.
data.n_cols() == 6)
750 vtk_cell_id[2] = patch.
data.n_cols();
753 patch.
data.n_cols() == 10)
757 vtk_cell_id[2] = patch.
data.n_cols();
782 template <
int dim,
int spacedim>
784 get_equispaced_location(
786 const std::initializer_list<unsigned int> &lattice_location,
787 const unsigned int n_subdivisions)
794 const unsigned int xstep = (dim > 0 ? *(lattice_location.begin() + 0) : 0);
795 const unsigned int ystep = (dim > 1 ? *(lattice_location.begin() + 1) : 0);
796 const unsigned int zstep = (dim > 2 ? *(lattice_location.begin() + 2) : 0);
804 unsigned int point_no = 0;
809 point_no += (n_subdivisions + 1) * (n_subdivisions + 1) * zstep;
813 point_no += (n_subdivisions + 1) * ystep;
827 for (
unsigned int d = 0;
d < spacedim; ++
d)
828 node[
d] = patch.
data(patch.
data.size(0) - spacedim +
d, point_no);
840 const double stepsize = 1. / n_subdivisions;
841 const double xfrac = xstep * stepsize;
847 const double yfrac = ystep * stepsize;
849 node += ((patch.
vertices[3] * xfrac) +
850 (patch.
vertices[2] * (1 - xfrac))) *
854 const double zfrac = zstep * stepsize;
856 node += (((patch.
vertices[5] * xfrac) +
857 (patch.
vertices[4] * (1 - xfrac))) *
860 (patch.
vertices[6] * (1 - xfrac))) *
873 template <
int dim,
int spacedim>
876 const unsigned int node_index)
881 unsigned int point_no_actual = node_index;
886 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
887 point_no_actual = table[node_index];
895 for (
unsigned int d = 0;
d < spacedim; ++
d)
897 patch.
data(patch.
data.size(0) - spacedim +
d, point_no_actual);
910 return patch.
vertices[point_no_actual];
921 template <
int dim,
int spacedim>
922 std::tuple<unsigned int, unsigned int>
923 count_nodes_and_cells(
926 unsigned int n_nodes = 0;
928 for (
const auto &patch : patches)
932 "The reference cell for this patch is set to 'Invalid', "
933 "but that is clearly not a valid choice. Did you forget "
934 "to set the reference cell for the patch?"));
949 return std::make_tuple(n_nodes,
n_cells);
959 template <
int dim,
int spacedim>
960 std::tuple<unsigned int, unsigned int, unsigned int>
961 count_nodes_and_cells_and_points(
963 const bool write_higher_order_cells)
965 unsigned int n_nodes = 0;
967 unsigned int n_points_and_n_cells = 0;
969 for (
const auto &patch : patches)
975 if (write_higher_order_cells)
981 n_points_and_n_cells +=
990 const unsigned int n_subcells =
993 n_points_and_n_cells +=
999 n_nodes += patch.
data.n_cols();
1001 n_points_and_n_cells += patch.
data.n_cols() + 1;
1005 return std::make_tuple(n_nodes,
n_cells, n_points_and_n_cells);
1013 template <
typename FlagsType>
1020 StreamBase(std::ostream &stream,
const FlagsType &flags)
1032 write_point(
const unsigned int,
const Point<dim> &)
1035 ExcMessage(
"The derived class you are using needs to "
1036 "reimplement this function if you want to call "
1056 write_cell(
const unsigned int ,
1057 const unsigned int ,
1058 std::array<unsigned int, dim> & )
1061 ExcMessage(
"The derived class you are using needs to "
1062 "reimplement this function if you want to call "
1073 write_cell_single(
const unsigned int index,
1074 const unsigned int start,
1075 const unsigned int n_points,
1084 ExcMessage(
"The derived class you are using needs to "
1085 "reimplement this function if you want to call "
1103 template <
typename T>
1117 unsigned int selected_component;
1124 std::ostream &stream;
1129 const FlagsType flags;
1135 class DXStream :
public StreamBase<DataOutBase::DXFlags>
1142 write_point(
const unsigned int index,
const Point<dim> &);
1154 write_cell(
const unsigned int index,
1155 const unsigned int start,
1156 const std::array<unsigned int, dim> &offsets);
1164 template <
typename data>
1166 write_dataset(
const unsigned int index,
const std::vector<data> &
values);
1172 class GmvStream :
public StreamBase<DataOutBase::GmvFlags>
1179 write_point(
const unsigned int index,
const Point<dim> &);
1191 write_cell(
const unsigned int index,
1192 const unsigned int start,
1193 const std::array<unsigned int, dim> &offsets);
1199 class TecplotStream :
public StreamBase<DataOutBase::TecplotFlags>
1206 write_point(
const unsigned int index,
const Point<dim> &);
1218 write_cell(
const unsigned int index,
1219 const unsigned int start,
1220 const std::array<unsigned int, dim> &offsets);
1226 class UcdStream :
public StreamBase<DataOutBase::UcdFlags>
1233 write_point(
const unsigned int index,
const Point<dim> &);
1247 write_cell(
const unsigned int index,
1248 const unsigned int start,
1249 const std::array<unsigned int, dim> &offsets);
1257 template <
typename data>
1259 write_dataset(
const unsigned int index,
const std::vector<data> &
values);
1265 class VtkStream :
public StreamBase<DataOutBase::VtkFlags>
1272 write_point(
const unsigned int index,
const Point<dim> &);
1284 write_cell(
const unsigned int index,
1285 const unsigned int start,
1286 const std::array<unsigned int, dim> &offsets);
1292 write_cell_single(
const unsigned int index,
1293 const unsigned int start,
1294 const unsigned int n_points,
1306 write_high_order_cell(
const unsigned int start,
1307 const std::vector<unsigned> &connectivity);
1320 DXStream::write_point(
const unsigned int,
const Point<dim> &p)
1322 if (flags.coordinates_binary)
1325 for (
unsigned int d = 0;
d < dim; ++
d)
1327 stream.write(
reinterpret_cast<const char *
>(data), dim *
sizeof(*data));
1331 for (
unsigned int d = 0;
d < dim; ++
d)
1332 stream << p(
d) <<
'\t';
1346 std::array<unsigned int, GeometryInfo<0>::vertices_per_cell>
1347 set_node_numbers(
const unsigned int ,
1348 const std::array<unsigned int, 0> & )
1356 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell>
1357 set_node_numbers(
const unsigned int start,
1358 const std::array<unsigned int, 1> &offsets)
1360 std::array<unsigned int, GeometryInfo<1>::vertices_per_cell> nodes;
1362 nodes[1] = start + offsets[0];
1368 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell>
1369 set_node_numbers(
const unsigned int start,
1370 const std::array<unsigned int, 2> &offsets)
1373 const unsigned int d1 = offsets[0];
1374 const unsigned int d2 = offsets[1];
1376 std::array<unsigned int, GeometryInfo<2>::vertices_per_cell> nodes;
1378 nodes[1] = start + d1;
1379 nodes[2] = start + d2;
1380 nodes[3] = start + d2 + d1;
1386 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell>
1387 set_node_numbers(
const unsigned int start,
1388 const std::array<unsigned int, 3> &offsets)
1390 const unsigned int d1 = offsets[0];
1391 const unsigned int d2 = offsets[1];
1392 const unsigned int d3 = offsets[2];
1394 std::array<unsigned int, GeometryInfo<3>::vertices_per_cell> nodes;
1396 nodes[1] = start + d1;
1397 nodes[2] = start + d2;
1398 nodes[3] = start + d2 + d1;
1399 nodes[4] = start + d3;
1400 nodes[5] = start + d3 + d1;
1401 nodes[6] = start + d3 + d2;
1402 nodes[7] = start + d3 + d2 + d1;
1411 DXStream::write_cell(
const unsigned int,
1412 const unsigned int start,
1413 const std::array<unsigned int, dim> &offsets)
1416 DataOutBaseImplementation::set_node_numbers(start, offsets);
1418 if (flags.int_binary)
1420 std::array<unsigned int, GeometryInfo<dim>::vertices_per_cell> temp;
1421 for (
unsigned int i = 0; i < nodes.size(); ++i)
1423 stream.write(
reinterpret_cast<const char *
>(temp.data()),
1424 temp.size() *
sizeof(temp[0]));
1428 for (
unsigned int i = 0; i < nodes.size() - 1; ++i)
1430 stream << nodes[GeometryInfo<dim>::dx_to_deal[nodes.size() - 1]]
1437 template <
typename data>
1439 DXStream::write_dataset(
const unsigned int,
const std::vector<data> &
values)
1441 if (flags.data_binary)
1443 stream.write(
reinterpret_cast<const char *
>(
values.data()),
1444 values.size() *
sizeof(data));
1448 for (
unsigned int i = 0; i <
values.size(); ++i)
1449 stream <<
'\t' <<
values[i];
1465 GmvStream::write_point(
const unsigned int,
const Point<dim> &p)
1469 stream << p(selected_component) <<
' ';
1476 GmvStream::write_cell(
const unsigned int,
1477 const unsigned int s,
1478 const std::array<unsigned int, dim> &offsets)
1481 const unsigned int start = s + 1;
1482 stream << gmv_cell_type[dim] <<
'\n';
1494 const unsigned int d1 = offsets[0];
1496 stream <<
'\t' << start + d1;
1502 const unsigned int d1 = offsets[0];
1503 const unsigned int d2 = offsets[1];
1505 stream <<
'\t' << start + d1;
1506 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1512 const unsigned int d1 = offsets[0];
1513 const unsigned int d2 = offsets[1];
1514 const unsigned int d3 = offsets[2];
1516 stream <<
'\t' << start + d1;
1517 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1518 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1519 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1531 TecplotStream::TecplotStream(std::ostream & out,
1539 TecplotStream::write_point(
const unsigned int,
const Point<dim> &p)
1543 stream << p(selected_component) <<
'\n';
1550 TecplotStream::write_cell(
const unsigned int,
1551 const unsigned int s,
1552 const std::array<unsigned int, dim> &offsets)
1554 const unsigned int start = s + 1;
1566 const unsigned int d1 = offsets[0];
1568 stream <<
'\t' << start + d1;
1574 const unsigned int d1 = offsets[0];
1575 const unsigned int d2 = offsets[1];
1577 stream <<
'\t' << start + d1;
1578 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1584 const unsigned int d1 = offsets[0];
1585 const unsigned int d2 = offsets[1];
1586 const unsigned int d3 = offsets[2];
1588 stream <<
'\t' << start + d1;
1589 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1590 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1591 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1610 UcdStream::write_point(
const unsigned int index,
const Point<dim> &p)
1612 stream <<
index + 1 <<
" ";
1614 for (
unsigned int i = 0; i < dim; ++i)
1615 stream << p(i) <<
' ';
1617 for (
unsigned int i = dim; i < 3; ++i)
1626 UcdStream::write_cell(
const unsigned int index,
1627 const unsigned int start,
1628 const std::array<unsigned int, dim> &offsets)
1631 DataOutBaseImplementation::set_node_numbers(start, offsets);
1634 stream <<
index + 1 <<
"\t0 " << ucd_cell_type[dim];
1635 for (
unsigned int i = 0; i < nodes.size(); ++i)
1642 template <
typename data>
1644 UcdStream::write_dataset(
const unsigned int index,
1645 const std::vector<data> &
values)
1647 stream <<
index + 1;
1648 for (
unsigned int i = 0; i <
values.size(); ++i)
1649 stream <<
'\t' <<
values[i];
1664 VtkStream::write_point(
const unsigned int,
const Point<dim> &p)
1669 for (
unsigned int i = dim; i < 3; ++i)
1678 VtkStream::write_cell(
const unsigned int,
1679 const unsigned int start,
1680 const std::array<unsigned int, dim> &offsets)
1682 stream << GeometryInfo<dim>::vertices_per_cell <<
'\t';
1694 const unsigned int d1 = offsets[0];
1696 stream <<
'\t' << start + d1;
1702 const unsigned int d1 = offsets[0];
1703 const unsigned int d2 = offsets[1];
1705 stream <<
'\t' << start + d1;
1706 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1712 const unsigned int d1 = offsets[0];
1713 const unsigned int d2 = offsets[1];
1714 const unsigned int d3 = offsets[2];
1716 stream <<
'\t' << start + d1;
1717 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1718 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t'
1719 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1732 VtkStream::write_cell_single(
const unsigned int index,
1733 const unsigned int start,
1734 const unsigned int n_points,
1739 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
1741 stream <<
'\t' << n_points;
1742 for (
unsigned int i = 0; i < n_points; ++i)
1751 VtkStream::write_high_order_cell(
const unsigned int start,
1752 const std::vector<unsigned> &connectivity)
1754 stream << connectivity.size();
1755 for (
const auto &c : connectivity)
1756 stream <<
'\t' << start + c;
1768 template <
int dim,
int spacedim>
1772 template <
int dim,
int spacedim>
1776 template <
int dim,
int spacedim>
1778 : patch_index(no_neighbor)
1780 , points_are_available(false)
1794 template <
int dim,
int spacedim>
1820 if (data.n_rows() != patch.
data.n_rows())
1823 if (data.n_cols() != patch.
data.n_cols())
1826 for (
unsigned int i = 0; i < data.n_rows(); ++i)
1827 for (
unsigned int j = 0; j < data.n_cols(); ++j)
1828 if (data[i][j] != patch.
data[i][j])
1836 template <
int dim,
int spacedim>
1842 sizeof(neighbors) /
sizeof(neighbors[0]) *
1853 template <
int dim,
int spacedim>
1861 data.swap(other_patch.
data);
1868 template <
int spacedim>
1872 template <
int spacedim>
1876 template <
int spacedim>
1880 template <
int spacedim>
1883 template <
int spacedim>
1887 template <
int spacedim>
1889 : patch_index(no_neighbor)
1890 , points_are_available(false)
1897 template <
int spacedim>
1901 const unsigned int dim = 0;
1915 if (
data.n_rows() != patch.
data.n_rows())
1918 if (
data.n_cols() != patch.
data.n_cols())
1921 for (
unsigned int i = 0; i <
data.n_rows(); ++i)
1922 for (
unsigned int j = 0; j <
data.n_cols(); ++j)
1923 if (
data[i][j] != patch.
data[i][j])
1931 template <
int spacedim>
1943 template <
int spacedim>
1956 : write_preamble(write_preamble)
1971 : space_dimension_labels(labels)
1985 const bool bicubic_patch,
1986 const bool external_data)
1988 , bicubic_patch(bicubic_patch)
1989 , external_data(external_data)
1994 const bool xdmf_hdf5_output)
1995 : filter_duplicate_vertices(filter_duplicate_vertices)
1996 , xdmf_hdf5_output(xdmf_hdf5_output)
2004 "Filter duplicate vertices",
2007 "Whether to remove duplicate vertex values. deal.II duplicates "
2008 "vertices once for each adjacent cell so that it can output "
2009 "discontinuous quantities for which there may be more than one "
2010 "value for each vertex position. Setting this flag to "
2011 "'true' will merge all of these values by selecting a "
2012 "random one and outputting this as 'the' value for the vertex. "
2013 "As long as the data to be output corresponds to continuous "
2014 "fields, merging vertices has no effect. On the other hand, "
2015 "if the data to be output corresponds to discontinuous fields "
2016 "(either because you are using a discontinuous finite element, "
2017 "or because you are using a DataPostprocessor that yields "
2018 "discontinuous data, or because the data to be output has been "
2019 "produced by entirely different means), then the data in the "
2020 "output file no longer faithfully represents the underlying data "
2021 "because the discontinuous field has been replaced by a "
2022 "continuous one. Note also that the filtering can not occur "
2023 "on processor boundaries. Thus, a filtered discontinuous field "
2024 "looks like a continuous field inside of a subdomain, "
2025 "but like a discontinuous field at the subdomain boundary."
2027 "In any case, filtering results in drastically smaller output "
2028 "files (smaller by about a factor of 2^dim).");
2033 "Whether the data will be used in an XDMF/HDF5 combination.");
2048 const bool int_binary,
2049 const bool coordinates_binary,
2050 const bool data_binary)
2051 : write_neighbors(write_neighbors)
2052 , int_binary(int_binary)
2053 , coordinates_binary(coordinates_binary)
2054 , data_binary(data_binary)
2055 , data_double(false)
2065 "A boolean field indicating whether neighborship "
2066 "information between cells is to be written to the "
2067 "OpenDX output file");
2071 "Output format of integer numbers, which is "
2072 "either a text representation (ascii) or binary integer "
2073 "values of 32 or 64 bits length");
2077 "Output format of vertex coordinates, which is "
2078 "either a text representation (ascii) or binary "
2079 "floating point values of 32 or 64 bits length");
2083 "Output format of data values, which is "
2084 "either a text representation (ascii) or binary "
2085 "floating point values of 32 or 64 bits length");
2105 "A flag indicating whether a comment should be "
2106 "written to the beginning of the output file "
2107 "indicating date and time of creation as well "
2108 "as the creating program");
2122 const int azimuth_angle,
2123 const int polar_angle,
2124 const unsigned int line_thickness,
2126 const bool draw_colorbar)
2129 , height_vector(height_vector)
2130 , azimuth_angle(azimuth_angle)
2131 , polar_angle(polar_angle)
2132 , line_thickness(line_thickness)
2134 , draw_colorbar(draw_colorbar)
2145 "A flag indicating whether POVRAY should use smoothed "
2146 "triangles instead of the usual ones");
2150 "Whether POVRAY should use bicubic patches");
2154 "Whether camera and lighting information should "
2155 "be put into an external file \"data.inc\" or into "
2156 "the POVRAY input file");
2172 const unsigned int color_vector,
2174 const unsigned int size,
2175 const double line_width,
2176 const double azimut_angle,
2177 const double turn_angle,
2178 const double z_scaling,
2179 const bool draw_mesh,
2180 const bool draw_cells,
2181 const bool shade_cells,
2183 : height_vector(height_vector)
2184 , color_vector(color_vector)
2187 , line_width(line_width)
2188 , azimut_angle(azimut_angle)
2189 , turn_angle(turn_angle)
2190 , z_scaling(z_scaling)
2191 , draw_mesh(draw_mesh)
2192 , draw_cells(draw_cells)
2193 , shade_cells(shade_cells)
2194 , color_function(color_function)
2233 double sum = xmax + xmin;
2234 double sum13 = xmin + 3 * xmax;
2235 double sum22 = 2 * xmin + 2 * xmax;
2236 double sum31 = 3 * xmin + xmax;
2237 double dif = xmax - xmin;
2238 double rezdif = 1.0 / dif;
2242 if (x < (sum31) / 4)
2244 else if (x < (sum22) / 4)
2246 else if (x < (sum13) / 4)
2257 rgb_values.
green = 0;
2258 rgb_values.
blue = (x - xmin) * 4. * rezdif;
2262 rgb_values.
green = (4 * x - 3 * xmin - xmax) * rezdif;
2263 rgb_values.
blue = (sum22 - 4. * x) * rezdif;
2266 rgb_values.
red = (4 * x - 2 *
sum) * rezdif;
2267 rgb_values.
green = (xmin + 3 * xmax - 4 * x) * rezdif;
2268 rgb_values.
blue = 0;
2272 rgb_values.
green = (4 * x - xmin - 3 * xmax) * rezdif;
2273 rgb_values.
blue = (4. * x - sum13) * rezdif;
2280 rgb_values.
red = rgb_values.
green = rgb_values.
blue = 1;
2294 (x - xmin) / (xmax - xmin);
2307 1 - (x - xmin) / (xmax - xmin);
2319 "Number of the input vector that is to be used to "
2320 "generate height information");
2324 "Number of the input vector that is to be used to "
2325 "generate color information");
2329 "Whether width or height should be scaled to match "
2334 "The size (width or height) to which the eps output "
2335 "file is to be scaled");
2339 "The width in which the postscript renderer is to "
2344 "Angle of the viewing position against the vertical "
2349 "Angle of the viewing direction against the y-axis");
2353 "Scaling for the z-direction relative to the scaling "
2354 "used in x- and y-directions");
2358 "Whether the mesh lines, or only the surface should be "
2363 "Whether only the mesh lines, or also the interior of "
2364 "cells should be plotted. If this flag is false, then "
2365 "one can see through the mesh");
2369 "Whether the interior of cells shall be shaded");
2373 "default|grey scale|reverse grey scale"),
2374 "Name of a color function used to colorize mesh lines "
2375 "and/or cell interiors");
2385 if (prm.
get(
"Scale to width or height") ==
"width")
2397 if (prm.
get(
"Color function") ==
"default")
2399 else if (prm.
get(
"Color function") ==
"grey scale")
2401 else if (prm.
get(
"Color function") ==
"reverse grey scale")
2412 : zone_name(zone_name)
2413 , solution_time(solution_time)
2427 const unsigned int cycle,
2428 const bool print_date_and_time,
2430 const bool write_higher_order_cells,
2431 const std::map<std::string, std::string> &physical_units)
2434 , print_date_and_time(print_date_and_time)
2435 , compression_level(compression_level)
2436 , write_higher_order_cells(write_higher_order_cells)
2437 , physical_units(physical_units)
2445 if (format_name ==
"none")
2448 if (format_name ==
"dx")
2451 if (format_name ==
"ucd")
2454 if (format_name ==
"gnuplot")
2457 if (format_name ==
"povray")
2460 if (format_name ==
"eps")
2463 if (format_name ==
"gmv")
2466 if (format_name ==
"tecplot")
2469 if (format_name ==
"tecplot_binary")
2472 if (format_name ==
"vtk")
2475 if (format_name ==
"vtu")
2478 if (format_name ==
"deal.II intermediate")
2481 if (format_name ==
"hdf5")
2485 ExcMessage(
"The given file format name is not recognized: <" +
2486 format_name +
">"));
2497 return "none|dx|ucd|gnuplot|povray|eps|gmv|tecplot|tecplot_binary|vtk|vtu|hdf5|svg|deal.II intermediate";
2505 switch (output_format)
2549 template <
int dim,
int spacedim>
2550 std::vector<Point<spacedim>>
2554 static const std::array<unsigned int, 5> table = {{0, 1, 3, 2, 4}};
2556 std::vector<Point<spacedim>> node_positions;
2557 for (
const auto &patch : patches)
2560 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2562 for (
unsigned int point_no = 0; point_no < patch.
data.n_cols();
2564 node_positions.emplace_back(get_node_location(
2573 const unsigned int n = n_subdivisions + 1;
2578 node_positions.emplace_back(
2579 get_equispaced_location(patch, {}, n_subdivisions));
2582 for (
unsigned int i1 = 0; i1 < n; ++i1)
2583 node_positions.emplace_back(
2584 get_equispaced_location(patch, {i1}, n_subdivisions));
2587 for (
unsigned int i2 = 0; i2 < n; ++i2)
2588 for (
unsigned int i1 = 0; i1 < n; ++i1)
2589 node_positions.emplace_back(get_equispaced_location(
2590 patch, {i1, i2}, n_subdivisions));
2593 for (
unsigned int i3 = 0; i3 < n; ++i3)
2594 for (
unsigned int i2 = 0; i2 < n; ++i2)
2595 for (
unsigned int i1 = 0; i1 < n; ++i1)
2596 node_positions.emplace_back(get_equispaced_location(
2597 patch, {i1, i2, i3}, n_subdivisions));
2606 return node_positions;
2610 template <
int dim,
int spacedim,
typename StreamType>
2616 const std::vector<Point<spacedim>> node_positions =
2620 for (
const auto &node : node_positions)
2621 out.write_point(count++, node);
2627 template <
int dim,
int spacedim,
typename StreamType>
2632 unsigned int count = 0;
2633 unsigned int first_vertex_of_patch = 0;
2634 for (
const auto &patch : patches)
2637 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2639 out.write_cell_single(count++,
2640 first_vertex_of_patch,
2641 patch.
data.n_cols(),
2643 first_vertex_of_patch += patch.
data.n_cols();
2648 const unsigned int n = n_subdivisions + 1;
2654 const unsigned int offset = first_vertex_of_patch;
2655 out.template write_cell<0>(count++, offset, {});
2661 constexpr
unsigned int d1 = 1;
2663 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2665 const unsigned int offset =
2666 first_vertex_of_patch + i1 * d1;
2667 out.template write_cell<1>(count++, offset, {{d1}});
2675 constexpr
unsigned int d1 = 1;
2676 const unsigned int d2 = n;
2678 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2679 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2681 const unsigned int offset =
2682 first_vertex_of_patch + i2 * d2 + i1 * d1;
2683 out.template write_cell<2>(count++,
2693 constexpr
unsigned int d1 = 1;
2694 const unsigned int d2 = n;
2695 const unsigned int d3 = n * n;
2697 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
2698 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
2699 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
2701 const unsigned int offset = first_vertex_of_patch +
2704 out.template write_cell<3>(count++,
2716 first_vertex_of_patch +=
2717 Utilities::fixed_power<dim>(n_subdivisions + 1);
2726 template <
int dim,
int spacedim,
typename StreamType>
2730 const bool legacy_format)
2733 unsigned int first_vertex_of_patch = 0;
2735 std::vector<unsigned> connectivity;
2737 for (
const auto &patch : patches)
2739 if (patch.
reference_cell != ReferenceCells::get_hypercube<dim>())
2741 connectivity.resize(patch.
data.n_cols());
2743 for (
unsigned int i = 0; i < patch.
data.n_cols(); ++i)
2744 connectivity[i] = i;
2746 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2749 first_vertex_of_patch += patch.
data.n_cols();
2754 const unsigned int n = n_subdivisions + 1;
2756 connectivity.resize(Utilities::fixed_power<dim>(n));
2763 ExcMessage(
"Point-like cells should not be possible "
2764 "when writing higher-order cells."));
2769 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2771 const unsigned int local_index = i1;
2772 const unsigned int connectivity_index =
2774 .template vtk_lexicographic_to_node_index<1>(
2775 {{i1}}, {{n_subdivisions}}, legacy_format);
2776 connectivity[connectivity_index] = local_index;
2783 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2784 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2786 const unsigned int local_index = i2 * n + i1;
2787 const unsigned int connectivity_index =
2789 .template vtk_lexicographic_to_node_index<2>(
2791 {{n_subdivisions, n_subdivisions}},
2793 connectivity[connectivity_index] = local_index;
2800 for (
unsigned int i3 = 0; i3 < n_subdivisions + 1; ++i3)
2801 for (
unsigned int i2 = 0; i2 < n_subdivisions + 1; ++i2)
2802 for (
unsigned int i1 = 0; i1 < n_subdivisions + 1; ++i1)
2804 const unsigned int local_index =
2805 i3 * n * n + i2 * n + i1;
2806 const unsigned int connectivity_index =
2808 .template vtk_lexicographic_to_node_index<3>(
2814 connectivity[connectivity_index] = local_index;
2825 out.template write_high_order_cell<dim>(first_vertex_of_patch,
2829 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
2837 template <
int dim,
int spacedim,
class StreamType>
2840 unsigned int n_data_sets,
2841 const bool double_precision,
2845 unsigned int count = 0;
2847 for (
const auto &patch : patches)
2850 const unsigned int n = n_subdivisions + 1;
2852 Assert((patch.
data.n_rows() == n_data_sets &&
2854 (patch.
data.n_rows() == n_data_sets + spacedim &&
2857 (n_data_sets + spacedim) :
2860 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
2863 std::vector<float> floats(n_data_sets);
2864 std::vector<double> doubles(n_data_sets);
2867 for (
unsigned int i = 0; i < Utilities::fixed_power<dim>(n);
2869 if (double_precision)
2871 for (
unsigned int data_set = 0; data_set < n_data_sets;
2873 doubles[data_set] = patch.
data(data_set, i);
2874 out.write_dataset(count, doubles);
2878 for (
unsigned int data_set = 0; data_set < n_data_sets;
2880 floats[data_set] = patch.
data(data_set, i);
2881 out.write_dataset(count, floats);
2906 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
2907 camera_horizontal[2] * camera_direction[1];
2908 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
2909 camera_horizontal[0] * camera_direction[2];
2910 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
2911 camera_horizontal[1] * camera_direction[0];
2915 phi /= (
point[0] - camera_position[0]) * camera_direction[0] +
2916 (
point[1] - camera_position[1]) * camera_direction[1] +
2917 (
point[2] - camera_position[2]) * camera_direction[2];
2921 camera_position[0] + phi * (
point[0] - camera_position[0]);
2923 camera_position[1] + phi * (
point[1] - camera_position[1]);
2925 camera_position[2] + phi * (
point[2] - camera_position[2]);
2928 projection_decomposition[0] = (projection[0] - camera_position[0] -
2929 camera_focus * camera_direction[0]) *
2930 camera_horizontal[0];
2931 projection_decomposition[0] += (projection[1] - camera_position[1] -
2932 camera_focus * camera_direction[1]) *
2933 camera_horizontal[1];
2934 projection_decomposition[0] += (projection[2] - camera_position[2] -
2935 camera_focus * camera_direction[2]) *
2936 camera_horizontal[2];
2938 projection_decomposition[1] = (projection[0] - camera_position[0] -
2939 camera_focus * camera_direction[0]) *
2941 projection_decomposition[1] += (projection[1] - camera_position[1] -
2942 camera_focus * camera_direction[1]) *
2944 projection_decomposition[1] += (projection[2] - camera_position[2] -
2945 camera_focus * camera_direction[2]) *
2948 return projection_decomposition;
2957 svg_get_gradient_parameters(
Point<3> points[])
2963 for (
int i = 0; i < 2; ++i)
2965 for (
int j = 0; j < 2 - i; ++j)
2967 if (points[j][2] > points[j + 1][2])
2970 points[j] = points[j + 1];
2971 points[j + 1] = temp;
2978 v_inter = points[1];
2985 A[0][0] = v_max[0] - v_min[0];
2986 A[0][1] = v_inter[0] - v_min[0];
2987 A[1][0] = v_max[1] - v_min[1];
2988 A[1][1] = v_inter[1] - v_min[1];
2994 bool col_change =
false;
3003 double temp =
A[1][0];
3008 for (
unsigned int k = 0; k < 1; ++k)
3010 for (
unsigned int i = k + 1; i < 2; ++i)
3012 x =
A[i][k] /
A[k][k];
3014 for (
unsigned int j = k + 1; j < 2; ++j)
3015 A[i][j] =
A[i][j] -
A[k][j] * x;
3017 b[i] =
b[i] -
b[k] * x;
3021 b[1] =
b[1] /
A[1][1];
3023 for (
int i = 0; i >= 0; i--)
3027 for (
unsigned int j = i + 1; j < 2; ++j)
3030 b[i] =
sum /
A[i][i];
3040 double c =
b[0] * (v_max[2] - v_min[2]) +
b[1] * (v_inter[2] - v_min[2]) +
3044 A[0][0] = v_max[0] - v_min[0];
3045 A[0][1] = v_inter[0] - v_min[0];
3046 A[1][0] = v_max[1] - v_min[1];
3047 A[1][1] = v_inter[1] - v_min[1];
3049 b[0] = 1.0 - v_min[0];
3061 double temp =
A[1][0];
3066 for (
unsigned int k = 0; k < 1; ++k)
3068 for (
unsigned int i = k + 1; i < 2; ++i)
3070 x =
A[i][k] /
A[k][k];
3072 for (
unsigned int j = k + 1; j < 2; ++j)
3073 A[i][j] =
A[i][j] -
A[k][j] * x;
3075 b[i] =
b[i] -
b[k] * x;
3079 b[1] =
b[1] /
A[1][1];
3081 for (
int i = 0; i >= 0; i--)
3085 for (
unsigned int j = i + 1; j < 2; ++j)
3088 b[i] =
sum /
A[i][i];
3098 gradient[0] =
b[0] * (v_max[2] - v_min[2]) +
3099 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3102 A[0][0] = v_max[0] - v_min[0];
3103 A[0][1] = v_inter[0] - v_min[0];
3104 A[1][0] = v_max[1] - v_min[1];
3105 A[1][1] = v_inter[1] - v_min[1];
3108 b[1] = 1.0 - v_min[1];
3119 double temp =
A[1][0];
3124 for (
unsigned int k = 0; k < 1; ++k)
3126 for (
unsigned int i = k + 1; i < 2; ++i)
3128 x =
A[i][k] /
A[k][k];
3130 for (
unsigned int j = k + 1; j < 2; ++j)
3131 A[i][j] =
A[i][j] -
A[k][j] * x;
3133 b[i] =
b[i] -
b[k] * x;
3137 b[1] =
b[1] /
A[1][1];
3139 for (
int i = 0; i >= 0; i--)
3143 for (
unsigned int j = i + 1; j < 2; ++j)
3146 b[i] =
sum /
A[i][i];
3156 gradient[1] =
b[0] * (v_max[2] - v_min[2]) +
3157 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
3163 gradient[1] * (v_min[1] - v_max[1]);
3167 gradient_parameters[0] = v_min[0];
3168 gradient_parameters[1] = v_min[1];
3173 gradient_parameters[4] = v_min[2];
3174 gradient_parameters[5] = v_max[2];
3176 return gradient_parameters;
3182 template <
int dim,
int spacedim>
3186 const std::vector<std::string> & data_names,
3188 std::tuple<
unsigned int,
3201 #ifndef DEAL_II_WITH_MPI
3210 if (patches.size() == 0)
3214 const unsigned int n_data_sets = data_names.size();
3216 UcdStream ucd_out(out, flags);
3219 unsigned int n_nodes;
3221 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
3227 <<
"# This file was generated by the deal.II library." <<
'\n'
3231 <<
"# For a description of the UCD format see the AVS Developer's guide."
3237 out << n_nodes <<
' ' <<
n_cells <<
' ' << n_data_sets <<
' ' << 0
3250 if (n_data_sets != 0)
3252 out << n_data_sets <<
" ";
3253 for (
unsigned int i = 0; i < n_data_sets; ++i)
3258 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3259 out << data_names[data_set]
3263 write_data(patches, n_data_sets,
true, ucd_out);
3273 template <
int dim,
int spacedim>
3277 const std::vector<std::string> & data_names,
3279 std::tuple<
unsigned int,
3291 #ifndef DEAL_II_WITH_MPI
3300 if (patches.size() == 0)
3304 DXStream dx_out(out, flags);
3307 unsigned int offset = 0;
3309 const unsigned int n_data_sets = data_names.size();
3312 unsigned int n_nodes;
3314 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
3317 out <<
"object \"vertices\" class array type float rank 1 shape "
3318 << spacedim <<
" items " << n_nodes;
3322 out <<
" lsb ieee data 0" <<
'\n';
3323 offset += n_nodes * spacedim *
sizeof(float);
3327 out <<
" data follows" <<
'\n';
3336 out <<
"object \"cells\" class array type int rank 1 shape "
3341 out <<
" lsb binary data " << offset <<
'\n';
3342 offset +=
n_cells *
sizeof(int);
3346 out <<
" data follows" <<
'\n';
3352 out <<
"attribute \"element type\" string \"";
3359 out <<
"\"" <<
'\n' <<
"attribute \"ref\" string \"positions\"" <<
'\n';
3366 out <<
"object \"neighbors\" class array type int rank 1 shape "
3370 for (
const auto &patch : patches)
3373 const unsigned int n1 = (dim > 0) ? n : 1;
3374 const unsigned int n2 = (dim > 1) ? n : 1;
3375 const unsigned int n3 = (dim > 2) ? n : 1;
3376 const unsigned int x_minus = (dim > 0) ? 0 : 0;
3377 const unsigned int x_plus = (dim > 0) ? 1 : 0;
3378 const unsigned int y_minus = (dim > 1) ? 2 : 0;
3379 const unsigned int y_plus = (dim > 1) ? 3 : 0;
3380 const unsigned int z_minus = (dim > 2) ? 4 : 0;
3381 const unsigned int z_plus = (dim > 2) ? 5 : 0;
3382 unsigned int cells_per_patch = Utilities::fixed_power<dim>(n);
3383 unsigned int dx = 1;
3384 unsigned int dy = n;
3385 unsigned int dz = n * n;
3387 const unsigned int patch_start =
3390 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3391 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3392 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3394 const unsigned int nx = i1 *
dx;
3395 const unsigned int ny = i2 * dy;
3396 const unsigned int nz = i3 * dz;
3408 const unsigned int nn = patch.
neighbors[x_minus];
3412 << (nn * cells_per_patch + ny + nz +
dx * (n - 1));
3418 out <<
'\t' << patch_start + nx -
dx + ny + nz;
3423 const unsigned int nn = patch.
neighbors[x_plus];
3426 out << (nn * cells_per_patch + ny + nz);
3432 out <<
'\t' << patch_start + nx +
dx + ny + nz;
3439 const unsigned int nn = patch.
neighbors[y_minus];
3443 << (nn * cells_per_patch + nx + nz + dy * (n - 1));
3449 out <<
'\t' << patch_start + nx + ny - dy + nz;
3454 const unsigned int nn = patch.
neighbors[y_plus];
3457 out << (nn * cells_per_patch + nx + nz);
3463 out <<
'\t' << patch_start + nx + ny + dy + nz;
3471 const unsigned int nn = patch.
neighbors[z_minus];
3475 << (nn * cells_per_patch + nx + ny + dz * (n - 1));
3481 out <<
'\t' << patch_start + nx + ny + nz - dz;
3486 const unsigned int nn = patch.
neighbors[z_plus];
3489 out << (nn * cells_per_patch + nx + ny);
3495 out <<
'\t' << patch_start + nx + ny + nz + dz;
3503 if (n_data_sets != 0)
3505 out <<
"object \"data\" class array type float rank 1 shape "
3506 << n_data_sets <<
" items " << n_nodes;
3510 out <<
" lsb ieee data " << offset <<
'\n';
3511 offset += n_data_sets * n_nodes *
3512 ((flags.
data_double) ?
sizeof(
double) :
sizeof(float));
3516 out <<
" data follows" <<
'\n';
3521 out <<
"attribute \"dep\" string \"positions\"" <<
'\n';
3525 out <<
"object \"data\" class constantarray type float rank 0 items "
3526 << n_nodes <<
" data follows" <<
'\n'
3532 out <<
"object \"deal data\" class field" <<
'\n'
3533 <<
"component \"positions\" value \"vertices\"" <<
'\n'
3534 <<
"component \"connections\" value \"cells\"" <<
'\n'
3535 <<
"component \"data\" value \"data\"" <<
'\n';
3538 out <<
"component \"neighbors\" value \"neighbors\"" <<
'\n';
3545 out <<
"end" <<
'\n';
3563 template <
int dim,
int spacedim>
3567 const std::vector<std::string> & data_names,
3569 std::tuple<
unsigned int,
3578 #ifndef DEAL_II_WITH_MPI
3588 if (patches.size() == 0)
3592 const unsigned int n_data_sets = data_names.size();
3596 out <<
"# This file was generated by the deal.II library." <<
'\n'
3600 <<
"# For a description of the GNUPLOT format see the GNUPLOT manual."
3607 for (
unsigned int spacedim_n = 0; spacedim_n < spacedim; ++spacedim_n)
3612 for (
const auto &data_name : data_names)
3613 out <<
'<' << data_name <<
"> ";
3619 for (
const auto &patch : patches)
3622 const unsigned int n_points_per_direction = n_subdivisions + 1;
3624 Assert((patch.
data.n_rows() == n_data_sets &&
3626 (patch.
data.n_rows() == n_data_sets + spacedim &&
3629 (n_data_sets + spacedim) :
3631 patch.
data.n_rows()));
3633 auto output_point_data =
3634 [&out, &patch, n_data_sets](
const unsigned int point_index)
mutable {
3635 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3636 out << patch.data(data_set, point_index) <<
' ';
3645 Assert(patch.data.n_cols() == 1,
3647 n_subdivisions + 1));
3651 out << get_equispaced_location(patch, {}, n_subdivisions)
3653 output_point_data(0);
3663 Assert(patch.data.n_cols() ==
3664 Utilities::fixed_power<dim>(n_points_per_direction),
3666 n_subdivisions + 1));
3668 for (
unsigned int i1 = 0; i1 < n_points_per_direction; ++i1)
3671 out << get_equispaced_location(patch, {i1}, n_subdivisions)
3674 output_point_data(i1);
3687 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3688 n_points_per_direction),
3690 n_subdivisions + 1));
3692 for (
unsigned int i2 = 0; i2 < n_points_per_direction; ++i2)
3694 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3698 out << get_equispaced_location(patch,
3703 output_point_data(i1 + i2 * n_points_per_direction);
3728 out << get_node_location(patch, 0) <<
' ';
3729 output_point_data(0);
3732 out << get_node_location(patch, 1) <<
' ';
3733 output_point_data(1);
3737 out << get_node_location(patch, 2) <<
' ';
3738 output_point_data(2);
3741 out << get_node_location(patch, 2) <<
' ';
3742 output_point_data(2);
3762 Assert(patch.data.n_cols() == Utilities::fixed_power<dim>(
3763 n_points_per_direction),
3765 n_subdivisions + 1));
3770 for (
unsigned int i3 = 0; i3 < n_points_per_direction; ++i3)
3771 for (
unsigned int i2 = 0; i2 < n_points_per_direction;
3773 for (
unsigned int i1 = 0; i1 < n_points_per_direction;
3778 get_equispaced_location(patch,
3782 if (i1 < n_subdivisions)
3785 out << this_point <<
' ';
3786 output_point_data(i1 +
3787 i2 * n_points_per_direction +
3788 i3 * n_points_per_direction *
3789 n_points_per_direction);
3793 out << get_equispaced_location(patch,
3798 output_point_data((i1 + 1) +
3799 i2 * n_points_per_direction +
3800 i3 * n_points_per_direction *
3801 n_points_per_direction);
3805 out <<
'\n' <<
'\n';
3809 if (i2 < n_subdivisions)
3812 out << this_point <<
' ';
3813 output_point_data(i1 +
3814 i2 * n_points_per_direction +
3815 i3 * n_points_per_direction *
3816 n_points_per_direction);
3820 out << get_equispaced_location(patch,
3826 i1 + (i2 + 1) * n_points_per_direction +
3827 i3 * n_points_per_direction *
3828 n_points_per_direction);
3832 out <<
'\n' <<
'\n';
3836 if (i3 < n_subdivisions)
3839 out << this_point <<
' ';
3840 output_point_data(i1 +
3841 i2 * n_points_per_direction +
3842 i3 * n_points_per_direction *
3843 n_points_per_direction);
3847 out << get_equispaced_location(patch,
3853 i1 + i2 * n_points_per_direction +
3854 (i3 + 1) * n_points_per_direction *
3855 n_points_per_direction);
3858 out <<
'\n' <<
'\n';
3867 for (
const unsigned int v : {0, 1, 2, 0, 3, 2})
3869 out << get_node_location(patch, v) <<
' ';
3870 output_point_data(v);
3875 for (
const unsigned int v : {3, 1})
3877 out << get_node_location(patch, v) <<
' ';
3878 output_point_data(v);
3888 for (
const unsigned int v : {0, 1, 3, 2, 0, 4, 1})
3890 out << get_node_location(patch, v) <<
' ';
3891 output_point_data(v);
3896 for (
const unsigned int v : {2, 4, 3})
3898 out << get_node_location(patch, v) <<
' ';
3899 output_point_data(v);
3913 for (
const unsigned int v : {0, 1, 2, 0, 3, 4, 5, 3})
3915 out << get_node_location(patch, v) <<
' ';
3916 output_point_data(v);
3921 for (
const unsigned int v : {1, 4})
3923 out << get_node_location(patch, v) <<
' ';
3924 output_point_data(v);
3929 for (
const unsigned int v : {2, 5})
3931 out << get_node_location(patch, v) <<
' ';
3932 output_point_data(v);
3957 template <
int dim,
int spacedim>
3959 do_write_povray(
const std::vector<Patch<dim, spacedim>> &,
3960 const std::vector<std::string> &,
3961 const PovrayFlags &,
3965 ExcMessage(
"Writing files in POVRAY format is only supported "
3966 "for two-dimensional meshes."));
3972 do_write_povray(
const std::vector<Patch<2, 2>> &patches,
3973 const std::vector<std::string> &data_names,
3974 const PovrayFlags & flags,
3979 #ifndef DEAL_II_WITH_MPI
3988 if (patches.size() == 0)
3991 constexpr
int dim = 2;
3993 constexpr
int spacedim = 2;
3995 const unsigned int n_data_sets = data_names.size();
4001 <<
"/* This file was generated by the deal.II library." <<
'\n'
4005 <<
" For a description of the POVRAY format see the POVRAY manual."
4010 out <<
"#include \"colors.inc\" " <<
'\n'
4011 <<
"#include \"textures.inc\" " <<
'\n';
4015 if (flags.external_data)
4016 out <<
"#include \"data.inc\" " <<
'\n';
4022 <<
"camera {" <<
'\n'
4023 <<
" location <1,4,-7>" <<
'\n'
4024 <<
" look_at <0,0,0>" <<
'\n'
4025 <<
" angle 30" <<
'\n'
4030 <<
"light_source {" <<
'\n'
4031 <<
" <1,4,-7>" <<
'\n'
4032 <<
" color Grey" <<
'\n'
4035 <<
"light_source {" <<
'\n'
4036 <<
" <0,20,0>" <<
'\n'
4037 <<
" color White" <<
'\n'
4044 double hmin = patches[0].data(0, 0);
4045 double hmax = patches[0].data(0, 0);
4047 for (
const auto &patch : patches)
4051 Assert((patch.
data.n_rows() == n_data_sets &&
4053 (patch.
data.n_rows() == n_data_sets + spacedim &&
4056 (n_data_sets + spacedim) :
4058 patch.
data.n_rows()));
4060 Utilities::fixed_power<dim>(n_subdivisions + 1),
4062 n_subdivisions + 1));
4064 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
4065 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
4067 const int dl = i * (n_subdivisions + 1) + j;
4068 if (patch.
data(0, dl) < hmin)
4069 hmin = patch.
data(0, dl);
4070 if (patch.
data(0, dl) > hmax)
4071 hmax = patch.
data(0, dl);
4075 out <<
"#declare HMIN=" << hmin <<
";" <<
'\n'
4076 <<
"#declare HMAX=" << hmax <<
";" <<
'\n'
4079 if (!flags.external_data)
4082 out <<
"#declare Tex=texture{" <<
'\n'
4083 <<
" pigment {" <<
'\n'
4084 <<
" gradient y" <<
'\n'
4085 <<
" scale y*(HMAX-HMIN)*" << 0.1 <<
'\n'
4086 <<
" color_map {" <<
'\n'
4087 <<
" [0.00 color Light_Purple] " <<
'\n'
4088 <<
" [0.95 color Light_Purple] " <<
'\n'
4089 <<
" [1.00 color White] " <<
'\n'
4094 if (!flags.bicubic_patch)
4097 out <<
'\n' <<
"mesh {" <<
'\n';
4101 for (
const auto &patch : patches)
4104 const unsigned int n = n_subdivisions + 1;
4105 const unsigned int d1 = 1;
4106 const unsigned int d2 = n;
4108 Assert((patch.
data.n_rows() == n_data_sets &&
4110 (patch.
data.n_rows() == n_data_sets + spacedim &&
4113 (n_data_sets + spacedim) :
4115 patch.
data.n_rows()));
4116 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
4118 n_subdivisions + 1));
4121 std::vector<Point<spacedim>> ver(n * n);
4123 for (
unsigned int i2 = 0; i2 < n; ++i2)
4124 for (
unsigned int i1 = 0; i1 < n; ++i1)
4127 ver[i1 * d1 + i2 * d2] =
4128 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4132 if (!flags.bicubic_patch)
4135 std::vector<Point<3>> nrml;
4145 for (
unsigned int i = 0; i < n; ++i)
4146 for (
unsigned int j = 0; j < n; ++j)
4148 const unsigned int il = (i == 0) ? i : (i - 1);
4149 const unsigned int ir =
4150 (i == n_subdivisions) ? i : (i + 1);
4151 const unsigned int jl = (j == 0) ? j : (j - 1);
4152 const unsigned int jr =
4153 (j == n_subdivisions) ? j : (j + 1);
4156 ver[ir * d1 + j * d2](0) - ver[il * d1 + j * d2](0);
4157 h1(1) = patch.
data(0, ir * d1 + j * d2) -
4158 patch.
data(0, il * d1 + j * d2);
4160 ver[ir * d1 + j * d2](1) - ver[il * d1 + j * d2](1);
4163 ver[i * d1 + jr * d2](0) - ver[i * d1 + jl * d2](0);
4164 h2(1) = patch.
data(0, i * d1 + jr * d2) -
4165 patch.
data(0, i * d1 + jl * d2);
4167 ver[i * d1 + jr * d2](1) - ver[i * d1 + jl * d2](1);
4169 nrml[i * d1 + j * d2](0) =
4170 h1(1) * h2(2) - h1(2) * h2(1);
4171 nrml[i * d1 + j * d2](1) =
4172 h1(2) * h2(0) - h1(0) * h2(2);
4173 nrml[i * d1 + j * d2](2) =
4174 h1(0) * h2(1) - h1(1) * h2(0);
4178 std::sqrt(std::pow(nrml[i * d1 + j * d2](0), 2.) +
4179 std::pow(nrml[i * d1 + j * d2](1), 2.) +
4180 std::pow(nrml[i * d1 + j * d2](2), 2.));
4182 if (nrml[i * d1 + j * d2](1) < 0)
4185 for (
unsigned int k = 0; k < 3; ++k)
4186 nrml[i * d1 + j * d2](k) /=
norm;
4191 for (
unsigned int i = 0; i < n_subdivisions; ++i)
4192 for (
unsigned int j = 0; j < n_subdivisions; ++j)
4195 const int dl = i * d1 + j * d2;
4201 out <<
"smooth_triangle {" <<
'\n'
4202 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4203 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0)
4204 <<
", " << nrml[dl](1) <<
", " << nrml[dl](2)
4206 out <<
" \t<" << ver[dl + d1](0) <<
","
4207 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
4208 <<
">, <" << nrml[dl + d1](0) <<
", "
4209 << nrml[dl + d1](1) <<
", " << nrml[dl + d1](2)
4211 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4212 << patch.
data(0, dl + d1 + d2) <<
","
4213 << ver[dl + d1 + d2](1) <<
">, <"
4214 << nrml[dl + d1 + d2](0) <<
", "
4215 << nrml[dl + d1 + d2](1) <<
", "
4216 << nrml[dl + d1 + d2](2) <<
">}" <<
'\n';
4219 out <<
"smooth_triangle {" <<
'\n'
4220 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4221 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0)
4222 <<
", " << nrml[dl](1) <<
", " << nrml[dl](2)
4224 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4225 << patch.
data(0, dl + d1 + d2) <<
","
4226 << ver[dl + d1 + d2](1) <<
">, <"
4227 << nrml[dl + d1 + d2](0) <<
", "
4228 << nrml[dl + d1 + d2](1) <<
", "
4229 << nrml[dl + d1 + d2](2) <<
">," <<
'\n';
4230 out <<
"\t<" << ver[dl + d2](0) <<
","
4231 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
4232 <<
">, <" << nrml[dl + d2](0) <<
", "
4233 << nrml[dl + d2](1) <<
", " << nrml[dl + d2](2)
4239 out <<
"triangle {" <<
'\n'
4240 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4241 <<
"," << ver[dl](1) <<
">," <<
'\n';
4242 out <<
"\t<" << ver[dl + d1](0) <<
","
4243 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
4245 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4246 << patch.
data(0, dl + d1 + d2) <<
","
4247 << ver[dl + d1 + d2](1) <<
">}" <<
'\n';
4250 out <<
"triangle {" <<
'\n'
4251 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
4252 <<
"," << ver[dl](1) <<
">," <<
'\n';
4253 out <<
"\t<" << ver[dl + d1 + d2](0) <<
","
4254 << patch.
data(0, dl + d1 + d2) <<
","
4255 << ver[dl + d1 + d2](1) <<
">," <<
'\n';
4256 out <<
"\t<" << ver[dl + d2](0) <<
","
4257 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
4265 Assert(n_subdivisions == 3,
4268 <<
"bicubic_patch {" <<
'\n'
4269 <<
" type 0" <<
'\n'
4270 <<
" flatness 0" <<
'\n'
4271 <<
" u_steps 0" <<
'\n'
4272 <<
" v_steps 0" <<
'\n';
4273 for (
int i = 0; i < 16; ++i)
4275 out <<
"\t<" << ver[i](0) <<
"," << patch.
data(0, i) <<
","
4276 << ver[i](1) <<
">";
4281 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n';
4285 if (!flags.bicubic_patch)
4288 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n' <<
'\n';
4300 template <
int dim,
int spacedim>
4304 const std::vector<std::string> & data_names,
4306 std::tuple<
unsigned int,
4313 do_write_povray(patches, data_names, flags, out);
4318 template <
int dim,
int spacedim>
4322 const std::vector<std::string> & ,
4324 std::tuple<
unsigned int,
4336 template <
int spacedim>
4340 const std::vector<std::string> & ,
4342 std::tuple<
unsigned int,
4351 #ifndef DEAL_II_WITH_MPI
4360 if (patches.size() == 0)
4370 std::multiset<EpsCell2d> cells;
4379 double heights[4] = {0, 0, 0, 0};
4383 for (
const auto &patch : patches)
4386 const unsigned int n = n_subdivisions + 1;
4387 const unsigned int d1 = 1;
4388 const unsigned int d2 = n;
4390 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
4391 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
4395 get_equispaced_location(patch, {i1, i2}, n_subdivisions);
4397 get_equispaced_location(patch, {i1 + 1, i2}, n_subdivisions);
4399 get_equispaced_location(patch, {i1, i2 + 1}, n_subdivisions);
4400 points[3] = get_equispaced_location(patch,
4408 patch.
data.n_rows() == 0,
4411 patch.
data.n_rows()));
4413 patch.
data.n_rows() != 0 ?
4417 heights[1] = patch.
data.n_rows() != 0 ?
4419 (i1 + 1) * d1 + i2 * d2) *
4422 heights[2] = patch.
data.n_rows() != 0 ?
4424 i1 * d1 + (i2 + 1) * d2) *
4427 heights[3] = patch.
data.n_rows() != 0 ?
4429 (i1 + 1) * d1 + (i2 + 1) * d2) *
4436 for (
unsigned int i = 0; i < 4; ++i)
4437 heights[i] = points[i](2);
4458 cz = -std::cos(flags.
turn_angle * 2 * pi / 360.),
4461 sz = std::sin(flags.
turn_angle * 2 * pi / 360.);
4462 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4464 const double x = points[vertex](0), y = points[vertex](1),
4465 z = -heights[vertex];
4467 eps_cell.vertices[vertex](0) = -cz * x + sz * y;
4468 eps_cell.vertices[vertex](1) =
4469 -cx * sz * x - cx * cz * y - sx * z;
4493 (points[0] + points[1] + points[2] + points[3]) / 4;
4494 const double center_height =
4495 -(heights[0] + heights[1] + heights[2] + heights[3]) / 4;
4498 eps_cell.depth = -sx * sz * center_point(0) -
4499 sx * cz * center_point(1) + cx * center_height;
4504 patch.
data.n_rows() == 0,
4507 patch.
data.n_rows()));
4508 const double color_values[4] = {
4509 patch.
data.n_rows() != 0 ?
4513 patch.
data.n_rows() != 0 ?
4517 patch.
data.n_rows() != 0 ?
4521 patch.
data.n_rows() != 0 ?
4523 (i1 + 1) * d1 + (i2 + 1) * d2) :
4527 eps_cell.color_value = (color_values[0] + color_values[1] +
4528 color_values[3] + color_values[2]) /
4533 std::min(min_color_value, eps_cell.color_value);
4535 std::max(max_color_value, eps_cell.color_value);
4539 cells.insert(eps_cell);
4545 double x_min = cells.begin()->vertices[0](0);
4546 double x_max = x_min;
4547 double y_min = cells.begin()->vertices[0](1);
4548 double y_max = y_min;
4550 for (
const auto &cell : cells)
4551 for (
const auto &vertex : cell.vertices)
4553 x_min =
std::min(x_min, vertex(0));
4554 x_max =
std::max(x_max, vertex(0));
4555 y_min =
std::min(y_min, vertex(1));
4556 y_max =
std::max(y_max, vertex(1));
4561 const double scale =
4565 const Point<2> offset(x_min, y_min);
4570 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n'
4571 <<
"%%Title: deal.II Output" <<
'\n'
4572 <<
"%%Creator: the deal.II library" <<
'\n'
4575 <<
"%%BoundingBox: "
4579 <<
static_cast<unsigned int>((x_max - x_min) *
scale + 0.5) <<
' '
4580 <<
static_cast<unsigned int>((y_max - y_min) *
scale + 0.5) <<
'\n';
4589 out <<
"/m {moveto} bind def" <<
'\n'
4590 <<
"/l {lineto} bind def" <<
'\n'
4591 <<
"/s {setrgbcolor} bind def" <<
'\n'
4592 <<
"/sg {setgray} bind def" <<
'\n'
4593 <<
"/lx {lineto closepath stroke} bind def" <<
'\n'
4594 <<
"/lf {lineto closepath fill} bind def" <<
'\n';
4596 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4598 out << flags.
line_width <<
" setlinewidth" <<
'\n';
4606 if (max_color_value == min_color_value)
4607 max_color_value = min_color_value + 1;
4611 for (
const auto &cell : cells)
4624 out << rgb_values.
red <<
" sg ";
4626 out << rgb_values.
red <<
' ' << rgb_values.
green <<
' '
4627 << rgb_values.
blue <<
" s ";
4632 out << (cell.vertices[0] - offset) *
scale <<
" m "
4633 << (cell.vertices[1] - offset) *
scale <<
" l "
4634 << (cell.vertices[3] - offset) *
scale <<
" l "
4635 << (cell.vertices[2] - offset) *
scale <<
" lf" <<
'\n';
4640 << (cell.vertices[0] - offset) *
scale <<
" m "
4641 << (cell.vertices[1] - offset) *
scale <<
" l "
4642 << (cell.vertices[3] - offset) *
scale <<
" l "
4643 << (cell.vertices[2] - offset) *
scale <<
" lx" <<
'\n';
4645 out <<
"showpage" <<
'\n';
4654 template <
int dim,
int spacedim>
4658 const std::vector<std::string> & data_names,
4660 std::tuple<
unsigned int,
4676 #ifndef DEAL_II_WITH_MPI
4685 if (patches.size() == 0)
4689 GmvStream gmv_out(out, flags);
4690 const unsigned int n_data_sets = data_names.size();
4693 Assert((patches[0].data.n_rows() == n_data_sets &&
4694 !patches[0].points_are_available) ||
4695 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4696 patches[0].points_are_available),
4698 (n_data_sets + spacedim) :
4700 patches[0].data.n_rows()));
4704 out <<
"gmvinput ascii" <<
'\n' <<
'\n';
4707 unsigned int n_nodes;
4709 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
4724 [&patches]() {
return create_global_data_table(patches); });
4730 out <<
"nodes " << n_nodes <<
'\n';
4731 for (
unsigned int d = 0;
d < spacedim; ++
d)
4733 gmv_out.selected_component =
d;
4739 for (
unsigned int d = spacedim;
d < 3; ++
d)
4741 for (
unsigned int i = 0; i < n_nodes; ++i)
4748 out <<
"cells " <<
n_cells <<
'\n';
4753 out <<
"variable" <<
'\n';
4757 std::move(*create_global_data_table_task.
return_value());
4761 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4763 out << data_names[data_set] <<
" 1" <<
'\n';
4765 data_vectors[data_set].
end(),
4766 std::ostream_iterator<double>(out,
" "));
4767 out <<
'\n' <<
'\n';
4773 out <<
"endvars" <<
'\n';
4776 out <<
"endgmv" <<
'\n';
4787 template <
int dim,
int spacedim>
4791 const std::vector<std::string> & data_names,
4793 std::tuple<
unsigned int,
4807 #ifndef DEAL_II_WITH_MPI
4816 if (patches.size() == 0)
4820 TecplotStream tecplot_out(out, flags);
4822 const unsigned int n_data_sets = data_names.size();
4825 Assert((patches[0].data.n_rows() == n_data_sets &&
4826 !patches[0].points_are_available) ||
4827 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4828 patches[0].points_are_available),
4830 (n_data_sets + spacedim) :
4832 patches[0].data.n_rows()));
4835 unsigned int n_nodes;
4837 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
4843 <<
"# This file was generated by the deal.II library." <<
'\n'
4847 <<
"# For a description of the Tecplot format see the Tecplot documentation."
4852 out <<
"Variables=";
4860 out <<
"\"x\", \"y\"";
4863 out <<
"\"x\", \"y\", \"z\"";
4869 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4870 out <<
", \"" << data_names[data_set] <<
"\"";
4876 out <<
"t=\"" << flags.
zone_name <<
"\" ";
4879 out <<
"strandid=1, solutiontime=" << flags.
solution_time <<
", ";
4881 out <<
"f=feblock, n=" << n_nodes <<
", e=" <<
n_cells
4882 <<
", et=" << tecplot_cell_type[dim] <<
'\n';
4899 [&patches]() {
return create_global_data_table(patches); });
4905 for (
unsigned int d = 0;
d < spacedim; ++
d)
4907 tecplot_out.selected_component =
d;
4918 std::move(*create_global_data_table_task.
return_value());
4921 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4924 data_vectors[data_set].
end(),
4925 std::ostream_iterator<double>(out,
"\n"));
4943 #ifdef DEAL_II_HAVE_TECPLOT
4950 TecplotMacros(
const unsigned int n_nodes = 0,
4951 const unsigned int n_vars = 0,
4952 const unsigned int n_cells = 0,
4953 const unsigned int n_vert = 0);
4956 nd(
const unsigned int i,
const unsigned int j);
4958 cd(
const unsigned int i,
const unsigned int j);
4959 std::vector<float> nodalData;
4960 std::vector<int> connData;
4963 unsigned int n_nodes;
4964 unsigned int n_vars;
4966 unsigned int n_vert;
4970 inline TecplotMacros::TecplotMacros(
const unsigned int n_nodes,
4971 const unsigned int n_vars,
4973 const unsigned int n_vert)
4979 nodalData.resize(n_nodes * n_vars);
4980 connData.resize(
n_cells * n_vert);
4985 inline TecplotMacros::~TecplotMacros()
4991 TecplotMacros::nd(
const unsigned int i,
const unsigned int j)
4993 return nodalData[i * n_nodes + j];
4999 TecplotMacros::cd(
const unsigned int i,
const unsigned int j)
5001 return connData[i + j * n_vert];
5012 template <
int dim,
int spacedim>
5016 const std::vector<std::string> & data_names,
5018 std::tuple<
unsigned int,
5022 & nonscalar_data_ranges,
5031 #ifndef DEAL_II_HAVE_TECPLOT
5034 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5042 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5049 char *file_name = (
char *)flags.tecplot_binary_file_name;
5051 if (file_name ==
nullptr)
5056 ExcMessage(
"Specify the name of the tecplot_binary"
5057 " file through the TecplotFlags interface."));
5058 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
5065 # ifndef DEAL_II_WITH_MPI
5074 if (patches.size() == 0)
5078 const unsigned int n_data_sets = data_names.size();
5081 Assert((patches[0].data.n_rows() == n_data_sets &&
5082 !patches[0].points_are_available) ||
5083 (patches[0].data.n_rows() == n_data_sets + spacedim &&
5084 patches[0].points_are_available),
5086 (n_data_sets + spacedim) :
5088 patches[0].data.n_rows()));
5091 unsigned int n_nodes;
5093 std::tie(n_nodes,
n_cells) = count_nodes_and_cells(patches);
5095 const unsigned int vars_per_node = (spacedim + n_data_sets),
5098 TecplotMacros tm(n_nodes, vars_per_node,
n_cells, nodes_per_cell);
5100 int is_double = 0, tec_debug = 0, cell_type = tecplot_binary_cell_type[dim];
5102 std::string tec_var_names;
5106 tec_var_names =
"x y";
5109 tec_var_names =
"x y z";
5115 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5117 tec_var_names +=
" ";
5118 tec_var_names += data_names[data_set];
5134 [&patches]() {
return create_global_data_table(patches); });
5138 for (
unsigned int d = 1;
d <= spacedim; ++
d)
5140 unsigned int entry = 0;
5142 for (
const auto &patch : patches)
5150 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5151 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5153 const double x_frac = i * 1. / n_subdivisions,
5154 y_frac = j * 1. / n_subdivisions;
5156 tm.nd((
d - 1), entry) =
static_cast<float>(
5158 (patch.
vertices[0](
d - 1) * (1 - x_frac))) *
5161 (patch.
vertices[2](
d - 1) * (1 - x_frac))) *
5170 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5171 for (
unsigned int k = 0; k < n_subdivisions + 1; ++k)
5172 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5174 const double x_frac = i * 1. / n_subdivisions,
5175 y_frac = k * 1. / n_subdivisions,
5176 z_frac = j * 1. / n_subdivisions;
5179 tm.nd((
d - 1), entry) =
static_cast<float>(
5180 ((((patch.
vertices[1](
d - 1) * x_frac) +
5181 (patch.
vertices[0](
d - 1) * (1 - x_frac))) *
5184 (patch.
vertices[2](
d - 1) * (1 - x_frac))) *
5188 (patch.
vertices[4](
d - 1) * (1 - x_frac))) *
5191 (patch.
vertices[6](
d - 1) * (1 - x_frac))) *
5209 std::move(*create_global_data_table_task.
return_value());
5212 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5213 for (
unsigned int entry = 0; entry < data_vectors[data_set].size();
5215 tm.nd((spacedim + data_set), entry) =
5216 static_cast<float>(data_vectors[data_set][entry]);
5222 unsigned int first_vertex_of_patch = 0;
5223 unsigned int elem = 0;
5225 for (
const auto &patch : patches)
5228 const unsigned int n = n_subdivisions + 1;
5229 const unsigned int d1 = 1;
5230 const unsigned int d2 = n;
5231 const unsigned int d3 = n * n;
5237 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5238 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5241 first_vertex_of_patch + (i1)*d1 + (i2)*d2 + 1;
5243 first_vertex_of_patch + (i1 + 1) * d1 + (i2)*d2 + 1;
5244 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5247 first_vertex_of_patch + (i1)*d1 + (i2 + 1) * d2 + 1;
5256 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5257 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5258 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5263 tm.cd(0, elem) = first_vertex_of_patch + (i1)*d1 +
5264 (i2)*d2 + (i3)*d3 + 1;
5265 tm.cd(1, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5266 (i2)*d2 + (i3)*d3 + 1;
5267 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5268 (i2 + 1) * d2 + (i3)*d3 + 1;
5269 tm.cd(3, elem) = first_vertex_of_patch + (i1)*d1 +
5270 (i2 + 1) * d2 + (i3)*d3 + 1;
5271 tm.cd(4, elem) = first_vertex_of_patch + (i1)*d1 +
5272 (i2)*d2 + (i3 + 1) * d3 + 1;
5273 tm.cd(5, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5274 (i2)*d2 + (i3 + 1) * d3 + 1;
5275 tm.cd(6, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5276 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5277 tm.cd(7, elem) = first_vertex_of_patch + (i1)*d1 +
5278 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5291 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
5296 int ierr = 0, num_nodes =
static_cast<int>(n_nodes),
5297 num_cells =
static_cast<int>(
n_cells);
5299 char dot[2] = {
'.', 0};
5303 char *var_names =
const_cast<char *
>(tec_var_names.c_str());
5304 ierr = TECINI(
nullptr, var_names, file_name, dot, &tec_debug, &is_double);
5308 char FEBLOCK[] = {
'F',
'E',
'B',
'L',
'O',
'C',
'K', 0};
5310 TECZNE(
nullptr, &num_nodes, &num_cells, &cell_type, FEBLOCK,
nullptr);
5314 int total = (vars_per_node * num_nodes);
5316 ierr = TECDAT(&total, tm.nodalData.data(), &is_double);
5320 ierr = TECNOD(tm.connData.data());
5333 template <
int dim,
int spacedim>
5337 const std::vector<std::string> & data_names,
5339 std::tuple<
unsigned int,
5343 & nonscalar_data_ranges,
5349 #ifndef DEAL_II_WITH_MPI
5358 if (patches.size() == 0)
5362 VtkStream vtk_out(out, flags);
5364 const unsigned int n_data_sets = data_names.size();
5366 if (patches[0].points_are_available)
5378 out <<
"# vtk DataFile Version 3.0" <<
'\n'
5379 <<
"#This file was generated by the deal.II library";
5387 out <<
'\n' <<
"ASCII" <<
'\n';
5389 out <<
"DATASET UNSTRUCTURED_GRID\n" <<
'\n';
5396 const unsigned int n_metadata =
5401 out <<
"FIELD FieldData " << n_metadata <<
'\n';
5405 out <<
"CYCLE 1 1 int\n" << flags.
cycle <<
'\n';
5409 out <<
"TIME 1 1 double\n" << flags.
time <<
'\n';
5415 unsigned int n_nodes;
5417 unsigned int n_points_and_n_cells;
5418 std::tie(n_nodes,
n_cells, n_points_and_n_cells) =
5434 [&patches]() {
return create_global_data_table(patches); });
5440 out <<
"POINTS " << n_nodes <<
" double" <<
'\n';
5445 out <<
"CELLS " <<
n_cells <<
' ' << n_points_and_n_cells <<
'\n';
5453 out <<
"CELL_TYPES " <<
n_cells <<
'\n';
5457 for (
const auto &patch : patches)
5459 const auto vtk_cell_id =
5462 for (
unsigned int i = 0; i < vtk_cell_id[1]; ++i)
5463 out <<
' ' << vtk_cell_id[0];
5472 std::move(*create_global_data_table_task.
return_value());
5477 out <<
"POINT_DATA " << n_nodes <<
'\n';
5481 std::vector<bool> data_set_written(n_data_sets,
false);
5482 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
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);