Skip to content

Commit

Permalink
Compatibility to discretize >= 0.6 (II) (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
prisae authored Nov 19, 2020
1 parent f1ed1c6 commit 5532a3e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ Changelog
recent versions
"""""""""""""""


*v0.14.3* : Bug fix
-------------------

**2020-11-19**

- Bug fix for ``discretize>=0.6.0``.


*v0.14.2* : Bug fix
-------------------

Expand All @@ -18,7 +27,7 @@ recent versions

**2020-11-14**

- Fix for h5py>3.0.
- Fix for ``h5py>=3.0``.
- Improved docs re automatic gridding.


Expand Down
8 changes: 1 addition & 7 deletions emg3d/meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,11 @@ class TensorMesh(dTensorMesh, _TensorMesh):
h : list of three ndarrays
Cell widths in [x, y, z] directions.
x0 : ndarray of dimension (3, )
x0 : tuple of length 3
Origin (x, y, z).
"""

def __init__(self, h, x0):
"""Initiate TensorMesh."""
# Cast `h` to list, as `discretize.TensorMesh`
# fails if `h` is an # ndarray.
super().__init__(h=list(h), x0=x0)

def __eq__(self, mesh):
"""Compare two meshes.
Expand Down
9 changes: 6 additions & 3 deletions tests/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def test_solver_homogeneous(capsys):
# Not very sophisticated; replace/extend by more detailed tests.
dat = REGRES['res']

grid = meshes.TensorMesh(**dat['input_grid'])
grid = meshes.TensorMesh(list(dat['input_grid']['h']),
dat['input_grid']['x0'])
model = models.Model(**dat['input_model'])
sfield = fields.get_source_field(**dat['input_source'])

Expand Down Expand Up @@ -240,7 +241,8 @@ def test_solver_homogeneous_laplace():
# Not very sophisticated; replace/extend by more detailed tests.
dat = REGRES['lap']

grid = meshes.TensorMesh(**dat['input_grid'])
grid = meshes.TensorMesh(list(dat['input_grid']['h']),
dat['input_grid']['x0'])
model = models.Model(**dat['input_model'])
sfield = fields.get_source_field(**dat['input_source'])

Expand Down Expand Up @@ -439,7 +441,8 @@ def test_krylov(capsys):

# Load any case.
dat = REGRES['res']
grid = meshes.TensorMesh(**dat['input_grid'])
grid = meshes.TensorMesh(list(dat['input_grid']['h']),
dat['input_grid']['x0'])
model = models.Model(**dat['input_model'])
model.property_x /= 100000 # Set stupid input to make bicgstab fail.
model.property_y *= 100000 # Set stupid input to make bicgstab fail.
Expand Down

0 comments on commit 5532a3e

Please sign in to comment.