Skip to main content
`Ctrl`+`K`

# petsc4py.PETSc.LGMap

class petsc4py.PETSc.LGMap

  Bases: `Object`

  Mapping from a local to a global ordering.

  See also

  `ISLocalToGlobalMapping`

  Enumerations

  `GLMapMode` | Enum describing mapping behavior when global indices are missing.
  `Type` | Local to global map types.

  Methods Summary

  `apply`(indices[, result]) | Convert a locally numbered list of integers to a global numbering.
  `applyBlock`(indices[, result]) | Convert a local block numbering to a global block numbering.
  `applyBlockInverse`(indices[, mode]) | Compute blocked local numbering from blocked global numbering.
  `applyIS`(iset) | Create an index set with global numbering from a local numbering.
  `applyInverse`(indices[, mode]) | Compute local numbering from global numbering.
  `create`(indices[, bsize, comm]) | Create a local-to-global mapping.
  `createIS`(iset) | Create a local-to-global mapping from an index set.
  `createSF`(sf, start) | Create a local-to-global mapping from a star forest.
  `destroy`() | Destroy the local-to-global mapping.
  `getBlockIndices`() | Return the global indices for each local block.
  `getBlockInfo`() | Determine the block indices shared with neighboring processes.
  `getBlockSize`() | Return the block size of the local-to-global mapping.
  `getIndices`() | Return the global indices for each local point in the mapping.
  `getInfo`() | Determine the indices shared with neighboring processes.
  `getSize`() | Return the local size of the local-to-global mapping.
  `load`(viewer) | Load a local-to-global mapping.
  `setFromOptions`() | Set mapping options from the options database.
  `setType`(lgmap_type) | Set the type of the local-to-global map.
  `view`([viewer]) | View the local-to-global mapping.

  Attributes Summary

  `block_indices` | The global indices for each local block in the mapping.
  `block_info` | Mapping describing block indices shared with neighboring processes.
  `block_size` | The block size.
  `indices` | The global indices for each local point in the mapping.
  `info` | Mapping describing indices shared with neighboring processes.
  `size` | The local size.

  Methods Documentation

  apply(indices, result=None)

    Convert a locally numbered list of integers to a global numbering.

    Not collective.

    Parameters:

      - indices (Sequence[int]) – Input indices in local numbering.

      - result (ArrayInt | None) – Array to write the global numbering to. If `None` then a new array will be allocated.

    Returns:

      Indices in global numbering. If `result` is not `None` then this is returned here.

    Return type:

      `ArrayInt`

    See also

    `LGMap.applyBlock`, `ISLocalToGlobalMappingApply`

    Source code at petsc4py/PETSc/IS.pyx:1471

  applyBlock(indices, result=None)

    Convert a local block numbering to a global block numbering.

    Not collective.

    Parameters:

      - indices (Sequence[int]) – Input block indices in local numbering.

      - result (ArrayInt | None) – Array to write the global numbering to. If `None` then a new array will be allocated.

    Returns:

      Block indices in global numbering. If `result` is not `None` then this is returned here.

    Return type:

      `ArrayInt`

    See also

    `LGMap.apply`, `ISLocalToGlobalMappingApplyBlock`

    Source code at petsc4py/PETSc/IS.pyx:1508

  applyBlockInverse(indices, mode=None)

    Compute blocked local numbering from blocked global numbering.

    Not collective.

    Parameters:

      - indices (Sequence[int]) – Indices with a global block numbering.

      - mode (GLMapMode | str | None) – Flag indicating what to do with indices that have no local value, defaults to `"mask"`.

    Returns:

      Indices with a local block numbering.

    Return type:

      `ArrayInt`

    See also

    `ISGlobalToLocalMappingApplyBlock`

    Source code at petsc4py/PETSc/IS.pyx:1609

  applyIS(iset)

    Create an index set with global numbering from a local numbering.

    Collective.

    Parameters:

      iset (IS) – Index set with local numbering.

    Returns:

      Index set with global numbering.

    Return type:

      `IS`

    See also

    `ISLocalToGlobalMappingApplyIS`

    Source code at petsc4py/PETSc/IS.pyx:1545

  applyInverse(indices, mode=None)

    Compute local numbering from global numbering.

    Not collective.

    Parameters:

      - indices (Sequence[int]) – Indices with a global numbering.

      - mode (GLMapMode | str | None) – Flag indicating what to do with indices that have no local value, defaults to `"mask"`.

    Returns:

      Indices with a local numbering.

    Return type:

      `ArrayInt`

    See also

    `ISGlobalToLocalMappingApply`

    Source code at petsc4py/PETSc/IS.pyx:1570

  create(indices, bsize=None, comm=None)

    Create a local-to-global mapping.

    Not collective.

    Parameters:

      - indices (Sequence[int]) – Global index for each local element.

      - bsize (int | None) – Block size, defaults to 1.

      - comm (Comm | None) – MPI communicator, defaults to `Sys.getDefaultComm`.

    Return type:

      Self

    See also

    `ISLocalToGlobalMappingCreate`

    Source code at petsc4py/PETSc/IS.pyx:1254

  createIS(iset)

    Create a local-to-global mapping from an index set.

    Not collective.

    Parameters:

      iset (IS) – Index set containing the global numbers for each local number.

    Return type:

      Self

    See also

    `ISLocalToGlobalMappingCreateIS`

    Source code at petsc4py/PETSc/IS.pyx:1289

  createSF(sf, start)

    Create a local-to-global mapping from a star forest.

    Collective.

    Parameters:

      - sf (SF) – Star forest mapping contiguous local indices to (rank, offset).

      - start (int) – First global index on this process.

    Return type:

      Self

    See also

    `ISLocalToGlobalMappingCreateSF`

    Source code at petsc4py/PETSc/IS.pyx:1310

  destroy()

    Destroy the local-to-global mapping.

    Not collective.

    See also

    `ISLocalToGlobalMappingDestroy`

    Source code at petsc4py/PETSc/IS.pyx:1241

    Return type:

      Self

  getBlockIndices()

    Return the global indices for each local block.

    Not collective.

    See also

    `ISLocalToGlobalMappingGetBlockIndices`

    Source code at petsc4py/PETSc/IS.pyx:1385

    Return type:

      ArrayInt

  getBlockInfo()

    Determine the block indices shared with neighboring processes.

    Collective.

    Returns:

      Mapping from neighboring processor number to an array of shared block indices (in local numbering).

    Return type:

      `dict`

    See also

    `ISLocalToGlobalMappingGetBlockInfo`

    Source code at petsc4py/PETSc/IS.pyx:1440

  getBlockSize()

    Return the block size of the local-to-global mapping.

    Not collective.

    See also

    `ISLocalToGlobalMappingGetBlockSize`

    Source code at petsc4py/PETSc/IS.pyx:1347

    Return type:

      int

  getIndices()

    Return the global indices for each local point in the mapping.

    Not collective.

    See also

    `ISLocalToGlobalMappingGetIndices`

    Source code at petsc4py/PETSc/IS.pyx:1361

    Return type:

      ArrayInt

  getInfo()

    Determine the indices shared with neighboring processes.

    Collective.

    Returns:

      Mapping from neighboring processor number to an array of shared indices (in local numbering).

    Return type:

      `dict`

    See also

    `ISLocalToGlobalMappingGetInfo`

    Source code at petsc4py/PETSc/IS.pyx:1411

  getSize()

    Return the local size of the local-to-global mapping.

    Not collective.

    See also

    `ISLocalToGlobalMappingGetSize`

    Source code at petsc4py/PETSc/IS.pyx:1333

    Return type:

      int

  load(viewer)

    Load a local-to-global mapping.

    Collective.

    See also

    `view`, `ISLocalToGlobalMappingLoad`

    Source code at petsc4py/PETSc/IS.pyx:1223

    Parameters:

      viewer (Viewer)

    Return type:

      Self

  setFromOptions()

    Set mapping options from the options database.

    Not collective.

    See also

    Working with PETSc options, `ISLocalToGlobalMappingSetFromOptions`

    Source code at petsc4py/PETSc/IS.pyx:1192

    Return type:

      None

  setType(lgmap_type)

    Set the type of the local-to-global map.

    Logically collective.

    Parameters:

      lgmap_type (Type | str) – The type of the local-to-global mapping.

    Return type:

      None

    Notes

    Use `-islocaltoglobalmapping_type` to set the type in the options database.

    See also

    Working with PETSc options, `ISLocalToGlobalMappingSetType`

    Source code at petsc4py/PETSc/IS.pyx:1168

  view(viewer=None)

    View the local-to-global mapping.

    Not collective.

    Parameters:

      viewer (Viewer | None) – Viewer instance, defaults to an instance of `Viewer.Type.ASCII`.

    Return type:

      None

    See also

    `load`, `ISLocalToGlobalMappingView`

    Source code at petsc4py/PETSc/IS.pyx:1204

  Attributes Documentation

  block_indices

    The global indices for each local block in the mapping.

    Not collective.

    See also

    `LGMap.getBlockIndices`, `ISLocalToGlobalMappingGetBlockIndices`

    Source code at petsc4py/PETSc/IS.pyx:1688

  block_info

    Mapping describing block indices shared with neighboring processes.

    Collective.

    See also

    `LGMap.getBlockInfo`, `ISLocalToGlobalMappingGetBlockInfo`

    Source code at petsc4py/PETSc/IS.pyx:1714

  block_size

    The block size.

    Not collective.

    See also

    `LGMap.getBlockSize`

    Source code at petsc4py/PETSc/IS.pyx:1662

  indices

    The global indices for each local point in the mapping.

    Not collective.

    See also

    `LGMap.getIndices`, `ISLocalToGlobalMappingGetIndices`

    Source code at petsc4py/PETSc/IS.pyx:1675

  info

    Mapping describing indices shared with neighboring processes.

    Collective.

    See also

    `LGMap.getInfo`, `ISLocalToGlobalMappingGetInfo`

    Source code at petsc4py/PETSc/IS.pyx:1701

  size

    The local size.

    Not collective.

    See also

    `LGMap.getSize`

    Source code at petsc4py/PETSc/IS.pyx:1649