DMTS#

Object held by a DM that contains all the callback functions and their contexts needed by a TS

Synopsis#

struct _p_DMTS {
  PETSCHEADER(struct _DMTSOps);
  PetscContainer rhsfunctionctxcontainer;
  PetscContainer rhsjacobianctxcontainer;

  PetscContainer ifunctionctxcontainer;
  PetscContainer ijacobianctxcontainer;

  PetscContainer i2functionctxcontainer;
  PetscContainer i2jacobianctxcontainer;

  void *transientvarctx;

  void *solutionctx;
  void *forcingctx;

  void *data;

  /* See the developer note for DMTS above */
  DM originaldm;
};

Notes#

Users provide callback functions and their contexts to TS using, for example, TSSetIFunction(). These values are stored in a DMTS that is contained in the DM associated with the TS. If no DM was provided by the user with TSSetDM() it is automatically created by TSGetDM() with DMShellCreate().

Users very rarely need to worked directly with the DMTS object, rather they work with the TS and the DM they created

Multiple DM can share a single DMTS, often each DM is associated with a grid refinement level. DMGetDMTS() returns the DMTS associated with a DM. DMGetDMTSWrite() returns a unique DMTS that is only associated with the current DM, making a copy of the shared DMTS if needed (copy-on-write).

See DMKSP for details on why there is a needed for DMTS instead of simply storing the user callbacks directly in the DM or the TS

Developer Note#

The original dm inside the DMTS is NOT reference counted (to prevent a reference count loop between a DM and a DMSNES). The DM on which this context was first created is cached here to implement one-way copy-on-write. When DMGetDMTSWrite() sees a request using a different DM, it makes a copy of the DMTS.

See Also#

TS: Scalable ODE and DAE Solvers, TSCreate(), DM, DMGetDMTSWrite(), DMGetDMTS(), TSSetIFunction(), DMTSSetRHSFunctionContextDestroy(), DMTSSetRHSJacobian(), DMTSGetRHSJacobian(), DMTSSetRHSJacobianContextDestroy(), DMTSSetIFunction(), DMTSGetIFunction(), DMTSSetIFunctionContextDestroy(), DMTSSetIJacobian(), DMTSGetIJacobian(), DMTSSetIJacobianContextDestroy(), DMTSSetI2Function(), DMTSGetI2Function(), DMTSSetI2FunctionContextDestroy(), DMTSSetI2Jacobian(), DMTSGetI2Jacobian(), DMTSSetI2JacobianContextDestroy(), DMKSP, DMSNES

Level#

developer

Location#

include/petsc/private/tsimpl.h


Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages