Error in the definition of LocalSolver class

Issue #45 resolved
Ricardo Amigo created an issue

Hi!

Using the version 2016.1.0, I get an error when initializing an object of LocalSolver class. After importing dolfin_adjoint, the following error occurs:

Traceback (most recent call last):
  File "brute.py", line 4, in <module>
    from dolfin_adjoint import *
  File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/__init__.py", line 52, in <module>
    from ui import *
  File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/ui.py", line 48, in <module>
    from localsolver import LocalSolver
  File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/localsolver.py", line 48, in <module>
    class LocalSolver(dolfin.LocalSolver):
  File "/usr/lib/python2.7/dist-packages/dolfin_adjoint/localsolver.py", line 49, in LocalSolver
    def __init__(self, a, L = None, solver_type = dolfin.LocalSolver.SolverType_LU, **kwargs):
AttributeError: type object 'LocalSolver' has no attribute 'SolverType_LU'

I solved this by replacing:

def __init__(self, a, L = None, solver_type = dolfin.LocalSolver.SolverType_LU, **kwargs):

per:

def __init__(self, a, L = None, solver_type = dolfin.LocalSolver.LU, **kwargs):

Is this a bug or it happens just because my fenics version is the 1.6.0?

Comments (7)

  1. Simon Funke

    Hi Ricardo,

    It works for me as it is. Are you certain that you use FEniCS 2016.1 with dolfin-adjoint 2016.1 and not an older FEniCS installation? (Check with import dolfin; print dolfin.__version__)

    Simon

  2. Ricardo Amigo reporter

    Hi Simon! Yes, my version of Fenics is an older one: 1.6.0.

    I am not sure, but I think that when someone follows the instructions downloading Fenics and Dolfin-Adjoint via apt-get, he gets Fenics 1.6.0 and Dolfin-Adjoint 2016.1. This can be an issue...

    Thank you!

  3. Simon Funke

    Hi Ricardo,

    The dolfin-adjoint packages do not enforce a specific fenics version, so you need to make sure that you have installed the right now...

  4. Log in to comment