[petsc-dev] TS problems wasted my time

Matthew Knepley knepley at gmail.com
Sun Feb 24 14:15:13 CST 2013


On Sun, Feb 24, 2013 at 3:12 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Move it out of TSOps.
>
Yes, it should be handled exactly like we do in SNES.

   Matt


> 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.
>>
>>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130224/d816428d/attachment.html>


More information about the petsc-dev mailing list