Skip to main content
`Ctrl`+`K`

# PetscSectionMigrateData

Migrate data described by a `PetscSection` using a `PetscSF` that defines a original-to-new (root-to-leaf) point mapping

## Synopsis

    #include "petscsection.h"
    PetscErrorCode PetscSectionMigrateData(PetscSF migratePointSF, MPI_Datatype datatype, PetscSection rootSection, const void *rootData, PetscSection leafSection, void *leafData[], PetscSF *migrateDataSF)

Collective

## Input Parameters

- migratePointSF - defines the mapping (communication) of the root points to the leaf points

- datatype - the type of data

- rootSection - the `PetscSection` that describes the data layout on the root points (how many dof and what fields are associated with each root point)

- rootData - the existing data array described by `rootSection`, may be `NULL` is storage size of `rootSection` is zero

## Output Parameters

- leafSection - the new `PetscSection` that describes the data layout on the leaf points

- leafData - the redistributed data array that is associated with the leaf points

- migrateDataSF - defines the mapping (communication) of the `rootData` array to the `leafData` array, may be `NULL` if not needed

## Notes

This function can best be thought of as applying `PetscSFBcastBegin()` to an array described by a `PetscSection`. While `PetscSFBcastBegin()` is limited to broadcasting data that is of the same size for every index, this function allows the data to be a different size for each index. The size and layout of that irregularly sized data before and after `PetscSFBcastBegin()` is described by the `rootSection` and `leafSection`, respectively.

This function combines `PetscSFDistributeSection()`, `PetscSFCreateSectionSF()`, and `PetscSFBcastBegin()`/`PetscSFBcastEnd()` into a single call. `migrateDataSF` can be used to repeat the `PetscSFBcastBegin()`/`PetscSFBcastEnd()` on a different data array described by the same `rootSection`.

This should not be used for global-to-local type communciation patterns. For this use case, see `PetscSectionCreateGlobalSection()` and `PetscSFSetGraphSection()`.

## See Also

PetscSection, `PetscSection`, `PetscSFDistributeSection()`, `PetscSFCreateSectionSF()`, `DMPlexDistributeData()`

## Level

advanced

## Location

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

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