PetscSFCreateStridedSF#

Create an PetscSF to communicate interleaved blocks of data

Synopsis#

#include "petscsf.h"   
PetscErrorCode PetscSFCreateStridedSF(PetscSF sf, PetscInt bs, PetscInt ldr, PetscInt ldl, PetscSF *vsf)

Collective

Input Parameters#

  • sf - star forest

  • bs - stride

  • ldr - leading dimension of root space

  • ldl - leading dimension of leaf space

Output Parameter#

Notes#

This can be useful to perform communications on blocks of right-hand sides. For example, the calling sequence

  c_datatype *roots, *leaves;
  for i in [0,bs) do
    PetscSFBcastBegin(sf, mpi_datatype, roots + i*ldr, leaves + i*ldl, op)
    PetscSFBcastEnd(sf, mpi_datatype, roots + i*ldr, leaves + i*ldl, op)

is equivalent to

  c_datatype *roots, *leaves;
  PetscSFCreateStridedSF(sf, bs, ldr, ldl, &vsf)
  PetscSFBcastBegin(vsf, mpi_datatype, roots, leaves, op)
  PetscSFBcastEnd(vsf, mpi_datatype, roots, leaves, op)

Developer Notes#

Should this functionality be handled with a new API instead of creating a new object?

See Also#

PetscSF, PetscSFCreate(), PetscSFSetGraph()

Level#

intermediate

Location#

src/vec/is/sf/utils/sfutils.c

Examples#

src/vec/is/sf/tutorials/ex1.c


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