<div dir="ltr"><div><div><div><div><div><div><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">I was wondering why there is different behaviour between </font></span></span><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2"><br>  PetscLogEventGetId()</font></span></span><br><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">and<br>  PetscLogStageGetId()</font></span></span><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2"><br></font></span></span><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2"><br>PetscLogEventGetId() </font></span></span>returns -1 if the event isn't found, <br>whilst  </font></span></span><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">PetscLogStageGetId() </font></span></span>throws an error if the stage isn't found.<br><br></font></span></span></div><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">My use case is that within one of my custom preconditioners, I wanted<br></font></span></span></div><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">to call </font></span></span>PetscLogStageRegister() during the creation phase, but obviously<br></div>I can only register the stage once. To enable multiple instances of the <br></div>preconditioner to exist, I need to ensure that the stage is only registered once.<br></div><div>Hence I would like to check for the existence of the stage prior to calling<br></div><div>the register function.<br><br></div><div>Is there currently a way to check for the existence of a registered stage?<br></div><div><br><br></div>Cheers<br></div>  Dave<br><div><div><div><div><div><div><div><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"></span></span><br><br></div></div></div></div></div></div></div></div>