Commit 6701eb96 authored by Andreas Dedner's avatar Andreas Dedner

added DUNEPY_DISABLE_PLOTTING environment variable so that no plotting windows are opened

parent fe8b05a4
# from .alu import create as aluGrid
# from .alusimplex import create as aluSimplexGrid
# from .alucube import create as aluCubeGrid
# from .aluconform import create as aluConformGrid
# from .oned import create as oneDGrid
# from .sp import create as spGrid
# from .ug import create as ugGrid
# from .yasp import create as yaspGrid
from .._grid import reader
from .map import MultipleCodimMultipleGeomTypeMapper as Mapper
......
......@@ -10,6 +10,13 @@ try:
block = s in ['TRUE','true', '1', 't', 'y', 'yes']
except KeyError:
block = True
try:
s = os.environ['DUNEPY_DISABLE_PLOTTING']
disable = s in ['TRUE','true', '1', 't', 'y', 'yes']
except KeyError:
disable = False
block = block and (not disable)
def _plotGrid(fig, grid, gridLines="black"):
for p in grid.polygons():
......@@ -19,6 +26,8 @@ def _plotGrid(fig, grid, gridLines="black"):
def plotGrid(grid, gridLines="black", figure=None,
xlim=None, ylim=None, figsize=None):
if disable: return
if figure is None:
figure = pyplot.figure(figsize=figsize)
......@@ -148,6 +157,7 @@ def plotPointData(solution, level=0, gridLines="black",
vectors=None, nofVectors=None, figure=None,
xlim=None, ylim=None, clim=None, figsize=None, cmap=None,
colorbar=True):
if disable: return
try:
grid = solution.grid
except:
......@@ -173,6 +183,7 @@ def plotCellData(solution, level=0, gridLines="black",
vectors=None, nofVectors=None, figure=None,
xlim=None, ylim=None, clim=None, figsize=None, cmap=None,
colorbar=True):
if disable: return
try:
grid = solution.grid
except:
......@@ -195,6 +206,7 @@ def plotCellData(solution, level=0, gridLines="black",
def plotComponents(solution, level=0, show=None, gridLines="black", figure=None,
xlim=None, ylim=None, clim=None, figsize=None, cmap=None):
if disable: return
try:
grid = solution.grid
except:
......@@ -227,6 +239,7 @@ def plotComponents(solution, level=0, show=None, gridLines="black", figure=None,
pyplot.show(block=block)
def plot(solution,*args,**kwargs):
if disable: return
try:
grid = solution.grid
except:
......@@ -243,6 +256,7 @@ def plot(solution,*args,**kwargs):
raise ValueError("wrong value for 'on' parameter should be one of 'points','cells','components-points'")
def mayaviPointData(solution, level=0, component=0):
if disable: return
grid = solution.grid
from mayavi import mlab
triangulation = grid.triangulation(level)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment