# PetscLayoutCreateFromSizes
Allocates `PetscLayout` object and sets the layout sizes, and sets the layout up. 
## Synopsis
```
#include "petscis.h" 
PetscErrorCode PetscLayoutCreateFromSizes(MPI_Comm comm, PetscInt n, PetscInt N, PetscInt bs, PetscLayout *map)
```
Collective


## Input Parameters

- ***comm  -*** the MPI communicator
- ***n     -*** the local size (or `PETSC_DECIDE`)
- ***N     -*** the global size (or `PETSC_DECIDE`)
- ***bs    -*** the block size (or `PETSC_DECIDE`)



## Output Parameters

- ***map -*** the new `PetscLayout`





## Note
```none
PetscLayoutCreateFromSizes(comm,n,N,bs,&layout);
```
is a shorthand for
```none
  PetscLayoutCreate(comm,&layout);
  PetscLayoutSetLocalSize(layout,n);
  PetscLayoutSetSize(layout,N);
  PetscLayoutSetBlockSize(layout,bs);
  PetscLayoutSetUp(layout);
```



## See Also
 [PetscLayout](sec_matlayout), `PetscLayoutCreate()`, `PetscLayoutSetLocalSize()`, `PetscLayoutSetSize()`, `PetscLayoutGetSize()`, `PetscLayoutGetLocalSize()`, `PetscLayout`, `PetscLayoutDestroy()`,
`PetscLayoutGetRange()`, `PetscLayoutGetRanges()`, `PetscLayoutSetBlockSize()`, `PetscLayoutGetBlockSize()`, `PetscLayoutSetUp()`, `PetscLayoutCreateFromRanges()`

## Level
advanced

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


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