not using "from dolfin import *"

Asked by Nico Schlömer

Hi,

if I remember correctly, dolfin_adjoint assumes that

from dolfin import *

 is called, then

from dolfin_adjoint import *

which overrides some functions of dolfin. Now, I like to keep my code clean so I always imported dolfin as

import dolfin as df

The above idea won't work anymore then, of course. When importing dolfin_adjoint as

import dolfin_adjoint as da

which methods will I have to prefix with "da" instead of "df"?

Question information

Language:
English Edit question
Status:
Answered
For:
dolfin-adjoint Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Patrick Farrell (pefarrell) said :
#1

Hi Nico,

You can get a list with the following snippet of code:

print [key for key in df.__dict__ if key in da.__dict__ and '__' not in key]

yields

['KrylovSolver',
 'assemble',
 'NonlinearVariationalSolver',
 'NonlinearVariationalProblem',
 'LinearSolver',
 'project',
 'PointIntegralSolver',
 'LinearVariationalSolver',
 'assemble_system',
 'LUSolver',
 'interpolate',
 'LinearVariationalProblem',
 'NewtonSolver',
 'solve',
 'functional',
 'function',
 'Constant',
 'Function']

Hope this helps,

Patrick

Can you help with this problem?

Provide an answer of your own, or ask Nico Schlömer for more information if necessary.

To post a message you must log in.