[petsc-dev] is this wrong?
Mark Adams
mfadams at lbl.gov
Mon Nov 6 09:49:42 CST 2017
On Mon, Nov 6, 2017 at 9:39 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> Did you mean
>
> *flg = currentvalue;
>
> ?
>
yes
>
> On 6 November 2017 at 17:25, Mark Adams <mfadams at lbl.gov> wrote:
> > This code looks wrong. I get a valgrind warning if the option is not
> set. I
> > think this code should be added.
> >
> > PetscErrorCode PetscOptionsBool_Private(PetscOptionItems
> > *PetscOptionsObject,const char opt[],const char text[],const char
> > man[],PetscBool currentvalue,PetscBool *flg,PetscBool *set)
> > {
> > PetscErrorCode ierr;
> > PetscBool iset;
> > PetscOptionItem amsopt;
> >
> > PetscFunctionBegin;
> > if (!PetscOptionsObject->count) {
> > ierr =
> > PetscOptionItemCreate_Private(PetscOptionsObject,opt,text,
> man,OPTION_BOOL,&amsopt);CHKERRQ(ierr);
> > ierr = PetscMalloc(sizeof(PetscBool),&amsopt->data);CHKERRQ(ierr);
> >
> > *(PetscBool*)amsopt->data = currentvalue;
> > }
> > flg = currentvalue;
> > ierr =
> > PetscOptionsGetBool(PetscOptionsObject->options,
> PetscOptionsObject->prefix,opt,flg,&iset);CHKERRQ(ierr);
> > if (set) *set = iset;
> > if (PetscOptionsObject->printhelp && PetscOptionsObject->count == 1 &&
> > !PetscOptionsObject->alreadyprinted) {
> > const char *v = PetscBools[currentvalue];
> > ierr = (*PetscHelpPrintf)(PetscOptionsObject->comm," -%s%s: <%s> %s
> > (%s)\n",PetscOptionsObject->prefix?PetscOptionsObject->
> prefix:"",opt+1,v,text,ManSection(man));CHKERRQ(ierr);
> > }
> > PetscFunctionReturn(0);
> > }
> >
>
>
>
> --
> Lisandro Dalcin
> ============
> Research Scientist
> Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
> Extreme Computing Research Center (ECRC)
> King Abdullah University of Science and Technology (KAUST)
> http://ecrc.kaust.edu.sa/
>
> 4700 King Abdullah University of Science and Technology
> al-Khawarizmi Bldg (Bldg 1), Office # 0109
> Thuwal 23955-6900, Kingdom of Saudi Arabia
> http://www.kaust.edu.sa
>
> Office Phone: +966 12 808-0459
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171106/6f03ab9d/attachment-0001.html>
More information about the petsc-dev
mailing list