From: Timo Heister Date: Wed, 7 Aug 2019 20:24:09 +0000 (-0600) Subject: step-49: switch to vtu and add possible extensions X-Git-Tag: v9.2.0-rc1~957^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8667c384c06697b8ff3cdf113a4a6f1debb4e7a4;p=dealii.git step-49: switch to vtu and add possible extensions --- diff --git a/examples/step-49/doc/intro.dox b/examples/step-49/doc/intro.dox index d84c925692..51fb958fec 100644 --- a/examples/step-49/doc/intro.dox +++ b/examples/step-49/doc/intro.dox @@ -11,7 +11,7 @@ dimensions. We will discuss several ways to do this, but this list is not exhaustive. Additionally, there is not one approach that fits all problems. This example program shows some of ways to create and modify meshes for -computations and outputs them as .eps files in much the same way +computations and outputs them as .vtu files in much the same way as we do in step-1. No other computations or adaptive refinements are done; the idea is that you can use the techniques used here as building blocks in other, more involved simulators. Please note that the @@ -279,14 +279,3 @@ just creating the mesh are necessary. We will go over some of these steps in the results section below. - diff --git a/examples/step-49/doc/results.dox b/examples/step-49/doc/results.dox index d7c0aa0510..870823510d 100644 --- a/examples/step-49/doc/results.dox +++ b/examples/step-49/doc/results.dox @@ -1,6 +1,6 @@

Results

-The program produces a series of .eps files of the +The program produces a series of .vtu files of the triangulations. The methods are discussed above. @@ -328,3 +328,27 @@ the nice detail of the boundary fitted mesh if we refine two more times: + + +

Possible extensions

+ +

Modify a mesh

+ +Similar to the operations in step-1, iterate over a mesh and change boundary +indicators. + +

Extracting a boundary mesh

+ +To compute on surfaces on manifolds, you can use the function +GridTools::extract_boundary_mesh() to extract the surface elements of a +mesh. For example, using the function on a 3d mesh (a Triangulation<3,3>), +this will return a Triangulation<2,3> that you can use in step-38 for example. + + + diff --git a/examples/step-49/step-49.cc b/examples/step-49/step-49.cc index 2d2724a730..abf6625b9e 100644 --- a/examples/step-49/step-49.cc +++ b/examples/step-49/step-49.cc @@ -55,8 +55,8 @@ using namespace dealii; // - The number of boundary faces that use each boundary indicator, so that // it can be compared with what we expect. // -// Finally, the function outputs the mesh in encapsulated postscript (EPS) -// format that can easily be visualized in the same way as was done in step-1. +// Finally, the function outputs the mesh in VTU format that can easily be +// visualized in Paraview or VisIt. template void print_mesh_info(const Triangulation &triangulation, const std::string & filename) @@ -95,7 +95,7 @@ void print_mesh_info(const Triangulation &triangulation, // file: std::ofstream out(filename); GridOut grid_out; - grid_out.write_eps(triangulation, out); + grid_out.write_vtu(triangulation, out); std::cout << " written to " << filename << std::endl << std::endl; } @@ -116,7 +116,7 @@ void grid_1() std::ifstream f("untitled.msh"); gridin.read_msh(f); - print_mesh_info(triangulation, "grid-1.eps"); + print_mesh_info(triangulation, "grid-1.vtu"); } @@ -142,7 +142,7 @@ void grid_2() Triangulation<2> triangulation; GridGenerator::merge_triangulations(tria1, tria2, triangulation); - print_mesh_info(triangulation, "grid-2.eps"); + print_mesh_info(triangulation, "grid-2.vtu"); } @@ -191,7 +191,7 @@ void grid_3() // section for a fully worked example where we do attach a // Manifold object). triangulation.refine_global(2); - print_mesh_info(triangulation, "grid-3.eps"); + print_mesh_info(triangulation, "grid-3.vtu"); } // There is one snag to doing things as shown above: If one moves the nodes on @@ -221,7 +221,7 @@ void grid_4() GridGenerator::hyper_cube_with_cylindrical_hole(triangulation, 0.25, 1.0); GridGenerator::extrude_triangulation(triangulation, 3, 2.0, out); - print_mesh_info(out, "grid-4.eps"); + print_mesh_info(out, "grid-4.vtu"); } @@ -255,7 +255,7 @@ void grid_5() return {in[0], in[1] + std::sin(in[0] / 5.0 * numbers::PI)}; }, triangulation); - print_mesh_info(triangulation, "grid-5.eps"); + print_mesh_info(triangulation, "grid-5.vtu"); } @@ -295,7 +295,7 @@ void grid_6() Point<2>(1.0, 1.0)); GridTools::transform(Grid6Func(), triangulation); - print_mesh_info(triangulation, "grid-6.eps"); + print_mesh_info(triangulation, "grid-6.vtu"); } @@ -318,14 +318,14 @@ void grid_7() Point<2>(1.0, 1.0)); GridTools::distort_random(0.3, triangulation, true); - print_mesh_info(triangulation, "grid-7.eps"); + print_mesh_info(triangulation, "grid-7.vtu"); } // @sect3{The main function} -// Finally, the main function. There isn't much to do here, only to call the -// subfunctions. +// Finally, the main function. There isn't much to do here, only to call all the +// various functions we wrote above. int main() { try