34 #include <deal.II/base/data_out_base.h> 35 #include <deal.II/base/memory_consumption.h> 36 #include <deal.II/base/mpi.h> 37 #include <deal.II/base/parameter_handler.h> 38 #include <deal.II/base/thread_management.h> 39 #include <deal.II/base/utilities.h> 41 #include <deal.II/numerics/data_component_interpretation.h> 56 #ifdef DEAL_II_WITH_ZLIB 60 #ifdef DEAL_II_WITH_HDF5 64 DEAL_II_NAMESPACE_OPEN
74 <<
"Unexpected input: expected line\n <" << arg1
75 <<
">\nbut got\n <" << arg2 <<
">");
81 #ifdef DEAL_II_WITH_ZLIB 90 using base64_encodestep =
enum { step_A, step_B, step_C };
92 using base64_encodestate =
struct 94 base64_encodestep step;
99 base64_init_encodestate(base64_encodestate *state_in)
101 state_in->step = step_A;
102 state_in->result = 0;
106 base64_encode_value(
char value_in)
108 static const char *encoding =
109 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
112 return encoding[
static_cast<int>(value_in)];
116 base64_encode_block(
const char * plaintext_in,
119 base64_encodestate *state_in)
121 const char * plainchar = plaintext_in;
122 const char *
const plaintextend = plaintext_in + length_in;
123 char * codechar = code_out;
126 result = state_in->result;
128 switch (state_in->step)
135 if (plainchar == plaintextend)
137 state_in->result = result;
138 state_in->step = step_A;
139 return codechar - code_out;
141 const char fragment = *plainchar++;
142 result = (fragment & 0x0fc) >> 2;
143 *codechar++ = base64_encode_value(result);
144 result = (fragment & 0x003) << 4;
149 if (plainchar == plaintextend)
151 state_in->result = result;
152 state_in->step = step_B;
153 return codechar - code_out;
155 const char fragment = *plainchar++;
156 result |= (fragment & 0x0f0) >> 4;
157 *codechar++ = base64_encode_value(result);
158 result = (fragment & 0x00f) << 2;
163 if (plainchar == plaintextend)
165 state_in->result = result;
166 state_in->step = step_C;
167 return codechar - code_out;
169 const char fragment = *plainchar++;
170 result |= (fragment & 0x0c0) >> 6;
171 *codechar++ = base64_encode_value(result);
172 result = (fragment & 0x03f) >> 0;
173 *codechar++ = base64_encode_value(result);
178 return codechar - code_out;
182 base64_encode_blockend(
char *code_out, base64_encodestate *state_in)
184 char *codechar = code_out;
186 switch (state_in->step)
189 *codechar++ = base64_encode_value(state_in->result);
194 *codechar++ = base64_encode_value(state_in->result);
202 return codechar - code_out;
214 encode_block(
const char *data,
const int data_size)
216 base64::base64_encodestate state;
217 base64::base64_init_encodestate(&state);
219 char *encoded_data =
new char[2 * data_size + 1];
221 const int encoded_length_data =
222 base64::base64_encode_block(data, data_size, encoded_data, &state);
223 base64::base64_encode_blockend(encoded_data + encoded_length_data, &state);
234 get_zlib_compression_level(
240 return Z_NO_COMPRESSION;
244 return Z_BEST_COMPRESSION;
246 return Z_DEFAULT_COMPRESSION;
249 return Z_NO_COMPRESSION;
257 template <
typename T>
259 write_compressed_block(
const std::vector<T> & data,
261 std::ostream & output_stream)
263 if (data.size() != 0)
266 uLongf compressed_data_length = compressBound(data.size() *
sizeof(T));
267 char * compressed_data =
new char[compressed_data_length];
269 compress2(reinterpret_cast<Bytef *>(compressed_data),
270 &compressed_data_length,
271 reinterpret_cast<const Bytef *>(data.data()),
272 data.size() *
sizeof(T),
278 const uint32_t compression_header[4] = {
280 static_cast<uint32_t
>(data.size() *
sizeof(T)),
281 static_cast<uint32_t
>(data.size() *
283 static_cast<uint32_t
>(
284 compressed_data_length)};
286 char *encoded_header =
287 encode_block(reinterpret_cast<const char *>(&compression_header[0]),
288 4 *
sizeof(compression_header[0]));
289 output_stream << encoded_header;
290 delete[] encoded_header;
294 encode_block(compressed_data, compressed_data_length);
295 delete[] compressed_data;
297 output_stream << encoded_data;
298 delete[] encoded_data;
344 operator<(
const SvgCell &)
const;
348 SvgCell::operator<(
const SvgCell &e)
const 351 return depth >
e.depth;
385 operator<(
const EpsCell2d &)
const;
399 template <
int dim,
int spacedim,
typename Number =
double>
401 write_gmv_reorder_data_vectors(
402 const std::vector<Patch<dim, spacedim>> &patches,
406 if (patches.size() == 0)
416 const unsigned int n_data_sets = patches[0].points_are_available ?
417 (patches[0].data.n_rows() - spacedim) :
418 patches[0].data.n_rows();
423 unsigned int next_value = 0;
424 for (
const auto &patch : patches)
426 const unsigned int n_subdivisions = patch.n_subdivisions;
427 (void)n_subdivisions;
429 Assert((patch.data.n_rows() == n_data_sets &&
430 !patch.points_are_available) ||
431 (patch.data.n_rows() == n_data_sets + spacedim &&
432 patch.points_are_available),
434 (n_data_sets + spacedim) :
436 patch.data.n_rows()));
437 Assert((n_data_sets == 0) ||
438 (patch.data.n_cols() ==
439 Utilities::fixed_power<dim>(n_subdivisions + 1)),
441 n_subdivisions + 1));
443 for (
unsigned int i = 0; i < patch.data.n_cols(); ++i, ++next_value)
444 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
445 data_vectors[data_set][next_value] = patch.data(data_set, i);
448 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
457 , node_dim(
numbers::invalid_unsigned_int)
458 , vertices_per_cell(
numbers::invalid_unsigned_int)
465 , node_dim(
numbers::invalid_unsigned_int)
466 , vertices_per_cell(
numbers::invalid_unsigned_int)
478 for (
unsigned int d = 0; d < dim; ++d)
482 unsigned int internal_ind;
493 internal_ind = it->second;
503 const unsigned int pt_index)
517 for (
unsigned int d = 0; d <
node_dim; ++d)
518 node_data[
node_dim * existing_point.second + d] =
519 existing_point.first(d);
527 std::vector<unsigned int> &cell_data)
const 533 cell_data[filtered_cell.first] =
534 filtered_cell.second + local_node_offset;
603 const unsigned int start,
604 const unsigned int d1,
605 const unsigned int d2,
606 const unsigned int d3)
608 const unsigned int base_entry =
634 const unsigned int dimension,
635 const unsigned int set_num,
638 unsigned int new_dim;
657 for (
unsigned int d = 0; d < new_dim; ++d)
660 data_sets.back()[r * new_dim + d] = data_vectors(set_num + d, i);
676 const char *gmv_cell_type[4] = {
"",
"line 2",
"quad 4",
"hex 8"};
678 const char *ucd_cell_type[4] = {
"pt",
"line",
"quad",
"hex"};
680 const char *tecplot_cell_type[4] = {
"",
"lineseg",
"quadrilateral",
"brick"};
682 #ifdef DEAL_II_HAVE_TECPLOT 683 const unsigned int tecplot_binary_cell_type[4] = {0, 0, 1, 3};
690 const unsigned int vtk_cell_type[5] = {1,
694 static_cast<unsigned int>(-1)};
698 const unsigned int vtk_lagrange_cell_type[5] = {
703 static_cast<unsigned int>(-1)};
711 template <
int dim,
int spacedim>
714 const unsigned int xstep,
715 const unsigned int ystep,
716 const unsigned int zstep,
717 const unsigned int n_subdivisions)
722 unsigned int point_no = 0;
726 Assert(zstep < n_subdivisions + 1,
728 point_no += (n_subdivisions + 1) * (n_subdivisions + 1) * zstep;
731 Assert(ystep < n_subdivisions + 1,
733 point_no += (n_subdivisions + 1) * ystep;
736 Assert(xstep < n_subdivisions + 1,
747 for (
unsigned int d = 0;
d < spacedim; ++
d)
748 node[d] = patch.
data(patch.
data.
size(0) - spacedim +
d, point_no);
757 const double stepsize = 1. / n_subdivisions,
758 xfrac = xstep * stepsize;
764 const double yfrac = ystep * stepsize;
766 node += ((patch.
vertices[3] * xfrac) +
767 (patch.
vertices[2] * (1 - xfrac))) *
771 const double zfrac = zstep * stepsize;
773 node += (((patch.
vertices[5] * xfrac) +
774 (patch.
vertices[4] * (1 - xfrac))) *
777 (patch.
vertices[6] * (1 - xfrac))) *
795 vtk_point_index_from_ijk(
const unsigned i,
798 const std::array<unsigned, 2> &order)
800 const bool ibdy = (i == 0 || i == order[0]);
801 const bool jbdy = (j == 0 || j == order[1]);
803 const int nbdy = (ibdy ? 1 : 0) + (jbdy ? 1 : 0);
807 return (i ? (j ? 2 : 1) : (j ? 3 : 0));
815 return (i - 1) + (j ? order[0] - 1 + order[1] - 1 : 0) + offset;
821 (i ? order[0] - 1 : 2 * (order[0] - 1) + order[1] - 1) +
826 offset += 2 * (order[0] - 1 + order[1] - 1);
828 return offset + (i - 1) + (order[0] - 1) * ((j - 1));
839 vtk_point_index_from_ijk(
const unsigned i,
842 const std::array<unsigned, 3> &order)
844 const bool ibdy = (i == 0 || i == order[0]);
845 const bool jbdy = (j == 0 || j == order[1]);
846 const bool kbdy = (k == 0 || k == order[2]);
848 const int nbdy = (ibdy ? 1 : 0) + (jbdy ? 1 : 0) + (kbdy ? 1 : 0);
852 return (i ? (j ? 2 : 1) : (j ? 3 : 0)) + (k ? 4 : 0);
860 return (i - 1) + (j ? order[0] - 1 + order[1] - 1 : 0) +
861 (k ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset;
866 (i ? order[0] - 1 : 2 * (order[0] - 1) + order[1] - 1) +
867 (k ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset;
870 offset += 4 * (order[0] - 1) + 4 * (order[1] - 1);
871 return (k - 1) + (order[2] - 1) * (i ? (j ? 3 : 1) : (j ? 2 : 0)) +
875 offset += 4 * (order[0] - 1 + order[1] - 1 + order[2] - 1);
880 return (j - 1) + ((order[1] - 1) * (k - 1)) +
881 (i ? (order[1] - 1) * (order[2] - 1) : 0) + offset;
883 offset += 2 * (order[1] - 1) * (order[2] - 1);
886 return (i - 1) + ((order[0] - 1) * (k - 1)) +
887 (j ? (order[2] - 1) * (order[0] - 1) : 0) + offset;
889 offset += 2 * (order[2] - 1) * (order[0] - 1);
891 return (i - 1) + ((order[0] - 1) * (j - 1)) +
892 (k ? (order[0] - 1) * (order[1] - 1) : 0) + offset;
897 2 * ((order[1] - 1) * (order[2] - 1) + (order[2] - 1) * (order[0] - 1) +
898 (order[0] - 1) * (order[1] - 1));
899 return offset + (i - 1) +
900 (order[0] - 1) * ((j - 1) + (order[1] - 1) * ((k - 1)));
904 vtk_point_index_from_ijk(
const unsigned,
907 const std::array<unsigned, 0> &)
914 vtk_point_index_from_ijk(
const unsigned,
917 const std::array<unsigned, 1> &)
924 template <
int dim,
int spacedim>
927 unsigned int & n_nodes,
928 unsigned int & n_cells)
932 for (
const auto &patch : patches)
944 template <
typename FlagsType>
951 StreamBase(std::ostream &stream,
const FlagsType &flags)
952 : selected_component(
numbers::invalid_unsigned_int)
963 write_point(
const unsigned int,
const Point<dim> &)
966 ExcMessage(
"The derived class you are using needs to " 967 "reimplement this function if you want to call " 987 write_cell(
const unsigned int ,
994 ExcMessage(
"The derived class you are using needs to " 995 "reimplement this function if you want to call " 1013 template <
typename T>
1027 unsigned int selected_component;
1034 std::ostream &stream;
1039 const FlagsType flags;
1045 class DXStream :
public StreamBase<DataOutBase::DXFlags>
1052 write_point(
const unsigned int index,
const Point<dim> &);
1064 write_cell(
const unsigned int index,
1065 const unsigned int start,
1066 const unsigned int x_offset,
1067 const unsigned int y_offset,
1068 const unsigned int z_offset);
1076 template <
typename data>
1078 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1084 class GmvStream :
public StreamBase<DataOutBase::GmvFlags>
1091 write_point(
const unsigned int index,
const Point<dim> &);
1103 write_cell(
const unsigned int index,
1104 const unsigned int start,
1105 const unsigned int x_offset,
1106 const unsigned int y_offset,
1107 const unsigned int z_offset);
1113 class TecplotStream :
public StreamBase<DataOutBase::TecplotFlags>
1120 write_point(
const unsigned int index,
const Point<dim> &);
1132 write_cell(
const unsigned int index,
1133 const unsigned int start,
1134 const unsigned int x_offset,
1135 const unsigned int y_offset,
1136 const unsigned int z_offset);
1142 class UcdStream :
public StreamBase<DataOutBase::UcdFlags>
1149 write_point(
const unsigned int index,
const Point<dim> &);
1163 write_cell(
const unsigned int index,
1164 const unsigned int start,
1165 const unsigned int x_offset,
1166 const unsigned int y_offset,
1167 const unsigned int z_offset);
1175 template <
typename data>
1177 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1183 class VtkStream :
public StreamBase<DataOutBase::VtkFlags>
1190 write_point(
const unsigned int index,
const Point<dim> &);
1202 write_cell(
const unsigned int index,
1203 const unsigned int start,
1204 const unsigned int x_offset,
1205 const unsigned int y_offset,
1206 const unsigned int z_offset);
1217 write_high_order_cell(
const unsigned int index,
1218 const unsigned int start,
1219 const std::vector<unsigned> &connectivity);
1223 class VtuStream :
public StreamBase<DataOutBase::VtkFlags>
1230 write_point(
const unsigned int index,
const Point<dim> &);
1245 write_cell(
const unsigned int index,
1246 const unsigned int start,
1247 const unsigned int x_offset,
1248 const unsigned int y_offset,
1249 const unsigned int z_offset);
1260 write_high_order_cell(
const unsigned int index,
1261 const unsigned int start,
1262 const std::vector<unsigned> &connectivity);
1267 template <
typename T>
1278 template <
typename T>
1280 operator<<(const std::vector<T> &);
1291 std::vector<float> vertices;
1292 std::vector<int32_t> cells;
1305 DXStream::write_point(
const unsigned int,
const Point<dim> &p)
1307 if (flags.coordinates_binary)
1310 for (
unsigned int d = 0;
d < dim; ++
d)
1312 stream.write(reinterpret_cast<const char *>(data), dim *
sizeof(*data));
1316 for (
unsigned int d = 0;
d < dim; ++
d)
1317 stream << p(d) <<
'\t';
1326 DXStream::write_cell(
unsigned int,
1332 int nodes[1 << dim];
1353 if (flags.int_binary)
1354 stream.write(reinterpret_cast<const char *>(nodes),
1355 (1 << dim) *
sizeof(*nodes));
1358 const unsigned int final = (1 << dim) - 1;
1359 for (
unsigned int i = 0; i <
final; ++i)
1360 stream << nodes[i] <<
'\t';
1361 stream << nodes[
final] <<
'\n';
1367 template <
typename data>
1369 DXStream::write_dataset(
const unsigned int,
const std::vector<data> &values)
1371 if (flags.data_binary)
1373 stream.write(reinterpret_cast<const char *>(values.data()),
1374 values.size() *
sizeof(data));
1378 for (
unsigned int i = 0; i < values.size(); ++i)
1379 stream <<
'\t' << values[i];
1395 GmvStream::write_point(
const unsigned int,
const Point<dim> &p)
1399 stream << p(selected_component) <<
' ';
1406 GmvStream::write_cell(
unsigned int,
1413 const unsigned int start = s + 1;
1414 stream << gmv_cell_type[dim] <<
'\n';
1419 stream <<
'\t' << start + d1;
1422 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1425 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1426 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1435 TecplotStream::TecplotStream(std::ostream & out,
1443 TecplotStream::write_point(
const unsigned int,
const Point<dim> &p)
1447 stream << p(selected_component) <<
'\n';
1454 TecplotStream::write_cell(
unsigned int,
1460 const unsigned int start = s + 1;
1465 stream <<
'\t' << start + d1;
1468 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1471 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1472 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1488 UcdStream::write_point(
const unsigned int index,
const Point<dim> &p)
1490 stream << index + 1 <<
" ";
1492 for (
unsigned int i = 0; i < dim; ++i)
1493 stream << p(i) <<
' ';
1495 for (
unsigned int i = dim; i < 3; ++i)
1504 UcdStream::write_cell(
unsigned int index,
1510 int nodes[1 << dim];
1532 stream << index + 1 <<
"\t0 " << ucd_cell_type[dim];
1533 const unsigned int final = (1 << dim);
1534 for (
unsigned int i = 0; i <
final; ++i)
1535 stream <<
'\t' << nodes[i] + 1;
1541 template <
typename data>
1543 UcdStream::write_dataset(
const unsigned int index,
1544 const std::vector<data> &values)
1546 stream << index + 1;
1547 for (
unsigned int i = 0; i < values.size(); ++i)
1548 stream <<
'\t' << values[i];
1563 VtkStream::write_point(
const unsigned int,
const Point<dim> &p)
1568 for (
unsigned int i = dim; i < 3; ++i)
1577 VtkStream::write_cell(
unsigned int,
1583 stream << GeometryInfo<dim>::vertices_per_cell <<
'\t' << start;
1585 stream <<
'\t' << start + d1;
1589 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1592 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1593 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1602 VtkStream::write_high_order_cell(
const unsigned int,
1603 const unsigned int start,
1604 const std::vector<unsigned> &connectivity)
1606 stream << connectivity.size();
1607 for (
const auto &c : connectivity)
1608 stream <<
'\t' << start + c;
1619 VtuStream::write_point(
const unsigned int,
const Point<dim> &p)
1621 #if !defined(DEAL_II_WITH_ZLIB) 1625 for (
unsigned int i = dim; i < 3; ++i)
1630 for (
unsigned int i = 0; i < dim; ++i)
1631 vertices.push_back(p[i]);
1632 for (
unsigned int i = dim; i < 3; ++i)
1633 vertices.push_back(0);
1639 VtuStream::flush_points()
1641 #ifdef DEAL_II_WITH_ZLIB 1644 *
this << vertices <<
'\n';
1652 VtuStream::write_cell(
unsigned int,
1658 #if !defined(DEAL_II_WITH_ZLIB) 1662 stream <<
'\t' << start + d1;
1665 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1668 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1669 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1675 cells.push_back(start);
1678 cells.push_back(start + d1);
1681 cells.push_back(start + d2 + d1);
1682 cells.push_back(start + d2);
1685 cells.push_back(start + d3);
1686 cells.push_back(start + d3 + d1);
1687 cells.push_back(start + d3 + d2 + d1);
1688 cells.push_back(start + d3 + d2);
1697 VtuStream::write_high_order_cell(
const unsigned int,
1698 const unsigned int start,
1699 const std::vector<unsigned> &connectivity)
1701 #if !defined(DEAL_II_WITH_ZLIB) 1702 for (
const auto &c : connectivity)
1703 stream <<
'\t' << start + c;
1706 for (
const auto &c : connectivity)
1707 cells.push_back(start + c);
1712 VtuStream::flush_cells()
1714 #ifdef DEAL_II_WITH_ZLIB 1717 *
this << cells <<
'\n';
1723 template <
typename T>
1725 VtuStream::operator<<(const std::vector<T> &data)
1727 #ifdef DEAL_II_WITH_ZLIB 1730 write_compressed_block(data, flags, stream);
1732 for (
unsigned int i = 0; i < data.size(); ++i)
1733 stream << data[i] <<
' ';
1747 template <
int dim,
int spacedim>
1751 template <
int dim,
int spacedim>
1755 template <
int dim,
int spacedim>
1757 : patch_index(no_neighbor)
1759 , points_are_available(false)
1763 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
1764 neighbors[i] = no_neighbor;
1772 template <
int dim,
int spacedim>
1777 const double epsilon = 3e-16;
1778 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
1779 if (vertices[i].distance(patch.
vertices[i]) > epsilon)
1782 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
1795 if (data.n_rows() != patch.
data.n_rows())
1798 if (data.n_cols() != patch.
data.n_cols())
1801 for (
unsigned int i = 0; i < data.n_rows(); ++i)
1802 for (
unsigned int j = 0; j < data.n_cols(); ++j)
1803 if (data[i][j] != patch.
data[i][j])
1811 template <
int dim,
int spacedim>
1815 return (
sizeof(vertices) /
sizeof(vertices[0]) *
1817 sizeof(neighbors) /
sizeof(neighbors[0]) *
1827 template <
int dim,
int spacedim>
1835 data.swap(other_patch.
data);
1841 template <
int spacedim>
1845 template <
int spacedim>
1849 template <
int spacedim>
1853 template <
int spacedim>
1854 unsigned int Patch<0, spacedim>::n_subdivisions = 1;
1856 template <
int spacedim>
1858 : patch_index(no_neighbor)
1859 , points_are_available(false)
1866 template <
int spacedim>
1870 const unsigned int dim = 0;
1873 const double epsilon = 3e-16;
1874 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
1884 if (
data.n_rows() != patch.
data.n_rows())
1887 if (
data.n_cols() != patch.
data.n_cols())
1890 for (
unsigned int i = 0; i <
data.n_rows(); ++i)
1891 for (
unsigned int j = 0; j <
data.n_cols(); ++j)
1892 if (
data[i][j] != patch.
data[i][j])
1900 template <
int spacedim>
1912 template <
int spacedim>
1924 : write_preamble(write_preamble)
1939 : space_dimension_labels(labels)
1953 const bool bicubic_patch,
1954 const bool external_data)
1956 , bicubic_patch(bicubic_patch)
1957 , external_data(external_data)
1962 const bool xdmf_hdf5_output)
1963 : filter_duplicate_vertices(filter_duplicate_vertices)
1964 , xdmf_hdf5_output(xdmf_hdf5_output)
1972 "Filter duplicate vertices",
1975 "Whether to remove duplicate vertex values. deal.II duplicates " 1976 "vertices once for each adjacent cell so that it can output " 1977 "discontinuous quantities for which there may be more than one " 1978 "value for each vertex position. Setting this flag to " 1979 "'true' will merge all of these values by selecting a " 1980 "random one and outputting this as 'the' value for the vertex. " 1981 "As long as the data to be output corresponds to continuous " 1982 "fields, merging vertices has no effect. On the other hand, " 1983 "if the data to be output corresponds to discontinuous fields " 1984 "(either because you are using a discontinuous finite element, " 1985 "or because you are using a DataPostprocessor that yields " 1986 "discontinuous data, or because the data to be output has been " 1987 "produced by entirely different means), then the data in the " 1988 "output file no longer faithfully represents the underlying data " 1989 "because the discontinuous field has been replaced by a " 1990 "continuous one. Note also that the filtering can not occur " 1991 "on processor boundaries. Thus, a filtered discontinuous field " 1992 "looks like a continuous field inside of a subdomain, " 1993 "but like a discontinuous field at the subdomain boundary." 1995 "In any case, filtering results in drastically smaller output " 1996 "files (smaller by about a factor of 2^dim).");
2001 "Whether the data will be used in an XDMF/HDF5 combination.");
2016 const bool int_binary,
2017 const bool coordinates_binary,
2018 const bool data_binary)
2019 : write_neighbors(write_neighbors)
2020 , int_binary(int_binary)
2021 , coordinates_binary(coordinates_binary)
2022 , data_binary(data_binary)
2023 , data_double(false)
2033 "A boolean field indicating whether neighborship " 2034 "information between cells is to be written to the " 2035 "OpenDX output file");
2039 "Output format of integer numbers, which is " 2040 "either a text representation (ascii) or binary integer " 2041 "values of 32 or 64 bits length");
2045 "Output format of vertex coordinates, which is " 2046 "either a text representation (ascii) or binary " 2047 "floating point values of 32 or 64 bits length");
2051 "Output format of data values, which is " 2052 "either a text representation (ascii) or binary " 2053 "floating point values of 32 or 64 bits length");
2073 "A flag indicating whether a comment should be " 2074 "written to the beginning of the output file " 2075 "indicating date and time of creation as well " 2076 "as the creating program");
2090 const int azimuth_angle,
2091 const int polar_angle,
2092 const unsigned int line_thickness,
2094 const bool draw_colorbar)
2097 , height_vector(height_vector)
2098 , azimuth_angle(azimuth_angle)
2099 , polar_angle(polar_angle)
2100 , line_thickness(line_thickness)
2102 , draw_colorbar(draw_colorbar)
2113 "A flag indicating whether POVRAY should use smoothed " 2114 "triangles instead of the usual ones");
2118 "Whether POVRAY should use bicubic patches");
2122 "Whether camera and lighting information should " 2123 "be put into an external file \"data.inc\" or into " 2124 "the POVRAY input file");
2140 const unsigned int color_vector,
2142 const unsigned int size,
2143 const double line_width,
2144 const double azimut_angle,
2145 const double turn_angle,
2146 const double z_scaling,
2147 const bool draw_mesh,
2148 const bool draw_cells,
2149 const bool shade_cells,
2151 : height_vector(height_vector)
2152 , color_vector(color_vector)
2153 , size_type(size_type)
2155 , line_width(line_width)
2156 , azimut_angle(azimut_angle)
2157 , turn_angle(turn_angle)
2158 , z_scaling(z_scaling)
2159 , draw_mesh(draw_mesh)
2160 , draw_cells(draw_cells)
2161 , shade_cells(shade_cells)
2162 , color_function(color_function)
2201 double sum = xmax + xmin;
2202 double sum13 = xmin + 3 * xmax;
2203 double sum22 = 2 * xmin + 2 * xmax;
2204 double sum31 = 3 * xmin + xmax;
2205 double dif = xmax - xmin;
2206 double rezdif = 1.0 / dif;
2210 if (x < (sum31) / 4)
2212 else if (x < (sum22) / 4)
2214 else if (x < (sum13) / 4)
2225 rgb_values.green = 0;
2226 rgb_values.blue = (x - xmin) * 4. * rezdif;
2230 rgb_values.green = (4 * x - 3 * xmin - xmax) * rezdif;
2231 rgb_values.blue = (sum22 - 4. * x) * rezdif;
2234 rgb_values.red = (4 * x - 2 * sum) * rezdif;
2235 rgb_values.green = (xmin + 3 * xmax - 4 * x) * rezdif;
2236 rgb_values.blue = 0;
2240 rgb_values.green = (4 * x - xmin - 3 * xmax) * rezdif;
2241 rgb_values.blue = (4. * x - sum13) * rezdif;
2248 rgb_values.red = rgb_values.green = rgb_values.blue = 1;
2261 rgb_values.red = rgb_values.blue = rgb_values.green =
2262 (x - xmin) / (xmax - xmin);
2274 rgb_values.red = rgb_values.blue = rgb_values.green =
2275 1 - (x - xmin) / (xmax - xmin);
2282 EpsCell2d::operator<(
const EpsCell2d &e)
const 2285 return depth > e.depth;
2296 "Number of the input vector that is to be used to " 2297 "generate height information");
2301 "Number of the input vector that is to be used to " 2302 "generate color information");
2306 "Whether width or height should be scaled to match " 2311 "The size (width or height) to which the eps output " 2312 "file is to be scaled");
2316 "The width in which the postscript renderer is to " 2321 "Angle of the viewing position against the vertical " 2326 "Angle of the viewing direction against the y-axis");
2330 "Scaling for the z-direction relative to the scaling " 2331 "used in x- and y-directions");
2335 "Whether the mesh lines, or only the surface should be " 2340 "Whether only the mesh lines, or also the interior of " 2341 "cells should be plotted. If this flag is false, then " 2342 "one can see through the mesh");
2346 "Whether the interior of cells shall be shaded");
2350 "default|grey scale|reverse grey scale"),
2351 "Name of a color function used to colorize mesh lines " 2352 "and/or cell interiors");
2362 if (prm.
get(
"Scale to width or height") ==
"width")
2374 if (prm.
get(
"Color function") ==
"default")
2376 else if (prm.
get(
"Color function") ==
"grey scale")
2378 else if (prm.
get(
"Color function") ==
"reverse grey scale")
2389 const char * zone_name,
2390 const double solution_time)
2391 : tecplot_binary_file_name(tecplot_binary_file_name)
2392 , zone_name(zone_name)
2393 , solution_time(solution_time)
2401 return sizeof(*this) +
2409 const unsigned int cycle,
2410 const bool print_date_and_time,
2412 const bool write_higher_order_cells)
2415 , print_date_and_time(print_date_and_time)
2416 , compression_level(compression_level)
2417 , write_higher_order_cells(write_higher_order_cells)
2425 if (format_name ==
"none")
2428 if (format_name ==
"dx")
2431 if (format_name ==
"ucd")
2434 if (format_name ==
"gnuplot")
2437 if (format_name ==
"povray")
2440 if (format_name ==
"eps")
2443 if (format_name ==
"gmv")
2446 if (format_name ==
"tecplot")
2449 if (format_name ==
"tecplot_binary")
2452 if (format_name ==
"vtk")
2455 if (format_name ==
"vtu")
2458 if (format_name ==
"deal.II intermediate")
2461 if (format_name ==
"hdf5")
2465 ExcMessage(
"The given file format name is not recognized: <" +
2466 format_name +
">"));
2477 return "none|dx|ucd|gnuplot|povray|eps|gmv|tecplot|tecplot_binary|vtk|vtu|hdf5|svg|deal.II intermediate";
2485 switch (output_format)
2524 template <
int dim,
int spacedim,
typename StreamType>
2526 write_nodes(
const std::vector<Patch<dim, spacedim>> &patches, StreamType &out)
2529 unsigned int count = 0;
2531 for (
const auto &patch : patches)
2534 const unsigned int n = n_subdivisions + 1;
2537 const unsigned int n1 = (dim > 0) ? n : 1;
2538 const unsigned int n2 = (dim > 1) ? n : 1;
2539 const unsigned int n3 = (dim > 2) ? n : 1;
2541 for (
unsigned int i3 = 0; i3 < n3; ++i3)
2542 for (
unsigned int i2 = 0; i2 < n2; ++i2)
2543 for (
unsigned int i1 = 0; i1 < n1; ++i1)
2544 out.write_point(count++,
2545 compute_node(patch, i1, i2, i3, n_subdivisions));
2550 template <
int dim,
int spacedim,
typename StreamType>
2552 write_cells(
const std::vector<Patch<dim, spacedim>> &patches, StreamType &out)
2555 unsigned int count = 0;
2556 unsigned int first_vertex_of_patch = 0;
2557 for (
const auto &patch : patches)
2560 const unsigned int n = n_subdivisions + 1;
2562 const unsigned int n1 = (dim > 0) ? n_subdivisions : 1;
2563 const unsigned int n2 = (dim > 1) ? n_subdivisions : 1;
2564 const unsigned int n3 = (dim > 2) ? n_subdivisions : 1;
2566 const unsigned int d1 = 1;
2567 const unsigned int d2 = n;
2568 const unsigned int d3 = n * n;
2569 for (
unsigned int i3 = 0; i3 < n3; ++i3)
2570 for (
unsigned int i2 = 0; i2 < n2; ++i2)
2571 for (
unsigned int i1 = 0; i1 < n1; ++i1)
2573 const unsigned int offset =
2574 first_vertex_of_patch + i3 * d3 + i2 * d2 + i1 * d1;
2576 out.template write_cell<dim>(count++, offset, d1, d2, d3);
2579 first_vertex_of_patch +=
2580 Utilities::fixed_power<dim>(n_subdivisions + 1);
2586 template <
int dim,
int spacedim,
typename StreamType>
2588 write_high_order_cells(
const std::vector<Patch<dim, spacedim>> &patches,
2592 unsigned int first_vertex_of_patch = 0;
2593 unsigned int count = 0;
2595 std::vector<unsigned> connectivity;
2597 std::array<unsigned, dim> cell_order;
2599 for (
const auto &patch : patches)
2602 const unsigned int n = n_subdivisions + 1;
2604 cell_order.fill(n_subdivisions);
2605 connectivity.resize(Utilities::fixed_power<dim>(n));
2608 const unsigned int n1 = (dim > 0) ? n_subdivisions : 0;
2609 const unsigned int n2 = (dim > 1) ? n_subdivisions : 0;
2610 const unsigned int n3 = (dim > 2) ? n_subdivisions : 0;
2612 const unsigned int d1 = 1;
2613 const unsigned int d2 = n;
2614 const unsigned int d3 = n * n;
2615 for (
unsigned int i3 = 0; i3 <= n3; ++i3)
2616 for (
unsigned int i2 = 0; i2 <= n2; ++i2)
2617 for (
unsigned int i1 = 0; i1 <= n1; ++i1)
2619 const unsigned int local_index = i3 * d3 + i2 * d2 + i1 * d1;
2620 const unsigned int connectivity_index =
2621 vtk_point_index_from_ijk(i1, i2, i3, cell_order);
2622 connectivity[connectivity_index] = local_index;
2625 out.template write_high_order_cell<dim>(count++,
2626 first_vertex_of_patch,
2630 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
2637 template <
int dim,
int spacedim,
class StreamType>
2639 write_data(
const std::vector<Patch<dim, spacedim>> &patches,
2640 unsigned int n_data_sets,
2641 const bool double_precision,
2645 unsigned int count = 0;
2647 for (
const auto &patch : patches)
2650 const unsigned int n = n_subdivisions + 1;
2652 Assert((patch.
data.n_rows() == n_data_sets &&
2654 (patch.
data.n_rows() == n_data_sets + spacedim &&
2657 (n_data_sets + spacedim) :
2659 patch.
data.n_rows()));
2660 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
2663 std::vector<float> floats(n_data_sets);
2664 std::vector<double> doubles(n_data_sets);
2667 for (
unsigned int i = 0; i < Utilities::fixed_power<dim>(n);
2669 if (double_precision)
2671 for (
unsigned int data_set = 0; data_set < n_data_sets;
2673 doubles[data_set] = patch.
data(data_set, i);
2674 out.write_dataset(count, doubles);
2678 for (
unsigned int data_set = 0; data_set < n_data_sets;
2680 floats[data_set] = patch.
data(data_set, i);
2681 out.write_dataset(count, floats);
2705 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
2706 camera_horizontal[2] * camera_direction[1];
2707 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
2708 camera_horizontal[0] * camera_direction[2];
2709 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
2710 camera_horizontal[1] * camera_direction[0];
2714 phi /= (
point[0] - camera_position[0]) * camera_direction[0] +
2715 (point[1] - camera_position[1]) * camera_direction[1] +
2716 (
point[2] - camera_position[2]) * camera_direction[2];
2720 camera_position[0] + phi * (
point[0] - camera_position[0]);
2722 camera_position[1] + phi * (
point[1] - camera_position[1]);
2724 camera_position[2] + phi * (
point[2] - camera_position[2]);
2727 projection_decomposition[0] = (projection[0] - camera_position[0] -
2728 camera_focus * camera_direction[0]) *
2729 camera_horizontal[0];
2730 projection_decomposition[0] += (projection[1] - camera_position[1] -
2731 camera_focus * camera_direction[1]) *
2732 camera_horizontal[1];
2733 projection_decomposition[0] += (projection[2] - camera_position[2] -
2734 camera_focus * camera_direction[2]) *
2735 camera_horizontal[2];
2737 projection_decomposition[1] = (projection[0] - camera_position[0] -
2738 camera_focus * camera_direction[0]) *
2740 projection_decomposition[1] += (projection[1] - camera_position[1] -
2741 camera_focus * camera_direction[1]) *
2743 projection_decomposition[1] += (projection[2] - camera_position[2] -
2744 camera_focus * camera_direction[2]) *
2747 return projection_decomposition;
2761 for (
int i = 0; i < 2; ++i)
2763 for (
int j = 0; j < 2 - i; ++j)
2765 if (points[j][2] > points[j + 1][2])
2768 points[j] = points[j + 1];
2769 points[j + 1] = temp;
2776 v_inter = points[1];
2783 A[0][0] = v_max[0] - v_min[0];
2784 A[0][1] = v_inter[0] - v_min[0];
2785 A[1][0] = v_max[1] - v_min[1];
2786 A[1][1] = v_inter[1] - v_min[1];
2792 bool col_change =
false;
2801 double temp = A[1][0];
2806 for (
unsigned int k = 0; k < 1; k++)
2808 for (
unsigned int i = k + 1; i < 2; i++)
2810 x = A[i][k] / A[k][k];
2812 for (
unsigned int j = k + 1; j < 2; j++)
2813 A[i][j] = A[i][j] - A[k][j] * x;
2815 b[i] =
b[i] -
b[k] * x;
2819 b[1] =
b[1] / A[1][1];
2821 for (
int i = 0; i >= 0; i--)
2825 for (
unsigned int j = i + 1; j < 2; j++)
2826 sum = sum - A[i][j] * b[j];
2828 b[i] =
sum / A[i][i];
2838 double c =
b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) +
2842 A[0][0] = v_max[0] - v_min[0];
2843 A[0][1] = v_inter[0] - v_min[0];
2844 A[1][0] = v_max[1] - v_min[1];
2845 A[1][1] = v_inter[1] - v_min[1];
2847 b[0] = 1.0 - v_min[0];
2859 double temp = A[1][0];
2864 for (
unsigned int k = 0; k < 1; k++)
2866 for (
unsigned int i = k + 1; i < 2; i++)
2868 x = A[i][k] / A[k][k];
2870 for (
unsigned int j = k + 1; j < 2; j++)
2871 A[i][j] = A[i][j] - A[k][j] * x;
2873 b[i] =
b[i] -
b[k] * x;
2877 b[1] =
b[1] / A[1][1];
2879 for (
int i = 0; i >= 0; i--)
2883 for (
unsigned int j = i + 1; j < 2; j++)
2884 sum = sum - A[i][j] * b[j];
2886 b[i] =
sum / A[i][i];
2896 gradient[0] =
b[0] * (v_max[2] - v_min[2]) +
2897 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
2900 A[0][0] = v_max[0] - v_min[0];
2901 A[0][1] = v_inter[0] - v_min[0];
2902 A[1][0] = v_max[1] - v_min[1];
2903 A[1][1] = v_inter[1] - v_min[1];
2906 b[1] = 1.0 - v_min[1];
2917 double temp = A[1][0];
2922 for (
unsigned int k = 0; k < 1; k++)
2924 for (
unsigned int i = k + 1; i < 2; i++)
2926 x = A[i][k] / A[k][k];
2928 for (
unsigned int j = k + 1; j < 2; j++)
2929 A[i][j] = A[i][j] - A[k][j] * x;
2931 b[i] =
b[i] -
b[k] * x;
2935 b[1] =
b[1] / A[1][1];
2937 for (
int i = 0; i >= 0; i--)
2941 for (
unsigned int j = i + 1; j < 2; j++)
2942 sum = sum - A[i][j] * b[j];
2944 b[i] =
sum / A[i][i];
2954 gradient[1] =
b[0] * (v_max[2] - v_min[2]) +
2955 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
2958 double gradient_norm =
2959 std::sqrt(std::pow(gradient[0], 2.0) + std::pow(gradient[1], 2.0));
2960 gradient[0] /= gradient_norm;
2961 gradient[1] /= gradient_norm;
2963 double lambda = -gradient[0] * (v_min[0] - v_max[0]) -
2964 gradient[1] * (v_min[1] - v_max[1]);
2968 gradient_parameters[0] = v_min[0];
2969 gradient_parameters[1] = v_min[1];
2971 gradient_parameters[2] = v_min[0] + lambda * gradient[0];
2972 gradient_parameters[3] = v_min[1] + lambda * gradient[1];
2974 gradient_parameters[4] = v_min[2];
2975 gradient_parameters[5] = v_max[2];
2977 return gradient_parameters;
2983 template <
int dim,
int spacedim>
2987 const std::vector<std::string> & data_names,
2988 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
2996 std::tuple<
unsigned int,
3006 template <
int dim,
int spacedim>
3010 const std::vector<std::string> & data_names,
3012 std::tuple<
unsigned int,
3025 #ifndef DEAL_II_WITH_MPI 3034 if (patches.size() == 0)
3038 const unsigned int n_data_sets = data_names.size();
3040 UcdStream ucd_out(out, flags);
3043 unsigned int n_nodes;
3044 unsigned int n_cells;
3045 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
3051 <<
"# This file was generated by the deal.II library." <<
'\n' 3055 <<
"# For a description of the UCD format see the AVS Developer's guide." 3061 out << n_nodes <<
' ' << n_cells <<
' ' << n_data_sets <<
' ' << 0
3066 write_nodes(patches, ucd_out);
3069 write_cells(patches, ucd_out);
3074 if (n_data_sets != 0)
3076 out << n_data_sets <<
" ";
3077 for (
unsigned int i = 0; i < n_data_sets; ++i)
3082 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3083 out << data_names[data_set]
3087 write_data(patches, n_data_sets,
true, ucd_out);
3098 template <
int dim,
int spacedim>
3102 const std::vector<std::string> & data_names,
3103 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3111 std::tuple<
unsigned int,
3121 template <
int dim,
int spacedim>
3125 const std::vector<std::string> & data_names,
3127 std::tuple<
unsigned int,
3139 #ifndef DEAL_II_WITH_MPI 3148 if (patches.size() == 0)
3152 DXStream dx_out(out, flags);
3155 unsigned int offset = 0;
3157 const unsigned int n_data_sets = data_names.size();
3160 unsigned int n_nodes;
3161 unsigned int n_cells;
3162 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
3164 out <<
"object \"vertices\" class array type float rank 1 shape " 3165 << spacedim <<
" items " << n_nodes;
3169 out <<
" lsb ieee data 0" <<
'\n';
3170 offset += n_nodes * spacedim *
sizeof(float);
3174 out <<
" data follows" <<
'\n';
3175 write_nodes(patches, dx_out);
3183 out <<
"object \"cells\" class array type int rank 1 shape " 3188 out <<
" lsb binary data " << offset <<
'\n';
3189 offset += n_cells *
sizeof(int);
3193 out <<
" data follows" <<
'\n';
3194 write_cells(patches, dx_out);
3199 out <<
"attribute \"element type\" string \"";
3206 out <<
"\"" <<
'\n' <<
"attribute \"ref\" string \"positions\"" <<
'\n';
3213 out <<
"object \"neighbors\" class array type int rank 1 shape " 3217 for (
const auto &patch : patches)
3220 const unsigned int n1 = (dim > 0) ? n : 1;
3221 const unsigned int n2 = (dim > 1) ? n : 1;
3222 const unsigned int n3 = (dim > 2) ? n : 1;
3223 unsigned int cells_per_patch = Utilities::fixed_power<dim>(n);
3224 unsigned int dx = 1;
3225 unsigned int dy = n;
3226 unsigned int dz = n * n;
3228 const unsigned int patch_start =
3231 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3232 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3233 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3235 const unsigned int nx = i1 *
dx;
3236 const unsigned int ny = i2 * dy;
3237 const unsigned int nz = i3 * dz;
3249 const unsigned int nn = patch.
neighbors[0];
3253 << (nn * cells_per_patch + ny + nz +
dx * (n - 1));
3259 out <<
'\t' << patch_start + nx -
dx + ny + nz;
3264 const unsigned int nn = patch.
neighbors[1];
3267 out << (nn * cells_per_patch + ny + nz);
3273 out <<
'\t' << patch_start + nx +
dx + ny + nz;
3280 const unsigned int nn = patch.
neighbors[2];
3284 << (nn * cells_per_patch + nx + nz + dy * (n - 1));
3290 out <<
'\t' << patch_start + nx + ny - dy + nz;
3295 const unsigned int nn = patch.
neighbors[3];
3298 out << (nn * cells_per_patch + nx + nz);
3304 out <<
'\t' << patch_start + nx + ny + dy + nz;
3312 const unsigned int nn = patch.
neighbors[4];
3316 << (nn * cells_per_patch + nx + ny + dz * (n - 1));
3322 out <<
'\t' << patch_start + nx + ny + nz - dz;
3327 const unsigned int nn = patch.
neighbors[5];
3330 out << (nn * cells_per_patch + nx + ny);
3336 out <<
'\t' << patch_start + nx + ny + nz + dz;
3344 if (n_data_sets != 0)
3346 out <<
"object \"data\" class array type float rank 1 shape " 3347 << n_data_sets <<
" items " << n_nodes;
3351 out <<
" lsb ieee data " << offset <<
'\n';
3352 offset += n_data_sets * n_nodes *
3353 ((flags.
data_double) ?
sizeof(
double) :
sizeof(float));
3357 out <<
" data follows" <<
'\n';
3358 write_data(patches, n_data_sets, flags.
data_double, dx_out);
3362 out <<
"attribute \"dep\" string \"positions\"" <<
'\n';
3366 out <<
"object \"data\" class constantarray type float rank 0 items " 3367 << n_nodes <<
" data follows" <<
'\n' 3373 out <<
"object \"deal data\" class field" <<
'\n' 3374 <<
"component \"positions\" value \"vertices\"" <<
'\n' 3375 <<
"component \"connections\" value \"cells\"" <<
'\n' 3376 <<
"component \"data\" value \"data\"" <<
'\n';
3379 out <<
"component \"neighbors\" value \"neighbors\"" <<
'\n';
3386 out <<
"end" <<
'\n';
3389 write_nodes(patches, dx_out);
3391 write_cells(patches, dx_out);
3393 write_data(patches, n_data_sets, flags.
data_double, dx_out);
3404 template <
int dim,
int spacedim>
3408 const std::vector<std::string> & data_names,
3409 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3417 std::tuple<
unsigned int,
3427 template <
int dim,
int spacedim>
3431 const std::vector<std::string> & data_names,
3433 std::tuple<
unsigned int,
3442 #ifndef DEAL_II_WITH_MPI 3452 if (patches.size() == 0)
3456 const unsigned int n_data_sets = data_names.size();
3460 out <<
"# This file was generated by the deal.II library." <<
'\n' 3464 <<
"# For a description of the GNUPLOT format see the GNUPLOT manual." 3471 for (
unsigned int spacedim_n = 0; spacedim_n < spacedim; ++spacedim_n)
3476 for (
const auto &data_name : data_names)
3477 out <<
'<' << data_name <<
"> ";
3483 for (
const auto &patch : patches)
3486 const unsigned int n = n_subdivisions + 1;
3488 const unsigned int n1 = (dim > 0) ? n : 1;
3489 const unsigned int n2 = (dim > 1) ? n : 1;
3490 const unsigned int n3 = (dim > 2) ? n : 1;
3491 unsigned int d1 = 1;
3492 unsigned int d2 = n;
3493 unsigned int d3 = n * n;
3495 Assert((patch.
data.n_rows() == n_data_sets &&
3497 (patch.
data.n_rows() == n_data_sets + spacedim &&
3500 (n_data_sets + spacedim) :
3502 patch.
data.n_rows()));
3503 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
3509 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3511 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3514 out << compute_node(patch, i1, i2, 0, n_subdivisions)
3517 for (
unsigned int data_set = 0; data_set < n_data_sets;
3519 out << patch.
data(data_set, i1 * d1 + i2 * d2) <<
' ';
3535 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3536 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3537 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3541 compute_node(patch, i1, i2, i3, n_subdivisions);
3543 if (i1 < n_subdivisions)
3547 for (
unsigned int data_set = 0; data_set < n_data_sets;
3550 << patch.
data(data_set,
3551 i1 * d1 + i2 * d2 + i3 * d3);
3555 out << compute_node(
3556 patch, i1 + 1, i2, i3, n_subdivisions);
3558 for (
unsigned int data_set = 0; data_set < n_data_sets;
3561 << patch.
data(data_set,
3562 (i1 + 1) * d1 + i2 * d2 + i3 * d3);
3566 out <<
'\n' <<
'\n';
3570 if (i2 < n_subdivisions)
3574 for (
unsigned int data_set = 0; data_set < n_data_sets;
3577 << patch.
data(data_set,
3578 i1 * d1 + i2 * d2 + i3 * d3);
3582 out << compute_node(
3583 patch, i1, i2 + 1, i3, n_subdivisions);
3585 for (
unsigned int data_set = 0; data_set < n_data_sets;
3588 << patch.
data(data_set,
3589 i1 * d1 + (i2 + 1) * d2 + i3 * d3);
3593 out <<
'\n' <<
'\n';
3597 if (i3 < n_subdivisions)
3601 for (
unsigned int data_set = 0; data_set < n_data_sets;
3604 << patch.
data(data_set,
3605 i1 * d1 + i2 * d2 + i3 * d3);
3609 out << compute_node(
3610 patch, i1, i2, i3 + 1, n_subdivisions);
3612 for (
unsigned int data_set = 0; data_set < n_data_sets;
3615 << patch.
data(data_set,
3616 i1 * d1 + i2 * d2 + (i3 + 1) * d3);
3619 out <<
'\n' <<
'\n';
3634 template <
int dim,
int spacedim>
3638 const std::vector<std::string> & data_names,
3639 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3647 std::tuple<
unsigned int,
3657 template <
int dim,
int spacedim>
3661 const std::vector<std::string> & data_names,
3663 std::tuple<
unsigned int,
3672 #ifndef DEAL_II_WITH_MPI 3681 if (patches.size() == 0)
3688 const unsigned int n_data_sets = data_names.size();
3693 out <<
"/* This file was generated by the deal.II library." <<
'\n' 3697 <<
" For a description of the POVRAY format see the POVRAY manual." 3702 out <<
"#include \"colors.inc\" " <<
'\n' 3703 <<
"#include \"textures.inc\" " <<
'\n';
3708 out <<
"#include \"data.inc\" " <<
'\n';
3714 <<
"camera {" <<
'\n' 3715 <<
" location <1,4,-7>" <<
'\n' 3716 <<
" look_at <0,0,0>" <<
'\n' 3717 <<
" angle 30" <<
'\n' 3722 <<
"light_source {" <<
'\n' 3723 <<
" <1,4,-7>" <<
'\n' 3724 <<
" color Grey" <<
'\n' 3727 <<
"light_source {" <<
'\n' 3728 <<
" <0,20,0>" <<
'\n' 3729 <<
" color White" <<
'\n' 3736 double hmin = patches[0].data(0, 0);
3737 double hmax = patches[0].data(0, 0);
3739 for (
const auto &patch : patches)
3743 Assert((patch.
data.n_rows() == n_data_sets &&
3745 (patch.
data.n_rows() == n_data_sets + spacedim &&
3748 (n_data_sets + spacedim) :
3750 patch.
data.n_rows()));
3752 Utilities::fixed_power<dim>(n_subdivisions + 1),
3755 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
3756 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
3758 const int dl = i * (n_subdivisions + 1) + j;
3759 if (patch.
data(0, dl) < hmin)
3760 hmin = patch.
data(0, dl);
3761 if (patch.
data(0, dl) > hmax)
3762 hmax = patch.
data(0, dl);
3766 out <<
"#declare HMIN=" << hmin <<
";" <<
'\n' 3767 <<
"#declare HMAX=" << hmax <<
";" <<
'\n' 3773 out <<
"#declare Tex=texture{" <<
'\n' 3774 <<
" pigment {" <<
'\n' 3775 <<
" gradient y" <<
'\n' 3776 <<
" scale y*(HMAX-HMIN)*" << 0.1 <<
'\n' 3777 <<
" color_map {" <<
'\n' 3778 <<
" [0.00 color Light_Purple] " <<
'\n' 3779 <<
" [0.95 color Light_Purple] " <<
'\n' 3780 <<
" [1.00 color White] " <<
'\n' 3788 out <<
'\n' <<
"mesh {" <<
'\n';
3792 for (
const auto &patch : patches)
3795 const unsigned int n = n_subdivisions + 1;
3796 const unsigned int d1 = 1;
3797 const unsigned int d2 = n;
3799 Assert((patch.
data.n_rows() == n_data_sets &&
3801 (patch.
data.n_rows() == n_data_sets + spacedim &&
3804 (n_data_sets + spacedim) :
3806 patch.
data.n_rows()));
3807 Assert(patch.
data.n_cols() == Utilities::fixed_power<dim>(n),
3811 std::vector<Point<spacedim>> ver(n * n);
3813 for (
unsigned int i2 = 0; i2 < n; ++i2)
3814 for (
unsigned int i1 = 0; i1 < n; ++i1)
3817 ver[i1 * d1 + i2 * d2] =
3818 compute_node(patch, i1, i2, 0, n_subdivisions);
3825 std::vector<Point<3>> nrml;
3835 for (
unsigned int i = 0; i < n; ++i)
3836 for (
unsigned int j = 0; j < n; ++j)
3838 const unsigned int il = (i == 0) ? i : (i - 1);
3839 const unsigned int ir =
3840 (i == n_subdivisions) ? i : (i + 1);
3841 const unsigned int jl = (j == 0) ? j : (j - 1);
3842 const unsigned int jr =
3843 (j == n_subdivisions) ? j : (j + 1);
3846 ver[ir * d1 + j * d2](0) - ver[il * d1 + j * d2](0);
3847 h1(1) = patch.
data(0, ir * d1 + j * d2) -
3848 patch.
data(0, il * d1 + j * d2);
3850 ver[ir * d1 + j * d2](1) - ver[il * d1 + j * d2](1);
3853 ver[i * d1 + jr * d2](0) - ver[i * d1 + jl * d2](0);
3854 h2(1) = patch.
data(0, i * d1 + jr * d2) -
3855 patch.
data(0, i * d1 + jl * d2);
3857 ver[i * d1 + jr * d2](1) - ver[i * d1 + jl * d2](1);
3859 nrml[i * d1 + j * d2](0) = h1(1) * h2(2) - h1(2) * h2(1);
3860 nrml[i * d1 + j * d2](1) = h1(2) * h2(0) - h1(0) * h2(2);
3861 nrml[i * d1 + j * d2](2) = h1(0) * h2(1) - h1(1) * h2(0);
3865 std::sqrt(std::pow(nrml[i * d1 + j * d2](0), 2.) +
3866 std::pow(nrml[i * d1 + j * d2](1), 2.) +
3867 std::pow(nrml[i * d1 + j * d2](2), 2.));
3869 if (nrml[i * d1 + j * d2](1) < 0)
3872 for (
unsigned int k = 0; k < 3; ++k)
3873 nrml[i * d1 + j * d2](k) /= norm;
3878 for (
unsigned int i = 0; i < n_subdivisions; ++i)
3879 for (
unsigned int j = 0; j < n_subdivisions; ++j)
3882 const int dl = i * d1 + j * d2;
3888 out <<
"smooth_triangle {" <<
'\n' 3889 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
3890 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0) <<
", " 3891 << nrml[dl](1) <<
", " << nrml[dl](2) <<
">," <<
'\n';
3892 out <<
" \t<" << ver[dl + d1](0) <<
"," 3893 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
3894 <<
">, <" << nrml[dl + d1](0) <<
", " 3895 << nrml[dl + d1](1) <<
", " << nrml[dl + d1](2)
3897 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3898 << patch.
data(0, dl + d1 + d2) <<
"," 3899 << ver[dl + d1 + d2](1) <<
">, <" 3900 << nrml[dl + d1 + d2](0) <<
", " 3901 << nrml[dl + d1 + d2](1) <<
", " 3902 << nrml[dl + d1 + d2](2) <<
">}" <<
'\n';
3905 out <<
"smooth_triangle {" <<
'\n' 3906 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
3907 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0) <<
", " 3908 << nrml[dl](1) <<
", " << nrml[dl](2) <<
">," <<
'\n';
3909 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3910 << patch.
data(0, dl + d1 + d2) <<
"," 3911 << ver[dl + d1 + d2](1) <<
">, <" 3912 << nrml[dl + d1 + d2](0) <<
", " 3913 << nrml[dl + d1 + d2](1) <<
", " 3914 << nrml[dl + d1 + d2](2) <<
">," <<
'\n';
3915 out <<
"\t<" << ver[dl + d2](0) <<
"," 3916 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
3917 <<
">, <" << nrml[dl + d2](0) <<
", " 3918 << nrml[dl + d2](1) <<
", " << nrml[dl + d2](2)
3924 out <<
"triangle {" <<
'\n' 3925 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
3926 <<
"," << ver[dl](1) <<
">," <<
'\n';
3927 out <<
"\t<" << ver[dl + d1](0) <<
"," 3928 << patch.
data(0, dl + d1) <<
"," << ver[dl + d1](1)
3930 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3931 << patch.
data(0, dl + d1 + d2) <<
"," 3932 << ver[dl + d1 + d2](1) <<
">}" <<
'\n';
3935 out <<
"triangle {" <<
'\n' 3936 <<
"\t<" << ver[dl](0) <<
"," << patch.
data(0, dl)
3937 <<
"," << ver[dl](1) <<
">," <<
'\n';
3938 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3939 << patch.
data(0, dl + d1 + d2) <<
"," 3940 << ver[dl + d1 + d2](1) <<
">," <<
'\n';
3941 out <<
"\t<" << ver[dl + d2](0) <<
"," 3942 << patch.
data(0, dl + d2) <<
"," << ver[dl + d2](1)
3950 Assert(n_subdivisions == 3,
3953 <<
"bicubic_patch {" <<
'\n' 3954 <<
" type 0" <<
'\n' 3955 <<
" flatness 0" <<
'\n' 3956 <<
" u_steps 0" <<
'\n' 3957 <<
" v_steps 0" <<
'\n';
3958 for (
int i = 0; i < 16; ++i)
3960 out <<
"\t<" << ver[i](0) <<
"," << patch.
data(0, i) <<
"," 3961 << ver[i](1) <<
">";
3966 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n';
3973 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n' <<
'\n';
3984 template <
int dim,
int spacedim>
3988 const std::vector<std::string> & ,
3989 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3999 template <
int dim,
int spacedim>
4003 const std::vector<std::string> & ,
4005 std::tuple<
unsigned int,
4018 template <
int spacedim>
4022 const std::vector<std::string> & data_names,
4023 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
4031 std::tuple<
unsigned int,
4041 template <
int spacedim>
4045 const std::vector<std::string> & ,
4047 std::tuple<
unsigned int,
4056 #ifndef DEAL_II_WITH_MPI 4065 if (patches.size() == 0)
4075 std::multiset<EpsCell2d> cells;
4079 float min_color_value = std::numeric_limits<float>::max();
4080 float max_color_value = std::numeric_limits<float>::min();
4084 double heights[4] = {0, 0, 0, 0};
4088 for (
const auto &patch : patches)
4091 const unsigned int n = n_subdivisions + 1;
4092 const unsigned int d1 = 1;
4093 const unsigned int d2 = n;
4095 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
4096 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
4099 points[0] = compute_node(patch, i1, i2, 0, n_subdivisions);
4100 points[1] = compute_node(patch, i1 + 1, i2, 0, n_subdivisions);
4101 points[2] = compute_node(patch, i1, i2 + 1, 0, n_subdivisions);
4103 compute_node(patch, i1 + 1, i2 + 1, 0, n_subdivisions);
4109 patch.
data.n_rows() == 0,
4112 patch.
data.n_rows()));
4114 patch.
data.n_rows() != 0 ?
4118 heights[1] = patch.
data.n_rows() != 0 ?
4120 (i1 + 1) * d1 + i2 * d2) *
4123 heights[2] = patch.
data.n_rows() != 0 ?
4125 i1 * d1 + (i2 + 1) * d2) *
4128 heights[3] = patch.
data.n_rows() != 0 ?
4130 (i1 + 1) * d1 + (i2 + 1) * d2) *
4137 for (
unsigned int i = 0; i < 4; ++i)
4138 heights[i] = points[i](2);
4159 cz = -std::cos(flags.
turn_angle * 2 * pi / 360.),
4162 sz = std::sin(flags.
turn_angle * 2 * pi / 360.);
4163 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4165 const double x = points[vertex](0), y = points[vertex](1),
4166 z = -heights[vertex];
4168 eps_cell.vertices[vertex](0) = -cz * x + sz * y;
4169 eps_cell.vertices[vertex](1) =
4170 -cx * sz * x - cx * cz * y - sx * z;
4194 (points[0] + points[1] + points[2] + points[3]) / 4;
4195 const double center_height =
4196 -(heights[0] + heights[1] + heights[2] + heights[3]) / 4;
4199 eps_cell.depth = -sx * sz * center_point(0) -
4200 sx * cz * center_point(1) + cx * center_height;
4205 patch.
data.n_rows() == 0,
4208 patch.
data.n_rows()));
4209 const double color_values[4] = {
4210 patch.
data.n_rows() != 0 ?
4214 patch.
data.n_rows() != 0 ?
4218 patch.
data.n_rows() != 0 ?
4222 patch.
data.n_rows() != 0 ?
4224 (i1 + 1) * d1 + (i2 + 1) * d2) :
4228 eps_cell.color_value = (color_values[0] + color_values[1] +
4229 color_values[3] + color_values[2]) /
4234 std::min(min_color_value, eps_cell.color_value);
4236 std::max(max_color_value, eps_cell.color_value);
4240 cells.insert(eps_cell);
4246 double x_min = cells.begin()->vertices[0](0);
4247 double x_max = x_min;
4248 double y_min = cells.begin()->vertices[0](1);
4249 double y_max = y_min;
4251 for (
const auto &cell : cells)
4252 for (
const auto &vertex : cell.vertices)
4254 x_min = std::min(x_min, vertex(0));
4255 x_max = std::max(x_max, vertex(0));
4256 y_min = std::min(y_min, vertex(1));
4257 y_max = std::max(y_max, vertex(1));
4262 const double scale =
4266 const Point<2> offset(x_min, y_min);
4271 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n' 4272 <<
"%%Title: deal.II Output" <<
'\n' 4273 <<
"%%Creator: the deal.II library" <<
'\n' 4276 <<
"%%BoundingBox: " 4280 <<
static_cast<unsigned int>((x_max - x_min) *
scale + 0.5) <<
' ' 4281 <<
static_cast<unsigned int>((y_max - y_min) *
scale + 0.5) <<
'\n';
4290 out <<
"/m {moveto} bind def" <<
'\n' 4291 <<
"/l {lineto} bind def" <<
'\n' 4292 <<
"/s {setrgbcolor} bind def" <<
'\n' 4293 <<
"/sg {setgray} bind def" <<
'\n' 4294 <<
"/lx {lineto closepath stroke} bind def" <<
'\n' 4295 <<
"/lf {lineto closepath fill} bind def" <<
'\n';
4297 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4299 out << flags.
line_width <<
" setlinewidth" <<
'\n';
4307 if (max_color_value == min_color_value)
4308 max_color_value = min_color_value + 1;
4312 for (
const auto &cell : cells)
4325 out << rgb_values.red <<
" sg ";
4327 out << rgb_values.red <<
' ' << rgb_values.green <<
' ' 4328 << rgb_values.blue <<
" s ";
4333 out << (cell.vertices[0] - offset) *
scale <<
" m " 4334 << (cell.vertices[1] - offset) *
scale <<
" l " 4335 << (cell.vertices[3] - offset) *
scale <<
" l " 4336 << (cell.vertices[2] - offset) *
scale <<
" lf" <<
'\n';
4341 << (cell.vertices[0] - offset) *
scale <<
" m " 4342 << (cell.vertices[1] - offset) *
scale <<
" l " 4343 << (cell.vertices[3] - offset) *
scale <<
" l " 4344 << (cell.vertices[2] - offset) *
scale <<
" lx" <<
'\n';
4346 out <<
"showpage" <<
'\n';
4355 template <
int dim,
int spacedim>
4359 const std::vector<std::string> & data_names,
4360 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
4368 std::tuple<
unsigned int,
4378 template <
int dim,
int spacedim>
4382 const std::vector<std::string> & data_names,
4384 std::tuple<
unsigned int,
4400 #ifndef DEAL_II_WITH_MPI 4409 if (patches.size() == 0)
4413 GmvStream gmv_out(out, flags);
4414 const unsigned int n_data_sets = data_names.size();
4417 Assert((patches[0].data.n_rows() == n_data_sets &&
4418 !patches[0].points_are_available) ||
4419 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4420 patches[0].points_are_available),
4422 (n_data_sets + spacedim) :
4424 patches[0].data.n_rows()));
4428 out <<
"gmvinput ascii" <<
'\n' <<
'\n';
4431 unsigned int n_nodes;
4432 unsigned int n_cells;
4433 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4448 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
4450 &write_gmv_reorder_data_vectors<dim, spacedim>;
4458 out <<
"nodes " << n_nodes <<
'\n';
4459 for (
unsigned int d = 0; d < spacedim; ++d)
4461 gmv_out.selected_component = d;
4462 write_nodes(patches, gmv_out);
4467 for (
unsigned int d = spacedim; d < 3; ++d)
4469 for (
unsigned int i = 0; i < n_nodes; ++i)
4476 out <<
"cells " << n_cells <<
'\n';
4477 write_cells(patches, gmv_out);
4481 out <<
"variable" <<
'\n';
4485 reorder_task.
join();
4489 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4491 out << data_names[data_set] <<
" 1" <<
'\n';
4492 std::copy(data_vectors[data_set].begin(),
4493 data_vectors[data_set].end(),
4494 std::ostream_iterator<double>(out,
" "));
4495 out <<
'\n' <<
'\n';
4501 out <<
"endvars" <<
'\n';
4504 out <<
"endgmv" <<
'\n';
4515 template <
int dim,
int spacedim>
4519 const std::vector<std::string> & data_names,
4520 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
4528 std::tuple<
unsigned int,
4538 template <
int dim,
int spacedim>
4542 const std::vector<std::string> & data_names,
4544 std::tuple<
unsigned int,
4558 #ifndef DEAL_II_WITH_MPI 4567 if (patches.size() == 0)
4571 TecplotStream tecplot_out(out, flags);
4573 const unsigned int n_data_sets = data_names.size();
4576 Assert((patches[0].data.n_rows() == n_data_sets &&
4577 !patches[0].points_are_available) ||
4578 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4579 patches[0].points_are_available),
4581 (n_data_sets + spacedim) :
4583 patches[0].data.n_rows()));
4586 unsigned int n_nodes;
4587 unsigned int n_cells;
4588 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4594 <<
"# This file was generated by the deal.II library." <<
'\n' 4598 <<
"# For a description of the Tecplot format see the Tecplot documentation." 4603 out <<
"Variables=";
4611 out <<
"\"x\", \"y\"";
4614 out <<
"\"x\", \"y\", \"z\"";
4620 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4621 out <<
", \"" << data_names[data_set] <<
"\"";
4627 out <<
"t=\"" << flags.
zone_name <<
"\" ";
4630 out <<
"strandid=1, solutiontime=" << flags.
solution_time <<
", ";
4632 out <<
"f=feblock, n=" << n_nodes <<
", e=" << n_cells
4633 <<
", et=" << tecplot_cell_type[dim] <<
'\n';
4652 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
4654 &write_gmv_reorder_data_vectors<dim, spacedim>;
4662 for (
unsigned int d = 0; d < spacedim; ++d)
4664 tecplot_out.selected_component = d;
4665 write_nodes(patches, tecplot_out);
4675 reorder_task.
join();
4678 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4680 std::copy(data_vectors[data_set].begin(),
4681 data_vectors[data_set].end(),
4682 std::ostream_iterator<double>(out,
"\n"));
4686 write_cells(patches, tecplot_out);
4700 #ifdef DEAL_II_HAVE_TECPLOT 4707 TecplotMacros(
const unsigned int n_nodes = 0,
4708 const unsigned int n_vars = 0,
4709 const unsigned int n_cells = 0,
4710 const unsigned int n_vert = 0);
4713 nd(
const unsigned int i,
const unsigned int j);
4715 cd(
const unsigned int i,
const unsigned int j);
4716 std::vector<float> nodalData;
4717 std::vector<int> connData;
4720 unsigned int n_nodes;
4721 unsigned int n_vars;
4722 unsigned int n_cells;
4723 unsigned int n_vert;
4727 inline TecplotMacros::TecplotMacros(
const unsigned int n_nodes,
4728 const unsigned int n_vars,
4729 const unsigned int n_cells,
4730 const unsigned int n_vert)
4736 nodalData.resize(n_nodes * n_vars);
4737 connData.resize(n_cells * n_vert);
4742 inline TecplotMacros::~TecplotMacros()
4748 TecplotMacros::nd(
const unsigned int i,
const unsigned int j)
4750 return nodalData[i * n_nodes + j];
4756 TecplotMacros::cd(
const unsigned int i,
const unsigned int j)
4758 return connData[i + j * n_vert];
4769 template <
int dim,
int spacedim>
4773 const std::vector<std::string> & data_names,
4774 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
4775 & nonscalar_data_ranges,
4779 const unsigned int size = nonscalar_data_ranges.size();
4781 std::tuple<
unsigned int,
4785 new_nonscalar_data_ranges(size);
4786 for (
unsigned int i = 0; i < size; ++i)
4788 new_nonscalar_data_ranges[i] =
4789 std::tuple<
unsigned int,
4793 std::get<0>(nonscalar_data_ranges[i]),
4794 std::get<1>(nonscalar_data_ranges[i]),
4795 std::get<2>(nonscalar_data_ranges[i]),
4800 patches, data_names, new_nonscalar_data_ranges, flags, out);
4805 template <
int dim,
int spacedim>
4809 const std::vector<std::string> & data_names,
4811 std::tuple<
unsigned int,
4815 & nonscalar_data_ranges,
4824 #ifndef DEAL_II_HAVE_TECPLOT 4827 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
4835 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
4844 if (file_name ==
nullptr)
4849 ExcMessage(
"Specify the name of the tecplot_binary" 4850 " file through the TecplotFlags interface."));
4851 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
4858 # ifndef DEAL_II_WITH_MPI 4867 if (patches.size() == 0)
4871 const unsigned int n_data_sets = data_names.size();
4874 Assert((patches[0].data.n_rows() == n_data_sets &&
4875 !patches[0].points_are_available) ||
4876 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4877 patches[0].points_are_available),
4879 (n_data_sets + spacedim) :
4881 patches[0].data.n_rows()));
4884 unsigned int n_nodes;
4885 unsigned int n_cells;
4886 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4888 const unsigned int vars_per_node = (spacedim + n_data_sets),
4891 TecplotMacros tm(n_nodes, vars_per_node, n_cells, nodes_per_cell);
4893 int is_double = 0, tec_debug = 0, cell_type = tecplot_binary_cell_type[dim];
4895 std::string tec_var_names;
4899 tec_var_names =
"x y";
4902 tec_var_names =
"x y z";
4908 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4910 tec_var_names +=
" ";
4911 tec_var_names += data_names[data_set];
4927 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
4929 &write_gmv_reorder_data_vectors<dim, spacedim>;
4935 for (
unsigned int d = 1; d <= spacedim; ++d)
4937 unsigned int entry = 0;
4939 for (
const auto &patch : patches)
4947 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
4948 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
4950 const double x_frac = i * 1. / n_subdivisions,
4951 y_frac = j * 1. / n_subdivisions;
4953 tm.nd((d - 1), entry) =
static_cast<float>(
4954 (((patch.
vertices[1](d - 1) * x_frac) +
4955 (patch.
vertices[0](d - 1) * (1 - x_frac))) *
4957 ((patch.
vertices[3](d - 1) * x_frac) +
4958 (patch.
vertices[2](d - 1) * (1 - x_frac))) *
4967 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
4968 for (
unsigned int k = 0; k < n_subdivisions + 1; ++k)
4969 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
4971 const double x_frac = i * 1. / n_subdivisions,
4972 y_frac = k * 1. / n_subdivisions,
4973 z_frac = j * 1. / n_subdivisions;
4976 tm.nd((d - 1), entry) =
static_cast<float>(
4977 ((((patch.
vertices[1](d - 1) * x_frac) +
4978 (patch.
vertices[0](d - 1) * (1 - x_frac))) *
4980 ((patch.
vertices[3](d - 1) * x_frac) +
4981 (patch.
vertices[2](d - 1) * (1 - x_frac))) *
4984 (((patch.
vertices[5](d - 1) * x_frac) +
4985 (patch.
vertices[4](d - 1) * (1 - x_frac))) *
4987 ((patch.
vertices[7](d - 1) * x_frac) +
4988 (patch.
vertices[6](d - 1) * (1 - x_frac))) *
5006 reorder_task.
join();
5009 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5010 for (
unsigned int entry = 0; entry < data_vectors[data_set].
size();
5012 tm.nd((spacedim + data_set), entry) =
5013 static_cast<float>(data_vectors[data_set][entry]);
5019 unsigned int first_vertex_of_patch = 0;
5020 unsigned int elem = 0;
5022 for (
const auto &patch : patches)
5025 const unsigned int n = n_subdivisions + 1;
5026 const unsigned int d1 = 1;
5027 const unsigned int d2 = n;
5028 const unsigned int d3 = n * n;
5034 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5035 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5038 first_vertex_of_patch + (i1)*d1 + (i2)*d2 + 1;
5040 first_vertex_of_patch + (i1 + 1) * d1 + (i2)*d2 + 1;
5041 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5044 first_vertex_of_patch + (i1)*d1 + (i2 + 1) * d2 + 1;
5053 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5054 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5055 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5060 tm.cd(0, elem) = first_vertex_of_patch + (i1)*d1 +
5061 (i2)*d2 + (i3)*d3 + 1;
5062 tm.cd(1, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5063 (i2)*d2 + (i3)*d3 + 1;
5064 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5065 (i2 + 1) * d2 + (i3)*d3 + 1;
5066 tm.cd(3, elem) = first_vertex_of_patch + (i1)*d1 +
5067 (i2 + 1) * d2 + (i3)*d3 + 1;
5068 tm.cd(4, elem) = first_vertex_of_patch + (i1)*d1 +
5069 (i2)*d2 + (i3 + 1) * d3 + 1;
5070 tm.cd(5, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5071 (i2)*d2 + (i3 + 1) * d3 + 1;
5072 tm.cd(6, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5073 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5074 tm.cd(7, elem) = first_vertex_of_patch + (i1)*d1 +
5075 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5088 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
5093 int ierr = 0, num_nodes =
static_cast<int>(n_nodes),
5094 num_cells = static_cast<int>(n_cells);
5096 char dot[2] = {
'.', 0};
5100 char *var_names =
const_cast<char *
>(tec_var_names.c_str());
5101 ierr = TECINI(
nullptr, var_names, file_name, dot, &tec_debug, &is_double);
5105 char FEBLOCK[] = {
'F',
'E',
'B',
'L',
'O',
'C',
'K', 0};
5107 TECZNE(
nullptr, &num_nodes, &num_cells, &cell_type, FEBLOCK,
nullptr);
5111 int total = (vars_per_node * num_nodes);
5113 ierr = TECDAT(&total, tm.nodalData.data(), &is_double);
5117 ierr = TECNOD(tm.connData.data());
5130 template <
int dim,
int spacedim>
5134 const std::vector<std::string> & data_names,
5135 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
5136 & nonscalar_data_ranges,
5140 const unsigned int size = nonscalar_data_ranges.size();
5142 std::tuple<
unsigned int,
5146 new_nonscalar_data_ranges(size);
5147 for (
unsigned int i = 0; i < size; ++i)
5149 new_nonscalar_data_ranges[i] =
5150 std::tuple<
unsigned int,
5154 std::get<0>(nonscalar_data_ranges[i]),
5155 std::get<1>(nonscalar_data_ranges[i]),
5156 std::get<2>(nonscalar_data_ranges[i]),
5160 write_vtk(patches, data_names, new_nonscalar_data_ranges, flags, out);
5165 template <
int dim,
int spacedim>
5169 const std::vector<std::string> & data_names,
5171 std::tuple<
unsigned int,
5175 & nonscalar_data_ranges,
5181 #ifndef DEAL_II_WITH_MPI 5190 if (patches.size() == 0)
5194 VtkStream vtk_out(out, flags);
5196 const unsigned int n_data_sets = data_names.size();
5198 if (patches[0].points_are_available)
5210 out <<
"# vtk DataFile Version 3.0" <<
'\n' 5211 <<
"#This file was generated by the deal.II library";
5219 out <<
'\n' <<
"ASCII" <<
'\n';
5221 out <<
"DATASET UNSTRUCTURED_GRID\n" <<
'\n';
5228 const unsigned int n_metadata =
5229 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5230 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5232 out <<
"FIELD FieldData " << n_metadata <<
"\n";
5234 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5236 out <<
"CYCLE 1 1 int\n" << flags.
cycle <<
"\n";
5238 if (flags.
time != std::numeric_limits<double>::min())
5240 out <<
"TIME 1 1 double\n" << flags.
time <<
"\n";
5245 unsigned int n_nodes;
5246 unsigned int n_cells;
5247 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
5255 n_cells = patches.size();
5256 n_points_per_cell = n_nodes / n_cells;
5273 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5275 &write_gmv_reorder_data_vectors<dim, spacedim>;
5283 out <<
"POINTS " << n_nodes <<
" double" <<
'\n';
5284 write_nodes(patches, vtk_out);
5288 out <<
"CELLS " << n_cells <<
' ' << n_cells * (n_points_per_cell + 1)
5291 write_high_order_cells(patches, vtk_out);
5293 write_cells(patches, vtk_out);
5297 out <<
"CELL_TYPES " << n_cells <<
'\n';
5301 vtk_lagrange_cell_type[dim] :
5303 for (
unsigned int i = 0; i < n_cells; ++i)
5304 out <<
' ' << vtk_cell_id;
5311 reorder_task.
join();
5316 out <<
"POINT_DATA " << n_nodes <<
'\n';
5320 std::vector<bool> data_set_written(n_data_sets,
false);
5321 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5324 std::get<0>(nonscalar_data_range),
5326 std::get<0>(nonscalar_data_range)));
5327 AssertThrow(std::get<1>(nonscalar_data_range) < n_data_sets,
5331 AssertThrow(std::get<1>(nonscalar_data_range) + 1 -
5332 std::get<0>(nonscalar_data_range) <=
5335 "Can't declare a vector with more than 3 components " 5339 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5340 i <= std::get<1>(nonscalar_data_range);
5342 data_set_written[i] =
true;
5348 if (!std::get<2>(nonscalar_data_range).empty())
5349 out << std::get<2>(nonscalar_data_range);
5352 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5353 i < std::get<1>(nonscalar_data_range);
5355 out << data_names[i] <<
"__";
5356 out << data_names[std::get<1>(nonscalar_data_range)];
5359 out <<
" double" <<
'\n';
5362 for (
unsigned int n = 0; n < n_nodes; ++n)
5364 switch (std::get<1>(nonscalar_data_range) -
5365 std::get<0>(nonscalar_data_range))
5368 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5373 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5375 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5379 out << data_vectors(std::get<0>(nonscalar_data_range), n)
5381 << data_vectors(std::get<0>(nonscalar_data_range) + 1, n)
5383 << data_vectors(std::get<0>(nonscalar_data_range) + 2, n)
5396 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5397 if (data_set_written[data_set] ==
false)
5399 out <<
"SCALARS " << data_names[data_set] <<
" double 1" <<
'\n' 5400 <<
"LOOKUP_TABLE default" <<
'\n';
5401 std::copy(data_vectors[data_set].begin(),
5402 data_vectors[data_set].end(),
5403 std::ostream_iterator<double>(out,
" "));
5419 out <<
"<?xml version=\"1.0\" ?> \n";
5421 out <<
"# vtk DataFile Version 3.0" <<
'\n' 5422 <<
"#This file was generated by the deal.II library";
5431 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"";
5432 #ifdef DEAL_II_WITH_ZLIB 5433 out <<
" compressor=\"vtkZLibDataCompressor\"";
5435 #ifdef DEAL_II_WORDS_BIGENDIAN 5436 out <<
" byte_order=\"BigEndian\"";
5438 out <<
" byte_order=\"LittleEndian\"";
5442 out <<
"<UnstructuredGrid>";
5452 out <<
" </UnstructuredGrid>\n";
5453 out <<
"</VTKFile>\n";
5458 template <
int dim,
int spacedim>
5462 const std::vector<std::string> & data_names,
5463 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
5464 & nonscalar_data_ranges,
5469 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5477 template <
int dim,
int spacedim>
5481 const std::vector<std::string> & data_names,
5483 std::tuple<
unsigned int,
5487 & nonscalar_data_ranges,
5492 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5500 template <
int dim,
int spacedim>
5504 const std::vector<std::string> & data_names,
5505 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
5506 & nonscalar_data_ranges,
5510 const unsigned int size = nonscalar_data_ranges.size();
5512 std::tuple<
unsigned int,
5516 new_nonscalar_data_ranges(size);
5517 for (
unsigned int i = 0; i < size; ++i)
5519 new_nonscalar_data_ranges[i] =
5520 std::tuple<
unsigned int,
5524 std::get<0>(nonscalar_data_ranges[i]),
5525 std::get<1>(nonscalar_data_ranges[i]),
5526 std::get<2>(nonscalar_data_ranges[i]),
5530 write_vtu_main(patches, data_names, new_nonscalar_data_ranges, flags, out);
5535 template <
int dim,
int spacedim>
5539 const std::vector<std::string> & data_names,
5541 std::tuple<
unsigned int,
5545 & nonscalar_data_ranges,
5551 #ifndef DEAL_II_WITH_MPI 5560 if (patches.size() == 0)
5565 out <<
"<Piece NumberOfPoints=\"0\" NumberOfCells=\"0\" >\n" 5567 <<
"<DataArray type=\"UInt8\" Name=\"types\"></DataArray>\n" 5569 <<
" <PointData Scalars=\"scalars\">\n";
5570 std::vector<bool> data_set_written(data_names.size(),
false);
5571 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5574 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5575 i <= std::get<1>(nonscalar_data_range);
5577 data_set_written[i] =
true;
5581 out <<
" <DataArray type=\"Float32\" Name=\"";
5583 if (!std::get<2>(nonscalar_data_range).empty())
5584 out << std::get<2>(nonscalar_data_range);
5587 for (
unsigned int i = std::get<0>(nonscalar_data_range);
5588 i < std::get<1>(nonscalar_data_range);
5590 out << data_names[i] <<
"__";
5591 out << data_names[std::get<1>(nonscalar_data_range)];
5594 out <<
"\" NumberOfComponents=\"3\"></DataArray>\n";
5597 for (
unsigned int data_set = 0; data_set < data_names.size();
5599 if (data_set_written[data_set] ==
false)
5601 out <<
" <DataArray type=\"Float32\" Name=\"" 5602 << data_names[data_set] <<
"\"></DataArray>\n";
5605 out <<
" </PointData>\n";
5606 out <<
"</Piece>\n";
5620 const unsigned int n_metadata =
5621 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5622 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5624 out <<
"<FieldData>\n";
5626 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5629 <<
"<DataArray type=\"Float32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">" 5630 << flags.
cycle <<
"</DataArray>\n";
5632 if (flags.
time != std::numeric_limits<double>::min())
5635 <<
"<DataArray type=\"Float32\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">" 5636 << flags.
time <<
"</DataArray>\n";
5640 out <<
"</FieldData>\n";
5644 VtuStream vtu_out(out, flags);
5646 const unsigned int n_data_sets = data_names.size();
5649 if (patches[0].points_are_available)
5658 #ifdef DEAL_II_WITH_ZLIB 5659 const char *ascii_or_binary =
"binary";
5661 const char *ascii_or_binary =
"ascii";
5666 unsigned int n_nodes;
5667 unsigned int n_cells;
5668 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
5676 n_cells = patches.size();
5677 n_points_per_cell = n_nodes / n_cells;
5694 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5696 &write_gmv_reorder_data_vectors<dim, spacedim, float>;
5705 out <<
"<Piece NumberOfPoints=\"" << n_nodes <<
"\" NumberOfCells=\"" 5706 << n_cells <<
"\" >\n";
5707 out <<
" <Points>\n";
5708 out <<
" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"" 5709 << ascii_or_binary <<
"\">\n";
5710 write_nodes(patches, vtu_out);
5711 out <<
" </DataArray>\n";
5712 out <<
" </Points>\n\n";
5715 out <<
" <Cells>\n";
5716 out <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"" 5717 << ascii_or_binary <<
"\">\n";
5719 write_high_order_cells(patches, vtu_out);
5721 write_cells(patches, vtu_out);
5722 out <<
" </DataArray>\n";
5726 out <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\"" 5727 << ascii_or_binary <<
"\">\n";
5729 std::vector<int32_t> offsets(n_cells);
5730 for (
unsigned int i = 0; i < n_cells; ++i)
5731 offsets[i] = (i + 1) * n_points_per_cell;
5734 out <<
" </DataArray>\n";
5738 out <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\"" 5739 << ascii_or_binary <<
"\">\n";
5744 vtk_lagrange_cell_type[dim] :
5749 #ifdef DEAL_II_WITH_ZLIB 5750 std::vector<uint8_t> cell_types(n_cells,
5751 static_cast<uint8_t>(vtk_cell_id));
5753 std::vector<unsigned int> cell_types(n_cells, vtk_cell_id);
5756 vtu_out << cell_types;
5759 out <<
" </DataArray>\n";
5760 out <<
" </Cells>\n";
5768 reorder_task.
join();
5773 out <<
" <PointData Scalars=\"scalars\">\n";
5777 std::vector<bool> data_set_written(n_data_sets,
false);
5778 for (
const auto &range : nonscalar_data_ranges)
5780 const auto first_component = std::get<0>(range);
5781 const auto last_component = std::get<1>(range);
5782 const auto &name = std::get<2>(range);
5783 const bool is_tensor =
5784 (std::get<3>(range) ==
5793 AssertThrow((last_component + 1 - first_component <= 9),
5795 "Can't declare a tensor with more than 9 components " 5800 AssertThrow((last_component + 1 - first_component <= 3),
5802 "Can't declare a vector with more than 3 components " 5807 for (
unsigned int i = first_component; i <= last_component; ++i)
5808 data_set_written[i] =
true;
5812 out <<
" <DataArray type=\"Float32\" Name=\"";
5818 for (
unsigned int i = first_component; i < last_component; ++i)
5819 out << data_names[i] <<
"__";
5820 out << data_names[last_component];
5823 out <<
"\" NumberOfComponents=\"" <<
n_components <<
"\" format=\"" 5824 << ascii_or_binary <<
"\">\n";
5827 std::vector<float> data;
5830 for (
unsigned int n = 0; n < n_nodes; ++n)
5834 switch (last_component - first_component)
5837 data.push_back(data_vectors(first_component, n));
5843 data.push_back(data_vectors(first_component, n));
5844 data.push_back(data_vectors(first_component + 1, n));
5849 data.push_back(data_vectors(first_component, n));
5850 data.push_back(data_vectors(first_component + 1, n));
5851 data.push_back(data_vectors(first_component + 2, n));
5864 const unsigned int size = last_component - first_component + 1;
5868 vtk_data[0][0] = data_vectors(first_component, n);
5870 else if ((size == 4) || (size == 9))
5873 for (
unsigned int c = 0; c < size; ++c)
5877 vtk_data[ind[0]][ind[1]] =
5878 data_vectors(first_component + c, n);
5889 for (
unsigned int i = 0; i < 3; ++i)
5890 for (
unsigned int j = 0; j < 3; ++j)
5891 data.push_back(vtk_data[i][j]);
5896 out <<
" </DataArray>\n";
5901 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5902 if (data_set_written[data_set] ==
false)
5904 out <<
" <DataArray type=\"Float32\" Name=\"" 5905 << data_names[data_set] <<
"\" format=\"" << ascii_or_binary
5908 std::vector<float> data(data_vectors[data_set].begin(),
5909 data_vectors[data_set].end());
5911 out <<
" </DataArray>\n";
5914 out <<
" </PointData>\n";
5917 out <<
" </Piece>\n";
5931 const std::vector<std::string> &piece_names,
5932 const std::vector<std::string> &data_names,
5933 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
5934 &nonscalar_data_ranges)
5936 const unsigned int size = nonscalar_data_ranges.size();
5938 std::tuple<
unsigned int,
5942 new_nonscalar_data_ranges(size);
5943 for (
unsigned int i = 0; i < size; ++i)
5945 new_nonscalar_data_ranges[i] =
5946 std::tuple<
unsigned int,
5950 std::get<0>(nonscalar_data_ranges[i]),
5951 std::get<1>(nonscalar_data_ranges[i]),
5952 std::get<2>(nonscalar_data_ranges[i]),
5964 const std::vector<std::string> &piece_names,
5965 const std::vector<std::string> &data_names,
5967 std::tuple<
unsigned int,
5971 &nonscalar_data_ranges)
5975 const unsigned int n_data_sets = data_names.size();
5977 out <<
"<?xml version=\"1.0\"?>\n";
5980 out <<
"#This file was generated by the deal.II library" 5985 <<
"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
5986 out <<
" <PUnstructuredGrid GhostLevel=\"0\">\n";
5987 out <<
" <PPointData Scalars=\"scalars\">\n";
5990 std::vector<bool> data_set_written(n_data_sets,
false);
5991 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
5993 const auto first_component = std::get<0>(nonscalar_data_range);
5994 const auto last_component = std::get<1>(nonscalar_data_range);
5995 const bool is_tensor =
5996 (std::get<3>(nonscalar_data_range) ==
6005 AssertThrow((last_component + 1 - first_component <= 9),
6007 "Can't declare a tensor with more than 9 components " 6012 Assert((last_component + 1 - first_component <= 3),
6014 "Can't declare a vector with more than 3 components " 6019 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6020 i <= std::get<1>(nonscalar_data_range);
6022 data_set_written[i] =
true;
6026 out <<
" <PDataArray type=\"Float32\" Name=\"";
6028 if (!std::get<2>(nonscalar_data_range).empty())
6029 out << std::get<2>(nonscalar_data_range);
6032 for (
unsigned int i = std::get<0>(nonscalar_data_range);
6033 i < std::get<1>(nonscalar_data_range);
6035 out << data_names[i] <<
"__";
6036 out << data_names[std::get<1>(nonscalar_data_range)];
6040 <<
"\" format=\"ascii\"/>\n";
6043 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6044 if (data_set_written[data_set] ==
false)
6046 out <<
" <PDataArray type=\"Float32\" Name=\"" 6047 << data_names[data_set] <<
"\" format=\"ascii\"/>\n";
6050 out <<
" </PPointData>\n";
6052 out <<
" <PPoints>\n";
6053 out <<
" <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
6054 out <<
" </PPoints>\n";
6056 for (
const auto &piece_name : piece_names)
6057 out <<
" <Piece Source=\"" << piece_name <<
"\"/>\n";
6059 out <<
" </PUnstructuredGrid>\n";
6060 out <<
"</VTKFile>\n";
6073 const std::vector<std::pair<double, std::string>> ×_and_names)
6077 out <<
"<?xml version=\"1.0\"?>\n";
6080 out <<
"#This file was generated by the deal.II library" 6085 <<
"<VTKFile type=\"Collection\" version=\"0.1\" ByteOrder=\"LittleEndian\">\n";
6086 out <<
" <Collection>\n";
6088 std::streamsize ss = out.precision();
6091 for (
const auto &time_and_name : times_and_names)
6092 out <<
" <DataSet timestep=\"" << time_and_name.first
6093 <<
"\" group=\"\" part=\"0\" file=\"" << time_and_name.second
6096 out <<
" </Collection>\n";
6097 out <<
"</VTKFile>\n";
6109 const std::vector<std::string> &piece_names)
6111 out <<
"!NBLOCKS " << piece_names.size() <<
'\n';
6112 for (
const auto &piece_name : piece_names)
6113 out << piece_name <<
'\n';
6122 const std::vector<std::vector<std::string>> &piece_names)
6126 if (piece_names.size() == 0)
6129 const double nblocks = piece_names[0].size();
6131 ExcMessage(
"piece_names should be a vector of nonempty vectors."));
6133 out <<
"!NBLOCKS " << nblocks <<
'\n';
6134 for (
const auto &domain : piece_names)
6136 Assert(domain.size() == nblocks,
6138 "piece_names should be a vector of equal sized vectors."));
6139 for (
const auto &subdomain : domain)
6140 out << subdomain <<
'\n';
6151 const std::vector<std::pair<
double, std::vector<std::string>>>
6152 ×_and_piece_names)
6156 if (times_and_piece_names.size() == 0)
6159 const double nblocks = times_and_piece_names[0].second.size();
6163 "time_and_piece_names should contain nonempty vectors of filenames for every timestep."));
6165 for (
const auto &domain : times_and_piece_names)
6166 out <<
"!TIME " << domain.first <<
'\n';
6168 out <<
"!NBLOCKS " << nblocks <<
'\n';
6169 for (
const auto &domain : times_and_piece_names)
6171 Assert(domain.second.size() == nblocks,
6173 "piece_names should be a vector of equal sized vectors."));
6174 for (
const auto &subdomain : domain.second)
6175 out << subdomain <<
'\n';
6183 template <
int dim,
int spacedim>
6186 const std::vector<Patch<dim, spacedim>> &,
6187 const std::vector<std::string> &,
6188 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
6197 template <
int dim,
int spacedim>
6200 const std::vector<Patch<dim, spacedim>> &,
6201 const std::vector<std::string> &,
6203 std::tuple<
unsigned int,
6215 template <
int spacedim>
6219 const std::vector<std::string> & data_names,
6220 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &
6229 std::tuple<
unsigned int,
6239 template <
int spacedim>
6243 const std::vector<std::string> & ,
6245 std::tuple<
unsigned int,
6253 const unsigned int height = flags.
height;
6254 unsigned int width = flags.
width;
6257 unsigned int margin_in_percent = 0;
6259 margin_in_percent = 5;
6263 double x_dimension, y_dimension, z_dimension;
6265 const auto &first_patch = patches[0];
6267 unsigned int n_subdivisions = first_patch.n_subdivisions;
6268 unsigned int n = n_subdivisions + 1;
6269 const unsigned int d1 = 1;
6270 const unsigned int d2 = n;
6273 std::array<Point<spacedim>, 4> projected_points;
6276 std::array<Point<2>, 4> projection_decompositions;
6278 projected_point = compute_node(first_patch, 0, 0, 0, n_subdivisions);
6281 first_patch.data.n_rows() == 0,
6284 double x_min = projected_point[0];
6285 double x_max = x_min;
6286 double y_min = projected_point[1];
6287 double y_max = y_min;
6288 double z_min = first_patch.data.n_rows() != 0 ?
6291 double z_max = z_min;
6294 for (
const auto &patch : patches)
6297 n = n_subdivisions + 1;
6299 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6301 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6303 projected_points[0] =
6304 compute_node(patch, i1, i2, 0, n_subdivisions);
6305 projected_points[1] =
6306 compute_node(patch, i1 + 1, i2, 0, n_subdivisions);
6307 projected_points[2] =
6308 compute_node(patch, i1, i2 + 1, 0, n_subdivisions);
6309 projected_points[3] =
6310 compute_node(patch, i1 + 1, i2 + 1, 0, n_subdivisions);
6312 x_min = std::min(x_min, projected_points[0][0]);
6313 x_min = std::min(x_min, projected_points[1][0]);
6314 x_min = std::min(x_min, projected_points[2][0]);
6315 x_min = std::min(x_min, projected_points[3][0]);
6317 x_max = std::max(x_max, projected_points[0][0]);
6318 x_max = std::max(x_max, projected_points[1][0]);
6319 x_max = std::max(x_max, projected_points[2][0]);
6320 x_max = std::max(x_max, projected_points[3][0]);
6322 y_min = std::min(y_min, projected_points[0][1]);
6323 y_min = std::min(y_min, projected_points[1][1]);
6324 y_min = std::min(y_min, projected_points[2][1]);
6325 y_min = std::min(y_min, projected_points[3][1]);
6327 y_max = std::max(y_max, projected_points[0][1]);
6328 y_max = std::max(y_max, projected_points[1][1]);
6329 y_max = std::max(y_max, projected_points[2][1]);
6330 y_max = std::max(y_max, projected_points[3][1]);
6333 patch.
data.n_rows() == 0,
6336 patch.
data.n_rows()));
6338 z_min = std::min<double>(z_min,
6340 i1 * d1 + i2 * d2));
6341 z_min = std::min<double>(z_min,
6343 (i1 + 1) * d1 + i2 * d2));
6344 z_min = std::min<double>(z_min,
6346 i1 * d1 + (i2 + 1) * d2));
6348 std::min<double>(z_min,
6350 (i1 + 1) * d1 + (i2 + 1) * d2));
6352 z_max = std::max<double>(z_max,
6354 i1 * d1 + i2 * d2));
6355 z_max = std::max<double>(z_max,
6357 (i1 + 1) * d1 + i2 * d2));
6358 z_max = std::max<double>(z_max,
6360 i1 * d1 + (i2 + 1) * d2));
6362 std::max<double>(z_max,
6364 (i1 + 1) * d1 + (i2 + 1) * d2));
6369 x_dimension = x_max - x_min;
6370 y_dimension = y_max - y_min;
6371 z_dimension = z_max - z_min;
6378 float camera_focus = 0;
6381 camera_position[0] = 0.;
6382 camera_position[1] = 0.;
6383 camera_position[2] = z_min + 2. * z_dimension;
6385 camera_direction[0] = 0.;
6386 camera_direction[1] = 0.;
6387 camera_direction[2] = -1.;
6389 camera_horizontal[0] = 1.;
6390 camera_horizontal[1] = 0.;
6391 camera_horizontal[2] = 0.;
6393 camera_focus = .5 * z_dimension;
6399 const float angle_factor = 3.14159265f / 180.f;
6402 camera_position_temp[1] =
6403 std::cos(angle_factor * flags.polar_angle) * camera_position[1] -
6404 std::sin(angle_factor * flags.polar_angle) * camera_position[2];
6405 camera_position_temp[2] =
6406 std::sin(angle_factor * flags.polar_angle) * camera_position[1] +
6407 std::cos(angle_factor * flags.polar_angle) * camera_position[2];
6409 camera_direction_temp[1] =
6410 std::cos(angle_factor * flags.polar_angle) * camera_direction[1] -
6411 std::sin(angle_factor * flags.polar_angle) * camera_direction[2];
6412 camera_direction_temp[2] =
6413 std::sin(angle_factor * flags.polar_angle) * camera_direction[1] +
6414 std::cos(angle_factor * flags.polar_angle) * camera_direction[2];
6416 camera_horizontal_temp[1] =
6417 std::cos(angle_factor * flags.polar_angle) * camera_horizontal[1] -
6418 std::sin(angle_factor * flags.polar_angle) * camera_horizontal[2];
6419 camera_horizontal_temp[2] =
6420 std::sin(angle_factor * flags.polar_angle) * camera_horizontal[1] +
6421 std::cos(angle_factor * flags.polar_angle) * camera_horizontal[2];
6423 camera_position[1] = camera_position_temp[1];
6424 camera_position[2] = camera_position_temp[2];
6426 camera_direction[1] = camera_direction_temp[1];
6427 camera_direction[2] = camera_direction_temp[2];
6429 camera_horizontal[1] = camera_horizontal_temp[1];
6430 camera_horizontal[2] = camera_horizontal_temp[2];
6433 camera_position_temp[0] =
6434 std::cos(angle_factor * flags.
azimuth_angle) * camera_position[0] -
6435 std::sin(angle_factor * flags.
azimuth_angle) * camera_position[1];
6436 camera_position_temp[1] =
6437 std::sin(angle_factor * flags.
azimuth_angle) * camera_position[0] +
6438 std::cos(angle_factor * flags.
azimuth_angle) * camera_position[1];
6440 camera_direction_temp[0] =
6441 std::cos(angle_factor * flags.
azimuth_angle) * camera_direction[0] -
6442 std::sin(angle_factor * flags.
azimuth_angle) * camera_direction[1];
6443 camera_direction_temp[1] =
6444 std::sin(angle_factor * flags.
azimuth_angle) * camera_direction[0] +
6445 std::cos(angle_factor * flags.
azimuth_angle) * camera_direction[1];
6447 camera_horizontal_temp[0] =
6448 std::cos(angle_factor * flags.
azimuth_angle) * camera_horizontal[0] -
6449 std::sin(angle_factor * flags.
azimuth_angle) * camera_horizontal[1];
6450 camera_horizontal_temp[1] =
6451 std::sin(angle_factor * flags.
azimuth_angle) * camera_horizontal[0] +
6452 std::cos(angle_factor * flags.
azimuth_angle) * camera_horizontal[1];
6454 camera_position[0] = camera_position_temp[0];
6455 camera_position[1] = camera_position_temp[1];
6457 camera_direction[0] = camera_direction_temp[0];
6458 camera_direction[1] = camera_direction_temp[1];
6460 camera_horizontal[0] = camera_horizontal_temp[0];
6461 camera_horizontal[1] = camera_horizontal_temp[1];
6464 camera_position[0] = x_min + .5 * x_dimension;
6465 camera_position[1] = y_min + .5 * y_dimension;
6467 camera_position[0] += (z_min + 2. * z_dimension) *
6468 std::sin(angle_factor * flags.polar_angle) *
6470 camera_position[1] -= (z_min + 2. * z_dimension) *
6471 std::sin(angle_factor * flags.polar_angle) *
6476 double x_min_perspective, y_min_perspective;
6477 double x_max_perspective, y_max_perspective;
6478 double x_dimension_perspective, y_dimension_perspective;
6480 n_subdivisions = first_patch.n_subdivisions;
6481 n = n_subdivisions + 1;
6485 projected_point = compute_node(first_patch, 0, 0, 0, n_subdivisions);
6488 first_patch.data.n_rows() == 0,
6491 point[0] = projected_point[0];
6492 point[1] = projected_point[1];
6493 point[2] = first_patch.data.n_rows() != 0 ?
6497 projection_decomposition = svg_project_point(point,
6503 x_min_perspective = projection_decomposition[0];
6504 x_max_perspective = projection_decomposition[0];
6505 y_min_perspective = projection_decomposition[1];
6506 y_max_perspective = projection_decomposition[1];
6509 for (
const auto &patch : patches)
6512 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6514 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6516 const std::array<Point<spacedim>, 4> projected_vertices{
6517 {compute_node(patch, i1, i2, 0, n_subdivisions),
6518 compute_node(patch, i1 + 1, i2, 0, n_subdivisions),
6519 compute_node(patch, i1, i2 + 1, 0, n_subdivisions),
6520 compute_node(patch, i1 + 1, i2 + 1, 0, n_subdivisions)}};
6523 patch.
data.n_rows() == 0,
6526 patch.
data.n_rows()));
6528 const std::array<Point<3>, 4> vertices = {
6529 {
Point<3>{projected_vertices[0][0],
6530 projected_vertices[0][1],
6531 patch.
data.n_rows() != 0 ?
6532 patch.
data(0, i1 * d1 + i2 * d2) :
6535 projected_vertices[1][1],
6536 patch.
data.n_rows() != 0 ?
6537 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6540 projected_vertices[2][1],
6541 patch.
data.n_rows() != 0 ?
6542 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6545 projected_vertices[3][1],
6546 patch.
data.n_rows() != 0 ?
6547 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6550 projection_decompositions = {
6551 {svg_project_point(vertices[0],
6556 svg_project_point(vertices[1],
6561 svg_project_point(vertices[2],
6566 svg_project_point(vertices[3],
6573 std::min(x_min_perspective,
6574 static_cast<double>(
6575 projection_decompositions[0][0]));
6577 std::min(x_min_perspective,
6578 static_cast<double>(
6579 projection_decompositions[1][0]));
6581 std::min(x_min_perspective,
6582 static_cast<double>(
6583 projection_decompositions[2][0]));
6585 std::min(x_min_perspective,
6586 static_cast<double>(
6587 projection_decompositions[3][0]));
6590 std::max(x_max_perspective,
6591 static_cast<double>(
6592 projection_decompositions[0][0]));
6594 std::max(x_max_perspective,
6595 static_cast<double>(
6596 projection_decompositions[1][0]));
6598 std::max(x_max_perspective,
6599 static_cast<double>(
6600 projection_decompositions[2][0]));
6602 std::max(x_max_perspective,
6603 static_cast<double>(
6604 projection_decompositions[3][0]));
6607 std::min(y_min_perspective,
6608 static_cast<double>(
6609 projection_decompositions[0][1]));
6611 std::min(y_min_perspective,
6612 static_cast<double>(
6613 projection_decompositions[1][1]));
6615 std::min(y_min_perspective,
6616 static_cast<double>(
6617 projection_decompositions[2][1]));
6619 std::min(y_min_perspective,
6620 static_cast<double>(
6621 projection_decompositions[3][1]));
6624 std::max(y_max_perspective,
6625 static_cast<double>(
6626 projection_decompositions[0][1]));
6628 std::max(y_max_perspective,
6629 static_cast<double>(
6630 projection_decompositions[1][1]));
6632 std::max(y_max_perspective,
6633 static_cast<double>(
6634 projection_decompositions[2][1]));
6636 std::max(y_max_perspective,
6637 static_cast<double>(
6638 projection_decompositions[3][1]));
6643 x_dimension_perspective = x_max_perspective - x_min_perspective;
6644 y_dimension_perspective = y_max_perspective - y_min_perspective;
6646 std::multiset<SvgCell> cells;
6649 for (
const auto &patch : patches)
6653 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6655 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6657 const std::array<Point<spacedim>, 4> projected_vertices = {
6658 {compute_node(patch, i1, i2, 0, n_subdivisions),
6659 compute_node(patch, i1 + 1, i2, 0, n_subdivisions),
6660 compute_node(patch, i1, i2 + 1, 0, n_subdivisions),
6661 compute_node(patch, i1 + 1, i2 + 1, 0, n_subdivisions)}};
6664 patch.
data.n_rows() == 0,
6667 patch.
data.n_rows()));
6671 cell.vertices[0][0] = projected_vertices[0][0];
6672 cell.vertices[0][1] = projected_vertices[0][1];
6673 cell.vertices[0][2] = patch.
data.n_rows() != 0 ?
6674 patch.
data(0, i1 * d1 + i2 * d2) :
6677 cell.vertices[1][0] = projected_vertices[1][0];
6678 cell.vertices[1][1] = projected_vertices[1][1];
6679 cell.vertices[1][2] = patch.
data.n_rows() != 0 ?
6680 patch.
data(0, (i1 + 1) * d1 + i2 * d2) :
6683 cell.vertices[2][0] = projected_vertices[2][0];
6684 cell.vertices[2][1] = projected_vertices[2][1];
6685 cell.vertices[2][2] = patch.
data.n_rows() != 0 ?
6686 patch.
data(0, i1 * d1 + (i2 + 1) * d2) :
6689 cell.vertices[3][0] = projected_vertices[3][0];
6690 cell.vertices[3][1] = projected_vertices[3][1];
6691 cell.vertices[3][2] =
6692 patch.
data.n_rows() != 0 ?
6693 patch.
data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6696 cell.projected_vertices[0] =
6697 svg_project_point(cell.vertices[0],
6702 cell.projected_vertices[1] =
6703 svg_project_point(cell.vertices[1],
6708 cell.projected_vertices[2] =
6709 svg_project_point(cell.vertices[2],
6714 cell.projected_vertices[3] =
6715 svg_project_point(cell.vertices[3],
6721 cell.center = .25 * (cell.vertices[0] + cell.vertices[1] +
6722 cell.vertices[2] + cell.vertices[3]);
6723 cell.projected_center = svg_project_point(cell.center,
6729 cell.depth = cell.center.distance(camera_position);
6739 width =
static_cast<unsigned int>(
6740 .5 + height * (x_dimension_perspective / y_dimension_perspective));
6741 unsigned int additional_width = 0;
6744 additional_width =
static_cast<unsigned int>(
6748 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\"" 6749 << height <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" 6751 <<
" <rect width=\"" << width + additional_width <<
"\" height=\"" 6752 << height <<
"\" style=\"fill:white\"/>" <<
'\n' 6755 unsigned int triangle_counter = 0;
6758 for (
const auto &cell : cells)
6762 for (
unsigned int triangle_index = 0; triangle_index < 4;
6765 switch (triangle_index)
6768 points3d_triangle[0] = cell.vertices[0],
6769 points3d_triangle[1] = cell.vertices[1],
6770 points3d_triangle[2] = cell.center;
6773 points3d_triangle[0] = cell.vertices[1],
6774 points3d_triangle[1] = cell.vertices[3],
6775 points3d_triangle[2] = cell.center;
6778 points3d_triangle[0] = cell.vertices[3],
6779 points3d_triangle[1] = cell.vertices[2],
6780 points3d_triangle[2] = cell.center;
6783 points3d_triangle[0] = cell.vertices[2],
6784 points3d_triangle[1] = cell.vertices[0],
6785 points3d_triangle[2] = cell.center;
6792 svg_get_gradient_parameters(points3d_triangle);
6795 .667 - ((gradient_param[4] - z_min) / z_dimension) * .667;
6797 .667 - ((gradient_param[5] - z_min) / z_dimension) * .667;
6799 unsigned int start_r = 0;
6800 unsigned int start_g = 0;
6801 unsigned int start_b = 0;
6803 unsigned int stop_r = 0;
6804 unsigned int stop_g = 0;
6805 unsigned int stop_b = 0;
6807 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
6808 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
6810 double start_f = start_h * 6. - start_i;
6811 double start_q = 1. - start_f;
6813 double stop_f = stop_h * 6. - stop_i;
6814 double stop_q = 1. - stop_f;
6816 switch (start_i % 6)
6820 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
6823 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
6828 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
6831 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
6835 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
6840 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
6850 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
6853 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
6858 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
6861 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
6865 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
6870 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
6876 Point<3> gradient_start_point_3d, gradient_stop_point_3d;
6878 gradient_start_point_3d[0] = gradient_param[0];
6879 gradient_start_point_3d[1] = gradient_param[1];
6880 gradient_start_point_3d[2] = gradient_param[4];
6882 gradient_stop_point_3d[0] = gradient_param[2];
6883 gradient_stop_point_3d[1] = gradient_param[3];
6884 gradient_stop_point_3d[2] = gradient_param[5];
6887 svg_project_point(gradient_start_point_3d,
6893 svg_project_point(gradient_stop_point_3d,
6900 out <<
" <linearGradient id=\"" << triangle_counter
6901 <<
"\" gradientUnits=\"userSpaceOnUse\" " 6903 <<
static_cast<unsigned int>(
6905 ((gradient_start_point[0] - x_min_perspective) /
6906 x_dimension_perspective) *
6907 (width - (width / 100.) * 2. * margin_in_percent) +
6908 ((width / 100.) * margin_in_percent))
6911 <<
static_cast<unsigned int>(
6912 .5 + height - (height / 100.) * margin_in_percent -
6913 ((gradient_start_point[1] - y_min_perspective) /
6914 y_dimension_perspective) *
6915 (height - (height / 100.) * 2. * margin_in_percent))
6918 <<
static_cast<unsigned int>(
6920 ((gradient_stop_point[0] - x_min_perspective) /
6921 x_dimension_perspective) *
6922 (width - (width / 100.) * 2. * margin_in_percent) +
6923 ((width / 100.) * margin_in_percent))
6926 <<
static_cast<unsigned int>(
6927 .5 + height - (height / 100.) * margin_in_percent -
6928 ((gradient_stop_point[1] - y_min_perspective) /
6929 y_dimension_perspective) *
6930 (height - (height / 100.) * 2. * margin_in_percent))
6933 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
6934 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n' 6935 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
6936 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n' 6937 <<
" </linearGradient>" <<
'\n';
6940 double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
6941 double x3 = cell.projected_center[0];
6942 double y3 = cell.projected_center[1];
6944 switch (triangle_index)
6947 x1 = cell.projected_vertices[0][0],
6948 y1 = cell.projected_vertices[0][1],
6949 x2 = cell.projected_vertices[1][0],
6950 y2 = cell.projected_vertices[1][1];
6953 x1 = cell.projected_vertices[1][0],
6954 y1 = cell.projected_vertices[1][1],
6955 x2 = cell.projected_vertices[3][0],
6956 y2 = cell.projected_vertices[3][1];
6959 x1 = cell.projected_vertices[3][0],
6960 y1 = cell.projected_vertices[3][1],
6961 x2 = cell.projected_vertices[2][0],
6962 y2 = cell.projected_vertices[2][1];
6965 x1 = cell.projected_vertices[2][0],
6966 y1 = cell.projected_vertices[2][1],
6967 x2 = cell.projected_vertices[0][0],
6968 y2 = cell.projected_vertices[0][1];
6974 out <<
" <path d=\"M " 6975 <<
static_cast<unsigned int>(
6977 ((x1 - x_min_perspective) / x_dimension_perspective) *
6978 (width - (width / 100.) * 2. * margin_in_percent) +
6979 ((width / 100.) * margin_in_percent))
6981 <<
static_cast<unsigned int>(
6982 .5 + height - (height / 100.) * margin_in_percent -
6983 ((y1 - y_min_perspective) / y_dimension_perspective) *
6984 (height - (height / 100.) * 2. * margin_in_percent))
6986 <<
static_cast<unsigned int>(
6988 ((x2 - x_min_perspective) / x_dimension_perspective) *
6989 (width - (width / 100.) * 2. * margin_in_percent) +
6990 ((width / 100.) * margin_in_percent))
6992 <<
static_cast<unsigned int>(
6993 .5 + height - (height / 100.) * margin_in_percent -
6994 ((y2 - y_min_perspective) / y_dimension_perspective) *
6995 (height - (height / 100.) * 2. * margin_in_percent))
6997 <<
static_cast<unsigned int>(
6999 ((x3 - x_min_perspective) / x_dimension_perspective) *
7000 (width - (width / 100.) * 2. * margin_in_percent) +
7001 ((width / 100.) * margin_in_percent))
7003 <<
static_cast<unsigned int>(
7004 .5 + height - (height / 100.) * margin_in_percent -
7005 ((y3 - y_min_perspective) / y_dimension_perspective) *
7006 (height - (height / 100.) * 2. * margin_in_percent))
7008 <<
static_cast<unsigned int>(
7010 ((x1 - x_min_perspective) / x_dimension_perspective) *
7011 (width - (width / 100.) * 2. * margin_in_percent) +
7012 ((width / 100.) * margin_in_percent))
7014 <<
static_cast<unsigned int>(
7015 .5 + height - (height / 100.) * margin_in_percent -
7016 ((y1 - y_min_perspective) / y_dimension_perspective) *
7017 (height - (height / 100.) * 2. * margin_in_percent))
7018 <<
"\" style=\"stroke:black; fill:url(#" << triangle_counter
7019 <<
"); stroke-width:" << flags.line_thickness <<
"\"/>" <<
'\n';
7029 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
7031 unsigned int element_height =
static_cast<unsigned int>(
7032 ((height / 100.) * (71. - 2. * margin_in_percent)) / 4);
7033 unsigned int element_width =
7034 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7036 additional_width = 0;
7039 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7041 for (
unsigned int index = 0; index < 4; index++)
7043 double start_h = .667 - ((index + 1) / 4.) * .667;
7044 double stop_h = .667 - (index / 4.) * .667;
7046 unsigned int start_r = 0;
7047 unsigned int start_g = 0;
7048 unsigned int start_b = 0;
7050 unsigned int stop_r = 0;
7051 unsigned int stop_g = 0;
7052 unsigned int stop_b = 0;
7054 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
7055 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
7057 double start_f = start_h * 6. - start_i;
7058 double start_q = 1. - start_f;
7060 double stop_f = stop_h * 6. - stop_i;
7061 double stop_q = 1. - stop_f;
7063 switch (start_i % 6)
7067 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
7070 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
7075 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
7078 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
7082 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
7087 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7097 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7100 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7105 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7108 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7112 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7117 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7124 out <<
" <linearGradient id=\"colorbar_" << index
7125 <<
"\" gradientUnits=\"userSpaceOnUse\" " 7126 <<
"x1=\"" << width + additional_width <<
"\" " 7128 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7129 (margin_in_percent + 29)) +
7130 (3 - index) * element_height
7132 <<
"x2=\"" << width + additional_width <<
"\" " 7134 << static_cast<unsigned int>(.5 + (height / 100.) *
7135 (margin_in_percent + 29)) +
7136 (4 - index) * element_height
7139 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7140 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n' 7141 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7142 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n' 7143 <<
" </linearGradient>" <<
'\n';
7148 <<
" x=\"" << width + additional_width <<
"\" y=\"" 7149 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7150 (margin_in_percent + 29)) +
7151 (3 - index) * element_height
7152 <<
"\" width=\"" << element_width <<
"\" height=\"" 7154 <<
"\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_" 7155 << index <<
")\"/>" <<
'\n';
7158 for (
unsigned int index = 0; index < 5; index++)
7162 << width + additional_width +
7163 static_cast<unsigned int>(1.5 * element_width)
7165 << static_cast<unsigned int>(
7166 .5 + (height / 100.) * (margin_in_percent + 29) +
7167 (4. - index) * element_height + 30.)
7169 <<
" style=\"text-anchor:start; font-size:80; font-family:Helvetica";
7171 if (index == 0 || index == 4)
7172 out <<
"; font-weight:bold";
7175 <<
static_cast<float>(
7176 (
static_cast<int>((z_min + index * (z_dimension / 4.)) *
7185 out <<
"</text>" <<
'\n';
7190 out <<
'\n' <<
"</svg>";
7196 template <
int dim,
int spacedim>
7200 const std::vector<std::string> & data_names,
7201 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
7202 & nonscalar_data_ranges,
7206 const unsigned int size = nonscalar_data_ranges.size();
7208 std::tuple<
unsigned int,
7212 new_nonscalar_data_ranges(size);
7213 for (
unsigned int i = 0; i < size; ++i)
7215 new_nonscalar_data_ranges[i] =
7216 std::tuple<
unsigned int,
7220 std::get<0>(nonscalar_data_ranges[i]),
7221 std::get<1>(nonscalar_data_ranges[i]),
7222 std::get<2>(nonscalar_data_ranges[i]),
7227 patches, data_names, new_nonscalar_data_ranges, flags, out);
7232 template <
int dim,
int spacedim>
7236 const std::vector<std::string> & data_names,
7238 std::tuple<
unsigned int,
7242 &nonscalar_data_ranges,
7251 out << dim <<
' ' << spacedim <<
'\n';
7254 out <<
"[deal.II intermediate format graphics data]" <<
'\n' 7255 <<
"[written by " << DEAL_II_PACKAGE_NAME <<
" " 7256 << DEAL_II_PACKAGE_VERSION <<
"]" <<
'\n' 7257 <<
"[Version: " << Deal_II_IntermediateFlags::format_version <<
"]" 7260 out << data_names.size() <<
'\n';
7261 for (
const auto &data_name : data_names)
7262 out << data_name <<
'\n';
7264 out << patches.size() <<
'\n';
7265 for (
unsigned int i = 0; i < patches.size(); ++i)
7266 out << patches[i] <<
'\n';
7268 out << nonscalar_data_ranges.size() <<
'\n';
7269 for (
const auto &nonscalar_data_range : nonscalar_data_ranges)
7270 out << std::get<0>(nonscalar_data_range) <<
' ' 7271 << std::get<1>(nonscalar_data_range) <<
'\n' 7272 << std::get<2>(nonscalar_data_range) <<
'\n';
7281 std::pair<unsigned int, unsigned int>
7286 unsigned int dim, spacedim;
7287 input >> dim >> spacedim;
7289 return std::make_pair(dim, spacedim);
7298 template <
int dim,
int spacedim>
7300 : default_subdivisions(1)
7306 template <
int dim,
int spacedim>
7311 get_dataset_names(),
7312 get_nonscalar_data_ranges(),
7319 template <
int dim,
int spacedim>
7324 get_dataset_names(),
7325 get_nonscalar_data_ranges(),
7332 template <
int dim,
int spacedim>
7337 get_dataset_names(),
7338 get_nonscalar_data_ranges(),
7345 template <
int dim,
int spacedim>
7350 get_dataset_names(),
7351 get_nonscalar_data_ranges(),
7358 template <
int dim,
int spacedim>
7363 get_dataset_names(),
7364 get_nonscalar_data_ranges(),
7371 template <
int dim,
int spacedim>
7376 get_dataset_names(),
7377 get_nonscalar_data_ranges(),
7384 template <
int dim,
int spacedim>
7389 get_dataset_names(),
7390 get_nonscalar_data_ranges(),
7397 template <
int dim,
int spacedim>
7402 get_dataset_names(),
7403 get_nonscalar_data_ranges(),
7410 template <
int dim,
int spacedim>
7415 get_dataset_names(),
7416 get_nonscalar_data_ranges(),
7421 template <
int dim,
int spacedim>
7426 get_dataset_names(),
7427 get_nonscalar_data_ranges(),
7432 template <
int dim,
int spacedim>
7437 get_dataset_names(),
7438 get_nonscalar_data_ranges(),
7443 template <
int dim,
int spacedim>
7446 const std::string &filename,
7447 MPI_Comm comm)
const 7449 #ifndef DEAL_II_WITH_MPI 7453 std::ofstream f(filename);
7460 int ierr = MPI_Info_create(&info);
7463 ierr = MPI_File_open(comm,
7464 DEAL_II_MPI_CONST_CAST(filename.c_str()),
7465 MPI_MODE_CREATE | MPI_MODE_WRONLY,
7470 ierr = MPI_File_set_size(fh, 0);
7474 ierr = MPI_Barrier(comm);
7476 ierr = MPI_Info_free(&info);
7479 unsigned int header_size;
7484 std::stringstream ss;
7486 header_size = ss.str().size();
7487 ierr = MPI_File_write(fh,
7488 DEAL_II_MPI_CONST_CAST(ss.str().c_str()),
7495 ierr = MPI_Bcast(&header_size, 1, MPI_UNSIGNED, 0, comm);
7498 ierr = MPI_File_seek_shared(fh, header_size, MPI_SEEK_SET);
7501 std::stringstream ss;
7503 get_dataset_names(),
7504 get_nonscalar_data_ranges(),
7507 ierr = MPI_File_write_ordered(fh,
7508 DEAL_II_MPI_CONST_CAST(ss.str().c_str()),
7518 std::stringstream ss;
7520 unsigned int footer_size = ss.str().size();
7521 ierr = MPI_File_write_shared(fh,
7522 DEAL_II_MPI_CONST_CAST(ss.str().c_str()),
7528 ierr = MPI_File_close(&fh);
7534 template <
int dim,
int spacedim>
7538 const std::vector<std::string> &piece_names)
const 7542 get_dataset_names(),
7543 get_nonscalar_data_ranges());
7548 template <
int dim,
int spacedim>
7551 std::ostream &out)
const 7554 get_dataset_names(),
7555 get_nonscalar_data_ranges(),
7556 deal_II_intermediate_flags,
7561 template <
int dim,
int spacedim>
7565 const std::string & h5_filename,
7566 const double cur_time,
7567 MPI_Comm comm)
const 7569 return create_xdmf_entry(
7570 data_filter, h5_filename, h5_filename, cur_time, comm);
7575 template <
int dim,
int spacedim>
7579 const std::string & h5_mesh_filename,
7580 const std::string & h5_solution_filename,
7581 const double cur_time,
7582 MPI_Comm comm)
const 7584 unsigned int local_node_cell_count[2], global_node_cell_count[2];
7586 #ifndef DEAL_II_WITH_HDF5 7590 (void)h5_mesh_filename;
7591 (void)h5_solution_filename;
7597 ExcMessage(
"XDMF only supports 2 or 3 space dimensions."));
7599 local_node_cell_count[0] = data_filter.
n_nodes();
7600 local_node_cell_count[1] = data_filter.
n_cells();
7603 #ifdef DEAL_II_WITH_MPI 7605 int ierr = MPI_Allreduce(local_node_cell_count,
7606 global_node_cell_count,
7614 const int myrank = 0;
7615 global_node_cell_count[0] = local_node_cell_count[0];
7616 global_node_cell_count[1] = local_node_cell_count[1];
7623 h5_solution_filename,
7625 global_node_cell_count[0],
7626 global_node_cell_count[1],
7629 unsigned int n_data_sets = data_filter.
n_data_sets();
7634 for (i = 0; i < n_data_sets; ++i)
7648 template <
int dim,
int spacedim>
7651 const std::vector<XDMFEntry> &entries,
7652 const std::string & filename,
7653 MPI_Comm comm)
const 7655 #ifdef DEAL_II_WITH_MPI 7659 const int myrank = 0;
7665 std::ofstream xdmf_file(filename.c_str());
7666 std::vector<XDMFEntry>::const_iterator it;
7668 xdmf_file <<
"<?xml version=\"1.0\" ?>\n";
7669 xdmf_file <<
"<!DOCTYPE Xdmf SYSTEM \"Xdmf.dtd\" []>\n";
7670 xdmf_file <<
"<Xdmf Version=\"2.0\">\n";
7671 xdmf_file <<
" <Domain>\n";
7673 <<
" <Grid Name=\"CellTime\" GridType=\"Collection\" CollectionType=\"Temporal\">\n";
7676 for (it = entries.begin(); it != entries.end(); ++it)
7677 xdmf_file << it->get_xdmf_content(3);
7679 xdmf_file <<
" </Grid>\n";
7680 xdmf_file <<
" </Domain>\n";
7681 xdmf_file <<
"</Xdmf>\n";
7693 template <
int dim,
int spacedim>
7699 get_dataset_names(),
7700 get_nonscalar_data_ranges(),
7706 template <
int dim,
int spacedim>
7710 const std::vector<std::string> & data_names,
7711 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
7712 & nonscalar_data_ranges,
7715 const unsigned int size = nonscalar_data_ranges.size();
7717 std::tuple<
unsigned int,
7721 new_nonscalar_data_ranges(size);
7722 for (
unsigned int i = 0; i < size; ++i)
7724 new_nonscalar_data_ranges[i] =
7725 std::tuple<
unsigned int,
7729 std::get<0>(nonscalar_data_ranges[i]),
7730 std::get<1>(nonscalar_data_ranges[i]),
7731 std::get<2>(nonscalar_data_ranges[i]),
7737 new_nonscalar_data_ranges,
7743 template <
int dim,
int spacedim>
7747 const std::vector<std::string> & data_names,
7749 std::tuple<
unsigned int,
7753 & nonscalar_data_ranges,
7756 const unsigned int n_data_sets = data_names.size();
7757 unsigned int n_node, n_cell;
7761 #ifndef DEAL_II_WITH_MPI 7770 if (patches.size() == 0)
7774 compute_sizes<dim, spacedim>(patches, n_node, n_cell);
7777 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
7779 &DataOutBase::template write_gmv_reorder_data_vectors<dim, spacedim>;
7783 write_nodes(patches, filtered_data);
7784 write_cells(patches, filtered_data);
7787 reorder_task.join();
7791 unsigned int i, n_th_vector, data_set, pt_data_vector_dim;
7792 std::string vector_name;
7793 for (n_th_vector = 0, data_set = 0; data_set < n_data_sets;)
7796 while (n_th_vector < nonscalar_data_ranges.size() &&
7797 std::get<0>(nonscalar_data_ranges[n_th_vector]) < data_set)
7801 if (n_th_vector < nonscalar_data_ranges.size() &&
7802 std::get<0>(nonscalar_data_ranges[n_th_vector]) == data_set)
7805 pt_data_vector_dim = std::get<1>(nonscalar_data_ranges[n_th_vector]) -
7806 std::get<0>(nonscalar_data_ranges[n_th_vector]) +
7811 std::get<1>(nonscalar_data_ranges[n_th_vector]) >=
7812 std::get<0>(nonscalar_data_ranges[n_th_vector]),
7813 ExcLowerRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
7814 std::get<0>(nonscalar_data_ranges[n_th_vector])));
7816 std::get<1>(nonscalar_data_ranges[n_th_vector]) < n_data_sets,
7817 ExcIndexRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
7823 if (!std::get<2>(nonscalar_data_ranges[n_th_vector]).empty())
7825 vector_name = std::get<2>(nonscalar_data_ranges[n_th_vector]);
7830 for (i = std::get<0>(nonscalar_data_ranges[n_th_vector]);
7831 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
7833 vector_name += data_names[i] +
"__";
7835 data_names[std::get<1>(nonscalar_data_ranges[n_th_vector])];
7841 pt_data_vector_dim = 1;
7842 vector_name = data_names[data_set];
7852 data_set += pt_data_vector_dim;
7858 template <
int dim,
int spacedim>
7862 const std::string & filename,
7863 MPI_Comm comm)
const 7870 template <
int dim,
int spacedim>
7874 const bool write_mesh_file,
7875 const std::string & mesh_filename,
7876 const std::string & solution_filename,
7877 MPI_Comm comm)
const 7889 template <
int dim,
int spacedim>
7894 const std::string & filename,
7902 template <
int dim,
int spacedim>
7907 const bool write_mesh_file,
7908 const std::string & mesh_filename,
7909 const std::string & solution_filename,
7915 "DataOutBase was asked to write HDF5 output for a space dimension of 1. " 7916 "HDF5 only supports datasets that live in 2 or 3 dimensions."));
7920 #ifndef DEAL_II_WITH_HDF5 7924 (void)write_mesh_file;
7925 (void)mesh_filename;
7926 (void)solution_filename;
7930 # ifndef DEAL_II_WITH_MPI 7941 hid_t h5_mesh_file_id = -1, h5_solution_file_id, file_plist_id, plist_id;
7942 hid_t node_dataspace, node_dataset, node_file_dataspace,
7943 node_memory_dataspace;
7944 hid_t cell_dataspace, cell_dataset, cell_file_dataspace,
7945 cell_memory_dataspace;
7946 hid_t pt_data_dataspace, pt_data_dataset, pt_data_file_dataspace,
7947 pt_data_memory_dataspace;
7949 unsigned int local_node_cell_count[2], global_node_cell_count[2],
7950 global_node_cell_offsets[2];
7951 hsize_t count[2], offset[2], node_ds_dim[2], cell_ds_dim[2];
7952 std::vector<double> node_data_vec;
7953 std::vector<unsigned int> cell_data_vec;
7956 # ifndef H5_HAVE_PARALLEL 7957 # ifdef DEAL_II_WITH_MPI 7962 "Serial HDF5 output on multiple processes is not yet supported."));
7966 local_node_cell_count[0] = data_filter.
n_nodes();
7967 local_node_cell_count[1] = data_filter.
n_cells();
7970 file_plist_id = H5Pcreate(H5P_FILE_ACCESS);
7973 # ifdef DEAL_II_WITH_MPI 7974 # ifdef H5_HAVE_PARALLEL 7976 status = H5Pset_fapl_mpio(file_plist_id, comm, MPI_INFO_NULL);
7983 # ifdef DEAL_II_WITH_MPI 7984 ierr = MPI_Allreduce(local_node_cell_count,
7985 global_node_cell_count,
7991 ierr = MPI_Scan(local_node_cell_count,
7992 global_node_cell_offsets,
7998 global_node_cell_offsets[0] -= local_node_cell_count[0];
7999 global_node_cell_offsets[1] -= local_node_cell_count[1];
8001 global_node_cell_count[0] = local_node_cell_count[0];
8002 global_node_cell_count[1] = local_node_cell_count[1];
8003 global_node_cell_offsets[0] = global_node_cell_offsets[1] = 0;
8007 plist_id = H5Pcreate(H5P_DATASET_XFER);
8009 # ifdef DEAL_II_WITH_MPI 8010 # ifdef H5_HAVE_PARALLEL 8011 status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
8016 if (write_mesh_file)
8019 h5_mesh_file_id = H5Fcreate(mesh_filename.c_str(),
8027 node_ds_dim[0] = global_node_cell_count[0];
8028 node_ds_dim[1] = (spacedim < 2) ? 2 : spacedim;
8029 node_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8032 cell_ds_dim[0] = global_node_cell_count[1];
8034 cell_dataspace = H5Screate_simple(2, cell_ds_dim,
nullptr);
8038 # if H5Gcreate_vers == 1 8039 node_dataset = H5Dcreate(h5_mesh_file_id,
8045 node_dataset = H5Dcreate(h5_mesh_file_id,
8054 # if H5Gcreate_vers == 1 8055 cell_dataset = H5Dcreate(
8056 h5_mesh_file_id,
"cells", H5T_NATIVE_UINT, cell_dataspace, H5P_DEFAULT);
8058 cell_dataset = H5Dcreate(h5_mesh_file_id,
8069 status = H5Sclose(node_dataspace);
8071 status = H5Sclose(cell_dataspace);
8076 count[0] = local_node_cell_count[0];
8077 count[1] = (spacedim < 2) ? 2 : spacedim;
8079 offset[0] = global_node_cell_offsets[0];
8082 node_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8086 node_file_dataspace = H5Dget_space(node_dataset);
8088 status = H5Sselect_hyperslab(
8089 node_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8093 count[0] = local_node_cell_count[1];
8095 offset[0] = global_node_cell_offsets[1];
8097 cell_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8100 cell_file_dataspace = H5Dget_space(cell_dataset);
8102 status = H5Sselect_hyperslab(
8103 cell_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8108 status = H5Dwrite(node_dataset,
8110 node_memory_dataspace,
8111 node_file_dataspace,
8113 node_data_vec.data());
8115 node_data_vec.clear();
8118 data_filter.
fill_cell_data(global_node_cell_offsets[0], cell_data_vec);
8119 status = H5Dwrite(cell_dataset,
8121 cell_memory_dataspace,
8122 cell_file_dataspace,
8124 cell_data_vec.data());
8126 cell_data_vec.clear();
8129 status = H5Sclose(node_file_dataspace);
8131 status = H5Sclose(cell_file_dataspace);
8135 status = H5Sclose(node_memory_dataspace);
8137 status = H5Sclose(cell_memory_dataspace);
8141 status = H5Dclose(node_dataset);
8143 status = H5Dclose(cell_dataset);
8147 if (mesh_filename != solution_filename)
8149 status = H5Fclose(h5_mesh_file_id);
8155 if (mesh_filename == solution_filename && write_mesh_file)
8157 h5_solution_file_id = h5_mesh_file_id;
8162 h5_solution_file_id = H5Fcreate(solution_filename.c_str(),
8172 std::string vector_name;
8181 node_ds_dim[0] = global_node_cell_count[0];
8182 node_ds_dim[1] = pt_data_vector_dim;
8183 pt_data_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8186 # if H5Gcreate_vers == 1 8187 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8188 vector_name.c_str(),
8193 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8194 vector_name.c_str(),
8204 count[0] = local_node_cell_count[0];
8205 count[1] = pt_data_vector_dim;
8206 offset[0] = global_node_cell_offsets[0];
8208 pt_data_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8212 pt_data_file_dataspace = H5Dget_space(pt_data_dataset);
8214 status = H5Sselect_hyperslab(pt_data_file_dataspace,
8223 status = H5Dwrite(pt_data_dataset,
8225 pt_data_memory_dataspace,
8226 pt_data_file_dataspace,
8232 status = H5Sclose(pt_data_dataspace);
8234 status = H5Sclose(pt_data_memory_dataspace);
8236 status = H5Sclose(pt_data_file_dataspace);
8239 status = H5Dclose(pt_data_dataset);
8244 status = H5Pclose(file_plist_id);
8248 status = H5Pclose(plist_id);
8252 status = H5Fclose(h5_solution_file_id);
8259 template <
int dim,
int spacedim>
8267 output_format = default_fmt;
8269 switch (output_format)
8303 write_tecplot_binary(out);
8319 write_deal_II_intermediate(out);
8329 template <
int dim,
int spacedim>
8338 template <
int dim,
int spacedim>
8339 template <
typename FlagType>
8345 if (
typeid(flags) ==
typeid(dx_flags))
8347 else if (
typeid(flags) ==
typeid(ucd_flags))
8349 else if (
typeid(flags) ==
typeid(povray_flags))
8351 else if (
typeid(flags) ==
typeid(eps_flags))
8353 else if (
typeid(flags) ==
typeid(gmv_flags))
8355 else if (
typeid(flags) ==
typeid(tecplot_flags))
8358 else if (
typeid(flags) ==
typeid(vtk_flags))
8360 else if (
typeid(flags) ==
typeid(svg_flags))
8362 else if (
typeid(flags) ==
typeid(gnuplot_flags))
8365 else if (
typeid(flags) ==
typeid(deal_II_intermediate_flags))
8366 deal_II_intermediate_flags =
8374 template <
int dim,
int spacedim>
8387 template <
int dim,
int spacedim>
8394 "A name for the output format to be used");
8398 "Number of subdivisions of each mesh cell");
8440 template <
int dim,
int spacedim>
8444 const std::string &output_name = prm.
get(
"Output format");
8446 default_subdivisions = prm.
get_integer(
"Subdivisions");
8449 dx_flags.parse_parameters(prm);
8453 ucd_flags.parse_parameters(prm);
8457 gnuplot_flags.parse_parameters(prm);
8461 povray_flags.parse_parameters(prm);
8465 eps_flags.parse_parameters(prm);
8469 gmv_flags.parse_parameters(prm);
8473 tecplot_flags.parse_parameters(prm);
8477 vtk_flags.parse_parameters(prm);
8481 deal_II_intermediate_flags.parse_parameters(prm);
8487 template <
int dim,
int spacedim>
8491 return (
sizeof(default_fmt) +
8506 template <
int dim,
int spacedim>
8508 std::tuple<
unsigned int,
8515 std::tuple<
unsigned int,
8523 template <
int dim,
int spacedim>
8524 std::vector<std::tuple<unsigned int, unsigned int, std::string>>
8527 const auto &nonscalar_data_ranges = get_nonscalar_data_ranges();
8529 const unsigned int size = nonscalar_data_ranges.size();
8530 std::vector<std::tuple<unsigned int, unsigned int, std::string>>
8531 vector_data_ranges(size);
8532 for (
unsigned int i = 0; i < size; ++i)
8534 vector_data_ranges[i] =
8535 std::tuple<unsigned int, unsigned int, std::string>(
8536 std::get<0>(nonscalar_data_ranges[i]),
8537 std::get<1>(nonscalar_data_ranges[i]),
8538 std::get<2>(nonscalar_data_ranges[i]));
8540 return vector_data_ranges;
8545 template <
int dim,
int spacedim>
8553 std::set<std::string> all_names;
8556 std::tuple<
unsigned int,
8560 ranges = this->get_nonscalar_data_ranges();
8561 const std::vector<std::string> data_names = this->get_dataset_names();
8562 const unsigned int n_data_sets = data_names.size();
8563 std::vector<bool> data_set_written(n_data_sets,
false);
8565 for (
const auto &range : ranges)
8567 const std::string &name = std::get<2>(range);
8570 Assert(all_names.find(name) == all_names.end(),
8572 "Error: names of fields in DataOut need to be unique, " 8574 name +
"' is used more than once."));
8575 all_names.insert(name);
8576 for (
unsigned int i = std::get<0>(range); i <= std::get<1>(range);
8578 data_set_written[i] =
true;
8582 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
8583 if (data_set_written[data_set] ==
false)
8585 const std::string &name = data_names[data_set];
8586 Assert(all_names.find(name) == all_names.end(),
8588 "Error: names of fields in DataOut need to be unique, " 8590 name +
"' is used more than once."));
8591 all_names.insert(name);
8601 template <
int dim,
int spacedim>
8609 std::vector<typename ::DataOutBase::Patch<dim, spacedim>> tmp;
8613 std::vector<std::string> tmp;
8614 tmp.swap(dataset_names);
8618 std::tuple<
unsigned int,
8623 tmp.swap(nonscalar_data_ranges);
8630 std::pair<unsigned int, unsigned int> dimension_info =
8633 (dimension_info.second == spacedim),
8634 ExcIncompatibleDimensions(
8635 dimension_info.first, dim, dimension_info.second, spacedim));
8644 getline(in, header);
8646 std::ostringstream s;
8647 s <<
"[deal.II intermediate format graphics data]";
8649 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
8653 getline(in, header);
8655 std::ostringstream s;
8656 s <<
"[written by " << DEAL_II_PACKAGE_NAME <<
" " 8657 << DEAL_II_PACKAGE_VERSION <<
"]";
8659 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
8663 getline(in, header);
8665 std::ostringstream s;
8669 Assert(header == s.str(),
8671 "Invalid or incompatible file format. Intermediate format " 8672 "files can only be read by the same deal.II version as they " 8673 "are written by."));
8677 unsigned int n_datasets;
8679 dataset_names.resize(n_datasets);
8680 for (
unsigned int i = 0; i < n_datasets; ++i)
8681 in >> dataset_names[i];
8683 unsigned int n_patches;
8685 patches.resize(n_patches);
8686 for (
unsigned int i = 0; i < n_patches; ++i)
8689 unsigned int n_nonscalar_data_ranges;
8690 in >> n_nonscalar_data_ranges;
8691 nonscalar_data_ranges.resize(n_nonscalar_data_ranges);
8692 for (
unsigned int i = 0; i < n_nonscalar_data_ranges; ++i)
8694 in >> std::get<0>(nonscalar_data_ranges[i]) >>
8695 std::get<1>(nonscalar_data_ranges[i]);
8704 std::get<2>(nonscalar_data_ranges[i]) = name;
8712 template <
int dim,
int spacedim>
8716 using Patch = typename ::DataOutBase::Patch<dim, spacedim>;
8719 const std::vector<Patch> &source_patches = source.
get_patches();
8727 Assert(get_nonscalar_data_ranges().size() ==
8729 ExcMessage(
"Both sources need to declare the same components " 8731 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
8733 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
8735 ExcMessage(
"Both sources need to declare the same components " 8737 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
8739 ExcMessage(
"Both sources need to declare the same components " 8741 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
8743 ExcMessage(
"Both sources need to declare the same components " 8748 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
8750 Assert(patches[0].data.n_rows() == source_patches[0].data.n_rows(),
8752 Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(),
8757 const unsigned int old_n_patches = patches.size();
8758 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
8761 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
8762 patches[i].patch_index += old_n_patches;
8765 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
8766 for (
unsigned int n = 0; n < GeometryInfo<dim>::faces_per_cell; ++n)
8767 if (patches[i].neighbors[n] !=
8769 patches[i].neighbors[n] += old_n_patches;
8774 template <
int dim,
int spacedim>
8775 const std::vector<typename ::DataOutBase::Patch<dim, spacedim>> &
8783 template <
int dim,
int spacedim>
8784 std::vector<std::string>
8787 return dataset_names;
8792 template <
int dim,
int spacedim>
8794 std::tuple<
unsigned int,
8800 return nonscalar_data_ranges;
8809 , h5_sol_filename(
"")
8810 , h5_mesh_filename(
"")
8812 , num_nodes(
numbers::invalid_unsigned_int)
8813 , num_cells(
numbers::invalid_unsigned_int)
8814 , dimension(
numbers::invalid_unsigned_int)
8815 , space_dimension(
numbers::invalid_unsigned_int)
8822 const unsigned int nodes,
8823 const unsigned int cells,
8824 const unsigned int dim)
8825 :
XDMFEntry(filename, filename, time, nodes, cells, dim, dim)
8831 const std::string &solution_filename,
8833 const unsigned int nodes,
8834 const unsigned int cells,
8835 const unsigned int dim)
8836 :
XDMFEntry(mesh_filename, solution_filename, time, nodes, cells, dim, dim)
8842 const std::string &solution_filename,
8844 const unsigned int nodes,
8845 const unsigned int cells,
8846 const unsigned int dim,
8847 const unsigned int spacedim)
8849 , h5_sol_filename(solution_filename)
8850 , h5_mesh_filename(mesh_filename)
8855 , space_dimension(spacedim)
8862 const unsigned int dimension)
8875 indent(
const unsigned int indent_level)
8877 std::string res =
"";
8878 for (
unsigned int i = 0; i < indent_level; ++i)
8892 std::stringstream ss;
8893 ss << indent(indent_level + 0)
8894 <<
"<Grid Name=\"mesh\" GridType=\"Uniform\">\n";
8895 ss << indent(indent_level + 1) <<
"<Time Value=\"" <<
entry_time <<
"\"/>\n";
8896 ss << indent(indent_level + 1) <<
"<Geometry GeometryType=\"" 8898 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes 8900 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
8902 ss << indent(indent_level + 2) <<
"</DataItem>\n";
8903 ss << indent(indent_level + 1) <<
"</Geometry>\n";
8908 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 8910 <<
"\" NumberOfElements=\"" <<
num_cells 8911 <<
"\" NodesPerElement=\"1\">\n";
8913 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 8915 <<
"\" NumberOfElements=\"" <<
num_cells 8916 <<
"\" NodesPerElement=\"2\">\n";
8918 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 8920 <<
"\" NumberOfElements=\"" <<
num_cells <<
"\">\n";
8922 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 8924 <<
"\" NumberOfElements=\"" <<
num_cells <<
"\">\n";
8926 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_cells 8928 <<
"\" NumberType=\"UInt\" Format=\"HDF\">\n";
8930 ss << indent(indent_level + 2) <<
"</DataItem>\n";
8931 ss << indent(indent_level + 1) <<
"</Topology>\n";
8937 ss << indent(indent_level + 1)
8938 <<
"<Topology TopologyType=\"Polyvertex\" NumberOfElements=\"" 8940 ss << indent(indent_level + 1) <<
"</Topology>\n";
8945 ss << indent(indent_level + 1) <<
"<Attribute Name=\"" 8946 << attribute_dim.first <<
"\" AttributeType=\"" 8947 << (attribute_dim.second > 1 ?
"Vector" :
"Scalar")
8948 <<
"\" Center=\"Node\">\n";
8950 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes 8951 <<
" " << (attribute_dim.second > 1 ? 3 : 1)
8952 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
8954 << attribute_dim.first <<
"\n";
8955 ss << indent(indent_level + 2) <<
"</DataItem>\n";
8956 ss << indent(indent_level + 1) <<
"</Attribute>\n";
8959 ss << indent(indent_level + 0) <<
"</Grid>\n";
8968 template <
int dim,
int spacedim>
8970 operator<<(std::ostream &out, const Patch<dim, spacedim> &patch)
8973 out <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]" 8977 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
8981 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
8989 out << patch.
data.n_rows() <<
' ' << patch.
data.n_cols() <<
'\n';
8990 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
8991 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
8992 out << patch.
data[i][j] <<
' ';
9000 template <
int dim,
int spacedim>
9012 getline(in, header);
9013 while ((header.size() != 0) && (header[header.size() - 1] ==
' '))
9014 header.erase(header.size() - 1);
9016 while ((header.empty()) && in);
9018 std::ostringstream s;
9019 s <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]";
9021 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9026 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
9029 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
9036 unsigned int n_rows, n_cols;
9037 in >> n_rows >> n_cols;
9039 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9040 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9041 in >> patch.
data[i][j];
9052 #include "data_out_base.inst" 9054 DEAL_II_NAMESPACE_CLOSE
static void declare_parameters(ParameterHandler &prm)
long int get_integer(const std::string &entry_string) const
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names) const
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static const unsigned int invalid_unsigned_int
unsigned int space_dimension
Map3DPoint existing_points
static ::ExceptionBase & ExcIncompatiblePatchLists()
unsigned int height_vector
void write_vtu_footer(std::ostream &out)
static void declare_parameters(ParameterHandler &prm)
#define DeclException2(Exception2, type1, type2, outsequence)
#define AssertDimension(dim1, dim2)
void parse_parameters(const ParameterHandler &prm)
void write_hdf5_parallel(const DataOutBase::DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm) const
void write_tecplot_binary(std::ostream &out) const
void swap(TableBase< N, T > &v)
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation="")
void set_flags(const FlagType &flags)
void write_vtu_main(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
void write_data_set(const std::string &name, const unsigned int dimension, const unsigned int set_num, const Table< 2, double > &data_vectors)
std::map< unsigned int, unsigned int > filtered_cells
void write_gmv(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const GmvFlags &flags, std::ostream &out)
static ::ExceptionBase & ExcIO()
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
Task< RT > new_task(const std::function< RT()> &function)
virtual const std::vector<::DataOutBase::Patch< dim, spacedim > > & get_patches() const override
std::pair< unsigned int, unsigned int > determine_intermediate_format_dimensions(std::istream &input)
void write_vtu_in_parallel(const std::string &filename, MPI_Comm comm) const
void parse_parameters(const ParameterHandler &prm)
void swap(Patch< dim, spacedim > &other_patch)
void merge(const DataOutReader< dim, spacedim > &other)
std::string get(const std::string &entry_string) const
void write_vtu_header(std::ostream &out, const VtkFlags &flags)
unsigned int n_nodes() const
void write_svg(const std::vector< Patch< 2, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const SvgFlags &flags, std::ostream &out)
static RgbValues default_color_function(const double value, const double min_value, const double max_value)
void write_pvd_record(std::ostream &out, const std::vector< std::pair< double, std::string >> ×_and_names)
ZlibCompressionLevel compression_level
static ::ExceptionBase & ExcNotInitialized()
virtual std::vector< std::string > get_dataset_names() const override
#define AssertThrow(cond, exc)
void write_vtk(std::ostream &out) const
unsigned int get_data_set_dim(const unsigned int set_num) const
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
std::vector< unsigned int > data_set_dims
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
std::string get_xdmf_content(const unsigned int indent_level) const
bool filter_duplicate_vertices
std::vector< std::vector< double > > data_sets
static void declare_parameters(ParameterHandler &prm)
void fill_cell_data(const unsigned int local_node_offset, std::vector< unsigned int > &cell_data) const
std::map< std::string, unsigned int > attribute_dims
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
void parse_parameters(ParameterHandler &prm)
void write_filtered_data(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, DataOutFilter &filtered_data)
Point< spacedim > vertices[1]
void write_ucd(std::ostream &out) const
std::string default_suffix(const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
void write_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm)
__global__ void scale(Number *val, const Number *V_val, const size_type N)
void write_tecplot(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const TecplotFlags &flags, std::ostream &out)
const char * tecplot_binary_file_name
unsigned int neighbors[dim > 0 ? GeometryInfo< dim >::faces_per_cell :1]
void write_deal_II_intermediate(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const Deal_II_IntermediateFlags &flags, std::ostream &out)
void enter_subsection(const std::string &subsection)
static ::ExceptionBase & ExcNoPatches()
static ::ExceptionBase & ExcIncompatibleDatasetNames()
DataOutBase::DataOutFilterFlags flags
SvgFlags(const unsigned int height_vector=0, const int azimuth_angle=37, const int polar_angle=45, const unsigned int line_thickness=1, const bool margin=true, const bool draw_colorbar=true)
unsigned int n_data_sets() const
std::string default_suffix(const OutputFormat output_format)
EpsFlags(const unsigned int height_vector=0, const unsigned int color_vector=0, const SizeType size_type=width, const unsigned int size=300, const double line_width=0.5, const double azimut_angle=60, const double turn_angle=30, const double z_scaling=1.0, const bool draw_mesh=true, const bool draw_cells=true, const bool shade_cells=true, const ColorFunction color_function=&default_color_function)
static ::ExceptionBase & ExcNotEnoughSpaceDimensionLabels()
std::istream & operator>>(std::istream &in, Patch< dim, spacedim > &patch)
static ::ExceptionBase & ExcMessage(std::string arg1)
std::vector< std::string > space_dimension_labels
static RgbValues reverse_grey_scale_color_function(const double value, const double min_value, const double max_value)
void write_point(const unsigned int index, const Point< dim > &p)
double get_double(const std::string &entry_name) const
unsigned int n_cells() const
std::size_t memory_consumption() const
TecplotFlags(const char *tecplot_binary_file_name=nullptr, const char *zone_name=nullptr, const double solution_time=-1.0)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
T sum(const T &t, const MPI_Comm &mpi_communicator)
std::vector< std::string > data_set_names
void add_attribute(const std::string &attr_name, const unsigned int dimension)
void write_tecplot(std::ostream &out) const
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
#define Assert(cond, exc)
DXFlags(const bool write_neighbors=false, const bool int_binary=false, const bool coordinates_binary=false, const bool data_binary=false)
void write_vtu(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
void write_tecplot_binary(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const TecplotFlags &flags, std::ostream &out)
void write_cell(const unsigned int index, const unsigned int start, const unsigned int d1, const unsigned int d2, const unsigned int d3)
void read(std::istream &in)
bool points_are_available
OutputFormat parse_output_format(const std::string &format_name)
void write_xdmf_file(const std::vector< XDMFEntry > &entries, const std::string &filename, MPI_Comm comm) const
void write_dx(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const DXFlags &flags, std::ostream &out)
ColorFunction color_function
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
void write_svg(std::ostream &out) const
unsigned int n_subdivisions
bool get_bool(const std::string &entry_name) const
void parse_parameters(const ParameterHandler &prm)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges() const
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
std::string h5_sol_filename
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
void parse_parameters(const ParameterHandler &prm)
static ::ExceptionBase & ExcLowerRange(int arg1, int arg2)
std::string h5_mesh_filename
unsigned int n_mpi_processes(const MPI_Comm &mpi_communicator)
void fill_node_data(std::vector< double > &node_data) const
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
static ::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
static void declare_parameters(ParameterHandler &prm)
static void declare_parameters(ParameterHandler &prm)
bool operator==(const Patch &patch) const
void write_eps(std::ostream &out) const
DataComponentInterpretation
void swap(Vector< Number > &u, Vector< Number > &v)
void write_povray(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const PovrayFlags &flags, std::ostream &out)
void write_deal_II_intermediate(std::ostream &out) const
static void declare_parameters(ParameterHandler &prm)
static const unsigned int no_neighbor
std::size_t memory_consumption() const
size_type size(const unsigned int i) const
void write_ucd(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const UcdFlags &flags, std::ostream &out)
#define AssertThrowMPI(error_code)
void write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const
const double * get_data_set(const unsigned int set_num) const
VtkFlags(const double time=std::numeric_limits< double >::min(), const unsigned int cycle=std::numeric_limits< unsigned int >::min(), const bool print_date_and_time=true, const ZlibCompressionLevel compression_level=best_compression, const bool write_higher_order_cells=false)
static constexpr double PI
void write_povray(std::ostream &out) const
static const unsigned int space_dim
void set_default_format(const DataOutBase::OutputFormat default_format)
void write_gmv(std::ostream &out) const
PovrayFlags(const bool smooth=false, const bool bicubic_patch=false, const bool external_data=false)
void internal_add_cell(const unsigned int cell_index, const unsigned int pt_index)
unsigned int color_vector
std::size_t memory_consumption() const
unsigned int this_mpi_process(const MPI_Comm &mpi_communicator)
void validate_dataset_names() const
static ::ExceptionBase & ExcNotImplemented()
std::ostream & operator<<(std::ostream &out, const SymmetricTensor< 2, dim, Number > &t)
static void declare_parameters(ParameterHandler &prm)
void write_dx(std::ostream &out) const
std::string get_data_set_name(const unsigned int set_num) const
std::size_t memory_consumption() const
std::map< unsigned int, unsigned int > filtered_points
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const
bool points_are_available
bool write_higher_order_cells
void write_gnuplot(std::ostream &out) const
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
void write_vtu(std::ostream &out) const
UcdFlags(const bool write_preamble=false)
void parse_parameters(const ParameterHandler &prm)
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges)
std::string get_output_format_names()
unsigned int height_vector
unsigned int vertices_per_cell
void write_gnuplot(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const GnuplotFlags &flags, std::ostream &out)
void write_vtk(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
void write_eps(const std::vector< Patch< 2, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const EpsFlags &flags, std::ostream &out)
static ::ExceptionBase & ExcErrorOpeningTecplotFile(char *arg1)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcTecplotAPIError()
XDMFEntry create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, MPI_Comm comm) const