From f77d9e2930119f2a95f7a2361c1a4bb2d949d8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaman=20G=C3=BC=C3=A7l=C3=BC?= Date: Fri, 5 Feb 2021 14:40:07 +0100 Subject: [PATCH] Don't use SymPDE's obsolete classes Scalar/VectorField (#9) * Do not import obsolete classes ScalarField and VectorField from SymPDE - they were not used anyway; * Update version. --- gelato/expr.py | 16 +++++----------- gelato/tests/test_glt_symbol.py | 10 +++++----- gelato/version.py | 2 +- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gelato/expr.py b/gelato/expr.py index b7c1d66..4355aab 100644 --- a/gelato/expr.py +++ b/gelato/expr.py @@ -1,17 +1,13 @@ # coding: utf-8 -from sympy import Function -from sympy.core import Add, Mul from sympy import I as sympy_I from sympy import Symbol from sympy.core.containers import Tuple from sympy import S -from sympy.core import Expr, Basic, AtomicExpr +from sympy.core import Expr, Basic from sympy import simplify, expand -from sympy import Matrix, ImmutableDenseMatrix -from sympy.physics.quantum import TensorProduct -from sympde.expr import LinearForm, BilinearForm +from sympde.expr import BilinearForm from sympde.expr import TensorExpr from sympde.expr import Mass as MassForm @@ -22,12 +18,12 @@ from sympde.expr import Basic1dForm from sympde.topology import SymbolicExpr from sympde.calculus.matrices import SymbolicDeterminant -from sympde.topology.space import ScalarField, VectorField -from .glt import (BasicGlt, Mass, Stiffness, - Advection, Bilaplacian) +from .glt import (BasicGlt, Mass, Stiffness, Advection, Bilaplacian) +__all__ = ('gelatize', 'GltExpr') +#============================================================================== def gelatize(a, degrees=None, n_elements=None, evaluate=False, mapping=None, human=False, expand=False): @@ -130,8 +126,6 @@ def gelatize(a, degrees=None, n_elements=None, evaluate=False, mapping=None, return expr - - #============================================================================== # TODO add __call__ class GltExpr(Expr): diff --git a/gelato/tests/test_glt_symbol.py b/gelato/tests/test_glt_symbol.py index 4cdb06b..79f64d7 100644 --- a/gelato/tests/test_glt_symbol.py +++ b/gelato/tests/test_glt_symbol.py @@ -1,7 +1,7 @@ # coding: utf-8 from sympy.core import Symbol -from sympy import cos, sin +from sympy import cos, sin, Rational as frac from gelato import Mass, Stiffness, Advection, Bilaplacian @@ -15,22 +15,22 @@ def test_glt_symbol_1(): three = 3 # ... linear splines - assert( Mass(one, t) == cos(t)/3 + 2/3 ) + assert( Mass(one, t) == cos(t)/3 + frac(2, 3) ) assert( Stiffness(one, t) == -2*cos(t) + 2 ) assert( Advection(one, t) == -sin(t) ) # assert( Bilaplacian(one, t) == 0 ) # ... # ... quadratic splines - assert( Mass(two, t) == 13*cos(t)/30 + cos(2*t)/60 + 11/20 ) + assert( Mass(two, t) == 13*cos(t)/30 + cos(2*t)/60 + frac(11, 20) ) assert( Stiffness(two, t) == -2*cos(t)/3 - cos(2*t)/3 + 1 ) assert( Advection(two, t) == -5*sin(t)/6 - sin(2*t)/12 ) # assert( Bilaplacian(two, t) == -8*cos(t) + 2*cos(2*t) + 6 ) # ... # ... cubic splines - assert( Mass(three, t) == 397*cos(t)/840 + cos(2*t)/21 + cos(3*t)/2520 + 151/315 ) - assert( Stiffness(three, t) == -cos(t)/4 - 2*cos(2*t)/5 - cos(3*t)/60 + 2/3) + assert( Mass(three, t) == 397*cos(t)/840 + cos(2*t)/21 + cos(3*t)/2520 + frac(151, 315) ) + assert( Stiffness(three, t) == -cos(t)/4 - 2*cos(2*t)/5 - cos(3*t)/60 + frac(2, 3)) assert( Advection(three, t) == -49*sin(t)/72 - 7*sin(2*t)/45 - sin(3*t)/360 ) # assert( Bilaplacian(three, t) == -3*cos(t) + cos(3*t)/3 + 8/3 ) # ... diff --git a/gelato/version.py b/gelato/version.py index 9d1bb72..f323a57 100644 --- a/gelato/version.py +++ b/gelato/version.py @@ -1 +1 @@ -__version__ = '0.10.0' +__version__ = '0.11.0'