This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Unrecognized PETSc command line arguments in C++ interface

0 votes

Hi fenics-users.
I have a very basic problem: setting PETSc options from command line.

I can do this in Python, e.g. python demo_poisson.py --petsc.log_summary after adding parameters.parse() at the beginning of the code.
However, in C++ this doesn't work, as

...
int main (int argc, char* argv[]) {
Parameters p("cli");
p.parse(argc,argv);

and

$ ./myProg --petsc.log_summary

outputs

Skipping unrecognized option for parameter set "cli": --petsc.log_summary

I spied through Parameters.cpp and saw that Parameters::parse_petsc() is protected, so I can't call it directly, and also it is never called by Parameters::parse(), which only calls Parameters::parse_common(), which parses "everything except PETSc options".

I think I'm missing something basic here, any idea?
Thanks

closed with the note: Solved
asked Nov 13, 2014 by Massimiliano Leoni FEniCS User (1,760 points)
closed Nov 16, 2014 by Massimiliano Leoni

1 Answer

0 votes
 
Best answer

Solved, I had to instantiate GlobalParameters instead of Parameters.

answered Nov 16, 2014 by Massimiliano Leoni FEniCS User (1,760 points)
...