<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 6, 2017 at 9:39 AM, Lisandro Dalcin <span dir="ltr"><<a href="mailto:dalcinl@gmail.com" target="_blank">dalcinl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Did you mean<br>
<br>
*flg = currentvalue;<br>
<br>
?<br></blockquote><div><br></div><div>yes</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
On 6 November 2017 at 17:25, Mark Adams <<a href="mailto:mfadams@lbl.gov">mfadams@lbl.gov</a>> wrote:<br>
> This code looks wrong. I get a valgrind warning if the option is not set. I<br>
> think this code should be added.<br>
><br>
> PetscErrorCode PetscOptionsBool_Private(<wbr>PetscOptionItems<br>
> *PetscOptionsObject,const char opt[],const char text[],const char<br>
> man[],PetscBool currentvalue,PetscBool *flg,PetscBool *set)<br>
> {<br>
> PetscErrorCode ierr;<br>
> PetscBool iset;<br>
> PetscOptionItem amsopt;<br>
><br>
> PetscFunctionBegin;<br>
> if (!PetscOptionsObject->count) {<br>
> ierr =<br>
> PetscOptionItemCreate_Private(<wbr>PetscOptionsObject,opt,text,<wbr>man,OPTION_BOOL,&amsopt);<wbr>CHKERRQ(ierr);<br>
> ierr = PetscMalloc(sizeof(PetscBool),<wbr>&amsopt->data);CHKERRQ(ierr);<br>
><br>
> *(PetscBool*)amsopt->data = currentvalue;<br>
> }<br>
> flg = currentvalue;<br>
> ierr =<br>
> PetscOptionsGetBool(<wbr>PetscOptionsObject->options,<wbr>PetscOptionsObject->prefix,<wbr>opt,flg,&iset);CHKERRQ(ierr);<br>
> if (set) *set = iset;<br>
> if (PetscOptionsObject->printhelp && PetscOptionsObject->count == 1 &&<br>
> !PetscOptionsObject-><wbr>alreadyprinted) {<br>
> const char *v = PetscBools[currentvalue];<br>
> ierr = (*PetscHelpPrintf)(<wbr>PetscOptionsObject->comm," -%s%s: <%s> %s<br>
> (%s)\n",PetscOptionsObject-><wbr>prefix?PetscOptionsObject-><wbr>prefix:"",opt+1,v,text,<wbr>ManSection(man));CHKERRQ(ierr)<wbr>;<br>
> }<br>
> PetscFunctionReturn(0);<br>
> }<br>
><br>
<br>
<br>
<br>
</div></div>--<br>
Lisandro Dalcin<br>
============<br>
Research Scientist<br>
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)<br>
Extreme Computing Research Center (ECRC)<br>
King Abdullah University of Science and Technology (KAUST)<br>
<a href="http://ecrc.kaust.edu.sa/" rel="noreferrer" target="_blank">http://ecrc.kaust.edu.sa/</a><br>
<br>
4700 King Abdullah University of Science and Technology<br>
al-Khawarizmi Bldg (Bldg 1), Office # 0109<br>
Thuwal 23955-6900, Kingdom of Saudi Arabia<br>
<a href="http://www.kaust.edu.sa" rel="noreferrer" target="_blank">http://www.kaust.edu.sa</a><br>
<br>
Office Phone: <a href="tel:%2B966%2012%20808-0459" value="+966128080459">+966 12 808-0459</a><br>
</blockquote></div><br></div></div>