32 #include <boost/algorithm/string.hpp>
33 #include <boost/archive/binary_oarchive.hpp>
50 const bool write_faces,
51 const bool write_diameter,
52 const bool write_measure,
53 const bool write_all_faces)
55 , write_faces(write_faces)
56 , write_diameter(write_diameter)
57 , write_measure(write_measure)
58 , write_all_faces(write_all_faces)
67 "Write the mesh connectivity as DX grid cells");
71 "Write faces of cells. These may be boundary faces "
72 "or all faces between mesh cells, according to "
73 "\"Write all faces\"");
77 "If cells are written, additionally write their"
78 " diameter as data for visualization");
82 "Write the volume of each cell as data");
86 "Write all faces, not only boundary");
100 Msh::Msh(
const bool write_faces,
const bool write_lines)
101 : write_faces(write_faces)
102 , write_lines(write_lines)
122 const bool write_faces,
123 const bool write_lines)
124 : write_preamble(write_preamble)
125 , write_faces(write_faces)
126 , write_lines(write_lines)
151 const unsigned int n_extra_curved_line_points,
152 const bool curved_inner_cells,
153 const bool write_additional_boundary_lines)
154 : write_cell_numbers(write_cell_numbers)
155 , n_extra_curved_line_points(n_extra_curved_line_points)
156 , n_boundary_face_points(this->n_extra_curved_line_points)
157 , curved_inner_cells(curved_inner_cells)
158 , write_additional_boundary_lines(write_additional_boundary_lines)
165 :
Gnuplot(flags.write_cell_numbers,
166 flags.n_extra_curved_line_points,
167 flags.curved_inner_cells,
168 flags.write_additional_boundary_lines)
203 const unsigned int size,
204 const double line_width,
205 const bool color_lines_on_user_flag,
206 const unsigned int n_boundary_face_points,
207 const bool color_lines_level)
210 , line_width(line_width)
211 , color_lines_on_user_flag(color_lines_on_user_flag)
212 , n_boundary_face_points(n_boundary_face_points)
213 , color_lines_level(color_lines_level)
223 "Depending on this parameter, either the "
225 "of the eps is scaled to \"Size\"");
229 "Size of the output in points");
233 "Width of the lines drawn in points");
237 "Draw lines with user flag set in different color");
241 "Number of points on boundary edges. "
242 "Increase this beyond 2 to see curved boundaries.");
246 "Draw different colors according to grid level.");
253 if (param.
get(
"Size by") == std::string(
"width"))
255 else if (param.
get(
"Size by") == std::string(
"height"))
267 const unsigned int size,
268 const double line_width,
269 const bool color_lines_on_user_flag,
270 const unsigned int n_boundary_face_points)
274 color_lines_on_user_flag,
275 n_boundary_face_points)
293 const unsigned int size,
294 const double line_width,
295 const bool color_lines_on_user_flag,
296 const unsigned int n_boundary_face_points,
297 const bool write_cell_numbers,
298 const bool write_cell_number_level,
299 const bool write_vertex_numbers,
300 const bool color_lines_level)
304 color_lines_on_user_flag,
305 n_boundary_face_points,
307 , write_cell_numbers(write_cell_numbers)
308 , write_cell_number_level(write_cell_number_level)
309 , write_vertex_numbers(write_vertex_numbers)
319 "(2D only) Write cell numbers"
320 " into the centers of cells");
324 "(2D only) if \"Cell number\" is true, write "
325 "numbers in the form level.number");
329 "Write numbers for each vertex");
337 write_cell_numbers = param.
get_bool(
"Cell number");
338 write_cell_number_level = param.
get_bool(
"Level number");
339 write_vertex_numbers = param.
get_bool(
"Vertex number");
345 const unsigned int size,
346 const double line_width,
347 const bool color_lines_on_user_flag,
348 const unsigned int n_boundary_face_points,
349 const double azimut_angle,
350 const double turn_angle)
354 color_lines_on_user_flag,
355 n_boundary_face_points)
356 , azimut_angle(azimut_angle)
357 , turn_angle(turn_angle)
367 "Azimuth of the viw point, that is, the angle "
368 "in the plane from the x-axis.");
372 "Elevation of the view point above the xy-plane.");
380 azimut_angle = 90 - param.
get_double(
"Elevation");
387 : draw_boundary(true)
390 , n_boundary_face_points(0)
396 , boundary_thickness(3)
430 const unsigned int boundary_line_thickness,
433 const int azimuth_angle,
434 const int polar_angle,
436 const bool convert_level_number_to_height,
437 const bool label_level_number,
438 const bool label_cell_index,
439 const bool label_material_id,
440 const bool label_subdomain_id,
441 const bool draw_colorbar,
442 const bool draw_legend,
443 const bool label_boundary_id)
446 , line_thickness(line_thickness)
447 , boundary_line_thickness(boundary_line_thickness)
449 , background(background)
450 , azimuth_angle(azimuth_angle)
451 , polar_angle(polar_angle)
453 , convert_level_number_to_height(convert_level_number_to_height)
454 , level_height_factor(0.3f)
455 , cell_font_scaling(1.f)
456 , label_level_number(label_level_number)
457 , label_cell_index(label_cell_index)
458 , label_material_id(label_material_id)
459 , label_subdomain_id(label_subdomain_id)
460 , label_level_subdomain_id(false)
461 , label_boundary_id(label_boundary_id)
462 , draw_colorbar(draw_colorbar)
463 , draw_legend(draw_legend)
467 : draw_bounding_box(false)
580 switch (output_format)
623 if (format_name ==
"none" || format_name ==
"false")
626 if (format_name ==
"dx")
629 if (format_name ==
"ucd")
632 if (format_name ==
"gnuplot")
635 if (format_name ==
"eps")
638 if (format_name ==
"xfig")
641 if (format_name ==
"msh")
644 if (format_name ==
"svg")
647 if (format_name ==
"mathgl")
650 if (format_name ==
"vtk")
653 if (format_name ==
"vtu")
666 return "none|dx|gnuplot|eps|ucd|xfig|msh|svg|mathgl|vtk|vtu";
799 template <
int dim,
int spacedim>
802 std::ostream & out)
const
818 std::vector<unsigned int> renumber(
vertices.size());
821 unsigned int new_number = 0;
822 for (
unsigned int i = 0; i <
vertices.size(); ++i)
824 renumber[i] = new_number++;
828 out <<
"object \"vertices\" class array type float rank 1 shape " << dim
829 <<
" items " << n_vertices <<
" data follows" <<
'\n';
831 for (
unsigned int i = 0; i <
vertices.size(); ++i)
840 const unsigned int n_faces =
848 out <<
"object \"cells\" class array type int rank 1 shape "
849 << n_vertices_per_cell <<
" items " <<
n_cells <<
" data follows"
860 out <<
"attribute \"element type\" string \"";
868 <<
"attribute \"ref\" string \"positions\"" <<
'\n'
873 out <<
"object \"material\" class array type int rank 0 items " <<
n_cells
874 <<
" data follows" <<
'\n';
876 out <<
' ' << cell->material_id();
877 out <<
'\n' <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
879 out <<
"object \"level\" class array type int rank 0 items " <<
n_cells
880 <<
" data follows" <<
'\n';
882 out <<
' ' << cell->level();
883 out <<
'\n' <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
887 out <<
"object \"measure\" class array type float rank 0 items "
888 <<
n_cells <<
" data follows" <<
'\n';
890 out <<
'\t' << cell->measure();
892 <<
"attribute \"dep\" string \"connections\"" <<
'\n'
898 out <<
"object \"diameter\" class array type float rank 0 items "
899 <<
n_cells <<
" data follows" <<
'\n';
901 out <<
'\t' << cell->diameter();
903 <<
"attribute \"dep\" string \"connections\"" <<
'\n'
910 out <<
"object \"faces\" class array type int rank 1 shape "
911 << n_vertices_per_face <<
" items " << n_faces <<
" data follows"
921 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_face;
924 << renumber[face->vertex_index(
929 out <<
"attribute \"element type\" string \"";
935 <<
"attribute \"ref\" string \"positions\"" <<
'\n'
941 out <<
"object \"boundary\" class array type int rank 0 items " << n_faces
942 <<
" data follows" <<
'\n';
949 <<
static_cast<std::make_signed<types::boundary_id>::type
>(
950 cell->face(f)->boundary_id());
954 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
958 out <<
"object \"face measure\" class array type float rank 0 items "
959 << n_faces <<
" data follows" <<
'\n';
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';
976 out <<
' ' << cell->face(f)->diameter();
979 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
993 out <<
"object \"deal data\" class field" <<
'\n'
994 <<
"component \"positions\" value \"vertices\"" <<
'\n'
995 <<
"component \"connections\" value \"cells\"" <<
'\n';
999 out <<
"object \"cell data\" class field" <<
'\n'
1000 <<
"component \"positions\" value \"vertices\"" <<
'\n'
1001 <<
"component \"connections\" value \"cells\"" <<
'\n';
1002 out <<
"component \"material\" value \"material\"" <<
'\n';
1003 out <<
"component \"level\" value \"level\"" <<
'\n';
1005 out <<
"component \"measure\" value \"measure\"" <<
'\n';
1007 out <<
"component \"diameter\" value \"diameter\"" <<
'\n';
1012 out <<
"object \"face data\" class field" <<
'\n'
1013 <<
"component \"positions\" value \"vertices\"" <<
'\n'
1014 <<
"component \"connections\" value \"faces\"" <<
'\n';
1015 out <<
"component \"boundary\" value \"boundary\"" <<
'\n';
1017 out <<
"component \"measure\" value \"face measure\"" <<
'\n';
1019 out <<
"component \"diameter\" value \"face diameter\"" <<
'\n';
1022 out <<
'\n' <<
"object \"grid data\" class group" <<
'\n';
1024 out <<
"member \"cells\" value \"cell data\"" <<
'\n';
1026 out <<
"member \"faces\" value \"face data\"" <<
'\n';
1027 out <<
"end" <<
'\n';
1038 template <
int dim,
int spacedim>
1041 std::ostream & out)
const
1069 out <<
"@f$NOD" <<
'\n' << n_vertices <<
'\n';
1074 for (
unsigned int i = 0; i <
vertices.size(); ++i)
1079 for (
unsigned int d = spacedim + 1;
d <= 3; ++
d)
1085 out <<
"@f$ENDNOD" <<
'\n'
1124 unsigned int elm_type;
1144 out << cell->active_cell_index() + 1 <<
' ' << elm_type <<
' '
1145 << cell->material_id() <<
' ' << cell->subdomain_id() <<
' '
1167 out <<
"@f$ENDELM\n";
1177 template <
int dim,
int spacedim>
1180 std::ostream & out)
const
1198 std::time_t time1 = std::time(
nullptr);
1199 std::tm * time = std::localtime(&time1);
1201 <<
"# This file was generated by the deal.II library." <<
'\n'
1202 <<
"# Date = " << time->tm_year + 1900 <<
"/" << time->tm_mon + 1
1203 <<
"/" << time->tm_mday <<
'\n'
1204 <<
"# Time = " << time->tm_hour <<
":" << std::setw(2) << time->tm_min
1205 <<
":" << std::setw(2) << time->tm_sec <<
'\n'
1207 <<
"# For a description of the UCD format see the AVS Developer's guide."
1213 out << n_vertices <<
' '
1223 for (
unsigned int i = 0; i <
vertices.size(); ++i)
1228 for (
unsigned int d = spacedim + 1;
d <= 3; ++
d)
1237 out << cell->active_cell_index() + 1 <<
' ' << cell->material_id() <<
' ';
1294 template <
int dim,
int spacedim>
1312 const int spacedim = 2;
1318 out <<
"#FIG 3.2\nLandscape\nCenter\nInches" << std::endl
1319 <<
"A4\n100.00\nSingle"
1322 <<
"-3" << std::endl
1323 <<
"# generated by deal.II GridOut class" << std::endl
1324 <<
"# reduce first number to scale up image" << std::endl
1325 <<
"1200 2" << std::endl;
1328 unsigned int colno = 32;
1329 out <<
"0 " << colno++ <<
" #ff0000" << std::endl;
1330 out <<
"0 " << colno++ <<
" #ff8000" << std::endl;
1331 out <<
"0 " << colno++ <<
" #ffd000" << std::endl;
1332 out <<
"0 " << colno++ <<
" #ffff00" << std::endl;
1333 out <<
"0 " << colno++ <<
" #c0ff00" << std::endl;
1334 out <<
"0 " << colno++ <<
" #80ff00" << std::endl;
1335 out <<
"0 " << colno++ <<
" #00f000" << std::endl;
1336 out <<
"0 " << colno++ <<
" #00f0c0" << std::endl;
1337 out <<
"0 " << colno++ <<
" #00f0ff" << std::endl;
1338 out <<
"0 " << colno++ <<
" #00c0ff" << std::endl;
1339 out <<
"0 " << colno++ <<
" #0080ff" << std::endl;
1340 out <<
"0 " << colno++ <<
" #0040ff" << std::endl;
1341 out <<
"0 " << colno++ <<
" #0000c0" << std::endl;
1342 out <<
"0 " << colno++ <<
" #5000ff" << std::endl;
1343 out <<
"0 " << colno++ <<
" #8000ff" << std::endl;
1344 out <<
"0 " << colno++ <<
" #b000ff" << std::endl;
1345 out <<
"0 " << colno++ <<
" #ff00ff" << std::endl;
1346 out <<
"0 " << colno++ <<
" #ff80ff" << std::endl;
1348 for (
unsigned int i = 0; i < 8; ++i)
1349 out <<
"0 " << colno++ <<
" #" << std::hex << 32 * i + 31 << 32 * i + 31
1350 << 32 * i + 31 << std::dec << std::endl;
1352 for (
unsigned int i = 1; i < 16; ++i)
1353 out <<
"0 " << colno++ <<
" #00" << std::hex << 16 * i + 15 << std::dec
1354 <<
"00" << std::endl;
1356 for (
unsigned int i = 1; i < 16; ++i)
1357 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 << 16 * i + 15
1358 << std::dec <<
"00" << std::endl;
1360 for (
unsigned int i = 1; i < 16; ++i)
1361 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 << std::dec
1362 <<
"0000" << std::endl;
1364 for (
unsigned int i = 1; i < 16; ++i)
1365 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 <<
"00"
1366 << 16 * i + 15 << std::dec << std::endl;
1368 for (
unsigned int i = 1; i < 16; ++i)
1369 out <<
"0 " << colno++ <<
" #0000" << std::hex << 16 * i + 15 << std::dec
1372 for (
unsigned int i = 1; i < 16; ++i)
1373 out <<
"0 " << colno++ <<
" #00" << std::hex << 16 * i + 15 << 16 * i + 15
1374 << std::dec << std::endl;
1396 out << cell->material_id() + 32;
1399 out << cell->level() + 8;
1402 out << cell->subdomain_id() + 32;
1405 out << cell->level_subdomain_id() + 32;
1414 (900 + cell->material_id()))
1420 << nv + 1 << std::endl;
1426 for (
unsigned int k = 0; k <= nv; ++k)
1430 for (
unsigned int d = 0; d < static_cast<unsigned int>(dim); ++
d)
1434 out <<
'\t' << ((
d == 0) ? val : -val);
1439 static const unsigned int face_reorder[4] = {2, 1, 3, 0};
1441 for (
const unsigned int f : face_reorder)
1469 for (
unsigned int k = 0;
1470 k < GeometryInfo<dim>::vertices_per_face;
1474 for (
unsigned int d = 0; d < static_cast<unsigned int>(dim);
1480 out <<
'\t' << ((
d == 0) ? val : -val);
1514 const float camera_focus)
1520 camera_focus / ((
point - camera_position) * camera_direction);
1523 camera_position + phi * (
point - camera_position);
1525 return {(projection - camera_position - camera_focus * camera_direction) *
1527 (projection - camera_position - camera_focus * camera_direction) *
1534 template <
int dim,
int spacedim>
1537 std::ostream & )
const
1548 unsigned int min_level, max_level;
1556 Assert(height != 0 || width != 0,
1557 ExcMessage(
"You have to set at least one of width and height"));
1559 unsigned int margin_in_percent = 0;
1561 margin_in_percent = 8;
1564 unsigned int cell_label_font_size;
1577 float x_max_perspective, x_min_perspective;
1578 float y_max_perspective, y_min_perspective;
1580 float x_dimension_perspective, y_dimension_perspective;
1584 double x_min = tria.
begin()->vertex(0)[0];
1585 double x_max = x_min;
1586 double y_min = tria.
begin()->vertex(0)[1];
1587 double y_max = y_min;
1589 double x_dimension, y_dimension;
1591 min_level = max_level = tria.
begin()->level();
1594 std::set<unsigned int> materials;
1597 std::set<unsigned int> levels;
1600 std::set<unsigned int> subdomains;
1603 std::set<int> level_subdomains;
1611 for (
unsigned int vertex_index = 0; vertex_index < 4; vertex_index++)
1613 if (cell->vertex(vertex_index)[0] < x_min)
1614 x_min = cell->vertex(vertex_index)[0];
1615 if (cell->vertex(vertex_index)[0] > x_max)
1616 x_max = cell->vertex(vertex_index)[0];
1618 if (cell->vertex(vertex_index)[1] < y_min)
1619 y_min = cell->vertex(vertex_index)[1];
1620 if (cell->vertex(vertex_index)[1] > y_max)
1621 y_max = cell->vertex(vertex_index)[1];
1624 if (
static_cast<unsigned int>(cell->level()) < min_level)
1625 min_level = cell->level();
1626 if (
static_cast<unsigned int>(cell->level()) > max_level)
1627 max_level = cell->level();
1629 materials.insert(cell->material_id());
1630 levels.insert(cell->level());
1631 if (cell->is_active())
1632 subdomains.insert(cell->subdomain_id() + 2);
1633 level_subdomains.insert(cell->level_subdomain_id() + 2);
1636 x_dimension = x_max - x_min;
1637 y_dimension = y_max - y_min;
1640 const unsigned int n_materials = materials.size();
1643 const unsigned int n_levels = levels.size();
1646 const unsigned int n_subdomains = subdomains.size();
1649 const unsigned int n_level_subdomains = level_subdomains.size();
1663 n = n_level_subdomains;
1672 camera_position[0] = 0;
1673 camera_position[1] = 0;
1674 camera_position[2] = 2. *
std::max(x_dimension, y_dimension);
1677 camera_direction[0] = 0;
1678 camera_direction[1] = 0;
1679 camera_direction[2] = -1;
1682 camera_horizontal[0] = 1;
1683 camera_horizontal[1] = 0;
1684 camera_horizontal[2] = 0;
1686 camera_focus = .5 *
std::max(x_dimension, y_dimension);
1692 const double angle_factor = 3.14159265 / 180.;
1695 camera_position_temp[1] =
1698 camera_position_temp[2] =
1702 camera_direction_temp[1] =
1705 camera_direction_temp[2] =
1709 camera_horizontal_temp[1] =
1712 camera_horizontal_temp[2] =
1716 camera_position[1] = camera_position_temp[1];
1717 camera_position[2] = camera_position_temp[2];
1719 camera_direction[1] = camera_direction_temp[1];
1720 camera_direction[2] = camera_direction_temp[2];
1722 camera_horizontal[1] = camera_horizontal_temp[1];
1723 camera_horizontal[2] = camera_horizontal_temp[2];
1726 camera_position_temp[0] =
1729 camera_position_temp[1] =
1733 camera_direction_temp[0] =
1736 camera_direction_temp[1] =
1740 camera_horizontal_temp[0] =
1743 camera_horizontal_temp[1] =
1747 camera_position[0] = camera_position_temp[0];
1748 camera_position[1] = camera_position_temp[1];
1750 camera_direction[0] = camera_direction_temp[0];
1751 camera_direction[1] = camera_direction_temp[1];
1753 camera_horizontal[0] = camera_horizontal_temp[0];
1754 camera_horizontal[1] = camera_horizontal_temp[1];
1757 camera_position[0] = x_min + .5 * x_dimension;
1758 camera_position[1] = y_min + .5 * y_dimension;
1760 camera_position[0] += 2. *
std::max(x_dimension, y_dimension) *
1763 camera_position[1] -= 2. *
std::max(x_dimension, y_dimension) *
1774 float min_level_min_vertex_distance = 0;
1779 (
static_cast<float>(tria.
begin()->level()) /
1780 static_cast<float>(n_levels)) *
1781 std::max(x_dimension, y_dimension);
1784 projection_decomposition = svg_project_point(
1785 point, camera_position, camera_direction, camera_horizontal, camera_focus);
1787 x_max_perspective = projection_decomposition[0];
1788 x_min_perspective = projection_decomposition[0];
1790 y_max_perspective = projection_decomposition[1];
1791 y_min_perspective = projection_decomposition[1];
1795 point[0] = cell->vertex(0)[0];
1796 point[1] = cell->vertex(0)[1];
1803 (
static_cast<float>(cell->level()) /
static_cast<float>(n_levels)) *
1804 std::max(x_dimension, y_dimension);
1807 projection_decomposition = svg_project_point(
point,
1813 if (x_max_perspective < projection_decomposition[0])
1814 x_max_perspective = projection_decomposition[0];
1815 if (x_min_perspective > projection_decomposition[0])
1816 x_min_perspective = projection_decomposition[0];
1818 if (y_max_perspective < projection_decomposition[1])
1819 y_max_perspective = projection_decomposition[1];
1820 if (y_min_perspective > projection_decomposition[1])
1821 y_min_perspective = projection_decomposition[1];
1823 point[0] = cell->vertex(1)[0];
1824 point[1] = cell->vertex(1)[1];
1826 projection_decomposition = svg_project_point(
point,
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(2)[0];
1843 point[1] = cell->vertex(2)[1];
1845 projection_decomposition = svg_project_point(
point,
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(3)[0];
1862 point[1] = cell->vertex(3)[1];
1864 projection_decomposition = svg_project_point(
point,
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 if (
static_cast<unsigned int>(cell->level()) == min_level)
1881 min_level_min_vertex_distance = cell->minimum_vertex_distance();
1884 x_dimension_perspective = x_max_perspective - x_min_perspective;
1885 y_dimension_perspective = y_max_perspective - y_min_perspective;
1889 width =
static_cast<unsigned int>(
1890 .5 + height * (x_dimension_perspective / y_dimension_perspective));
1891 else if (height == 0)
1892 height =
static_cast<unsigned int>(
1893 .5 + width * (y_dimension_perspective / x_dimension_perspective));
1894 unsigned int additional_width = 0;
1896 unsigned int font_size =
1897 static_cast<unsigned int>(.5 + (height / 100.) * 1.75);
1898 cell_label_font_size =
static_cast<unsigned int>(
1900 min_level_min_vertex_distance /
std::min(x_dimension, y_dimension)));
1907 additional_width =
static_cast<unsigned int>(
1912 additional_width =
static_cast<unsigned int>(
1913 .5 + height * .175);
1925 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\"" << height
1926 <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" <<
'\n'
1933 <<
" <linearGradient id=\"background_gradient\" gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\""
1934 << height <<
"\">" <<
'\n'
1935 <<
" <stop offset=\"0\" style=\"stop-color:white\"/>" <<
'\n'
1936 <<
" <stop offset=\"1\" style=\"stop-color:lightsteelblue\"/>" <<
'\n'
1937 <<
" </linearGradient>" <<
'\n';
1943 out <<
"<!-- internal style sheet -->" <<
'\n'
1944 <<
"<style type=\"text/css\"><![CDATA[" <<
'\n';
1948 out <<
" rect.background{fill:url(#background_gradient)}" <<
'\n';
1950 out <<
" rect.background{fill:white}" <<
'\n';
1952 out <<
" rect.background{fill:none}" <<
'\n';
1955 out <<
" rect{fill:none; stroke:rgb(25,25,25); stroke-width:"
1957 <<
" text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)}"
1959 <<
" line{stroke:rgb(25,25,25); stroke-width:"
1961 <<
" path{fill:none; stroke:rgb(25,25,25); stroke-width:"
1963 <<
" circle{fill:white; stroke:black; stroke-width:2}" <<
'\n'
1969 unsigned int labeling_index = 0;
1970 auto materials_it = materials.begin();
1971 auto levels_it = levels.begin();
1972 auto subdomains_it = subdomains.begin();
1973 auto level_subdomains_it = level_subdomains.begin();
1975 for (
unsigned int index = 0; index < n; index++)
1980 h = .6 - (index / (n - 1.)) * .6;
1988 unsigned int i =
static_cast<unsigned int>(h * 6);
1990 double f = h * 6 - i;
1997 r = 255, g =
static_cast<unsigned int>(.5 + 255 * t);
2000 r =
static_cast<unsigned int>(.5 + 255 * q), g = 255;
2003 g = 255,
b =
static_cast<unsigned int>(.5 + 255 * t);
2006 g =
static_cast<unsigned int>(.5 + 255 * q),
b = 255;
2009 r =
static_cast<unsigned int>(.5 + 255 * t),
b = 255;
2012 r = 255,
b =
static_cast<unsigned int>(.5 + 255 * q);
2021 labeling_index = *materials_it++;
2024 labeling_index = *levels_it++;
2027 labeling_index = *subdomains_it++;
2030 labeling_index = *level_subdomains_it++;
2036 out <<
" path.p" << labeling_index <<
"{fill:rgb(" << r <<
',' << g
2037 <<
',' <<
b <<
"); "
2038 <<
"stroke:rgb(25,25,25); stroke-width:"
2041 out <<
" path.ps" << labeling_index <<
"{fill:rgb("
2042 <<
static_cast<unsigned int>(.5 + .75 * r) <<
','
2043 <<
static_cast<unsigned int>(.5 + .75 * g) <<
','
2044 <<
static_cast<unsigned int>(.5 + .75 *
b) <<
"); "
2045 <<
"stroke:rgb(20,20,20); stroke-width:"
2048 out <<
" rect.r" << labeling_index <<
"{fill:rgb(" << r <<
',' << g
2049 <<
',' <<
b <<
"); "
2050 <<
"stroke:rgb(25,25,25); stroke-width:"
2057 out <<
"]]></style>" <<
'\n' <<
'\n';
2060 out <<
" <rect class=\"background\" width=\"" << width <<
"\" height=\""
2061 << height <<
"\"/>" <<
'\n';
2065 unsigned int x_offset = 0;
2068 x_offset =
static_cast<unsigned int>(.5 + (height / 100.) *
2069 (margin_in_percent / 2.));
2071 x_offset =
static_cast<unsigned int>(.5 + height * .025);
2074 <<
" <text x=\"" << x_offset <<
"\" y=\""
2075 <<
static_cast<unsigned int>(.5 + height * .0525) <<
'\"'
2076 <<
" style=\"font-weight:100; fill:lightsteelblue; text-anchor:start; font-family:Courier; font-size:"
2077 <<
static_cast<unsigned int>(.5 + height * .045) <<
"px\">"
2079 <<
"</text>" <<
'\n';
2098 out <<
" <!-- cells -->" <<
'\n';
2100 for (
unsigned int level_index = min_level; level_index <= max_level;
2113 out <<
" class=\"p";
2115 if (!cell->is_active() &&
2122 out << cell->material_id();
2125 out << static_cast<unsigned int>(cell->level());
2128 if (cell->is_active())
2129 out << cell->subdomain_id() + 2;
2134 out << cell->level_subdomain_id() + 2;
2145 point[0] = cell->vertex(0)[0];
2146 point[1] = cell->vertex(0)[1];
2152 (
static_cast<float>(cell->level()) /
2153 static_cast<float>(n_levels)) *
2154 std::max(x_dimension, y_dimension);
2157 projection_decomposition = svg_project_point(
point,
2163 out << static_cast<unsigned int>(
2165 ((projection_decomposition[0] - x_min_perspective) /
2166 x_dimension_perspective) *
2167 (width - (width / 100.) * 2. * margin_in_percent) +
2168 ((width / 100.) * margin_in_percent))
2170 <<
static_cast<unsigned int>(
2171 .5 + height - (height / 100.) * margin_in_percent -
2172 ((projection_decomposition[1] - y_min_perspective) /
2173 y_dimension_perspective) *
2174 (height - (height / 100.) * 2. * margin_in_percent));
2178 point[0] = cell->vertex(1)[0];
2179 point[1] = cell->vertex(1)[1];
2181 projection_decomposition = svg_project_point(
point,
2187 out << static_cast<unsigned int>(
2189 ((projection_decomposition[0] - x_min_perspective) /
2190 x_dimension_perspective) *
2191 (width - (width / 100.) * 2. * margin_in_percent) +
2192 ((width / 100.) * margin_in_percent))
2194 <<
static_cast<unsigned int>(
2195 .5 + height - (height / 100.) * margin_in_percent -
2196 ((projection_decomposition[1] - y_min_perspective) /
2197 y_dimension_perspective) *
2198 (height - (height / 100.) * 2. * margin_in_percent));
2202 point[0] = cell->vertex(3)[0];
2203 point[1] = cell->vertex(3)[1];
2205 projection_decomposition = svg_project_point(
point,
2211 out << static_cast<unsigned int>(
2213 ((projection_decomposition[0] - x_min_perspective) /
2214 x_dimension_perspective) *
2215 (width - (width / 100.) * 2. * margin_in_percent) +
2216 ((width / 100.) * margin_in_percent))
2218 <<
static_cast<unsigned int>(
2219 .5 + height - (height / 100.) * margin_in_percent -
2220 ((projection_decomposition[1] - y_min_perspective) /
2221 y_dimension_perspective) *
2222 (height - (height / 100.) * 2. * margin_in_percent));
2226 point[0] = cell->vertex(2)[0];
2227 point[1] = cell->vertex(2)[1];
2229 projection_decomposition = svg_project_point(
point,
2235 out << static_cast<unsigned int>(
2237 ((projection_decomposition[0] - x_min_perspective) /
2238 x_dimension_perspective) *
2239 (width - (width / 100.) * 2. * margin_in_percent) +
2240 ((width / 100.) * margin_in_percent))
2242 <<
static_cast<unsigned int>(
2243 .5 + height - (height / 100.) * margin_in_percent -
2244 ((projection_decomposition[1] - y_min_perspective) /
2245 y_dimension_perspective) *
2246 (height - (height / 100.) * 2. * margin_in_percent));
2250 point[0] = cell->vertex(0)[0];
2251 point[1] = cell->vertex(0)[1];
2253 projection_decomposition = svg_project_point(
point,
2259 out << static_cast<unsigned int>(
2261 ((projection_decomposition[0] - x_min_perspective) /
2262 x_dimension_perspective) *
2263 (width - (width / 100.) * 2. * margin_in_percent) +
2264 ((width / 100.) * margin_in_percent))
2266 <<
static_cast<unsigned int>(
2267 .5 + height - (height / 100.) * margin_in_percent -
2268 ((projection_decomposition[1] - y_min_perspective) /
2269 y_dimension_perspective) *
2270 (height - (height / 100.) * 2. * margin_in_percent));
2272 out <<
"\"/>" <<
'\n';
2279 point[0] = cell->center()[0];
2280 point[1] = cell->center()[1];
2286 (
static_cast<float>(cell->level()) /
2287 static_cast<float>(n_levels)) *
2288 std::max(x_dimension, y_dimension);
2291 const double distance_to_camera =
2292 std::sqrt(std::pow(
point[0] - camera_position[0], 2.) +
2293 std::pow(
point[1] - camera_position[1], 2.) +
2294 std::pow(
point[2] - camera_position[2], 2.));
2295 const double distance_factor =
2296 distance_to_camera / (2. *
std::max(x_dimension, y_dimension));
2298 projection_decomposition = svg_project_point(
point,
2304 const unsigned int font_size_this_cell =
2305 static_cast<unsigned int>(
2307 cell_label_font_size *
2308 std::pow(.5, cell->level() - 4. + 3.5 * distance_factor));
2312 <<
static_cast<unsigned int>(
2314 ((projection_decomposition[0] - x_min_perspective) /
2315 x_dimension_perspective) *
2316 (width - (width / 100.) * 2. * margin_in_percent) +
2317 ((width / 100.) * margin_in_percent))
2319 <<
static_cast<unsigned int>(
2320 .5 + height - (height / 100.) * margin_in_percent -
2321 ((projection_decomposition[1] - y_min_perspective) /
2322 y_dimension_perspective) *
2323 (height - (height / 100.) * 2. * margin_in_percent) +
2324 0.5 * font_size_this_cell)
2325 <<
"\" style=\"font-size:" << font_size_this_cell <<
"px\">";
2329 out << cell->level();
2336 out << cell->index();
2345 <<
static_cast<std::make_signed<types::material_id>::type
>(
2346 cell->material_id());
2354 if (cell->is_active())
2356 std::make_signed<types::subdomain_id>::type
>(
2357 cell->subdomain_id());
2370 <<
static_cast<std::make_signed<types::subdomain_id>::type
>(
2371 cell->level_subdomain_id());
2374 out <<
"</text>" <<
'\n';
2381 for (
const unsigned int faceIndex :
2384 if (cell->at_boundary(faceIndex))
2386 point[0] = cell->face(faceIndex)->vertex(0)[0];
2387 point[1] = cell->face(faceIndex)->vertex(0)[1];
2393 (
static_cast<float>(cell->level()) /
2394 static_cast<float>(n_levels)) *
2395 std::max(x_dimension, y_dimension);
2398 projection_decomposition =
2399 svg_project_point(
point,
2405 out <<
" <line x1=\""
2406 <<
static_cast<unsigned int>(
2408 ((projection_decomposition[0] -
2409 x_min_perspective) /
2410 x_dimension_perspective) *
2412 (width / 100.) * 2. * margin_in_percent) +
2413 ((width / 100.) * margin_in_percent))
2415 <<
static_cast<unsigned int>(
2417 (height / 100.) * margin_in_percent -
2418 ((projection_decomposition[1] -
2419 y_min_perspective) /
2420 y_dimension_perspective) *
2422 (height / 100.) * 2. * margin_in_percent));
2424 point[0] = cell->face(faceIndex)->vertex(1)[0];
2425 point[1] = cell->face(faceIndex)->vertex(1)[1];
2431 (
static_cast<float>(cell->level()) /
2432 static_cast<float>(n_levels)) *
2433 std::max(x_dimension, y_dimension);
2436 projection_decomposition =
2437 svg_project_point(
point,
2444 <<
static_cast<unsigned int>(
2446 ((projection_decomposition[0] -
2447 x_min_perspective) /
2448 x_dimension_perspective) *
2450 (width / 100.) * 2. * margin_in_percent) +
2451 ((width / 100.) * margin_in_percent))
2453 <<
static_cast<unsigned int>(
2455 (height / 100.) * margin_in_percent -
2456 ((projection_decomposition[1] -
2457 y_min_perspective) /
2458 y_dimension_perspective) *
2460 (height / 100.) * 2. * margin_in_percent))
2466 const double distance_to_camera = std::sqrt(
2467 std::pow(
point[0] - camera_position[0], 2.) +
2468 std::pow(
point[1] - camera_position[1], 2.) +
2469 std::pow(
point[2] - camera_position[2], 2.));
2470 const double distance_factor =
2471 distance_to_camera /
2472 (2. *
std::max(x_dimension, y_dimension));
2474 const unsigned int font_size_this_edge =
2475 static_cast<unsigned int>(
2476 .5 + .5 * cell_label_font_size *
2478 cell->level() - 4. +
2479 3.5 * distance_factor));
2481 point[0] = cell->face(faceIndex)->center()[0];
2482 point[1] = cell->face(faceIndex)->center()[1];
2488 (
static_cast<float>(cell->level()) /
2489 static_cast<float>(n_levels)) *
2490 std::max(x_dimension, y_dimension);
2493 projection_decomposition =
2494 svg_project_point(
point,
2500 const unsigned int xc =
static_cast<unsigned int>(
2502 ((projection_decomposition[0] - x_min_perspective) /
2503 x_dimension_perspective) *
2505 (width / 100.) * 2. * margin_in_percent) +
2506 ((width / 100.) * margin_in_percent));
2507 const unsigned int yc =
static_cast<unsigned int>(
2508 .5 + height - (height / 100.) * margin_in_percent -
2509 ((projection_decomposition[1] - y_min_perspective) /
2510 y_dimension_perspective) *
2512 (height / 100.) * 2. * margin_in_percent));
2514 out <<
" <circle cx=\"" << xc <<
"\" cy=\"" << yc
2515 <<
"\" r=\"" << font_size_this_edge <<
"\" />"
2518 out <<
" <text x=\"" << xc <<
"\" y=\"" << yc
2519 <<
"\" style=\"font-size:" << font_size_this_edge
2520 <<
"px\" dominant-baseline=\"middle\">"
2521 <<
static_cast<int>(
2522 cell->face(faceIndex)->boundary_id())
2523 <<
"</text>" <<
'\n';
2535 out <<
'\n' <<
" <!-- legend -->" <<
'\n';
2537 additional_width = 0;
2539 additional_width =
static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
2547 unsigned int line_offset = 0;
2548 out <<
" <rect x=\"" << width + additional_width <<
"\" y=\""
2549 <<
static_cast<unsigned int>(.5 + (height / 100.) * margin_in_percent)
2551 <<
static_cast<unsigned int>(.5 + (height / 100.) *
2552 (40. - margin_in_percent))
2553 <<
"\" height=\"" <<
static_cast<unsigned int>(.5 + height * .215)
2556 out <<
" <text x=\""
2557 << width + additional_width +
2558 static_cast<unsigned int>(.5 + (height / 100.) * 1.25)
2560 <<
static_cast<unsigned int>(.5 +
2561 (height / 100.) * margin_in_percent +
2562 (++line_offset) * 1.5 * font_size)
2563 <<
"\" style=\"text-anchor:start; font-weight:bold; font-size:"
2564 << font_size <<
"px\">"
2566 <<
"</text>" <<
'\n';
2570 out <<
" <text x=\""
2571 << width + additional_width +
2572 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2574 <<
static_cast<unsigned int>(.5 +
2575 (height / 100.) * margin_in_percent +
2576 (++line_offset) * 1.5 * font_size)
2577 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:"
2578 << font_size <<
"px\">"
2586 out <<
"</text>" <<
'\n';
2591 out <<
" <text x=\""
2592 << width + additional_width +
2593 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2595 <<
static_cast<unsigned int>(.5 +
2596 (height / 100.) * margin_in_percent +
2597 (++line_offset) * 1.5 * font_size)
2598 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:"
2599 << font_size <<
"px\">"
2606 out <<
"</text>" <<
'\n';
2611 out <<
" <text x=\""
2612 << width + additional_width +
2613 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2615 <<
static_cast<unsigned int>(.5 +
2616 (height / 100.) * margin_in_percent +
2617 (++line_offset) * 1.5 * font_size)
2618 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:"
2619 << font_size <<
"px\">"
2626 out <<
"</text>" <<
'\n';
2631 out <<
" <text x= \""
2632 << width + additional_width +
2633 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2635 <<
static_cast<unsigned int>(.5 +
2636 (height / 100.) * margin_in_percent +
2637 (++line_offset) * 1.5 * font_size)
2638 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:"
2639 << font_size <<
"px\">"
2645 out <<
"</text>" <<
'\n';
2650 out <<
" <text x= \""
2651 << width + additional_width +
2652 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2654 <<
static_cast<unsigned int>(.5 +
2655 (height / 100.) * margin_in_percent +
2656 (++line_offset) * 1.5 * font_size)
2657 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:"
2658 << font_size <<
"px\">"
2659 <<
"level_subdomain_id"
2660 <<
"</text>" <<
'\n';
2665 out <<
" <text x=\""
2666 << width + additional_width +
2667 static_cast<unsigned int>(.5 + (height / 100.) * 1.25)
2669 <<
static_cast<unsigned int>(.5 +
2670 (height / 100.) * margin_in_percent +
2671 (++line_offset) * 1.5 * font_size)
2672 <<
"\" style=\"text-anchor:start; font-weight:bold; font-size:"
2673 << font_size <<
"px\">"
2675 <<
"</text>" <<
'\n';
2677 out <<
" <text x= \""
2678 << width + additional_width +
2679 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2681 <<
static_cast<unsigned int>(.5 +
2682 (height / 100.) * margin_in_percent +
2683 (++line_offset) * 1.5 * font_size)
2684 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:"
2685 << font_size <<
"px\">"
2687 <<
"</text>" <<
'\n';
2695 out <<
" <text x=\"" << width + additional_width <<
"\" y=\""
2696 <<
static_cast<unsigned int>(
2697 .5 + (height / 100.) * margin_in_percent + 13.75 * font_size)
2698 <<
"\" style=\"text-anchor:start; font-size:" << font_size <<
"px\">"
2707 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
2709 out <<
" <text x=\"" << width + additional_width <<
"\" y=\""
2710 <<
static_cast<unsigned int>(
2711 .5 + (height / 100.) * (margin_in_percent + 29.) -
2713 <<
"\" style=\"text-anchor:start; font-weight:bold; font-size:"
2714 << font_size <<
"px\">";
2719 out <<
"material_id";
2722 out <<
"level_number";
2725 out <<
"subdomain_id";
2728 out <<
"level_subdomain_id";
2734 out <<
"</text>" <<
'\n';
2736 unsigned int element_height =
static_cast<unsigned int>(
2737 ((height / 100.) * (71. - 2. * margin_in_percent)) / n);
2738 unsigned int element_width =
2739 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
2741 int labeling_index = 0;
2742 auto materials_it = materials.begin();
2743 auto levels_it = levels.begin();
2744 auto subdomains_it = subdomains.begin();
2745 auto level_subdomains_it = level_subdomains.begin();
2747 for (
unsigned int index = 0; index < n; index++)
2752 labeling_index = *materials_it++;
2755 labeling_index = *levels_it++;
2758 labeling_index = *subdomains_it++;
2761 labeling_index = *level_subdomains_it++;
2767 out <<
" <rect class=\"r" << labeling_index <<
"\" x=\""
2768 << width + additional_width <<
"\" y=\""
2769 <<
static_cast<unsigned int>(.5 + (height / 100.) *
2770 (margin_in_percent + 29)) +
2771 (n - index - 1) * element_height
2772 <<
"\" width=\"" << element_width <<
"\" height=\""
2773 << element_height <<
"\"/>" <<
'\n';
2775 out <<
" <text x=\""
2776 << width + additional_width + 1.5 * element_width <<
"\" y=\""
2777 <<
static_cast<unsigned int>(.5 + (height / 100.) *
2778 (margin_in_percent + 29)) +
2779 (n - index - 1 + .5) * element_height +
2780 static_cast<unsigned int>(.5 + font_size * .35)
2782 <<
" style=\"text-anchor:start; font-size:"
2783 <<
static_cast<unsigned int>(.5 + font_size) <<
"px";
2785 if (index == 0 || index == n - 1)
2786 out <<
"; font-weight:bold";
2788 out <<
"\">" << labeling_index;
2795 out <<
"</text>" <<
'\n';
2803 out <<
'\n' <<
"</svg>";
2817 template <
int dim,
int spacedim>
2820 std::ostream & out)
const
2827 const std::time_t time1 = std::time(
nullptr);
2828 const std::tm * time = std::localtime(&time1);
2832 <<
"\n# This file was generated by the deal.II library."
2833 <<
"\n# Date = " << time->tm_year + 1900 <<
"/" << std::setfill(
'0')
2834 << std::setw(2) << time->tm_mon + 1 <<
"/" << std::setfill(
'0')
2835 << std::setw(2) << time->tm_mday <<
"\n# Time = " << std::setfill(
'0')
2836 << std::setw(2) << time->tm_hour <<
":" << std::setfill(
'0')
2837 << std::setw(2) << time->tm_min <<
":" << std::setfill(
'0')
2838 << std::setw(2) << time->tm_sec <<
"\n#"
2839 <<
"\n# For a description of the MathGL script format see the MathGL manual. "
2841 <<
"\n# Note: This file is understood by MathGL v2.1 and higher only, and can "
2842 <<
"\n# be quickly viewed in a graphical environment using \'mglview\'. "
2849 const std::string axes =
"xyz";
2865 out <<
"\nsetsize 800 800";
2866 out <<
"\nrotate 0 0";
2869 out <<
"\nsetsize 800 800";
2870 out <<
"\nrotate 60 40";
2879 <<
"\n# Vertex ordering."
2880 <<
"\n# list <vertex order> <vertex indices>"
2890 out <<
"\nlist f 0 1 2 3"
2895 <<
"\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"
2904 <<
"\n# List of vertices."
2905 <<
"\n# list <id> <vertices>"
2914 for (
unsigned int i = 0; i < dim; ++i)
2921 out <<
"\nlist " << axes[i] << cell->active_cell_index() <<
" ";
2923 out << cell->vertex(j)[i] <<
" ";
2930 <<
"\n# List of cells to quadplot."
2931 <<
"\n# quadplot <vertex order> <id> <style>"
2936 out <<
"\nquadplot f ";
2937 for (
unsigned int j = 0; j < dim; ++j)
2938 out << axes[j] << i <<
" ";
2964 template <
int dim,
int spacedim,
typename ITERATOR,
typename END>
2966 generate_triangulation_patches(
2972 for (; cell !=
end; ++cell)
2980 patch.
vertices[v] = cell->vertex(v);
2981 patch.
data(0, v) = cell->level();
2983 static_cast<std::make_signed<types::manifold_id>::type
>(
2984 cell->manifold_id());
2986 static_cast<std::make_signed<types::material_id>::type
>(
2987 cell->material_id());
2988 if (cell->is_active())
2990 static_cast<std::make_signed<types::subdomain_id>::type
>(
2991 cell->subdomain_id());
2993 patch.
data(3, v) = -1;
2995 static_cast<std::make_signed<types::subdomain_id>::type
>(
2996 cell->level_subdomain_id());
2998 patches.push_back(patch);
3004 std::vector<std::string>
3005 triangulation_patch_data_names()
3007 std::vector<std::string> v(5);
3012 v[4] =
"level_subdomain";
3019 std::vector<typename Triangulation<3, 3>::active_line_iterator>
3022 std::vector<typename Triangulation<3, 3>::active_line_iterator> res;
3024 std::vector<bool> flags;
3029 for (
unsigned int l = 0; l < GeometryInfo<3>::lines_per_face; ++
l)
3031 const auto line = face->line(
l);
3032 if (line->user_flag_set() || line->has_children())
3035 line->set_user_flag();
3036 if (line->at_boundary())
3037 res.emplace_back(line);
3048 template <
int dim,
int spacedim>
3049 std::vector<typename Triangulation<dim, spacedim>::active_line_iterator>
3061 std::vector<typename Triangulation<3, 3>::active_line_iterator>
3064 std::vector<typename Triangulation<3, 3>::active_line_iterator> res;
3066 std::vector<bool> flags;
3071 for (
unsigned int l = 0; l < GeometryInfo<3>::lines_per_face; ++
l)
3073 const auto line = face->line(
l);
3074 if (line->user_flag_set() || line->has_children())
3077 line->set_user_flag();
3079 (line->boundary_id() != 0 &&
3081 res.emplace_back(line);
3091 template <
int dim,
int spacedim>
3092 std::vector<typename Triangulation<dim, spacedim>::active_line_iterator>
3103 template <
int dim,
int spacedim>
3104 std::vector<typename Triangulation<dim, spacedim>::active_face_iterator>
3107 std::vector<typename Triangulation<dim, spacedim>::active_face_iterator>
3114 res.push_back(face);
3125 template <
int dim,
int spacedim>
3126 std::vector<typename Triangulation<dim, spacedim>::active_face_iterator>
3129 std::vector<typename Triangulation<dim, spacedim>::active_face_iterator>
3136 (face->boundary_id() != 0 &&
3138 res.push_back(face);
3146 template <
int dim,
int spacedim>
3149 std::ostream & out)
const
3156 const auto n_vertices =
vertices.size();
3158 out <<
"# vtk DataFile Version 3.0\n"
3159 <<
"Triangulation generated with deal.II\n"
3161 <<
"DATASET UNSTRUCTURED_GRID\n"
3162 <<
"POINTS " << n_vertices <<
" double\n";
3168 for (
unsigned int d = spacedim + 1;
d <= 3; ++
d)
3174 get_relevant_face_iterators(tria) :
3175 get_boundary_face_iterators(tria);
3177 get_relevant_edge_iterators(tria) :
3178 get_boundary_edge_iterators(tria);
3184 "At least one of the flags (output_cells, output_faces, output_edges) has to be enabled!"));
3197 const int cells_size =
3209 out <<
"\nCELLS " <<
n_cells <<
' ' << cells_size <<
'\n';
3219 const int cell_type = (dim == 1 ? 3 : dim == 2 ? 9 : 12);
3220 const int face_type = (dim == 1 ? 1 : dim == 2 ? 3 : 9);
3221 const int co_face_type = (dim == 1 ? -1 : dim == 2 ? -1 : 3);
3227 out << GeometryInfo<dim>::vertices_per_cell;
3235 for (
const auto &face : faces)
3237 out << GeometryInfo<dim>::vertices_per_face;
3238 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_face; ++i)
3243 dim > ::ucd_to_deal[i]);
3248 for (
const auto &edge : edges)
3251 for (
unsigned int i = 0; i < 2; ++i)
3252 out <<
' ' << edge->vertex_index(i);
3257 out <<
"\nCELL_TYPES " <<
n_cells <<
'\n';
3262 out << cell_type <<
' ';
3268 for (
unsigned int i = 0; i < faces.size(); ++i)
3270 out << face_type <<
' ';
3276 for (
unsigned int i = 0; i < edges.size(); ++i)
3278 out << co_face_type <<
' ';
3281 out <<
"\n\nCELL_DATA " <<
n_cells <<
'\n'
3282 <<
"SCALARS MaterialID int 1\n"
3283 <<
"LOOKUP_TABLE default\n";
3290 out << static_cast<std::make_signed<types::material_id>::type>(
3291 cell->material_id())
3298 for (
const auto &face : faces)
3300 out << static_cast<std::make_signed<types::boundary_id>::type>(
3301 face->boundary_id())
3308 for (
const auto &edge : edges)
3310 out << static_cast<std::make_signed<types::boundary_id>::type>(
3311 edge->boundary_id())
3316 out <<
"\n\nSCALARS ManifoldID int 1\n"
3317 <<
"LOOKUP_TABLE default\n";
3324 out << static_cast<std::make_signed<types::manifold_id>::type>(
3325 cell->manifold_id())
3332 for (
const auto &face : faces)
3334 out << static_cast<std::make_signed<types::manifold_id>::type>(
3335 face->manifold_id())
3342 for (
const auto &edge : edges)
3344 out << static_cast<std::make_signed<types::manifold_id>::type>(
3345 edge->manifold_id())
3358 template <
int dim,
int spacedim>
3361 std::ostream & out)
const
3369 std::vector<DataOutBase::Patch<dim, spacedim>> patches;
3371 generate_triangulation_patches(patches, tria.
begin_active(), tria.
end());
3376 triangulation_patch_data_names(),
3378 std::tuple<
unsigned int,
3386 out <<
" </UnstructuredGrid>\n";
3387 out <<
"<dealiiData encoding=\"base64\">";
3388 std::stringstream outstring;
3389 boost::archive::binary_oarchive ia(outstring);
3393 out <<
"\n</dealiiData>\n";
3394 out <<
"</VTKFile>\n";
3405 template <
int dim,
int spacedim>
3409 const std::string & filename_without_extension,
3410 const bool view_levels,
3411 const bool include_artificial)
const
3413 std::vector<DataOutBase::Patch<dim, spacedim>> patches;
3414 const unsigned int n_datasets = 4;
3415 std::vector<std::string> data_names;
3416 data_names.emplace_back(
"level");
3417 data_names.emplace_back(
"subdomain");
3418 data_names.emplace_back(
"level_subdomain");
3419 data_names.emplace_back(
"proc_writing");
3427 if (cell->has_children())
3429 if (!include_artificial &&
3433 else if (!include_artificial)
3435 if (cell->has_children() &&
3438 else if (cell->is_active() &&
3439 cell->level_subdomain_id() ==
3449 for (
unsigned int vertex = 0; vertex < n_q_points; ++vertex)
3451 patch.
vertices[vertex] = cell->vertex(vertex);
3452 patch.
data(0, vertex) = cell->level();
3453 if (cell->is_active())
3454 patch.
data(1, vertex) =
static_cast<double>(
3455 static_cast<std::make_signed<types::subdomain_id>::type
>(
3456 cell->subdomain_id()));
3458 patch.
data(1, vertex) = -1.0;
3459 patch.
data(2, vertex) =
static_cast<double>(
3460 static_cast<std::make_signed<types::subdomain_id>::type
>(
3461 cell->level_subdomain_id()));
3467 patches.push_back(patch);
3473 std::string new_file = filename_without_extension +
".vtu";
3477 new_file = filename_without_extension +
".proc" +
3482 if (tr->locally_owned_subdomain() == 0)
3484 std::vector<std::string> filenames;
3489 std::size_t pos = filename_without_extension.find_last_of(
'/');
3490 if (pos == std::string::npos)
3494 const unsigned int n_procs =
3496 for (
unsigned int i = 0; i < n_procs; ++i)
3497 filenames.push_back(filename_without_extension.substr(pos) +
3501 const std::string pvtu_master_filename =
3502 (filename_without_extension +
".pvtu");
3503 std::ofstream pvtu_master(pvtu_master_filename.c_str());
3510 Vector<float> dummy_vector(tr->n_active_cells());
3522 std::ofstream out(new_file.c_str());
3524 std::tuple<
unsigned int,
3586 template <
int dim,
int spacedim>
3591 unsigned int n_faces = 0;
3594 if ((face->at_boundary()) && (face->boundary_id() != 0))
3602 template <
int dim,
int spacedim>
3609 std::vector<bool> line_flags;
3613 .clear_user_flags_line();
3615 unsigned int n_lines = 0;
3618 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++
l)
3619 if (cell->line(
l)->at_boundary() && (cell->line(
l)->boundary_id() != 0) &&
3620 (cell->line(
l)->user_flag_set() ==
false))
3623 cell->line(
l)->set_user_flag();
3638 const unsigned int next_element_index,
3639 std::ostream &)
const
3641 return next_element_index;
3647 const unsigned int next_element_index,
3648 std::ostream &)
const
3650 return next_element_index;
3655 const unsigned int next_element_index,
3656 std::ostream &)
const
3658 return next_element_index;
3664 const unsigned int next_element_index,
3665 std::ostream &)
const
3667 return next_element_index;
3672 const unsigned int next_element_index,
3673 std::ostream &)
const
3675 return next_element_index;
3681 const unsigned int next_element_index,
3682 std::ostream &)
const
3684 return next_element_index;
3690 const unsigned int next_element_index,
3691 std::ostream &)
const
3693 return next_element_index;
3698 const unsigned int next_element_index,
3699 std::ostream &)
const
3701 return next_element_index;
3706 template <
int dim,
int spacedim>
3709 const unsigned int next_element_index,
3710 std::ostream & out)
const
3712 unsigned int current_element_index = next_element_index;
3715 if (face->at_boundary() && (face->boundary_id() != 0))
3717 out << current_element_index <<
' ';
3729 out << static_cast<unsigned int>(face->boundary_id()) <<
' '
3730 <<
static_cast<unsigned int>(face->boundary_id()) <<
' '
3733 for (
unsigned int vertex = 0;
3734 vertex < GeometryInfo<dim>::vertices_per_face;
3737 << face->vertex_index(
3742 ++current_element_index;
3744 return current_element_index;
3748 template <
int dim,
int spacedim>
3751 const unsigned int next_element_index,
3752 std::ostream & out)
const
3754 unsigned int current_element_index = next_element_index;
3759 std::vector<bool> line_flags;
3763 .clear_user_flags_line();
3766 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++
l)
3767 if (cell->line(
l)->at_boundary() && (cell->line(
l)->boundary_id() != 0) &&
3768 (cell->line(
l)->user_flag_set() ==
false))
3770 out << next_element_index <<
" 1 ";
3771 out << static_cast<unsigned int>(cell->line(
l)->boundary_id()) <<
' '
3772 <<
static_cast<unsigned int>(cell->line(
l)->boundary_id())
3775 for (
unsigned int vertex = 0; vertex < 2; ++vertex)
3777 << cell->line(
l)->vertex_index(
3785 ++current_element_index;
3786 cell->line(
l)->set_user_flag();
3794 return current_element_index;
3801 const unsigned int next_element_index,
3802 std::ostream &)
const
3804 return next_element_index;
3809 const unsigned int next_element_index,
3810 std::ostream &)
const
3812 return next_element_index;
3817 const unsigned int next_element_index,
3818 std::ostream &)
const
3820 return next_element_index;
3825 const unsigned int next_element_index,
3826 std::ostream &)
const
3828 return next_element_index;
3833 const unsigned int next_element_index,
3834 std::ostream &)
const
3836 return next_element_index;
3842 const unsigned int next_element_index,
3843 std::ostream &)
const
3845 return next_element_index;
3851 const unsigned int next_element_index,
3852 std::ostream &)
const
3854 return next_element_index;
3859 const unsigned int next_element_index,
3860 std::ostream &)
const
3862 return next_element_index;
3867 template <
int dim,
int spacedim>
3870 const unsigned int next_element_index,
3871 std::ostream & out)
const
3873 unsigned int current_element_index = next_element_index;
3877 if (face->at_boundary() && (face->boundary_id() != 0))
3879 out << current_element_index <<
" "
3880 <<
static_cast<unsigned int>(face->boundary_id()) <<
" ";
3893 for (
unsigned int vertex = 0;
3894 vertex < GeometryInfo<dim>::vertices_per_face;
3896 out << face->vertex_index(
3902 ++current_element_index;
3904 return current_element_index;
3909 template <
int dim,
int spacedim>
3912 const unsigned int next_element_index,
3913 std::ostream & out)
const
3915 unsigned int current_element_index = next_element_index;
3920 std::vector<bool> line_flags;
3924 .clear_user_flags_line();
3927 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++
l)
3928 if (cell->line(
l)->at_boundary() && (cell->line(
l)->boundary_id() != 0) &&
3929 (cell->line(
l)->user_flag_set() ==
false))
3931 out << current_element_index <<
" "
3932 <<
static_cast<unsigned int>(cell->line(
l)->boundary_id())
3935 for (
unsigned int vertex = 0; vertex < 2; ++vertex)
3936 out << cell->line(
l)->vertex_index(
3945 ++current_element_index;
3946 cell->line(
l)->set_user_flag();
3953 return current_element_index;
3970 template <
int spacedim>
3974 while (points.size() > 2)
3977 first_difference /= first_difference.
norm();
3979 second_difference /= second_difference.
norm();
3981 if ((first_difference - second_difference).
norm() < 1
e-10)
3982 points.erase(points.begin() + 1);
3990 template <
int spacedim>
3999 for (
const auto &cell : tria.active_cell_iterators())
4002 out <<
"# cell " << cell <<
'\n';
4004 out << cell->vertex(0) <<
' ' << cell->level() <<
' '
4005 << cell->material_id() <<
'\n'
4006 << cell->vertex(1) <<
' ' << cell->level() <<
' '
4007 << cell->material_id() <<
'\n'
4020 template <
int spacedim>
4031 const unsigned int n_additional_points =
4033 const unsigned int n_points = 2 + n_additional_points;
4038 std::vector<
Point<dim - 1>> boundary_points;
4039 if (mapping !=
nullptr)
4041 boundary_points.resize(n_points);
4042 boundary_points[0][0] = 0;
4043 boundary_points[n_points - 1][0] = 1;
4044 for (
unsigned int i = 1; i < n_points - 1; ++i)
4045 boundary_points[i](0) = 1. * i / (n_points - 1);
4047 std::vector<double> dummy_weights(n_points, 1. / n_points);
4048 Quadrature<dim - 1> quadrature(boundary_points, dummy_weights);
4053 for (
const auto &cell : tria.active_cell_iterators())
4056 out <<
"# cell " << cell <<
'\n';
4058 if (mapping ==
nullptr ||
4070 << cell->level() <<
' ' << cell->material_id() <<
'\n';
4071 out << cell->vertex(0) <<
' ' << cell->level() <<
' '
4072 << cell->material_id() <<
'\n'
4080 for (
const unsigned int face_no :
4084 spacedim>::face_iterator
4085 face = cell->face(face_no);
4086 if (dim != spacedim || face->at_boundary() ||
4092 std::vector<Point<spacedim>> line_points;
4095 const unsigned int offset = face_no * n_points;
4096 for (
unsigned int i = 0; i < n_points; ++i)
4097 line_points.push_back(
4099 cell, q_projector.
point(offset + i)));
4100 internal::remove_colinear_points(line_points);
4103 out <<
point <<
' ' << cell->level() <<
' '
4104 << cell->material_id() <<
'\n';
4106 out <<
'\n' <<
'\n';
4112 out << face->vertex(0) <<
' ' << cell->level() <<
' '
4113 << cell->material_id() <<
'\n'
4114 << face->vertex(1) <<
' ' << cell->level() <<
' '
4115 << cell->material_id() <<
'\n'
4131 template <
int spacedim>
4142 const unsigned int n_additional_points =
4144 const unsigned int n_points = 2 + n_additional_points;
4149 std::vector<Point<1>> boundary_points;
4150 if (mapping !=
nullptr)
4152 boundary_points.resize(n_points);
4153 boundary_points[0][0] = 0;
4154 boundary_points[n_points - 1][0] = 1;
4155 for (
unsigned int i = 1; i < n_points - 1; ++i)
4156 boundary_points[i](0) = 1. * i / (n_points - 1);
4158 std::vector<double> dummy_weights(n_points, 1. / n_points);
4162 QIterated<dim - 1> quadrature(quadrature1d, 1);
4167 for (
const auto &cell : tria.active_cell_iterators())
4170 out <<
"# cell " << cell <<
'\n';
4172 if (mapping ==
nullptr || n_points == 2 ||
4173 (!cell->has_boundary_lines() &&
4177 out << cell->vertex(0) <<
' ' << cell->level() <<
' '
4178 << cell->material_id() <<
'\n'
4179 << cell->vertex(1) <<
' ' << cell->level() <<
' '
4180 << cell->material_id() <<
'\n'
4181 << cell->vertex(5) <<
' ' << cell->level() <<
' '
4182 << cell->material_id() <<
'\n'
4183 << cell->vertex(4) <<
' ' << cell->level() <<
' '
4184 << cell->material_id() <<
'\n'
4185 << cell->vertex(0) <<
' ' << cell->level() <<
' '
4186 << cell->material_id() <<
'\n'
4189 out << cell->vertex(2) <<
' ' << cell->level() <<
' '
4190 << cell->material_id() <<
'\n'
4191 << cell->vertex(3) <<
' ' << cell->level() <<
' '
4192 << cell->material_id() <<
'\n'
4193 << cell->vertex(7) <<
' ' << cell->level() <<
' '
4194 << cell->material_id() <<
'\n'
4195 << cell->vertex(6) <<
' ' << cell->level() <<
' '
4196 << cell->material_id() <<
'\n'
4197 << cell->vertex(2) <<
' ' << cell->level() <<
' '
4198 << cell->material_id() <<
'\n'
4202 out << cell->vertex(0) <<
' ' << cell->level() <<
' '
4203 << cell->material_id() <<
'\n'
4204 << cell->vertex(2) <<
' ' << cell->level() <<
' '
4205 << cell->material_id() <<
'\n'
4207 out << cell->vertex(1) <<
' ' << cell->level() <<
' '
4208 << cell->material_id() <<
'\n'
4209 << cell->vertex(3) <<
' ' << cell->level() <<
' '
4210 << cell->material_id() <<
'\n'
4212 out << cell->vertex(5) <<
' ' << cell->level() <<
' '
4213 << cell->material_id() <<
'\n'
4214 << cell->vertex(7) <<
' ' << cell->level() <<
' '
4215 << cell->material_id() <<
'\n'
4217 out << cell->vertex(4) <<
' ' << cell->level() <<
' '
4218 << cell->material_id() <<
'\n'
4219 << cell->vertex(6) <<
' ' << cell->level() <<
' '
4220 << cell->material_id() <<
'\n'
4225 for (
const unsigned int face_no :
4229 spacedim>::face_iterator
4230 face = cell->face(face_no);
4232 if (face->at_boundary() &&
4235 const unsigned int offset = face_no * n_points * n_points;
4236 for (
unsigned int i = 0; i < n_points - 1; ++i)
4237 for (
unsigned int j = 0; j < n_points - 1; ++j)
4242 q_projector->
point(offset + i * n_points + j));
4243 out << p0 <<
' ' << cell->level() <<
' '
4244 << cell->material_id() <<
'\n';
4248 offset + (i + 1) * n_points + j)))
4249 <<
' ' << cell->level() <<
' '
4250 << cell->material_id() <<
'\n';
4254 offset + (i + 1) * n_points + j + 1)))
4255 <<
' ' << cell->level() <<
' '
4256 << cell->material_id() <<
'\n';
4259 q_projector->
point(offset + i * n_points +
4261 <<
' ' << cell->level() <<
' '
4262 << cell->material_id() <<
'\n';
4264 out << p0 <<
' ' << cell->level() <<
' '
4265 << cell->material_id() <<
'\n';
4266 out <<
'\n' <<
'\n';
4271 for (
unsigned int l = 0;
4272 l < GeometryInfo<dim>::lines_per_face;
4275 const typename ::Triangulation<dim, spacedim>::
4276 line_iterator line = face->line(
l);
4279 &v1 = line->vertex(1);
4280 if (line->at_boundary() ||
4286 std::vector<Point<spacedim>> line_points;
4295 for (
unsigned int i = 0; i < n_points; ++i)
4296 line_points.push_back(
4299 (1 - boundary_points[i][0]) * u0 +
4300 boundary_points[i][0] * u1));
4301 internal::remove_colinear_points(line_points);
4303 out <<
point <<
' ' << cell->level() <<
' '
4304 <<
static_cast<unsigned int>(
4305 cell->material_id())
4309 out << v0 <<
' ' << cell->level() <<
' '
4310 << cell->material_id() <<
'\n'
4311 << v1 <<
' ' << cell->level() <<
' '
4312 << cell->material_id() <<
'\n';
4314 out <<
'\n' <<
'\n';
4321 if (q_projector !=
nullptr)
4335 template <
int dim,
int spacedim>
4359 const unsigned int l)
4379 write_eps(const ::Triangulation<1, 2> &,
4389 write_eps(const ::Triangulation<1, 3> &,
4399 write_eps(const ::Triangulation<2, 3> &,
4410 template <
int dim,
int spacedim>
4412 write_eps(const ::Triangulation<dim, spacedim> &tria,
4418 using LineList = std::list<LineEntry>;
4458 for (
const auto &cell : tria.active_cell_iterators())
4459 for (
unsigned int line_no = 0;
4460 line_no < GeometryInfo<dim>::lines_per_cell;
4463 typename ::Triangulation<dim, spacedim>::line_iterator
4464 line = cell->line(line_no);
4476 if (!line->has_children() &&
4477 (mapping ==
nullptr || !line->at_boundary()))
4497 line_list.emplace_back(
4498 Point<2>(line->vertex(0)(0), line->vertex(0)(1)),
4499 Point<2>(line->vertex(1)(0), line->vertex(1)(1)),
4500 line->user_flag_set(),
4510 if (mapping !=
nullptr)
4517 std::vector<
Point<dim - 1>> boundary_points(n_points);
4519 for (
unsigned int i = 0; i < n_points; ++i)
4520 boundary_points[i](0) = 1. * (i + 1) / (n_points + 1);
4522 Quadrature<dim - 1> quadrature(boundary_points);
4530 for (
const auto &cell : tria.active_cell_iterators())
4531 for (
const unsigned int face_no :
4534 const typename ::Triangulation<dim, spacedim>::
4535 face_iterator face = cell->face(face_no);
4537 if (face->at_boundary())
4547 const unsigned int offset = face_no * n_points;
4548 for (
unsigned int i = 0; i < n_points; ++i)
4552 cell, q_projector.
point(offset + i)));
4553 const Point<2> p1(p1_dim(0), p1_dim(1));
4555 line_list.emplace_back(p0,
4557 face->user_flag_set(),
4564 const Point<2> p1(p1_dim(0), p1_dim(1));
4565 line_list.emplace_back(p0,
4567 face->user_flag_set(),
4602 const double turn_angle = eps_flags_3.
turn_angle;
4604 -std::sin(z_angle * 2. * pi / 360.) *
4605 std::sin(turn_angle * 2. * pi / 360.),
4606 +std::sin(z_angle * 2. * pi / 360.) *
4607 std::cos(turn_angle * 2. * pi / 360.),
4608 -std::cos(z_angle * 2. * pi / 360.));
4616 ((
Point<dim>(0, 0, 1) * view_direction) * view_direction);
4625 ((
Point<dim>(1, 0, 0) * view_direction) * view_direction) -
4626 ((
Point<dim>(1, 0, 0) * unit_vector1) * unit_vector1));
4630 for (
const auto &cell : tria.active_cell_iterators())
4631 for (
unsigned int line_no = 0;
4632 line_no < GeometryInfo<dim>::lines_per_cell;
4635 typename ::Triangulation<dim, spacedim>::line_iterator
4636 line = cell->line(line_no);
4637 line_list.emplace_back(
4638 Point<2>(line->vertex(0) * unit_vector2,
4639 line->vertex(0) * unit_vector1),
4640 Point<2>(line->vertex(1) * unit_vector2,
4641 line->vertex(1) * unit_vector1),
4642 line->user_flag_set(),
4658 double x_min = tria.begin_active()->vertex(0)(0);
4659 double x_max = x_min;
4660 double y_min = tria.begin_active()->vertex(0)(1);
4661 double y_max = y_min;
4662 unsigned int max_level = line_list.begin()->level;
4664 for (LineList::const_iterator line = line_list.begin();
4665 line != line_list.end();
4668 x_min =
std::min(x_min, line->first(0));
4669 x_min =
std::min(x_min, line->second(0));
4671 x_max =
std::max(x_max, line->first(0));
4672 x_max =
std::max(x_max, line->second(0));
4674 y_min =
std::min(y_min, line->first(1));
4675 y_min =
std::min(y_min, line->second(1));
4677 y_max =
std::max(y_max, line->first(1));
4678 y_max =
std::max(y_max, line->second(1));
4680 max_level =
std::max(max_level, line->level);
4688 const double scale =
4689 (eps_flags_base.
size /
4700 std::time_t time1 = std::time(
nullptr);
4701 std::tm * time = std::localtime(&time1);
4702 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n'
4703 <<
"%%Title: deal.II Output" <<
'\n'
4704 <<
"%%Creator: the deal.II library" <<
'\n'
4705 <<
"%%Creation Date: " << time->tm_year + 1900 <<
"/"
4706 << time->tm_mon + 1 <<
"/" << time->tm_mday <<
" - "
4707 << time->tm_hour <<
":" << std::setw(2) << time->tm_min <<
":"
4708 << std::setw(2) << time->tm_sec <<
'\n'
4709 <<
"%%BoundingBox: "
4713 <<
static_cast<unsigned int>(
4716 <<
static_cast<unsigned int>(
4726 out <<
"/m {moveto} bind def" <<
'\n'
4727 <<
"/x {lineto stroke} bind def" <<
'\n'
4728 <<
"/b {0 0 0 setrgbcolor} def" <<
'\n'
4729 <<
"/r {1 0 0 setrgbcolor} def" <<
'\n';
4736 out <<
"/l { neg " << (max_level) <<
" add "
4737 << (0.66666 /
std::max(1
U, (max_level - 1)))
4738 <<
" mul 1 0.8 sethsbcolor} def" <<
'\n';
4752 << (
"/R {rmoveto} bind def\n"
4753 "/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont\n"
4754 "dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall\n"
4755 "currentdict end definefont\n"
4756 "/MFshow {{dup dup 0 get findfont exch 1 get scalefont setfont\n"
4757 "[ currentpoint ] exch dup 2 get 0 exch rmoveto dup dup 5 get exch 4 get\n"
4758 "{show} {stringwidth pop 0 rmoveto}ifelse dup 3 get\n"
4759 "{2 get neg 0 exch rmoveto pop} {pop aload pop moveto}ifelse} forall} bind def\n"
4760 "/MFwidth {0 exch {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n"
4761 "5 get stringwidth pop add}\n"
4762 "{pop} ifelse} forall} bind def\n"
4763 "/MCshow { currentpoint stroke m\n"
4764 "exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n")
4768 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4771 out << eps_flags_base.
line_width <<
" setlinewidth" <<
'\n';
4775 const Point<2> offset(x_min, y_min);
4777 for (LineList::const_iterator line = line_list.begin();
4778 line != line_list.end();
4781 out << line->level <<
" l " << (line->first - offset) *
scale <<
" m "
4782 << (line->second - offset) *
scale <<
" x" <<
'\n';
4787 << (line->first - offset) *
scale <<
" m "
4788 << (line->second - offset) *
scale <<
" x" <<
'\n';
4794 out <<
"(Helvetica) findfont 140 scalefont setfont" <<
'\n';
4796 for (
const auto &cell : tria.active_cell_iterators())
4798 out << (cell->center()(0) - offset(0)) *
scale <<
' '
4799 << (cell->center()(1) - offset(1)) *
scale <<
" m" <<
'\n'
4800 <<
"[ [(Helvetica) 12.0 0.0 true true (";
4804 out << cell->index();
4807 <<
"] -6 MCshow" <<
'\n';
4814 out <<
"(Helvetica) findfont 140 scalefont setfont" <<
'\n';
4820 std::set<unsigned int> treated_vertices;
4821 for (
const auto &cell : tria.active_cell_iterators())
4822 for (
const unsigned int vertex :
4824 if (treated_vertices.find(cell->vertex_index(vertex)) ==
4825 treated_vertices.end())
4827 treated_vertices.insert(cell->vertex_index(vertex));
4829 out << (cell->vertex(vertex)(0) - offset(0)) *
scale <<
' '
4830 << (cell->vertex(vertex)(1) - offset(1)) *
scale <<
" m"
4832 <<
"[ [(Helvetica) 10.0 0.0 true true ("
4833 << cell->vertex_index(vertex) <<
")] "
4834 <<
"] -6 MCshow" <<
'\n';
4838 out <<
"showpage" <<
'\n';
4850 template <
int dim,
int spacedim>
4860 template <
int dim,
int spacedim>
4867 switch (output_format)
4917 template <
int dim,
int spacedim>
4928 #include "grid_out.inst"