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[(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((Bytef *)compressed_data,
270 &compressed_data_length,
271 (
const Bytef *)data.data(),
272 data.size() *
sizeof(T),
278 const uint32_t compression_header[4] = {
280 (uint32_t)(data.size() *
sizeof(T)),
281 (uint32_t)(data.size() *
sizeof(T)),
283 compressed_data_length};
285 char *encoded_header =
286 encode_block(reinterpret_cast<const char *>(&compression_header[0]),
287 4 *
sizeof(compression_header[0]));
288 output_stream << encoded_header;
289 delete[] encoded_header;
293 encode_block(compressed_data, compressed_data_length);
294 delete[] compressed_data;
296 output_stream << encoded_data;
297 delete[] encoded_data;
343 operator<(
const SvgCell &)
const;
347 SvgCell::operator<(
const SvgCell &e)
const 350 return depth > e.depth;
384 operator<(
const EpsCell2d &)
const;
398 template <
int dim,
int spacedim,
typename Number =
double>
400 write_gmv_reorder_data_vectors(
401 const std::vector<Patch<dim, spacedim>> &patches,
405 if (patches.size() == 0)
415 const unsigned int n_data_sets = patches[0].points_are_available ?
416 (patches[0].data.n_rows() - spacedim) :
417 patches[0].data.n_rows();
422 unsigned int next_value = 0;
423 for (
typename std::vector<Patch<dim, spacedim>>::const_iterator patch =
425 patch != patches.end();
428 const unsigned int n_subdivisions = patch->n_subdivisions;
429 (void)n_subdivisions;
431 Assert((patch->data.n_rows() == n_data_sets &&
432 !patch->points_are_available) ||
433 (patch->data.n_rows() == n_data_sets + spacedim &&
434 patch->points_are_available),
436 (n_data_sets + spacedim) :
438 patch->data.n_rows()));
439 Assert((n_data_sets == 0) ||
440 (patch->data.n_cols() ==
441 Utilities::fixed_power<dim>(n_subdivisions + 1)),
443 n_subdivisions + 1));
445 for (
unsigned int i = 0; i < patch->data.n_cols(); ++i, ++next_value)
446 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
447 data_vectors[data_set][next_value] = patch->data(data_set, i);
450 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
457 DataOutFilter::DataOutFilter()
459 , node_dim(
numbers::invalid_unsigned_int)
460 , vertices_per_cell(
numbers::invalid_unsigned_int)
480 for (
unsigned int d = 0; d < dim; ++d)
484 unsigned int internal_ind;
495 internal_ind = it->second;
505 const unsigned int pt_index)
521 for (
unsigned int d = 0; d <
node_dim; ++d)
522 node_data[node_dim * it->second + d] = it->first(d);
530 std::vector<unsigned int> &cell_data)
const 534 for (std::map<unsigned int, unsigned int>::const_iterator it =
539 cell_data[it->first] = it->second + local_node_offset;
608 const unsigned int start,
609 const unsigned int d1,
610 const unsigned int d2,
611 const unsigned int d3)
613 const unsigned int base_entry =
639 const unsigned int dimension,
640 const unsigned int set_num,
643 unsigned int new_dim;
647 if (flags.xdmf_hdf5_output && dimension != 1)
662 for (
unsigned int d = 0; d < new_dim; ++d)
665 data_sets.back()[r * new_dim + d] = data_vectors(set_num + d, i);
681 const char *gmv_cell_type[4] = {
"",
"line 2",
"quad 4",
"hex 8"};
683 const char *ucd_cell_type[4] = {
"pt",
"line",
"quad",
"hex"};
685 const char *tecplot_cell_type[4] = {
"",
"lineseg",
"quadrilateral",
"brick"};
687 #ifdef DEAL_II_HAVE_TECPLOT 688 const unsigned int tecplot_binary_cell_type[4] = {0, 0, 1, 3};
695 const unsigned int vtk_cell_type[5] = {1,
699 static_cast<unsigned int>(-1)};
703 const unsigned int vtk_lagrange_cell_type[5] = {
708 static_cast<unsigned int>(-1)};
719 template <
int dim,
int spacedim>
723 const unsigned int xstep,
724 const unsigned int ystep,
725 const unsigned int zstep,
726 const unsigned int n_subdivisions)
730 unsigned int point_no = 0;
734 Assert(zstep < n_subdivisions + 1,
736 point_no += (n_subdivisions + 1) * (n_subdivisions + 1) * zstep;
739 Assert(ystep < n_subdivisions + 1,
741 point_no += (n_subdivisions + 1) * ystep;
744 Assert(xstep < n_subdivisions + 1,
755 for (
unsigned int d = 0; d < spacedim; ++d)
756 node[d] = patch->
data(patch->
data.
size(0) - spacedim + d, point_no);
765 const double stepsize = 1. / n_subdivisions,
766 xfrac = xstep * stepsize;
772 const double yfrac = ystep * stepsize;
774 node += ((patch->
vertices[3] * xfrac) +
775 (patch->
vertices[2] * (1 - xfrac))) *
779 const double zfrac = zstep * stepsize;
781 node += (((patch->
vertices[5] * xfrac) +
782 (patch->
vertices[4] * (1 - xfrac))) *
785 (patch->
vertices[6] * (1 - xfrac))) *
802 vtk_point_index_from_ijk(
const unsigned i,
805 const std::array<unsigned, 2> &order)
807 const bool ibdy = (i == 0 || i == order[0]);
808 const bool jbdy = (j == 0 || j == order[1]);
810 const int nbdy = (ibdy ? 1 : 0) + (jbdy ? 1 : 0);
814 return (i ? (j ? 2 : 1) : (j ? 3 : 0));
822 return (i - 1) + (j ? order[0] - 1 + order[1] - 1 : 0) + offset;
828 (i ? order[0] - 1 : 2 * (order[0] - 1) + order[1] - 1) +
833 offset += 2 * (order[0] - 1 + order[1] - 1);
835 return offset + (i - 1) + (order[0] - 1) * ((j - 1));
846 vtk_point_index_from_ijk(
const unsigned i,
849 const std::array<unsigned, 3> &order)
851 const bool ibdy = (i == 0 || i == order[0]);
852 const bool jbdy = (j == 0 || j == order[1]);
853 const bool kbdy = (k == 0 || k == order[2]);
855 const int nbdy = (ibdy ? 1 : 0) + (jbdy ? 1 : 0) + (kbdy ? 1 : 0);
859 return (i ? (j ? 2 : 1) : (j ? 3 : 0)) + (k ? 4 : 0);
867 return (i - 1) + (j ? order[0] - 1 + order[1] - 1 : 0) +
868 (k ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset;
873 (i ? order[0] - 1 : 2 * (order[0] - 1) + order[1] - 1) +
874 (k ? 2 * (order[0] - 1 + order[1] - 1) : 0) + offset;
877 offset += 4 * (order[0] - 1) + 4 * (order[1] - 1);
878 return (k - 1) + (order[2] - 1) * (i ? (j ? 3 : 1) : (j ? 2 : 0)) +
882 offset += 4 * (order[0] - 1 + order[1] - 1 + order[2] - 1);
887 return (j - 1) + ((order[1] - 1) * (k - 1)) +
888 (i ? (order[1] - 1) * (order[2] - 1) : 0) + offset;
890 offset += 2 * (order[1] - 1) * (order[2] - 1);
893 return (i - 1) + ((order[0] - 1) * (k - 1)) +
894 (j ? (order[2] - 1) * (order[0] - 1) : 0) + offset;
896 offset += 2 * (order[2] - 1) * (order[0] - 1);
898 return (i - 1) + ((order[0] - 1) * (j - 1)) +
899 (k ? (order[0] - 1) * (order[1] - 1) : 0) + offset;
904 2 * ((order[1] - 1) * (order[2] - 1) + (order[2] - 1) * (order[0] - 1) +
905 (order[0] - 1) * (order[1] - 1));
906 return offset + (i - 1) +
907 (order[0] - 1) * ((j - 1) + (order[1] - 1) * ((k - 1)));
911 vtk_point_index_from_ijk(
const unsigned,
914 const std::array<unsigned, 0> &)
921 vtk_point_index_from_ijk(
const unsigned,
924 const std::array<unsigned, 1> &)
931 template <
int dim,
int spacedim>
940 patch = patches.begin();
941 patch != patches.end();
944 n_nodes += Utilities::fixed_power<dim>(patch->
n_subdivisions + 1);
954 template <
typename FlagsType>
961 StreamBase(std::ostream &stream,
const FlagsType &flags)
976 ExcMessage(
"The derived class you are using needs to " 977 "reimplement this function if you want to call " 1000 const unsigned int ,
1001 const unsigned int )
1004 ExcMessage(
"The derived class you are using needs to " 1005 "reimplement this function if you want to call " 1023 template <
typename T>
1037 unsigned int selected_component;
1044 std::ostream &stream;
1049 const FlagsType
flags;
1055 class DXStream :
public StreamBase<DataOutBase::DXFlags>
1075 const unsigned int start,
1076 const unsigned int x_offset,
1077 const unsigned int y_offset,
1078 const unsigned int z_offset);
1086 template <
typename data>
1088 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1094 class GmvStream :
public StreamBase<DataOutBase::GmvFlags>
1114 const unsigned int start,
1115 const unsigned int x_offset,
1116 const unsigned int y_offset,
1117 const unsigned int z_offset);
1123 class TecplotStream :
public StreamBase<DataOutBase::TecplotFlags>
1143 const unsigned int start,
1144 const unsigned int x_offset,
1145 const unsigned int y_offset,
1146 const unsigned int z_offset);
1152 class UcdStream :
public StreamBase<DataOutBase::UcdFlags>
1174 const unsigned int start,
1175 const unsigned int x_offset,
1176 const unsigned int y_offset,
1177 const unsigned int z_offset);
1185 template <
typename data>
1187 write_dataset(
const unsigned int index,
const std::vector<data> &values);
1193 class VtkStream :
public StreamBase<DataOutBase::VtkFlags>
1213 const unsigned int start,
1214 const unsigned int x_offset,
1215 const unsigned int y_offset,
1216 const unsigned int z_offset);
1227 write_high_order_cell(
const unsigned int index,
1228 const unsigned int start,
1229 const std::vector<unsigned> &connectivity);
1233 class VtuStream :
public StreamBase<DataOutBase::VtkFlags>
1256 const unsigned int start,
1257 const unsigned int x_offset,
1258 const unsigned int y_offset,
1259 const unsigned int z_offset);
1270 write_high_order_cell(
const unsigned int index,
1271 const unsigned int start,
1272 const std::vector<unsigned> &connectivity);
1277 template <
typename T>
1288 template <
typename T>
1290 operator<<(const std::vector<T> &);
1301 std::vector<float> vertices;
1302 std::vector<int32_t> cells;
1309 : StreamBase<DataOutBase::DXFlags>(out, f)
1315 DXStream::write_point(
const unsigned int,
const Point<dim> &p)
1317 if (flags.coordinates_binary)
1320 for (
unsigned int d = 0; d < dim; ++d)
1322 stream.write(reinterpret_cast<const char *>(data), dim *
sizeof(*data));
1326 for (
unsigned int d = 0; d < dim; ++d)
1327 stream << p(d) <<
'\t';
1336 DXStream::write_cell(
unsigned int,
1342 int nodes[1 << dim];
1346 nodes[GeometryInfo<dim>::dx_to_deal[1]] = start + d1;
1350 nodes[GeometryInfo<dim>::dx_to_deal[2]] = start + d2;
1351 nodes[GeometryInfo<dim>::dx_to_deal[3]] = start + d2 + d1;
1355 nodes[GeometryInfo<dim>::dx_to_deal[4]] = start + d3;
1356 nodes[GeometryInfo<dim>::dx_to_deal[5]] = start + d3 + d1;
1357 nodes[GeometryInfo<dim>::dx_to_deal[6]] = start + d3 + d2;
1358 nodes[GeometryInfo<dim>::dx_to_deal[7]] = start + d3 + d2 + d1;
1363 if (flags.int_binary)
1364 stream.write(reinterpret_cast<const char *>(nodes),
1365 (1 << dim) *
sizeof(*nodes));
1368 const unsigned int final = (1 << dim) - 1;
1369 for (
unsigned int i = 0; i <
final; ++i)
1370 stream << nodes[i] <<
'\t';
1371 stream << nodes[
final] <<
'\n';
1377 template <
typename data>
1379 DXStream::write_dataset(
const unsigned int,
const std::vector<data> &values)
1381 if (flags.data_binary)
1383 stream.write(reinterpret_cast<const char *>(values.data()),
1384 values.size() *
sizeof(data));
1388 for (
unsigned int i = 0; i < values.size(); ++i)
1389 stream <<
'\t' << values[i];
1399 : StreamBase<DataOutBase::GmvFlags>(out, f)
1405 GmvStream::write_point(
const unsigned int,
const Point<dim> &p)
1409 stream << p(selected_component) <<
' ';
1416 GmvStream::write_cell(
unsigned int,
1423 const unsigned int start = s + 1;
1424 stream << gmv_cell_type[dim] <<
'\n';
1429 stream <<
'\t' << start + d1;
1432 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1435 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1436 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1445 TecplotStream::TecplotStream(std::ostream & out,
1447 : StreamBase<DataOutBase::TecplotFlags>(out, f)
1453 TecplotStream::write_point(
const unsigned int,
const Point<dim> &p)
1457 stream << p(selected_component) <<
'\n';
1464 TecplotStream::write_cell(
unsigned int,
1470 const unsigned int start = s + 1;
1475 stream <<
'\t' << start + d1;
1478 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1481 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1482 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1492 : StreamBase<DataOutBase::UcdFlags>(out, f)
1498 UcdStream::write_point(
const unsigned int index,
const Point<dim> &p)
1500 stream << index + 1 <<
" ";
1502 for (
unsigned int i = 0; i < dim; ++i)
1503 stream << p(i) <<
' ';
1505 for (
unsigned int i = dim; i < 3; ++i)
1514 UcdStream::write_cell(
unsigned int index,
1520 int nodes[1 << dim];
1524 nodes[GeometryInfo<dim>::ucd_to_deal[1]] = start + d1;
1528 nodes[GeometryInfo<dim>::ucd_to_deal[2]] = start + d2;
1529 nodes[GeometryInfo<dim>::ucd_to_deal[3]] = start + d2 + d1;
1533 nodes[GeometryInfo<dim>::ucd_to_deal[4]] = start + d3;
1534 nodes[GeometryInfo<dim>::ucd_to_deal[5]] = start + d3 + d1;
1535 nodes[GeometryInfo<dim>::ucd_to_deal[6]] = start + d3 + d2;
1536 nodes[GeometryInfo<dim>::ucd_to_deal[7]] = start + d3 + d2 + d1;
1542 stream << index + 1 <<
"\t0 " << ucd_cell_type[dim];
1543 const unsigned int final = (1 << dim);
1544 for (
unsigned int i = 0; i <
final; ++i)
1545 stream <<
'\t' << nodes[i] + 1;
1551 template <
typename data>
1553 UcdStream::write_dataset(
const unsigned int index,
1554 const std::vector<data> &values)
1556 stream << index + 1;
1557 for (
unsigned int i = 0; i < values.size(); ++i)
1558 stream <<
'\t' << values[i];
1567 : StreamBase<DataOutBase::VtkFlags>(out, f)
1573 VtkStream::write_point(
const unsigned int,
const Point<dim> &p)
1578 for (
unsigned int i = dim; i < 3; ++i)
1587 VtkStream::write_cell(
unsigned int,
1593 stream << GeometryInfo<dim>::vertices_per_cell <<
'\t' << start;
1595 stream <<
'\t' << start + d1;
1599 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1602 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1603 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1612 VtkStream::write_high_order_cell(
const unsigned int,
1613 const unsigned int start,
1614 const std::vector<unsigned> &connectivity)
1616 stream << connectivity.size();
1617 for (
const auto &c : connectivity)
1618 stream <<
'\t' << start + c;
1623 : StreamBase<DataOutBase::VtkFlags>(out, f)
1629 VtuStream::write_point(
const unsigned int,
const Point<dim> &p)
1631 #if !defined(DEAL_II_WITH_ZLIB) 1635 for (
unsigned int i = dim; i < 3; ++i)
1640 for (
unsigned int i = 0; i < dim; ++i)
1641 vertices.push_back(p[i]);
1642 for (
unsigned int i = dim; i < 3; ++i)
1643 vertices.push_back(0);
1649 VtuStream::flush_points()
1651 #ifdef DEAL_II_WITH_ZLIB 1654 *
this << vertices <<
'\n';
1662 VtuStream::write_cell(
unsigned int,
1668 #if !defined(DEAL_II_WITH_ZLIB) 1672 stream <<
'\t' << start + d1;
1675 stream <<
'\t' << start + d2 + d1 <<
'\t' << start + d2;
1678 stream <<
'\t' << start + d3 <<
'\t' << start + d3 + d1 <<
'\t' 1679 << start + d3 + d2 + d1 <<
'\t' << start + d3 + d2;
1685 cells.push_back(start);
1688 cells.push_back(start + d1);
1691 cells.push_back(start + d2 + d1);
1692 cells.push_back(start + d2);
1695 cells.push_back(start + d3);
1696 cells.push_back(start + d3 + d1);
1697 cells.push_back(start + d3 + d2 + d1);
1698 cells.push_back(start + d3 + d2);
1707 VtuStream::write_high_order_cell(
const unsigned int,
1708 const unsigned int start,
1709 const std::vector<unsigned> &connectivity)
1711 #if !defined(DEAL_II_WITH_ZLIB) 1712 for (
const auto &c : connectivity)
1713 stream <<
'\t' << start + c;
1716 for (
const auto &c : connectivity)
1717 cells.push_back(start + c);
1722 VtuStream::flush_cells()
1724 #ifdef DEAL_II_WITH_ZLIB 1727 *
this << cells <<
'\n';
1733 template <
typename T>
1735 VtuStream::operator<<(const std::vector<T> &data)
1737 #ifdef DEAL_II_WITH_ZLIB 1740 write_compressed_block(data, flags, stream);
1742 for (
unsigned int i = 0; i < data.size(); ++i)
1743 stream << data[i] <<
' ';
1757 template <
int dim,
int spacedim>
1761 template <
int dim,
int spacedim>
1765 template <
int dim,
int spacedim>
1767 : patch_index(no_neighbor)
1769 , points_are_available(false)
1773 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
1782 template <
int dim,
int spacedim>
1787 const double epsilon = 3e-16;
1788 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
1792 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
1805 if (data.n_rows() != patch.
data.n_rows())
1808 if (data.n_cols() != patch.
data.n_cols())
1811 for (
unsigned int i = 0; i < data.n_rows(); ++i)
1812 for (
unsigned int j = 0; j < data.n_cols(); ++j)
1813 if (data[i][j] != patch.
data[i][j])
1821 template <
int dim,
int spacedim>
1837 template <
int dim,
int spacedim>
1845 data.swap(other_patch.
data);
1851 template <
int spacedim>
1855 template <
int spacedim>
1859 template <
int spacedim>
1861 Patch<0, spacedim>::no_neighbor};
1863 template <
int spacedim>
1866 template <
int spacedim>
1876 template <
int spacedim>
1880 const unsigned int dim = 0;
1883 const double epsilon = 3e-16;
1884 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
1894 if (data.n_rows() != patch.
data.n_rows())
1897 if (data.n_cols() != patch.
data.n_cols())
1900 for (
unsigned int i = 0; i < data.n_rows(); ++i)
1901 for (
unsigned int j = 0; j < data.n_cols(); ++j)
1902 if (data[i][j] != patch.
data[i][j])
1910 template <
int spacedim>
1922 template <
int spacedim>
1927 data.swap(other_patch.
data);
1934 : write_preamble(write_preamble)
1941 space_dimension_labels.emplace_back(
"x");
1942 space_dimension_labels.emplace_back(
"y");
1943 space_dimension_labels.emplace_back(
"z");
1949 : space_dimension_labels(labels)
1963 const bool bicubic_patch,
1964 const bool external_data)
1966 , bicubic_patch(bicubic_patch)
1967 , external_data(external_data)
1972 const bool xdmf_hdf5_output)
1973 : filter_duplicate_vertices(filter_duplicate_vertices)
1974 , xdmf_hdf5_output(xdmf_hdf5_output)
1982 "Filter duplicate vertices",
1985 "Whether to remove duplicate vertex values. deal.II duplicates " 1986 "vertices once for each adjacent cell so that it can output " 1987 "discontinuous quantities for which there may be more than one " 1988 "value for each vertex position. Setting this flag to " 1989 "'true' will merge all of these values by selecting a " 1990 "random one and outputting this as 'the' value for the vertex. " 1991 "As long as the data to be output corresponds to continuous " 1992 "fields, merging vertices has no effect. On the other hand, " 1993 "if the data to be output corresponds to discontinuous fields " 1994 "(either because you are using a discontinuous finite element, " 1995 "or because you are using a DataPostprocessor that yields " 1996 "discontinuous data, or because the data to be output has been " 1997 "produced by entirely different means), then the data in the " 1998 "output file no longer faithfully represents the underlying data " 1999 "because the discontinuous field has been replaced by a " 2000 "continuous one. Note also that the filtering can not occur " 2001 "on processor boundaries. Thus, a filtered discontinuous field " 2002 "looks like a continuous field inside of a subdomain, " 2003 "but like a discontinuous field at the subdomain boundary." 2005 "In any case, filtering results in drastically smaller output " 2006 "files (smaller by about a factor of 2^dim).");
2011 "Whether the data will be used in an XDMF/HDF5 combination.");
2026 const bool int_binary,
2027 const bool coordinates_binary,
2028 const bool data_binary)
2029 : write_neighbors(write_neighbors)
2030 , int_binary(int_binary)
2031 , coordinates_binary(coordinates_binary)
2032 , data_binary(data_binary)
2033 , data_double(false)
2043 "A boolean field indicating whether neighborship " 2044 "information between cells is to be written to the " 2045 "OpenDX output file");
2049 "Output format of integer numbers, which is " 2050 "either a text representation (ascii) or binary integer " 2051 "values of 32 or 64 bits length");
2055 "Output format of vertex coordinates, which is " 2056 "either a text representation (ascii) or binary " 2057 "floating point values of 32 or 64 bits length");
2061 "Output format of data values, which is " 2062 "either a text representation (ascii) or binary " 2063 "floating point values of 32 or 64 bits length");
2083 "A flag indicating whether a comment should be " 2084 "written to the beginning of the output file " 2085 "indicating date and time of creation as well " 2086 "as the creating program");
2094 write_preamble = prm.
get_bool(
"Write preamble");
2100 const int azimuth_angle,
2101 const int polar_angle,
2102 const unsigned int line_thickness,
2104 const bool draw_colorbar)
2107 , height_vector(height_vector)
2108 , azimuth_angle(azimuth_angle)
2109 , polar_angle(polar_angle)
2110 , line_thickness(line_thickness)
2112 , draw_colorbar(draw_colorbar)
2123 "A flag indicating whether POVRAY should use smoothed " 2124 "triangles instead of the usual ones");
2128 "Whether POVRAY should use bicubic patches");
2132 "Whether camera and lighting information should " 2133 "be put into an external file \"data.inc\" or into " 2134 "the POVRAY input file");
2142 smooth = prm.
get_bool(
"Use smooth triangles");
2143 bicubic_patch = prm.
get_bool(
"Use bicubic patches");
2144 external_data = prm.
get_bool(
"Include external file");
2150 const unsigned int color_vector,
2152 const unsigned int size,
2153 const double line_width,
2154 const double azimut_angle,
2155 const double turn_angle,
2156 const double z_scaling,
2157 const bool draw_mesh,
2158 const bool draw_cells,
2159 const bool shade_cells,
2161 : height_vector(height_vector)
2162 , color_vector(color_vector)
2163 , size_type(size_type)
2165 , line_width(line_width)
2166 , azimut_angle(azimut_angle)
2167 , turn_angle(turn_angle)
2168 , z_scaling(z_scaling)
2169 , draw_mesh(draw_mesh)
2170 , draw_cells(draw_cells)
2171 , shade_cells(shade_cells)
2172 , color_function(color_function)
2211 double sum = xmax + xmin;
2212 double sum13 = xmin + 3 * xmax;
2213 double sum22 = 2 * xmin + 2 * xmax;
2214 double sum31 = 3 * xmin + xmax;
2215 double dif = xmax - xmin;
2216 double rezdif = 1.0 / dif;
2220 if (x < (sum31) / 4)
2222 else if (x < (sum22) / 4)
2224 else if (x < (sum13) / 4)
2235 rgb_values.green = 0;
2236 rgb_values.blue = (x - xmin) * 4. * rezdif;
2240 rgb_values.green = (4 * x - 3 * xmin - xmax) * rezdif;
2241 rgb_values.blue = (sum22 - 4. * x) * rezdif;
2244 rgb_values.red = (4 * x - 2 * sum) * rezdif;
2245 rgb_values.green = (xmin + 3 * xmax - 4 * x) * rezdif;
2246 rgb_values.blue = 0;
2250 rgb_values.green = (4 * x - xmin - 3 * xmax) * rezdif;
2251 rgb_values.blue = (4. * x - sum13) * rezdif;
2258 rgb_values.red = rgb_values.green = rgb_values.blue = 1;
2271 rgb_values.red = rgb_values.blue = rgb_values.green =
2272 (x - xmin) / (xmax - xmin);
2284 rgb_values.red = rgb_values.blue = rgb_values.green =
2285 1 - (x - xmin) / (xmax - xmin);
2292 EpsCell2d::operator<(
const EpsCell2d &e)
const 2295 return depth > e.depth;
2306 "Number of the input vector that is to be used to " 2307 "generate height information");
2311 "Number of the input vector that is to be used to " 2312 "generate color information");
2316 "Whether width or height should be scaled to match " 2321 "The size (width or height) to which the eps output " 2322 "file is to be scaled");
2326 "The width in which the postscript renderer is to " 2331 "Angle of the viewing position against the vertical " 2336 "Angle of the viewing direction against the y-axis");
2340 "Scaling for the z-direction relative to the scaling " 2341 "used in x- and y-directions");
2345 "Whether the mesh lines, or only the surface should be " 2350 "Whether only the mesh lines, or also the interior of " 2351 "cells should be plotted. If this flag is false, then " 2352 "one can see through the mesh");
2356 "Whether the interior of cells shall be shaded");
2360 "default|grey scale|reverse grey scale"),
2361 "Name of a color function used to colorize mesh lines " 2362 "and/or cell interiors");
2372 if (prm.
get(
"Scale to width or height") ==
"width")
2384 if (prm.
get(
"Color function") ==
"default")
2386 else if (prm.
get(
"Color function") ==
"grey scale")
2388 else if (prm.
get(
"Color function") ==
"reverse grey scale")
2399 const char * zone_name,
2400 const double solution_time)
2401 : tecplot_binary_file_name(tecplot_binary_file_name)
2402 , zone_name(zone_name)
2403 , solution_time(solution_time)
2411 return sizeof(*this) +
2419 const unsigned int cycle,
2420 const bool print_date_and_time,
2422 const bool write_higher_order_cells)
2425 , print_date_and_time(print_date_and_time)
2426 , compression_level(compression_level)
2427 , write_higher_order_cells(write_higher_order_cells)
2435 if (format_name ==
"none")
2438 if (format_name ==
"dx")
2441 if (format_name ==
"ucd")
2444 if (format_name ==
"gnuplot")
2447 if (format_name ==
"povray")
2450 if (format_name ==
"eps")
2453 if (format_name ==
"gmv")
2456 if (format_name ==
"tecplot")
2459 if (format_name ==
"tecplot_binary")
2462 if (format_name ==
"vtk")
2465 if (format_name ==
"vtu")
2468 if (format_name ==
"deal.II intermediate")
2471 if (format_name ==
"hdf5")
2475 ExcMessage(
"The given file format name is not recognized: <" +
2476 format_name +
">"));
2487 return "none|dx|ucd|gnuplot|povray|eps|gmv|tecplot|tecplot_binary|vtk|vtu|hdf5|svg|deal.II intermediate";
2495 switch (output_format)
2534 template <
int dim,
int spacedim,
typename StreamType>
2539 unsigned int count = 0;
2545 patch != patches.end();
2548 const unsigned int n_subdivisions = patch->n_subdivisions;
2549 const unsigned int n = n_subdivisions + 1;
2552 const unsigned int n1 = (dim > 0) ? n : 1;
2553 const unsigned int n2 = (dim > 1) ? n : 1;
2554 const unsigned int n3 = (dim > 2) ? n : 1;
2556 for (
unsigned int i3 = 0; i3 < n3; ++i3)
2557 for (
unsigned int i2 = 0; i2 < n2; ++i2)
2558 for (
unsigned int i1 = 0; i1 < n1; ++i1)
2560 compute_node(node, &*patch, i1, i2, i3, n_subdivisions);
2561 out.write_point(count++, node);
2567 template <
int dim,
int spacedim,
typename StreamType>
2572 unsigned int count = 0;
2573 unsigned int first_vertex_of_patch = 0;
2576 patch != patches.end();
2579 const unsigned int n_subdivisions = patch->n_subdivisions;
2580 const unsigned int n = n_subdivisions + 1;
2582 const unsigned int n1 = (dim > 0) ? n_subdivisions : 1;
2583 const unsigned int n2 = (dim > 1) ? n_subdivisions : 1;
2584 const unsigned int n3 = (dim > 2) ? n_subdivisions : 1;
2586 const unsigned int d1 = 1;
2587 const unsigned int d2 = n;
2588 const unsigned int d3 = n * n;
2589 for (
unsigned int i3 = 0; i3 < n3; ++i3)
2590 for (
unsigned int i2 = 0; i2 < n2; ++i2)
2591 for (
unsigned int i1 = 0; i1 < n1; ++i1)
2593 const unsigned int offset =
2594 first_vertex_of_patch + i3 * d3 + i2 * d2 + i1 * d1;
2596 out.template write_cell<dim>(count++, offset, d1, d2, d3);
2599 first_vertex_of_patch +=
2600 Utilities::fixed_power<dim>(n_subdivisions + 1);
2606 template <
int dim,
int spacedim,
typename StreamType>
2612 unsigned int first_vertex_of_patch = 0;
2613 unsigned int count = 0;
2615 std::vector<unsigned> connectivity;
2617 std::array<unsigned, dim> cell_order;
2621 patch != patches.end();
2624 const unsigned int n_subdivisions = patch->n_subdivisions;
2625 const unsigned int n = n_subdivisions + 1;
2627 cell_order.fill(n_subdivisions);
2628 connectivity.resize(Utilities::fixed_power<dim>(n));
2631 const unsigned int n1 = (dim > 0) ? n_subdivisions : 0;
2632 const unsigned int n2 = (dim > 1) ? n_subdivisions : 0;
2633 const unsigned int n3 = (dim > 2) ? n_subdivisions : 0;
2635 const unsigned int d1 = 1;
2636 const unsigned int d2 = n;
2637 const unsigned int d3 = n * n;
2638 for (
unsigned int i3 = 0; i3 <= n3; ++i3)
2639 for (
unsigned int i2 = 0; i2 <= n2; ++i2)
2640 for (
unsigned int i1 = 0; i1 <= n1; ++i1)
2642 const unsigned int local_index = i3 * d3 + i2 * d2 + i1 * d1;
2643 const unsigned int connectivity_index =
2644 vtk_point_index_from_ijk(i1, i2, i3, cell_order);
2645 connectivity[connectivity_index] = local_index;
2648 out.template write_high_order_cell<dim>(count++,
2649 first_vertex_of_patch,
2653 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
2660 template <
int dim,
int spacedim,
class StreamType>
2663 unsigned int n_data_sets,
2664 const bool double_precision,
2668 unsigned int count = 0;
2672 patch != patches.end();
2675 const unsigned int n_subdivisions = patch->n_subdivisions;
2676 const unsigned int n = n_subdivisions + 1;
2678 Assert((patch->data.n_rows() == n_data_sets &&
2679 !patch->points_are_available) ||
2680 (patch->data.n_rows() == n_data_sets + spacedim &&
2681 patch->points_are_available),
2683 (n_data_sets + spacedim) :
2685 patch->data.n_rows()));
2686 Assert(patch->data.n_cols() == Utilities::fixed_power<dim>(n),
2689 std::vector<float> floats(n_data_sets);
2690 std::vector<double> doubles(n_data_sets);
2693 for (
unsigned int i = 0; i < Utilities::fixed_power<dim>(n);
2695 if (double_precision)
2697 for (
unsigned int data_set = 0; data_set < n_data_sets;
2699 doubles[data_set] = patch->data(data_set, i);
2700 out.write_dataset(count, doubles);
2704 for (
unsigned int data_set = 0; data_set < n_data_sets;
2706 floats[data_set] = patch->data(data_set, i);
2707 out.write_dataset(count, floats);
2731 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
2732 camera_horizontal[2] * camera_direction[1];
2733 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
2734 camera_horizontal[0] * camera_direction[2];
2735 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
2736 camera_horizontal[1] * camera_direction[0];
2740 phi /= (point[0] - camera_position[0]) * camera_direction[0] +
2741 (point[1] - camera_position[1]) * camera_direction[1] +
2742 (point[2] - camera_position[2]) * camera_direction[2];
2746 camera_position[0] + phi * (point[0] - camera_position[0]);
2748 camera_position[1] + phi * (point[1] - camera_position[1]);
2750 camera_position[2] + phi * (point[2] - camera_position[2]);
2753 projection_decomposition[0] = (projection[0] - camera_position[0] -
2754 camera_focus * camera_direction[0]) *
2755 camera_horizontal[0];
2756 projection_decomposition[0] += (projection[1] - camera_position[1] -
2757 camera_focus * camera_direction[1]) *
2758 camera_horizontal[1];
2759 projection_decomposition[0] += (projection[2] - camera_position[2] -
2760 camera_focus * camera_direction[2]) *
2761 camera_horizontal[2];
2763 projection_decomposition[1] = (projection[0] - camera_position[0] -
2764 camera_focus * camera_direction[0]) *
2766 projection_decomposition[1] += (projection[1] - camera_position[1] -
2767 camera_focus * camera_direction[1]) *
2769 projection_decomposition[1] += (projection[2] - camera_position[2] -
2770 camera_focus * camera_direction[2]) *
2773 return projection_decomposition;
2787 for (
int i = 0; i < 2; ++i)
2789 for (
int j = 0; j < 2 - i; ++j)
2791 if (points[j][2] > points[j + 1][2])
2794 points[j] = points[j + 1];
2795 points[j + 1] = temp;
2802 v_inter = points[1];
2809 A[0][0] = v_max[0] - v_min[0];
2810 A[0][1] = v_inter[0] - v_min[0];
2811 A[1][0] = v_max[1] - v_min[1];
2812 A[1][1] = v_inter[1] - v_min[1];
2818 bool col_change =
false;
2827 double temp = A[1][0];
2832 for (
unsigned int k = 0; k < 1; k++)
2834 for (
unsigned int i = k + 1; i < 2; i++)
2836 x = A[i][k] / A[k][k];
2838 for (
unsigned int j = k + 1; j < 2; j++)
2839 A[i][j] = A[i][j] - A[k][j] * x;
2841 b[i] = b[i] - b[k] * x;
2845 b[1] = b[1] / A[1][1];
2847 for (
int i = 0; i >= 0; i--)
2851 for (
unsigned int j = i + 1; j < 2; j++)
2852 sum = sum - A[i][j] * b[j];
2854 b[i] = sum / A[i][i];
2864 double c = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) +
2868 A[0][0] = v_max[0] - v_min[0];
2869 A[0][1] = v_inter[0] - v_min[0];
2870 A[1][0] = v_max[1] - v_min[1];
2871 A[1][1] = v_inter[1] - v_min[1];
2873 b[0] = 1.0 - v_min[0];
2885 double temp = A[1][0];
2890 for (
unsigned int k = 0; k < 1; k++)
2892 for (
unsigned int i = k + 1; i < 2; i++)
2894 x = A[i][k] / A[k][k];
2896 for (
unsigned int j = k + 1; j < 2; j++)
2897 A[i][j] = A[i][j] - A[k][j] * x;
2899 b[i] = b[i] - b[k] * x;
2903 b[1] = b[1] / A[1][1];
2905 for (
int i = 0; i >= 0; i--)
2909 for (
unsigned int j = i + 1; j < 2; j++)
2910 sum = sum - A[i][j] * b[j];
2912 b[i] = sum / A[i][i];
2922 gradient[0] = b[0] * (v_max[2] - v_min[2]) +
2923 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
2926 A[0][0] = v_max[0] - v_min[0];
2927 A[0][1] = v_inter[0] - v_min[0];
2928 A[1][0] = v_max[1] - v_min[1];
2929 A[1][1] = v_inter[1] - v_min[1];
2932 b[1] = 1.0 - v_min[1];
2943 double temp = A[1][0];
2948 for (
unsigned int k = 0; k < 1; k++)
2950 for (
unsigned int i = k + 1; i < 2; i++)
2952 x = A[i][k] / A[k][k];
2954 for (
unsigned int j = k + 1; j < 2; j++)
2955 A[i][j] = A[i][j] - A[k][j] * x;
2957 b[i] = b[i] - b[k] * x;
2961 b[1] = b[1] / A[1][1];
2963 for (
int i = 0; i >= 0; i--)
2967 for (
unsigned int j = i + 1; j < 2; j++)
2968 sum = sum - A[i][j] * b[j];
2970 b[i] = sum / A[i][i];
2980 gradient[1] = b[0] * (v_max[2] - v_min[2]) +
2981 b[1] * (v_inter[2] - v_min[2]) - c + v_min[2];
2984 double gradient_norm =
2985 sqrt(pow(gradient[0], 2.0) + pow(gradient[1], 2.0));
2986 gradient[0] /= gradient_norm;
2987 gradient[1] /= gradient_norm;
2989 double lambda = -gradient[0] * (v_min[0] - v_max[0]) -
2990 gradient[1] * (v_min[1] - v_max[1]);
2994 gradient_parameters[0] = v_min[0];
2995 gradient_parameters[1] = v_min[1];
2997 gradient_parameters[2] = v_min[0] + lambda * gradient[0];
2998 gradient_parameters[3] = v_min[1] + lambda * gradient[1];
3000 gradient_parameters[4] = v_min[2];
3001 gradient_parameters[5] = v_max[2];
3003 return gradient_parameters;
3009 template <
int dim,
int spacedim>
3013 const std::vector<std::string> & data_names,
3014 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3022 std::tuple<
unsigned int,
3032 template <
int dim,
int spacedim>
3036 const std::vector<std::string> & data_names,
3038 std::tuple<
unsigned int,
3051 #ifndef DEAL_II_WITH_MPI 3060 if (patches.size() == 0)
3064 const unsigned int n_data_sets = data_names.size();
3066 UcdStream ucd_out(out, flags);
3069 unsigned int n_nodes;
3070 unsigned int n_cells;
3071 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
3077 <<
"# This file was generated by the deal.II library." <<
'\n' 3081 <<
"# For a description of the UCD format see the AVS Developer's guide." 3087 out << n_nodes <<
' ' << n_cells <<
' ' << n_data_sets <<
' ' << 0
3092 write_nodes(patches, ucd_out);
3095 write_cells(patches, ucd_out);
3100 if (n_data_sets != 0)
3102 out << n_data_sets <<
" ";
3103 for (
unsigned int i = 0; i < n_data_sets; ++i)
3108 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
3109 out << data_names[data_set]
3113 write_data(patches, n_data_sets,
true, ucd_out);
3124 template <
int dim,
int spacedim>
3128 const std::vector<std::string> & data_names,
3129 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3137 std::tuple<
unsigned int,
3147 template <
int dim,
int spacedim>
3151 const std::vector<std::string> & data_names,
3153 std::tuple<
unsigned int,
3165 #ifndef DEAL_II_WITH_MPI 3174 if (patches.size() == 0)
3178 DXStream dx_out(out, flags);
3181 unsigned int offset = 0;
3183 const unsigned int n_data_sets = data_names.size();
3186 unsigned int n_nodes;
3187 unsigned int n_cells;
3188 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
3190 out <<
"object \"vertices\" class array type float rank 1 shape " 3191 << spacedim <<
" items " << n_nodes;
3195 out <<
" lsb ieee data 0" <<
'\n';
3196 offset += n_nodes * spacedim *
sizeof(float);
3200 out <<
" data follows" <<
'\n';
3201 write_nodes(patches, dx_out);
3209 out <<
"object \"cells\" class array type int rank 1 shape " 3214 out <<
" lsb binary data " << offset <<
'\n';
3215 offset += n_cells *
sizeof(int);
3219 out <<
" data follows" <<
'\n';
3220 write_cells(patches, dx_out);
3225 out <<
"attribute \"element type\" string \"";
3232 out <<
"\"" <<
'\n' <<
"attribute \"ref\" string \"positions\"" <<
'\n';
3239 out <<
"object \"neighbors\" class array type int rank 1 shape " 3245 patch != patches.end();
3248 const unsigned int n = patch->n_subdivisions;
3249 const unsigned int n1 = (dim > 0) ? n : 1;
3250 const unsigned int n2 = (dim > 1) ? n : 1;
3251 const unsigned int n3 = (dim > 2) ? n : 1;
3252 unsigned int cells_per_patch = Utilities::fixed_power<dim>(n);
3253 unsigned int dx = 1;
3254 unsigned int dy = n;
3255 unsigned int dz = n * n;
3257 const unsigned int patch_start =
3258 patch->patch_index * cells_per_patch;
3260 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3261 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3262 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3264 const unsigned int nx = i1 *
dx;
3265 const unsigned int ny = i2 * dy;
3266 const unsigned int nz = i3 * dz;
3278 const unsigned int nn = patch->neighbors[0];
3280 if (nn != patch->no_neighbor)
3282 << (nn * cells_per_patch + ny + nz + dx * (n - 1));
3288 out <<
'\t' << patch_start + nx - dx + ny + nz;
3293 const unsigned int nn = patch->neighbors[1];
3295 if (nn != patch->no_neighbor)
3296 out << (nn * cells_per_patch + ny + nz);
3302 out <<
'\t' << patch_start + nx + dx + ny + nz;
3309 const unsigned int nn = patch->neighbors[2];
3311 if (nn != patch->no_neighbor)
3313 << (nn * cells_per_patch + nx + nz + dy * (n - 1));
3319 out <<
'\t' << patch_start + nx + ny - dy + nz;
3324 const unsigned int nn = patch->neighbors[3];
3326 if (nn != patch->no_neighbor)
3327 out << (nn * cells_per_patch + nx + nz);
3333 out <<
'\t' << patch_start + nx + ny + dy + nz;
3341 const unsigned int nn = patch->neighbors[4];
3343 if (nn != patch->no_neighbor)
3345 << (nn * cells_per_patch + nx + ny + dz * (n - 1));
3351 out <<
'\t' << patch_start + nx + ny + nz - dz;
3356 const unsigned int nn = patch->neighbors[5];
3358 if (nn != patch->no_neighbor)
3359 out << (nn * cells_per_patch + nx + ny);
3365 out <<
'\t' << patch_start + nx + ny + nz + dz;
3373 if (n_data_sets != 0)
3375 out <<
"object \"data\" class array type float rank 1 shape " 3376 << n_data_sets <<
" items " << n_nodes;
3380 out <<
" lsb ieee data " << offset <<
'\n';
3381 offset += n_data_sets * n_nodes *
3382 ((flags.
data_double) ?
sizeof(
double) :
sizeof(float));
3386 out <<
" data follows" <<
'\n';
3387 write_data(patches, n_data_sets, flags.
data_double, dx_out);
3391 out <<
"attribute \"dep\" string \"positions\"" <<
'\n';
3395 out <<
"object \"data\" class constantarray type float rank 0 items " 3396 << n_nodes <<
" data follows" <<
'\n' 3402 out <<
"object \"deal data\" class field" <<
'\n' 3403 <<
"component \"positions\" value \"vertices\"" <<
'\n' 3404 <<
"component \"connections\" value \"cells\"" <<
'\n' 3405 <<
"component \"data\" value \"data\"" <<
'\n';
3408 out <<
"component \"neighbors\" value \"neighbors\"" <<
'\n';
3415 out <<
"end" <<
'\n';
3418 write_nodes(patches, dx_out);
3420 write_cells(patches, dx_out);
3422 write_data(patches, n_data_sets, flags.
data_double, dx_out);
3433 template <
int dim,
int spacedim>
3437 const std::vector<std::string> & data_names,
3438 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3446 std::tuple<
unsigned int,
3456 template <
int dim,
int spacedim>
3460 const std::vector<std::string> & data_names,
3462 std::tuple<
unsigned int,
3471 #ifndef DEAL_II_WITH_MPI 3481 if (patches.size() == 0)
3485 const unsigned int n_data_sets = data_names.size();
3489 out <<
"# This file was generated by the deal.II library." <<
'\n' 3493 <<
"# For a description of the GNUPLOT format see the GNUPLOT manual." 3500 for (
unsigned int spacedim_n = 0; spacedim_n < spacedim; ++spacedim_n)
3505 for (
unsigned int i = 0; i < data_names.size(); ++i)
3506 out <<
'<' << data_names[i] <<
"> ";
3514 patch != patches.end();
3517 const unsigned int n_subdivisions = patch->n_subdivisions;
3518 const unsigned int n = n_subdivisions + 1;
3520 const unsigned int n1 = (dim > 0) ? n : 1;
3521 const unsigned int n2 = (dim > 1) ? n : 1;
3522 const unsigned int n3 = (dim > 2) ? n : 1;
3523 unsigned int d1 = 1;
3524 unsigned int d2 = n;
3525 unsigned int d3 = n * n;
3527 Assert((patch->data.n_rows() == n_data_sets &&
3528 !patch->points_are_available) ||
3529 (patch->data.n_rows() == n_data_sets + spacedim &&
3530 patch->points_are_available),
3532 (n_data_sets + spacedim) :
3534 patch->data.n_rows()));
3535 Assert(patch->data.n_cols() == Utilities::fixed_power<dim>(n),
3542 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3544 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3547 compute_node(node, &*patch, i1, i2, 0, n_subdivisions);
3550 for (
unsigned int data_set = 0; data_set < n_data_sets;
3552 out << patch->data(data_set, i1 * d1 + i2 * d2) <<
' ';
3568 for (
unsigned int i3 = 0; i3 < n3; ++i3)
3569 for (
unsigned int i2 = 0; i2 < n2; ++i2)
3570 for (
unsigned int i1 = 0; i1 < n1; ++i1)
3574 this_point, &*patch, i1, i2, i3, n_subdivisions);
3576 if (i1 < n_subdivisions)
3580 for (
unsigned int data_set = 0; data_set < n_data_sets;
3583 << patch->data(data_set,
3584 i1 * d1 + i2 * d2 + i3 * d3);
3589 node, &*patch, i1 + 1, i2, i3, n_subdivisions);
3592 for (
unsigned int data_set = 0; data_set < n_data_sets;
3595 << patch->data(data_set,
3596 (i1 + 1) * d1 + i2 * d2 + i3 * d3);
3600 out <<
'\n' <<
'\n';
3604 if (i2 < n_subdivisions)
3608 for (
unsigned int data_set = 0; data_set < n_data_sets;
3611 << patch->data(data_set,
3612 i1 * d1 + i2 * d2 + i3 * d3);
3617 node, &*patch, i1, i2 + 1, i3, n_subdivisions);
3620 for (
unsigned int data_set = 0; data_set < n_data_sets;
3623 << patch->data(data_set,
3624 i1 * d1 + (i2 + 1) * d2 + i3 * d3);
3628 out <<
'\n' <<
'\n';
3632 if (i3 < n_subdivisions)
3636 for (
unsigned int data_set = 0; data_set < n_data_sets;
3639 << patch->data(data_set,
3640 i1 * d1 + i2 * d2 + i3 * d3);
3645 node, &*patch, i1, i2, i3 + 1, n_subdivisions);
3648 for (
unsigned int data_set = 0; data_set < n_data_sets;
3651 << patch->data(data_set,
3652 i1 * d1 + i2 * d2 + (i3 + 1) * d3);
3655 out <<
'\n' <<
'\n';
3670 template <
int dim,
int spacedim>
3674 const std::vector<std::string> & data_names,
3675 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
3683 std::tuple<
unsigned int,
3693 template <
int dim,
int spacedim>
3697 const std::vector<std::string> & data_names,
3699 std::tuple<
unsigned int,
3708 #ifndef DEAL_II_WITH_MPI 3717 if (patches.size() == 0)
3724 const unsigned int n_data_sets = data_names.size();
3729 out <<
"/* This file was generated by the deal.II library." <<
'\n' 3733 <<
" For a description of the POVRAY format see the POVRAY manual." 3738 out <<
"#include \"colors.inc\" " <<
'\n' 3739 <<
"#include \"textures.inc\" " <<
'\n';
3744 out <<
"#include \"data.inc\" " <<
'\n';
3750 <<
"camera {" <<
'\n' 3751 <<
" location <1,4,-7>" <<
'\n' 3752 <<
" look_at <0,0,0>" <<
'\n' 3753 <<
" angle 30" <<
'\n' 3758 <<
"light_source {" <<
'\n' 3759 <<
" <1,4,-7>" <<
'\n' 3760 <<
" color Grey" <<
'\n' 3763 <<
"light_source {" <<
'\n' 3764 <<
" <0,20,0>" <<
'\n' 3765 <<
" color White" <<
'\n' 3772 double hmin = patches[0].data(0, 0);
3773 double hmax = patches[0].data(0, 0);
3777 patch != patches.end();
3780 const unsigned int n_subdivisions = patch->n_subdivisions;
3782 Assert((patch->data.n_rows() == n_data_sets &&
3783 !patch->points_are_available) ||
3784 (patch->data.n_rows() == n_data_sets + spacedim &&
3785 patch->points_are_available),
3787 (n_data_sets + spacedim) :
3789 patch->data.n_rows()));
3790 Assert(patch->data.n_cols() ==
3791 Utilities::fixed_power<dim>(n_subdivisions + 1),
3794 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
3795 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
3797 const int dl = i * (n_subdivisions + 1) + j;
3798 if (patch->data(0, dl) < hmin)
3799 hmin = patch->data(0, dl);
3800 if (patch->data(0, dl) > hmax)
3801 hmax = patch->data(0, dl);
3805 out <<
"#declare HMIN=" << hmin <<
";" <<
'\n' 3806 <<
"#declare HMAX=" << hmax <<
";" <<
'\n' 3812 out <<
"#declare Tex=texture{" <<
'\n' 3813 <<
" pigment {" <<
'\n' 3814 <<
" gradient y" <<
'\n' 3815 <<
" scale y*(HMAX-HMIN)*" << 0.1 <<
'\n' 3816 <<
" color_map {" <<
'\n' 3817 <<
" [0.00 color Light_Purple] " <<
'\n' 3818 <<
" [0.95 color Light_Purple] " <<
'\n' 3819 <<
" [1.00 color White] " <<
'\n' 3827 out <<
'\n' <<
"mesh {" <<
'\n';
3833 patch != patches.end();
3836 const unsigned int n_subdivisions = patch->n_subdivisions;
3837 const unsigned int n = n_subdivisions + 1;
3838 const unsigned int d1 = 1;
3839 const unsigned int d2 = n;
3841 Assert((patch->data.n_rows() == n_data_sets &&
3842 !patch->points_are_available) ||
3843 (patch->data.n_rows() == n_data_sets + spacedim &&
3844 patch->points_are_available),
3846 (n_data_sets + spacedim) :
3848 patch->data.n_rows()));
3849 Assert(patch->data.n_cols() == Utilities::fixed_power<dim>(n),
3853 std::vector<Point<spacedim>> ver(n * n);
3855 for (
unsigned int i2 = 0; i2 < n; ++i2)
3856 for (
unsigned int i1 = 0; i1 < n; ++i1)
3860 ver[i1 * d1 + i2 * d2], &*patch, i1, i2, 0, n_subdivisions);
3867 std::vector<Point<3>> nrml;
3877 for (
unsigned int i = 0; i < n; ++i)
3878 for (
unsigned int j = 0; j < n; ++j)
3880 const unsigned int il = (i == 0) ? i : (i - 1);
3881 const unsigned int ir =
3882 (i == n_subdivisions) ? i : (i + 1);
3883 const unsigned int jl = (j == 0) ? j : (j - 1);
3884 const unsigned int jr =
3885 (j == n_subdivisions) ? j : (j + 1);
3888 ver[ir * d1 + j * d2](0) - ver[il * d1 + j * d2](0);
3889 h1(1) = patch->data(0, ir * d1 + j * d2) -
3890 patch->data(0, il * d1 + j * d2);
3892 ver[ir * d1 + j * d2](1) - ver[il * d1 + j * d2](1);
3895 ver[i * d1 + jr * d2](0) - ver[i * d1 + jl * d2](0);
3896 h2(1) = patch->data(0, i * d1 + jr * d2) -
3897 patch->data(0, i * d1 + jl * d2);
3899 ver[i * d1 + jr * d2](1) - ver[i * d1 + jl * d2](1);
3901 nrml[i * d1 + j * d2](0) = h1(1) * h2(2) - h1(2) * h2(1);
3902 nrml[i * d1 + j * d2](1) = h1(2) * h2(0) - h1(0) * h2(2);
3903 nrml[i * d1 + j * d2](2) = h1(0) * h2(1) - h1(1) * h2(0);
3907 std::sqrt(std::pow(nrml[i * d1 + j * d2](0), 2.) +
3908 std::pow(nrml[i * d1 + j * d2](1), 2.) +
3909 std::pow(nrml[i * d1 + j * d2](2), 2.));
3911 if (nrml[i * d1 + j * d2](1) < 0)
3914 for (
unsigned int k = 0; k < 3; ++k)
3915 nrml[i * d1 + j * d2](k) /= norm;
3920 for (
unsigned int i = 0; i < n_subdivisions; ++i)
3921 for (
unsigned int j = 0; j < n_subdivisions; ++j)
3924 const int dl = i * d1 + j * d2;
3930 out <<
"smooth_triangle {" <<
'\n' 3931 <<
"\t<" << ver[dl](0) <<
"," << patch->data(0, dl)
3932 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0) <<
", " 3933 << nrml[dl](1) <<
", " << nrml[dl](2) <<
">," <<
'\n';
3934 out <<
" \t<" << ver[dl + d1](0) <<
"," 3935 << patch->data(0, dl + d1) <<
"," << ver[dl + d1](1)
3936 <<
">, <" << nrml[dl + d1](0) <<
", " 3937 << nrml[dl + d1](1) <<
", " << nrml[dl + d1](2)
3939 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3940 << patch->data(0, dl + d1 + d2) <<
"," 3941 << ver[dl + d1 + d2](1) <<
">, <" 3942 << nrml[dl + d1 + d2](0) <<
", " 3943 << nrml[dl + d1 + d2](1) <<
", " 3944 << nrml[dl + d1 + d2](2) <<
">}" <<
'\n';
3947 out <<
"smooth_triangle {" <<
'\n' 3948 <<
"\t<" << ver[dl](0) <<
"," << patch->data(0, dl)
3949 <<
"," << ver[dl](1) <<
">, <" << nrml[dl](0) <<
", " 3950 << nrml[dl](1) <<
", " << nrml[dl](2) <<
">," <<
'\n';
3951 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3952 << patch->data(0, dl + d1 + d2) <<
"," 3953 << ver[dl + d1 + d2](1) <<
">, <" 3954 << nrml[dl + d1 + d2](0) <<
", " 3955 << nrml[dl + d1 + d2](1) <<
", " 3956 << nrml[dl + d1 + d2](2) <<
">," <<
'\n';
3957 out <<
"\t<" << ver[dl + d2](0) <<
"," 3958 << patch->data(0, dl + d2) <<
"," << ver[dl + d2](1)
3959 <<
">, <" << nrml[dl + d2](0) <<
", " 3960 << nrml[dl + d2](1) <<
", " << nrml[dl + d2](2)
3966 out <<
"triangle {" <<
'\n' 3967 <<
"\t<" << ver[dl](0) <<
"," << patch->data(0, dl)
3968 <<
"," << ver[dl](1) <<
">," <<
'\n';
3969 out <<
"\t<" << ver[dl + d1](0) <<
"," 3970 << patch->data(0, dl + d1) <<
"," << ver[dl + d1](1)
3972 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3973 << patch->data(0, dl + d1 + d2) <<
"," 3974 << ver[dl + d1 + d2](1) <<
">}" <<
'\n';
3977 out <<
"triangle {" <<
'\n' 3978 <<
"\t<" << ver[dl](0) <<
"," << patch->data(0, dl)
3979 <<
"," << ver[dl](1) <<
">," <<
'\n';
3980 out <<
"\t<" << ver[dl + d1 + d2](0) <<
"," 3981 << patch->data(0, dl + d1 + d2) <<
"," 3982 << ver[dl + d1 + d2](1) <<
">," <<
'\n';
3983 out <<
"\t<" << ver[dl + d2](0) <<
"," 3984 << patch->data(0, dl + d2) <<
"," << ver[dl + d2](1)
3992 Assert(n_subdivisions == 3,
3995 <<
"bicubic_patch {" <<
'\n' 3996 <<
" type 0" <<
'\n' 3997 <<
" flatness 0" <<
'\n' 3998 <<
" u_steps 0" <<
'\n' 3999 <<
" v_steps 0" <<
'\n';
4000 for (
int i = 0; i < 16; ++i)
4002 out <<
"\t<" << ver[i](0) <<
"," << patch->data(0, i) <<
"," 4003 << ver[i](1) <<
">";
4008 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n';
4015 out <<
" texture {Tex}" <<
'\n' <<
"}" <<
'\n' <<
'\n';
4026 template <
int dim,
int spacedim>
4030 const std::vector<std::string> & ,
4031 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
4041 template <
int dim,
int spacedim>
4045 const std::vector<std::string> & ,
4047 std::tuple<
unsigned int,
4060 template <
int spacedim>
4064 const std::vector<std::string> & data_names,
4065 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
4073 std::tuple<
unsigned int,
4083 template <
int spacedim>
4087 const std::vector<std::string> & ,
4089 std::tuple<
unsigned int,
4098 #ifndef DEAL_II_WITH_MPI 4107 if (patches.size() == 0)
4117 std::multiset<EpsCell2d> cells;
4123 double min_color_value = 0, max_color_value = 0;
4127 double heights[4] = {0, 0, 0, 0};
4133 patch != patches.end();
4136 const unsigned int n_subdivisions = patch->n_subdivisions;
4137 const unsigned int n = n_subdivisions + 1;
4138 const unsigned int d1 = 1;
4139 const unsigned int d2 = n;
4141 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
4142 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
4145 compute_node(points[0], &*patch, i1, i2, 0, n_subdivisions);
4146 compute_node(points[1], &*patch, i1 + 1, i2, 0, n_subdivisions);
4147 compute_node(points[2], &*patch, i1, i2 + 1, 0, n_subdivisions);
4149 points[3], &*patch, i1 + 1, i2 + 1, 0, n_subdivisions);
4155 patch->data.n_rows() == 0,
4158 patch->data.n_rows()));
4160 patch->data.n_rows() != 0 ?
4164 heights[1] = patch->data.n_rows() != 0 ?
4166 (i1 + 1) * d1 + i2 * d2) *
4169 heights[2] = patch->data.n_rows() != 0 ?
4171 i1 * d1 + (i2 + 1) * d2) *
4174 heights[3] = patch->data.n_rows() != 0 ?
4176 (i1 + 1) * d1 + (i2 + 1) * d2) *
4183 for (
unsigned int i = 0; i < 4; ++i)
4184 heights[i] = points[i](2);
4205 cz = -std::cos(flags.
turn_angle * 2 * pi / 360.),
4208 sz = std::sin(flags.
turn_angle * 2 * pi / 360.);
4209 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4211 const double x = points[vertex](0), y = points[vertex](1),
4212 z = -heights[vertex];
4214 eps_cell.vertices[vertex](0) = -cz * x + sz * y;
4215 eps_cell.vertices[vertex](1) =
4216 -cx * sz * x - cx * cz * y - sx * z;
4240 (points[0] + points[1] + points[2] + points[3]) / 4;
4241 const double center_height =
4242 -(heights[0] + heights[1] + heights[2] + heights[3]) / 4;
4245 eps_cell.depth = -sx * sz * center_point(0) -
4246 sx * cz * center_point(1) + cx * center_height;
4251 patch->data.n_rows() == 0,
4254 patch->data.n_rows()));
4255 const double color_values[4] = {
4256 patch->data.n_rows() != 0 ?
4260 patch->data.n_rows() != 0 ?
4261 patch->data(flags.
color_vector, (i1 + 1) * d1 + i2 * d2) :
4264 patch->data.n_rows() != 0 ?
4265 patch->data(flags.
color_vector, i1 * d1 + (i2 + 1) * d2) :
4268 patch->data.n_rows() != 0 ?
4270 (i1 + 1) * d1 + (i2 + 1) * d2) :
4274 eps_cell.color_value = (color_values[0] + color_values[1] +
4275 color_values[3] + color_values[2]) /
4279 if (patch == patches.begin())
4280 min_color_value = max_color_value = eps_cell.color_value;
4284 (min_color_value < eps_cell.color_value ?
4286 eps_cell.color_value);
4288 (max_color_value > eps_cell.color_value ?
4290 eps_cell.color_value);
4295 cells.insert(eps_cell);
4301 double x_min = cells.begin()->vertices[0](0);
4302 double x_max = x_min;
4303 double y_min = cells.begin()->vertices[0](1);
4304 double y_max = y_min;
4306 for (
typename std::multiset<EpsCell2d>::const_iterator cell = cells.begin();
4307 cell != cells.end();
4309 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
4311 x_min = std::min(x_min, cell->vertices[vertex](0));
4312 x_max = std::max(x_max, cell->vertices[vertex](0));
4313 y_min = std::min(y_min, cell->vertices[vertex](1));
4314 y_max = std::max(y_max, cell->vertices[vertex](1));
4319 const double scale =
4321 (flags.size_type ==
EpsFlags::width ? x_max - x_min : y_min - y_max));
4323 const Point<2> offset(x_min, y_min);
4328 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n' 4329 <<
"%%Title: deal.II Output" <<
'\n' 4330 <<
"%%Creator: the deal.II library" <<
'\n' 4333 <<
"%%BoundingBox: " 4337 <<
static_cast<unsigned int>((x_max - x_min) * scale + 0.5) <<
' ' 4338 <<
static_cast<unsigned int>((y_max - y_min) * scale + 0.5) <<
'\n';
4347 out <<
"/m {moveto} bind def" <<
'\n' 4348 <<
"/l {lineto} bind def" <<
'\n' 4349 <<
"/s {setrgbcolor} bind def" <<
'\n' 4350 <<
"/sg {setgray} bind def" <<
'\n' 4351 <<
"/lx {lineto closepath stroke} bind def" <<
'\n' 4352 <<
"/lf {lineto closepath fill} bind def" <<
'\n';
4354 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4356 out << flags.line_width <<
" setlinewidth" <<
'\n';
4364 if (max_color_value == min_color_value)
4365 max_color_value = min_color_value + 1;
4369 for (
typename std::multiset<EpsCell2d>::const_iterator cell = cells.begin();
4370 cell != cells.end();
4373 if (flags.draw_cells)
4375 if (flags.shade_cells)
4378 (*flags.color_function)(cell->color_value,
4384 out << rgb_values.red <<
" sg ";
4386 out << rgb_values.red <<
' ' << rgb_values.green <<
' ' 4387 << rgb_values.blue <<
" s ";
4392 out << (cell->vertices[0] - offset) * scale <<
" m " 4393 << (cell->vertices[1] - offset) * scale <<
" l " 4394 << (cell->vertices[3] - offset) * scale <<
" l " 4395 << (cell->vertices[2] - offset) * scale <<
" lf" <<
'\n';
4398 if (flags.draw_mesh)
4400 << (cell->vertices[0] - offset) * scale <<
" m " 4401 << (cell->vertices[1] - offset) * scale <<
" l " 4402 << (cell->vertices[3] - offset) * scale <<
" l " 4403 << (cell->vertices[2] - offset) * scale <<
" lx" <<
'\n';
4405 out <<
"showpage" <<
'\n';
4414 template <
int dim,
int spacedim>
4418 const std::vector<std::string> & data_names,
4419 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
4427 std::tuple<
unsigned int,
4437 template <
int dim,
int spacedim>
4441 const std::vector<std::string> & data_names,
4443 std::tuple<
unsigned int,
4459 #ifndef DEAL_II_WITH_MPI 4468 if (patches.size() == 0)
4472 GmvStream gmv_out(out, flags);
4473 const unsigned int n_data_sets = data_names.size();
4476 Assert((patches[0].data.n_rows() == n_data_sets &&
4477 !patches[0].points_are_available) ||
4478 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4479 patches[0].points_are_available),
4481 (n_data_sets + spacedim) :
4483 patches[0].data.n_rows()));
4487 out <<
"gmvinput ascii" <<
'\n' <<
'\n';
4490 unsigned int n_nodes;
4491 unsigned int n_cells;
4492 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4507 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
4509 &write_gmv_reorder_data_vectors<dim, spacedim>;
4517 out <<
"nodes " << n_nodes <<
'\n';
4518 for (
unsigned int d = 0; d < spacedim; ++d)
4520 gmv_out.selected_component = d;
4521 write_nodes(patches, gmv_out);
4526 for (
unsigned int d = spacedim; d < 3; ++d)
4528 for (
unsigned int i = 0; i < n_nodes; ++i)
4535 out <<
"cells " << n_cells <<
'\n';
4536 write_cells(patches, gmv_out);
4540 out <<
"variable" <<
'\n';
4544 reorder_task.
join();
4548 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4550 out << data_names[data_set] <<
" 1" <<
'\n';
4551 std::copy(data_vectors[data_set].begin(),
4552 data_vectors[data_set].end(),
4553 std::ostream_iterator<double>(out,
" "));
4554 out <<
'\n' <<
'\n';
4560 out <<
"endvars" <<
'\n';
4563 out <<
"endgmv" <<
'\n';
4574 template <
int dim,
int spacedim>
4578 const std::vector<std::string> & data_names,
4579 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
4587 std::tuple<
unsigned int,
4597 template <
int dim,
int spacedim>
4601 const std::vector<std::string> & data_names,
4603 std::tuple<
unsigned int,
4617 #ifndef DEAL_II_WITH_MPI 4626 if (patches.size() == 0)
4630 TecplotStream tecplot_out(out, flags);
4632 const unsigned int n_data_sets = data_names.size();
4635 Assert((patches[0].data.n_rows() == n_data_sets &&
4636 !patches[0].points_are_available) ||
4637 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4638 patches[0].points_are_available),
4640 (n_data_sets + spacedim) :
4642 patches[0].data.n_rows()));
4645 unsigned int n_nodes;
4646 unsigned int n_cells;
4647 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4653 <<
"# This file was generated by the deal.II library." <<
'\n' 4657 <<
"# For a description of the Tecplot format see the Tecplot documentation." 4662 out <<
"Variables=";
4670 out <<
"\"x\", \"y\"";
4673 out <<
"\"x\", \"y\", \"z\"";
4679 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4680 out <<
", \"" << data_names[data_set] <<
"\"";
4686 out <<
"t=\"" << flags.
zone_name <<
"\" ";
4689 out <<
"strandid=1, solutiontime=" << flags.
solution_time <<
", ";
4691 out <<
"f=feblock, n=" << n_nodes <<
", e=" << n_cells
4692 <<
", et=" << tecplot_cell_type[dim] <<
'\n';
4711 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
4713 &write_gmv_reorder_data_vectors<dim, spacedim>;
4721 for (
unsigned int d = 0; d < spacedim; ++d)
4723 tecplot_out.selected_component = d;
4724 write_nodes(patches, tecplot_out);
4734 reorder_task.
join();
4737 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4739 std::copy(data_vectors[data_set].begin(),
4740 data_vectors[data_set].end(),
4741 std::ostream_iterator<double>(out,
"\n"));
4745 write_cells(patches, tecplot_out);
4759 #ifdef DEAL_II_HAVE_TECPLOT 4766 TecplotMacros(
const unsigned int n_nodes = 0,
4767 const unsigned int n_vars = 0,
4768 const unsigned int n_cells = 0,
4769 const unsigned int n_vert = 0);
4772 nd(
const unsigned int i,
const unsigned int j);
4774 cd(
const unsigned int i,
const unsigned int j);
4775 std::vector<float> nodalData;
4776 std::vector<int> connData;
4779 unsigned int n_nodes;
4780 unsigned int n_vars;
4781 unsigned int n_cells;
4782 unsigned int n_vert;
4786 inline TecplotMacros::TecplotMacros(
const unsigned int n_nodes,
4787 const unsigned int n_vars,
4788 const unsigned int n_cells,
4789 const unsigned int n_vert)
4795 nodalData.resize(n_nodes * n_vars);
4796 connData.resize(n_cells * n_vert);
4801 inline TecplotMacros::~TecplotMacros()
4807 TecplotMacros::nd(
const unsigned int i,
const unsigned int j)
4809 return nodalData[i * n_nodes + j];
4815 TecplotMacros::cd(
const unsigned int i,
const unsigned int j)
4817 return connData[i + j * n_vert];
4828 template <
int dim,
int spacedim>
4832 const std::vector<std::string> & data_names,
4833 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
4834 & nonscalar_data_ranges,
4838 const unsigned int size = nonscalar_data_ranges.size();
4840 std::tuple<
unsigned int,
4844 new_nonscalar_data_ranges(size);
4845 for (
unsigned int i = 0; i < size; ++i)
4847 new_nonscalar_data_ranges[i] =
4848 std::tuple<
unsigned int,
4852 std::get<0>(nonscalar_data_ranges[i]),
4853 std::get<1>(nonscalar_data_ranges[i]),
4854 std::get<2>(nonscalar_data_ranges[i]),
4859 patches, data_names, new_nonscalar_data_ranges, flags, out);
4864 template <
int dim,
int spacedim>
4868 const std::vector<std::string> & data_names,
4870 std::tuple<
unsigned int,
4874 & nonscalar_data_ranges,
4883 #ifndef DEAL_II_HAVE_TECPLOT 4886 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
4894 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
4903 if (file_name == NULL)
4908 ExcMessage(
"Specify the name of the tecplot_binary" 4909 " file through the TecplotFlags interface."));
4910 write_tecplot(patches, data_names, nonscalar_data_ranges, flags, out);
4917 # ifndef DEAL_II_WITH_MPI 4926 if (patches.size() == 0)
4930 const unsigned int n_data_sets = data_names.size();
4933 Assert((patches[0].data.n_rows() == n_data_sets &&
4934 !patches[0].points_are_available) ||
4935 (patches[0].data.n_rows() == n_data_sets + spacedim &&
4936 patches[0].points_are_available),
4938 (n_data_sets + spacedim) :
4940 patches[0].data.n_rows()));
4943 unsigned int n_nodes;
4944 unsigned int n_cells;
4945 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
4947 const unsigned int vars_per_node = (spacedim + n_data_sets),
4950 TecplotMacros tm(n_nodes, vars_per_node, n_cells, nodes_per_cell);
4952 int is_double = 0, tec_debug = 0, cell_type = tecplot_binary_cell_type[dim];
4954 std::string tec_var_names;
4958 tec_var_names =
"x y";
4961 tec_var_names =
"x y z";
4967 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
4969 tec_var_names +=
" ";
4970 tec_var_names += data_names[data_set];
4986 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
4988 &write_gmv_reorder_data_vectors<dim, spacedim>;
4994 for (
unsigned int d = 1; d <= spacedim; ++d)
4996 unsigned int entry = 0;
5000 patch != patches.end();
5003 const unsigned int n_subdivisions = patch->n_subdivisions;
5009 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5010 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5012 const double x_frac = i * 1. / n_subdivisions,
5013 y_frac = j * 1. / n_subdivisions;
5015 tm.nd((d - 1), entry) =
static_cast<float>(
5016 (((patch->vertices[1](d - 1) * x_frac) +
5017 (patch->vertices[0](d - 1) * (1 - x_frac))) *
5019 ((patch->vertices[3](d - 1) * x_frac) +
5020 (patch->vertices[2](d - 1) * (1 - x_frac))) *
5029 for (
unsigned int j = 0; j < n_subdivisions + 1; ++j)
5030 for (
unsigned int k = 0; k < n_subdivisions + 1; ++k)
5031 for (
unsigned int i = 0; i < n_subdivisions + 1; ++i)
5033 const double x_frac = i * 1. / n_subdivisions,
5034 y_frac = k * 1. / n_subdivisions,
5035 z_frac = j * 1. / n_subdivisions;
5038 tm.nd((d - 1), entry) =
static_cast<float>(
5039 ((((patch->vertices[1](d - 1) * x_frac) +
5040 (patch->vertices[0](d - 1) * (1 - x_frac))) *
5042 ((patch->vertices[3](d - 1) * x_frac) +
5043 (patch->vertices[2](d - 1) * (1 - x_frac))) *
5046 (((patch->vertices[5](d - 1) * x_frac) +
5047 (patch->vertices[4](d - 1) * (1 - x_frac))) *
5049 ((patch->vertices[7](d - 1) * x_frac) +
5050 (patch->vertices[6](d - 1) * (1 - x_frac))) *
5068 reorder_task.
join();
5071 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5072 for (
unsigned int entry = 0; entry < data_vectors[data_set].
size();
5074 tm.nd((spacedim + data_set), entry) =
5075 static_cast<float>(data_vectors[data_set][entry]);
5081 unsigned int first_vertex_of_patch = 0;
5082 unsigned int elem = 0;
5086 patch != patches.end();
5089 const unsigned int n_subdivisions = patch->n_subdivisions;
5090 const unsigned int n = n_subdivisions + 1;
5091 const unsigned int d1 = 1;
5092 const unsigned int d2 = n;
5093 const unsigned int d3 = n * n;
5099 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5100 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5103 first_vertex_of_patch + (i1)*d1 + (i2)*d2 + 1;
5105 first_vertex_of_patch + (i1 + 1) * d1 + (i2)*d2 + 1;
5106 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5109 first_vertex_of_patch + (i1)*d1 + (i2 + 1) * d2 + 1;
5118 for (
unsigned int i3 = 0; i3 < n_subdivisions; ++i3)
5119 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
5120 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
5125 tm.cd(0, elem) = first_vertex_of_patch + (i1)*d1 +
5126 (i2)*d2 + (i3)*d3 + 1;
5127 tm.cd(1, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5128 (i2)*d2 + (i3)*d3 + 1;
5129 tm.cd(2, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5130 (i2 + 1) * d2 + (i3)*d3 + 1;
5131 tm.cd(3, elem) = first_vertex_of_patch + (i1)*d1 +
5132 (i2 + 1) * d2 + (i3)*d3 + 1;
5133 tm.cd(4, elem) = first_vertex_of_patch + (i1)*d1 +
5134 (i2)*d2 + (i3 + 1) * d3 + 1;
5135 tm.cd(5, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5136 (i2)*d2 + (i3 + 1) * d3 + 1;
5137 tm.cd(6, elem) = first_vertex_of_patch + (i1 + 1) * d1 +
5138 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5139 tm.cd(7, elem) = first_vertex_of_patch + (i1)*d1 +
5140 (i2 + 1) * d2 + (i3 + 1) * d3 + 1;
5153 first_vertex_of_patch += Utilities::fixed_power<dim>(n);
5158 int ierr = 0, num_nodes =
static_cast<int>(n_nodes),
5159 num_cells = static_cast<int>(n_cells);
5161 char dot[2] = {
'.', 0};
5165 char *var_names =
const_cast<char *
>(tec_var_names.c_str());
5166 ierr = TECINI(NULL, var_names, file_name, dot, &tec_debug, &is_double);
5170 char FEBLOCK[] = {
'F',
'E',
'B',
'L',
'O',
'C',
'K', 0};
5171 ierr = TECZNE(NULL, &num_nodes, &num_cells, &cell_type, FEBLOCK, NULL);
5175 int total = (vars_per_node * num_nodes);
5177 ierr = TECDAT(&total, &tm.nodalData[0], &is_double);
5181 ierr = TECNOD(&tm.connData[0]);
5194 template <
int dim,
int spacedim>
5198 const std::vector<std::string> & data_names,
5199 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
5200 & nonscalar_data_ranges,
5204 const unsigned int size = nonscalar_data_ranges.size();
5206 std::tuple<
unsigned int,
5210 new_nonscalar_data_ranges(size);
5211 for (
unsigned int i = 0; i < size; ++i)
5213 new_nonscalar_data_ranges[i] =
5214 std::tuple<
unsigned int,
5218 std::get<0>(nonscalar_data_ranges[i]),
5219 std::get<1>(nonscalar_data_ranges[i]),
5220 std::get<2>(nonscalar_data_ranges[i]),
5224 write_vtk(patches, data_names, new_nonscalar_data_ranges, flags, out);
5229 template <
int dim,
int spacedim>
5233 const std::vector<std::string> & data_names,
5235 std::tuple<
unsigned int,
5239 & nonscalar_data_ranges,
5245 #ifndef DEAL_II_WITH_MPI 5254 if (patches.size() == 0)
5258 VtkStream vtk_out(out, flags);
5260 const unsigned int n_data_sets = data_names.size();
5262 if (patches[0].points_are_available)
5274 out <<
"# vtk DataFile Version 3.0" <<
'\n' 5275 <<
"#This file was generated by the deal.II library";
5283 out <<
'\n' <<
"ASCII" <<
'\n';
5285 out <<
"DATASET UNSTRUCTURED_GRID\n" <<
'\n';
5292 const unsigned int n_metadata =
5293 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5294 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5296 out <<
"FIELD FieldData " << n_metadata <<
"\n";
5298 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5300 out <<
"CYCLE 1 1 int\n" << flags.
cycle <<
"\n";
5302 if (flags.
time != std::numeric_limits<double>::min())
5304 out <<
"TIME 1 1 double\n" << flags.
time <<
"\n";
5309 unsigned int n_nodes;
5310 unsigned int n_cells;
5311 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
5319 n_cells = patches.size();
5320 n_points_per_cell = n_nodes / n_cells;
5337 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5339 &write_gmv_reorder_data_vectors<dim, spacedim>;
5347 out <<
"POINTS " << n_nodes <<
" double" <<
'\n';
5348 write_nodes(patches, vtk_out);
5352 out <<
"CELLS " << n_cells <<
' ' << n_cells * (n_points_per_cell + 1)
5355 write_high_order_cells(patches, vtk_out);
5357 write_cells(patches, vtk_out);
5361 out <<
"CELL_TYPES " << n_cells <<
'\n';
5365 vtk_lagrange_cell_type[dim] :
5367 for (
unsigned int i = 0; i < n_cells; ++i)
5368 out <<
' ' << vtk_cell_id;
5375 reorder_task.
join();
5380 out <<
"POINT_DATA " << n_nodes <<
'\n';
5384 std::vector<bool> data_set_written(n_data_sets,
false);
5385 for (
unsigned int n_th_vector = 0;
5386 n_th_vector < nonscalar_data_ranges.size();
5390 std::get<1>(nonscalar_data_ranges[n_th_vector]) >=
5391 std::get<0>(nonscalar_data_ranges[n_th_vector]),
5392 ExcLowerRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
5393 std::get<0>(nonscalar_data_ranges[n_th_vector])));
5395 std::get<1>(nonscalar_data_ranges[n_th_vector]) < n_data_sets,
5396 ExcIndexRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
5399 AssertThrow(std::get<1>(nonscalar_data_ranges[n_th_vector]) + 1 -
5400 std::get<0>(nonscalar_data_ranges[n_th_vector]) <=
5403 "Can't declare a vector with more than 3 components " 5407 for (
unsigned int i = std::get<0>(nonscalar_data_ranges[n_th_vector]);
5408 i <= std::get<1>(nonscalar_data_ranges[n_th_vector]);
5410 data_set_written[i] =
true;
5416 if (std::get<2>(nonscalar_data_ranges[n_th_vector]) !=
"")
5417 out << std::get<2>(nonscalar_data_ranges[n_th_vector]);
5420 for (
unsigned int i =
5421 std::get<0>(nonscalar_data_ranges[n_th_vector]);
5422 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
5424 out << data_names[i] <<
"__";
5425 out << data_names[std::get<1>(nonscalar_data_ranges[n_th_vector])];
5428 out <<
" double" <<
'\n';
5431 for (
unsigned int n = 0; n < n_nodes; ++n)
5433 switch (std::get<1>(nonscalar_data_ranges[n_th_vector]) -
5434 std::get<0>(nonscalar_data_ranges[n_th_vector]))
5437 out << data_vectors(
5438 std::get<0>(nonscalar_data_ranges[n_th_vector]), n)
5443 out << data_vectors(
5444 std::get<0>(nonscalar_data_ranges[n_th_vector]), n)
5447 std::get<0>(nonscalar_data_ranges[n_th_vector]) + 1,
5452 out << data_vectors(
5453 std::get<0>(nonscalar_data_ranges[n_th_vector]), n)
5456 std::get<0>(nonscalar_data_ranges[n_th_vector]) + 1,
5460 std::get<0>(nonscalar_data_ranges[n_th_vector]) + 2,
5474 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5475 if (data_set_written[data_set] ==
false)
5477 out <<
"SCALARS " << data_names[data_set] <<
" double 1" <<
'\n' 5478 <<
"LOOKUP_TABLE default" <<
'\n';
5479 std::copy(data_vectors[data_set].begin(),
5480 data_vectors[data_set].end(),
5481 std::ostream_iterator<double>(out,
" "));
5497 out <<
"<?xml version=\"1.0\" ?> \n";
5499 out <<
"# vtk DataFile Version 3.0" <<
'\n' 5500 <<
"#This file was generated by the deal.II library";
5509 out <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\"";
5510 #ifdef DEAL_II_WITH_ZLIB 5511 out <<
" compressor=\"vtkZLibDataCompressor\"";
5513 #ifdef DEAL_II_WORDS_BIGENDIAN 5514 out <<
" byte_order=\"BigEndian\"";
5516 out <<
" byte_order=\"LittleEndian\"";
5520 out <<
"<UnstructuredGrid>";
5530 out <<
" </UnstructuredGrid>\n";
5531 out <<
"</VTKFile>\n";
5536 template <
int dim,
int spacedim>
5540 const std::vector<std::string> & data_names,
5541 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
5542 & nonscalar_data_ranges,
5547 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5555 template <
int dim,
int spacedim>
5559 const std::vector<std::string> & data_names,
5561 std::tuple<
unsigned int,
5565 & nonscalar_data_ranges,
5570 write_vtu_main(patches, data_names, nonscalar_data_ranges, flags, out);
5578 template <
int dim,
int spacedim>
5582 const std::vector<std::string> & data_names,
5583 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
5584 & nonscalar_data_ranges,
5588 const unsigned int size = nonscalar_data_ranges.size();
5590 std::tuple<
unsigned int,
5594 new_nonscalar_data_ranges(size);
5595 for (
unsigned int i = 0; i < size; ++i)
5597 new_nonscalar_data_ranges[i] =
5598 std::tuple<
unsigned int,
5602 std::get<0>(nonscalar_data_ranges[i]),
5603 std::get<1>(nonscalar_data_ranges[i]),
5604 std::get<2>(nonscalar_data_ranges[i]),
5608 write_vtu_main(patches, data_names, new_nonscalar_data_ranges, flags, out);
5613 template <
int dim,
int spacedim>
5617 const std::vector<std::string> & data_names,
5619 std::tuple<
unsigned int,
5623 & nonscalar_data_ranges,
5629 #ifndef DEAL_II_WITH_MPI 5638 if (patches.size() == 0)
5643 out <<
"<Piece NumberOfPoints=\"0\" NumberOfCells=\"0\" >\n" 5645 <<
"<DataArray type=\"UInt8\" Name=\"types\"></DataArray>\n" 5647 <<
" <PointData Scalars=\"scalars\">\n";
5648 std::vector<bool> data_set_written(data_names.size(),
false);
5649 for (
unsigned int n_th_vector = 0;
5650 n_th_vector < nonscalar_data_ranges.size();
5654 for (
unsigned int i =
5655 std::get<0>(nonscalar_data_ranges[n_th_vector]);
5656 i <= std::get<1>(nonscalar_data_ranges[n_th_vector]);
5658 data_set_written[i] =
true;
5662 out <<
" <DataArray type=\"Float32\" Name=\"";
5664 if (std::get<2>(nonscalar_data_ranges[n_th_vector]) !=
"")
5665 out << std::get<2>(nonscalar_data_ranges[n_th_vector]);
5668 for (
unsigned int i =
5669 std::get<0>(nonscalar_data_ranges[n_th_vector]);
5670 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
5672 out << data_names[i] <<
"__";
5673 out << data_names[std::get<1>(
5674 nonscalar_data_ranges[n_th_vector])];
5677 out <<
"\" NumberOfComponents=\"3\"></DataArray>\n";
5680 for (
unsigned int data_set = 0; data_set < data_names.size();
5682 if (data_set_written[data_set] ==
false)
5684 out <<
" <DataArray type=\"Float32\" Name=\"" 5685 << data_names[data_set] <<
"\"></DataArray>\n";
5688 out <<
" </PointData>\n";
5689 out <<
"</Piece>\n";
5703 const unsigned int n_metadata =
5704 ((flags.
cycle != std::numeric_limits<unsigned int>::min() ? 1 : 0) +
5705 (flags.
time != std::numeric_limits<double>::min() ? 1 : 0));
5707 out <<
"<FieldData>\n";
5709 if (flags.
cycle != std::numeric_limits<unsigned int>::min())
5712 <<
"<DataArray type=\"Float32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">" 5713 << flags.
cycle <<
"</DataArray>\n";
5715 if (flags.
time != std::numeric_limits<double>::min())
5718 <<
"<DataArray type=\"Float32\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">" 5719 << flags.
time <<
"</DataArray>\n";
5723 out <<
"</FieldData>\n";
5727 VtuStream vtu_out(out, flags);
5729 const unsigned int n_data_sets = data_names.size();
5732 if (patches[0].points_are_available)
5741 #ifdef DEAL_II_WITH_ZLIB
5742 const char *ascii_or_binary =
"binary";
5744 const char *ascii_or_binary =
"ascii";
5749 unsigned int n_nodes;
5750 unsigned int n_cells;
5751 compute_sizes<dim, spacedim>(patches, n_nodes, n_cells);
5759 n_cells = patches.size();
5760 n_points_per_cell = n_nodes / n_cells;
5777 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
5779 &write_gmv_reorder_data_vectors<dim, spacedim, float>;
5788 out <<
"<Piece NumberOfPoints=\"" << n_nodes <<
"\" NumberOfCells=\"" 5789 << n_cells <<
"\" >\n";
5790 out <<
" <Points>\n";
5791 out <<
" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"" 5792 << ascii_or_binary <<
"\">\n";
5793 write_nodes(patches, vtu_out);
5794 out <<
" </DataArray>\n";
5795 out <<
" </Points>\n\n";
5798 out <<
" <Cells>\n";
5799 out <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"" 5800 << ascii_or_binary <<
"\">\n";
5802 write_high_order_cells(patches, vtu_out);
5804 write_cells(patches, vtu_out);
5805 out <<
" </DataArray>\n";
5809 out <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\"" 5810 << ascii_or_binary <<
"\">\n";
5812 std::vector<int32_t> offsets(n_cells);
5813 for (
unsigned int i = 0; i < n_cells; ++i)
5814 offsets[i] = (i + 1) * n_points_per_cell;
5817 out <<
" </DataArray>\n";
5821 out <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\"" 5822 << ascii_or_binary <<
"\">\n";
5827 vtk_lagrange_cell_type[dim] :
5832 #ifdef DEAL_II_WITH_ZLIB 5833 std::vector<uint8_t> cell_types(n_cells,
5834 static_cast<uint8_t>(vtk_cell_id));
5836 std::vector<unsigned int> cell_types(n_cells, vtk_cell_id);
5839 vtu_out << cell_types;
5842 out <<
" </DataArray>\n";
5843 out <<
" </Cells>\n";
5851 reorder_task.
join();
5856 out <<
" <PointData Scalars=\"scalars\">\n";
5860 std::vector<bool> data_set_written(n_data_sets,
false);
5861 for (
auto range : nonscalar_data_ranges)
5863 const auto first_component = std::get<0>(range);
5864 const auto last_component = std::get<1>(range);
5865 const auto name = std::get<2>(range);
5866 const bool is_tensor =
5867 (std::get<3>(range) ==
5869 const unsigned int n_components = (is_tensor ? 9 : 3);
5876 AssertThrow((last_component + 1 - first_component <= 9),
5878 "Can't declare a tensor with more than 9 components " 5883 AssertThrow((last_component + 1 - first_component <= 3),
5885 "Can't declare a vector with more than 3 components " 5890 for (
unsigned int i = first_component; i <= last_component; ++i)
5891 data_set_written[i] =
true;
5895 out <<
" <DataArray type=\"Float32\" Name=\"";
5901 for (
unsigned int i = first_component; i < last_component; ++i)
5902 out << data_names[i] <<
"__";
5903 out << data_names[last_component];
5906 out <<
"\" NumberOfComponents=\"" << n_components <<
"\" format=\"" 5907 << ascii_or_binary <<
"\">\n";
5910 std::vector<float> data;
5911 data.reserve(n_nodes * n_components);
5913 for (
unsigned int n = 0; n < n_nodes; ++n)
5917 switch (last_component - first_component)
5920 data.push_back(data_vectors(first_component, n));
5926 data.push_back(data_vectors(first_component, n));
5927 data.push_back(data_vectors(first_component + 1, n));
5932 data.push_back(data_vectors(first_component, n));
5933 data.push_back(data_vectors(first_component + 1, n));
5934 data.push_back(data_vectors(first_component + 2, n));
5947 const unsigned int size = last_component - first_component + 1;
5951 vtk_data[0][0] = data_vectors(first_component, n);
5953 else if ((size == 4) || (size == 9))
5956 for (
unsigned int c = 0; c < size; ++c)
5960 vtk_data[ind[0]][ind[1]] =
5961 data_vectors(first_component + c, n);
5972 for (
unsigned int i = 0; i < 3; ++i)
5973 for (
unsigned int j = 0; j < 3; ++j)
5974 data.push_back(vtk_data[i][j]);
5979 out <<
" </DataArray>\n";
5984 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
5985 if (data_set_written[data_set] ==
false)
5987 out <<
" <DataArray type=\"Float32\" Name=\"" 5988 << data_names[data_set] <<
"\" format=\"" << ascii_or_binary
5991 std::vector<float> data(data_vectors[data_set].begin(),
5992 data_vectors[data_set].end());
5994 out <<
" </DataArray>\n";
5997 out <<
" </PointData>\n";
6000 out <<
" </Piece>\n";
6014 const std::vector<std::string> &piece_names,
6015 const std::vector<std::string> &data_names,
6016 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
6017 &nonscalar_data_ranges)
6019 const unsigned int size = nonscalar_data_ranges.size();
6021 std::tuple<
unsigned int,
6025 new_nonscalar_data_ranges(size);
6026 for (
unsigned int i = 0; i < size; ++i)
6028 new_nonscalar_data_ranges[i] =
6029 std::tuple<
unsigned int,
6033 std::get<0>(nonscalar_data_ranges[i]),
6034 std::get<1>(nonscalar_data_ranges[i]),
6035 std::get<2>(nonscalar_data_ranges[i]),
6047 const std::vector<std::string> &piece_names,
6048 const std::vector<std::string> &data_names,
6050 std::tuple<
unsigned int,
6054 &nonscalar_data_ranges)
6058 const unsigned int n_data_sets = data_names.size();
6060 out <<
"<?xml version=\"1.0\"?>\n";
6063 out <<
"#This file was generated by the deal.II library" 6068 <<
"<VTKFile type=\"PUnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
6069 out <<
" <PUnstructuredGrid GhostLevel=\"0\">\n";
6070 out <<
" <PPointData Scalars=\"scalars\">\n";
6073 std::vector<bool> data_set_written(n_data_sets,
false);
6074 for (
unsigned int n_th_vector = 0;
6075 n_th_vector < nonscalar_data_ranges.size();
6079 std::get<1>(nonscalar_data_ranges[n_th_vector]) >=
6080 std::get<0>(nonscalar_data_ranges[n_th_vector]),
6081 ExcLowerRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
6082 std::get<0>(nonscalar_data_ranges[n_th_vector])));
6084 std::get<1>(nonscalar_data_ranges[n_th_vector]) < n_data_sets,
6085 ExcIndexRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
6088 AssertThrow(std::get<1>(nonscalar_data_ranges[n_th_vector]) + 1 -
6089 std::get<0>(nonscalar_data_ranges[n_th_vector]) <=
6092 "Can't declare a vector with more than 3 components " 6096 for (
unsigned int i = std::get<0>(nonscalar_data_ranges[n_th_vector]);
6097 i <= std::get<1>(nonscalar_data_ranges[n_th_vector]);
6099 data_set_written[i] =
true;
6103 out <<
" <PDataArray type=\"Float32\" Name=\"";
6105 if (std::get<2>(nonscalar_data_ranges[n_th_vector]) !=
"")
6106 out << std::get<2>(nonscalar_data_ranges[n_th_vector]);
6109 for (
unsigned int i =
6110 std::get<0>(nonscalar_data_ranges[n_th_vector]);
6111 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
6113 out << data_names[i] <<
"__";
6114 out << data_names[std::get<1>(nonscalar_data_ranges[n_th_vector])];
6117 out <<
"\" NumberOfComponents=\"3\" format=\"ascii\"/>\n";
6120 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
6121 if (data_set_written[data_set] ==
false)
6123 out <<
" <PDataArray type=\"Float32\" Name=\"" 6124 << data_names[data_set] <<
"\" format=\"ascii\"/>\n";
6127 out <<
" </PPointData>\n";
6129 out <<
" <PPoints>\n";
6130 out <<
" <PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
6131 out <<
" </PPoints>\n";
6133 for (
unsigned int i = 0; i < piece_names.size(); ++i)
6134 out <<
" <Piece Source=\"" << piece_names[i] <<
"\"/>\n";
6136 out <<
" </PUnstructuredGrid>\n";
6137 out <<
"</VTKFile>\n";
6150 const std::vector<std::pair<double, std::string>> ×_and_names)
6154 out <<
"<?xml version=\"1.0\"?>\n";
6157 out <<
"#This file was generated by the deal.II library" 6162 <<
"<VTKFile type=\"Collection\" version=\"0.1\" ByteOrder=\"LittleEndian\">\n";
6163 out <<
" <Collection>\n";
6165 std::streamsize ss = out.precision();
6168 for (
unsigned int i = 0; i < times_and_names.size(); ++i)
6169 out <<
" <DataSet timestep=\"" << times_and_names[i].first
6170 <<
"\" group=\"\" part=\"0\" file=\"" << times_and_names[i].second
6173 out <<
" </Collection>\n";
6174 out <<
"</VTKFile>\n";
6186 const std::vector<std::string> &piece_names)
6188 out <<
"!NBLOCKS " << piece_names.size() <<
'\n';
6189 for (
unsigned int i = 0; i < piece_names.size(); ++i)
6190 out << piece_names[i] <<
'\n';
6199 const std::vector<std::vector<std::string>> &piece_names)
6203 if (piece_names.size() == 0)
6206 const double nblocks = piece_names[0].size();
6208 ExcMessage(
"piece_names should be a vector of nonempty vectors."));
6210 out <<
"!NBLOCKS " << nblocks <<
'\n';
6211 for (
const auto &domain : piece_names)
6213 Assert(domain.size() == nblocks,
6215 "piece_names should be a vector of equal sized vectors."));
6216 for (
const auto &subdomain : domain)
6217 out << subdomain <<
'\n';
6228 const std::vector<std::pair<
double, std::vector<std::string>>>
6229 ×_and_piece_names)
6233 if (times_and_piece_names.size() == 0)
6236 const double nblocks = times_and_piece_names[0].second.size();
6240 "time_and_piece_names should contain nonempty vectors of filenames for every timestep."));
6242 for (
const auto &domain : times_and_piece_names)
6243 out <<
"!TIME " << domain.first <<
'\n';
6245 out <<
"!NBLOCKS " << nblocks <<
'\n';
6246 for (
const auto &domain : times_and_piece_names)
6248 Assert(domain.second.size() == nblocks,
6250 "piece_names should be a vector of equal sized vectors."));
6251 for (
const auto &subdomain : domain.second)
6252 out << subdomain <<
'\n';
6260 template <
int dim,
int spacedim>
6264 const std::vector<std::string> &,
6265 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &,
6274 template <
int dim,
int spacedim>
6278 const std::vector<std::string> &,
6280 std::tuple<
unsigned int,
6292 template <
int spacedim>
6296 const std::vector<std::string> & data_names,
6297 const std::vector<std::tuple<unsigned int, unsigned int, std::string>> &
6306 std::tuple<
unsigned int,
6316 template <
int spacedim>
6320 const std::vector<std::string> & ,
6322 std::tuple<
unsigned int,
6331 const unsigned int height = flags.
height;
6332 unsigned int width = flags.
width;
6335 unsigned int margin_in_percent = 0;
6337 margin_in_percent = 5;
6341 double x_dimension, y_dimension, z_dimension;
6343 typename std::vector<Patch<dim, spacedim>>::const_iterator patch =
6346 unsigned int n_subdivisions = patch->n_subdivisions;
6347 unsigned int n = n_subdivisions + 1;
6348 const unsigned int d1 = 1;
6349 const unsigned int d2 = n;
6355 Point<2> projection_decompositions[4];
6357 compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions);
6360 patch->data.n_rows() == 0,
6363 double x_min = projected_point[0];
6364 double x_max = x_min;
6365 double y_min = projected_point[1];
6366 double y_max = y_min;
6368 patch->data.n_rows() != 0 ? patch->data(flags.
height_vector, 0) : 0;
6369 double z_max = z_min;
6372 for (; patch != patches.end(); ++patch)
6374 n_subdivisions = patch->n_subdivisions;
6375 n = n_subdivisions + 1;
6377 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6379 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6382 projected_points[0], &*patch, i1, i2, 0, n_subdivisions);
6384 projected_points[1], &*patch, i1 + 1, i2, 0, n_subdivisions);
6386 projected_points[2], &*patch, i1, i2 + 1, 0, n_subdivisions);
6387 compute_node(projected_points[3],
6394 x_min = std::min(x_min, (
double)projected_points[0][0]);
6395 x_min = std::min(x_min, (
double)projected_points[1][0]);
6396 x_min = std::min(x_min, (
double)projected_points[2][0]);
6397 x_min = std::min(x_min, (
double)projected_points[3][0]);
6399 x_max = std::max(x_max, (
double)projected_points[0][0]);
6400 x_max = std::max(x_max, (
double)projected_points[1][0]);
6401 x_max = std::max(x_max, (
double)projected_points[2][0]);
6402 x_max = std::max(x_max, (
double)projected_points[3][0]);
6404 y_min = std::min(y_min, (
double)projected_points[0][1]);
6405 y_min = std::min(y_min, (
double)projected_points[1][1]);
6406 y_min = std::min(y_min, (
double)projected_points[2][1]);
6407 y_min = std::min(y_min, (
double)projected_points[3][1]);
6409 y_max = std::max(y_max, (
double)projected_points[0][1]);
6410 y_max = std::max(y_max, (
double)projected_points[1][1]);
6411 y_max = std::max(y_max, (
double)projected_points[2][1]);
6412 y_max = std::max(y_max, (
double)projected_points[3][1]);
6415 patch->data.n_rows() == 0,
6418 patch->data.n_rows()));
6420 z_min = std::min(z_min,
6422 i1 * d1 + i2 * d2));
6423 z_min = std::min(z_min,
6425 (i1 + 1) * d1 + i2 * d2));
6426 z_min = std::min(z_min,
6428 i1 * d1 + (i2 + 1) * d2));
6432 (i1 + 1) * d1 + (i2 + 1) * d2));
6434 z_max = std::max(z_max,
6436 i1 * d1 + i2 * d2));
6437 z_max = std::max(z_max,
6439 (i1 + 1) * d1 + i2 * d2));
6440 z_max = std::max(z_max,
6442 i1 * d1 + (i2 + 1) * d2));
6446 (i1 + 1) * d1 + (i2 + 1) * d2));
6451 x_dimension = x_max - x_min;
6452 y_dimension = y_max - y_min;
6453 z_dimension = z_max - z_min;
6460 float camera_focus = 0;
6463 camera_position[0] = 0.;
6464 camera_position[1] = 0.;
6465 camera_position[2] = z_min + 2. * z_dimension;
6467 camera_direction[0] = 0.;
6468 camera_direction[1] = 0.;
6469 camera_direction[2] = -1.;
6471 camera_horizontal[0] = 1.;
6472 camera_horizontal[1] = 0.;
6473 camera_horizontal[2] = 0.;
6475 camera_focus = .5 * z_dimension;
6481 const float angle_factor = 3.14159265f / 180.f;
6484 camera_position_temp[1] =
6485 std::cos(angle_factor * flags.polar_angle) * camera_position[1] -
6486 std::sin(angle_factor * flags.polar_angle) * camera_position[2];
6487 camera_position_temp[2] =
6488 std::sin(angle_factor * flags.polar_angle) * camera_position[1] +
6489 std::cos(angle_factor * flags.polar_angle) * camera_position[2];
6491 camera_direction_temp[1] =
6492 std::cos(angle_factor * flags.polar_angle) * camera_direction[1] -
6493 std::sin(angle_factor * flags.polar_angle) * camera_direction[2];
6494 camera_direction_temp[2] =
6495 std::sin(angle_factor * flags.polar_angle) * camera_direction[1] +
6496 std::cos(angle_factor * flags.polar_angle) * camera_direction[2];
6498 camera_horizontal_temp[1] =
6499 std::cos(angle_factor * flags.polar_angle) * camera_horizontal[1] -
6500 std::sin(angle_factor * flags.polar_angle) * camera_horizontal[2];
6501 camera_horizontal_temp[2] =
6502 std::sin(angle_factor * flags.polar_angle) * camera_horizontal[1] +
6503 std::cos(angle_factor * flags.polar_angle) * camera_horizontal[2];
6505 camera_position[1] = camera_position_temp[1];
6506 camera_position[2] = camera_position_temp[2];
6508 camera_direction[1] = camera_direction_temp[1];
6509 camera_direction[2] = camera_direction_temp[2];
6511 camera_horizontal[1] = camera_horizontal_temp[1];
6512 camera_horizontal[2] = camera_horizontal_temp[2];
6515 camera_position_temp[0] =
6516 std::cos(angle_factor * flags.
azimuth_angle) * camera_position[0] -
6517 std::sin(angle_factor * flags.
azimuth_angle) * camera_position[1];
6518 camera_position_temp[1] =
6519 std::sin(angle_factor * flags.
azimuth_angle) * camera_position[0] +
6520 std::cos(angle_factor * flags.
azimuth_angle) * camera_position[1];
6522 camera_direction_temp[0] =
6523 std::cos(angle_factor * flags.
azimuth_angle) * camera_direction[0] -
6524 std::sin(angle_factor * flags.
azimuth_angle) * camera_direction[1];
6525 camera_direction_temp[1] =
6526 std::sin(angle_factor * flags.
azimuth_angle) * camera_direction[0] +
6527 std::cos(angle_factor * flags.
azimuth_angle) * camera_direction[1];
6529 camera_horizontal_temp[0] =
6530 std::cos(angle_factor * flags.
azimuth_angle) * camera_horizontal[0] -
6531 std::sin(angle_factor * flags.
azimuth_angle) * camera_horizontal[1];
6532 camera_horizontal_temp[1] =
6533 std::sin(angle_factor * flags.
azimuth_angle) * camera_horizontal[0] +
6534 std::cos(angle_factor * flags.
azimuth_angle) * camera_horizontal[1];
6536 camera_position[0] = camera_position_temp[0];
6537 camera_position[1] = camera_position_temp[1];
6539 camera_direction[0] = camera_direction_temp[0];
6540 camera_direction[1] = camera_direction_temp[1];
6542 camera_horizontal[0] = camera_horizontal_temp[0];
6543 camera_horizontal[1] = camera_horizontal_temp[1];
6546 camera_position[0] = x_min + .5 * x_dimension;
6547 camera_position[1] = y_min + .5 * y_dimension;
6549 camera_position[0] += (z_min + 2. * z_dimension) *
6550 std::sin(angle_factor * flags.polar_angle) *
6552 camera_position[1] -= (z_min + 2. * z_dimension) *
6553 std::sin(angle_factor * flags.polar_angle) *
6558 double x_min_perspective, y_min_perspective;
6559 double x_max_perspective, y_max_perspective;
6560 double x_dimension_perspective, y_dimension_perspective;
6562 patch = patches.begin();
6564 n_subdivisions = patch->n_subdivisions;
6565 n = n_subdivisions + 1;
6569 compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions);
6572 patch->data.n_rows() == 0,
6575 point[0] = projected_point[0];
6576 point[1] = projected_point[1];
6578 patch->data.n_rows() != 0 ? patch->data(flags.
height_vector, 0) : 0;
6580 projection_decomposition = svg_project_point(point,
6586 x_min_perspective = projection_decomposition[0];
6587 x_max_perspective = projection_decomposition[0];
6588 y_min_perspective = projection_decomposition[1];
6589 y_max_perspective = projection_decomposition[1];
6592 for (; patch != patches.end(); ++patch)
6594 n_subdivisions = patch->n_subdivisions;
6595 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6597 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6603 projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions);
6604 compute_node(projected_vertices[1],
6610 compute_node(projected_vertices[2],
6616 compute_node(projected_vertices[3],
6624 patch->data.n_rows() == 0,
6627 patch->data.n_rows()));
6629 vertices[0][0] = projected_vertices[0][0];
6630 vertices[0][1] = projected_vertices[0][1];
6631 vertices[0][2] = patch->data.n_rows() != 0 ?
6632 patch->data(0, i1 * d1 + i2 * d2) :
6635 vertices[1][0] = projected_vertices[1][0];
6636 vertices[1][1] = projected_vertices[1][1];
6637 vertices[1][2] = patch->data.n_rows() != 0 ?
6638 patch->data(0, (i1 + 1) * d1 + i2 * d2) :
6641 vertices[2][0] = projected_vertices[2][0];
6642 vertices[2][1] = projected_vertices[2][1];
6643 vertices[2][2] = patch->data.n_rows() != 0 ?
6644 patch->data(0, i1 * d1 + (i2 + 1) * d2) :
6647 vertices[3][0] = projected_vertices[3][0];
6648 vertices[3][1] = projected_vertices[3][1];
6650 patch->data.n_rows() != 0 ?
6651 patch->data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6654 projection_decompositions[0] =
6655 svg_project_point(vertices[0],
6660 projection_decompositions[1] =
6661 svg_project_point(vertices[1],
6666 projection_decompositions[2] =
6667 svg_project_point(vertices[2],
6672 projection_decompositions[3] =
6673 svg_project_point(vertices[3],
6680 std::min(x_min_perspective,
6681 (
double)projection_decompositions[0][0]);
6683 std::min(x_min_perspective,
6684 (
double)projection_decompositions[1][0]);
6686 std::min(x_min_perspective,
6687 (
double)projection_decompositions[2][0]);
6689 std::min(x_min_perspective,
6690 (
double)projection_decompositions[3][0]);
6693 std::max(x_max_perspective,
6694 (
double)projection_decompositions[0][0]);
6696 std::max(x_max_perspective,
6697 (
double)projection_decompositions[1][0]);
6699 std::max(x_max_perspective,
6700 (
double)projection_decompositions[2][0]);
6702 std::max(x_max_perspective,
6703 (
double)projection_decompositions[3][0]);
6706 std::min(y_min_perspective,
6707 (
double)projection_decompositions[0][1]);
6709 std::min(y_min_perspective,
6710 (
double)projection_decompositions[1][1]);
6712 std::min(y_min_perspective,
6713 (
double)projection_decompositions[2][1]);
6715 std::min(y_min_perspective,
6716 (
double)projection_decompositions[3][1]);
6719 std::max(y_max_perspective,
6720 (
double)projection_decompositions[0][1]);
6722 std::max(y_max_perspective,
6723 (
double)projection_decompositions[1][1]);
6725 std::max(y_max_perspective,
6726 (
double)projection_decompositions[2][1]);
6728 std::max(y_max_perspective,
6729 (
double)projection_decompositions[3][1]);
6734 x_dimension_perspective = x_max_perspective - x_min_perspective;
6735 y_dimension_perspective = y_max_perspective - y_min_perspective;
6737 std::multiset<SvgCell> cells;
6740 for (patch = patches.begin(); patch != patches.end(); ++patch)
6742 n_subdivisions = patch->n_subdivisions;
6744 for (
unsigned int i2 = 0; i2 < n_subdivisions; ++i2)
6746 for (
unsigned int i1 = 0; i1 < n_subdivisions; ++i1)
6752 projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions);
6753 compute_node(projected_vertices[1],
6759 compute_node(projected_vertices[2],
6765 compute_node(projected_vertices[3],
6773 patch->data.n_rows() == 0,
6776 patch->data.n_rows()));
6778 cell.vertices[0][0] = projected_vertices[0][0];
6779 cell.vertices[0][1] = projected_vertices[0][1];
6780 cell.vertices[0][2] = patch->data.n_rows() != 0 ?
6781 patch->data(0, i1 * d1 + i2 * d2) :
6784 cell.vertices[1][0] = projected_vertices[1][0];
6785 cell.vertices[1][1] = projected_vertices[1][1];
6786 cell.vertices[1][2] =
6787 patch->data.n_rows() != 0 ?
6788 patch->data(0, (i1 + 1) * d1 + i2 * d2) :
6791 cell.vertices[2][0] = projected_vertices[2][0];
6792 cell.vertices[2][1] = projected_vertices[2][1];
6793 cell.vertices[2][2] =
6794 patch->data.n_rows() != 0 ?
6795 patch->data(0, i1 * d1 + (i2 + 1) * d2) :
6798 cell.vertices[3][0] = projected_vertices[3][0];
6799 cell.vertices[3][1] = projected_vertices[3][1];
6800 cell.vertices[3][2] =
6801 patch->data.n_rows() != 0 ?
6802 patch->data(0, (i1 + 1) * d1 + (i2 + 1) * d2) :
6805 cell.projected_vertices[0] =
6806 svg_project_point(cell.vertices[0],
6811 cell.projected_vertices[1] =
6812 svg_project_point(cell.vertices[1],
6817 cell.projected_vertices[2] =
6818 svg_project_point(cell.vertices[2],
6823 cell.projected_vertices[3] =
6824 svg_project_point(cell.vertices[3],
6830 cell.center = .25 * (cell.vertices[0] + cell.vertices[1] +
6831 cell.vertices[2] + cell.vertices[3]);
6832 cell.projected_center = svg_project_point(cell.center,
6838 cell.depth = cell.center.distance(camera_position);
6848 width =
static_cast<unsigned int>(
6849 .5 + height * (x_dimension_perspective / y_dimension_perspective));
6850 unsigned int additional_width = 0;
6853 additional_width =
static_cast<unsigned int>(
6857 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\"" 6858 << height <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" 6860 <<
" <rect width=\"" << width + additional_width <<
"\" height=\"" 6861 << height <<
"\" style=\"fill:white\"/>" <<
'\n' 6864 unsigned int triangle_counter = 0;
6867 for (
typename std::multiset<SvgCell>::const_iterator cell = cells.begin();
6868 cell != cells.end();
6873 for (
unsigned int triangle_index = 0; triangle_index < 4;
6876 switch (triangle_index)
6879 points3d_triangle[0] = cell->vertices[0],
6880 points3d_triangle[1] = cell->vertices[1],
6881 points3d_triangle[2] = cell->center;
6884 points3d_triangle[0] = cell->vertices[1],
6885 points3d_triangle[1] = cell->vertices[3],
6886 points3d_triangle[2] = cell->center;
6889 points3d_triangle[0] = cell->vertices[3],
6890 points3d_triangle[1] = cell->vertices[2],
6891 points3d_triangle[2] = cell->center;
6894 points3d_triangle[0] = cell->vertices[2],
6895 points3d_triangle[1] = cell->vertices[0],
6896 points3d_triangle[2] = cell->center;
6903 svg_get_gradient_parameters(points3d_triangle);
6906 .667 - ((gradient_param[4] - z_min) / z_dimension) * .667;
6908 .667 - ((gradient_param[5] - z_min) / z_dimension) * .667;
6910 unsigned int start_r = 0;
6911 unsigned int start_g = 0;
6912 unsigned int start_b = 0;
6914 unsigned int stop_r = 0;
6915 unsigned int stop_g = 0;
6916 unsigned int stop_b = 0;
6918 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
6919 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
6921 double start_f = start_h * 6. - start_i;
6922 double start_q = 1. - start_f;
6924 double stop_f = stop_h * 6. - stop_i;
6925 double stop_q = 1. - stop_f;
6927 switch (start_i % 6)
6931 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
6934 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
6939 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
6942 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
6946 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
6951 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
6961 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
6964 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
6969 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
6972 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
6976 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
6981 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
6987 Point<3> gradient_start_point_3d, gradient_stop_point_3d;
6989 gradient_start_point_3d[0] = gradient_param[0];
6990 gradient_start_point_3d[1] = gradient_param[1];
6991 gradient_start_point_3d[2] = gradient_param[4];
6993 gradient_stop_point_3d[0] = gradient_param[2];
6994 gradient_stop_point_3d[1] = gradient_param[3];
6995 gradient_stop_point_3d[2] = gradient_param[5];
6998 svg_project_point(gradient_start_point_3d,
7004 svg_project_point(gradient_stop_point_3d,
7011 out <<
" <linearGradient id=\"" << triangle_counter
7012 <<
"\" gradientUnits=\"userSpaceOnUse\" " 7014 <<
static_cast<unsigned int>(
7016 ((gradient_start_point[0] - x_min_perspective) /
7017 x_dimension_perspective) *
7018 (width - (width / 100.) * 2. * margin_in_percent) +
7019 ((width / 100.) * margin_in_percent))
7022 <<
static_cast<unsigned int>(
7023 .5 + height - (height / 100.) * margin_in_percent -
7024 ((gradient_start_point[1] - y_min_perspective) /
7025 y_dimension_perspective) *
7026 (height - (height / 100.) * 2. * margin_in_percent))
7029 <<
static_cast<unsigned int>(
7031 ((gradient_stop_point[0] - x_min_perspective) /
7032 x_dimension_perspective) *
7033 (width - (width / 100.) * 2. * margin_in_percent) +
7034 ((width / 100.) * margin_in_percent))
7037 <<
static_cast<unsigned int>(
7038 .5 + height - (height / 100.) * margin_in_percent -
7039 ((gradient_stop_point[1] - y_min_perspective) /
7040 y_dimension_perspective) *
7041 (height - (height / 100.) * 2. * margin_in_percent))
7044 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7045 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n' 7046 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7047 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n' 7048 <<
" </linearGradient>" <<
'\n';
7051 double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
7052 double x3 = cell->projected_center[0];
7053 double y3 = cell->projected_center[1];
7055 switch (triangle_index)
7058 x1 = cell->projected_vertices[0][0],
7059 y1 = cell->projected_vertices[0][1],
7060 x2 = cell->projected_vertices[1][0],
7061 y2 = cell->projected_vertices[1][1];
7064 x1 = cell->projected_vertices[1][0],
7065 y1 = cell->projected_vertices[1][1],
7066 x2 = cell->projected_vertices[3][0],
7067 y2 = cell->projected_vertices[3][1];
7070 x1 = cell->projected_vertices[3][0],
7071 y1 = cell->projected_vertices[3][1],
7072 x2 = cell->projected_vertices[2][0],
7073 y2 = cell->projected_vertices[2][1];
7076 x1 = cell->projected_vertices[2][0],
7077 y1 = cell->projected_vertices[2][1],
7078 x2 = cell->projected_vertices[0][0],
7079 y2 = cell->projected_vertices[0][1];
7085 out <<
" <path d=\"M " 7086 <<
static_cast<unsigned int>(
7088 ((x1 - x_min_perspective) / x_dimension_perspective) *
7089 (width - (width / 100.) * 2. * margin_in_percent) +
7090 ((width / 100.) * margin_in_percent))
7092 <<
static_cast<unsigned int>(
7093 .5 + height - (height / 100.) * margin_in_percent -
7094 ((y1 - y_min_perspective) / y_dimension_perspective) *
7095 (height - (height / 100.) * 2. * margin_in_percent))
7097 <<
static_cast<unsigned int>(
7099 ((x2 - x_min_perspective) / x_dimension_perspective) *
7100 (width - (width / 100.) * 2. * margin_in_percent) +
7101 ((width / 100.) * margin_in_percent))
7103 <<
static_cast<unsigned int>(
7104 .5 + height - (height / 100.) * margin_in_percent -
7105 ((y2 - y_min_perspective) / y_dimension_perspective) *
7106 (height - (height / 100.) * 2. * margin_in_percent))
7108 <<
static_cast<unsigned int>(
7110 ((x3 - x_min_perspective) / x_dimension_perspective) *
7111 (width - (width / 100.) * 2. * margin_in_percent) +
7112 ((width / 100.) * margin_in_percent))
7114 <<
static_cast<unsigned int>(
7115 .5 + height - (height / 100.) * margin_in_percent -
7116 ((y3 - y_min_perspective) / y_dimension_perspective) *
7117 (height - (height / 100.) * 2. * margin_in_percent))
7119 <<
static_cast<unsigned int>(
7121 ((x1 - x_min_perspective) / x_dimension_perspective) *
7122 (width - (width / 100.) * 2. * margin_in_percent) +
7123 ((width / 100.) * margin_in_percent))
7125 <<
static_cast<unsigned int>(
7126 .5 + height - (height / 100.) * margin_in_percent -
7127 ((y1 - y_min_perspective) / y_dimension_perspective) *
7128 (height - (height / 100.) * 2. * margin_in_percent))
7129 <<
"\" style=\"stroke:black; fill:url(#" << triangle_counter
7130 <<
"); stroke-width:" << flags.line_thickness <<
"\"/>" <<
'\n';
7140 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
7142 unsigned int element_height =
static_cast<unsigned int>(
7143 ((height / 100.) * (71. - 2. * margin_in_percent)) / 4);
7144 unsigned int element_width =
7145 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7147 additional_width = 0;
7150 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
7152 for (
unsigned int index = 0; index < 4; index++)
7154 double start_h = .667 - ((index + 1) / 4.) * .667;
7155 double stop_h = .667 - (index / 4.) * .667;
7157 unsigned int start_r = 0;
7158 unsigned int start_g = 0;
7159 unsigned int start_b = 0;
7161 unsigned int stop_r = 0;
7162 unsigned int stop_g = 0;
7163 unsigned int stop_b = 0;
7165 unsigned int start_i =
static_cast<unsigned int>(start_h * 6.);
7166 unsigned int stop_i =
static_cast<unsigned int>(stop_h * 6.);
7168 double start_f = start_h * 6. - start_i;
7169 double start_q = 1. - start_f;
7171 double stop_f = stop_h * 6. - stop_i;
7172 double stop_q = 1. - stop_f;
7174 switch (start_i % 6)
7178 start_g =
static_cast<unsigned int>(.5 + 255. * start_f);
7181 start_r =
static_cast<unsigned int>(.5 + 255. * start_q),
7186 start_b =
static_cast<unsigned int>(.5 + 255. * start_f);
7189 start_g =
static_cast<unsigned int>(.5 + 255. * start_q),
7193 start_r =
static_cast<unsigned int>(.5 + 255. * start_f),
7198 start_b =
static_cast<unsigned int>(.5 + 255. * start_q);
7208 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_f);
7211 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_q),
7216 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_f);
7219 stop_g =
static_cast<unsigned int>(.5 + 255. * stop_q),
7223 stop_r =
static_cast<unsigned int>(.5 + 255. * stop_f),
7228 stop_b =
static_cast<unsigned int>(.5 + 255. * stop_q);
7235 out <<
" <linearGradient id=\"colorbar_" << index
7236 <<
"\" gradientUnits=\"userSpaceOnUse\" " 7237 <<
"x1=\"" << width + additional_width <<
"\" " 7239 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7240 (margin_in_percent + 29)) +
7241 (3 - index) * element_height
7243 <<
"x2=\"" << width + additional_width <<
"\" " 7245 << static_cast<unsigned int>(.5 + (height / 100.) *
7246 (margin_in_percent + 29)) +
7247 (4 - index) * element_height
7250 <<
" <stop offset=\"0\" style=\"stop-color:rgb(" << start_r
7251 <<
"," << start_g <<
"," << start_b <<
")\"/>" <<
'\n' 7252 <<
" <stop offset=\"1\" style=\"stop-color:rgb(" << stop_r
7253 <<
"," << stop_g <<
"," << stop_b <<
")\"/>" <<
'\n' 7254 <<
" </linearGradient>" <<
'\n';
7259 <<
" x=\"" << width + additional_width <<
"\" y=\"" 7260 <<
static_cast<unsigned int>(.5 + (height / 100.) *
7261 (margin_in_percent + 29)) +
7262 (3 - index) * element_height
7263 <<
"\" width=\"" << element_width <<
"\" height=\"" 7265 <<
"\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_" 7266 << index <<
")\"/>" <<
'\n';
7269 for (
unsigned int index = 0; index < 5; index++)
7273 << width + additional_width +
7274 static_cast<unsigned int>(1.5 * element_width)
7276 << static_cast<unsigned int>(
7277 .5 + (height / 100.) * (margin_in_percent + 29) +
7278 (4. - index) * element_height + 30.)
7280 <<
" style=\"text-anchor:start; font-size:80; font-family:Helvetica";
7282 if (index == 0 || index == 4)
7283 out <<
"; font-weight:bold";
7286 << (float)(((
int)((z_min + index * (z_dimension / 4.)) *
7295 out <<
"</text>" <<
'\n';
7300 out <<
'\n' <<
"</svg>";
7306 template <
int dim,
int spacedim>
7310 const std::vector<std::string> & data_names,
7311 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
7312 & nonscalar_data_ranges,
7316 const unsigned int size = nonscalar_data_ranges.size();
7318 std::tuple<
unsigned int,
7322 new_nonscalar_data_ranges(size);
7323 for (
unsigned int i = 0; i < size; ++i)
7325 new_nonscalar_data_ranges[i] =
7326 std::tuple<
unsigned int,
7330 std::get<0>(nonscalar_data_ranges[i]),
7331 std::get<1>(nonscalar_data_ranges[i]),
7332 std::get<2>(nonscalar_data_ranges[i]),
7337 patches, data_names, new_nonscalar_data_ranges, flags, out);
7342 template <
int dim,
int spacedim>
7346 const std::vector<std::string> & data_names,
7348 std::tuple<
unsigned int,
7352 &nonscalar_data_ranges,
7361 out << dim <<
' ' << spacedim <<
'\n';
7364 out <<
"[deal.II intermediate format graphics data]" <<
'\n' 7365 <<
"[written by " << DEAL_II_PACKAGE_NAME <<
" " 7366 << DEAL_II_PACKAGE_VERSION <<
"]" <<
'\n' 7370 out << data_names.size() <<
'\n';
7371 for (
unsigned int i = 0; i < data_names.size(); ++i)
7372 out << data_names[i] <<
'\n';
7374 out << patches.size() <<
'\n';
7375 for (
unsigned int i = 0; i < patches.size(); ++i)
7376 out << patches[i] <<
'\n';
7378 out << nonscalar_data_ranges.size() <<
'\n';
7379 for (
unsigned int i = 0; i < nonscalar_data_ranges.size(); ++i)
7380 out << std::get<0>(nonscalar_data_ranges[i]) <<
' ' 7381 << std::get<1>(nonscalar_data_ranges[i]) <<
'\n' 7382 << std::get<2>(nonscalar_data_ranges[i]) <<
'\n';
7391 std::pair<unsigned int, unsigned int>
7396 unsigned int dim, spacedim;
7397 input >> dim >> spacedim;
7399 return std::make_pair(dim, spacedim);
7408 template <
int dim,
int spacedim>
7410 : default_subdivisions(1)
7416 template <
int dim,
int spacedim>
7429 template <
int dim,
int spacedim>
7442 template <
int dim,
int spacedim>
7455 template <
int dim,
int spacedim>
7468 template <
int dim,
int spacedim>
7481 template <
int dim,
int spacedim>
7494 template <
int dim,
int spacedim>
7507 template <
int dim,
int spacedim>
7520 template <
int dim,
int spacedim>
7531 template <
int dim,
int spacedim>
7542 template <
int dim,
int spacedim>
7553 template <
int dim,
int spacedim>
7556 MPI_Comm comm)
const 7558 #ifndef DEAL_II_WITH_MPI 7562 std::ofstream f(filename);
7569 int ierr = MPI_Info_create(&info);
7572 ierr = MPI_File_open(comm,
7573 const_cast<char *>(filename),
7574 MPI_MODE_CREATE | MPI_MODE_WRONLY,
7579 ierr = MPI_File_set_size(fh, 0);
7583 ierr = MPI_Barrier(comm);
7585 ierr = MPI_Info_free(&info);
7588 unsigned int header_size;
7593 std::stringstream ss;
7595 header_size = ss.str().size();
7596 ierr = MPI_File_write(fh,
7597 const_cast<char *>(ss.str().c_str()),
7604 ierr = MPI_Bcast(&header_size, 1, MPI_UNSIGNED, 0, comm);
7607 ierr = MPI_File_seek_shared(fh, header_size, MPI_SEEK_SET);
7610 std::stringstream ss;
7616 ierr = MPI_File_write_ordered(fh,
7617 const_cast<char *>(ss.str().c_str()),
7627 std::stringstream ss;
7629 unsigned int footer_size = ss.str().size();
7630 ierr = MPI_File_write_shared(fh,
7631 const_cast<char *>(ss.str().c_str()),
7637 ierr = MPI_File_close(&fh);
7643 template <
int dim,
int spacedim>
7647 const std::vector<std::string> &piece_names)
const 7657 template <
int dim,
int spacedim>
7660 std::ostream &out)
const 7670 template <
int dim,
int spacedim>
7674 const std::string & h5_filename,
7675 const double cur_time,
7676 MPI_Comm comm)
const 7679 data_filter, h5_filename, h5_filename, cur_time, comm);
7684 template <
int dim,
int spacedim>
7688 const std::string & h5_mesh_filename,
7689 const std::string & h5_solution_filename,
7690 const double cur_time,
7691 MPI_Comm comm)
const 7693 unsigned int local_node_cell_count[2], global_node_cell_count[2];
7695 #ifndef DEAL_II_WITH_HDF5 7699 (void)h5_mesh_filename;
7700 (void)h5_solution_filename;
7706 ExcMessage(
"XDMF only supports 2 or 3 space dimensions."));
7708 local_node_cell_count[0] = data_filter.
n_nodes();
7709 local_node_cell_count[1] = data_filter.
n_cells();
7712 #ifdef DEAL_II_WITH_MPI 7714 int ierr = MPI_Allreduce(local_node_cell_count,
7715 global_node_cell_count,
7723 const int myrank = 0;
7724 global_node_cell_count[0] = local_node_cell_count[0];
7725 global_node_cell_count[1] = local_node_cell_count[1];
7732 h5_solution_filename,
7734 global_node_cell_count[0],
7735 global_node_cell_count[1],
7738 unsigned int n_data_sets = data_filter.
n_data_sets();
7743 for (i = 0; i < n_data_sets; ++i)
7757 template <
int dim,
int spacedim>
7760 const std::vector<XDMFEntry> &entries,
7761 const std::string & filename,
7762 MPI_Comm comm)
const 7764 #ifdef DEAL_II_WITH_MPI 7768 const int myrank = 0;
7774 std::ofstream xdmf_file(filename.c_str());
7775 std::vector<XDMFEntry>::const_iterator it;
7777 xdmf_file <<
"<?xml version=\"1.0\" ?>\n";
7778 xdmf_file <<
"<!DOCTYPE Xdmf SYSTEM \"Xdmf.dtd\" []>\n";
7779 xdmf_file <<
"<Xdmf Version=\"2.0\">\n";
7780 xdmf_file <<
" <Domain>\n";
7782 <<
" <Grid Name=\"CellTime\" GridType=\"Collection\" CollectionType=\"Temporal\">\n";
7785 for (it = entries.begin(); it != entries.end(); ++it)
7786 xdmf_file << it->get_xdmf_content(3);
7788 xdmf_file <<
" </Grid>\n";
7789 xdmf_file <<
" </Domain>\n";
7790 xdmf_file <<
"</Xdmf>\n";
7802 template <
int dim,
int spacedim>
7815 template <
int dim,
int spacedim>
7819 const std::vector<std::string> & data_names,
7820 const std::vector<std::tuple<unsigned int, unsigned int, std::string>>
7821 & nonscalar_data_ranges,
7824 const unsigned int size = nonscalar_data_ranges.size();
7826 std::tuple<
unsigned int,
7830 new_nonscalar_data_ranges(size);
7831 for (
unsigned int i = 0; i < size; ++i)
7833 new_nonscalar_data_ranges[i] =
7834 std::tuple<
unsigned int,
7838 std::get<0>(nonscalar_data_ranges[i]),
7839 std::get<1>(nonscalar_data_ranges[i]),
7840 std::get<2>(nonscalar_data_ranges[i]),
7846 new_nonscalar_data_ranges,
7852 template <
int dim,
int spacedim>
7856 const std::vector<std::string> & data_names,
7858 std::tuple<
unsigned int,
7862 & nonscalar_data_ranges,
7865 const unsigned int n_data_sets = data_names.size();
7866 unsigned int n_node, n_cell;
7870 #ifndef DEAL_II_WITH_MPI 7879 if (patches.size() == 0)
7883 compute_sizes<dim, spacedim>(patches, n_node, n_cell);
7886 void (*fun_ptr)(
const std::vector<Patch<dim, spacedim>> &,
7888 &DataOutBase::template write_gmv_reorder_data_vectors<dim, spacedim>;
7892 write_nodes(patches, filtered_data);
7893 write_cells(patches, filtered_data);
7896 reorder_task.join();
7900 unsigned int i, n_th_vector, data_set, pt_data_vector_dim;
7901 std::string vector_name;
7902 for (n_th_vector = 0, data_set = 0; data_set < n_data_sets;)
7905 while (n_th_vector < nonscalar_data_ranges.size() &&
7906 std::get<0>(nonscalar_data_ranges[n_th_vector]) < data_set)
7910 if (n_th_vector < nonscalar_data_ranges.size() &&
7911 std::get<0>(nonscalar_data_ranges[n_th_vector]) == data_set)
7914 pt_data_vector_dim = std::get<1>(nonscalar_data_ranges[n_th_vector]) -
7915 std::get<0>(nonscalar_data_ranges[n_th_vector]) +
7920 std::get<1>(nonscalar_data_ranges[n_th_vector]) >=
7921 std::get<0>(nonscalar_data_ranges[n_th_vector]),
7922 ExcLowerRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
7923 std::get<0>(nonscalar_data_ranges[n_th_vector])));
7925 std::get<1>(nonscalar_data_ranges[n_th_vector]) < n_data_sets,
7926 ExcIndexRange(std::get<1>(nonscalar_data_ranges[n_th_vector]),
7932 if (std::get<2>(nonscalar_data_ranges[n_th_vector]) !=
"")
7934 vector_name = std::get<2>(nonscalar_data_ranges[n_th_vector]);
7939 for (i = std::get<0>(nonscalar_data_ranges[n_th_vector]);
7940 i < std::get<1>(nonscalar_data_ranges[n_th_vector]);
7942 vector_name += data_names[i] +
"__";
7944 data_names[std::get<1>(nonscalar_data_ranges[n_th_vector])];
7950 pt_data_vector_dim = 1;
7951 vector_name = data_names[data_set];
7961 data_set += pt_data_vector_dim;
7967 template <
int dim,
int spacedim>
7971 const std::string & filename,
7972 MPI_Comm comm)
const 7979 template <
int dim,
int spacedim>
7983 const bool write_mesh_file,
7984 const std::string & mesh_filename,
7985 const std::string & solution_filename,
7986 MPI_Comm comm)
const 7998 template <
int dim,
int spacedim>
8003 const std::string & filename,
8011 template <
int dim,
int spacedim>
8016 const bool write_mesh_file,
8017 const std::string & mesh_filename,
8018 const std::string & solution_filename,
8024 "DataOutBase was asked to write HDF5 output for a space dimension of 1. " 8025 "HDF5 only supports datasets that live in 2 or 3 dimensions."));
8029 #ifndef DEAL_II_WITH_HDF5 8033 (void)write_mesh_file;
8034 (void)mesh_filename;
8035 (void)solution_filename;
8039 # ifndef DEAL_II_WITH_MPI 8050 hid_t h5_mesh_file_id = -1, h5_solution_file_id, file_plist_id, plist_id;
8051 hid_t node_dataspace, node_dataset, node_file_dataspace,
8052 node_memory_dataspace;
8053 hid_t cell_dataspace, cell_dataset, cell_file_dataspace,
8054 cell_memory_dataspace;
8055 hid_t pt_data_dataspace, pt_data_dataset, pt_data_file_dataspace,
8056 pt_data_memory_dataspace;
8058 unsigned int local_node_cell_count[2], global_node_cell_count[2],
8059 global_node_cell_offsets[2];
8060 hsize_t count[2], offset[2], node_ds_dim[2], cell_ds_dim[2];
8061 std::vector<double> node_data_vec;
8062 std::vector<unsigned int> cell_data_vec;
8065 # ifndef H5_HAVE_PARALLEL 8066 # ifdef DEAL_II_WITH_MPI 8071 "Serial HDF5 output on multiple processes is not yet supported."));
8075 local_node_cell_count[0] = data_filter.
n_nodes();
8076 local_node_cell_count[1] = data_filter.
n_cells();
8079 file_plist_id = H5Pcreate(H5P_FILE_ACCESS);
8082 # ifdef DEAL_II_WITH_MPI 8083 # ifdef H5_HAVE_PARALLEL 8085 status = H5Pset_fapl_mpio(file_plist_id, comm, MPI_INFO_NULL);
8092 # ifdef DEAL_II_WITH_MPI 8093 ierr = MPI_Allreduce(local_node_cell_count,
8094 global_node_cell_count,
8100 ierr = MPI_Scan(local_node_cell_count,
8101 global_node_cell_offsets,
8107 global_node_cell_offsets[0] -= local_node_cell_count[0];
8108 global_node_cell_offsets[1] -= local_node_cell_count[1];
8110 global_node_cell_count[0] = local_node_cell_count[0];
8111 global_node_cell_count[1] = local_node_cell_count[1];
8112 global_node_cell_offsets[0] = global_node_cell_offsets[1] = 0;
8116 plist_id = H5Pcreate(H5P_DATASET_XFER);
8118 # ifdef DEAL_II_WITH_MPI 8119 # ifdef H5_HAVE_PARALLEL 8120 status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
8125 if (write_mesh_file)
8128 h5_mesh_file_id = H5Fcreate(mesh_filename.c_str(),
8136 node_ds_dim[0] = global_node_cell_count[0];
8137 node_ds_dim[1] = (spacedim < 2) ? 2 : spacedim;
8138 node_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8141 cell_ds_dim[0] = global_node_cell_count[1];
8143 cell_dataspace = H5Screate_simple(2, cell_ds_dim,
nullptr);
8147 # if H5Gcreate_vers == 1 8148 node_dataset = H5Dcreate(h5_mesh_file_id,
8154 node_dataset = H5Dcreate(h5_mesh_file_id,
8163 # if H5Gcreate_vers == 1 8164 cell_dataset = H5Dcreate(
8165 h5_mesh_file_id,
"cells", H5T_NATIVE_UINT, cell_dataspace, H5P_DEFAULT);
8167 cell_dataset = H5Dcreate(h5_mesh_file_id,
8178 status = H5Sclose(node_dataspace);
8180 status = H5Sclose(cell_dataspace);
8185 count[0] = local_node_cell_count[0];
8186 count[1] = (spacedim < 2) ? 2 : spacedim;
8188 offset[0] = global_node_cell_offsets[0];
8191 node_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8195 node_file_dataspace = H5Dget_space(node_dataset);
8197 status = H5Sselect_hyperslab(
8198 node_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8202 count[0] = local_node_cell_count[1];
8204 offset[0] = global_node_cell_offsets[1];
8206 cell_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8209 cell_file_dataspace = H5Dget_space(cell_dataset);
8211 status = H5Sselect_hyperslab(
8212 cell_file_dataspace, H5S_SELECT_SET, offset,
nullptr, count,
nullptr);
8217 status = H5Dwrite(node_dataset,
8219 node_memory_dataspace,
8220 node_file_dataspace,
8222 node_data_vec.data());
8224 node_data_vec.clear();
8227 data_filter.
fill_cell_data(global_node_cell_offsets[0], cell_data_vec);
8228 status = H5Dwrite(cell_dataset,
8230 cell_memory_dataspace,
8231 cell_file_dataspace,
8233 cell_data_vec.data());
8235 cell_data_vec.clear();
8238 status = H5Sclose(node_file_dataspace);
8240 status = H5Sclose(cell_file_dataspace);
8244 status = H5Sclose(node_memory_dataspace);
8246 status = H5Sclose(cell_memory_dataspace);
8250 status = H5Dclose(node_dataset);
8252 status = H5Dclose(cell_dataset);
8256 if (mesh_filename != solution_filename)
8258 status = H5Fclose(h5_mesh_file_id);
8264 if (mesh_filename == solution_filename && write_mesh_file)
8266 h5_solution_file_id = h5_mesh_file_id;
8271 h5_solution_file_id = H5Fcreate(solution_filename.c_str(),
8281 std::string vector_name;
8290 node_ds_dim[0] = global_node_cell_count[0];
8291 node_ds_dim[1] = pt_data_vector_dim;
8292 pt_data_dataspace = H5Screate_simple(2, node_ds_dim,
nullptr);
8295 # if H5Gcreate_vers == 1 8296 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8297 vector_name.c_str(),
8302 pt_data_dataset = H5Dcreate(h5_solution_file_id,
8303 vector_name.c_str(),
8313 count[0] = local_node_cell_count[0];
8314 count[1] = pt_data_vector_dim;
8315 offset[0] = global_node_cell_offsets[0];
8317 pt_data_memory_dataspace = H5Screate_simple(2, count,
nullptr);
8321 pt_data_file_dataspace = H5Dget_space(pt_data_dataset);
8323 status = H5Sselect_hyperslab(pt_data_file_dataspace,
8332 status = H5Dwrite(pt_data_dataset,
8334 pt_data_memory_dataspace,
8335 pt_data_file_dataspace,
8341 status = H5Sclose(pt_data_dataspace);
8343 status = H5Sclose(pt_data_memory_dataspace);
8345 status = H5Sclose(pt_data_file_dataspace);
8348 status = H5Dclose(pt_data_dataset);
8353 status = H5Pclose(file_plist_id);
8357 status = H5Pclose(plist_id);
8361 status = H5Fclose(h5_solution_file_id);
8368 template <
int dim,
int spacedim>
8378 switch (output_format)
8438 template <
int dim,
int spacedim>
8447 template <
int dim,
int spacedim>
8448 template <
typename FlagType>
8454 if (
typeid(flags) ==
typeid(
dx_flags))
8456 else if (
typeid(flags) ==
typeid(
ucd_flags))
8460 else if (
typeid(flags) ==
typeid(
eps_flags))
8462 else if (
typeid(flags) ==
typeid(
gmv_flags))
8467 else if (
typeid(flags) ==
typeid(
vtk_flags))
8469 else if (
typeid(flags) ==
typeid(
svg_flags))
8483 template <
int dim,
int spacedim>
8496 template <
int dim,
int spacedim>
8503 "A name for the output format to be used");
8507 "Number of subdivisions of each mesh cell");
8549 template <
int dim,
int spacedim>
8553 const std::string &output_name = prm.
get(
"Output format");
8596 template <
int dim,
int spacedim>
8615 template <
int dim,
int spacedim>
8617 std::tuple<
unsigned int,
8624 std::tuple<
unsigned int,
8632 template <
int dim,
int spacedim>
8633 std::vector<std::tuple<unsigned int, unsigned int, std::string>>
8638 const unsigned int size = nonscalar_data_ranges.size();
8639 std::vector<std::tuple<unsigned int, unsigned int, std::string>>
8640 vector_data_ranges(size);
8641 for (
unsigned int i = 0; i < size; ++i)
8643 vector_data_ranges[i] =
8644 std::tuple<unsigned int, unsigned int, std::string>(
8645 std::get<0>(nonscalar_data_ranges[i]),
8646 std::get<1>(nonscalar_data_ranges[i]),
8647 std::get<2>(nonscalar_data_ranges[i]));
8649 return vector_data_ranges;
8654 template <
int dim,
int spacedim>
8662 std::set<std::string> all_names;
8665 std::tuple<
unsigned int,
8671 const unsigned int n_data_sets = data_names.size();
8672 std::vector<bool> data_set_written(n_data_sets,
false);
8674 for (
unsigned int n_th_vector = 0; n_th_vector < ranges.size();
8677 const std::string &name = std::get<2>(ranges[n_th_vector]);
8680 Assert(all_names.find(name) == all_names.end(),
8682 "Error: names of fields in DataOut need to be unique, " 8684 name +
"' is used more than once."));
8685 all_names.insert(name);
8686 for (
unsigned int i = std::get<0>(ranges[n_th_vector]);
8687 i <= std::get<1>(ranges[n_th_vector]);
8689 data_set_written[i] =
true;
8693 for (
unsigned int data_set = 0; data_set < n_data_sets; ++data_set)
8694 if (data_set_written[data_set] ==
false)
8696 const std::string &name = data_names[data_set];
8697 Assert(all_names.find(name) == all_names.end(),
8699 "Error: names of fields in DataOut need to be unique, " 8701 name +
"' is used more than once."));
8702 all_names.insert(name);
8712 template <
int dim,
int spacedim>
8720 std::vector<typename ::DataOutBase::Patch<dim, spacedim>> tmp;
8724 std::vector<std::string> tmp;
8725 tmp.swap(dataset_names);
8729 std::tuple<
unsigned int,
8734 tmp.swap(nonscalar_data_ranges);
8741 std::pair<unsigned int, unsigned int> dimension_info =
8744 (dimension_info.second == spacedim),
8745 ExcIncompatibleDimensions(
8746 dimension_info.first, dim, dimension_info.second, spacedim));
8755 getline(in, header);
8757 std::ostringstream s;
8758 s <<
"[deal.II intermediate format graphics data]";
8760 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
8764 getline(in, header);
8766 std::ostringstream s;
8767 s <<
"[written by " << DEAL_II_PACKAGE_NAME <<
" " 8768 << DEAL_II_PACKAGE_VERSION <<
"]";
8770 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
8774 getline(in, header);
8776 std::ostringstream s;
8780 Assert(header == s.str(),
8782 "Invalid or incompatible file format. Intermediate format " 8783 "files can only be read by the same deal.II version as they " 8784 "are written by."));
8788 unsigned int n_datasets;
8790 dataset_names.resize(n_datasets);
8791 for (
unsigned int i = 0; i < n_datasets; ++i)
8792 in >> dataset_names[i];
8794 unsigned int n_patches;
8796 patches.resize(n_patches);
8797 for (
unsigned int i = 0; i < n_patches; ++i)
8800 unsigned int n_nonscalar_data_ranges;
8801 in >> n_nonscalar_data_ranges;
8802 nonscalar_data_ranges.resize(n_nonscalar_data_ranges);
8803 for (
unsigned int i = 0; i < n_nonscalar_data_ranges; ++i)
8805 in >> std::get<0>(nonscalar_data_ranges[i]) >>
8806 std::get<1>(nonscalar_data_ranges[i]);
8815 std::get<2>(nonscalar_data_ranges[i]) = name;
8823 template <
int dim,
int spacedim>
8827 using Patch = typename ::DataOutBase::Patch<dim, spacedim>;
8830 const std::vector<Patch> &source_patches = source.
get_patches();
8840 ExcMessage(
"Both sources need to declare the same components " 8846 ExcMessage(
"Both sources need to declare the same components " 8850 ExcMessage(
"Both sources need to declare the same components " 8854 ExcMessage(
"Both sources need to declare the same components " 8859 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
8861 Assert(patches[0].data.n_rows() == source_patches[0].data.n_rows(),
8863 Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(),
8868 const unsigned int old_n_patches = patches.size();
8869 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
8872 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
8873 patches[i].patch_index += old_n_patches;
8876 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
8877 for (
unsigned int n = 0; n < GeometryInfo<dim>::faces_per_cell; ++n)
8878 if (patches[i].neighbors[n] !=
8880 patches[i].neighbors[n] += old_n_patches;
8885 template <
int dim,
int spacedim>
8886 const std::vector<typename ::DataOutBase::Patch<dim, spacedim>> &
8894 template <
int dim,
int spacedim>
8895 std::vector<std::string>
8898 return dataset_names;
8903 template <
int dim,
int spacedim>
8905 std::tuple<
unsigned int,
8911 return nonscalar_data_ranges;
8920 , h5_sol_filename(
"")
8921 , h5_mesh_filename(
"")
8923 , num_nodes(
numbers::invalid_unsigned_int)
8924 , num_cells(
numbers::invalid_unsigned_int)
8925 , dimension(
numbers::invalid_unsigned_int)
8926 , space_dimension(
numbers::invalid_unsigned_int)
8933 const unsigned int nodes,
8934 const unsigned int cells,
8935 const unsigned int dim)
8936 :
XDMFEntry(filename, filename, time, nodes, cells, dim, dim)
8942 const std::string &solution_filename,
8944 const unsigned int nodes,
8945 const unsigned int cells,
8946 const unsigned int dim)
8947 :
XDMFEntry(mesh_filename, solution_filename, time, nodes, cells, dim, dim)
8953 const std::string &solution_filename,
8955 const unsigned int nodes,
8956 const unsigned int cells,
8957 const unsigned int dim,
8958 const unsigned int spacedim)
8986 indent(
const unsigned int indent_level)
8988 std::string res =
"";
8989 for (
unsigned int i = 0; i < indent_level; ++i)
9003 std::stringstream ss;
9004 ss << indent(indent_level + 0)
9005 <<
"<Grid Name=\"mesh\" GridType=\"Uniform\">\n";
9006 ss << indent(indent_level + 1) <<
"<Time Value=\"" <<
entry_time <<
"\"/>\n";
9007 ss << indent(indent_level + 1) <<
"<Geometry GeometryType=\"" 9009 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes 9011 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9013 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9014 ss << indent(indent_level + 1) <<
"</Geometry>\n";
9019 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 9021 <<
"\" NumberOfElements=\"" <<
num_cells 9022 <<
"\" NodesPerElement=\"1\">\n";
9024 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 9026 <<
"\" NumberOfElements=\"" << num_cells
9027 <<
"\" NodesPerElement=\"2\">\n";
9029 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 9031 <<
"\" NumberOfElements=\"" << num_cells <<
"\">\n";
9033 ss << indent(indent_level + 1) <<
"<Topology TopologyType=\"" 9035 <<
"\" NumberOfElements=\"" << num_cells <<
"\">\n";
9037 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" << num_cells
9039 <<
"\" NumberType=\"UInt\" Format=\"HDF\">\n";
9040 ss << indent(indent_level + 3) << h5_mesh_filename <<
":/cells\n";
9041 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9042 ss << indent(indent_level + 1) <<
"</Topology>\n";
9048 ss << indent(indent_level + 1)
9049 <<
"<Topology TopologyType=\"Polyvertex\" NumberOfElements=\"" 9051 ss << indent(indent_level + 1) <<
"</Topology>\n";
9054 for (std::map<std::string, unsigned int>::const_iterator it =
9059 ss << indent(indent_level + 1) <<
"<Attribute Name=\"" << it->first
9060 <<
"\" AttributeType=\"" << (it->second > 1 ?
"Vector" :
"Scalar")
9061 <<
"\" Center=\"Node\">\n";
9063 ss << indent(indent_level + 2) <<
"<DataItem Dimensions=\"" <<
num_nodes 9064 <<
" " << (it->second > 1 ? 3 : 1)
9065 <<
"\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n";
9066 ss << indent(indent_level + 3) <<
h5_sol_filename <<
":/" << it->first
9068 ss << indent(indent_level + 2) <<
"</DataItem>\n";
9069 ss << indent(indent_level + 1) <<
"</Attribute>\n";
9072 ss << indent(indent_level + 0) <<
"</Grid>\n";
9081 template <
int dim,
int spacedim>
9083 operator<<(std::ostream &out, const Patch<dim, spacedim> &patch)
9086 out <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]" 9090 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
9094 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
9095 out << patch.neighbors[i] <<
' ';
9098 out << patch.patch_index <<
' ' << patch.n_subdivisions <<
'\n';
9100 out << patch.points_are_available <<
'\n';
9102 out << patch.data.n_rows() <<
' ' << patch.data.n_cols() <<
'\n';
9103 for (
unsigned int i = 0; i < patch.data.n_rows(); ++i)
9104 for (
unsigned int j = 0; j < patch.data.n_cols(); ++j)
9105 out << patch.data[i][j] <<
' ';
9113 template <
int dim,
int spacedim>
9125 getline(in, header);
9126 while ((header.size() != 0) && (header[header.size() - 1] ==
' '))
9127 header.erase(header.size() - 1);
9129 while ((header ==
"") && in);
9131 std::ostringstream s;
9132 s <<
"[deal.II intermediate Patch<" << dim <<
',' << spacedim <<
">]";
9134 Assert(header == s.str(), ExcUnexpectedInput(s.str(), header));
9139 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
9142 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
9149 unsigned int n_rows, n_cols;
9150 in >> n_rows >> n_cols;
9152 for (
unsigned int i = 0; i < patch.
data.n_rows(); ++i)
9153 for (
unsigned int j = 0; j < patch.
data.n_cols(); ++j)
9154 in >> patch.
data[i][j];
9165 #include "data_out_base.inst" 9167 DEAL_II_NAMESPACE_CLOSE
void fill_node_data(std::vector< double > &node_data) const
unsigned int get_data_set_dim(const unsigned int set_num) const
static void declare_parameters(ParameterHandler &prm)
RgbValues(*)(const double value, const double min_value, const double max_value) ColorFunction
static const unsigned int invalid_unsigned_int
std::size_t memory_consumption() const
unsigned int n_cells() const
unsigned int space_dimension
std::string get_data_set_name(const unsigned int set_num) const
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_eps(std::ostream &out) const
void set_flags(const FlagType &flags)
virtual std::vector< std::string > get_dataset_names() const =0
void write_filtered_data(DataOutBase::DataOutFilter &filtered_data) const
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()
void write_visit_record(std::ostream &out, const std::vector< std::string > &piece_names)
Task< RT > new_task(const std::function< RT()> &function)
void write(std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
void write_vtu_in_parallel(const char *filename, MPI_Comm comm) const
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 parse_parameters(const ParameterHandler &prm)
void swap(Patch< dim, spacedim > &other_patch)
void merge(const DataOutReader< dim, spacedim > &other)
void write_vtu_header(std::ostream &out, const VtkFlags &flags)
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
void write_vtk(std::ostream &out) const
#define AssertThrow(cond, exc)
static::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
unsigned int default_subdivisions
std::vector< unsigned int > data_set_dims
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
std::string get(const std::string &entry_string) const
void fill_cell_data(const unsigned int local_node_offset, std::vector< unsigned int > &cell_data) const
bool filter_duplicate_vertices
std::vector< std::vector< double > > data_sets
static void declare_parameters(ParameterHandler &prm)
std::map< std::string, unsigned int > attribute_dims
std::size_t memory_consumption() 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_hdf5_parallel(const std::vector< Patch< dim, spacedim >> &patches, const DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm)
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
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()
DataOutBase::PovrayFlags povray_flags
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)
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)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges() const
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)
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
std::vector< std::string > data_set_names
void add_attribute(const std::string &attr_name, const unsigned int dimension)
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
size_type size(const unsigned int i) const
std::size_t memory_consumption() const
void write_svg(std::ostream &out) const
#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 parse_parameters(const ParameterHandler &prm)
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)
unsigned int n_data_sets() const
void write_cell(const unsigned int index, const unsigned int start, const unsigned int d1, const unsigned int d2, const unsigned int d3)
DataOutBase::Deal_II_IntermediateFlags deal_II_intermediate_flags
void read(std::istream &in)
const double * get_data_set(const unsigned int set_num) const
std::size_t memory_consumption() const
bool points_are_available
OutputFormat parse_output_format(const std::string &format_name)
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
void write_pvtu_record(std::ostream &out, const std::vector< std::string > &piece_names) const
void write_hdf5_parallel(const DataOutBase::DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm) const
static RgbValues grey_scale_color_function(const double value, const double min_value, const double max_value)
virtual const std::vector< DataOutBase::Patch< dim, spacedim > > & get_patches() const =0
DataOutFilterFlags(const bool filter_duplicate_vertices=false, const bool xdmf_hdf5_output=false)
unsigned int n_subdivisions
DataOutBase::TecplotFlags tecplot_flags
void parse_parameters(const ParameterHandler &prm)
void write_ucd(std::ostream &out) const
std::ostream & operator<<(std::ostream &out, const Patch< dim, spacedim > &patch)
DataOutBase::SvgFlags svg_flags
std::string h5_sol_filename
static TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
void parse_parameters(const ParameterHandler &prm)
std::string default_suffix(const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
static::ExceptionBase & ExcLowerRange(int arg1, int arg2)
std::string h5_mesh_filename
unsigned int n_mpi_processes(const MPI_Comm &mpi_communicator)
bool get_bool(const std::string &entry_name) const
void write_xdmf_file(const std::vector< XDMFEntry > &entries, const std::string &filename, MPI_Comm comm) const
static::ExceptionBase & ExcInvalidDatasetSize(int arg1, int arg2)
static void declare_parameters(ParameterHandler &prm)
unsigned int n_nodes() const
static void declare_parameters(ParameterHandler &prm)
DataComponentInterpretation
void swap(Vector< Number > &u, Vector< Number > &v)
XDMFEntry create_xdmf_entry(const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, MPI_Comm comm) const
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)
static void declare_parameters(ParameterHandler &prm)
static const unsigned int no_neighbor
DataOutBase::GmvFlags gmv_flags
DataOutBase::VtkFlags vtk_flags
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)
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const
void write_tecplot(std::ostream &out) 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)
void write_gnuplot(std::ostream &out) const
DataOutBase::GnuplotFlags gnuplot_flags
void set_default_format(const DataOutBase::OutputFormat default_format)
bool operator==(const Patch &patch) const
void write_vtu(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)
void write_tecplot_binary(std::ostream &out) const
unsigned int color_vector
double get_double(const std::string &entry_name) const
DataOutBase::OutputFormat default_fmt
void write_dx(std::ostream &out) const
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
unsigned int this_mpi_process(const MPI_Comm &mpi_communicator)
static::ExceptionBase & ExcNotImplemented()
static void declare_parameters(ParameterHandler &prm)
DataOutBase::EpsFlags eps_flags
void write_povray(std::ostream &out) const
std::map< unsigned int, unsigned int > filtered_points
bool points_are_available
bool write_higher_order_cells
std::string get_xdmf_content(const unsigned int indent_level) 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)
unsigned int neighbors[dim > 0?GeometryInfo< dim >::faces_per_cell:1]
void write_deal_II_intermediate(std::ostream &out) const
std::string get_output_format_names()
void validate_dataset_names() const
DataOutBase::UcdFlags ucd_flags
void write_gmv(std::ostream &out) const
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)
long int get_integer(const std::string &entry_string) const
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)
DataOutBase::DXFlags dx_flags
static::ExceptionBase & ExcInternalError()
static::ExceptionBase & ExcTecplotAPIError()