16 #include <deal.II/base/exceptions.h> 17 #include <deal.II/base/geometry_info.h> 18 #include <deal.II/base/parameter_handler.h> 19 #include <deal.II/base/point.h> 20 #include <deal.II/base/qprojector.h> 21 #include <deal.II/base/quadrature.h> 23 #include <deal.II/fe/mapping.h> 25 #include <deal.II/grid/grid_out.h> 26 #include <deal.II/grid/tria.h> 27 #include <deal.II/grid/tria_accessor.h> 28 #include <deal.II/grid/tria_iterator.h> 30 #include <deal.II/numerics/data_out.h> 42 DEAL_II_NAMESPACE_OPEN
48 const bool write_faces,
49 const bool write_diameter,
50 const bool write_measure,
51 const bool write_all_faces)
52 : write_cells(write_cells)
53 , write_faces(write_faces)
54 , write_diameter(write_diameter)
55 , write_measure(write_measure)
56 , write_all_faces(write_all_faces)
65 "Write the mesh connectivity as DX grid cells");
69 "Write faces of cells. These may be boundary faces " 70 "or all faces between mesh cells, according to " 71 "\"Write all faces\"");
75 "If cells are written, additionally write their" 76 " diameter as data for visualization");
80 "Write the volume of each cell as data");
84 "Write all faces, not only boundary");
99 : write_faces(write_faces)
100 , write_lines(write_lines)
122 : write_preamble(write_preamble)
123 , write_faces(write_faces)
124 , write_lines(write_lines)
149 const unsigned int n_extra_curved_line_points,
150 const bool curved_inner_cells,
151 const bool write_additional_boundary_lines)
152 : write_cell_numbers(write_cell_numbers)
153 , n_extra_curved_line_points(n_extra_curved_line_points)
154 , n_boundary_face_points(this->n_extra_curved_line_points)
155 , curved_inner_cells(curved_inner_cells)
156 , write_additional_boundary_lines(write_additional_boundary_lines)
201 const unsigned int size,
202 const double line_width,
203 const bool color_lines_on_user_flag,
205 const bool color_lines_level)
206 : size_type(size_type)
208 , line_width(line_width)
209 , color_lines_on_user_flag(color_lines_on_user_flag)
210 , n_boundary_face_points(n_boundary_face_points)
211 , color_lines_level(color_lines_level)
221 "Depending on this parameter, either the" 223 "of the eps is scaled to \"Size\"");
227 "Size of the output in points");
231 "Width of the lines drawn in points");
235 "Draw lines with user flag set in different color");
239 "Number of points on boundary edges. " 240 "Increase this beyond 2 to see curved boundaries.");
244 "Draw different colors according to grid level.");
251 if (param.
get(
"Size by") == std::string(
"width"))
253 else if (param.
get(
"Size by") == std::string(
"height"))
265 const unsigned int size,
272 color_lines_on_user_flag,
273 n_boundary_face_points)
291 const unsigned int size,
292 const double line_width,
293 const bool color_lines_on_user_flag,
294 const unsigned int n_boundary_face_points,
295 const bool write_cell_numbers,
296 const bool write_cell_number_level,
297 const bool write_vertex_numbers,
298 const bool color_lines_level)
302 color_lines_on_user_flag,
303 n_boundary_face_points,
305 , write_cell_numbers(write_cell_numbers)
306 , write_cell_number_level(write_cell_number_level)
307 , write_vertex_numbers(write_vertex_numbers)
317 "(2D only) Write cell numbers" 318 " into the centers of cells");
322 "(2D only) if \"Cell number\" is true, write" 323 "numbers in the form level.number");
327 "Write numbers for each vertex");
335 write_cell_numbers = param.
get_bool(
"Cell number");
336 write_cell_number_level = param.
get_bool(
"Level number");
337 write_vertex_numbers = param.
get_bool(
"Vertex number");
343 const unsigned int size,
344 const double line_width,
345 const bool color_lines_on_user_flag,
346 const unsigned int n_boundary_face_points,
347 const double azimut_angle,
348 const double turn_angle)
352 color_lines_on_user_flag,
353 n_boundary_face_points)
354 , azimut_angle(azimut_angle)
355 , turn_angle(turn_angle)
365 "Azimuth of the viw point, that is, the angle " 366 "in the plane from the x-axis.");
370 "Elevation of the view point above the xy-plane.");
378 azimut_angle = 90 - param.
get_double(
"Elevation");
385 : draw_boundary(true)
386 , color_by(material_id)
388 , n_boundary_face_points(0)
394 , boundary_thickness(3)
428 const unsigned int boundary_line_thickness,
431 const int azimuth_angle,
432 const int polar_angle,
434 const bool convert_level_number_to_height,
435 const bool label_level_number,
436 const bool label_cell_index,
437 const bool label_material_id,
438 const bool label_subdomain_id,
439 const bool draw_colorbar,
440 const bool draw_legend)
443 , line_thickness(line_thickness)
444 , boundary_line_thickness(boundary_line_thickness)
446 , background(background)
447 , azimuth_angle(azimuth_angle)
448 , polar_angle(polar_angle)
450 , convert_level_number_to_height(convert_level_number_to_height)
451 , level_height_factor(0.3f)
452 , cell_font_scaling(1.f)
453 , label_level_number(label_level_number)
454 , label_cell_index(label_cell_index)
455 , label_material_id(label_material_id)
456 , label_subdomain_id(label_subdomain_id)
457 , label_level_subdomain_id(false)
458 , draw_colorbar(draw_colorbar)
459 , draw_legend(draw_legend)
463 : draw_bounding_box(false)
482 : default_format(none)
576 switch (output_format)
619 if (format_name ==
"none" || format_name ==
"false")
622 if (format_name ==
"dx")
625 if (format_name ==
"ucd")
628 if (format_name ==
"gnuplot")
631 if (format_name ==
"eps")
634 if (format_name ==
"xfig")
637 if (format_name ==
"msh")
640 if (format_name ==
"svg")
643 if (format_name ==
"mathgl")
646 if (format_name ==
"vtk")
649 if (format_name ==
"vtu")
662 return "none|dx|gnuplot|eps|ucd|xfig|msh|svg|mathgl|vtk|vtu";
795 template <
int dim,
int spacedim>
798 std::ostream & out)
const 804 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
814 std::vector<unsigned int> renumber(vertices.size());
817 unsigned int new_number = 0;
818 for (
unsigned int i = 0; i < vertices.size(); ++i)
820 renumber[i] = new_number++;
829 out <<
"object \"vertices\" class array type float rank 1 shape " << dim
830 <<
" items " << n_vertices <<
" data follows" <<
'\n';
832 for (
unsigned int i = 0; i < vertices.size(); ++i)
834 out <<
'\t' << vertices[i] <<
'\n';
841 const unsigned int n_faces =
849 out <<
"object \"cells\" class array type int rank 1 shape " 850 << n_vertices_per_cell <<
" items " << n_cells <<
" data follows" 855 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
862 out <<
"attribute \"element type\" string \"";
870 <<
"attribute \"ref\" string \"positions\"" <<
'\n' 875 out <<
"object \"material\" class array type int rank 0 items " << n_cells
876 <<
" data follows" <<
'\n';
878 out <<
' ' << (
unsigned int)cell->material_id();
879 out <<
'\n' <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
881 out <<
"object \"level\" class array type int rank 0 items " << n_cells
882 <<
" data follows" <<
'\n';
884 out <<
' ' << cell->level();
885 out <<
'\n' <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
889 out <<
"object \"measure\" class array type float rank 0 items " 890 << n_cells <<
" data follows" <<
'\n';
892 out <<
'\t' << cell->measure();
894 <<
"attribute \"dep\" string \"connections\"" <<
'\n' 900 out <<
"object \"diameter\" class array type float rank 0 items " 901 << n_cells <<
" data follows" <<
'\n';
903 out <<
'\t' << cell->diameter();
905 <<
"attribute \"dep\" string \"connections\"" <<
'\n' 912 out <<
"object \"faces\" class array type int rank 1 shape " 913 << n_vertices_per_face <<
" items " << n_faces <<
" data follows" 918 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
923 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_face;
926 << renumber[face->vertex_index(
931 out <<
"attribute \"element type\" string \"";
937 <<
"attribute \"ref\" string \"positions\"" <<
'\n' 943 out <<
"object \"boundary\" class array type int rank 0 items " << n_faces
944 <<
" data follows" <<
'\n';
949 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
950 out <<
' ' << (
int)(
signed char)cell->face(f)->boundary_id();
953 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
957 out <<
"object \"face measure\" class array type float rank 0 items " 958 << n_faces <<
" data follows" <<
'\n';
961 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell;
963 out <<
' ' << cell->face(f)->measure();
966 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
971 out <<
"object \"face diameter\" class array type float rank 0 items " 972 << n_faces <<
" data follows" <<
'\n';
975 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell;
977 out <<
' ' << cell->face(f)->diameter();
980 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
994 out <<
"object \"deal data\" class field" <<
'\n' 995 <<
"component \"positions\" value \"vertices\"" <<
'\n' 996 <<
"component \"connections\" value \"cells\"" <<
'\n';
1000 out <<
"object \"cell data\" class field" <<
'\n' 1001 <<
"component \"positions\" value \"vertices\"" <<
'\n' 1002 <<
"component \"connections\" value \"cells\"" <<
'\n';
1003 out <<
"component \"material\" value \"material\"" <<
'\n';
1004 out <<
"component \"level\" value \"level\"" <<
'\n';
1006 out <<
"component \"measure\" value \"measure\"" <<
'\n';
1008 out <<
"component \"diameter\" value \"diameter\"" <<
'\n';
1013 out <<
"object \"face data\" class field" <<
'\n' 1014 <<
"component \"positions\" value \"vertices\"" <<
'\n' 1015 <<
"component \"connections\" value \"faces\"" <<
'\n';
1016 out <<
"component \"boundary\" value \"boundary\"" <<
'\n';
1018 out <<
"component \"measure\" value \"face measure\"" <<
'\n';
1020 out <<
"component \"diameter\" value \"face diameter\"" <<
'\n';
1023 out <<
'\n' <<
"object \"grid data\" class group" <<
'\n';
1025 out <<
"member \"cells\" value \"cell data\"" <<
'\n';
1027 out <<
"member \"faces\" value \"face data\"" <<
'\n';
1028 out <<
"end" <<
'\n';
1039 template <
int dim,
int spacedim>
1042 std::ostream & out)
const 1049 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
1075 out <<
"@f$NOD" <<
'\n' << n_vertices <<
'\n';
1080 for (
unsigned int i = 0; i < vertices.size(); ++i)
1084 <<
" " << vertices[i];
1085 for (
unsigned int d = spacedim + 1; d <= 3; ++d)
1091 out <<
"@f$ENDNOD" <<
'\n' 1130 unsigned int elm_type;
1150 out << cell->active_cell_index() + 1 <<
' ' << elm_type <<
' ' 1151 <<
static_cast<unsigned int>(cell->material_id()) <<
' ' 1157 for (
unsigned int vertex = 0;
1158 vertex < GeometryInfo<dim>::vertices_per_cell;
1176 out <<
"@f$ENDELM\n";
1186 template <
int dim,
int spacedim>
1189 std::ostream & out)
const 1196 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
1212 std::time_t time1 = std::time(
nullptr);
1213 std::tm * time = std::localtime(&time1);
1215 <<
"# This file was generated by the deal.II library." <<
'\n' 1216 <<
"# Date = " << time->tm_year + 1900 <<
"/" << time->tm_mon + 1
1217 <<
"/" << time->tm_mday <<
'\n' 1218 <<
"# Time = " << time->tm_hour <<
":" << std::setw(2) << time->tm_min
1219 <<
":" << std::setw(2) << time->tm_sec <<
'\n' 1221 <<
"# For a description of the UCD format see the AVS Developer's guide." 1227 out << n_vertices <<
' ' 1237 for (
unsigned int i = 0; i < vertices.size(); ++i)
1241 <<
" " << vertices[i];
1242 for (
unsigned int d = spacedim + 1; d <= 3; ++d)
1251 out << cell->active_cell_index() + 1 <<
' ' 1252 <<
static_cast<unsigned int>(cell->material_id()) <<
' ';
1283 for (
unsigned int vertex = 0;
1284 vertex < GeometryInfo<dim>::vertices_per_cell;
1311 template <
int dim,
int spacedim>
1329 const int spacedim = 2;
1337 out <<
"#FIG 3.2\nLandscape\nCenter\nInches" << std::endl
1338 <<
"A4\n100.00\nSingle" 1341 <<
"-3" << std::endl
1342 <<
"# generated by deal.II GridOut class" << std::endl
1343 <<
"# reduce first number to scale up image" << std::endl
1344 <<
"1200 2" << std::endl;
1347 unsigned int colno = 32;
1348 out <<
"0 " << colno++ <<
" #ff0000" << std::endl;
1349 out <<
"0 " << colno++ <<
" #ff8000" << std::endl;
1350 out <<
"0 " << colno++ <<
" #ffd000" << std::endl;
1351 out <<
"0 " << colno++ <<
" #ffff00" << std::endl;
1352 out <<
"0 " << colno++ <<
" #c0ff00" << std::endl;
1353 out <<
"0 " << colno++ <<
" #80ff00" << std::endl;
1354 out <<
"0 " << colno++ <<
" #00f000" << std::endl;
1355 out <<
"0 " << colno++ <<
" #00f0c0" << std::endl;
1356 out <<
"0 " << colno++ <<
" #00f0ff" << std::endl;
1357 out <<
"0 " << colno++ <<
" #00c0ff" << std::endl;
1358 out <<
"0 " << colno++ <<
" #0080ff" << std::endl;
1359 out <<
"0 " << colno++ <<
" #0040ff" << std::endl;
1360 out <<
"0 " << colno++ <<
" #0000c0" << std::endl;
1361 out <<
"0 " << colno++ <<
" #5000ff" << std::endl;
1362 out <<
"0 " << colno++ <<
" #8000ff" << std::endl;
1363 out <<
"0 " << colno++ <<
" #b000ff" << std::endl;
1364 out <<
"0 " << colno++ <<
" #ff00ff" << std::endl;
1365 out <<
"0 " << colno++ <<
" #ff80ff" << std::endl;
1367 for (
unsigned int i = 0; i < 8; ++i)
1368 out <<
"0 " << colno++ <<
" #" << std::hex << 32 * i + 31 << 32 * i + 31
1369 << 32 * i + 31 << std::dec << std::endl;
1371 for (
unsigned int i = 1; i < 16; ++i)
1372 out <<
"0 " << colno++ <<
" #00" << std::hex << 16 * i + 15 << std::dec
1373 <<
"00" << std::endl;
1375 for (
unsigned int i = 1; i < 16; ++i)
1376 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 << 16 * i + 15
1377 << std::dec <<
"00" << std::endl;
1379 for (
unsigned int i = 1; i < 16; ++i)
1380 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 << std::dec
1381 <<
"0000" << std::endl;
1383 for (
unsigned int i = 1; i < 16; ++i)
1384 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 <<
"00" 1385 << 16 * i + 15 << std::dec << std::endl;
1387 for (
unsigned int i = 1; i < 16; ++i)
1388 out <<
"0 " << colno++ <<
" #0000" << std::hex << 16 * i + 15 << std::dec
1391 for (
unsigned int i = 1; i < 16; ++i)
1392 out <<
"0 " << colno++ <<
" #00" << std::hex << 16 * i + 15 << 16 * i + 15
1393 << std::dec << std::endl;
1403 for (; cell != end; ++cell)
1418 out << static_cast<unsigned int>(cell->material_id()) + 32;
1421 out << cell->level() + 8;
1424 out << cell->subdomain_id() + 32;
1427 out << cell->level_subdomain_id() + 32;
1436 (900 + cell->material_id()))
1442 << nv + 1 << std::endl;
1448 for (
unsigned int k = 0; k <= nv; ++k)
1452 for (
unsigned int d = 0; d < static_cast<unsigned int>(dim); ++d)
1456 out <<
'\t' << ((d == 0) ? val : -val);
1461 static const unsigned int face_reorder[4] = {2, 1, 3, 0};
1463 for (
unsigned int f = 0; f < nf; ++f)
1466 cell->face(face_reorder[f]);
1475 << (1 + (
unsigned int)bi);
1486 << nvf << std::endl;
1493 for (
unsigned int k = 0; k < nvf; ++k)
1496 for (
unsigned int d = 0; d < static_cast<unsigned int>(dim);
1501 out <<
'\t' << ((d == 0) ? val : -val);
1518 template <
int dim,
int spacedim>
1521 std::ostream & )
const 1530 unsigned int n_materials = 0;
1531 unsigned int n_levels = 0;
1532 unsigned int n_subdomains = 0;
1533 unsigned int n_level_subdomains = 0;
1537 unsigned int min_level, max_level;
1545 Assert(height != 0 || width != 0,
1546 ExcMessage(
"You have to set at least one of width and height"));
1548 unsigned int margin_in_percent = 0;
1550 margin_in_percent = 8;
1553 unsigned int cell_label_font_size;
1570 float x_max_perspective, x_min_perspective;
1571 float y_max_perspective, y_min_perspective;
1573 float x_dimension_perspective, y_dimension_perspective;
1577 double x_min = tria.
begin()->vertex(0)[0];
1578 double x_max = x_min;
1579 double y_min = tria.
begin()->vertex(0)[1];
1580 double y_max = y_min;
1582 double x_dimension, y_dimension;
1584 min_level = max_level = tria.
begin()->level();
1587 unsigned int materials[256];
1588 for (
unsigned int material_index = 0; material_index < 256; material_index++)
1589 materials[material_index] = 0;
1592 unsigned int levels[256];
1593 for (
unsigned int level_index = 0; level_index < 256; level_index++)
1594 levels[level_index] = 0;
1597 unsigned int subdomains[256];
1598 for (
unsigned int subdomain_index = 0; subdomain_index < 256;
1600 subdomains[subdomain_index] = 0;
1603 int level_subdomains[256];
1604 for (
int level_subdomain_index = 0; level_subdomain_index < 256;
1605 level_subdomain_index++)
1606 level_subdomains[level_subdomain_index] = 0;
1616 for (
unsigned int vertex_index = 0; vertex_index < 4; vertex_index++)
1618 if (cell->vertex(vertex_index)[0] < x_min)
1619 x_min = cell->vertex(vertex_index)[0];
1620 if (cell->vertex(vertex_index)[0] > x_max)
1621 x_max = cell->vertex(vertex_index)[0];
1623 if (cell->vertex(vertex_index)[1] < y_min)
1624 y_min = cell->vertex(vertex_index)[1];
1625 if (cell->vertex(vertex_index)[1] > y_max)
1626 y_max = cell->vertex(vertex_index)[1];
1629 if ((
unsigned int)cell->level() < min_level)
1630 min_level = cell->level();
1631 if ((
unsigned int)cell->level() > max_level)
1632 max_level = cell->level();
1634 materials[(
unsigned int)cell->material_id()] = 1;
1635 levels[(
unsigned int)cell->level()] = 1;
1637 subdomains[cell->subdomain_id() + 2] = 1;
1638 level_subdomains[cell->level_subdomain_id() + 2] = 1;
1641 x_dimension = x_max - x_min;
1642 y_dimension = y_max - y_min;
1645 for (
unsigned int material_index = 0; material_index < 256; material_index++)
1647 if (materials[material_index])
1652 for (
unsigned int level_index = 0; level_index < 256; level_index++)
1654 if (levels[level_index])
1659 for (
unsigned int subdomain_index = 0; subdomain_index < 256;
1662 if (subdomains[subdomain_index])
1667 for (
int level_subdomain_index = 0; level_subdomain_index < 256;
1668 level_subdomain_index++)
1670 if (level_subdomains[level_subdomain_index])
1671 n_level_subdomains++;
1686 n = n_level_subdomains;
1693 camera_position[0] = 0;
1694 camera_position[1] = 0;
1695 camera_position[2] = 2. * std::max(x_dimension, y_dimension);
1697 camera_direction[0] = 0;
1698 camera_direction[1] = 0;
1699 camera_direction[2] = -1;
1701 camera_horizontal[0] = 1;
1702 camera_horizontal[1] = 0;
1703 camera_horizontal[2] = 0;
1705 camera_focus = .5 * std::max(x_dimension, y_dimension);
1711 const double angle_factor = 3.14159265 / 180.;
1714 camera_position_temp[1] =
1717 camera_position_temp[2] =
1721 camera_direction_temp[1] =
1724 camera_direction_temp[2] =
1728 camera_horizontal_temp[1] =
1731 camera_horizontal_temp[2] =
1735 camera_position[1] = camera_position_temp[1];
1736 camera_position[2] = camera_position_temp[2];
1738 camera_direction[1] = camera_direction_temp[1];
1739 camera_direction[2] = camera_direction_temp[2];
1741 camera_horizontal[1] = camera_horizontal_temp[1];
1742 camera_horizontal[2] = camera_horizontal_temp[2];
1745 camera_position_temp[0] =
1748 camera_position_temp[1] =
1752 camera_direction_temp[0] =
1755 camera_direction_temp[1] =
1759 camera_horizontal_temp[0] =
1762 camera_horizontal_temp[1] =
1766 camera_position[0] = camera_position_temp[0];
1767 camera_position[1] = camera_position_temp[1];
1769 camera_direction[0] = camera_direction_temp[0];
1770 camera_direction[1] = camera_direction_temp[1];
1772 camera_horizontal[0] = camera_horizontal_temp[0];
1773 camera_horizontal[1] = camera_horizontal_temp[1];
1776 camera_position[0] = x_min + .5 * x_dimension;
1777 camera_position[1] = y_min + .5 * y_dimension;
1779 camera_position[0] += 2. * std::max(x_dimension, y_dimension) *
1782 camera_position[1] -= 2. * std::max(x_dimension, y_dimension) *
1789 point[0] = tria.
begin()->vertex(0)[0];
1790 point[1] = tria.
begin()->vertex(0)[1];
1793 float min_level_min_vertex_distance = 0;
1798 ((float)tria.
begin()->level() / (float)n_levels) *
1799 std::max(x_dimension, y_dimension);
1803 point, camera_position, camera_direction, camera_horizontal, camera_focus);
1805 x_max_perspective = projection_decomposition[0];
1806 x_min_perspective = projection_decomposition[0];
1808 y_max_perspective = projection_decomposition[1];
1809 y_min_perspective = projection_decomposition[1];
1815 point[0] = cell->vertex(0)[0];
1816 point[1] = cell->vertex(0)[1];
1822 ((float)cell->level() / (float)n_levels) *
1823 std::max(x_dimension, y_dimension);
1832 if (x_max_perspective < projection_decomposition[0])
1833 x_max_perspective = projection_decomposition[0];
1834 if (x_min_perspective > projection_decomposition[0])
1835 x_min_perspective = projection_decomposition[0];
1837 if (y_max_perspective < projection_decomposition[1])
1838 y_max_perspective = projection_decomposition[1];
1839 if (y_min_perspective > projection_decomposition[1])
1840 y_min_perspective = projection_decomposition[1];
1842 point[0] = cell->vertex(1)[0];
1843 point[1] = cell->vertex(1)[1];
1851 if (x_max_perspective < projection_decomposition[0])
1852 x_max_perspective = projection_decomposition[0];
1853 if (x_min_perspective > projection_decomposition[0])
1854 x_min_perspective = projection_decomposition[0];
1856 if (y_max_perspective < projection_decomposition[1])
1857 y_max_perspective = projection_decomposition[1];
1858 if (y_min_perspective > projection_decomposition[1])
1859 y_min_perspective = projection_decomposition[1];
1861 point[0] = cell->vertex(2)[0];
1862 point[1] = cell->vertex(2)[1];
1870 if (x_max_perspective < projection_decomposition[0])
1871 x_max_perspective = projection_decomposition[0];
1872 if (x_min_perspective > projection_decomposition[0])
1873 x_min_perspective = projection_decomposition[0];
1875 if (y_max_perspective < projection_decomposition[1])
1876 y_max_perspective = projection_decomposition[1];
1877 if (y_min_perspective > projection_decomposition[1])
1878 y_min_perspective = projection_decomposition[1];
1880 point[0] = cell->vertex(3)[0];
1881 point[1] = cell->vertex(3)[1];
1889 if (x_max_perspective < projection_decomposition[0])
1890 x_max_perspective = projection_decomposition[0];
1891 if (x_min_perspective > projection_decomposition[0])
1892 x_min_perspective = projection_decomposition[0];
1894 if (y_max_perspective < projection_decomposition[1])
1895 y_max_perspective = projection_decomposition[1];
1896 if (y_min_perspective > projection_decomposition[1])
1897 y_min_perspective = projection_decomposition[1];
1899 if ((
unsigned int)cell->level() == min_level)
1900 min_level_min_vertex_distance = cell->minimum_vertex_distance();
1903 x_dimension_perspective = x_max_perspective - x_min_perspective;
1904 y_dimension_perspective = y_max_perspective - y_min_perspective;
1908 width =
static_cast<unsigned int>(
1909 .5 + height * (x_dimension_perspective / y_dimension_perspective));
1910 else if (height == 0)
1911 height =
static_cast<unsigned int>(
1912 .5 + width * (y_dimension_perspective / x_dimension_perspective));
1913 unsigned int additional_width = 0;
1915 unsigned int font_size =
1916 static_cast<unsigned int>(.5 + (height / 100.) * 1.75);
1917 cell_label_font_size =
static_cast<unsigned int>(
1919 min_level_min_vertex_distance / std::min(x_dimension, y_dimension)));
1926 additional_width =
static_cast<unsigned int>(
1931 additional_width =
static_cast<unsigned int>(
1932 .5 + height * .175);
1944 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\"" << height
1945 <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" <<
'\n' 1952 <<
" <linearGradient id=\"background_gradient\" gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"" 1953 << height <<
"\">" <<
'\n' 1954 <<
" <stop offset=\"0\" style=\"stop-color:white\"/>" <<
'\n' 1955 <<
" <stop offset=\"1\" style=\"stop-color:lightsteelblue\"/>" <<
'\n' 1956 <<
" </linearGradient>" <<
'\n';
1962 out <<
"<!-- internal style sheet -->" <<
'\n' 1963 <<
"<style type=\"text/css\"><![CDATA[" <<
'\n';
1967 out <<
" rect.background{fill:url(#background_gradient)}" <<
'\n';
1969 out <<
" rect.background{fill:white}" <<
'\n';
1971 out <<
" rect.background{fill:none}" <<
'\n';
1974 out <<
" rect{fill:none; stroke:rgb(25,25,25); stroke-width:" 1976 <<
" text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)}" 1978 <<
" line{stroke:rgb(25,25,25); stroke-width:" 1980 <<
" path{fill:none; stroke:rgb(25,25,25); stroke-width:" 1987 unsigned int labeling_index = 0;
1989 for (
unsigned int index = 0; index < n; index++)
1994 h = .6 - (index / (n - 1.)) * .6;
2002 unsigned int i =
static_cast<unsigned int>(h * 6);
2004 double f = h * 6 - i;
2011 r = 255, g =
static_cast<unsigned int>(.5 + 255 * t);
2014 r =
static_cast<unsigned int>(.5 + 255 * q), g = 255;
2017 g = 255, b =
static_cast<unsigned int>(.5 + 255 * t);
2020 g =
static_cast<unsigned int>(.5 + 255 * q), b = 255;
2023 r =
static_cast<unsigned int>(.5 + 255 * t), b = 255;
2026 r = 255, b =
static_cast<unsigned int>(.5 + 255 * q);
2035 while (!materials[labeling_index])
2039 while (!levels[labeling_index])
2043 while (!subdomains[labeling_index])
2047 while (!level_subdomains[labeling_index])
2054 out <<
" path.p" << labeling_index <<
"{fill:rgb(" << r <<
',' << g
2055 <<
',' << b <<
"); " 2056 <<
"stroke:rgb(25,25,25); stroke-width:" 2059 out <<
" path.ps" << labeling_index <<
"{fill:rgb(" 2060 <<
static_cast<unsigned int>(.5 + .75 * r) <<
',' 2061 << static_cast<unsigned int>(.5 + .75 * g) <<
',' 2062 <<
static_cast<unsigned int>(.5 + .75 * b) <<
"); " 2063 <<
"stroke:rgb(20,20,20); stroke-width:" 2066 out <<
" rect.r" << labeling_index <<
"{fill:rgb(" << r <<
',' << g
2067 <<
',' << b <<
"); " 2068 <<
"stroke:rgb(25,25,25); stroke-width:" 2075 out <<
"]]></style>" <<
'\n' <<
'\n';
2078 out <<
" <rect class=\"background\" width=\"" << width <<
"\" height=\"" 2079 << height <<
"\"/>" <<
'\n';
2083 unsigned int x_offset = 0;
2086 x_offset =
static_cast<unsigned int>(.5 + (height / 100.) *
2087 (margin_in_percent / 2.));
2089 x_offset =
static_cast<unsigned int>(.5 + height * .025);
2092 <<
" <text x=\"" << x_offset <<
"\" y=\"" 2093 <<
static_cast<unsigned int>(.5 + height * .0525) <<
'\"' 2094 <<
" style=\"font-weight:100; fill:lightsteelblue; text-anchor:start; font-family:Courier; font-size:" 2095 <<
static_cast<unsigned int>(.5 + height * .045) <<
"px\">" 2097 <<
"</text>" <<
'\n';
2116 out <<
" <!-- cells -->" <<
'\n';
2118 for (
unsigned int level_index = min_level; level_index <= max_level;
2122 endc = tria.
end(level_index);
2124 for (; cell != endc; ++cell)
2134 out <<
" class=\"p";
2142 out << (
unsigned int)cell->material_id();
2145 out << (
unsigned int)cell->level();
2149 out << cell->subdomain_id() + 2;
2154 out << cell->level_subdomain_id() + 2;
2165 point[0] = cell->vertex(0)[0];
2166 point[1] = cell->vertex(0)[1];
2172 ((float)cell->level() / (float)n_levels) *
2173 std::max(x_dimension, y_dimension);
2176 projection_decomposition =
2183 out << static_cast<unsigned int>(
2185 ((projection_decomposition[0] - x_min_perspective) /
2186 x_dimension_perspective) *
2187 (width - (width / 100.) * 2. * margin_in_percent) +
2188 ((width / 100.) * margin_in_percent))
2190 <<
static_cast<unsigned int>(
2191 .5 + height - (height / 100.) * margin_in_percent -
2192 ((projection_decomposition[1] - y_min_perspective) /
2193 y_dimension_perspective) *
2194 (height - (height / 100.) * 2. * margin_in_percent));
2198 point[0] = cell->vertex(1)[0];
2199 point[1] = cell->vertex(1)[1];
2201 projection_decomposition =
2208 out << static_cast<unsigned int>(
2210 ((projection_decomposition[0] - x_min_perspective) /
2211 x_dimension_perspective) *
2212 (width - (width / 100.) * 2. * margin_in_percent) +
2213 ((width / 100.) * margin_in_percent))
2215 <<
static_cast<unsigned int>(
2216 .5 + height - (height / 100.) * margin_in_percent -
2217 ((projection_decomposition[1] - y_min_perspective) /
2218 y_dimension_perspective) *
2219 (height - (height / 100.) * 2. * margin_in_percent));
2223 point[0] = cell->vertex(3)[0];
2224 point[1] = cell->vertex(3)[1];
2226 projection_decomposition =
2233 out << static_cast<unsigned int>(
2235 ((projection_decomposition[0] - x_min_perspective) /
2236 x_dimension_perspective) *
2237 (width - (width / 100.) * 2. * margin_in_percent) +
2238 ((width / 100.) * margin_in_percent))
2240 <<
static_cast<unsigned int>(
2241 .5 + height - (height / 100.) * margin_in_percent -
2242 ((projection_decomposition[1] - y_min_perspective) /
2243 y_dimension_perspective) *
2244 (height - (height / 100.) * 2. * margin_in_percent));
2248 point[0] = cell->vertex(2)[0];
2249 point[1] = cell->vertex(2)[1];
2251 projection_decomposition =
2258 out << static_cast<unsigned int>(
2260 ((projection_decomposition[0] - x_min_perspective) /
2261 x_dimension_perspective) *
2262 (width - (width / 100.) * 2. * margin_in_percent) +
2263 ((width / 100.) * margin_in_percent))
2265 <<
static_cast<unsigned int>(
2266 .5 + height - (height / 100.) * margin_in_percent -
2267 ((projection_decomposition[1] - y_min_perspective) /
2268 y_dimension_perspective) *
2269 (height - (height / 100.) * 2. * margin_in_percent));
2273 point[0] = cell->vertex(0)[0];
2274 point[1] = cell->vertex(0)[1];
2276 projection_decomposition =
2283 out << static_cast<unsigned int>(
2285 ((projection_decomposition[0] - x_min_perspective) /
2286 x_dimension_perspective) *
2287 (width - (width / 100.) * 2. * margin_in_percent) +
2288 ((width / 100.) * margin_in_percent))
2290 <<
static_cast<unsigned int>(
2291 .5 + height - (height / 100.) * margin_in_percent -
2292 ((projection_decomposition[1] - y_min_perspective) /
2293 y_dimension_perspective) *
2294 (height - (height / 100.) * 2. * margin_in_percent));
2296 out <<
"\"/>" <<
'\n';
2303 point[0] = cell->center()[0];
2304 point[1] = cell->center()[1];
2310 ((float)cell->level() / (float)n_levels) *
2311 std::max(x_dimension, y_dimension);
2314 float distance_to_camera =
2315 sqrt(pow(point[0] - camera_position[0], 2.) +
2316 pow(point[1] - camera_position[1], 2.) +
2317 pow(point[2] - camera_position[2], 2.));
2318 float distance_factor =
2319 distance_to_camera / (2. * std::max(x_dimension, y_dimension));
2321 projection_decomposition =
2328 const unsigned int font_size_this_cell =
2329 static_cast<unsigned int>(
2331 cell_label_font_size *
2332 pow(.5, (
float)cell->level() - 4. + 3.5 * distance_factor));
2336 <<
static_cast<unsigned int>(
2338 ((projection_decomposition[0] - x_min_perspective) /
2339 x_dimension_perspective) *
2340 (width - (width / 100.) * 2. * margin_in_percent) +
2341 ((width / 100.) * margin_in_percent))
2343 <<
static_cast<unsigned int>(
2344 .5 + height - (height / 100.) * margin_in_percent -
2345 ((projection_decomposition[1] - y_min_perspective) /
2346 y_dimension_perspective) *
2347 (height - (height / 100.) * 2. * margin_in_percent) +
2348 0.5 * font_size_this_cell)
2349 <<
"\" style=\"font-size:" << font_size_this_cell <<
"px\">";
2353 out << cell->level();
2360 out << cell->index();
2368 out << (int)cell->material_id();
2377 out << static_cast<int>(cell->subdomain_id());
2389 out << static_cast<int>(cell->level_subdomain_id());
2392 out <<
"</text>" <<
'\n';
2399 for (
unsigned int faceIndex = 0; faceIndex < 4; faceIndex++)
2401 if (cell->at_boundary(faceIndex))
2403 point[0] = cell->face(faceIndex)->vertex(0)[0];
2404 point[1] = cell->face(faceIndex)->vertex(0)[1];
2410 ((float)cell->level() / (float)n_levels) *
2411 std::max(x_dimension, y_dimension);
2414 projection_decomposition =
2421 out <<
" <line x1=\"" 2422 <<
static_cast<unsigned int>(
2424 ((projection_decomposition[0] -
2425 x_min_perspective) /
2426 x_dimension_perspective) *
2428 (width / 100.) * 2. * margin_in_percent) +
2429 ((width / 100.) * margin_in_percent))
2431 <<
static_cast<unsigned int>(
2433 (height / 100.) * margin_in_percent -
2434 ((projection_decomposition[1] -
2435 y_min_perspective) /
2436 y_dimension_perspective) *
2438 (height / 100.) * 2. * margin_in_percent));
2440 point[0] = cell->face(faceIndex)->vertex(1)[0];
2441 point[1] = cell->face(faceIndex)->vertex(1)[1];
2447 ((float)cell->level() / (float)n_levels) *
2448 std::max(x_dimension, y_dimension);
2451 projection_decomposition =
2459 <<
static_cast<unsigned int>(
2461 ((projection_decomposition[0] -
2462 x_min_perspective) /
2463 x_dimension_perspective) *
2465 (width / 100.) * 2. * margin_in_percent) +
2466 ((width / 100.) * margin_in_percent))
2468 <<
static_cast<unsigned int>(
2470 (height / 100.) * margin_in_percent -
2471 ((projection_decomposition[1] -
2472 y_min_perspective) /
2473 y_dimension_perspective) *
2475 (height / 100.) * 2. * margin_in_percent))
2486 out <<
'\n' <<
" <!-- legend -->" <<
'\n';
2488 additional_width = 0;
2490 additional_width =
static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
2498 unsigned int line_offset = 0;
2499 out <<
" <rect x=\"" << width + additional_width <<
"\" y=\"" 2500 <<
static_cast<unsigned int>(.5 + (height / 100.) * margin_in_percent)
2502 << static_cast<unsigned int>(.5 + (height / 100.) *
2503 (40. - margin_in_percent))
2504 <<
"\" height=\"" <<
static_cast<unsigned int>(.5 + height * .165)
2507 out <<
" <text x=\"" 2508 << width + additional_width +
2509 static_cast<unsigned int>(.5 + (height / 100.) * 1.25)
2511 <<
static_cast<unsigned int>(.5 +
2512 (height / 100.) * margin_in_percent +
2513 (++line_offset) * 1.5 * font_size)
2514 <<
"\" style=\"text-anchor:start; font-weight:bold; font-size:" 2515 << font_size <<
"px\">" 2517 <<
"</text>" <<
'\n';
2521 out <<
" <text x=\"" 2522 << width + additional_width +
2523 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2525 <<
static_cast<unsigned int>(.5 +
2526 (height / 100.) * margin_in_percent +
2527 (++line_offset) * 1.5 * font_size)
2528 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2529 << font_size <<
"px\">" 2537 out <<
"</text>" <<
'\n';
2542 out <<
" <text x=\"" 2543 << width + additional_width +
2544 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2546 <<
static_cast<unsigned int>(.5 +
2547 (height / 100.) * margin_in_percent +
2548 (++line_offset) * 1.5 * font_size)
2549 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2550 << font_size <<
"px\">" 2557 out <<
"</text>" <<
'\n';
2562 out <<
" <text x=\"" 2563 << width + additional_width +
2564 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2566 <<
static_cast<unsigned int>(.5 +
2567 (height / 100.) * margin_in_percent +
2568 (++line_offset) * 1.5 * font_size)
2569 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2570 << font_size <<
"px\">" 2577 out <<
"</text>" <<
'\n';
2582 out <<
" <text x= \"" 2583 << width + additional_width +
2584 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2586 <<
static_cast<unsigned int>(.5 +
2587 (height / 100.) * margin_in_percent +
2588 (++line_offset) * 1.5 * font_size)
2589 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2590 << font_size <<
"px\">" 2596 out <<
"</text>" <<
'\n';
2601 out <<
" <text x= \"" 2602 << width + additional_width +
2603 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2605 <<
static_cast<unsigned int>(.5 +
2606 (height / 100.) * margin_in_percent +
2607 (++line_offset) * 1.5 * font_size)
2608 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2609 << font_size <<
"px\">" 2610 <<
"level_subdomain_id" 2611 <<
"</text>" <<
'\n';
2619 out <<
" <text x=\"" << width + additional_width <<
"\" y=\"" 2620 <<
static_cast<unsigned int>(
2621 .5 + (height / 100.) * margin_in_percent + 10.75 * font_size)
2622 <<
"\" style=\"text-anchor:start; font-size:" << font_size <<
"px\">" 2631 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
2633 out <<
" <text x=\"" << width + additional_width <<
"\" y=\"" 2634 <<
static_cast<unsigned int>(
2635 .5 + (height / 100.) * (margin_in_percent + 29.) -
2637 <<
"\" style=\"text-anchor:start; font-weight:bold; font-size:" 2638 << font_size <<
"px\">";
2643 out <<
"material_id";
2646 out <<
"level_number";
2649 out <<
"subdomain_id";
2652 out <<
"level_subdomain_id";
2658 out <<
"</text>" <<
'\n';
2660 unsigned int element_height =
static_cast<unsigned int>(
2661 ((height / 100.) * (71. - 2. * margin_in_percent)) / n);
2662 unsigned int element_width =
2663 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
2665 int labeling_index = 0;
2667 for (
unsigned int index = 0; index < n; index++)
2672 while (!materials[labeling_index])
2676 while (!levels[labeling_index])
2680 while (!subdomains[labeling_index])
2684 while (!level_subdomains[labeling_index])
2691 out <<
" <rect class=\"r" << labeling_index <<
"\" x=\"" 2692 << width + additional_width <<
"\" y=\"" 2693 <<
static_cast<unsigned int>(.5 + (height / 100.) *
2694 (margin_in_percent + 29)) +
2695 (n - index - 1) * element_height
2696 <<
"\" width=\"" << element_width <<
"\" height=\"" 2697 << element_height <<
"\"/>" <<
'\n';
2699 out <<
" <text x=\"" 2700 << width + additional_width + 1.5 * element_width <<
"\" y=\"" 2701 <<
static_cast<unsigned int>(.5 + (height / 100.) *
2702 (margin_in_percent + 29)) +
2703 (n - index - 1 + .5) * element_height +
2704 static_cast<unsigned int>(.5 + font_size * .35)
2706 <<
" style=\"text-anchor:start; font-size:" 2707 <<
static_cast<unsigned int>(.5 + font_size) <<
"px";
2709 if (index == 0 || index == n - 1)
2710 out <<
"; font-weight:bold";
2712 out <<
"\">" << labeling_index;
2719 out <<
"</text>" <<
'\n';
2727 out <<
'\n' <<
"</svg>";
2741 template <
int dim,
int spacedim>
2744 std::ostream & out)
const 2752 const std::time_t time1 = std::time(
nullptr);
2753 const std::tm * time = std::localtime(&time1);
2757 <<
"\n# This file was generated by the deal.II library." 2758 <<
"\n# Date = " << time->tm_year + 1900 <<
"/" << std::setfill(
'0')
2759 << std::setw(2) << time->tm_mon + 1 <<
"/" << std::setfill(
'0')
2760 << std::setw(2) << time->tm_mday
2761 <<
"\n# Time = " << std::setfill(
'0') << std::setw(2)
2762 << time->tm_hour <<
":" << std::setfill(
'0') << std::setw(2)
2763 << time->tm_min <<
":" << std::setfill(
'0') << std::setw(2)
2764 << time->tm_sec <<
"\n#" 2765 <<
"\n# For a description of the MathGL script format see the MathGL manual. " 2767 <<
"\n# Note: This file is understood by MathGL v2.1 and higher only, and can " 2768 <<
"\n# be quickly viewed in a graphical environment using \'mglview\'. " 2775 const std::string axes =
"xyz";
2791 out <<
"\nsetsize 800 800";
2792 out <<
"\nrotate 0 0";
2795 out <<
"\nsetsize 800 800";
2796 out <<
"\nrotate 60 40";
2805 <<
"\n# Vertex ordering." 2806 <<
"\n# list <vertex order> <vertex indices>" 2816 out <<
"\nlist f 0 1 2 3" 2821 <<
"\nlist f 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7 | 0 1 2 3 | 4 5 6 7" 2830 <<
"\n# List of vertices." 2831 <<
"\n# list <id> <vertices>" 2837 typename ::Triangulation<dim, spacedim>::active_cell_iterator
2842 for (; cell != endc; ++cell)
2844 for (
unsigned int i = 0; i < dim; ++i)
2851 out <<
"\nlist " << axes[i] << cell->active_cell_index() <<
" ";
2852 for (
unsigned int j = 0; j < GeometryInfo<dim>::vertices_per_cell;
2854 out << cell->vertex(j)[i] <<
" ";
2861 <<
"\n# List of cells to quadplot." 2862 <<
"\n# quadplot <vertex order> <id> <style>" 2867 out <<
"\nquadplot f ";
2868 for (
unsigned int j = 0; j < dim; ++j)
2869 out << axes[j] << i <<
" ";
2895 template <
int dim,
int spacedim,
typename ITERATOR,
typename END>
2897 generate_triangulation_patches(
2903 for (; cell != end; ++cell)
2909 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
2911 patch.
vertices[v] = cell->vertex(v);
2912 patch.
data(0, v) = cell->level();
2913 patch.
data(1, v) =
static_cast<int>(cell->manifold_id());
2914 patch.
data(2, v) = cell->material_id();
2915 if (!cell->has_children())
2916 patch.
data(3, v) =
static_cast<int>(cell->subdomain_id());
2918 patch.
data(3, v) = -1;
2919 patch.
data(4, v) =
static_cast<int>(cell->level_subdomain_id());
2921 patches.push_back(patch);
2925 std::vector<std::string>
2926 triangulation_patch_data_names()
2928 std::vector<std::string> v(5);
2933 v[4] =
"level_subdomain";
2940 template <
int dim,
int spacedim>
2943 std::ostream & out)
const 2951 std::vector<DataOutBase::Patch<dim, spacedim>> patches;
2953 generate_triangulation_patches(patches, tria.
begin_active(), tria.
end());
2956 triangulation_patch_data_names(),
2958 std::tuple<
unsigned int,
2970 template <
int dim,
int spacedim>
2973 std::ostream & out)
const 2981 std::vector<DataOutBase::Patch<dim, spacedim>> patches;
2983 generate_triangulation_patches(patches, tria.
begin_active(), tria.
end());
2986 triangulation_patch_data_names(),
2988 std::tuple<
unsigned int,
3000 template <
int dim,
int spacedim>
3004 const std::string & filename_without_extension,
3005 const bool view_levels,
3006 const bool include_artificial)
const 3008 std::vector<DataOutBase::Patch<dim, spacedim>> patches;
3009 const unsigned int n_datasets = 4;
3010 std::vector<std::string> data_names;
3011 data_names.emplace_back(
"level");
3012 data_names.emplace_back(
"subdomain");
3013 data_names.emplace_back(
"level_subdomain");
3014 data_names.emplace_back(
"proc_writing");
3019 for (cell = tria.
begin(), endc = tria.
end(); cell != endc; ++cell)
3023 if (cell->has_children())
3025 if (!include_artificial &&
3029 else if (!include_artificial)
3031 if (cell->has_children() &&
3034 else if (!cell->has_children() &&
3035 cell->level_subdomain_id() ==
3045 for (
unsigned int vertex = 0; vertex < n_q_points; ++vertex)
3047 patch.
vertices[vertex] = cell->vertex(vertex);
3048 patch.
data(0, vertex) = cell->level();
3049 if (!cell->has_children())
3050 patch.
data(1, vertex) =
3051 (double)static_cast<int>(cell->subdomain_id());
3053 patch.
data(1, vertex) = -1.0;
3054 patch.
data(2, vertex) =
3055 (double)static_cast<int>(cell->level_subdomain_id());
3059 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
3061 patches.push_back(patch);
3067 std::string new_file = filename_without_extension +
".vtu";
3071 new_file = filename_without_extension +
".proc" +
3076 if (tr->locally_owned_subdomain() == 0)
3078 std::vector<std::string> filenames;
3083 std::size_t pos = filename_without_extension.find_last_of(
'/');
3084 if (pos == std::string::npos)
3088 const unsigned int n_procs =
3090 for (
unsigned int i = 0; i < n_procs; ++i)
3091 filenames.push_back(filename_without_extension.substr(pos) +
3095 const std::string pvtu_master_filename =
3096 (filename_without_extension +
".pvtu");
3097 std::ofstream pvtu_master(pvtu_master_filename.c_str());
3104 Vector<float> dummy_vector(tr->n_active_cells());
3105 data_out.add_data_vector(dummy_vector,
"level");
3106 data_out.add_data_vector(dummy_vector,
"subdomain");
3107 data_out.add_data_vector(dummy_vector,
"level_subdomain");
3108 data_out.add_data_vector(dummy_vector,
"proc_writing");
3110 data_out.build_patches();
3112 data_out.write_pvtu_record(pvtu_master, filenames);
3116 std::ofstream out(new_file.c_str());
3118 std::tuple<
unsigned int,
3180 template <
int dim,
int spacedim>
3185 unsigned int n_faces = 0;
3189 if ((face->at_boundary()) && (face->boundary_id() != 0))
3197 template <
int dim,
int spacedim>
3204 std::vector<bool> line_flags;
3208 .clear_user_flags_line();
3210 unsigned int n_lines = 0;
3214 for (cell = tria.
begin_active(), endc = tria.
end(); cell != endc; ++cell)
3215 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
3216 if (cell->line(l)->at_boundary() && (cell->line(l)->boundary_id() != 0) &&
3217 (cell->line(l)->user_flag_set() ==
false))
3220 cell->line(l)->set_user_flag();
3235 const unsigned int next_element_index,
3236 std::ostream &)
const 3238 return next_element_index;
3244 const unsigned int next_element_index,
3245 std::ostream &)
const 3247 return next_element_index;
3252 const unsigned int next_element_index,
3253 std::ostream &)
const 3255 return next_element_index;
3261 const unsigned int next_element_index,
3262 std::ostream &)
const 3264 return next_element_index;
3269 const unsigned int next_element_index,
3270 std::ostream &)
const 3272 return next_element_index;
3278 const unsigned int next_element_index,
3279 std::ostream &)
const 3281 return next_element_index;
3287 const unsigned int next_element_index,
3288 std::ostream &)
const 3290 return next_element_index;
3295 const unsigned int next_element_index,
3296 std::ostream &)
const 3298 return next_element_index;
3303 template <
int dim,
int spacedim>
3306 const unsigned int next_element_index,
3307 std::ostream & out)
const 3309 unsigned int current_element_index = next_element_index;
3314 if (face->at_boundary() && (face->boundary_id() != 0))
3316 out << current_element_index <<
' ';
3328 out << static_cast<unsigned int>(face->boundary_id()) <<
' ' 3329 << static_cast<unsigned int>(face->boundary_id()) <<
' ' 3332 for (
unsigned int vertex = 0;
3333 vertex < GeometryInfo<dim>::vertices_per_face;
3336 << face->vertex_index(
3341 ++current_element_index;
3343 return current_element_index;
3347 template <
int dim,
int spacedim>
3350 const unsigned int next_element_index,
3351 std::ostream & out)
const 3353 unsigned int current_element_index = next_element_index;
3358 std::vector<bool> line_flags;
3362 .clear_user_flags_line();
3366 for (cell = tria.
begin_active(), endc = tria.
end(); cell != endc; ++cell)
3367 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
3368 if (cell->line(l)->at_boundary() && (cell->line(l)->boundary_id() != 0) &&
3369 (cell->line(l)->user_flag_set() ==
false))
3371 out << next_element_index <<
" 1 ";
3372 out << static_cast<unsigned int>(cell->line(l)->boundary_id()) <<
' ' 3373 << static_cast<unsigned int>(cell->line(l)->boundary_id())
3376 for (
unsigned int vertex = 0; vertex < 2; ++vertex)
3378 << cell->line(l)->vertex_index(
3386 ++current_element_index;
3387 cell->line(l)->set_user_flag();
3395 return current_element_index;
3402 const unsigned int next_element_index,
3403 std::ostream &)
const 3405 return next_element_index;
3410 const unsigned int next_element_index,
3411 std::ostream &)
const 3413 return next_element_index;
3418 const unsigned int next_element_index,
3419 std::ostream &)
const 3421 return next_element_index;
3426 const unsigned int next_element_index,
3427 std::ostream &)
const 3429 return next_element_index;
3434 const unsigned int next_element_index,
3435 std::ostream &)
const 3437 return next_element_index;
3443 const unsigned int next_element_index,
3444 std::ostream &)
const 3446 return next_element_index;
3452 const unsigned int next_element_index,
3453 std::ostream &)
const 3455 return next_element_index;
3460 const unsigned int next_element_index,
3461 std::ostream &)
const 3463 return next_element_index;
3468 template <
int dim,
int spacedim>
3471 const unsigned int next_element_index,
3472 std::ostream & out)
const 3474 unsigned int current_element_index = next_element_index;
3479 if (face->at_boundary() && (face->boundary_id() != 0))
3481 out << current_element_index <<
" " 3482 <<
static_cast<unsigned int>(face->boundary_id()) <<
" ";
3495 for (
unsigned int vertex = 0;
3496 vertex < GeometryInfo<dim>::vertices_per_face;
3498 out << face->vertex_index(
3504 ++current_element_index;
3506 return current_element_index;
3511 template <
int dim,
int spacedim>
3514 const unsigned int next_element_index,
3515 std::ostream & out)
const 3517 unsigned int current_element_index = next_element_index;
3522 std::vector<bool> line_flags;
3526 .clear_user_flags_line();
3530 for (cell = tria.
begin_active(), endc = tria.
end(); cell != endc; ++cell)
3531 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
3532 if (cell->line(l)->at_boundary() && (cell->line(l)->boundary_id() != 0) &&
3533 (cell->line(l)->user_flag_set() ==
false))
3535 out << current_element_index <<
" " 3536 <<
static_cast<unsigned int>(cell->line(l)->boundary_id())
3539 for (
unsigned int vertex = 0; vertex < 2; ++vertex)
3540 out << cell->line(l)->vertex_index(
3549 ++current_element_index;
3550 cell->line(l)->set_user_flag();
3557 return current_element_index;
3569 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
3570 camera_horizontal[2] * camera_direction[1];
3571 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
3572 camera_horizontal[0] * camera_direction[2];
3573 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
3574 camera_horizontal[1] * camera_direction[0];
3578 phi /= (point[0] - camera_position[0]) * camera_direction[0] +
3579 (point[1] - camera_position[1]) * camera_direction[1] +
3580 (point[2] - camera_position[2]) * camera_direction[2];
3583 projection[0] = camera_position[0] + phi * (point[0] - camera_position[0]);
3584 projection[1] = camera_position[1] + phi * (point[1] - camera_position[1]);
3585 projection[2] = camera_position[2] + phi * (point[2] - camera_position[2]);
3588 projection_decomposition[0] =
3589 (projection[0] - camera_position[0] - camera_focus * camera_direction[0]) *
3590 camera_horizontal[0];
3591 projection_decomposition[0] +=
3592 (projection[1] - camera_position[1] - camera_focus * camera_direction[1]) *
3593 camera_horizontal[1];
3594 projection_decomposition[0] +=
3595 (projection[2] - camera_position[2] - camera_focus * camera_direction[2]) *
3596 camera_horizontal[2];
3598 projection_decomposition[1] =
3599 (projection[0] - camera_position[0] - camera_focus * camera_direction[0]) *
3601 projection_decomposition[1] +=
3602 (projection[1] - camera_position[1] - camera_focus * camera_direction[1]) *
3604 projection_decomposition[1] +=
3605 (projection[2] - camera_position[2] - camera_focus * camera_direction[2]) *
3608 return projection_decomposition;
3625 template <
int spacedim>
3629 while (points.size() > 2)
3632 first_difference /= first_difference.
norm();
3634 second_difference /= second_difference.
norm();
3636 if ((first_difference - second_difference).norm() < 1e-10)
3637 points.erase(points.begin() + 1);
3645 template <
int spacedim>
3656 typename ::Triangulation<dim, spacedim>::active_cell_iterator cell =
3657 tria.begin_active();
3658 const typename ::Triangulation<dim, spacedim>::active_cell_iterator
3660 for (; cell != endc; ++cell)
3663 out <<
"# cell " << cell <<
'\n';
3665 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 3666 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3667 << cell->vertex(1) <<
' ' << cell->level() <<
' ' 3668 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3681 template <
int spacedim>
3692 const unsigned int n_additional_points =
3694 const unsigned int n_points = 2 + n_additional_points;
3696 typename ::Triangulation<dim, spacedim>::active_cell_iterator cell =
3697 tria.begin_active();
3698 const typename ::Triangulation<dim, spacedim>::active_cell_iterator
3704 std::vector<
Point<dim - 1>> boundary_points;
3705 if (mapping !=
nullptr)
3707 boundary_points.resize(n_points);
3708 boundary_points[0][0] = 0;
3709 boundary_points[n_points - 1][0] = 1;
3710 for (
unsigned int i = 1; i < n_points - 1; ++i)
3711 boundary_points[i](0) = 1. * i / (n_points - 1);
3713 std::vector<double> dummy_weights(n_points, 1. / n_points);
3714 Quadrature<dim - 1> quadrature(boundary_points, dummy_weights);
3720 for (; cell != endc; ++cell)
3723 out <<
"# cell " << cell <<
'\n';
3725 if (mapping ==
nullptr ||
3735 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
3738 << cell->level() <<
' ' 3739 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n';
3740 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 3741 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3749 for (
unsigned int face_no = 0;
3750 face_no < GeometryInfo<dim>::faces_per_cell;
3753 const typename ::Triangulation<dim,
3754 spacedim>::face_iterator
3755 face = cell->face(face_no);
3756 if (dim != spacedim || face->at_boundary() ||
3762 std::vector<Point<spacedim>> line_points;
3765 const unsigned int offset = face_no * n_points;
3766 for (
unsigned int i = 0; i < n_points; ++i)
3767 line_points.push_back(
3769 cell, q_projector->
point(offset + i)));
3770 internal::remove_colinear_points(line_points);
3773 out << point <<
' ' << cell->level() <<
' ' 3774 <<
static_cast<unsigned int>(cell->material_id())
3777 out <<
'\n' <<
'\n';
3783 out << face->vertex(0) <<
' ' << cell->level() <<
' ' 3784 <<
static_cast<unsigned int>(cell->material_id())
3786 << face->vertex(1) <<
' ' << cell->level() <<
' ' 3787 <<
static_cast<unsigned int>(cell->material_id())
3796 if (q_projector !=
nullptr)
3807 template <
int spacedim>
3818 const unsigned int n_additional_points =
3820 const unsigned int n_points = 2 + n_additional_points;
3822 typename ::Triangulation<dim, spacedim>::active_cell_iterator cell =
3823 tria.begin_active();
3824 const typename ::Triangulation<dim, spacedim>::active_cell_iterator
3830 std::vector<Point<1>> boundary_points;
3831 if (mapping !=
nullptr)
3833 boundary_points.resize(n_points);
3834 boundary_points[0][0] = 0;
3835 boundary_points[n_points - 1][0] = 1;
3836 for (
unsigned int i = 1; i < n_points - 1; ++i)
3837 boundary_points[i](0) = 1. * i / (n_points - 1);
3839 std::vector<double> dummy_weights(n_points, 1. / n_points);
3843 QIterated<dim - 1> quadrature(quadrature1d, 1);
3848 for (; cell != endc; ++cell)
3851 out <<
"# cell " << cell <<
'\n';
3853 if (mapping ==
nullptr || n_points == 2 ||
3854 (!cell->has_boundary_lines() &&
3858 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 3859 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3860 << cell->vertex(1) <<
' ' << cell->level() <<
' ' 3861 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3862 << cell->vertex(5) <<
' ' << cell->level() <<
' ' 3863 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3864 << cell->vertex(4) <<
' ' << cell->level() <<
' ' 3865 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3866 << cell->vertex(0) <<
' ' << cell->level() <<
' ' 3867 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3870 out << cell->vertex(2) <<
' ' << cell->level() <<
' ' 3871 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3872 << cell->vertex(3) <<
' ' << cell->level() <<
' ' 3873 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3874 << cell->vertex(7) <<
' ' << cell->level() <<
' ' 3875 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3876 << cell->vertex(6) <<
' ' << cell->level() <<
' ' 3877 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3878 << cell->vertex(2) <<
' ' << cell->level() <<
' ' 3879 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3883 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 3884 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3885 << cell->vertex(2) <<
' ' << cell->level() <<
' ' 3886 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3888 out << cell->vertex(1) <<
' ' << cell->level() <<
' ' 3889 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3890 << cell->vertex(3) <<
' ' << cell->level() <<
' ' 3891 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3893 out << cell->vertex(5) <<
' ' << cell->level() <<
' ' 3894 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3895 << cell->vertex(7) <<
' ' << cell->level() <<
' ' 3896 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3898 out << cell->vertex(4) <<
' ' << cell->level() <<
' ' 3899 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3900 << cell->vertex(6) <<
' ' << cell->level() <<
' ' 3901 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3906 for (
unsigned int face_no = 0;
3907 face_no < GeometryInfo<dim>::faces_per_cell;
3910 const typename ::Triangulation<dim,
3911 spacedim>::face_iterator
3912 face = cell->face(face_no);
3914 if (face->at_boundary() &&
3917 const unsigned int offset = face_no * n_points * n_points;
3918 for (
unsigned int i = 0; i < n_points - 1; ++i)
3919 for (
unsigned int j = 0; j < n_points - 1; ++j)
3924 q_projector->
point(offset + i * n_points + j));
3926 << p0 <<
' ' << cell->level() <<
' ' 3927 <<
static_cast<unsigned int>(cell->material_id())
3932 q_projector->
point(offset +
3933 (i + 1) * n_points + j)))
3934 <<
' ' << cell->level() <<
' ' 3935 <<
static_cast<unsigned int>(cell->material_id())
3941 offset + (i + 1) * n_points + j + 1)))
3942 <<
' ' << cell->level() <<
' ' 3943 <<
static_cast<unsigned int>(cell->material_id())
3948 q_projector->
point(offset + i * n_points +
3950 <<
' ' << cell->level() <<
' ' 3951 <<
static_cast<unsigned int>(cell->material_id())
3955 << p0 <<
' ' << cell->level() <<
' ' 3956 <<
static_cast<unsigned int>(cell->material_id())
3958 out <<
'\n' <<
'\n';
3963 for (
unsigned int l = 0;
3964 l < GeometryInfo<dim>::lines_per_face;
3967 const typename ::Triangulation<dim, spacedim>::
3968 line_iterator line = face->line(l);
3971 &v1 = line->vertex(1);
3972 if (line->at_boundary() ||
3978 std::vector<Point<spacedim>> line_points;
3989 for (
unsigned int i = 0; i < n_points; ++i)
3990 line_points.push_back(
3993 (1 - boundary_points[i][0]) * u0 +
3994 boundary_points[i][0] * u1));
3995 internal::remove_colinear_points(line_points);
3997 out << point <<
' ' << cell->level() <<
' ' 3998 <<
static_cast<unsigned int>(
3999 cell->material_id())
4004 << v0 <<
' ' << cell->level() <<
' ' 4005 <<
static_cast<unsigned int>(cell->material_id())
4007 << v1 <<
' ' << cell->level() <<
' ' 4008 <<
static_cast<unsigned int>(cell->material_id())
4011 out <<
'\n' <<
'\n';
4018 if (q_projector !=
nullptr)
4032 template <
int dim,
int spacedim>
4056 const unsigned int l)
4076 write_eps(const ::Triangulation<1, 2> &,
4086 write_eps(const ::Triangulation<1, 3> &,
4096 write_eps(const ::Triangulation<2, 3> &,
4107 template <
int dim,
int spacedim>
4109 write_eps(const ::Triangulation<dim, spacedim> &tria,
4115 using LineList = std::list<LineEntry>;
4127 static_cast<const GridOutFlags::EpsFlagsBase &>(eps_flags_3);
4155 for (typename ::Triangulation<dim, spacedim>::
4156 active_cell_iterator cell = tria.begin_active();
4159 for (
unsigned int line_no = 0;
4160 line_no < GeometryInfo<dim>::lines_per_cell;
4163 typename ::Triangulation<dim, spacedim>::line_iterator
4164 line = cell->line(line_no);
4176 if (!line->has_children() &&
4177 (mapping ==
nullptr || !line->at_boundary()))
4197 line_list.emplace_back(
4198 Point<2>(line->vertex(0)(0), line->vertex(0)(1)),
4199 Point<2>(line->vertex(1)(0), line->vertex(1)(1)),
4200 line->user_flag_set(),
4210 if (mapping !=
nullptr)
4217 std::vector<
Point<dim - 1>> boundary_points(n_points);
4219 for (
unsigned int i = 0; i < n_points; ++i)
4220 boundary_points[i](0) = 1. * (i + 1) / (n_points + 1);
4222 Quadrature<dim - 1> quadrature(boundary_points);
4230 for (typename ::Triangulation<dim, spacedim>::
4231 active_cell_iterator cell = tria.begin_active();
4234 for (
unsigned int face_no = 0;
4235 face_no < GeometryInfo<dim>::faces_per_cell;
4238 const typename ::Triangulation<dim, spacedim>::
4239 face_iterator face = cell->face(face_no);
4241 if (face->at_boundary())
4251 const unsigned int offset = face_no * n_points;
4252 for (
unsigned int i = 0; i < n_points; ++i)
4256 cell, q_projector.
point(offset + i)));
4257 const Point<2> p1(p1_dim(0), p1_dim(1));
4259 line_list.emplace_back(p0,
4261 face->user_flag_set(),
4268 const Point<2> p1(p1_dim(0), p1_dim(1));
4269 line_list.emplace_back(p0,
4271 face->user_flag_set(),
4286 typename ::Triangulation<dim,
4287 spacedim>::active_cell_iterator
4288 cell = tria.begin_active(),
4311 const double turn_angle = eps_flags_3.
turn_angle;
4313 -std::sin(z_angle * 2. * pi / 360.) *
4314 std::sin(turn_angle * 2. * pi / 360.),
4315 +std::sin(z_angle * 2. * pi / 360.) *
4316 std::cos(turn_angle * 2. * pi / 360.),
4317 -std::cos(z_angle * 2. * pi / 360.));
4325 ((
Point<dim>(0, 0, 1) * view_direction) * view_direction);
4334 ((
Point<dim>(1, 0, 0) * view_direction) * view_direction) -
4335 ((
Point<dim>(1, 0, 0) * unit_vector1) * unit_vector1));
4339 for (; cell != endc; ++cell)
4340 for (
unsigned int line_no = 0;
4341 line_no < GeometryInfo<dim>::lines_per_cell;
4344 typename ::Triangulation<dim, spacedim>::line_iterator
4345 line = cell->line(line_no);
4346 line_list.emplace_back(
4347 Point<2>(line->vertex(0) * unit_vector2,
4348 line->vertex(0) * unit_vector1),
4349 Point<2>(line->vertex(1) * unit_vector2,
4350 line->vertex(1) * unit_vector1),
4351 line->user_flag_set(),
4367 double x_min = tria.begin_active()->vertex(0)(0);
4368 double x_max = x_min;
4369 double y_min = tria.begin_active()->vertex(0)(1);
4370 double y_max = y_min;
4371 unsigned int max_level = line_list.begin()->level;
4373 for (LineList::const_iterator line = line_list.begin();
4374 line != line_list.end();
4377 x_min = std::min(x_min, line->first(0));
4378 x_min = std::min(x_min, line->second(0));
4380 x_max = std::max(x_max, line->first(0));
4381 x_max = std::max(x_max, line->second(0));
4383 y_min = std::min(y_min, line->first(1));
4384 y_min = std::min(y_min, line->second(1));
4386 y_max = std::max(y_max, line->first(1));
4387 y_max = std::max(y_max, line->second(1));
4389 max_level = std::max(max_level, line->level);
4397 const double scale =
4398 (eps_flags_base.
size /
4410 std::time_t time1 = std::time(
nullptr);
4411 std::tm * time = std::localtime(&time1);
4412 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n' 4413 <<
"%%Title: deal.II Output" <<
'\n' 4414 <<
"%%Creator: the deal.II library" <<
'\n' 4415 <<
"%%Creation Date: " << time->tm_year + 1900 <<
"/" 4416 << time->tm_mon + 1 <<
"/" << time->tm_mday <<
" - " 4417 << time->tm_hour <<
":" << std::setw(2) << time->tm_min <<
":" 4418 << std::setw(2) << time->tm_sec <<
'\n' 4419 <<
"%%BoundingBox: " 4423 <<
static_cast<unsigned int>(
4424 std::floor(((x_max - x_min) * scale) + 1))
4426 << static_cast<unsigned int>(
4427 std::floor(((y_max - y_min) * scale) + 1))
4436 out <<
"/m {moveto} bind def" <<
'\n' 4437 <<
"/x {lineto stroke} bind def" <<
'\n' 4438 <<
"/b {0 0 0 setrgbcolor} def" <<
'\n' 4439 <<
"/r {1 0 0 setrgbcolor} def" <<
'\n';
4446 out <<
"/l { neg " << (max_level) <<
" add " 4447 << (0.66666 / std::max(1U, (max_level - 1)))
4448 <<
" mul 1 0.8 sethsbcolor} def" <<
'\n';
4462 << (
"/R {rmoveto} bind def\n" 4463 "/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont\n" 4464 "dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall\n" 4465 "currentdict end definefont\n" 4466 "/MFshow {{dup dup 0 get findfont exch 1 get scalefont setfont\n" 4467 "[ currentpoint ] exch dup 2 get 0 exch rmoveto dup dup 5 get exch 4 get\n" 4468 "{show} {stringwidth pop 0 rmoveto}ifelse dup 3 get\n" 4469 "{2 get neg 0 exch rmoveto pop} {pop aload pop moveto}ifelse} forall} bind def\n" 4470 "/MFwidth {0 exch {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n" 4471 "5 get stringwidth pop add}\n" 4472 "{pop} ifelse} forall} bind def\n" 4473 "/MCshow { currentpoint stroke m\n" 4474 "exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n")
4478 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4481 out << eps_flags_base.
line_width <<
" setlinewidth" <<
'\n';
4485 const Point<2> offset(x_min, y_min);
4487 for (LineList::const_iterator line = line_list.begin();
4488 line != line_list.end();
4491 out << line->level <<
" l " << (line->first - offset) * scale <<
" m " 4492 << (line->second - offset) * scale <<
" x" <<
'\n';
4497 << (line->first - offset) * scale <<
" m " 4498 << (line->second - offset) * scale <<
" x" <<
'\n';
4504 out <<
"(Helvetica) findfont 140 scalefont setfont" <<
'\n';
4506 typename ::Triangulation<dim, spacedim>::active_cell_iterator
4507 cell = tria.begin_active(),
4509 for (; cell != endc; ++cell)
4511 out << (cell->center()(0) - offset(0)) * scale <<
' ' 4512 << (cell->center()(1) - offset(1)) * scale <<
" m" <<
'\n' 4513 <<
"[ [(Helvetica) 12.0 0.0 true true (";
4517 out << cell->index();
4520 <<
"] -6 MCshow" <<
'\n';
4527 out <<
"(Helvetica) findfont 140 scalefont setfont" <<
'\n';
4533 std::set<unsigned int> treated_vertices;
4534 typename ::Triangulation<dim, spacedim>::active_cell_iterator
4535 cell = tria.begin_active(),
4537 for (; cell != endc; ++cell)
4538 for (
unsigned int vertex = 0;
4539 vertex < GeometryInfo<dim>::vertices_per_cell;
4541 if (treated_vertices.find(cell->vertex_index(vertex)) ==
4542 treated_vertices.end())
4544 treated_vertices.insert(cell->vertex_index(vertex));
4546 out << (cell->vertex(vertex)(0) - offset(0)) * scale <<
' ' 4547 << (cell->vertex(vertex)(1) - offset(1)) * scale <<
" m" 4549 <<
"[ [(Helvetica) 10.0 0.0 true true (" 4550 << cell->vertex_index(vertex) <<
")] " 4551 <<
"] -6 MCshow" <<
'\n';
4555 out <<
"showpage" <<
'\n';
4567 template <
int dim,
int spacedim>
4577 template <
int dim,
int spacedim>
4584 switch (output_format)
4634 template <
int dim,
int spacedim>
4645 #include "grid_out.inst" 4648 DEAL_II_NAMESPACE_CLOSE
void parse_parameters(ParameterHandler ¶m)
void parse_parameters(ParameterHandler ¶m)
void write_ucd(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
static const unsigned int invalid_unsigned_int
void write_svg(const Triangulation< 2, 2 > &tria, std::ostream &out) const
OutputFormat default_format
static void declare_parameters(ParameterHandler &prm)
DX(const bool write_cells=true, const bool write_faces=false, const bool write_diameter=false, const bool write_measure=false, const bool write_all_faces=true)
const std::vector< Point< spacedim > > & get_vertices() const
cell_iterator end() const
static OutputFormat parse_output_format(const std::string &format_name)
void parse_parameters(ParameterHandler ¶m)
bool margin
Margin around the plotted area.
active_face_iterator begin_active_face() const
unsigned int n_used_vertices() const
void attach_triangulation(const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &)
bool write_additional_boundary_lines
static::ExceptionBase & ExcIO()
unsigned int n_boundary_face_points
static void declare_parameters(ParameterHandler ¶m)
GridOutFlags::Eps< 2 > eps_flags_2
void write_vtk(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
void parse_parameters(ParameterHandler ¶m)
unsigned int write_ucd_faces(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
static void declare_parameters(ParameterHandler ¶m)
Convert the level number into the cell color.
write() calls write_eps()
const std::vector< bool > & get_used_vertices() const
unsigned int line_thickness
Thickness of the lines between cells.
void write_mesh_per_processor_as_vtu(const Triangulation< dim, spacedim > &tria, const std::string &filename_without_extension, const bool view_levels=false, const bool include_artificial=false) const
bool convert_level_number_to_height
numbers::NumberTraits< Number >::real_type norm() const
#define AssertThrow(cond, exc)
static Point< 2 > svg_project_point(Point< 3 > point, Point< 3 > camera_position, Point< 3 > camera_direction, Point< 3 > camera_horizontal, float camera_focus)
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const =0
unsigned int boundary_line_thickness
Thickness of lines at the boundary.
Point< spacedim > vertices[GeometryInfo< dim >::vertices_per_cell]
cell_iterator begin(const unsigned int level=0) const
unsigned int n_active_cells() const
std::string get(const std::string &entry_string) const
const Point< dim > & point(const unsigned int i) const
void write_eps(const Triangulation< dim, spacedim > &tria, std::ostream &out, const Mapping< dim, spacedim > *mapping=nullptr) const
void parse_parameters(ParameterHandler ¶m)
void parse_parameters(ParameterHandler ¶m)
unsigned int n_extra_curved_line_points
write() calls write_ucd()
void enter_subsection(const std::string &subsection)
GridOutFlags::Vtk vtk_flags
void write_msh(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
bool label_cell_index
Write cell index into each cell. Defaults to true.
GridOutFlags::Gnuplot gnuplot_flags
Convert the global subdomain id into the cell color.
unsigned int & n_boundary_face_points
Convert the material id into the cell color.
static::ExceptionBase & ExcMessage(std::string arg1)
static void declare_parameters(ParameterHandler ¶m)
GridOutFlags::MathGL mathgl_flags
void write_vtu(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
write() calls write_mathgl()
GridOutFlags::DX dx_flags
GridOutFlags::Msh msh_flags
GridOutFlags::Eps< 1 > eps_flags_1
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
write() calls write_gnuplot()
#define Assert(cond, exc)
bool write_cell_number_level
void parse_parameters(const ParameterHandler &prm)
bool label_material_id
Write material id of each cell. Defaults to false.
void write_vtu(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const VtkFlags &flags, std::ostream &out)
EpsFlagsBase(const SizeType size_type=width, const unsigned int size=300, const double line_width=0.5, const bool color_lines_on_user_flag=false, const unsigned int n_boundary_face_points=2, const bool color_lines_level=false)
Abstract base class for mapping classes.
std::string default_suffix() const
GridOutFlags::XFig xfig_flags
bool label_subdomain_id
Write subdomain id of each cell. Defaults to false.
Ucd(const bool write_preamble=false, const bool write_faces=false, const bool write_lines=false)
static void declare_parameters(ParameterHandler ¶m)
bool label_level_subdomain_id
Write level subdomain id of each cell. Defaults to false.
static std::string get_output_format_names()
Convert the subdomain id into the cell color.
Msh(const bool write_faces=false, const bool write_lines=false)
unsigned int n_subdivisions
GridOutFlags::Ucd ucd_flags
static void declare_parameters(ParameterHandler ¶m)
virtual types::subdomain_id locally_owned_subdomain() const
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
void write_xfig(const Triangulation< dim, spacedim > &tria, std::ostream &out, const Mapping< dim, spacedim > *mapping=nullptr) const
static void declare_parameters(ParameterHandler ¶m)
unsigned int n_mpi_processes(const MPI_Comm &mpi_communicator)
bool get_bool(const std::string &entry_name) const
float cell_font_scaling
Scaling of the font for cell annotations. Defaults to 1.
Convert the level subdomain id into the cell color.
write() calls write_xfig()
DataComponentInterpretation
bool write_vertex_numbers
Convert the level subdomain id into the cell color.
static Quadrature< dim > project_to_all_faces(const SubQuadrature &quadrature)
const types::subdomain_id artificial_subdomain_id
Convert the level into the cell color.
std::size_t memory_consumption() const
void parse_parameters(ParameterHandler ¶m)
unsigned int write_msh_lines(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
unsigned int write_msh_faces(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
unsigned int n_boundary_lines(const Triangulation< dim, spacedim > &tria) const
unsigned int n_boundary_face_points
face_iterator end_face() const
unsigned int n_boundary_faces(const Triangulation< dim, spacedim > &tria) const
static void declare_parameters(ParameterHandler ¶m)
write() calls write_msh()
write() calls write_svg()
GridOutFlags::Svg svg_flags
double get_double(const std::string &entry_name) const
Svg(const unsigned int line_thickness=2, const unsigned int boundary_line_thickness=4, bool margin=true, const Background background=white, const int azimuth_angle=0, const int polar_angle=0, const Coloring coloring=level_number, const bool convert_level_number_to_height=false, const bool label_level_number=true, const bool label_cell_index=true, const bool label_material_id=false, const bool label_subdomain_id=false, const bool draw_colorbar=true, const bool draw_legend=true)
bool color_lines_on_user_flag
void parse_parameters(ParameterHandler ¶m)
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
static::ExceptionBase & ExcNotImplemented()
Convert the material id into the cell color (default)
void write_mathgl(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
float level_height_factor
GridOutFlags::Eps< 3 > eps_flags_3
static::ExceptionBase & ExcInvalidState()
void write(const Triangulation< dim, spacedim > &tria, std::ostream &out, const OutputFormat output_format, const Mapping< dim, spacedim > *mapping=nullptr) const
const types::boundary_id internal_face_boundary_id
write() calls write_vtu()
active_cell_iterator begin_active(const unsigned int level=0) const
bool points_are_available
static void declare_parameters(ParameterHandler ¶m)
void set_flags(const GridOutFlags::DX &flags)
bool label_level_number
Write level number into each cell. Defaults to true.
void parse_parameters(ParameterHandler ¶m)
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const =0
unsigned int write_ucd_lines(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
unsigned int neighbors[dim > 0?GeometryInfo< dim >::faces_per_cell:1]
Gnuplot & operator=(const Gnuplot &flags)
void write_gnuplot(const Triangulation< dim, spacedim > &tria, std::ostream &out, const Mapping< dim, spacedim > *mapping=nullptr) const
void write_dx(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
GridOutFlags::Vtu vtu_flags
write() calls write_vtk()
void parse_parameters(ParameterHandler ¶m)
void parse_parameters(ParameterHandler ¶m)
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
Gnuplot(const bool write_cell_number=false, const unsigned int n_extra_curved_line_points=2, const bool curved_inner_cells=false, const bool write_additional_boundary_lines=true)
static::ExceptionBase & ExcInternalError()