PetscObjectContainerCompose — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# PetscObjectContainerCompose

Creates a `PetscContainer`, provides all of its values and composes it with a `PetscObject`

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscObjectContainerCompose(PetscObject obj, const char *name, void *pointer, PetscCtxDestroyFn *destroy)

Collective

## Input Parameters

- obj - the `PetscObject`

- name - the name for the composed container

- pointer - the pointer to the data

- destroy - the routine to destroy the container’s data, see `PetscCtxDestroyFn` for its calling sequence; use `PetscCtxDestroyDefault()` if a `PetscFree()` frees the data

## Notes

This allows one to attach any type of data (accessible through a pointer) with the `PetscObjectCompose()` function to a `PetscObject`. The data item itself is attached by a call to `PetscContainerSetPointer()`.

## See Also

`PetscContainerCreate()`, `PetscContainerDestroy()`, `PetscContainerSetPointer()`, `PetscContainerGetPointer()`, `PetscObjectCompose()`, `PetscObjectQuery()`, `PetscContainerSetCtxDestroy()`, `PetscObject`, `PetscObjectContainerQuery()`

## Level

advanced

## Location

src/sys/objects/inherit.c

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