From e328ca212ff8248b1cb5ade4a3726c312d7ba079 Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Fri, 21 Feb 2025 17:08:50 +0100 Subject: [PATCH 1/2] dd an overload of printGrid that does not need an MPIHelper --- dune/grid/io/file/printgrid.hh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/dune/grid/io/file/printgrid.hh b/dune/grid/io/file/printgrid.hh index 6af758f5a4..63d4791581 100644 --- a/dune/grid/io/file/printgrid.hh +++ b/dune/grid/io/file/printgrid.hh @@ -59,7 +59,6 @@ namespace Dune { /** \brief Print a grid as a gnuplot for testing and development * \tparam GridType the type of grid to work with * \param grid the grid to print - * \param helper an MPIHelper to create unique output file names in parallel case * \param output_file the base of the output filename * \param size size of the plot in pixels; increase if plot is too cramped * \param execute_plot whether to execute gnuplot automatically @@ -70,13 +69,11 @@ namespace Dune { * Creates a gnuplot (one per process if parallel) showing the grid structure with indices, intersection types etc. */ template <typename GridType> - void printGrid (const GridType& grid, const Dune::MPIHelper& helper, std::string output_file = "printgrid", + void printGrid (const GridType& grid, std::string output_file, int size = 2000, bool execute_plot = true, bool png = true, bool local_corner_indices = true, bool local_intersection_indices = true, bool outer_normals = true) { - // Create output file - output_file = output_file + "_" + std::to_string(helper.rank()); std::string plot_file_name = output_file + ".gnuplot"; std::ofstream plotfile (plot_file_name, std::ios::out | std::ios::trunc); if (!plotfile.is_open()) { @@ -201,6 +198,27 @@ namespace Dune { } } + + /** \brief Print a grid as a gnuplot for testing and development + * \tparam GridType the type of grid to work with + * \param grid the grid to print + * \param helper an MPIHelper to create unique output file names in parallel case + * \param output_file the base of the output filename + * \param size size of the plot in pixels; increase if plot is too cramped + * \param execute_plot whether to execute gnuplot automatically + * \param png whether to use PNG or SVG as the output format + * \param local_corner_indices whether to show local corner indices + * \param local_intersection_indices whether to show local intersection indices + * \param outer_normals whether to show outer normals of intersections + * Creates a gnuplot (one per process if parallel) showing the grid structure with indices, intersection types etc. + */ + template <typename GridType> + void printGrid (const GridType& grid, const Dune::MPIHelper& helper, std::string output_file = "printgrid", + int size = 2000, bool execute_plot = true, bool png = true, bool local_corner_indices = true, + bool local_intersection_indices = true, bool outer_normals = true) + { + printGrid(grid, output_file + "_" + std::to_string(helper.rank()), size, execute_plot, png, local_corner_indices, local_intersection_indices, outer_normals); + } } #endif // #ifndef DUNE_PRINTGRID_HH -- GitLab From 3dbc10c1efdcdc548b6b2d71b297b793fa35d3e0 Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Fri, 21 Feb 2025 17:19:22 +0100 Subject: [PATCH 2/2] Update the documentation --- dune/grid/io/file/printgrid.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dune/grid/io/file/printgrid.hh b/dune/grid/io/file/printgrid.hh index 63d4791581..556271ddb2 100644 --- a/dune/grid/io/file/printgrid.hh +++ b/dune/grid/io/file/printgrid.hh @@ -66,7 +66,7 @@ namespace Dune { * \param local_corner_indices whether to show local corner indices * \param local_intersection_indices whether to show local intersection indices * \param outer_normals whether to show outer normals of intersections - * Creates a gnuplot (one per process if parallel) showing the grid structure with indices, intersection types etc. + * Creates a gnuplot showing the grid structure with indices, intersection types etc. */ template <typename GridType> void printGrid (const GridType& grid, std::string output_file, -- GitLab