# ISGlobalToLocalMappingApply
Provides the local numbering for a list of integers specified with a global numbering. 
## Synopsis
```
#include "petscis.h"  
PetscErrorCode ISGlobalToLocalMappingApply(ISLocalToGlobalMapping mapping, ISGlobalToLocalMappingMode type, PetscInt n, const PetscInt idx[], PetscInt *nout, PetscInt idxout[])
```
Not collective


## Input Parameters

- ***mapping -*** mapping between local and global numbering
- ***type -*** `IS_GTOLM_MASK` - maps global indices with no local value to -1 in the output list (i.e., mask them)
`IS_GTOLM_DROP` - drops the indices with no local value from the output list
- ***n -*** number of global indices to map
- ***idx -*** global indices to map



## Output Parameters

- ***nout -*** number of indices in output array (if type == `IS_GTOLM_MASK` then nout = n)
- ***idxout -*** local index of each global index, one must pass in an array long enough
to hold all the indices. You can call `ISGlobalToLocalMappingApply()` with
idxout == NULL to determine the required length (returned in nout)
and then allocate the required space and call `ISGlobalToLocalMappingApply()`
a second time to set the values.





## Notes
Either nout or idxout may be NULL. idx and idxout may be identical.

For "small" problems when using `ISGlobalToLocalMappingApply()` and `ISGlobalToLocalMappingApplyBlock()`, the `ISLocalToGlobalMappingType` of `ISLOCALTOGLOBALMAPPINGBASIC` will be used;
this uses more memory but is faster; this approach is not scalable for extremely large mappings. For large problems `ISLOCALTOGLOBALMAPPINGHASH` is used, this is scalable.
Use `ISLocalToGlobalMappingSetType()` or call `ISLocalToGlobalMappingSetFromOptions()` with the option -islocaltoglobalmapping_type <basic,hash> to control which is used.


## Developer Note
The manual page states that idx and idxout may be identical but the calling
sequence declares idx as const so it cannot be the same as idxout.


## See Also
 [](sec_scatter), `ISLocalToGlobalMapping`, `ISLocalToGlobalMappingApply()`, `ISGlobalToLocalMappingApplyBlock()`, `ISLocalToGlobalMappingCreate()`,
`ISLocalToGlobalMappingDestroy()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/utils/isltog.c.html#ISGlobalToLocalMappingApply">src/vec/is/utils/isltog.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/is/tutorials/ex4.c.html">src/vec/is/is/tutorials/ex4.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/is/tutorials/ex5.c.html">src/vec/is/is/tutorials/ex5.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/utils/isltog.c)


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