Skip to content
Snippets Groups Projects
Commit fdb3a2f7 authored by Simon Praetorius's avatar Simon Praetorius Committed by Santiago Ospina De Los Ríos
Browse files

Add an overload of printGrid that does not need an MPIHelper

parent 2749fc2f
No related branches found
No related tags found
1 merge request!768Add an overload of printGrid that does not need an MPIHelper
......@@ -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
......@@ -67,16 +66,14 @@ 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, 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment