[petsc-dev] TS problems wasted my time

Jed Brown jedbrown at mcs.anl.gov
Sun Feb 24 14:12:13 CST 2013


Move it out of TSOps.
On Feb 24, 2013 2:10 PM, "Barry Smith" <bsmith at mcs.anl.gov> wrote:

>
> PetscErrorCode  TSSetType(TS ts,TSType type)
> {
>   PetscErrorCode (*r)(TS);
>   PetscBool      match;
>   PetscErrorCode ierr;
>
>   PetscFunctionBegin;
>   PetscValidHeaderSpecific(ts, TS_CLASSID,1);
>   ierr = PetscObjectTypeCompare((PetscObject) ts, type,
> &match);CHKERRQ(ierr);
>   if (match) PetscFunctionReturn(0);
>
>   ierr = PetscFunctionListFind(PetscObjectComm((PetscObject)ts),TSList,
> type,PETSC_TRUE, (void (**)(void)) &r);CHKERRQ(ierr);
>   if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown TS
> type: %s", type);
>   if (ts->ops->destroy) {
>     ierr = (*(ts)->ops->destroy)(ts);CHKERRQ(ierr);
>
>     ts->ops->destroy = NULL;
>   }
>   ierr = PetscMemzero(ts->ops,sizeof(*ts->ops));CHKERRQ(ierr);
>
> but note that
>
>   PetscErrorCode (*snesfunction)(SNES,Vec,Vec,TS);
>   PetscErrorCode (*snesjacobian)(SNES,Vec,Mat*,Mat*,MatStructure*,TS);
>   PetscErrorCode (*prestep)(TS);
>   PetscErrorCode (*prestage)(TS,PetscReal);
>   PetscErrorCode (*poststep)(TS);
>   PetscErrorCode (*setup)(TS);
>   PetscErrorCode (*step)(TS);
>   PetscErrorCode (*solve)(TS);
>   PetscErrorCode (*interpolate)(TS,PetscReal,Vec);
>   PetscErrorCode (*evaluatestep)(TS,PetscInt,Vec,PetscBool*);
>   PetscErrorCode (*setfromoptions)(TS);
>   PetscErrorCode (*destroy)(TS);
>   PetscErrorCode (*view)(TS,PetscViewer);
>   PetscErrorCode (*reset)(TS);
>   PetscErrorCode
> (*linearstability)(TS,PetscReal,PetscReal,PetscReal*,PetscReal*);
>   PetscErrorCode (*load)(TS,PetscViewer);
>
> 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.
>
>   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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130224/1606a79d/attachment.html>


More information about the petsc-dev mailing list