petsc4py.PETSc.LGMap#

class petsc4py.PETSc.LGMap#

Bases: Object

Mapping from an arbitrary local ordering from 0 to n-1 to a global PETSc ordering used by a vector or matrix.

Enumerations

GLMapMode

Enum describing mapping behavior for global-to-local maps when global indices are missing.

Type

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.

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

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

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

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

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

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

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

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

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

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

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

Create a local-to-global mapping.

Not collective.

Parameters:
Return type:

Self

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

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

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

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

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

destroy()#

Destroy the local-to-global mapping.

Not collective.

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

Return type:

Self

getBlockIndices()#

Return the global indices for each local block.

Not collective.

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

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

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

getBlockSize()#

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

Not collective.

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

Return type:

int

getIndices()#

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

Not collective.

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

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

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

getSize()#

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

Not collective.

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

Return type:

int

setFromOptions()#

Set mapping options from the options database.

Not collective.

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

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.

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

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

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

Attributes Documentation

block_indices#

The global indices for each local block in the mapping.

Not collective.

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

block_info#

Mapping describing block indices shared with neighboring processes.

Collective.

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

block_size#

The block size.

Not collective.

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

indices#

The global indices for each local point in the mapping.

Not collective.

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

info#

Mapping describing indices shared with neighboring processes.

Collective.

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

size#

The local size.

Not collective.

See also

LGMap.getSize

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