Exemplo n.º 1
0
 def show(self, mesh, show=True, lib="glut", notebook=False, space=None,
         filename="a.png", **options):
     if lib == "glut":
         from _hermes2d import MeshView
         m = MeshView(self._name, self._x, self._y, self._w, self._h)
         m.show(mesh)
         m.wait()
     elif lib == "mpl":
         p = plot_hermes_mesh_mpl(mesh, space=space, **options)
         if show:
             if notebook:
                 p.savefig(filename)
             else:
                 p.show()
                 import pylab
                 pylab.show()
         return p
     else:
         raise NotImplementedError("Unknown library '%s'" % lib)
Exemplo n.º 2
0
 def show(self, mesh, show=True, lib="mpl", notebook=None, space=None,
         filename="mesh.png", **options):
     if notebook is None:
         try:
             from sagenb.misc.support import EMBEDDED_MODE
         except ImportError:
             EMBEDDED_MODE = False
         notebook = EMBEDDED_MODE
     if lib == "glut":
         from _hermes2d import MeshView
         m = MeshView(self._name, self._x, self._y, self._w, self._h)
         m.show(mesh)
         m.wait()
     elif lib == "mpl":
         p = plot_hermes_mesh_mpl(mesh, space=space, **options)
         if show:
             if notebook:
                 p.savefig(filename)
             else:
                 p.show()
                 import pylab
                 pylab.show()
         return p
     else:
         raise NotImplementedError("Unknown library '%s'" % lib)