Skip to main content
`Ctrl`+`K`

# PetscSectionCreate

Allocates a `PetscSection` and sets the map contents to the default.

## Synopsis

    #include "petscsection.h"
    PetscErrorCode PetscSectionCreate(MPI_Comm comm, PetscSection *s)

Collective

## Input Parameters

- comm - the MPI communicator

- s - pointer to the section

## Notes

Typical calling sequence

           PetscSectionCreate(MPI_Comm,PetscSection *);!
           PetscSectionSetNumFields(PetscSection, numFields);
           PetscSectionSetChart(PetscSection,low,high);
           PetscSectionSetDof(PetscSection,point,numdof);
           PetscSectionSetUp(PetscSection);
           PetscSectionGetOffset(PetscSection,point,PetscInt *);
           PetscSectionDestroy(PetscSection);

The `PetscSection` object and methods are intended to be used in the PETSc `Vec` and `Mat` implementations. The indices returned by the `PetscSection` are appropriate for the kind of `Vec` it is associated with. For example, if the vector being indexed is a local vector, we call the section a local section. If the section indexes a global vector, we call it a global section. For parallel vectors, like global vectors, we use negative indices to indicate dofs owned by other processes.

## See Also

PetscSection, `PetscSection`, `PetscSectionSetChart()`, `PetscSectionDestroy()`, `PetscSectionCreateGlobalSection()`

## Level

beginner

## Location

src/vec/is/section/interface/section.c

## Examples

src/ts/tutorials/ex30.c
src/snes/tutorials/ex7.c
src/dm/impls/plex/tutorials/ex7.c
src/ts/tutorials/ex11.c

Index of all PetscSection routines
Table of Contents for all manual pages
Index of all manual pages