dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #15154
Re: [Bug 425282] [NEW] Handle PETSc command-line options in Python
On Sunday 06 September 2009 20:48:28 logg wrote:
> On Sun, Sep 06, 2009 at 04:56:59PM -0000, Johan Hake wrote:
> > On Sunday 06 September 2009 18:36:32 logg wrote:
> > > Public bug reported:
> > >
> > > PETSc command-line options like --petsc.foo 3 are not handled in
> > > Python:
> > >
> > > StandardError: unknown option petsc.info
> > >
> > > Don't know why this doesn't work in Python since the Python interface
> > > seems to call the C++ implementation which handles PETSc command-line
> > > options.
> > >
> > > ** Affects: dolfin
> > > Importance: Medium
> > > Assignee: Johan Hake (johan-hake)
> > > Status: New
> >
> > How should it look like when this works? Do we get any message from PETSc
> > that it has got a parameter?
>
> Yes, at least when PETSc runs in verbose mode. That can be done by
> passing the -info command-line argument to PETSc. :-)
>
> > Or is it the dolfin part of the parameter system that does not get to
> > parse the parameter correctly?
>
> My fault. This is not a bug. I got confused as to what the demo is
> actually doing. I used another test program when I tested the
> command-line parsing for PETSc in C++. The "problem" is that the
> command-line is parsed by application_parameters, not by
> dolfin::parameters and options are only filtered out for PETSc for the
> global parameter set, not for other parameters like
> application_parameters.
Ok!
> The following works fine:
>
> python -c "from dolfin import *; parameters.parse()" --petsc.info
>
> I'm closing the bug.
>
> By the way, very nifty with
>
> parameters.foo = 1.0
>
> etc instead of parameters["foo"] = 1.0. :-)
Yes isn't it!
Unfortunately it is not visible through the tab-completion in ipython, as that
commando use the __dict__ attribute for this, and not __get/setattr__
commands. In python < 3.0 there are a lot of different ways of setting
attributes... each with different preference and behavior.
Johan
> --
> Anders
>
--
Handle PETSc command-line options in Python
https://bugs.launchpad.net/bugs/425282
You received this bug notification because you are subscribed to DOLFIN.
Status in DOLFIN: Invalid
Bug description:
PETSc command-line options like --petsc.foo 3 are not handled in Python:
StandardError: unknown option petsc.info
Don't know why this doesn't work in Python since the Python interface seems
to call the C++ implementation which handles PETSc command-line options.
References