DMSetApplicationContext#

Set a user context into a DM object

Synopsis#

#include "petscdm.h"          
#include "petscdmlabel.h"     
#include "petscds.h"     
PetscErrorCode DMSetApplicationContext(DM dm, void *ctx)

Not Collective

Input Parameters#

  • dm - the DM object

  • ctx - the user context

Note#

A user context is a way to pass problem specific information that is accessible whenever the DM is available In a multilevel solver, the user context is shared by all the DM in the hierarchy; it is thus not advisable to store objects that represent discretized quantities inside the context.

Fortran Note#

This only works when ctx is a Fortran derived type (it cannot be a PetscObject), we recommend writing a Fortran interface definition for this function that tells the Fortran compiler the derived data type that is passed in as the ctx argument. See DMGetApplicationContext() for an example.

See Also#

DM Basics, DM, DMGetApplicationContext(), DMView(), DMCreateGlobalVector(), DMCreateInterpolation(), DMCreateColoring(), DMCreateMatrix(), DMCreateMassMatrix()

Level#

intermediate

Location#

src/dm/interface/dm.c

Examples#

src/snes/tutorials/ex34.c
src/snes/tutorials/ex23.c
src/snes/tutorials/ex17.c
src/snes/tutorials/ex22.c
src/snes/tutorials/ex5.c
src/snes/tutorials/ex19.c
src/snes/tutorials/ex63.c
src/snes/tutorials/ex27.c
src/snes/tutorials/ex64.c
src/dm/tutorials/swarm_ex3.c


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