# PetscDSGetFieldIndex
Returns the index of the given field 
## Synopsis
```
#include "petscds.h" 
PetscErrorCode PetscDSGetFieldIndex(PetscDS prob, PetscObject disc, PetscInt *f)
```
Not collective


## Input Parameters

- ***prob -*** The `PetscDS` object
- ***disc -*** The discretization object



## Output Parameter

- ***f -*** The field number





## See Also
 `PetscDS`, `PetscGetDiscretization()`, `PetscDSGetNumFields()`, `PetscDSCreate()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/dt/interface/dtds.c.html#PetscDSGetFieldIndex">src/dm/dt/interface/dtds.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/dt/interface/dtds.c)


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