PetscObjectQuery — PETSc 3.24.5 documentation

Skip to main content
`Ctrl`+`K`

# PetscObjectQuery

Gets a PETSc object associated with a given object that was composed with `PetscObjectCompose()`

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscObjectQuery(PetscObject obj, const char name[], PetscObject *ptr)

Not Collective

## Input Parameters

- obj - the PETSc object. It must be cast with a (`PetscObject`), for example, `PetscObjectCompose`((`PetscObject`)mat,…);

- name - name associated with child object

- ptr - the other PETSc object associated with the PETSc object, this must be cast with (`PetscObject`*)

## Note

The reference count of neither object is increased in this call

## Fortran Note

Use

      call PetscObjectQuery(PetscObjectCast(obj), name, ptr, ierr)

## See Also

`PetscObjectCompose()`, `PetscObjectComposeFunction()`, `PetscObjectQueryFunction()`, `PetscContainer` `PetscContainerGetPointer()`, `PetscObject`

## Level

advanced

## Location

src/sys/objects/inherit.c

## Examples

src/dm/impls/plex/tutorials/ex19.c
src/dm/impls/plex/tutorials/ex18.c
src/snes/tutorials/ex35.c
src/ts/tutorials/ex77.c
src/snes/tutorials/ex7.c
src/ts/tutorials/ex30.c
src/snes/tutorials/ex48.c
src/ksp/ksp/tutorials/ex73.c
src/ts/tutorials/ex29.c

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