From 39c28b201b72d096b0a05836a4f2c4da220cdca6 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Wed, 29 Apr 2015 02:17:57 -0500
Subject: [PATCH] Add set_bounding_box flag to 2D mesh viz

---
 meshmode/mesh/visualization.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meshmode/mesh/visualization.py b/meshmode/mesh/visualization.py
index 8966861b..15c53940 100644
--- a/meshmode/mesh/visualization.py
+++ b/meshmode/mesh/visualization.py
@@ -30,7 +30,7 @@ import numpy as np
 # {{{ draw_2d_mesh
 
 def draw_2d_mesh(mesh, draw_vertex_numbers=True, draw_element_numbers=True,
-        draw_connectivity=False, **kwargs):
+        draw_connectivity=False, set_bounding_box=False, **kwargs):
     assert mesh.ambient_dim == 2
 
     import matplotlib.pyplot as pt
@@ -110,6 +110,12 @@ def draw_2d_mesh(mesh, draw_vertex_numbers=True, draw_element_numbers=True,
                         length_includes_head=True,
                         color="green", head_width=1e-2, lw=1e-2)
 
+    if set_bounding_box:
+        from meshmode.mesh.processing import find_bounding_box
+        lower, upper = find_bounding_box(mesh)
+        pt.xlim([lower[0], upper[0]])
+        pt.ylim([lower[1], upper[1]])
+
 # }}}
 
 # vim: foldmethod=marker
-- 
GitLab