[petsc-users] Petsc Options
Cody Permann
codypermann at gmail.com
Mon Nov 14 20:55:51 CST 2011
Perfect that will work for me.
Thanks,
Cody
On Mon, Nov 14, 2011 at 7:11 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> I have added to petsc-dev the following
>
> #undef __FUNCT__
> #define __FUNCT__ "PetscOptionsUsed"
> /*@C
> PetscOptionsUsed - Indicates if PETSc has used a particular option set
> in the database
>
> Not Collective
>
> Input Parameter:
> . option - string name of option
>
> Output Parameter:
> . used - PETSC_TRUE if the option was used, otherwise false, including
> if option was not found in options database
>
> Level: advanced
>
> .seealso: PetscOptionsView(), PetscOptionsLeft(), PetscOptionsAllUsed()
> @*/
> PetscErrorCode PetscOptionsUsed(const char *option,PetscBool *used)
> {
> PetscInt i;
> PetscErrorCode ierr;
>
> PetscFunctionBegin;
> *used = PETSC_FALSE;
> for (i=0; i<options->N; i++) {
> ierr = PetscStrcmp(options->names[i],option,used);CHKERRQ(ierr);
> if (*used) {
> *used = options->used[i];
> break;
> }
> }
> PetscFunctionReturn(0);
> }
>
> On Nov 14, 2011, at 5:06 PM, Cody Permann wrote:
>
> >
> > On Nov 14, 2011, at 2:20 PM, Matthew Knepley wrote:
> >
> >> On Mon, Nov 14, 2011 at 9:16 PM, Cody Permann <codypermann at gmail.com>
> wrote:
> >> How about a function that would fill in a char *[] with the options
> used or a function that would return a boolean for a single option
> indicating whether it was used or not? Basically we just need a public way
> to get at the data in PetscOptionTable::used.
> >>
> >> I don't like the whole table of options used, and we definitely need
> PetscOptionsOptionUsed(). What about providing
> >> the number of options, and an array of all option names?
> >
> > That will work fine. Anything is better than what we have now ;)
> >
> >>
> >> Matt
> >>
> >> Thanks,
> >> Cody
> >>
> >> On Nov 14, 2011, at 12:41 PM, Barry Smith wrote:
> >>
> >> >
> >> > Cody,
> >> >
> >> > What would you like the API to look like?
> >> >
> >> > Barry
> >> >
> >> >
> >> > On Nov 14, 2011, at 1:39 PM, Cody Permann wrote:
> >> >
> >> >> There doesn't appear to be an API in PETSc for getting back the
> command line options "used" or "unused" for a simulation. Yes I am aware
> that the options unused can be printed but there doesn't appear to be a
> mechanism for returning them back through a function call. I'd like to add
> an option to MOOSE that would work like PETSc's "-options_left" CLI
> argument, but in order to do so I need to combine the options recognized
> for both libraries to report the global unused list. Right now both MOOSE
> and PETSc have full access to the raw ARGV vector and each library
> recognizes it's own options and ignores the rest.
> >> >>
> >> >> I could strip out the options from ARGV before passing it to PETSc
> in conjunction with "-options_left" but that doesn't give me quite as much
> flexibility as I'd like. It looks like there are about two dozen or so
> PETSc related options functions in the API but none of them return unused
> options, or otherwise allow me to query whether any particular option was
> recognized or not. Is this assumption correct?
> >> >>
> >> >> Thanks,
> >> >> Cody
> >> >
> >>
> >>
> >>
> >>
> >> --
> >> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> >> -- Norbert Wiener
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111114/48b3f551/attachment.htm>
More information about the petsc-users
mailing list