down_cast problem

Asked by Sander Rhebergen

Dear,
I'm interested in using CBC.Block. After setup I tried running the stokes.py example in the test file. Unfortunately I'm getting errors like:

Traceback (most recent call last):
  File "stokes.py", line 3, in <module>
    from block import *
  File "/usr/local/lib/python2.7/dist-packages/block/__init__.py", line 84, in <module>
    _init()
  File "/usr/local/lib/python2.7/dist-packages/block/__init__.py", line 72, in _init
    dolfin.GenericMatrix.down_cast = dolfin.down_cast
AttributeError: 'module' object has no attribute 'down_cast'

I was wondering if there is a fix for this? Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
CBC.Block Edit question
Assignee:
No assignee Edit question
Solved by:
Joachim Haga
Solved:
Last query:
Last reply:
Revision history for this message
Joachim Haga (jobh) said :
#1

I will check. Is this with Dolfin 1.0?
Den 18. sep. 2012 17.11 skrev "Sander Rhebergen" <
<email address hidden>> følgende:

> New question #208903 on CBC.Block:
> https://answers.launchpad.net/cbc.block/+question/208903
>
> Dear,
> I'm interested in using CBC.Block. After setup I tried running the
> stokes.py example in the test file. Unfortunately I'm getting errors like:
>
> Traceback (most recent call last):
> File "stokes.py", line 3, in <module>
> from block import *
> File "/usr/local/lib/python2.7/dist-packages/block/__init__.py", line
> 84, in <module>
> _init()
> File "/usr/local/lib/python2.7/dist-packages/block/__init__.py", line
> 72, in _init
> dolfin.GenericMatrix.down_cast = dolfin.down_cast
> AttributeError: 'module' object has no attribute 'down_cast'
>
> I was wondering if there is a fix for this? Thanks.
>
>
> --
> You received this question notification because you are a member of
> cbc.block maintainers, which is an answer contact for CBC.Block.
>
> --
> Mailing list: https://launchpad.net/~cbc.block
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~cbc.block
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Sander Rhebergen (sanderrhebergen) said :
#2

Via Dorsal, today, I got the development version of FEniCS (and the Dolfin version that was in that package)

Revision history for this message
Best Joachim Haga (jobh) said :
#3

Aha! The dolfin interface was changed a few days ago:

"6903. By Anders Logg <logg@glaurung> on 2012-09-14
Merge work on redesigned LinearOperator / matrix-free interface:

[...]
- Rename down_cast --> as_type in C++ / as_backend_type in Python
[...]"

I'll have a go at fixing this soon (unless anyone beats me to it ;). In the
meantime, it should be sufficient to change the two lines in __init__.py
from

    dolfin.GenericMatrix.down_cast = dolfin.down_cast
    dolfin.GenericVector.down_cast = dolfin.down_cast

to

    dolfin.GenericMatrix.down_cast = dolfin.as_backend_type
    dolfin.GenericVector.down_cast = dolfin.as_backend_type

-j.

On 18 September 2012 20:25, Sander Rhebergen <
<email address hidden>> wrote:

> Question #208903 on CBC.Block changed:
> https://answers.launchpad.net/cbc.block/+question/208903
>
> Status: Answered => Open
>
> Sander Rhebergen is still having a problem:
> Via Dorsal, today, I got the development version of FEniCS (and the
> Dolfin version that was in that package)
>
> --
> You received this question notification because you are a member of
> cbc.block maintainers, which is an answer contact for CBC.Block.
>
> --
> Mailing list: https://launchpad.net/~cbc.block
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~cbc.block
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Sander Rhebergen (sanderrhebergen) said :
#4

Thanks Joachim Haga, that solved my question.

Revision history for this message
Sander Rhebergen (sanderrhebergen) said :
#5

Thanks!