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 <code>.eps</code> files in much the same way
+computations and outputs them as <code>.vtu</code> 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
the <a href="#Results">results section</a> below.
-<!--
-
-Possible Extensions
-
-- Modify a mesh:
- - change boundary indicators
- - relax inner vertices
-- Database of unstructured meshes for convergence studies
-- discuss GridTools::extract_boundary_mesh
-- how to remove or disable a cell inside a mesh
--->
<h1>Results</h1>
-The program produces a series of <code>.eps</code> files of the
+The program produces a series of <code>.vtu</code> files of the
triangulations. The methods are discussed above.
<img src="https://www.dealii.org/images/steps/developer/step-49.yuhan.11.png"
alt="" width="400" height="355">
+
+
+<h3> Possible extensions </h3>
+
+<h4> Modify a mesh </h4>
+
+Similar to the operations in step-1, iterate over a mesh and change boundary
+indicators.
+
+<h4> Extracting a boundary mesh </h4>
+
+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.
+
+
+<!--
+
+Possible Extensions for this tutorial:
+
+- Database of unstructured meshes for convergence studies
+- how to remove or disable a cell inside a mesh
+-->
// - 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 <int dim>
void print_mesh_info(const Triangulation<dim> &triangulation,
const std::string & filename)
// 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;
}
std::ifstream f("untitled.msh");
gridin.read_msh(f);
- print_mesh_info(triangulation, "grid-1.eps");
+ print_mesh_info(triangulation, "grid-1.vtu");
}
Triangulation<2> triangulation;
GridGenerator::merge_triangulations(tria1, tria2, triangulation);
- print_mesh_info(triangulation, "grid-2.eps");
+ print_mesh_info(triangulation, "grid-2.vtu");
}
// section</a> for a fully worked example where we <em>do</em> 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
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");
}
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");
}
Point<2>(1.0, 1.0));
GridTools::transform(Grid6Func(), triangulation);
- print_mesh_info(triangulation, "grid-6.eps");
+ print_mesh_info(triangulation, "grid-6.vtu");
}
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