From db99641f9960018d52749ce88f1b2f4ad406b03f Mon Sep 17 00:00:00 2001 From: Marco Mancini Date: Fri, 18 Dec 2015 16:34:42 +0100 Subject: [PATCH] Parallel plotting vectorfield: added example --- .../manifolds/differentiable/vectorfield.py | 23 +++++++++++++++++-- src/sage/tensor/modules/comp.py | 1 - 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/sage/manifolds/differentiable/vectorfield.py b/src/sage/manifolds/differentiable/vectorfield.py index 22b7d14c604..d71350cbdf0 100644 --- a/src/sage/manifolds/differentiable/vectorfield.py +++ b/src/sage/manifolds/differentiable/vectorfield.py @@ -503,10 +503,29 @@ def plot(self, chart=None, ambient_coords=None, mapping=None, g = v.plot(max_range=4, nb_values=5, scale=0.5) sphinx_plot(g) + Plot using parallel computation:: + + sage: Parallelism().set('tensor', nproc=2) + sage: Parallelism().get('tensor') + 2 + sage: v.plot(scale=0.5, nb_values=10, linestyle='--', width=1, arrowsize=6) + Graphics object consisting of 100 graphics primitives + + .. PLOT:: + + M = Manifold(2, 'M') + X = M.chart('x y'); x, y = X[:] + v = M.vector_field(name='v'); v[:] = -y, x + g = v.plot(scale=0.5, nb_values=10, linestyle='--', width=1, arrowsize=6) + sphinx_plot(g) + + :: + sage: Parallelism().set('tensor', nproc=1) # switch off parallelization + Plots along a line of fixed coordinate:: sage: v.plot(fixed_coords={x: -2}) - Graphics object consisting of 9 graphics primitives + Graphics object consisting of 8 graphics primitives .. PLOT:: @@ -559,7 +578,7 @@ def plot(self, chart=None, ambient_coords=None, mapping=None, or, for a 2D plot:: sage: v.plot(ambient_coords=(x, y), fixed_coords={t: 1, z: 0}) - Graphics object consisting of 80 graphics primitives + Graphics object consisting of 64 graphics primitives .. PLOT:: diff --git a/src/sage/tensor/modules/comp.py b/src/sage/tensor/modules/comp.py index 1bc1bdfccc6..d6bc2a09708 100644 --- a/src/sage/tensor/modules/comp.py +++ b/src/sage/tensor/modules/comp.py @@ -253,7 +253,6 @@ class :class:`~sage.tensor.differential_form_element.DifferentialForm`) from sage.parallel.decorate import parallel from sage.parallel.parallelism import Parallelism from operator import itemgetter -import time class Components(SageObject): r"""