# ISGeneralSetIndicesFromMask
Sets the indices for an `ISGENERAL` index set using a boolean mask 
## Synopsis
```
#include "petscis.h"  
PetscErrorCode ISGeneralSetIndicesFromMask(IS is, PetscInt rstart, PetscInt rend, const PetscBool mask[])
```
Collective on is


## Input Parameters

- ***is -*** the index set
- ***rstart -*** the range start index (inclusive)
- ***rend -*** the range end index (exclusive)
- ***mask -*** the boolean mask array of length rend-rstart, indices will be set for each `PETSC_TRUE` value in the array





## Note
The mask array may be freed by the user after this call.


## Example
```none
   PetscBool mask[] = {PETSC_FALSE, PETSC_TRUE, PETSC_FALSE, PETSC_FALSE, PETSC_TRUE};
   ISGeneralSetIndicesFromMask(is,10,15,mask);
```

will feed the `IS` with indices
```none
  {11, 14}
```

locally.


## See Also
 [](sec_scatter), `IS`, `ISCreateGeneral()`, `ISGeneralSetIndices()`, `ISGENERAL`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/is/impls/general/general.c.html#ISGeneralSetIndicesFromMask">src/vec/is/is/impls/general/general.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/is/impls/general/general.c.html#ISGeneralSetIndicesFromMask_General">ISGeneralSetIndicesFromMask_General in src/vec/is/is/impls/general/general.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/is/impls/general/general.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)  
