Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give helpfull error on - or / of meshes #203

Closed
fipymigrate opened this issue Sep 19, 2014 · 6 comments
Closed

Give helpfull error on - or / of meshes #203

fipymigrate opened this issue Sep 19, 2014 · 6 comments
Milestone

Comments

@fipymigrate
Copy link

When translating meshes, one cannot do

mesh = Grid2D(dx=dx, dy=dy, nx=nxtot, ny=nytot) - [[Lval/2], [0]]

but must do

mesh = Grid2D(dx=dx, dy=dy, nx=nxtot, ny=nytot) + [[-Lval/2], [0]]

The error given in the first case is not very helpfull for unexperience users:

TypeError: unsupported operand type(s) for -: 'instance' and 'list'

The patch in attachment adds sub and div and gives helpfull error message in those cases.

Imported from trac ticket #299, created by benny.malengier@gmail.com on 06-29-2010 at 09:32, last modified: 10-11-2011 at 15:59

@fipymigrate fipymigrate added this to the 3.0 milestone Sep 19, 2014
@fipymigrate
Copy link
Author

benny.malengier@gmail.com attached minus.patch on 06-29-2010 at 09:32

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

Fixed with r4761

Trac comment by wd15 on 09-20-2011 at 15:18

@guyer
Copy link
Member

guyer commented Sep 19, 2014

I agree that the previous error wasn't very helpful, but wouldn't it be better to just support the operations instead of raising a slightly clearer error?

Trac comment by guyer on 09-20-2011 at 18:22

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

sub does work now. Line
trunk/fipy/meshes/abstractMesh.py#L917 dealt with that.

>>> from fipy import *
>>> print (Grid1D() - [[1]]).cellCenters
[[-0.5]]

Trac comment by wd15 on 10-07-2011 at 15:50

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

Added div method with r299. Closing.

Trac comment by wd15 on 10-11-2011 at 15:58

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

Replying to wd15:

Added div method with r4805. Closing.

Trac comment by wd15 on 10-11-2011 at 15:59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants