<div dir="ltr">On Sun, Feb 24, 2013 at 3:12 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Move it out of TSOps.</p></blockquote><div style>Yes, it should be handled exactly like we do in SNES.</div>
<div style><br></div><div style>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Feb 24, 2013 2:10 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
PetscErrorCode  TSSetType(TS ts,TSType type)<br>
{<br>
  PetscErrorCode (*r)(TS);<br>
  PetscBool      match;<br>
  PetscErrorCode ierr;<br>
<br>
  PetscFunctionBegin;<br>
  PetscValidHeaderSpecific(ts, TS_CLASSID,1);<br>
  ierr = PetscObjectTypeCompare((PetscObject) ts, type, &match);CHKERRQ(ierr);<br>
  if (match) PetscFunctionReturn(0);<br>
<br>
  ierr = PetscFunctionListFind(PetscObjectComm((PetscObject)ts),TSList, type,PETSC_TRUE, (void (**)(void)) &r);CHKERRQ(ierr);<br>
  if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown TS type: %s", type);<br>
  if (ts->ops->destroy) {<br>
    ierr = (*(ts)->ops->destroy)(ts);CHKERRQ(ierr);<br>
<br>
    ts->ops->destroy = NULL;<br>
  }<br>
  ierr = PetscMemzero(ts->ops,sizeof(*ts->ops));CHKERRQ(ierr);<br>
<br>
but note that<br>
<br>
  PetscErrorCode (*snesfunction)(SNES,Vec,Vec,TS);<br>
  PetscErrorCode (*snesjacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,TS);<br>
  PetscErrorCode (*prestep)(TS);<br>
  PetscErrorCode (*prestage)(TS,PetscReal);<br>
  PetscErrorCode (*poststep)(TS);<br>
  PetscErrorCode (*setup)(TS);<br>
  PetscErrorCode (*step)(TS);<br>
  PetscErrorCode (*solve)(TS);<br>
  PetscErrorCode (*interpolate)(TS,PetscReal,Vec);<br>
  PetscErrorCode (*evaluatestep)(TS,PetscInt,Vec,PetscBool*);<br>
  PetscErrorCode (*setfromoptions)(TS);<br>
  PetscErrorCode (*destroy)(TS);<br>
  PetscErrorCode (*view)(TS,PetscViewer);<br>
  PetscErrorCode (*reset)(TS);<br>
  PetscErrorCode (*linearstability)(TS,PetscReal,PetscReal,PetscReal*,PetscReal*);<br>
  PetscErrorCode (*load)(TS,PetscViewer);<br>
<br>
TSOps is a combination of method specific functions and user provided functions. So if one does TSSetPostStep() before TSSetFromOptions() and then -ts_type <sometype> the post-step is wiped out even though it should not be.<br>


<br>
  How to fix? Should the memzero() be replaced with something that only wipes out certain fields but preserves the pre step, prestage and post step ops. Or should those ops be moved out of TSOps and handled differently? Needs to be fixed since current behavior is cruel.<br>


<br>
</blockquote></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>