# 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
Thus 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


## See Also
 `PetscObjectCompose()`, `PetscObjectComposeFunction()`, `PetscObjectQueryFunction()`, `PetscContainer`
`PetscContainerGetPointer()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/inherit.c.html#PetscObjectQuery">src/sys/objects/inherit.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex73.c.html">src/ksp/ksp/tutorials/ex73.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex48.c.html">src/snes/tutorials/ex48.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex29.c.html">src/ts/tutorials/ex29.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex77.c.html">src/ts/tutorials/ex77.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/inherit.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
