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");
98 Msh::Msh(
const bool write_faces,
const bool write_lines)
99 : write_faces(write_faces)
100 , write_lines(write_lines)
120 const bool write_faces,
121 const bool 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)
163 :
Gnuplot(flags.write_cell_numbers,
164 flags.n_extra_curved_line_points,
165 flags.curved_inner_cells,
166 flags.write_additional_boundary_lines)
201 const unsigned int size,
202 const double line_width,
203 const bool color_lines_on_user_flag,
204 const unsigned int n_boundary_face_points,
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,
266 const double line_width,
267 const bool color_lines_on_user_flag,
268 const unsigned int n_boundary_face_points)
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 <<
' ' << 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';
948 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
951 <<
static_cast<std::make_signed<types::boundary_id>::type
>(
952 cell->face(f)->boundary_id());
956 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
960 out <<
"object \"face measure\" class array type float rank 0 items " 961 << n_faces <<
" data follows" <<
'\n';
964 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell;
966 out <<
' ' << cell->face(f)->measure();
969 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
974 out <<
"object \"face diameter\" class array type float rank 0 items " 975 << n_faces <<
" data follows" <<
'\n';
978 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell;
980 out <<
' ' << cell->face(f)->diameter();
983 out <<
"attribute \"dep\" string \"connections\"" <<
'\n' <<
'\n';
997 out <<
"object \"deal data\" class field" <<
'\n' 998 <<
"component \"positions\" value \"vertices\"" <<
'\n' 999 <<
"component \"connections\" value \"cells\"" <<
'\n';
1003 out <<
"object \"cell data\" class field" <<
'\n' 1004 <<
"component \"positions\" value \"vertices\"" <<
'\n' 1005 <<
"component \"connections\" value \"cells\"" <<
'\n';
1006 out <<
"component \"material\" value \"material\"" <<
'\n';
1007 out <<
"component \"level\" value \"level\"" <<
'\n';
1009 out <<
"component \"measure\" value \"measure\"" <<
'\n';
1011 out <<
"component \"diameter\" value \"diameter\"" <<
'\n';
1016 out <<
"object \"face data\" class field" <<
'\n' 1017 <<
"component \"positions\" value \"vertices\"" <<
'\n' 1018 <<
"component \"connections\" value \"faces\"" <<
'\n';
1019 out <<
"component \"boundary\" value \"boundary\"" <<
'\n';
1021 out <<
"component \"measure\" value \"face measure\"" <<
'\n';
1023 out <<
"component \"diameter\" value \"face diameter\"" <<
'\n';
1026 out <<
'\n' <<
"object \"grid data\" class group" <<
'\n';
1028 out <<
"member \"cells\" value \"cell data\"" <<
'\n';
1030 out <<
"member \"faces\" value \"face data\"" <<
'\n';
1031 out <<
"end" <<
'\n';
1042 template <
int dim,
int spacedim>
1045 std::ostream & out)
const 1052 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
1078 out <<
"@f$NOD" <<
'\n' << n_vertices <<
'\n';
1083 for (
unsigned int i = 0; i < vertices.size(); ++i)
1087 <<
" " << vertices[i];
1088 for (
unsigned int d = spacedim + 1; d <= 3; ++d)
1094 out <<
"@f$ENDNOD" <<
'\n' 1133 unsigned int elm_type;
1153 out << cell->active_cell_index() + 1 <<
' ' << elm_type <<
' ' 1154 <<
static_cast<unsigned int>(cell->material_id()) <<
' ' 1160 for (
unsigned int vertex = 0;
1161 vertex < GeometryInfo<dim>::vertices_per_cell;
1179 out <<
"@f$ENDELM\n";
1189 template <
int dim,
int spacedim>
1192 std::ostream & out)
const 1199 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
1215 std::time_t time1 = std::time(
nullptr);
1216 std::tm * time = std::localtime(&time1);
1218 <<
"# This file was generated by the deal.II library." <<
'\n' 1219 <<
"# Date = " << time->tm_year + 1900 <<
"/" << time->tm_mon + 1
1220 <<
"/" << time->tm_mday <<
'\n' 1221 <<
"# Time = " << time->tm_hour <<
":" << std::setw(2) << time->tm_min
1222 <<
":" << std::setw(2) << time->tm_sec <<
'\n' 1224 <<
"# For a description of the UCD format see the AVS Developer's guide." 1230 out << n_vertices <<
' ' 1240 for (
unsigned int i = 0; i < vertices.size(); ++i)
1244 <<
" " << vertices[i];
1245 for (
unsigned int d = spacedim + 1; d <= 3; ++d)
1254 out << cell->active_cell_index() + 1 <<
' ' 1255 <<
static_cast<unsigned int>(cell->material_id()) <<
' ';
1286 for (
unsigned int vertex = 0;
1287 vertex < GeometryInfo<dim>::vertices_per_cell;
1314 template <
int dim,
int spacedim>
1332 const int spacedim = 2;
1338 out <<
"#FIG 3.2\nLandscape\nCenter\nInches" << std::endl
1339 <<
"A4\n100.00\nSingle" 1342 <<
"-3" << std::endl
1343 <<
"# generated by deal.II GridOut class" << std::endl
1344 <<
"# reduce first number to scale up image" << std::endl
1345 <<
"1200 2" << std::endl;
1348 unsigned int colno = 32;
1349 out <<
"0 " << colno++ <<
" #ff0000" << std::endl;
1350 out <<
"0 " << colno++ <<
" #ff8000" << std::endl;
1351 out <<
"0 " << colno++ <<
" #ffd000" << std::endl;
1352 out <<
"0 " << colno++ <<
" #ffff00" << std::endl;
1353 out <<
"0 " << colno++ <<
" #c0ff00" << std::endl;
1354 out <<
"0 " << colno++ <<
" #80ff00" << std::endl;
1355 out <<
"0 " << colno++ <<
" #00f000" << std::endl;
1356 out <<
"0 " << colno++ <<
" #00f0c0" << std::endl;
1357 out <<
"0 " << colno++ <<
" #00f0ff" << std::endl;
1358 out <<
"0 " << colno++ <<
" #00c0ff" << std::endl;
1359 out <<
"0 " << colno++ <<
" #0080ff" << std::endl;
1360 out <<
"0 " << colno++ <<
" #0040ff" << std::endl;
1361 out <<
"0 " << colno++ <<
" #0000c0" << std::endl;
1362 out <<
"0 " << colno++ <<
" #5000ff" << std::endl;
1363 out <<
"0 " << colno++ <<
" #8000ff" << std::endl;
1364 out <<
"0 " << colno++ <<
" #b000ff" << std::endl;
1365 out <<
"0 " << colno++ <<
" #ff00ff" << std::endl;
1366 out <<
"0 " << colno++ <<
" #ff80ff" << std::endl;
1368 for (
unsigned int i = 0; i < 8; ++i)
1369 out <<
"0 " << colno++ <<
" #" << std::hex << 32 * i + 31 << 32 * i + 31
1370 << 32 * i + 31 << std::dec << std::endl;
1372 for (
unsigned int i = 1; i < 16; ++i)
1373 out <<
"0 " << colno++ <<
" #00" << std::hex << 16 * i + 15 << std::dec
1374 <<
"00" << std::endl;
1376 for (
unsigned int i = 1; i < 16; ++i)
1377 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 << 16 * i + 15
1378 << std::dec <<
"00" << std::endl;
1380 for (
unsigned int i = 1; i < 16; ++i)
1381 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 << std::dec
1382 <<
"0000" << std::endl;
1384 for (
unsigned int i = 1; i < 16; ++i)
1385 out <<
"0 " << colno++ <<
" #" << std::hex << 16 * i + 15 <<
"00" 1386 << 16 * i + 15 << std::dec << std::endl;
1388 for (
unsigned int i = 1; i < 16; ++i)
1389 out <<
"0 " << colno++ <<
" #0000" << std::hex << 16 * i + 15 << std::dec
1392 for (
unsigned int i = 1; i < 16; ++i)
1393 out <<
"0 " << colno++ <<
" #00" << std::hex << 16 * i + 15 << 16 * i + 15
1394 << std::dec << std::endl;
1404 for (; cell != end; ++cell)
1419 out << static_cast<unsigned int>(cell->material_id()) + 32;
1422 out << cell->level() + 8;
1425 out << cell->subdomain_id() + 32;
1428 out << cell->level_subdomain_id() + 32;
1437 (900 + cell->material_id()))
1443 << nv + 1 << std::endl;
1449 for (
unsigned int k = 0; k <= nv; ++k)
1453 for (
unsigned int d = 0; d < static_cast<unsigned int>(dim); ++
d)
1457 out <<
'\t' << ((
d == 0) ? val : -val);
1462 static const unsigned int face_reorder[4] = {2, 1, 3, 0};
1464 for (
const unsigned int f : face_reorder)
1492 for (
unsigned int k = 0;
1493 k < GeometryInfo<dim>::vertices_per_face;
1497 for (
unsigned int d = 0; d < static_cast<unsigned int>(dim);
1503 out <<
'\t' << ((
d == 0) ? val : -val);
1520 template <
int dim,
int spacedim>
1523 std::ostream & )
const 1534 unsigned int min_level, max_level;
1542 Assert(height != 0 || width != 0,
1543 ExcMessage(
"You have to set at least one of width and height"));
1545 unsigned int margin_in_percent = 0;
1547 margin_in_percent = 8;
1550 unsigned int cell_label_font_size;
1567 float x_max_perspective, x_min_perspective;
1568 float y_max_perspective, y_min_perspective;
1570 float x_dimension_perspective, y_dimension_perspective;
1574 double x_min = tria.
begin()->vertex(0)[0];
1575 double x_max = x_min;
1576 double y_min = tria.
begin()->vertex(0)[1];
1577 double y_max = y_min;
1579 double x_dimension, y_dimension;
1581 min_level = max_level = tria.
begin()->level();
1584 std::set<unsigned int> materials;
1587 std::set<unsigned int> levels;
1590 std::set<unsigned int> subdomains;
1593 std::set<int> level_subdomains;
1601 for (
unsigned int vertex_index = 0; vertex_index < 4; vertex_index++)
1603 if (cell->vertex(vertex_index)[0] < x_min)
1604 x_min = cell->vertex(vertex_index)[0];
1605 if (cell->vertex(vertex_index)[0] > x_max)
1606 x_max = cell->vertex(vertex_index)[0];
1608 if (cell->vertex(vertex_index)[1] < y_min)
1609 y_min = cell->vertex(vertex_index)[1];
1610 if (cell->vertex(vertex_index)[1] > y_max)
1611 y_max = cell->vertex(vertex_index)[1];
1614 if (static_cast<unsigned int>(cell->level()) < min_level)
1615 min_level = cell->level();
1616 if (static_cast<unsigned int>(cell->level()) > max_level)
1617 max_level = cell->level();
1619 materials.insert(cell->material_id());
1620 levels.insert(cell->level());
1622 subdomains.insert(cell->subdomain_id() + 2);
1623 level_subdomains.insert(cell->level_subdomain_id() + 2);
1626 x_dimension = x_max - x_min;
1627 y_dimension = y_max - y_min;
1630 const unsigned int n_materials = materials.size();
1633 const unsigned int n_levels = levels.size();
1636 const unsigned int n_subdomains = subdomains.size();
1639 const unsigned int n_level_subdomains = level_subdomains.size();
1653 n = n_level_subdomains;
1660 camera_position[0] = 0;
1661 camera_position[1] = 0;
1662 camera_position[2] = 2. * std::max(x_dimension, y_dimension);
1664 camera_direction[0] = 0;
1665 camera_direction[1] = 0;
1666 camera_direction[2] = -1;
1668 camera_horizontal[0] = 1;
1669 camera_horizontal[1] = 0;
1670 camera_horizontal[2] = 0;
1672 camera_focus = .5 * std::max(x_dimension, y_dimension);
1678 const double angle_factor = 3.14159265 / 180.;
1681 camera_position_temp[1] =
1684 camera_position_temp[2] =
1688 camera_direction_temp[1] =
1691 camera_direction_temp[2] =
1695 camera_horizontal_temp[1] =
1698 camera_horizontal_temp[2] =
1702 camera_position[1] = camera_position_temp[1];
1703 camera_position[2] = camera_position_temp[2];
1705 camera_direction[1] = camera_direction_temp[1];
1706 camera_direction[2] = camera_direction_temp[2];
1708 camera_horizontal[1] = camera_horizontal_temp[1];
1709 camera_horizontal[2] = camera_horizontal_temp[2];
1712 camera_position_temp[0] =
1715 camera_position_temp[1] =
1719 camera_direction_temp[0] =
1722 camera_direction_temp[1] =
1726 camera_horizontal_temp[0] =
1729 camera_horizontal_temp[1] =
1733 camera_position[0] = camera_position_temp[0];
1734 camera_position[1] = camera_position_temp[1];
1736 camera_direction[0] = camera_direction_temp[0];
1737 camera_direction[1] = camera_direction_temp[1];
1739 camera_horizontal[0] = camera_horizontal_temp[0];
1740 camera_horizontal[1] = camera_horizontal_temp[1];
1743 camera_position[0] = x_min + .5 * x_dimension;
1744 camera_position[1] = y_min + .5 * y_dimension;
1746 camera_position[0] += 2. * std::max(x_dimension, y_dimension) *
1749 camera_position[1] -= 2. * std::max(x_dimension, y_dimension) *
1756 point[0] = tria.
begin()->vertex(0)[0];
1757 point[1] = tria.
begin()->vertex(0)[1];
1760 float min_level_min_vertex_distance = 0;
1765 (
static_cast<float>(tria.
begin()->level()) /
1766 static_cast<float>(n_levels)) *
1767 std::max(x_dimension, y_dimension);
1771 point, camera_position, camera_direction, camera_horizontal, camera_focus);
1773 x_max_perspective = projection_decomposition[0];
1774 x_min_perspective = projection_decomposition[0];
1776 y_max_perspective = projection_decomposition[1];
1777 y_min_perspective = projection_decomposition[1];
1783 point[0] = cell->vertex(0)[0];
1784 point[1] = cell->vertex(0)[1];
1791 (
static_cast<float>(cell->level()) / static_cast<float>(n_levels)) *
1792 std::max(x_dimension, y_dimension);
1801 if (x_max_perspective < projection_decomposition[0])
1802 x_max_perspective = projection_decomposition[0];
1803 if (x_min_perspective > projection_decomposition[0])
1804 x_min_perspective = projection_decomposition[0];
1806 if (y_max_perspective < projection_decomposition[1])
1807 y_max_perspective = projection_decomposition[1];
1808 if (y_min_perspective > projection_decomposition[1])
1809 y_min_perspective = projection_decomposition[1];
1811 point[0] = cell->vertex(1)[0];
1812 point[1] = cell->vertex(1)[1];
1820 if (x_max_perspective < projection_decomposition[0])
1821 x_max_perspective = projection_decomposition[0];
1822 if (x_min_perspective > projection_decomposition[0])
1823 x_min_perspective = projection_decomposition[0];
1825 if (y_max_perspective < projection_decomposition[1])
1826 y_max_perspective = projection_decomposition[1];
1827 if (y_min_perspective > projection_decomposition[1])
1828 y_min_perspective = projection_decomposition[1];
1830 point[0] = cell->vertex(2)[0];
1831 point[1] = cell->vertex(2)[1];
1839 if (x_max_perspective < projection_decomposition[0])
1840 x_max_perspective = projection_decomposition[0];
1841 if (x_min_perspective > projection_decomposition[0])
1842 x_min_perspective = projection_decomposition[0];
1844 if (y_max_perspective < projection_decomposition[1])
1845 y_max_perspective = projection_decomposition[1];
1846 if (y_min_perspective > projection_decomposition[1])
1847 y_min_perspective = projection_decomposition[1];
1849 point[0] = cell->vertex(3)[0];
1850 point[1] = cell->vertex(3)[1];
1858 if (x_max_perspective < projection_decomposition[0])
1859 x_max_perspective = projection_decomposition[0];
1860 if (x_min_perspective > projection_decomposition[0])
1861 x_min_perspective = projection_decomposition[0];
1863 if (y_max_perspective < projection_decomposition[1])
1864 y_max_perspective = projection_decomposition[1];
1865 if (y_min_perspective > projection_decomposition[1])
1866 y_min_perspective = projection_decomposition[1];
1868 if (static_cast<unsigned int>(cell->level()) == min_level)
1869 min_level_min_vertex_distance = cell->minimum_vertex_distance();
1872 x_dimension_perspective = x_max_perspective - x_min_perspective;
1873 y_dimension_perspective = y_max_perspective - y_min_perspective;
1877 width =
static_cast<unsigned int>(
1878 .5 + height * (x_dimension_perspective / y_dimension_perspective));
1879 else if (height == 0)
1880 height =
static_cast<unsigned int>(
1881 .5 + width * (y_dimension_perspective / x_dimension_perspective));
1882 unsigned int additional_width = 0;
1884 unsigned int font_size =
1885 static_cast<unsigned int>(.5 + (height / 100.) * 1.75);
1886 cell_label_font_size =
static_cast<unsigned int>(
1888 min_level_min_vertex_distance / std::min(x_dimension, y_dimension)));
1895 additional_width =
static_cast<unsigned int>(
1900 additional_width =
static_cast<unsigned int>(
1901 .5 + height * .175);
1913 out <<
"<svg width=\"" << width + additional_width <<
"\" height=\"" << height
1914 <<
"\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" <<
'\n' 1921 <<
" <linearGradient id=\"background_gradient\" gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"" 1922 << height <<
"\">" <<
'\n' 1923 <<
" <stop offset=\"0\" style=\"stop-color:white\"/>" <<
'\n' 1924 <<
" <stop offset=\"1\" style=\"stop-color:lightsteelblue\"/>" <<
'\n' 1925 <<
" </linearGradient>" <<
'\n';
1931 out <<
"<!-- internal style sheet -->" <<
'\n' 1932 <<
"<style type=\"text/css\"><![CDATA[" <<
'\n';
1936 out <<
" rect.background{fill:url(#background_gradient)}" <<
'\n';
1938 out <<
" rect.background{fill:white}" <<
'\n';
1940 out <<
" rect.background{fill:none}" <<
'\n';
1943 out <<
" rect{fill:none; stroke:rgb(25,25,25); stroke-width:" 1945 <<
" text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)}" 1947 <<
" line{stroke:rgb(25,25,25); stroke-width:" 1949 <<
" path{fill:none; stroke:rgb(25,25,25); stroke-width:" 1956 unsigned int labeling_index = 0;
1957 auto materials_it = materials.begin();
1958 auto levels_it = levels.begin();
1959 auto subdomains_it = subdomains.begin();
1960 auto level_subdomains_it = level_subdomains.begin();
1962 for (
unsigned int index = 0; index < n; index++)
1967 h = .6 - (index / (n - 1.)) * .6;
1975 unsigned int i =
static_cast<unsigned int>(h * 6);
1977 double f = h * 6 - i;
1984 r = 255, g =
static_cast<unsigned int>(.5 + 255 * t);
1987 r =
static_cast<unsigned int>(.5 + 255 * q), g = 255;
1990 g = 255, b =
static_cast<unsigned int>(.5 + 255 * t);
1993 g =
static_cast<unsigned int>(.5 + 255 * q), b = 255;
1996 r =
static_cast<unsigned int>(.5 + 255 * t), b = 255;
1999 r = 255, b =
static_cast<unsigned int>(.5 + 255 * q);
2008 labeling_index = *materials_it++;
2011 labeling_index = *levels_it++;
2014 labeling_index = *subdomains_it++;
2017 labeling_index = *level_subdomains_it++;
2023 out <<
" path.p" << labeling_index <<
"{fill:rgb(" << r <<
',' << g
2024 <<
',' << b <<
"); " 2025 <<
"stroke:rgb(25,25,25); stroke-width:" 2028 out <<
" path.ps" << labeling_index <<
"{fill:rgb(" 2029 <<
static_cast<unsigned int>(.5 + .75 * r) <<
',' 2030 << static_cast<unsigned int>(.5 + .75 * g) <<
',' 2031 <<
static_cast<unsigned int>(.5 + .75 * b) <<
"); " 2032 <<
"stroke:rgb(20,20,20); stroke-width:" 2035 out <<
" rect.r" << labeling_index <<
"{fill:rgb(" << r <<
',' << g
2036 <<
',' << b <<
"); " 2037 <<
"stroke:rgb(25,25,25); stroke-width:" 2044 out <<
"]]></style>" <<
'\n' <<
'\n';
2047 out <<
" <rect class=\"background\" width=\"" << width <<
"\" height=\"" 2048 << height <<
"\"/>" <<
'\n';
2052 unsigned int x_offset = 0;
2055 x_offset =
static_cast<unsigned int>(.5 + (height / 100.) *
2056 (margin_in_percent / 2.));
2058 x_offset =
static_cast<unsigned int>(.5 + height * .025);
2061 <<
" <text x=\"" << x_offset <<
"\" y=\"" 2062 <<
static_cast<unsigned int>(.5 + height * .0525) <<
'\"' 2063 <<
" style=\"font-weight:100; fill:lightsteelblue; text-anchor:start; font-family:Courier; font-size:" 2064 <<
static_cast<unsigned int>(.5 + height * .045) <<
"px\">" 2066 <<
"</text>" <<
'\n';
2085 out <<
" <!-- cells -->" <<
'\n';
2087 for (
unsigned int level_index = min_level; level_index <= max_level;
2091 endc = tria.
end(level_index);
2093 for (; cell != endc; ++cell)
2103 out <<
" class=\"p";
2111 out << cell->material_id();
2114 out << static_cast<unsigned int>(cell->level());
2118 out << cell->subdomain_id() + 2;
2123 out << cell->level_subdomain_id() + 2;
2134 point[0] = cell->vertex(0)[0];
2135 point[1] = cell->vertex(0)[1];
2141 (
static_cast<float>(cell->level()) /
2142 static_cast<float>(n_levels)) *
2143 std::max(x_dimension, y_dimension);
2146 projection_decomposition =
2153 out << static_cast<unsigned int>(
2155 ((projection_decomposition[0] - x_min_perspective) /
2156 x_dimension_perspective) *
2157 (width - (width / 100.) * 2. * margin_in_percent) +
2158 ((width / 100.) * margin_in_percent))
2160 <<
static_cast<unsigned int>(
2161 .5 + height - (height / 100.) * margin_in_percent -
2162 ((projection_decomposition[1] - y_min_perspective) /
2163 y_dimension_perspective) *
2164 (height - (height / 100.) * 2. * margin_in_percent));
2168 point[0] = cell->vertex(1)[0];
2169 point[1] = cell->vertex(1)[1];
2171 projection_decomposition =
2178 out << static_cast<unsigned int>(
2180 ((projection_decomposition[0] - x_min_perspective) /
2181 x_dimension_perspective) *
2182 (width - (width / 100.) * 2. * margin_in_percent) +
2183 ((width / 100.) * margin_in_percent))
2185 <<
static_cast<unsigned int>(
2186 .5 + height - (height / 100.) * margin_in_percent -
2187 ((projection_decomposition[1] - y_min_perspective) /
2188 y_dimension_perspective) *
2189 (height - (height / 100.) * 2. * margin_in_percent));
2193 point[0] = cell->vertex(3)[0];
2194 point[1] = cell->vertex(3)[1];
2196 projection_decomposition =
2203 out << static_cast<unsigned int>(
2205 ((projection_decomposition[0] - x_min_perspective) /
2206 x_dimension_perspective) *
2207 (width - (width / 100.) * 2. * margin_in_percent) +
2208 ((width / 100.) * margin_in_percent))
2210 <<
static_cast<unsigned int>(
2211 .5 + height - (height / 100.) * margin_in_percent -
2212 ((projection_decomposition[1] - y_min_perspective) /
2213 y_dimension_perspective) *
2214 (height - (height / 100.) * 2. * margin_in_percent));
2218 point[0] = cell->vertex(2)[0];
2219 point[1] = cell->vertex(2)[1];
2221 projection_decomposition =
2228 out << static_cast<unsigned int>(
2230 ((projection_decomposition[0] - x_min_perspective) /
2231 x_dimension_perspective) *
2232 (width - (width / 100.) * 2. * margin_in_percent) +
2233 ((width / 100.) * margin_in_percent))
2235 <<
static_cast<unsigned int>(
2236 .5 + height - (height / 100.) * margin_in_percent -
2237 ((projection_decomposition[1] - y_min_perspective) /
2238 y_dimension_perspective) *
2239 (height - (height / 100.) * 2. * margin_in_percent));
2243 point[0] = cell->vertex(0)[0];
2244 point[1] = cell->vertex(0)[1];
2246 projection_decomposition =
2253 out << static_cast<unsigned int>(
2255 ((projection_decomposition[0] - x_min_perspective) /
2256 x_dimension_perspective) *
2257 (width - (width / 100.) * 2. * margin_in_percent) +
2258 ((width / 100.) * margin_in_percent))
2260 <<
static_cast<unsigned int>(
2261 .5 + height - (height / 100.) * margin_in_percent -
2262 ((projection_decomposition[1] - y_min_perspective) /
2263 y_dimension_perspective) *
2264 (height - (height / 100.) * 2. * margin_in_percent));
2266 out <<
"\"/>" <<
'\n';
2273 point[0] = cell->center()[0];
2274 point[1] = cell->center()[1];
2280 (
static_cast<float>(cell->level()) /
2281 static_cast<float>(n_levels)) *
2282 std::max(x_dimension, y_dimension);
2285 float distance_to_camera =
2286 std::sqrt(std::pow(point[0] - camera_position[0], 2.) +
2287 std::pow(point[1] - camera_position[1], 2.) +
2288 std::pow(point[2] - camera_position[2], 2.));
2289 float distance_factor =
2290 distance_to_camera / (2. * std::max(x_dimension, y_dimension));
2292 projection_decomposition =
2299 const auto font_size_this_cell =
static_cast<unsigned int>(
2301 cell_label_font_size *
2302 std::pow(.5, cell->level() - 4. + 3.5 * distance_factor));
2306 <<
static_cast<unsigned int>(
2308 ((projection_decomposition[0] - x_min_perspective) /
2309 x_dimension_perspective) *
2310 (width - (width / 100.) * 2. * margin_in_percent) +
2311 ((width / 100.) * margin_in_percent))
2313 <<
static_cast<unsigned int>(
2314 .5 + height - (height / 100.) * margin_in_percent -
2315 ((projection_decomposition[1] - y_min_perspective) /
2316 y_dimension_perspective) *
2317 (height - (height / 100.) * 2. * margin_in_percent) +
2318 0.5 * font_size_this_cell)
2319 <<
"\" style=\"font-size:" << font_size_this_cell <<
"px\">";
2323 out << cell->level();
2330 out << cell->index();
2339 <<
static_cast<std::make_signed<types::material_id>::type
>(
2340 cell->material_id());
2350 std::make_signed<types::subdomain_id>::type
>(
2351 cell->subdomain_id());
2364 <<
static_cast<std::make_signed<types::subdomain_id>::type
>(
2365 cell->level_subdomain_id());
2368 out <<
"</text>" <<
'\n';
2375 for (
unsigned int faceIndex = 0; faceIndex < 4; faceIndex++)
2377 if (cell->at_boundary(faceIndex))
2379 point[0] = cell->face(faceIndex)->vertex(0)[0];
2380 point[1] = cell->face(faceIndex)->vertex(0)[1];
2386 (
static_cast<float>(cell->level()) /
2387 static_cast<float>(n_levels)) *
2388 std::max(x_dimension, y_dimension);
2391 projection_decomposition =
2398 out <<
" <line x1=\"" 2399 <<
static_cast<unsigned int>(
2401 ((projection_decomposition[0] -
2402 x_min_perspective) /
2403 x_dimension_perspective) *
2405 (width / 100.) * 2. * margin_in_percent) +
2406 ((width / 100.) * margin_in_percent))
2408 <<
static_cast<unsigned int>(
2410 (height / 100.) * margin_in_percent -
2411 ((projection_decomposition[1] -
2412 y_min_perspective) /
2413 y_dimension_perspective) *
2415 (height / 100.) * 2. * margin_in_percent));
2417 point[0] = cell->face(faceIndex)->vertex(1)[0];
2418 point[1] = cell->face(faceIndex)->vertex(1)[1];
2424 (
static_cast<float>(cell->level()) /
2425 static_cast<float>(n_levels)) *
2426 std::max(x_dimension, y_dimension);
2429 projection_decomposition =
2437 <<
static_cast<unsigned int>(
2439 ((projection_decomposition[0] -
2440 x_min_perspective) /
2441 x_dimension_perspective) *
2443 (width / 100.) * 2. * margin_in_percent) +
2444 ((width / 100.) * margin_in_percent))
2446 <<
static_cast<unsigned int>(
2448 (height / 100.) * margin_in_percent -
2449 ((projection_decomposition[1] -
2450 y_min_perspective) /
2451 y_dimension_perspective) *
2453 (height / 100.) * 2. * margin_in_percent))
2464 out <<
'\n' <<
" <!-- legend -->" <<
'\n';
2466 additional_width = 0;
2468 additional_width =
static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
2476 unsigned int line_offset = 0;
2477 out <<
" <rect x=\"" << width + additional_width <<
"\" y=\"" 2478 <<
static_cast<unsigned int>(.5 + (height / 100.) * margin_in_percent)
2480 << static_cast<unsigned int>(.5 + (height / 100.) *
2481 (40. - margin_in_percent))
2482 <<
"\" height=\"" <<
static_cast<unsigned int>(.5 + height * .165)
2485 out <<
" <text x=\"" 2486 << width + additional_width +
2487 static_cast<unsigned int>(.5 + (height / 100.) * 1.25)
2489 <<
static_cast<unsigned int>(.5 +
2490 (height / 100.) * margin_in_percent +
2491 (++line_offset) * 1.5 * font_size)
2492 <<
"\" style=\"text-anchor:start; font-weight:bold; font-size:" 2493 << font_size <<
"px\">" 2495 <<
"</text>" <<
'\n';
2499 out <<
" <text x=\"" 2500 << width + additional_width +
2501 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2503 <<
static_cast<unsigned int>(.5 +
2504 (height / 100.) * margin_in_percent +
2505 (++line_offset) * 1.5 * font_size)
2506 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2507 << font_size <<
"px\">" 2515 out <<
"</text>" <<
'\n';
2520 out <<
" <text x=\"" 2521 << width + additional_width +
2522 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2524 <<
static_cast<unsigned int>(.5 +
2525 (height / 100.) * margin_in_percent +
2526 (++line_offset) * 1.5 * font_size)
2527 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2528 << font_size <<
"px\">" 2535 out <<
"</text>" <<
'\n';
2540 out <<
" <text x=\"" 2541 << width + additional_width +
2542 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2544 <<
static_cast<unsigned int>(.5 +
2545 (height / 100.) * margin_in_percent +
2546 (++line_offset) * 1.5 * font_size)
2547 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2548 << font_size <<
"px\">" 2555 out <<
"</text>" <<
'\n';
2560 out <<
" <text x= \"" 2561 << width + additional_width +
2562 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2564 <<
static_cast<unsigned int>(.5 +
2565 (height / 100.) * margin_in_percent +
2566 (++line_offset) * 1.5 * font_size)
2567 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2568 << font_size <<
"px\">" 2574 out <<
"</text>" <<
'\n';
2579 out <<
" <text x= \"" 2580 << width + additional_width +
2581 static_cast<unsigned int>(.5 + (height / 100.) * 2.)
2583 <<
static_cast<unsigned int>(.5 +
2584 (height / 100.) * margin_in_percent +
2585 (++line_offset) * 1.5 * font_size)
2586 <<
"\" style=\"text-anchor:start; font-style:oblique; font-size:" 2587 << font_size <<
"px\">" 2588 <<
"level_subdomain_id" 2589 <<
"</text>" <<
'\n';
2597 out <<
" <text x=\"" << width + additional_width <<
"\" y=\"" 2598 <<
static_cast<unsigned int>(
2599 .5 + (height / 100.) * margin_in_percent + 10.75 * font_size)
2600 <<
"\" style=\"text-anchor:start; font-size:" << font_size <<
"px\">" 2609 out <<
'\n' <<
" <!-- colorbar -->" <<
'\n';
2611 out <<
" <text x=\"" << width + additional_width <<
"\" y=\"" 2612 <<
static_cast<unsigned int>(
2613 .5 + (height / 100.) * (margin_in_percent + 29.) -
2615 <<
"\" style=\"text-anchor:start; font-weight:bold; font-size:" 2616 << font_size <<
"px\">";
2621 out <<
"material_id";
2624 out <<
"level_number";
2627 out <<
"subdomain_id";
2630 out <<
"level_subdomain_id";
2636 out <<
"</text>" <<
'\n';
2638 unsigned int element_height =
static_cast<unsigned int>(
2639 ((height / 100.) * (71. - 2. * margin_in_percent)) / n);
2640 unsigned int element_width =
2641 static_cast<unsigned int>(.5 + (height / 100.) * 2.5);
2643 int labeling_index = 0;
2644 auto materials_it = materials.begin();
2645 auto levels_it = levels.begin();
2646 auto subdomains_it = subdomains.begin();
2647 auto level_subdomains_it = level_subdomains.begin();
2649 for (
unsigned int index = 0; index < n; index++)
2654 labeling_index = *materials_it++;
2657 labeling_index = *levels_it++;
2660 labeling_index = *subdomains_it++;
2663 labeling_index = *level_subdomains_it++;
2669 out <<
" <rect class=\"r" << labeling_index <<
"\" x=\"" 2670 << width + additional_width <<
"\" y=\"" 2671 <<
static_cast<unsigned int>(.5 + (height / 100.) *
2672 (margin_in_percent + 29)) +
2673 (n - index - 1) * element_height
2674 <<
"\" width=\"" << element_width <<
"\" height=\"" 2675 << element_height <<
"\"/>" <<
'\n';
2677 out <<
" <text x=\"" 2678 << width + additional_width + 1.5 * element_width <<
"\" y=\"" 2679 <<
static_cast<unsigned int>(.5 + (height / 100.) *
2680 (margin_in_percent + 29)) +
2681 (n - index - 1 + .5) * element_height +
2682 static_cast<unsigned int>(.5 + font_size * .35)
2684 <<
" style=\"text-anchor:start; font-size:" 2685 <<
static_cast<unsigned int>(.5 + font_size) <<
"px";
2687 if (index == 0 || index == n - 1)
2688 out <<
"; font-weight:bold";
2690 out <<
"\">" << labeling_index;
2697 out <<
"</text>" <<
'\n';
2705 out <<
'\n' <<
"</svg>";
2719 template <
int dim,
int spacedim>
2722 std::ostream & out)
const 2729 const std::time_t time1 = std::time(
nullptr);
2730 const std::tm * time = std::localtime(&time1);
2734 <<
"\n# This file was generated by the deal.II library." 2735 <<
"\n# Date = " << time->tm_year + 1900 <<
"/" << std::setfill(
'0')
2736 << std::setw(2) << time->tm_mon + 1 <<
"/" << std::setfill(
'0')
2737 << std::setw(2) << time->tm_mday <<
"\n# Time = " << std::setfill(
'0')
2738 << std::setw(2) << time->tm_hour <<
":" << std::setfill(
'0')
2739 << std::setw(2) << time->tm_min <<
":" << std::setfill(
'0')
2740 << std::setw(2) << time->tm_sec <<
"\n#" 2741 <<
"\n# For a description of the MathGL script format see the MathGL manual. " 2743 <<
"\n# Note: This file is understood by MathGL v2.1 and higher only, and can " 2744 <<
"\n# be quickly viewed in a graphical environment using \'mglview\'. " 2751 const std::string axes =
"xyz";
2767 out <<
"\nsetsize 800 800";
2768 out <<
"\nrotate 0 0";
2771 out <<
"\nsetsize 800 800";
2772 out <<
"\nrotate 60 40";
2781 <<
"\n# Vertex ordering." 2782 <<
"\n# list <vertex order> <vertex indices>" 2792 out <<
"\nlist f 0 1 2 3" 2797 <<
"\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" 2806 <<
"\n# List of vertices." 2807 <<
"\n# list <id> <vertices>" 2813 typename ::Triangulation<dim, spacedim>::active_cell_iterator
2818 for (; cell != endc; ++cell)
2820 for (
unsigned int i = 0; i < dim; ++i)
2827 out <<
"\nlist " << axes[i] << cell->active_cell_index() <<
" ";
2828 for (
unsigned int j = 0; j < GeometryInfo<dim>::vertices_per_cell;
2830 out << cell->vertex(j)[i] <<
" ";
2837 <<
"\n# List of cells to quadplot." 2838 <<
"\n# quadplot <vertex order> <id> <style>" 2843 out <<
"\nquadplot f ";
2844 for (
unsigned int j = 0; j < dim; ++j)
2845 out << axes[j] << i <<
" ";
2871 template <
int dim,
int spacedim,
typename ITERATOR,
typename END>
2873 generate_triangulation_patches(
2879 for (; cell != end; ++cell)
2885 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
2887 patch.
vertices[v] = cell->vertex(v);
2888 patch.
data(0, v) = cell->level();
2890 static_cast<std::make_signed<types::manifold_id>::type
>(
2891 cell->manifold_id());
2893 static_cast<std::make_signed<types::material_id>::type
>(
2894 cell->material_id());
2895 if (!cell->has_children())
2897 static_cast<std::make_signed<types::subdomain_id>::type
>(
2898 cell->subdomain_id());
2900 patch.
data(3, v) = -1;
2902 static_cast<std::make_signed<types::subdomain_id>::type
>(
2903 cell->level_subdomain_id());
2905 patches.push_back(patch);
2911 std::vector<std::string>
2912 triangulation_patch_data_names()
2914 std::vector<std::string> v(5);
2919 v[4] =
"level_subdomain";
2928 std::vector<typename Triangulation<3, 3>::active_line_iterator>
2931 std::vector<typename Triangulation<3, 3>::active_line_iterator> res;
2933 std::vector<bool> flags;
2938 for (
unsigned int l = 0; l < GeometryInfo<3>::lines_per_face; ++
l)
2940 auto line = face->line(l);
2941 if (line->user_flag_set() || line->has_children())
2944 line->set_user_flag();
2946 (line->boundary_id() != 0 &&
2948 res.emplace_back(line);
2958 template <
int dim,
int spacedim>
2959 std::vector<typename Triangulation<dim, spacedim>::active_line_iterator>
2971 template <
int dim,
int spacedim>
2972 std::vector<typename Triangulation<dim, spacedim>::active_face_iterator>
2975 std::vector<typename Triangulation<dim, spacedim>::active_face_iterator>
2982 (face->boundary_id() != 0 &&
2984 res.push_back(face);
2992 template <
int dim,
int spacedim>
2995 std::ostream & out)
const 3000 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
3002 const auto n_vertices = vertices.size();
3004 out <<
"# vtk DataFile Version 3.0\n" 3005 <<
"Triangulation generated with deal.II\n" 3007 <<
"DATASET UNSTRUCTURED_GRID\n" 3008 <<
"POINTS " << n_vertices <<
" double\n";
3011 for (
const auto &v : vertices)
3014 for (
unsigned int d = spacedim + 1; d <= 3; ++d)
3019 const auto faces = relevant_faces(tria);
3020 const auto co_faces = relevant_co_faces(tria);
3023 const int n_cells = tria.
n_active_cells() + faces.size() + co_faces.size();
3031 const int cells_size =
3034 co_faces.size() * (3);
3037 out <<
"\nCELLS " << n_cells <<
' ' << cells_size <<
'\n';
3047 const int cell_type = (dim == 1 ? 3 : dim == 2 ? 9 : 12);
3048 const int face_type = (dim == 1 ? 1 : dim == 2 ? 3 : 9);
3049 const int co_face_type = (dim == 1 ? -1 : dim == 2 ? -1 : 3);
3054 out << GeometryInfo<dim>::vertices_per_cell;
3055 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
3061 for (
const auto &face : faces)
3063 out << GeometryInfo<dim>::vertices_per_face;
3064 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_face; ++i)
3067 << face->vertex_index(
3068 GeometryInfo < (dim > 1) ? dim - 1 : dim > ::ucd_to_deal[i]);
3072 for (
const auto &co_face : co_faces)
3075 for (
unsigned int i = 0; i < 2; ++i)
3076 out <<
' ' << co_face->vertex_index(i);
3081 out <<
"\nCELL_TYPES " << n_cells <<
'\n';
3084 out << cell_type <<
' ';
3087 for (
unsigned int i = 0; i < faces.size(); ++i)
3089 out << face_type <<
' ';
3092 for (
unsigned int i = 0; i < co_faces.size(); ++i)
3094 out << co_face_type <<
' ';
3096 out <<
"\n\nCELL_DATA " << n_cells <<
'\n' 3097 <<
"SCALARS MaterialID int 1\n" 3098 <<
"LOOKUP_TABLE default\n";
3103 out << static_cast<std::make_signed<types::material_id>::type>(
3104 cell->material_id())
3108 for (
const auto &face : faces)
3110 out << static_cast<std::make_signed<types::boundary_id>::type>(
3111 face->boundary_id())
3115 for (
const auto &co_face : co_faces)
3117 out << static_cast<std::make_signed<types::boundary_id>::type>(
3118 co_face->boundary_id())
3122 out <<
"\n\nSCALARS ManifoldID int 1\n" 3123 <<
"LOOKUP_TABLE default\n";
3128 out << static_cast<std::make_signed<types::boundary_id>::type>(
3129 cell->manifold_id())
3133 for (
const auto &face : faces)
3135 out << static_cast<std::make_signed<types::boundary_id>::type>(
3136 face->manifold_id())
3140 for (
const auto &co_face : co_faces)
3142 out << static_cast<std::make_signed<types::boundary_id>::type>(
3143 co_face->manifold_id())
3155 template <
int dim,
int spacedim>
3158 std::ostream & out)
const 3166 std::vector<DataOutBase::Patch<dim, spacedim>> patches;
3168 generate_triangulation_patches(patches, tria.
begin_active(), tria.
end());
3171 triangulation_patch_data_names(),
3173 std::tuple<
unsigned int,
3185 template <
int dim,
int spacedim>
3189 const std::string & filename_without_extension,
3190 const bool view_levels,
3191 const bool include_artificial)
const 3193 std::vector<DataOutBase::Patch<dim, spacedim>> patches;
3194 const unsigned int n_datasets = 4;
3195 std::vector<std::string> data_names;
3196 data_names.emplace_back(
"level");
3197 data_names.emplace_back(
"subdomain");
3198 data_names.emplace_back(
"level_subdomain");
3199 data_names.emplace_back(
"proc_writing");
3204 for (cell = tria.
begin(), endc = tria.
end(); cell != endc; ++cell)
3208 if (cell->has_children())
3210 if (!include_artificial &&
3214 else if (!include_artificial)
3216 if (cell->has_children() &&
3219 else if (!cell->has_children() &&
3220 cell->level_subdomain_id() ==
3230 for (
unsigned int vertex = 0; vertex < n_q_points; ++vertex)
3232 patch.
vertices[vertex] = cell->vertex(vertex);
3233 patch.
data(0, vertex) = cell->level();
3234 if (!cell->has_children())
3235 patch.
data(1, vertex) =
static_cast<double>(
3236 static_cast<std::make_signed<types::subdomain_id>::type
>(
3237 cell->subdomain_id()));
3239 patch.
data(1, vertex) = -1.0;
3240 patch.
data(2, vertex) =
static_cast<double>(
3241 static_cast<std::make_signed<types::subdomain_id>::type
>(
3242 cell->level_subdomain_id()));
3246 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
3248 patches.push_back(patch);
3254 std::string new_file = filename_without_extension +
".vtu";
3258 new_file = filename_without_extension +
".proc" +
3263 if (tr->locally_owned_subdomain() == 0)
3265 std::vector<std::string> filenames;
3270 std::size_t pos = filename_without_extension.find_last_of(
'/');
3271 if (pos == std::string::npos)
3275 const unsigned int n_procs =
3277 for (
unsigned int i = 0; i < n_procs; ++i)
3278 filenames.push_back(filename_without_extension.substr(pos) +
3282 const std::string pvtu_master_filename =
3283 (filename_without_extension +
".pvtu");
3284 std::ofstream pvtu_master(pvtu_master_filename.c_str());
3291 Vector<float> dummy_vector(tr->n_active_cells());
3292 data_out.add_data_vector(dummy_vector,
"level");
3293 data_out.add_data_vector(dummy_vector,
"subdomain");
3294 data_out.add_data_vector(dummy_vector,
"level_subdomain");
3295 data_out.add_data_vector(dummy_vector,
"proc_writing");
3297 data_out.build_patches();
3299 data_out.write_pvtu_record(pvtu_master, filenames);
3303 std::ofstream out(new_file.c_str());
3305 std::tuple<
unsigned int,
3367 template <
int dim,
int spacedim>
3372 unsigned int n_faces = 0;
3376 if ((face->at_boundary()) && (face->boundary_id() != 0))
3384 template <
int dim,
int spacedim>
3391 std::vector<bool> line_flags;
3395 .clear_user_flags_line();
3397 unsigned int n_lines = 0;
3401 for (cell = tria.
begin_active(), endc = tria.
end(); cell != endc; ++cell)
3402 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
3403 if (cell->line(l)->at_boundary() && (cell->line(l)->boundary_id() != 0) &&
3404 (cell->line(l)->user_flag_set() ==
false))
3407 cell->line(l)->set_user_flag();
3422 const unsigned int next_element_index,
3423 std::ostream &)
const 3425 return next_element_index;
3431 const unsigned int next_element_index,
3432 std::ostream &)
const 3434 return next_element_index;
3439 const unsigned int next_element_index,
3440 std::ostream &)
const 3442 return next_element_index;
3448 const unsigned int next_element_index,
3449 std::ostream &)
const 3451 return next_element_index;
3456 const unsigned int next_element_index,
3457 std::ostream &)
const 3459 return next_element_index;
3465 const unsigned int next_element_index,
3466 std::ostream &)
const 3468 return next_element_index;
3474 const unsigned int next_element_index,
3475 std::ostream &)
const 3477 return next_element_index;
3482 const unsigned int next_element_index,
3483 std::ostream &)
const 3485 return next_element_index;
3490 template <
int dim,
int spacedim>
3493 const unsigned int next_element_index,
3494 std::ostream & out)
const 3496 unsigned int current_element_index = next_element_index;
3501 if (face->at_boundary() && (face->boundary_id() != 0))
3503 out << current_element_index <<
' ';
3515 out << static_cast<unsigned int>(face->boundary_id()) <<
' ' 3516 << static_cast<unsigned int>(face->boundary_id()) <<
' ' 3519 for (
unsigned int vertex = 0;
3520 vertex < GeometryInfo<dim>::vertices_per_face;
3523 << face->vertex_index(
3528 ++current_element_index;
3530 return current_element_index;
3534 template <
int dim,
int spacedim>
3537 const unsigned int next_element_index,
3538 std::ostream & out)
const 3540 unsigned int current_element_index = next_element_index;
3545 std::vector<bool> line_flags;
3549 .clear_user_flags_line();
3553 for (cell = tria.
begin_active(), endc = tria.
end(); cell != endc; ++cell)
3554 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
3555 if (cell->line(l)->at_boundary() && (cell->line(l)->boundary_id() != 0) &&
3556 (cell->line(l)->user_flag_set() ==
false))
3558 out << next_element_index <<
" 1 ";
3559 out << static_cast<unsigned int>(cell->line(l)->boundary_id()) <<
' ' 3560 << static_cast<unsigned int>(cell->line(l)->boundary_id())
3563 for (
unsigned int vertex = 0; vertex < 2; ++vertex)
3565 << cell->line(l)->vertex_index(
3573 ++current_element_index;
3574 cell->line(l)->set_user_flag();
3582 return current_element_index;
3589 const unsigned int next_element_index,
3590 std::ostream &)
const 3592 return next_element_index;
3597 const unsigned int next_element_index,
3598 std::ostream &)
const 3600 return next_element_index;
3605 const unsigned int next_element_index,
3606 std::ostream &)
const 3608 return next_element_index;
3613 const unsigned int next_element_index,
3614 std::ostream &)
const 3616 return next_element_index;
3621 const unsigned int next_element_index,
3622 std::ostream &)
const 3624 return next_element_index;
3630 const unsigned int next_element_index,
3631 std::ostream &)
const 3633 return next_element_index;
3639 const unsigned int next_element_index,
3640 std::ostream &)
const 3642 return next_element_index;
3647 const unsigned int next_element_index,
3648 std::ostream &)
const 3650 return next_element_index;
3655 template <
int dim,
int spacedim>
3658 const unsigned int next_element_index,
3659 std::ostream & out)
const 3661 unsigned int current_element_index = next_element_index;
3666 if (face->at_boundary() && (face->boundary_id() != 0))
3668 out << current_element_index <<
" " 3669 <<
static_cast<unsigned int>(face->boundary_id()) <<
" ";
3682 for (
unsigned int vertex = 0;
3683 vertex < GeometryInfo<dim>::vertices_per_face;
3685 out << face->vertex_index(
3691 ++current_element_index;
3693 return current_element_index;
3698 template <
int dim,
int spacedim>
3701 const unsigned int next_element_index,
3702 std::ostream & out)
const 3704 unsigned int current_element_index = next_element_index;
3709 std::vector<bool> line_flags;
3713 .clear_user_flags_line();
3717 for (cell = tria.
begin_active(), endc = tria.
end(); cell != endc; ++cell)
3718 for (
unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
3719 if (cell->line(l)->at_boundary() && (cell->line(l)->boundary_id() != 0) &&
3720 (cell->line(l)->user_flag_set() ==
false))
3722 out << current_element_index <<
" " 3723 <<
static_cast<unsigned int>(cell->line(l)->boundary_id())
3726 for (
unsigned int vertex = 0; vertex < 2; ++vertex)
3727 out << cell->line(l)->vertex_index(
3736 ++current_element_index;
3737 cell->line(l)->set_user_flag();
3744 return current_element_index;
3756 camera_vertical[0] = camera_horizontal[1] * camera_direction[2] -
3757 camera_horizontal[2] * camera_direction[1];
3758 camera_vertical[1] = camera_horizontal[2] * camera_direction[0] -
3759 camera_horizontal[0] * camera_direction[2];
3760 camera_vertical[2] = camera_horizontal[0] * camera_direction[1] -
3761 camera_horizontal[1] * camera_direction[0];
3765 phi /= (point[0] - camera_position[0]) * camera_direction[0] +
3766 (point[1] - camera_position[1]) * camera_direction[1] +
3767 (point[2] - camera_position[2]) * camera_direction[2];
3770 projection[0] = camera_position[0] + phi * (point[0] - camera_position[0]);
3771 projection[1] = camera_position[1] + phi * (point[1] - camera_position[1]);
3772 projection[2] = camera_position[2] + phi * (point[2] - camera_position[2]);
3775 projection_decomposition[0] =
3776 (projection[0] - camera_position[0] - camera_focus * camera_direction[0]) *
3777 camera_horizontal[0];
3778 projection_decomposition[0] +=
3779 (projection[1] - camera_position[1] - camera_focus * camera_direction[1]) *
3780 camera_horizontal[1];
3781 projection_decomposition[0] +=
3782 (projection[2] - camera_position[2] - camera_focus * camera_direction[2]) *
3783 camera_horizontal[2];
3785 projection_decomposition[1] =
3786 (projection[0] - camera_position[0] - camera_focus * camera_direction[0]) *
3788 projection_decomposition[1] +=
3789 (projection[1] - camera_position[1] - camera_focus * camera_direction[1]) *
3791 projection_decomposition[1] +=
3792 (projection[2] - camera_position[2] - camera_focus * camera_direction[2]) *
3795 return projection_decomposition;
3812 template <
int spacedim>
3816 while (points.size() > 2)
3819 first_difference /= first_difference.
norm();
3821 second_difference /= second_difference.
norm();
3823 if ((first_difference - second_difference).norm() < 1e-10)
3824 points.erase(points.begin() + 1);
3832 template <
int spacedim>
3843 typename ::Triangulation<dim, spacedim>::active_cell_iterator cell =
3844 tria.begin_active();
3845 const typename ::Triangulation<dim, spacedim>::active_cell_iterator
3847 for (; cell != endc; ++cell)
3850 out <<
"# cell " << cell <<
'\n';
3852 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 3853 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3854 << cell->vertex(1) <<
' ' << cell->level() <<
' ' 3855 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3868 template <
int spacedim>
3879 const unsigned int n_additional_points =
3881 const unsigned int n_points = 2 + n_additional_points;
3883 typename ::Triangulation<dim, spacedim>::active_cell_iterator cell =
3884 tria.begin_active();
3885 const typename ::Triangulation<dim, spacedim>::active_cell_iterator
3891 std::vector<
Point<dim - 1>> boundary_points;
3892 if (mapping !=
nullptr)
3894 boundary_points.resize(n_points);
3895 boundary_points[0][0] = 0;
3896 boundary_points[n_points - 1][0] = 1;
3897 for (
unsigned int i = 1; i < n_points - 1; ++i)
3898 boundary_points[i](0) = 1. * i / (n_points - 1);
3900 std::vector<double> dummy_weights(n_points, 1. / n_points);
3901 Quadrature<dim - 1> quadrature(boundary_points, dummy_weights);
3907 for (; cell != endc; ++cell)
3910 out <<
"# cell " << cell <<
'\n';
3912 if (mapping ==
nullptr ||
3922 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
3925 << cell->level() <<
' ' 3926 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n';
3927 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 3928 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 3936 for (
unsigned int face_no = 0;
3937 face_no < GeometryInfo<dim>::faces_per_cell;
3940 const typename ::Triangulation<dim,
3941 spacedim>::face_iterator
3942 face = cell->face(face_no);
3943 if (dim != spacedim || face->at_boundary() ||
3949 std::vector<Point<spacedim>> line_points;
3952 const unsigned int offset = face_no * n_points;
3953 for (
unsigned int i = 0; i < n_points; ++i)
3954 line_points.push_back(
3956 cell, q_projector->
point(offset + i)));
3957 internal::remove_colinear_points(line_points);
3960 out <<
point <<
' ' << cell->level() <<
' ' 3961 <<
static_cast<unsigned int>(cell->material_id())
3964 out <<
'\n' <<
'\n';
3970 out << face->vertex(0) <<
' ' << cell->level() <<
' ' 3971 <<
static_cast<unsigned int>(cell->material_id())
3973 << face->vertex(1) <<
' ' << cell->level() <<
' ' 3974 <<
static_cast<unsigned int>(cell->material_id())
3983 if (q_projector !=
nullptr)
3994 template <
int spacedim>
4005 const unsigned int n_additional_points =
4007 const unsigned int n_points = 2 + n_additional_points;
4009 typename ::Triangulation<dim, spacedim>::active_cell_iterator cell =
4010 tria.begin_active();
4011 const typename ::Triangulation<dim, spacedim>::active_cell_iterator
4017 std::vector<Point<1>> boundary_points;
4018 if (mapping !=
nullptr)
4020 boundary_points.resize(n_points);
4021 boundary_points[0][0] = 0;
4022 boundary_points[n_points - 1][0] = 1;
4023 for (
unsigned int i = 1; i < n_points - 1; ++i)
4024 boundary_points[i](0) = 1. * i / (n_points - 1);
4026 std::vector<double> dummy_weights(n_points, 1. / n_points);
4030 QIterated<dim - 1> quadrature(quadrature1d, 1);
4035 for (; cell != endc; ++cell)
4038 out <<
"# cell " << cell <<
'\n';
4040 if (mapping ==
nullptr || n_points == 2 ||
4041 (!cell->has_boundary_lines() &&
4045 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 4046 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4047 << cell->vertex(1) <<
' ' << cell->level() <<
' ' 4048 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4049 << cell->vertex(5) <<
' ' << cell->level() <<
' ' 4050 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4051 << cell->vertex(4) <<
' ' << cell->level() <<
' ' 4052 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4053 << cell->vertex(0) <<
' ' << cell->level() <<
' ' 4054 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4057 out << cell->vertex(2) <<
' ' << cell->level() <<
' ' 4058 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4059 << cell->vertex(3) <<
' ' << cell->level() <<
' ' 4060 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4061 << cell->vertex(7) <<
' ' << cell->level() <<
' ' 4062 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4063 << cell->vertex(6) <<
' ' << cell->level() <<
' ' 4064 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4065 << cell->vertex(2) <<
' ' << cell->level() <<
' ' 4066 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4070 out << cell->vertex(0) <<
' ' << cell->level() <<
' ' 4071 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4072 << cell->vertex(2) <<
' ' << cell->level() <<
' ' 4073 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4075 out << cell->vertex(1) <<
' ' << cell->level() <<
' ' 4076 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4077 << cell->vertex(3) <<
' ' << cell->level() <<
' ' 4078 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4080 out << cell->vertex(5) <<
' ' << cell->level() <<
' ' 4081 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4082 << cell->vertex(7) <<
' ' << cell->level() <<
' ' 4083 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4085 out << cell->vertex(4) <<
' ' << cell->level() <<
' ' 4086 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4087 << cell->vertex(6) <<
' ' << cell->level() <<
' ' 4088 <<
static_cast<unsigned int>(cell->material_id()) <<
'\n' 4093 for (
unsigned int face_no = 0;
4094 face_no < GeometryInfo<dim>::faces_per_cell;
4097 const typename ::Triangulation<dim,
4098 spacedim>::face_iterator
4099 face = cell->face(face_no);
4101 if (face->at_boundary() &&
4104 const unsigned int offset = face_no * n_points * n_points;
4105 for (
unsigned int i = 0; i < n_points - 1; ++i)
4106 for (
unsigned int j = 0; j < n_points - 1; ++j)
4111 q_projector->
point(offset + i * n_points + j));
4113 << p0 <<
' ' << cell->level() <<
' ' 4114 <<
static_cast<unsigned int>(cell->material_id())
4119 q_projector->
point(offset +
4120 (i + 1) * n_points + j)))
4121 <<
' ' << cell->level() <<
' ' 4122 <<
static_cast<unsigned int>(cell->material_id())
4128 offset + (i + 1) * n_points + j + 1)))
4129 <<
' ' << cell->level() <<
' ' 4130 <<
static_cast<unsigned int>(cell->material_id())
4135 q_projector->
point(offset + i * n_points +
4137 <<
' ' << cell->level() <<
' ' 4138 <<
static_cast<unsigned int>(cell->material_id())
4142 << p0 <<
' ' << cell->level() <<
' ' 4143 <<
static_cast<unsigned int>(cell->material_id())
4145 out <<
'\n' <<
'\n';
4150 for (
unsigned int l = 0;
4151 l < GeometryInfo<dim>::lines_per_face;
4154 const typename ::Triangulation<dim, spacedim>::
4155 line_iterator line = face->line(l);
4158 &v1 = line->vertex(1);
4159 if (line->at_boundary() ||
4165 std::vector<Point<spacedim>> line_points;
4176 for (
unsigned int i = 0; i < n_points; ++i)
4177 line_points.push_back(
4180 (1 - boundary_points[i][0]) * u0 +
4181 boundary_points[i][0] * u1));
4182 internal::remove_colinear_points(line_points);
4184 out <<
point <<
' ' << cell->level() <<
' ' 4185 <<
static_cast<unsigned int>(
4186 cell->material_id())
4191 << v0 <<
' ' << cell->level() <<
' ' 4192 <<
static_cast<unsigned int>(cell->material_id())
4194 << v1 <<
' ' << cell->level() <<
' ' 4195 <<
static_cast<unsigned int>(cell->material_id())
4198 out <<
'\n' <<
'\n';
4205 if (q_projector !=
nullptr)
4219 template <
int dim,
int spacedim>
4243 const unsigned int l)
4263 write_eps(const ::Triangulation<1, 2> &,
4273 write_eps(const ::Triangulation<1, 3> &,
4283 write_eps(const ::Triangulation<2, 3> &,
4294 template <
int dim,
int spacedim>
4296 write_eps(const ::Triangulation<dim, spacedim> &tria,
4302 using LineList = std::list<LineEntry>;
4314 static_cast<const GridOutFlags::EpsFlagsBase &>(eps_flags_3);
4342 for (typename ::Triangulation<dim, spacedim>::
4343 active_cell_iterator cell = tria.begin_active();
4346 for (
unsigned int line_no = 0;
4347 line_no < GeometryInfo<dim>::lines_per_cell;
4350 typename ::Triangulation<dim, spacedim>::line_iterator
4351 line = cell->line(line_no);
4363 if (!line->has_children() &&
4364 (mapping ==
nullptr || !line->at_boundary()))
4384 line_list.emplace_back(
4385 Point<2>(line->vertex(0)(0), line->vertex(0)(1)),
4386 Point<2>(line->vertex(1)(0), line->vertex(1)(1)),
4387 line->user_flag_set(),
4397 if (mapping !=
nullptr)
4404 std::vector<
Point<dim - 1>> boundary_points(n_points);
4406 for (
unsigned int i = 0; i < n_points; ++i)
4407 boundary_points[i](0) = 1. * (i + 1) / (n_points + 1);
4409 Quadrature<dim - 1> quadrature(boundary_points);
4417 for (typename ::Triangulation<dim, spacedim>::
4418 active_cell_iterator cell = tria.begin_active();
4421 for (
unsigned int face_no = 0;
4422 face_no < GeometryInfo<dim>::faces_per_cell;
4425 const typename ::Triangulation<dim, spacedim>::
4426 face_iterator face = cell->face(face_no);
4428 if (face->at_boundary())
4438 const unsigned int offset = face_no * n_points;
4439 for (
unsigned int i = 0; i < n_points; ++i)
4443 cell, q_projector.
point(offset + i)));
4444 const Point<2> p1(p1_dim(0), p1_dim(1));
4446 line_list.emplace_back(p0,
4448 face->user_flag_set(),
4455 const Point<2> p1(p1_dim(0), p1_dim(1));
4456 line_list.emplace_back(p0,
4458 face->user_flag_set(),
4473 typename ::Triangulation<dim,
4474 spacedim>::active_cell_iterator
4475 cell = tria.begin_active(),
4498 const double turn_angle = eps_flags_3.
turn_angle;
4500 -std::sin(z_angle * 2. * pi / 360.) *
4501 std::sin(turn_angle * 2. * pi / 360.),
4502 +std::sin(z_angle * 2. * pi / 360.) *
4503 std::cos(turn_angle * 2. * pi / 360.),
4504 -std::cos(z_angle * 2. * pi / 360.));
4512 ((
Point<dim>(0, 0, 1) * view_direction) * view_direction);
4521 ((
Point<dim>(1, 0, 0) * view_direction) * view_direction) -
4522 ((
Point<dim>(1, 0, 0) * unit_vector1) * unit_vector1));
4526 for (; cell != endc; ++cell)
4527 for (
unsigned int line_no = 0;
4528 line_no < GeometryInfo<dim>::lines_per_cell;
4531 typename ::Triangulation<dim, spacedim>::line_iterator
4532 line = cell->line(line_no);
4533 line_list.emplace_back(
4534 Point<2>(line->vertex(0) * unit_vector2,
4535 line->vertex(0) * unit_vector1),
4536 Point<2>(line->vertex(1) * unit_vector2,
4537 line->vertex(1) * unit_vector1),
4538 line->user_flag_set(),
4554 double x_min = tria.begin_active()->vertex(0)(0);
4555 double x_max = x_min;
4556 double y_min = tria.begin_active()->vertex(0)(1);
4557 double y_max = y_min;
4558 unsigned int max_level = line_list.begin()->level;
4560 for (LineList::const_iterator line = line_list.begin();
4561 line != line_list.end();
4564 x_min = std::min(x_min, line->first(0));
4565 x_min = std::min(x_min, line->second(0));
4567 x_max = std::max(x_max, line->first(0));
4568 x_max = std::max(x_max, line->second(0));
4570 y_min = std::min(y_min, line->first(1));
4571 y_min = std::min(y_min, line->second(1));
4573 y_max = std::max(y_max, line->first(1));
4574 y_max = std::max(y_max, line->second(1));
4576 max_level = std::max(max_level, line->level);
4584 const double scale =
4585 (eps_flags_base.
size /
4596 std::time_t time1 = std::time(
nullptr);
4597 std::tm * time = std::localtime(&time1);
4598 out <<
"%!PS-Adobe-2.0 EPSF-1.2" <<
'\n' 4599 <<
"%%Title: deal.II Output" <<
'\n' 4600 <<
"%%Creator: the deal.II library" <<
'\n' 4601 <<
"%%Creation Date: " << time->tm_year + 1900 <<
"/" 4602 << time->tm_mon + 1 <<
"/" << time->tm_mday <<
" - " 4603 << time->tm_hour <<
":" << std::setw(2) << time->tm_min <<
":" 4604 << std::setw(2) << time->tm_sec <<
'\n' 4605 <<
"%%BoundingBox: " 4609 <<
static_cast<unsigned int>(
4610 std::floor(((x_max - x_min) *
scale) + 1))
4612 << static_cast<unsigned int>(
4613 std::floor(((y_max - y_min) *
scale) + 1))
4622 out <<
"/m {moveto} bind def" <<
'\n' 4623 <<
"/x {lineto stroke} bind def" <<
'\n' 4624 <<
"/b {0 0 0 setrgbcolor} def" <<
'\n' 4625 <<
"/r {1 0 0 setrgbcolor} def" <<
'\n';
4632 out <<
"/l { neg " << (max_level) <<
" add " 4633 << (0.66666 / std::max(1U, (max_level - 1)))
4634 <<
" mul 1 0.8 sethsbcolor} def" <<
'\n';
4648 << (
"/R {rmoveto} bind def\n" 4649 "/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont\n" 4650 "dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall\n" 4651 "currentdict end definefont\n" 4652 "/MFshow {{dup dup 0 get findfont exch 1 get scalefont setfont\n" 4653 "[ currentpoint ] exch dup 2 get 0 exch rmoveto dup dup 5 get exch 4 get\n" 4654 "{show} {stringwidth pop 0 rmoveto}ifelse dup 3 get\n" 4655 "{2 get neg 0 exch rmoveto pop} {pop aload pop moveto}ifelse} forall} bind def\n" 4656 "/MFwidth {0 exch {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n" 4657 "5 get stringwidth pop add}\n" 4658 "{pop} ifelse} forall} bind def\n" 4659 "/MCshow { currentpoint stroke m\n" 4660 "exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n")
4664 out <<
"%%EndProlog" <<
'\n' <<
'\n';
4667 out << eps_flags_base.
line_width <<
" setlinewidth" <<
'\n';
4671 const Point<2> offset(x_min, y_min);
4673 for (LineList::const_iterator line = line_list.begin();
4674 line != line_list.end();
4677 out << line->level <<
" l " << (line->first - offset) *
scale <<
" m " 4678 << (line->second - offset) *
scale <<
" x" <<
'\n';
4683 << (line->first - offset) *
scale <<
" m " 4684 << (line->second - offset) *
scale <<
" x" <<
'\n';
4690 out <<
"(Helvetica) findfont 140 scalefont setfont" <<
'\n';
4692 typename ::Triangulation<dim, spacedim>::active_cell_iterator
4693 cell = tria.begin_active(),
4695 for (; cell != endc; ++cell)
4697 out << (cell->center()(0) - offset(0)) *
scale <<
' ' 4698 << (cell->center()(1) - offset(1)) *
scale <<
" m" <<
'\n' 4699 <<
"[ [(Helvetica) 12.0 0.0 true true (";
4703 out << cell->index();
4706 <<
"] -6 MCshow" <<
'\n';
4713 out <<
"(Helvetica) findfont 140 scalefont setfont" <<
'\n';
4719 std::set<unsigned int> treated_vertices;
4720 typename ::Triangulation<dim, spacedim>::active_cell_iterator
4721 cell = tria.begin_active(),
4723 for (; cell != endc; ++cell)
4724 for (
unsigned int vertex = 0;
4725 vertex < GeometryInfo<dim>::vertices_per_cell;
4727 if (treated_vertices.find(cell->vertex_index(vertex)) ==
4728 treated_vertices.end())
4730 treated_vertices.insert(cell->vertex_index(vertex));
4732 out << (cell->vertex(vertex)(0) - offset(0)) *
scale <<
' ' 4733 << (cell->vertex(vertex)(1) - offset(1)) *
scale <<
" m" 4735 <<
"[ [(Helvetica) 10.0 0.0 true true (" 4736 << cell->vertex_index(vertex) <<
")] " 4737 <<
"] -6 MCshow" <<
'\n';
4741 out <<
"showpage" <<
'\n';
4753 template <
int dim,
int spacedim>
4763 template <
int dim,
int spacedim>
4770 switch (output_format)
4820 template <
int dim,
int spacedim>
4831 #include "grid_out.inst" 4834 DEAL_II_NAMESPACE_CLOSE
void parse_parameters(ParameterHandler ¶m)
void parse_parameters(ParameterHandler ¶m)
unsigned int n_boundary_faces(const Triangulation< dim, spacedim > &tria) const
unsigned int n_active_cells() const
long int get_integer(const std::string &entry_string) const
unsigned int n_used_vertices() const
const types::manifold_id flat_manifold_id
static const unsigned int invalid_unsigned_int
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)
active_face_iterator begin_active_face() const
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation="")
static OutputFormat parse_output_format(const std::string &format_name)
void parse_parameters(ParameterHandler ¶m)
bool margin
Margin around the plotted area.
void attach_triangulation(const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &)
bool write_additional_boundary_lines
void write_xfig(const Triangulation< dim, spacedim > &tria, std::ostream &out, const Mapping< dim, spacedim > *mapping=nullptr) const
static ::ExceptionBase & ExcIO()
unsigned int n_boundary_face_points
static void declare_parameters(ParameterHandler ¶m)
GridOutFlags::Eps< 2 > eps_flags_2
IteratorRange< active_cell_iterator > active_cell_iterators() const
void write_vtu(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
std::string get(const std::string &entry_string) const
void parse_parameters(ParameterHandler ¶m)
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
const Point< dim > & point(const unsigned int i) const
static void declare_parameters(ParameterHandler ¶m)
Convert the level number into the cell color.
write() calls write_eps()
active_cell_iterator begin_active(const unsigned int level=0) const
unsigned int line_thickness
Thickness of the lines between cells.
bool convert_level_number_to_height
#define AssertThrow(cond, exc)
numbers::NumberTraits< Number >::real_type norm() const
static Point< 2 > svg_project_point(Point< 3 > point, Point< 3 > camera_position, Point< 3 > camera_direction, Point< 3 > camera_horizontal, float camera_focus)
void write_mathgl(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
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 write_msh_faces(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
void parse_parameters(ParameterHandler ¶m)
__global__ void scale(Number *val, const Number *V_val, const size_type N)
void parse_parameters(ParameterHandler ¶m)
unsigned int n_extra_curved_line_points
unsigned int neighbors[dim > 0 ? GeometryInfo< dim >::faces_per_cell :1]
write() calls write_ucd()
void write_gnuplot(const Triangulation< dim, spacedim > &tria, std::ostream &out, const Mapping< dim, spacedim > *mapping=nullptr) const
cell_iterator end() const
unsigned int n_boundary_lines(const Triangulation< dim, spacedim > &tria) const
void enter_subsection(const std::string &subsection)
GridOutFlags::Vtk vtk_flags
bool label_cell_index
Write cell index into each cell. Defaults to true.
GridOutFlags::Gnuplot gnuplot_flags
void write_svg(const Triangulation< 2, 2 > &tria, std::ostream &out) const
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)
std::size_t memory_consumption() const
double get_double(const std::string &entry_name) const
GridOutFlags::MathGL mathgl_flags
void save_user_flags_line(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.
const types::boundary_id invalid_boundary_id
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)
const std::vector< Point< spacedim > > & get_vertices() const
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
bool get_bool(const std::string &entry_name) const
void write_vtk(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
GridOutFlags::Ucd ucd_flags
static void declare_parameters(ParameterHandler ¶m)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static void declare_parameters(ParameterHandler ¶m)
unsigned int n_mpi_processes(const MPI_Comm &mpi_communicator)
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.
void parse_parameters(ParameterHandler ¶m)
unsigned int n_boundary_face_points
static void declare_parameters(ParameterHandler ¶m)
unsigned int write_ucd_faces(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
write() calls write_msh()
static constexpr double PI
const std::vector< bool > & get_used_vertices() const
void write_ucd(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
unsigned int write_ucd_lines(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
write() calls write_svg()
unsigned int write_msh_lines(const Triangulation< dim, spacedim > &tria, const unsigned int next_element_index, std::ostream &out) const
GridOutFlags::Svg svg_flags
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 write_eps(const Triangulation< dim, spacedim > &tria, std::ostream &out, const Mapping< dim, spacedim > *mapping=nullptr) const
static ::ExceptionBase & ExcNotImplemented()
Convert the material id into the cell color (default)
IteratorRange< cell_iterator > cell_iterators() const
float level_height_factor
GridOutFlags::Eps< 3 > eps_flags_3
face_iterator end_face() const
static ::ExceptionBase & ExcInvalidState()
const types::boundary_id internal_face_boundary_id
write() calls write_vtu()
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)
void write_dx(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
void write(const Triangulation< dim, spacedim > &tria, std::ostream &out, const OutputFormat output_format, const Mapping< dim, spacedim > *mapping=nullptr) const
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const =0
Gnuplot & operator=(const Gnuplot &flags)
GridOutFlags::Vtu vtu_flags
write() calls write_vtk()
virtual types::subdomain_id locally_owned_subdomain() const
void write_gnuplot(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const GnuplotFlags &flags, std::ostream &out)
void parse_parameters(ParameterHandler ¶m)
void parse_parameters(ParameterHandler ¶m)
void write_eps(const std::vector< Patch< 2, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string >> &nonscalar_data_ranges, const EpsFlags &flags, std::ostream &out)
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)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static ::ExceptionBase & ExcInternalError()
void write_msh(const Triangulation< dim, spacedim > &tria, std::ostream &out) const
std::string default_suffix() const