From 025ea6e71f3f1e300e9864924ea3a025398952f9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 3 Aug 2019 14:07:18 -0600 Subject: [PATCH] Let step-1 output SVG instead of EPS. --- examples/step-1/doc/results.dox | 37 +++++++++++++++++++++++++++------ examples/step-1/step-1.cc | 17 ++++++++------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/examples/step-1/doc/results.dox b/examples/step-1/doc/results.dox index 44f6ceeb29..c2ce47ff7b 100644 --- a/examples/step-1/doc/results.dox +++ b/examples/step-1/doc/results.dox @@ -1,27 +1,37 @@

Results

-Running the program produces graphics of two grids (grid-1.eps and grid-2.eps). They look like this: +Running the program produces graphics of two grids (grid-1.svg and grid-2.svg). +You can open these with most every web browser -- in the simplest case, +just open the current directory in your file system explorer and click +on the file. If you like working on the command line, you call your +web browser with the file: `firefox grid-1.svg`, `google-chrome grid-1.svg`, +or whatever the name of your browser is. If you do this, the two meshes +should look like this:
- + - +
The left one, well, is not very exciting. The right one is — at least -— unconventional. +— unconventional. The pictures color-code the "refinement level" of each +cell: How many times did a coarse mesh cell have to be subdivided to obtain +the given cell. In the left image, this is boring since the mesh was +refined globally a number of times, i.e., every cell was +refined the same number of times. -While the second mesh is entirely artificial and made-up, and +(While the second mesh is entirely artificial and made-up, and certainly not very practical in applications, to everyone's surprise it has found its way into the literature: see the paper by M. Mu titled "PDE.MART: A network-based problem-solving environment", ACM Trans. Math. Software, vol. 31, pp. 508-531, 2005. Apparently it is -good for some things at least. +good for some things at least.)

Possible extensions

@@ -90,3 +100,18 @@ possible. It will be time well invested. Questions (FAQ) page linked to from the top-level deal.II webpage also provides a good number of hints on debugging deal.II programs. + + +

More about graphical output

+ +It is often useful to include meshes into your theses or publications. +For this, it may not be very useful to color-code the cells by +refinement level, and to print the cell number onto each cell. But +it doesn't have to be that way -- the GridOut class allows setting flags +for each possible output format (see the classes in the GridOutFlags +namespace) that control how exactly a mesh is plotted. You can of +course also choose other output file formats such as VTK or VTU; this +is particularly useful for 3d meshes where a 2d format such as SVG +is not particular useful because it fixes a particular viewpoint onto +the 3d object. As a consequence, you might want to explore other +options in the GridOut class. diff --git a/examples/step-1/step-1.cc b/examples/step-1/step-1.cc index 93b65b79ce..327fc5f3c3 100644 --- a/examples/step-1/step-1.cc +++ b/examples/step-1/step-1.cc @@ -68,11 +68,12 @@ void first_grid() // Now we want to write a graphical representation of the mesh to an output // file. The GridOut class of deal.II can do that in a number of different - // output formats; here, we choose encapsulated postscript (eps) format: - std::ofstream out("grid-1.eps"); + // output formats; here, we choose scalable vector graphics (SVG) format + // that you can visualize using the web browser of your choice: + std::ofstream out("grid-1.svg"); GridOut grid_out; - grid_out.write_eps(triangulation, out); - std::cout << "Grid written to grid-1.eps" << std::endl; + grid_out.write_svg(triangulation, out); + std::cout << "Grid written to grid-1.svg" << std::endl; } @@ -238,13 +239,13 @@ void second_grid() // Finally, after these five iterations of refinement, we want to again - // write the resulting mesh to a file, again in eps format. This works just + // write the resulting mesh to a file, again in SVG format. This works just // as above: - std::ofstream out("grid-2.eps"); + std::ofstream out("grid-2.svg"); GridOut grid_out; - grid_out.write_eps(triangulation, out); + grid_out.write_svg(triangulation, out); - std::cout << "Grid written to grid-2.eps" << std::endl; + std::cout << "Grid written to grid-2.svg" << std::endl; } -- 2.39.5