[petsc-dev] PetscOptionsGetString (Barry Smith)

Shiyuan gshy2014 at gmail.com
Sat Apr 16 16:50:32 CDT 2011


It sounds reasonable to make the change but it's better to document it. I
don't see the change in the change log and I am surprised that my code
doesn't work any more.
Or maybe handle the single character case specially so that there is no need
to change the source code.

Another question is that in the newer version, PetscTruth becomes PetscBool.
I might need to switch between development version and current released
version. But to change the source code back and forth is a headache. Is
there any good way to handle this? Why don't do something like #define
PetscTruth PetscBool in the petsc.h so that we do not need to change the
source code. Any wrong with that approach?  Thanks.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
This behavior was changed because we wanted to always make sure that strings
obtained were null terminated.  When you pass in a string of length 1 there
is only room for the null terminator.

  We could only do the null termination when the the string is larger than
one allowing your old code to work. But that is slightly inconsistent
handling that case differently. What do you think?

  You might consider using something like PetscOptionsGetEList() instead of
PetscOptionsGetString() also.

   Barry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110416/ed96c2f6/attachment.html>


More information about the petsc-dev mailing list