- testing 3.20.5-4
- unstable 3.22.1-2
- experimental 3.22.1-1exp1
PETSC4PY(3) | Project name not set | PETSC4PY(3) |
NAME¶
petsc4py - PETSc for Python
- Author
- Lisandro Dalcin
- Contact
- dalcinl@gmail.com
- Web Site
- https://gitlab.com/petsc/petsc
- Date
- Nov 27, 2024
Abstract¶
This document describes petsc4py, a Python wrapper to the PETSc libraries.
PETSc (the Portable, Extensible Toolkit for Scientific Computation) is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations. It employs the MPI standard for all message-passing communication.
This package provides an important subset of PETSc functionalities and uses NumPy to efficiently manage input and output of array data.
A good friend of petsc4py is:
- •
- mpi4py: Python bindings for MPI, the Message Passing Interface.
Other projects depend on petsc4py:
- •
- slepc4py: Python bindings for SLEPc, the Scalable Library for Eigenvalue Problem Computations.
PETSC OVERVIEW¶
PETSc is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations. It employs the MPI standard for all message-passing communication.
PETSc is intended for use in large-scale application projects [petsc-efficient], and several ongoing computational science projects are built around the PETSc libraries. With strict attention to component interoperability, PETSc facilitates the integration of independently developed application modules, which often most naturally employ different coding styles and data structures.
PETSc is easy to use for beginners [petsc-user-ref]. Moreover, its careful design allows advanced users to have detailed control over the solution process. PETSc includes an expanding suite of parallel linear and nonlinear equation solvers that are easily used in application codes written in C, C++, and Fortran. PETSc provides many of the mechanisms needed within parallel application codes, such as simple parallel matrix and vector assembly routines that allow the overlap of communication and computation.
- [petsc-user-ref]
- S. Balay, S. Abhyankar, M. Adams, S. Benson, J. Brown, P. Brune, K. Buschelman, E. Constantinescu, L. Dalcin, A. Dener, V. Eijkhout, J. Faibussowitsch, W. Gropp, V. Hapla, T. Isaac, P. Jolivet, D. Karpeyev, D. Kaushik, M. Knepley, F. Kong, S. Kruger, D. May, L. Curfman McInnes, R. Mills, L. Mitchell, T. Munson, J. Roman, K. Rupp, P. Sanan, J Sarich, B. Smith, H. Suh, S. Zampini, H. Zhang, and H. Zhang, J. Zhang, PETSc/TAO Users Manual, ANL-21/39 - Revision 3.22, 2024. http://dx.doi.org/10.2172/2205494, https://petsc.org/release/docs/manual/manual.pdf
- [petsc-efficient]
- Satish Balay, Victor Eijkhout, William D. Gropp, Lois Curfman McInnes and Barry F. Smith. Efficient Management of Parallelism in Object Oriented Numerical Software Libraries. Modern Software Tools in Scientific Computing. E. Arge, A. M. Bruaset and H. P. Langtangen, editors. 163--202. Birkhauser Press. 1997.
Components¶
PETSc is designed with an object-oriented style. Almost all user-visible types are abstract interfaces with implementations that may be chosen at runtime. Those objects are managed through handles to opaque data structures which are created, accessed and destroyed by calling appropriate library routines.
PETSc consists of a variety of components. Each component manipulates a particular family of objects and the operations one would like to perform on these objects. These components provide the functionality required for many parallel solutions of PDEs.
- Vec
- Provides the vector operations required for setting up and solving large-scale linear and nonlinear problems. Includes easy-to-use parallel scatter and gather operations, as well as special-purpose code for handling ghost points for regular data structures.
- Mat
- A large suite of data structures and code for the manipulation of parallel sparse matrices. Includes several different parallel matrix data structures, each appropriate for a different class of problems.
- PC
- A collection of sequential and parallel preconditioners, including (sequential) ILU(k), LU, and (both sequential and parallel) block Jacobi, overlapping additive Schwarz methods.
- KSP
- Parallel implementations of many popular Krylov subspace iterative methods, including GMRES, CG, CGS, Bi-CG-Stab, two variants of TFQMR, CR, and LSQR. All are coded so that they are immediately usable with any preconditioners and any matrix data structures, including matrix-free methods.
- SNES
- Data-structure-neutral implementations of Newton-like methods for nonlinear systems. Includes both line search and trust region techniques with a single interface. Employs by default the above data structures and linear solvers. Users can set custom monitoring routines, convergence criteria, etc.
- TS
- Code for the time evolution of solutions of PDEs. In addition, provides pseudo-transient continuation techniques for computing steady-state solutions.
INSTALLATION¶
Install from PyPI using pip¶
You can use pip to install petsc4py and its dependencies (mpi4py is optional but highly recommended):
$ python -m pip install mpi4py petsc petsc4py
Install from the PETSc source tree¶
First build PETSc. Next cd to the top of the PETSc source tree and set the PETSC_DIR and PETSC_ARCH environment variables. Run:
$ python -m pip install src/binding/petsc4py
The installation of petsc4py supports multiple PETSC_ARCH in the form of colon separated list:
$ PETSC_ARCH='arch-0:...:arch-N' python -m pip install src/binding/petsc4py
If you are cross-compiling, and the numpy module cannot be loaded on your build host, then before invoking pip, set the NUMPY_INCLUDE environment variable to the path that would be returned by import numpy; numpy.get_include():
$ export NUMPY_INCLUDE=/usr/lib/pythonX/site-packages/numpy/core/include
Running the testing suite¶
When installing from source, the petsc4py complete testsuite can be run as:
$ cd src/binding/petsc4py $ python test/runtests.py
or via the makefile rule test:
$ make test -C src/binding/petsc4py
Specific tests can be run using the command-line option -k, e.g.:
$ python test/runtests.py -k test_optdb
to run all the tests provided in tests/test_optdb.py.
For other command-line options, run:
$ python test/runtests.py --help
If not otherwise specified, all tests will be run in sequential mode. To run all the tests with the same number of MPI processes, for example 4, run:
$ mpiexec -n 4 python test/runtests.py
or:
$ make test-4 -C src/binding/petsc4py
Building the documentation¶
Install the documentation dependencies:
$ python -m pip install -r ${PETSC_DIR/doc/requirements.txt
Then:
$ cd src/binding/petsc4py/docs/source $ make html
The resulting HTML files will be in _build/html.
NOTE:
CONTRIBUTING¶
Contributions from the user community are welcome. See the PETSc developers documentation for general information on contributions.
New contributions to petsc4py must adhere with the coding standards. We use cython-lint for Cython and ruff for Python source codes. These can be installed using:
$ python -m pip install -r src/binding/petsc4py/conf/requirements-lint.txt
If you are contributing Cython code, you can check compliance with:
$ make cython-lint -C src/binding/petsc4py
For Python code, run:
$ make ruff-lint -C src/binding/petsc4py
Python code can be auto-formatted using:
$ make ruff-lint RUFF_OPTS='format' -C src/binding/petsc4py
New contributions to petsc4py must be tested. Tests are located in the src/binding/petsc4py/test folder. To add a new test, either add a new test_xxx.py or modify a pre-existing file according to the unittest specifications.
If you add a new test_xxx.py, you can run the tests using:
$ cd src/binding/petsc4py $ python test/runtests.py -k test_xxx
If instead you are modifying an existing test_xxx.py, you can test your additions by using the fully qualified name of the Python class or method you are modifying, e.g.:
$ python test/runtests.py -k test_xxx.class_name.method_name
All new code must include documentation in accordance with the documentation standard. To check for compliance, run:
$ make html SPHINXOPTS='-W' -C src/binding/petsc4py/docs/source
WARNING:
CITATIONS¶
If PETSc for Python has been significant to a project that leads to an academic publication, please acknowledge that fact by citing the project.
- L. Dalcin, P. Kler, R. Paz, and A. Cosimo, Parallel Distributed Computing using Python, Advances in Water Resources, 34(9):1124-1139, 2011. https://doi.org/10.1016/j.advwatres.2011.04.013
- S. Balay, S. Abhyankar, M. Adams, S. Benson, J. Brown, P. Brune, K. Buschelman, E. Constantinescu, L. Dalcin, A. Dener, V. Eijkhout, J. Faibussowitsch, W. Gropp, V. Hapla, T. Isaac, P. Jolivet, D. Karpeyev, D. Kaushik, M. Knepley, F. Kong, S. Kruger, D. May, L. Curfman McInnes, R. Mills, L. Mitchell, T. Munson, J. Roman, K. Rupp, P. Sanan, J Sarich, B. Smith, H. Suh, S. Zampini, H. Zhang, and H. Zhang, J. Zhang, PETSc/TAO Users Manual, ANL-21/39 - Revision 3.22, 2024. https://doi.org/10.2172/2205494, https://petsc.org/release/docs/manual/manual.pdf
REFERENCE¶
petsc4py | The PETSc for Python package. |
petsc4py.typing | Typing support. |
petsc4py.PETSc | Portable, Extensible Toolkit for Scientific Computation. |
petsc4py¶
The PETSc for Python package.
This package is an interface to PETSc libraries.
PETSc (the Portable, Extensible Toolkit for Scientific Computation) is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations. It employs the MPI standard for all message-passing communications.
Functions
get_config() | Return a dictionary with information about PETSc. |
get_include() | Return the directory in the package that contains header files. |
init([args, arch, comm]) | Initialize PETSc. |
petsc4py.get_config¶
petsc4py.get_include¶
- petsc4py.get_include()
- Return the directory in the package that contains header files.
Extension modules that need to compile against petsc4py should use this function to locate the appropriate include directory.
Example
Using Python distutils or NumPy distutils:
import petsc4py Extension('extension_name', ...
include_dirs=[..., petsc4py.get_include()])
- Return type
- str
petsc4py.init¶
- petsc4py.init(args=None, arch=None, comm=None)
- Initialize PETSc.
- args (str | list[str] | None) -- Command-line arguments, usually the sys.argv list
- arch (str | None) -- Specific configuration to use
- comm (Intracomm | None) -- MPI commmunicator
- Return type
- None
Notes
This function should be called only once, typically at the very beginning of the bootstrap script of an application.
petsc4py.typing¶
Typing support.
Attributes
Scalar | Scalar type. |
ArrayBool | Array of bool. |
ArrayInt | Array of int. |
ArrayReal | Array of float. |
ArrayComplex | Array of complex. |
ArrayScalar | Array of Scalar numbers. |
DimsSpec | Dimensions specification. |
AccessModeSpec | Access mode specification. |
InsertModeSpec | Insertion mode specification. |
ScatterModeSpec | Scatter mode specification. |
LayoutSizeSpec | int or 2-tuple of int describing the layout sizes. |
NormTypeSpec | Norm type specification. |
PetscOptionsHandlerFunction | Callback for processing extra options. |
MatAssemblySpec | Matrix assembly specification. |
MatSizeSpec | int or (nested) tuple of int describing the matrix sizes. |
MatBlockSizeSpec | The row and column block sizes. |
CSRIndicesSpec | CSR indices format specification. |
CSRSpec | CSR format specification. |
NNZSpec | Nonzero pattern specification. |
MatNullFunction | PETSc.NullSpace callback. |
DMCoarsenHookFunction | PETSc.DM coarsening hook callback. |
DMRestrictHookFunction | PETSc.DM restriction hook callback. |
KSPRHSFunction | PETSc.KSP right-hand side function callback. |
KSPOperatorsFunction | PETSc.KSP operators function callback. |
KSPConvergenceTestFunction | PETSc.KSP convergence test callback. |
KSPMonitorFunction | PETSc.KSP monitor callback. |
KSPPreSolveFunction | PETSc.KSP pre solve callback. |
KSPPostSolveFunction | PETSc.KSP post solve callback. |
SNESMonitorFunction | SNES monitor callback. |
SNESObjFunction | SNES objective function callback. |
SNESFunction | SNES residual function callback. |
SNESJacobianFunction | SNES Jacobian callback. |
SNESGuessFunction | SNES initial guess callback. |
SNESUpdateFunction | SNES step update callback. |
SNESLSPreFunction | SNES linesearch pre-check update callback. |
SNESNGSFunction | SNES nonlinear Gauss-Seidel callback. |
SNESConvergedFunction | SNES convergence test callback. |
TSRHSFunction | TS right-hand side function callback. |
TSRHSJacobian | TS right-hand side Jacobian callback. |
TSRHSJacobianP | TS right-hand side parameter Jacobian callback. |
TSIFunction | TS implicit function callback. |
TSIJacobian | TS implicit Jacobian callback. |
TSIJacobianP | TS implicit parameter Jacobian callback. |
TSI2Function | TS implicit 2nd order function callback. |
TSI2Jacobian | TS implicit 2nd order Jacobian callback. |
TSI2JacobianP | TS implicit 2nd order parameter Jacobian callback. |
TSMonitorFunction | TS monitor callback. |
TSPreStepFunction | TS pre-step callback. |
TSPostStepFunction | TS post-step callback. |
TSIndicatorFunction | TS event indicator callback. |
TSPostEventFunction | TS post-event callback. |
TAOObjectiveFunction | TAO objective function callback. |
TAOGradientFunction | TAO objective gradient callback. |
TAOObjectiveGradientFunction | TAO objective function and gradient callback. |
TAOHessianFunction | TAO objective Hessian callback. |
TAOUpdateFunction | TAO update callback. |
TAOMonitorFunction | TAO monitor callback. |
TAOConvergedFunction | TAO convergence test callback. |
TAOJacobianFunction | TAO Jacobian callback. |
TAOResidualFunction | TAO residual callback. |
TAOJacobianResidualFunction | TAO Jacobian residual callback. |
TAOVariableBoundsFunction | TAO variable bounds callback. |
TAOConstraintsFunction | TAO constraints callback. |
TAOLSObjectiveFunction | TAOLineSearch objective function callback. |
TAOLSGradientFunction | TAOLineSearch objective gradient callback. |
TAOLSObjectiveGradientFunction | TAOLineSearch objective function and gradient callback. |
petsc4py.typing.Scalar¶
- petsc4py.typing.Scalar = float | complex
- Scalar type.
Scalars can be either float or complex (but not both) depending on how PETSc was configured (./configure --with-scalar-type=real|complex).
petsc4py.typing.ArrayBool¶
- petsc4py.typing.ArrayBool
- Array of bool.
alias of ndarray[Any, dtype[bool]]
petsc4py.typing.ArrayInt¶
- petsc4py.typing.ArrayInt
- Array of int.
alias of ndarray[Any, dtype[int]]
petsc4py.typing.ArrayReal¶
- petsc4py.typing.ArrayReal
- Array of float.
alias of ndarray[Any, dtype[float]]
petsc4py.typing.ArrayComplex¶
- petsc4py.typing.ArrayComplex
- Array of complex.
alias of ndarray[Any, dtype[complex]]
petsc4py.typing.ArrayScalar¶
- petsc4py.typing.ArrayScalar
- Array of Scalar numbers.
alias of ndarray[Any, dtype[float | complex]]
petsc4py.typing.DimsSpec¶
- petsc4py.typing.DimsSpec
- Dimensions specification.
N-tuples indicates N-dimensional grid sizes.
alias of tuple[int, ...]
petsc4py.typing.AccessModeSpec¶
petsc4py.typing.InsertModeSpec¶
- petsc4py.typing.InsertModeSpec = petsc4py.PETSc.InsertMode | bool | None
- Insertion mode specification.
- InsertMode.ADD_VALUES Add new value to existing one.
- InsertMode.INSERT_VALUES Replace existing entry with new value.
- None as InsertMode.INSERT_VALUES.
- False as InsertMode.INSERT_VALUES.
- True as InsertMode.ADD_VALUES.
SEE ALSO:
petsc4py.typing.ScatterModeSpec¶
- petsc4py.typing.ScatterModeSpec = petsc4py.PETSc.ScatterMode | bool | str | None
- Scatter mode specification.
- ScatterMode.FORWARD Forward mode.
- ScatterMode.REVERSE Reverse mode.
- None as ScatterMode.FORWARD.
- False as ScatterMode.FORWARD.
- True as ScatterMode.REVERSE.
- 'forward' as ScatterMode.FORWARD.
- 'reverse' as ScatterMode.REVERSE.
SEE ALSO:
petsc4py.typing.LayoutSizeSpec¶
- petsc4py.typing.LayoutSizeSpec = int | tuple[int, int]
- int or 2-tuple of int describing the layout sizes.
A single int indicates global size. A tuple of int indicates (local_size, global_size).
SEE ALSO:
petsc4py.typing.NormTypeSpec¶
- petsc4py.typing.NormTypeSpec = petsc4py.PETSc.NormType | None
- Norm type specification.
Possible values include:
- NormType.NORM_1 The 1-norm: Σₙ abs(xₙ) for vectors, maxₙ (Σᵢ abs(xₙᵢ)) for matrices.
- NormType.NORM_2 The 2-norm: √(Σₙ xₙ²) for vectors, largest singular values for matrices.
- NormType.NORM_INFINITY The ∞-norm: maxₙ abs(xₙ) for vectors, maxᵢ (Σₙ abs(xₙᵢ)) for matrices.
- NormType.NORM_FROBENIUS The Frobenius norm: same as 2-norm for vectors, √(Σₙᵢ xₙᵢ²) for matrices.
- NormType.NORM_1_AND_2 Compute both NormType.NORM_1 and NormType.NORM_2.
- None as NormType.NORM_2 for vectors, NormType.NORM_FROBENIUS for matrices.
SEE ALSO:
petsc4py.typing.PetscOptionsHandlerFunction¶
- petsc4py.typing.PetscOptionsHandlerFunction
- Callback for processing extra options.
alias of Callable[[Object], None]
petsc4py.typing.MatAssemblySpec¶
- petsc4py.typing.MatAssemblySpec = petsc4py.PETSc.Mat.AssemblyType | bool | None
- Matrix assembly specification.
- Mat.AssemblyType.FINAL
- Mat.AssemblyType.FLUSH
- None as Mat.AssemblyType.FINAL
- False as Mat.AssemblyType.FINAL
- True as Mat.AssemblyType.FLUSH
SEE ALSO:
petsc4py.typing.MatSizeSpec¶
- petsc4py.typing.MatSizeSpec = int | tuple[int, int] | tuple[tuple[int, int], tuple[int, int]]
- int or (nested) tuple of int describing the matrix
sizes.
If int then rows = columns. A single tuple of int indicates (rows, columns). A nested tuple of int indicates ((local_rows, rows), (local_columns, columns)).
SEE ALSO:
petsc4py.typing.MatBlockSizeSpec¶
- petsc4py.typing.MatBlockSizeSpec = int | tuple[int, int]
- The row and column block sizes.
If a single int is provided then rows and columns share the same block size.
petsc4py.typing.CSRIndicesSpec¶
- petsc4py.typing.CSRIndicesSpec
- CSR indices format specification.
A 2-tuple carrying the (row_start, col_indices) information.
alias of tuple[Sequence[int], Sequence[int]]
petsc4py.typing.CSRSpec¶
- petsc4py.typing.CSRSpec
- CSR format specification.
A 3-tuple carrying the (row_start, col_indices, values) information.
alias of tuple[Sequence[int], Sequence[int], Sequence[float | complex]]
petsc4py.typing.NNZSpec¶
- petsc4py.typing.NNZSpec
- Nonzero pattern specification.
A single int corresponds to fixed number of non-zeros per row. A Sequence of int indicates different non-zeros per row. If a 2-tuple is used, the elements of the tuple corresponds to the on-process and off-process parts of the matrix.
SEE ALSO:
alias of int | Sequence[int] | tuple[Sequence[int], Sequence[int]]
petsc4py.typing.MatNullFunction¶
- petsc4py.typing.MatNullFunction
- PETSc.NullSpace callback.
alias of Callable[[NullSpace, Vec], None]
petsc4py.typing.DMCoarsenHookFunction¶
- petsc4py.typing.DMCoarsenHookFunction
- PETSc.DM coarsening hook callback.
alias of Callable[[DM, DM], None]
petsc4py.typing.DMRestrictHookFunction¶
- petsc4py.typing.DMRestrictHookFunction
- PETSc.DM restriction hook callback.
alias of Callable[[DM, Mat, Vec, Mat, DM], None]
petsc4py.typing.KSPRHSFunction¶
- petsc4py.typing.KSPRHSFunction
- PETSc.KSP right-hand side function callback.
alias of Callable[[KSP, Vec], None]
petsc4py.typing.KSPOperatorsFunction¶
- petsc4py.typing.KSPOperatorsFunction
- PETSc.KSP operators function callback.
alias of Callable[[KSP, Mat, Mat], None]
petsc4py.typing.KSPConvergenceTestFunction¶
- petsc4py.typing.KSPConvergenceTestFunction
- PETSc.KSP convergence test callback.
alias of Callable[[KSP, int, float], ConvergedReason]
petsc4py.typing.KSPMonitorFunction¶
- petsc4py.typing.KSPMonitorFunction
- PETSc.KSP monitor callback.
alias of Callable[[KSP, int, float], None]
petsc4py.typing.KSPPreSolveFunction¶
- petsc4py.typing.KSPPreSolveFunction
- PETSc.KSP pre solve callback.
alias of Callable[[KSP, Vec, Vec], None]
petsc4py.typing.KSPPostSolveFunction¶
- petsc4py.typing.KSPPostSolveFunction
- PETSc.KSP post solve callback.
alias of Callable[[KSP, Vec, Vec], None]
petsc4py.typing.SNESMonitorFunction¶
- petsc4py.typing.SNESMonitorFunction
- SNES monitor callback.
alias of Callable[[SNES, int, float], None]
petsc4py.typing.SNESObjFunction¶
- petsc4py.typing.SNESObjFunction
- SNES objective function callback.
alias of Callable[[SNES, Vec], None]
petsc4py.typing.SNESFunction¶
- petsc4py.typing.SNESFunction
- SNES residual function callback.
alias of Callable[[SNES, Vec, Vec], None]
petsc4py.typing.SNESJacobianFunction¶
- petsc4py.typing.SNESJacobianFunction
- SNES Jacobian callback.
alias of Callable[[SNES, Vec, Mat, Mat], None]
petsc4py.typing.SNESGuessFunction¶
- petsc4py.typing.SNESGuessFunction
- SNES initial guess callback.
alias of Callable[[SNES, Vec], None]
petsc4py.typing.SNESUpdateFunction¶
- petsc4py.typing.SNESUpdateFunction
- SNES step update callback.
alias of Callable[[SNES, int], None]
petsc4py.typing.SNESLSPreFunction¶
- petsc4py.typing.SNESLSPreFunction
- SNES linesearch pre-check update callback.
alias of Callable[[Vec, Vec], None]
petsc4py.typing.SNESNGSFunction¶
- petsc4py.typing.SNESNGSFunction
- SNES nonlinear Gauss-Seidel callback.
alias of Callable[[SNES, Vec, Vec], None]
petsc4py.typing.SNESConvergedFunction¶
- petsc4py.typing.SNESConvergedFunction
- SNES convergence test callback.
alias of Callable[[SNES, int, tuple[float, float, float]], ConvergedReason]
petsc4py.typing.TSRHSFunction¶
- petsc4py.typing.TSRHSFunction
- TS right-hand side function callback.
alias of Callable[[TS, float, Vec, Vec], None]
petsc4py.typing.TSRHSJacobian¶
- petsc4py.typing.TSRHSJacobian
- TS right-hand side Jacobian callback.
alias of Callable[[TS, float, Vec, Mat, Mat], None]
petsc4py.typing.TSRHSJacobianP¶
- petsc4py.typing.TSRHSJacobianP
- TS right-hand side parameter Jacobian callback.
alias of Callable[[TS, float, Vec, Mat], None]
petsc4py.typing.TSIFunction¶
- petsc4py.typing.TSIFunction
- TS implicit function callback.
alias of Callable[[TS, float, Vec, Vec, Vec], None]
petsc4py.typing.TSIJacobian¶
- petsc4py.typing.TSIJacobian
- TS implicit Jacobian callback.
alias of Callable[[TS, float, Vec, Vec, float, Mat, Mat], None]
petsc4py.typing.TSIJacobianP¶
- petsc4py.typing.TSIJacobianP
- TS implicit parameter Jacobian callback.
alias of Callable[[TS, float, Vec, Vec, float, Mat], None]
petsc4py.typing.TSI2Function¶
- petsc4py.typing.TSI2Function
- TS implicit 2nd order function callback.
alias of Callable[[TS, float, Vec, Vec, Vec, Vec], None]
petsc4py.typing.TSI2Jacobian¶
- petsc4py.typing.TSI2Jacobian
- TS implicit 2nd order Jacobian callback.
alias of Callable[[TS, float, Vec, Vec, Vec, float, float, Mat, Mat], None]
petsc4py.typing.TSI2JacobianP¶
- petsc4py.typing.TSI2JacobianP
- TS implicit 2nd order parameter Jacobian callback.
alias of Callable[[TS, float, Vec, Vec, Vec, float, float, Mat], None]
petsc4py.typing.TSMonitorFunction¶
- petsc4py.typing.TSMonitorFunction
- TS monitor callback.
alias of Callable[[TS, int, float, Vec], None]
petsc4py.typing.TSPreStepFunction¶
- petsc4py.typing.TSPreStepFunction
- TS pre-step callback.
alias of Callable[[TS], None]
petsc4py.typing.TSPostStepFunction¶
- petsc4py.typing.TSPostStepFunction
- TS post-step callback.
alias of Callable[[TS], None]
petsc4py.typing.TSIndicatorFunction¶
- petsc4py.typing.TSIndicatorFunction
- TS event indicator callback.
alias of Callable[[TS, float, Vec, ndarray[Any, dtype[float]]], None]
petsc4py.typing.TSPostEventFunction¶
- petsc4py.typing.TSPostEventFunction
- TS post-event callback.
alias of Callable[[TS, ndarray[Any, dtype[int]], float, Vec, bool], None]
petsc4py.typing.TAOObjectiveFunction¶
- petsc4py.typing.TAOObjectiveFunction
- TAO objective function callback.
alias of Callable[[TAO, Vec], float]
petsc4py.typing.TAOGradientFunction¶
- petsc4py.typing.TAOGradientFunction
- TAO objective gradient callback.
alias of Callable[[TAO, Vec, Vec], None]
petsc4py.typing.TAOObjectiveGradientFunction¶
- petsc4py.typing.TAOObjectiveGradientFunction
- TAO objective function and gradient callback.
alias of Callable[[TAO, Vec, Vec], float]
petsc4py.typing.TAOHessianFunction¶
- petsc4py.typing.TAOHessianFunction
- TAO objective Hessian callback.
alias of Callable[[TAO, Vec, Mat, Mat], None]
petsc4py.typing.TAOUpdateFunction¶
- petsc4py.typing.TAOUpdateFunction
- TAO update callback.
alias of Callable[[TAO, int], None]
petsc4py.typing.TAOMonitorFunction¶
- petsc4py.typing.TAOMonitorFunction
- TAO monitor callback.
alias of Callable[[TAO], None]
petsc4py.typing.TAOConvergedFunction¶
- petsc4py.typing.TAOConvergedFunction
- TAO convergence test callback.
alias of Callable[[TAO], None]
petsc4py.typing.TAOJacobianFunction¶
- petsc4py.typing.TAOJacobianFunction
- TAO Jacobian callback.
alias of Callable[[TAO, Vec, Mat, Mat], None]
petsc4py.typing.TAOResidualFunction¶
- petsc4py.typing.TAOResidualFunction
- TAO residual callback.
alias of Callable[[TAO, Vec, Vec], None]
petsc4py.typing.TAOJacobianResidualFunction¶
- petsc4py.typing.TAOJacobianResidualFunction
- TAO Jacobian residual callback.
alias of Callable[[TAO, Vec, Mat, Mat], None]
petsc4py.typing.TAOVariableBoundsFunction¶
- petsc4py.typing.TAOVariableBoundsFunction
- TAO variable bounds callback.
alias of Callable[[TAO, Vec, Vec], None]
petsc4py.typing.TAOConstraintsFunction¶
- petsc4py.typing.TAOConstraintsFunction
- TAO constraints callback.
alias of Callable[[TAO, Vec, Vec], None]
petsc4py.typing.TAOLSObjectiveFunction¶
- petsc4py.typing.TAOLSObjectiveFunction
- TAOLineSearch objective function callback.
alias of Callable[[TAOLineSearch, Vec], float]
petsc4py.typing.TAOLSGradientFunction¶
- petsc4py.typing.TAOLSGradientFunction
- TAOLineSearch objective gradient callback.
alias of Callable[[TAOLineSearch, Vec, Vec], None]
petsc4py.typing.TAOLSObjectiveGradientFunction¶
- petsc4py.typing.TAOLSObjectiveGradientFunction
- TAOLineSearch objective function and gradient callback.
alias of Callable[[TAOLineSearch, Vec, Vec], float]
petsc4py.PETSc¶
Portable, Extensible Toolkit for Scientific Computation.
Basic constants:
- DECIDE
- Use a default value for an int or float parameter.
- DEFAULT
- Use a default value chosen by PETSc.
- DETERMINE
- Compute a default value for an int or float parameter. For tolerances this uses the default value from when the object's type was set.
- CURRENT
- Do not change the current value that is set.
- UNLIMITED
- For a parameter that is a bound, such as the maximum number of iterations, do not bound the value.
More constants:
Classes
AO | Application ordering object. |
Comm | Communicator object. |
DM | An object describing a computational grid or mesh. |
DMComposite | A DM object that is used to manage data for a collection of DMs. |
DMDA | A DM object that is used to manage data for a structured grid. |
DMInterpolation | Interpolation on a mesh. |
DMLabel | An object representing a subset of mesh entities from a DM. |
DMPlex | Encapsulate an unstructured mesh. |
DMPlexTransform | Mesh transformations. |
DMPlexTransformType | Transformation types. |
DMShell | A shell DM object, used to manage user-defined problem data. |
DMStag | A DM object representing a "staggered grid" or a structured cell complex. |
DMSwarm | A DM object used to represent arrays of data (fields) of arbitrary type. |
DS | Discrete System object. |
Device | The device object. |
DeviceContext | DeviceContext object. |
DualSpace | Dual space to a linear space. |
FE | A PETSc object that manages a finite element space. |
IS | A collection of indices. |
InsertMode | Insertion mode. |
KSP | Abstract PETSc object that manages all Krylov methods. |
LGMap | Mapping from a local to a global ordering. |
Log | Logging support. |
LogClass | Logging support. |
LogEvent | Logging support. |
LogStage | Logging support for different stages. |
Mat | Matrix object. |
MatPartitioning | Object for managing the partitioning of a matrix or graph. |
NormType | Norm type. |
NullSpace | Nullspace object. |
Object | Base class wrapping a PETSc object. |
Options | The options database object. |
PC | Preconditioners. |
Partitioner | A graph partitioner. |
Quad | Quadrature rule for integration. |
Random | The random number generator object. |
SF | Star Forest object for communication. |
SNES | Nonlinear equations solver. |
Scatter | Scatter object. |
ScatterMode | Scatter mode. |
Section | Mapping from integers in a range to unstructured set of integers. |
Space | Function space object. |
Sys | System utilities. |
TAO | Optimization solver. |
TAOLineSearch | TAO Line Search. |
TS | ODE integrator. |
Vec | A vector object. |
Viewer | Viewer object. |
ViewerHDF5 | Viewer object for HDF5 file formats. |
petsc4py.PETSc.AO¶
- class petsc4py.PETSc.AO
- Bases: Object
Application ordering object.
Enumerations
Type The application ordering types.
petsc4py.PETSc.AO.Type¶
- class petsc4py.PETSc.AO.Type
- Bases: object
The application ordering types.
Attributes Summary
ADVANCED Object ADVANCED of type str BASIC Object BASIC of type str MAPPING Object MAPPING of type str MEMORYSCALABLE Object MEMORYSCALABLE of type str Attributes Documentation
- ADVANCED: str = ADVANCED
- Object ADVANCED of type str
- BASIC: str = BASIC
- Object BASIC of type str
- MAPPING: str = MAPPING
- Object MAPPING of type str
- MEMORYSCALABLE: str = MEMORYSCALABLE
- Object MEMORYSCALABLE of type str
Methods Summary
app2petsc(indices) | Map an application-defined ordering to the PETSc ordering. |
createBasic(app[, petsc, comm]) | Return a basic application ordering using two orderings. |
createMapping(app[, petsc, comm]) | Return an application mapping using two orderings. |
createMemoryScalable(app[, petsc, comm]) | Return a memory scalable application ordering using two orderings. |
destroy() | Destroy the application ordering. |
getType() | Return the application ordering type. |
petsc2app(indices) | Map a PETSc ordering to the application-defined ordering. |
view([viewer]) | Display the application ordering. |
Methods Documentation
- app2petsc(indices)
- Map an application-defined ordering to the PETSc ordering.
Collective.
Any integers in indices that are negative are left unchanged. This allows one to convert, for example, neighbor lists that use negative entries to indicate nonexistent neighbors due to boundary conditions, etc.
Integers that are out of range are mapped to -1.
If IS is used, it cannot be of type stride or block.
- Parameters
- indices (Sequence[int] | IS) -- The indices; to be replaced with their mapped values.
- Return type
- Sequence[int] | IS
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:214
- createBasic(app, petsc=None, comm=None)
- Return a basic application ordering using two orderings.
Collective.
The arrays/indices app and petsc must contain all the integers 0 to len(app)-1 with no duplicates; that is there cannot be any "holes" in the indices. Use createMapping if you wish to have "holes" in the indices.
- app (Sequence[int] | IS) -- The application ordering.
- petsc (Sequence[int] | IS | None) -- Another ordering (may be None to indicate the natural ordering, that is 0, 1, 2, 3, ...).
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:53
- createMapping(app, petsc=None, comm=None)
- Return an application mapping using two orderings.
Collective.
The arrays app and petsc need NOT contain all the integers 0 to len(app)-1, that is there CAN be "holes" in the indices. Use createBasic if they do not have holes for better performance.
- app (Sequence[int] | IS) -- The application ordering.
- petsc (Sequence[int] | IS | None) -- Another ordering. May be None to indicate the identity ordering.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:154
- createMemoryScalable(app, petsc=None, comm=None)
- Return a memory scalable application ordering using two orderings.
Collective.
The arrays/indices app and petsc must contain all the integers 0 to len(app)-1 with no duplicates; that is there cannot be any "holes" in the indices. Use createMapping if you wish to have "holes" in the indices.
Comparing with createBasic, this routine trades memory with message communication.
- app (Sequence[int] | IS) -- The application ordering.
- petsc (Sequence[int] | IS | None) -- Another ordering (may be None to indicate the natural ordering, that is 0, 1, 2, 3, ...).
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:102
- destroy()
- Destroy the application ordering.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:40
- Return type
- Self
- getType()
- Return the application ordering type.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:200
- Return type
- str
- petsc2app(indices)
- Map a PETSc ordering to the application-defined ordering.
Collective.
Any integers in indices that are negative are left unchanged. This allows one to convert, for example, neighbor lists that use negative entries to indicate nonexistent neighbors due to boundary conditions, etc.
Integers that are out of range are mapped to -1.
If IS is used, it cannot be of type stride or block.
- Parameters
- indices (Sequence[int] | IS) -- The indices; to be replaced with their mapped values.
- Return type
- Sequence[int] | IS
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:248
- view(viewer=None)
- Display the application ordering.
Collective.
- Parameters
- viewer (Viewer | None) -- A Viewer to display the ordering.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/AO.pyx:21
petsc4py.PETSc.Comm¶
- class petsc4py.PETSc.Comm
- Bases: object
Communicator object.
Predefined instances:
- COMM_NULL
- The null (or invalid) communicator.
- COMM_SELF
- The self communicator.
- COMM_WORLD
- The world communicator.
SEE ALSO:
Methods Summary
barrier() | Barrier synchronization. |
destroy() | Destroy the communicator. |
duplicate() | Duplicate the communicator. |
getRank() | Return the rank of the calling processes in the communicator. |
getSize() | Return the number of processes in the communicator. |
tompi4py() | Convert communicator to mpi4py. |
Attributes Summary
fortran | Fortran handle. |
rank | Communicator rank. |
size | Communicator size. |
Methods Documentation
- barrier()
- Barrier synchronization.
Collective.
Source code at petsc4py/PETSc/Comm.pyx:123
- Return type
- None
- destroy()
- Destroy the communicator.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/Comm.pyx:61
- Return type
- None
- duplicate()
- Duplicate the communicator.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/Comm.pyx:79
- Return type
- Self
- getRank()
- Return the rank of the calling processes in the communicator.
Not collective.
Source code at petsc4py/PETSc/Comm.pyx:111
- Return type
- int
- getSize()
- Return the number of processes in the communicator.
Not collective.
Source code at petsc4py/PETSc/Comm.pyx:99
- Return type
- int
- tompi4py()
- Convert communicator to mpi4py.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Comm.pyx:155
- Return type
- Intracomm
Attributes Documentation
- fortran
- Fortran handle.
Source code at petsc4py/PETSc/Comm.pyx:147
- rank
- Communicator rank.
Source code at petsc4py/PETSc/Comm.pyx:140
- size
- Communicator size.
Source code at petsc4py/PETSc/Comm.pyx:135
petsc4py.PETSc.DM¶
- class petsc4py.PETSc.DM
- Bases: Object
An object describing a computational grid or mesh.
Enumerations
BoundaryType DM Boundary types. PolytopeType The DM cell types. ReorderDefaultFlag The DM reordering default flags. Type DM types.
petsc4py.PETSc.DM.BoundaryType¶
- class petsc4py.PETSc.DM.BoundaryType
- Bases: object
DM Boundary types.
Attributes Summary
GHOSTED Constant GHOSTED of type int MIRROR Constant MIRROR of type int NONE Constant NONE of type int PERIODIC Constant PERIODIC of type int TWIST Constant TWIST of type int Attributes Documentation
- GHOSTED: int = GHOSTED
- Constant GHOSTED of type int
- MIRROR: int = MIRROR
- Constant MIRROR of type int
- NONE: int = NONE
- Constant NONE of type int
- PERIODIC: int = PERIODIC
- Constant PERIODIC of type int
- TWIST: int = TWIST
- Constant TWIST of type int
petsc4py.PETSc.DM.PolytopeType¶
- class petsc4py.PETSc.DM.PolytopeType
- Bases: object
The DM cell types.
Attributes Summary
FV_GHOST Constant FV_GHOST of type int HEXAHEDRON Constant HEXAHEDRON of type int INTERIOR_GHOST Constant INTERIOR_GHOST of type int POINT Constant POINT of type int POINT_PRISM_TENSOR Constant POINT_PRISM_TENSOR of type int PYRAMID Constant PYRAMID of type int QUADRILATERAL Constant QUADRILATERAL of type int QUAD_PRISM_TENSOR Constant QUAD_PRISM_TENSOR of type int SEGMENT Constant SEGMENT of type int SEG_PRISM_TENSOR Constant SEG_PRISM_TENSOR of type int TETRAHEDRON Constant TETRAHEDRON of type int TRIANGLE Constant TRIANGLE of type int TRI_PRISM Constant TRI_PRISM of type int TRI_PRISM_TENSOR Constant TRI_PRISM_TENSOR of type int UNKNOWN Constant UNKNOWN of type int UNKNOWN_CELL Constant UNKNOWN_CELL of type int UNKNOWN_FACE Constant UNKNOWN_FACE of type int Attributes Documentation
- FV_GHOST: int = FV_GHOST
- Constant FV_GHOST of type int
- HEXAHEDRON: int = HEXAHEDRON
- Constant HEXAHEDRON of type int
- INTERIOR_GHOST: int = INTERIOR_GHOST
- Constant INTERIOR_GHOST of type int
- POINT: int = POINT
- Constant POINT of type int
- POINT_PRISM_TENSOR: int = POINT_PRISM_TENSOR
- Constant POINT_PRISM_TENSOR of type int
- PYRAMID: int = PYRAMID
- Constant PYRAMID of type int
- QUADRILATERAL: int = QUADRILATERAL
- Constant QUADRILATERAL of type int
- QUAD_PRISM_TENSOR: int = QUAD_PRISM_TENSOR
- Constant QUAD_PRISM_TENSOR of type int
- SEGMENT: int = SEGMENT
- Constant SEGMENT of type int
- SEG_PRISM_TENSOR: int = SEG_PRISM_TENSOR
- Constant SEG_PRISM_TENSOR of type int
- TETRAHEDRON: int = TETRAHEDRON
- Constant TETRAHEDRON of type int
- TRIANGLE: int = TRIANGLE
- Constant TRIANGLE of type int
- TRI_PRISM: int = TRI_PRISM
- Constant TRI_PRISM of type int
- TRI_PRISM_TENSOR: int = TRI_PRISM_TENSOR
- Constant TRI_PRISM_TENSOR of type int
- UNKNOWN: int = UNKNOWN
- Constant UNKNOWN of type int
- UNKNOWN_CELL: int = UNKNOWN_CELL
- Constant UNKNOWN_CELL of type int
- UNKNOWN_FACE: int = UNKNOWN_FACE
- Constant UNKNOWN_FACE of type int
petsc4py.PETSc.DM.ReorderDefaultFlag¶
- class petsc4py.PETSc.DM.ReorderDefaultFlag
- Bases: object
The DM reordering default flags.
Attributes Summary
FALSE Constant FALSE of type int NOTSET Constant NOTSET of type int TRUE Constant TRUE of type int Attributes Documentation
- FALSE: int = FALSE
- Constant FALSE of type int
- NOTSET: int = NOTSET
- Constant NOTSET of type int
- TRUE: int = TRUE
- Constant TRUE of type int
petsc4py.PETSc.DM.Type¶
- class petsc4py.PETSc.DM.Type
- Bases: object
DM types.
Attributes Summary
COMPOSITE Object COMPOSITE of type str DA Object DA of type str FOREST Object FOREST of type str MOAB Object MOAB of type str NETWORK Object NETWORK of type str P4EST Object P4EST of type str P8EST Object P8EST of type str PATCH Object PATCH of type str PLEX Object PLEX of type str PRODUCT Object PRODUCT of type str REDUNDANT Object REDUNDANT of type str SHELL Object SHELL of type str SLICED Object SLICED of type str STAG Object STAG of type str SWARM Object SWARM of type str Attributes Documentation
- COMPOSITE: str = COMPOSITE
- Object COMPOSITE of type str
- DA: str = DA
- Object DA of type str
- FOREST: str = FOREST
- Object FOREST of type str
- MOAB: str = MOAB
- Object MOAB of type str
- NETWORK: str = NETWORK
- Object NETWORK of type str
- P4EST: str = P4EST
- Object P4EST of type str
- P8EST: str = P8EST
- Object P8EST of type str
- PATCH: str = PATCH
- Object PATCH of type str
- PLEX: str = PLEX
- Object PLEX of type str
- PRODUCT: str = PRODUCT
- Object PRODUCT of type str
- REDUNDANT: str = REDUNDANT
- Object REDUNDANT of type str
- SHELL: str = SHELL
- Object SHELL of type str
- SLICED: str = SLICED
- Object SLICED of type str
- STAG: str = STAG
- Object STAG of type str
- SWARM: str = SWARM
- Object SWARM of type str
Methods Summary
adaptLabel(label) | Adapt a DM based on a DMLabel. |
adaptMetric(metric[, bdLabel, rgLabel]) | Return a mesh adapted to the specified metric field. |
addCoarsenHook(coarsenhook, restricthook[, ...]) | Add a callback to be executed when restricting to a coarser grid. |
addField(field[, label]) | Add a field to a DM object. |
appendOptionsPrefix(prefix) | Append to the prefix used for searching for options in the database. |
clearDS() | Remove all discrete systems from the DM. |
clearFields() | Remove all fields from the DM. |
clearLabelStratum(name, value) | Remove all points from a stratum. |
clearLabelValue(name, point, value) | Remove a point from a DMLabel with given value. |
clone() | Return the cloned DM . |
coarsen([comm]) | Return a coarsened DM object. |
coarsenHierarchy(nlevels) | Coarsen this DM and return the coarsened DM hierarchy. |
convert(dm_type) | Return a DM converted to another DM. |
copyDS(dm[, minDegree, maxDegree]) | Copy the discrete systems for this DM into another DM. |
copyDisc(dm) | Copy fields and discrete systems of a DM into another DM. |
copyFields(dm[, minDegree, maxDegree]) | Copy the discretizations of this DM into another DM. |
create([comm]) | Return an empty DM. |
createDS() | Create discrete systems. |
createFieldDecomposition() | Return a list of IS objects. |
createGlobalVec() | Return a global vector. |
createInjection(dm) | Return the injection matrix into a finer DM. |
createInterpolation(dm) | Return the interpolation matrix to a finer DM. |
createLabel(name) | Create a label of the given name if it does not already exist. |
createLocalVec() | Return a local vector. |
createMassMatrix(dmf) | Return the mass matrix between this DM and the given DM. |
createMat() | Return an empty matrix. |
createRestriction(dm) | Return the restriction matrix between this DM and the given DM. |
createSectionSF(localsec, globalsec) | Create the SF encoding the parallel DOF overlap for the DM. |
createSubDM(fields) | Return IS and DM encapsulating a subproblem. |
destroy() | Destroy the object. |
getAppCtx() | Return the application context. |
getAuxiliaryVec([label, value, part]) | Return an auxiliary vector for region. |
getBasicAdjacency() | Return the flags for determining variable influence. |
getBlockSize() | Return the inherent block size associated with a DM. |
getBoundingBox() | Return the dimension of embedding space for coordinates values. |
getCellCoordinateDM() | Return the cell coordinate DM. |
getCellCoordinateSection() | Return the cell coordinate layout over the DM. |
getCellCoordinates() | Return a global vector with the cellwise coordinates. |
getCellCoordinatesLocal() | Return a local vector with the cellwise coordinates. |
getCoarseDM() | Return the coarse DM. |
getCoarsenLevel() | Return the number of coarsenings. |
getCoordinateDM() | Return the coordinate DM. |
getCoordinateDim() | Return the dimension of embedding space for coordinates values. |
getCoordinateSection() | Return coordinate values layout over the mesh. |
getCoordinates() | Return a global vector with the coordinates associated. |
getCoordinatesLocal() | Return a local vector with the coordinates associated. |
getCoordinatesLocalized() | Check if the coordinates have been localized for cells. |
getDS() | Return default DS. |
getDimension() | Return the topological dimension of the DM. |
getField(index) | Return the discretization object for a given DM field. |
getFieldAdjacency(field) | Return the flags for determining variable influence. |
getGlobalSection() | Return the Section encoding the global data layout for the DM. |
getGlobalVec([name]) | Return a global vector. |
getLGMap() | Return local mapping to global mapping. |
getLabel(name) | Return the label of a given name. |
getLabelIdIS(name) | Return an IS of all values that the DMLabel takes. |
getLabelName(index) | Return the name of nth label. |
getLabelOutput(name) | Return the output flag for a given label. |
getLabelSize(name) | Return the number of values that the DMLabel takes. |
getLabelValue(name, point) | Return the value in DMLabel for the given point. |
getLocalBoundingBox() | Return the bounding box for the piece of the DM. |
getLocalSection() | Return the Section encoding the local data layout for the DM. |
getLocalVec([name]) | Return a local vector. |
getNumFields() | Return the number of fields in the DM. |
getNumLabels() | Return the number of labels defined by on the DM. |
getOptionsPrefix() | Return the prefix used for searching for options in the database. |
getPointSF() | Return the SF encoding the parallel DOF overlap for the DM. |
getRefineLevel() | Return the refinement level. |
getSectionSF() | Return the Section encoding the parallel DOF overlap. |
getStratumIS(name, value) | Return the points in a label stratum. |
getStratumSize(name, value) | Return the number of points in a label stratum. |
getType() | Return the DM type name. |
globalToLocal(vg, vl[, addv]) | Update local vectors from global vector. |
hasLabel(name) | Determine whether the DM has a label. |
load(viewer) | Return a DM stored in binary. |
localToGlobal(vl, vg[, addv]) | Update global vectors from local vector. |
localToLocal(vl, vlg[, addv]) | Map the values from a local vector to another local vector. |
localizeCoordinates() | Create local coordinates for cells having periodic faces. |
refine([comm]) | Return a refined DM object. |
refineHierarchy(nlevels) | Refine this DM and return the refined DM hierarchy. |
removeLabel(name) | Remove and destroy the label by name. |
restoreGlobalVec(vg[, name]) | Restore a global vector obtained with getGlobalVec. |
restoreLocalVec(vl[, name]) | Restore a local vector obtained with getLocalVec. |
setAppCtx(appctx) | Set the application context. |
setAuxiliaryVec(aux, label[, value, part]) | Set an auxiliary vector for a specific region. |
setBasicAdjacency(useCone, useClosure) | Set the flags for determining variable influence. |
setCellCoordinateDM(dm) | Set the cell coordinate DM. |
setCellCoordinateSection(dim, sec) | Set the cell coordinate layout over the DM. |
setCellCoordinates(c) | Set a global vector with the cellwise coordinates. |
setCellCoordinatesLocal(c) | Set a local vector with the cellwise coordinates. |
setCoarseDM(dm) | Set the coarse DM. |
setCoordinateDim(dim) | Set the dimension of embedding space for coordinates values. |
setCoordinateDisc(disc, project) | Project coordinates to a different space. |
setCoordinates(c) | Set a global vector that holds the coordinates. |
setCoordinatesLocal(c) | Set a local vector with the ghost point holding the coordinates. |
setDimension(dim) | Set the topological dimension of the DM. |
setField(index, field[, label]) | Set the discretization object for a given DM field. |
setFieldAdjacency(field, useCone, useClosure) | Set the flags for determining variable influence. |
setFromOptions() | Configure the object from the options database. |
setGlobalSection(sec) | Set the Section encoding the global data layout for the DM. |
setKSPComputeOperators(operators[, args, kargs]) | Matrix associated with the linear system. |
setLabelOutput(name, output) | Set if a given label should be saved to a view. |
setLabelValue(name, point, value) | Set a point to a DMLabel with a given value. |
setLocalSection(sec) | Set the Section encoding the local data layout for the DM. |
setMatType(mat_type) | Set matrix type to be used by DM.createMat. |
setNumFields(numFields) | Set the number of fields in the DM. |
setOptionsPrefix(prefix) | Set the prefix used for searching for options in the database. |
setPointSF(sf) | Set the SF encoding the parallel DOF overlap for the DM. |
setRefineLevel(level) | Set the number of refinements. |
setSNESFunction(function[, args, kargs]) | Set SNES residual evaluation function. |
setSNESJacobian(jacobian[, args, kargs]) | Set the SNES Jacobian evaluation function. |
setSectionSF(sf) | Set the Section encoding the parallel DOF overlap for the DM. |
setType(dm_type) | Build a DM. |
setUp() | Return the data structure. |
setVecType(vec_type) | Set the type of vector. |
view([viewer]) | View the DM. |
Attributes Summary
appctx | Application context. |
ds | Discrete space. |
Methods Documentation
- adaptLabel(label)
- Adapt a DM based on a DMLabel.
Collective.
- Parameters
- label (str) -- The name of the DMLabel.
- Return type
- DM
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1645
- adaptMetric(metric, bdLabel=None, rgLabel=None)
- Return a mesh adapted to the specified metric field.
Collective.
- metric (Vec) -- The metric to which the mesh is adapted, defined vertex-wise.
- bdLabel (str | None) -- Label for boundary tags.
- rgLabel (str | None) -- Label for cell tag.
- Return type
- DM
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1668
- addCoarsenHook(coarsenhook, restricthook, args=None, kargs=None)
- Add a callback to be executed when restricting to a coarser grid.
Logically collective.
- coarsenhook (DMCoarsenHookFunction) -- The coarsen hook function.
- restricthook (DMRestrictHookFunction) -- The restrict hook function.
- args (tuple[Any, ...] | None) -- Positional arguments for the hooks.
- kargs (dict[str, Any] | None) -- Keyword arguments for the hooks.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2333
- addField(field, label=None)
- Add a field to a DM object.
Logically collective.
- field (Object) -- The discretization object.
- label (str | None) -- The name of the label indicating the support of the field, or None for the entire mesh.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:611
- appendOptionsPrefix(prefix)
- Append to the prefix used for searching for options in the database.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:298
- Parameters
- prefix (str | None)
- Return type
- None
- clearDS()
- Remove all discrete systems from the DM.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:691
- Return type
- None
- clearFields()
- Remove all fields from the DM.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:634
- Return type
- None
- clearLabelStratum(name, value)
- Remove all points from a stratum.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2124
- clearLabelValue(name, point, value)
- Remove a point from a DMLabel with given value.
Not collective.
- name (str) -- The label name.
- point (int) -- The mesh point.
- value (int) -- The label value for the point.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2010
- clone()
- Return the cloned DM .
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:155
- Return type
- DM
- coarsen(comm=None)
- Return a coarsened DM object.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- DM
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1519
- coarsenHierarchy(nlevels)
- Coarsen this DM and return the coarsened DM hierarchy.
Collective.
- Parameters
- nlevels (int) -- The number of levels of coarsening.
- Return type
- list
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1570
- convert(dm_type)
- Return a DM converted to another DM.
Collective.
- Parameters
- dm_type (Type | str) -- The new DM.Type, use “same” for the same type.
- Return type
- DM
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1472
- copyDS(dm, minDegree=None, maxDegree=None)
- Copy the discrete systems for this DM into another DM.
Collective.
- dm (DM) -- The DM that the discrete fields are copied into.
- minDegree -- The minimum polynommial degree for the discretization, or None for no limit
- maxDegree -- The maximum polynommial degree for the discretization, or None for no limit
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:718
- copyDisc(dm)
- Copy fields and discrete systems of a DM into another DM.
Collective.
- Parameters
- dm (DM) -- The DM that the fields and discrete systems are copied into.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:751
- copyFields(dm, minDegree=None, maxDegree=None)
- Copy the discretizations of this DM into another DM.
Collective.
- dm (DM) -- The DM that the fields are copied into.
- minDegree -- The minimum polynommial degree for the discretization, or None for no limit
- maxDegree -- The maximum polynommial degree for the discretization, or None for no limit
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:646
- create(comm=None)
- Return an empty DM.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:134
- createDS()
- Create discrete systems.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:679
- Return type
- None
- createFieldDecomposition()
- Return a list of IS objects.
Not collective.
Notes
The user is responsible for freeing all requested arrays.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2222
- Return type
- tuple[list, list, list]
- createGlobalVec()
- Return a global vector.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:798
- Return type
- Vec
- createInjection(dm)
- Return the injection matrix into a finer DM.
Collective.
- Parameters
- dm (DM) -- The second, finer DM object.
- Return type
- Mat
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1434
- createInterpolation(dm)
- Return the interpolation matrix to a finer DM.
Collective.
- Parameters
- dm (DM) -- The second, finer DM.
- Return type
- tuple[Mat, Vec]
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1413
- createLabel(name)
- Create a label of the given name if it does not already exist.
Not collective.
- Parameters
- name (str) -- The label name.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1922
- createLocalVec()
- Return a local vector.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:812
- Return type
- Vec
- createMassMatrix(dmf)
- Return the mass matrix between this DM and the given DM.
Collective.
- Parameters
- dmf (DM) -- The second DM.
- Return type
- Mat
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1394
- createMat()
- Return an empty matrix.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1380
- Return type
- Mat
- createRestriction(dm)
- Return the restriction matrix between this DM and the given
DM.
Collective.
- Parameters
- dm (DM) -- The second, finer DM object.
- Return type
- Mat
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1453
- createSectionSF(localsec, globalsec)
- Create the SF encoding the parallel DOF overlap for the DM.
Collective.
- localsec (Section) -- Describe the local data layout.
- globalsec (Section) -- Describe the global data layout.
- Return type
- None
Notes
Encoding based on the Section describing the data layout.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1786
- createSubDM(fields)
- Return IS and DM encapsulating a subproblem.
Not collective.
- iset (IS) -- The global indices for all the degrees of freedom.
- subdm (DM) -- The DM for the subproblem.
- Parameters
- fields (Sequence[int])
- Return type
- tuple[IS, DM]
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:446
- destroy()
- Destroy the object.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:121
- Return type
- Self
- getAppCtx()
- Return the application context.
Source code at petsc4py/PETSc/DM.pyx:343
- Return type
- Any
- getAuxiliaryVec(label=None, value=0, part=0)
- Return an auxiliary vector for region.
Not collective.
- label (str | None) -- The name of the DMLabel.
- value (int | None) -- Indicate the region.
- part (int | None) -- The equation part, or 0 is unused.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:503
- getBasicAdjacency()
- Return the flags for determining variable influence.
Not collective.
- useCone (bool) -- Whether adjacency uses cone information.
- useClosure (bool) -- Whether adjacency is computed using full closure information.
- Return type
- tuple[bool, bool]
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:370
- getBlockSize()
- Return the inherent block size associated with a DM.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:770
- Return type
- int
- getBoundingBox()
- Return the dimension of embedding space for coordinates values.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1306
- Return type
- tuple[tuple[float, float], ...]
- getCellCoordinateDM()
- Return the cell coordinate DM.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1159
- Return type
- DM
- getCellCoordinateSection()
- Return the cell coordinate layout over the DM.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1194
- Return type
- Section
- getCellCoordinates()
- Return a global vector with the cellwise coordinates.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1226
- Return type
- Vec
- getCellCoordinatesLocal()
- Return a local vector with the cellwise coordinates.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1258
- Return type
- Vec
- getCoarseDM()
- Return the coarse DM.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1020
- Return type
- DM
- getCoarsenLevel()
- Return the number of coarsenings.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1629
- Return type
- int
- getCoordinateDM()
- Return the coordinate DM.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1048
- Return type
- DM
- getCoordinateDim()
- Return the dimension of embedding space for coordinates values.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:238
- Return type
- int
- getCoordinateSection()
- Return coordinate values layout over the mesh.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1063
- Return type
- Section
- getCoordinates()
- Return a global vector with the coordinates associated.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1095
- Return type
- Vec
- getCoordinatesLocal()
- Return a local vector with the coordinates associated.
Collective the first time it is called.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1127
- Return type
- Vec
- getCoordinatesLocalized()
- Check if the coordinates have been localized for cells.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1292
- Return type
- bool
- getDS()
- Return default DS.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:703
- Return type
- DS
- getDimension()
- Return the topological dimension of the DM.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:206
- Return type
- int
- getField(index)
- Return the discretization object for a given DM field.
Not collective.
- Parameters
- index (int) -- The field number.
- Return type
- tuple[Object, None]
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:586
- getFieldAdjacency(field)
- Return the flags for determining variable influence.
Not collective.
- Parameters
- field (int) -- The field number.
- Returns
- useCone (bool) -- Whether adjacency uses cone information.
- useClosure (bool) -- Whether adjacency is computed using full closure information.
- Return type
- tuple[bool, bool]
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:416
- getGlobalSection()
- Return the Section encoding the global data layout for the
DM.
Collective the first time it is called.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1762
- Return type
- Section
- getGlobalVec(name=None)
- Return a global vector.
Collective.
- Parameters
- name (str | None) -- The optional name to retrieve a persistent vector.
- Return type
- Vec
Notes
When done with the vector, it must be restored using restoreGlobalVec.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:826
- getLGMap()
- Return local mapping to global mapping.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1003
- Return type
- LGMap
- getLabel(name)
- Return the label of a given name.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1704
- Parameters
- name (str)
- Return type
- DMLabel
- getLabelIdIS(name)
- Return an IS of all values that the DMLabel takes.
Not collective.
- Parameters
- name (str) -- The label name.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2055
- getLabelName(index)
- Return the name of nth label.
Not collective.
- Parameters
- index (int) -- The label number.
- Return type
- str
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1881
- getLabelOutput(name)
- Return the output flag for a given label.
Not collective.
- Parameters
- name (str) -- The label name.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2168
- getLabelSize(name)
- Return the number of values that the DMLabel takes.
Not collective.
- Parameters
- name (str) -- The label name.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2034
- getLabelValue(name, point)
- Return the value in DMLabel for the given point.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1963
- getLocalBoundingBox()
- Return the bounding box for the piece of the DM.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1323
- Return type
- tuple[tuple[float, float], ...]
- getLocalSection()
- Return the Section encoding the local data layout for the
DM.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1735
- Return type
- Section
- getLocalVec(name=None)
- Return a local vector.
Not collective.
- Parameters
- name (str | None) -- The optional name to retrieve a persistent vector.
- Return type
- Vec
Notes
When done with the vector, it must be restored using restoreLocalVec.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:880
- getNumFields()
- Return the number of fields in the DM.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:546
- Return type
- int
- getNumLabels()
- Return the number of labels defined by on the DM.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1867
- Return type
- int
- getOptionsPrefix()
- Return the prefix used for searching for options in the database.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:284
- Return type
- str
- getPointSF()
- Return the SF encoding the parallel DOF overlap for the DM.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1840
- Return type
- SF
- getRefineLevel()
- Return the refinement level.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1597
- Return type
- int
- getSectionSF()
- Return the Section encoding the parallel DOF overlap.
Collective the first time it is called.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1809
- Return type
- SF
- getStratumIS(name, value)
- Return the points in a label stratum.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2100
- getStratumSize(name, value)
- Return the number of points in a label stratum.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2076
- getType()
- Return the DM type name.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:192
- Return type
- str
- globalToLocal(vg, vl, addv=None)
- Update local vectors from global vector.
Neighborwise collective.
- vg (Vec) -- The global vector.
- vl (Vec) -- The local vector.
- addv (InsertModeSpec | None) -- Insertion mode.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:934
- hasLabel(name)
- Determine whether the DM has a label.
Not collective.
- Parameters
- name (str) -- The label name.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1901
- load(viewer)
- Return a DM stored in binary.
Collective.
- Parameters
- viewer (Viewer) -- Viewer used to store the DM, like Viewer.Type.BINARY or Viewer.Type.HDF5.
- Return type
- Self
Notes
When using Viewer.Type.HDF5 format, one can save multiple DMPlex meshes in a single HDF5 files. This in turn requires one to name the DMPlex object with Object.setName before saving it with DM.view and before loading it with DM.load for identification of the mesh object.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:95
- localToGlobal(vl, vg, addv=None)
- Update global vectors from local vector.
Neighborwise collective.
- vl (Vec) -- The local vector.
- vg (Vec) -- The global vector.
- addv (InsertModeSpec | None) -- Insertion mode.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:957
- localToLocal(vl, vlg, addv=None)
- Map the values from a local vector to another local vector.
Neighborwise collective.
- vl (Vec) -- The local vector.
- vlg (Vec) -- The global vector.
- addv (InsertModeSpec | None) -- Insertion mode.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:980
- localizeCoordinates()
- Create local coordinates for cells having periodic faces.
Collective.
Notes
Used if the mesh is periodic.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1340
- Return type
- None
- refine(comm=None)
- Return a refined DM object.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- DM
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1495
- refineHierarchy(nlevels)
- Refine this DM and return the refined DM hierarchy.
Collective.
- Parameters
- nlevels (int) -- The number of levels of refinement.
- Return type
- list
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1543
- removeLabel(name)
- Remove and destroy the label by name.
Not collective.
- Parameters
- name (str) -- The label name.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1941
- restoreGlobalVec(vg, name=None)
- Restore a global vector obtained with getGlobalVec.
Logically collective.
- vg (Vec) -- The global vector.
- name (str | None) -- The name used to retrieve the persistent vector, if any.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:855
- restoreLocalVec(vl, name=None)
- Restore a local vector obtained with getLocalVec.
Not collective.
- vl (Vec) -- The local vector.
- name (str | None) -- The name used to retrieve the persistent vector, if any.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:909
- setAppCtx(appctx)
- Set the application context.
Source code at petsc4py/PETSc/DM.pyx:339
- Parameters
- appctx (Any)
- Return type
- None
- setAuxiliaryVec(aux, label, value=0, part=0)
- Set an auxiliary vector for a specific region.
Not collective.
- aux (Vec) -- The auxiliary vector.
- label (DMLabel | None) -- The name of the DMLabel.
- value -- Indicate the region.
- part -- The equation part, or 0 is unused.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:473
- setBasicAdjacency(useCone, useClosure)
- Set the flags for determining variable influence.
Not collective.
- useCone (bool) -- Whether adjacency uses cone information.
- useClosure (bool) -- Whether adjacency is computed using full closure information.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:349
- setCellCoordinateDM(dm)
- Set the cell coordinate DM.
Collective.
- Parameters
- dm (DM) -- The cell coordinate DM.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1142
- setCellCoordinateSection(dim, sec)
- Set the cell coordinate layout over the DM.
Collective.
- dim (int) -- The embedding dimension, or DETERMINE.
- sec (Section) -- The cell coordinate Section.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1174
- setCellCoordinates(c)
- Set a global vector with the cellwise coordinates.
Collective.
- Parameters
- c (Vec) -- The global cell coordinate vector.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1209
- setCellCoordinatesLocal(c)
- Set a local vector with the cellwise coordinates.
Not collective.
- Parameters
- c (Vec) -- The local cell coordinate vector.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1241
- setCoarseDM(dm)
- Set the coarse DM.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1035
- Parameters
- dm (DM)
- Return type
- None
- setCoordinateDim(dim)
- Set the dimension of embedding space for coordinates values.
Not collective.
- Parameters
- dim (int) -- The embedding dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:252
- setCoordinateDisc(disc, project)
- Project coordinates to a different space.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1273
- setCoordinates(c)
- Set a global vector that holds the coordinates.
Collective.
- Parameters
- c (Vec) -- Coordinate Vector.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1078
- setCoordinatesLocal(c)
- Set a local vector with the ghost point holding the coordinates.
Not collective.
- Parameters
- c (Vec) -- Coordinate Vector.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1110
- setDimension(dim)
- Set the topological dimension of the DM.
Collective.
- Parameters
- dim (int) -- Topological dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:220
- setField(index, field, label=None)
- Set the discretization object for a given DM field.
Logically collective.
- index (int) -- The field number.
- field (Object) -- The discretization object.
- label (str | None) -- The name of the label indicating the support of the field, or None for the entire mesh.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:560
- setFieldAdjacency(field, useCone, useClosure)
- Set the flags for determining variable influence.
Not collective.
- field (int) -- The field number.
- useCone (bool) -- Whether adjacency uses cone information.
- useClosure (bool) -- Whether adjacency is computed using full closure information.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:392
- setFromOptions()
- Configure the object from the options database.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:312
- Return type
- None
- setGlobalSection(sec)
- Set the Section encoding the global data layout for the DM.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1750
- Parameters
- sec (Section)
- Return type
- None
- setKSPComputeOperators(operators, args=None, kargs=None)
- Matrix associated with the linear system.
Collective.
- operator -- Callback function to compute the operators.
- args (tuple[Any, ...] | None) -- Positional arguments for the callback.
- kargs (dict[str, Any] | None) -- Keyword arguments for the callback.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2194
- setLabelOutput(name, output)
- Set if a given label should be saved to a view.
Not collective.
- name (str) -- The label name.
- output (bool) -- If True, the label is saved to the viewer.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2146
- setLabelValue(name, point, value)
- Set a point to a DMLabel with a given value.
Not collective.
- name (str) -- The label name.
- point (int) -- The mesh point.
- value (int) -- The label value for the point.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1986
- setLocalSection(sec)
- Set the Section encoding the local data layout for the DM.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1723
- Parameters
- sec (Section)
- Return type
- None
- setMatType(mat_type)
- Set matrix type to be used by DM.createMat.
Logically collective.
- Parameters
- mat_type (Type | str) -- The matrix type.
- Return type
- None
Notes
The option -dm_mat_type is used to set the matrix type.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1357
- setNumFields(numFields)
- Set the number of fields in the DM.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:533
- Parameters
- numFields (int)
- Return type
- None
- setOptionsPrefix(prefix)
- Set the prefix used for searching for options in the database.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:270
- Parameters
- prefix (str | None)
- Return type
- None
- setPointSF(sf)
- Set the SF encoding the parallel DOF overlap for the DM.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1855
- Parameters
- sf (SF)
- Return type
- None
- setRefineLevel(level)
- Set the number of refinements.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1611
- setSNESFunction(function, args=None, kargs=None)
- Set SNES residual evaluation function.
Not collective.
- function (SNESFunction) -- The callback.
- args (tuple[Any, ...] | None) -- Positional arguments for the callback.
- kargs (dict[str, Any] | None) -- Keyword arguments for the callback.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2270
- setSNESJacobian(jacobian, args=None, kargs=None)
- Set the SNES Jacobian evaluation function.
Not collective.
- jacobian (SNESJacobianFunction) -- The Jacobian callback.
- args (tuple[Any, ...] | None) -- Positional arguments for the callback.
- kargs (dict[str, Any] | None) -- Keyword arguments for the callback.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:2302
- setSectionSF(sf)
- Set the Section encoding the parallel DOF overlap for the
DM.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:1824
- Parameters
- sf (SF)
- Return type
- None
- setType(dm_type)
- Build a DM.
Collective.
- Parameters
- dm_type (Type | str) -- The type of DM.
- Return type
- None
Notes
DM types are available in DM.Type class.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:169
- setUp()
- Return the data structure.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:324
- Return type
- Self
- setVecType(vec_type)
- Set the type of vector.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:784
- Parameters
- vec_type (Type | str)
- Return type
- None
- view(viewer=None)
- View the DM.
Collective.
- Parameters
- viewer (Viewer | None) -- The DM viewer.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DM.pyx:76
Attributes Documentation
- appctx
- Application context.
Source code at petsc4py/PETSc/DM.pyx:2386
- ds
- Discrete space.
Source code at petsc4py/PETSc/DM.pyx:2396
petsc4py.PETSc.DMComposite¶
- class petsc4py.PETSc.DMComposite
- Bases: DM
A DM object that is used to manage data for a collection of DMs.
Methods Summary
addDM(dm, *args) Add a DM vector to the composite. create([comm]) Create a composite object. gather(gvec, imode, lvecs) Gather split local vectors into a coupled global vector. getAccess(gvec[, locs]) Get access to the individual vectors from the global vector. getEntries() Return sub-DMs contained in the composite. getGlobalISs() Return the index sets for each composed object in the composite. getLGMaps() Return a local-to-global mapping for each DM in the composite. getLocalISs() Return index sets for each component of a composite local vector. getNumber() Get number of sub-DMs contained in the composite. scatter(gvec, lvecs) Scatter coupled global vector into split local vectors. Methods Documentation
- addDM(dm, *args)
- Add a DM vector to the composite.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:28
- create(comm=None)
- Create a composite object.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:6
- gather(gvec, imode, lvecs)
- Gather split local vectors into a coupled global vector.
Collective.
- gvec (Vec) -- The global vector.
- imode (InsertModeSpec) -- The insertion mode.
- lvecs (Sequence[Vec]) -- The individual sequential vectors.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:115
- getAccess(gvec, locs=None)
- Get access to the individual vectors from the global vector.
Not collective.
Use via The with statement context manager (PEP 343).
- gvec (Vec) -- The global vector.
- locs (Sequence[int] | None) -- Indices of vectors wanted, or None to get all vectors.
- Return type
- Any
Source code at petsc4py/PETSc/DMComposite.pyx:219
- getEntries()
- Return sub-DMs contained in the composite.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:66
- Return type
- list[DM]
- getGlobalISs()
- Return the index sets for each composed object in the composite.
Collective.
These could be used to extract a subset of vector entries for a "multi-physics" preconditioner.
Use getLocalISs for index sets in the packed local numbering, and getLGMaps for to map local sub-DM (including ghost) indices to packed global indices.
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:143
- Return type
- list[IS]
- getLGMaps()
- Return a local-to-global mapping for each DM in the composite.
Collective.
Note that this includes all the ghost points that individual ghosted DMDA may have.
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:196
- Return type
- list[LGMap]
- getLocalISs()
- Return index sets for each component of a composite local vector.
Not collective.
To get the composite global indices at all local points (including ghosts), use getLGMaps.
To get index sets for pieces of the composite global vector, use getGlobalISs.
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:170
- Return type
- list[IS]
- getNumber()
- Get number of sub-DMs contained in the composite.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:51
- Return type
- int
- scatter(gvec, lvecs)
- Scatter coupled global vector into split local vectors.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMComposite.pyx:90
petsc4py.PETSc.DMDA¶
- class petsc4py.PETSc.DMDA
- Bases: DM
A DM object that is used to manage data for a structured grid.
Enumerations
ElementType Element types. InterpolationType Interpolation types. StencilType Stencil types.
petsc4py.PETSc.DMDA.ElementType¶
- class petsc4py.PETSc.DMDA.ElementType
- Bases: object
Element types.
Attributes Summary
P1 Constant P1 of type int Q1 Constant Q1 of type int Attributes Documentation
- P1: int = P1
- Constant P1 of type int
- Q1: int = Q1
- Constant Q1 of type int
petsc4py.PETSc.DMDA.InterpolationType¶
- class petsc4py.PETSc.DMDA.InterpolationType
- Bases: object
Interpolation types.
Attributes Summary
Q0 Constant Q0 of type int Q1 Constant Q1 of type int Attributes Documentation
- Q0: int = Q0
- Constant Q0 of type int
- Q1: int = Q1
- Constant Q1 of type int
petsc4py.PETSc.DMDA.StencilType¶
- class petsc4py.PETSc.DMDA.StencilType
- Bases: object
Stencil types.
Attributes Summary
BOX Constant BOX of type int STAR Constant STAR of type int Attributes Documentation
- BOX: int = BOX
- Constant BOX of type int
- STAR: int = STAR
- Constant STAR of type int
Methods Summary
create([dim, dof, sizes, proc_sizes, ...]) | Create a DMDA object. |
createNaturalVec() | Create a vector that will hold values in the natural numbering. |
duplicate([dof, boundary_type, ...]) | Duplicate a DMDA. |
getAO() | Return the application ordering context for a distributed array. |
getBoundaryType() | Return the type of ghost nodes at boundary in each dimension. |
getCoordinateName(index) | Return the name of a coordinate dimension. |
getCorners() | Return the lower left corner and the sizes of the owned local region. |
getDim() | Return the topological dimension. |
getDof() | Return the number of degrees of freedom per node. |
getElementType() | Return the element type to be returned by getElements. |
getElements([elem_type]) | Return an array containing the indices of all the local elements. |
getFieldName(field) | Return the name of an individual field component. |
getGhostCorners() | Return the lower left corner and the size of the ghosted local region. |
getGhostRanges() | Return the ranges of the local region in each dimension, including ghost nodes. |
getInterpolationType() | Return the type of interpolation. |
getOwnershipRanges() | Return the ranges of indices in each dimension owned by each process. |
getProcSizes() | Return the number of processes in each dimension. |
getRanges() | Return the ranges of the owned local region in each dimension. |
getRefinementFactor() | Return the ratios that the DMDA grid is refined in each dimension. |
getScatter() | Return the global-to-local, and local-to-local scatter contexts. |
getSizes() | Return the number of grid points in each dimension. |
getStencil() | Return the stencil type and width. |
getStencilType() | Return the stencil type. |
getStencilWidth() | Return the stencil width. |
getVecArray(vec[, readonly]) | Get access to the vector as laid out on a N-d grid. |
globalToNatural(vg, vn[, addv]) | Map values to the "natural" grid ordering. |
naturalToGlobal(vn, vg[, addv]) | Map values the to grid ordering. |
setBoundaryType(boundary_type) | Set the type of ghost nodes on domain boundaries. |
setCoordinateName(index, name) | Set the name of the coordinate dimension. |
setDim(dim) | Set the topological dimension. |
setDof(dof) | Set the number of degrees of freedom per vertex. |
setElementType(elem_type) | Set the element type to be returned by getElements. |
setFieldName(field, name) | Set the name of individual field components. |
setInterpolationType(interp_type) | Set the type of interpolation. |
setProcSizes(proc_sizes) | Set the number of processes in each dimension. |
setRefinementFactor([refine_x, refine_y, ...]) | Set the ratios for the DMDA grid refinement. |
setSizes(sizes) | Set the number of grid points in each dimension. |
setStencil(stencil_type, stencil_width) | Set the stencil type and width. |
setStencilType(stencil_type) | Set the stencil type. |
setStencilWidth(stencil_width) | Set the stencil width. |
setUniformCoordinates([xmin, xmax, ymin, ...]) | Set the DMDA coordinates to be a uniform grid. |
Attributes Summary
boundary_type | Boundary types in each dimension. |
corners | The lower left corner and size of local region in each dimension. |
dim | The grid dimension. |
dof | The number of DOFs associated with each stratum of the grid. |
ghost_corners | The lower left corner and size of local region in each dimension. |
ghost_ranges | Ranges of local region, including ghost nodes. |
proc_sizes | The number of processes in each dimension in the global decomposition. |
ranges | Ranges of the local region in each dimension. |
sizes | The global dimension. |
stencil | Stencil type and width. |
stencil_type | Stencil type. |
stencil_width | Elementwise stencil width. |
Methods Documentation
- create(dim=None, dof=None, sizes=None, proc_sizes=None, boundary_type=None, stencil_type=None, stencil_width=None, setup=True, ownership_ranges=None, comm=None)
- Create a DMDA object.
Collective.
This routine performs the following steps of the C API: - petsc.DMDACreate - petsc.DMSetDimension - petsc.DMDASetDof - petsc.DMDASetSizes - petsc.DMDASetNumProcs - petsc.DMDASetOwnershipRanges - petsc.DMDASetBoundaryType - petsc.DMDASetStencilType - petsc.DMDASetStencilWidth - petsc.DMSetUp (optionally)
- dim (int | None) -- The number of dimensions.
- dof (int | None) -- The number of degrees of freedom.
- sizes (DimsSpec | None) -- The number of elements in each dimension.
- proc_sizes (DimsSpec | None) -- The number of processes in x, y, z dimensions.
- boundary_type (tuple[DM.BoundaryType | int | str | bool, ...] | None) -- The boundary types.
- stencil_type (StencilType | None) -- The ghost/halo stencil type.
- stencil_width (int | None) -- The width of the ghost/halo region.
- setup (bool) -- Whether to call the setup routine after creating the object.
- ownership_ranges (tuple[Sequence[int], ...] | None) -- Local x, y, z element counts, of length equal to proc_sizes, summing to sizes.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:32
- createNaturalVec()
- Create a vector that will hold values in the natural numbering.
Collective.
The number of local entries in the vector on each process is the same as in a vector created with DM.createGlobalVec.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:832
- Return type
- Vec
- duplicate(dof=None, boundary_type=None, stencil_type=None, stencil_width=None)
- Duplicate a DMDA.
Collective.
This routine retrieves the information from the DMDA and recreates it. Parameters dof, boundary_type, stencil_type, stencil_width will be overwritten, if provided.
- dof (int | None) -- The number of degrees of freedom.
- boundary_type (tuple[DM.BoundaryType | int | str | bool, ...] | None) -- Boundary types.
- stencil_type (StencilType | None) -- The ghost/halo stencil type.
- stencil_width (int | None) -- The width of the ghost/halo region.
- Return type
- DMDA
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:148
- getAO()
- Return the application ordering context for a distributed array.
Collective.
The returned AO maps to the natural grid ordering that would be used for the DMDA if only 1 processor were employed (ordering most rapidly in the x-dimension, then y, then z). Multiple degrees of freedom are numbered for each node (rather than 1 component for the whole grid, then the next component, etc.).
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:909
- Return type
- AO
- getBoundaryType()
- Return the type of ghost nodes at boundary in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:407
- Return type
- tuple[BoundaryType, ...]
- getCoordinateName(index)
- Return the name of a coordinate dimension.
Not collective.
- Parameters
- index (int) -- The coordinate number for the DMDA (0, 1, ..., dim-1).
- Return type
- str
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:810
- getCorners()
- Return the lower left corner and the sizes of the owned local region.
Not collective.
Returns the global (x,y,z) indices of the lower left corner (first tuple) and size of the local region (second tuple).
Excluding ghost points.
The corner information is independent of the number of degrees of freedom per node. Thus the returned values can be thought of as coordinates on a logical grid, where each grid point has (potentially) several degrees of freedom.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:622
- Return type
- tuple[tuple[int, ...], tuple[int, ...]]
- getDim()
- Return the topological dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:234
- Return type
- int
- getDof()
- Return the number of degrees of freedom per node.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:264
- Return type
- int
- getElementType()
- Return the element type to be returned by getElements.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:1050
- Return type
- ElementType
- getElements(elem_type=None)
- Return an array containing the indices of all the local elements.
Not collective.
The elements are in local coordinates.
Each process uniquely owns a subset of the elements. That is, no element is owned by two or more processes.
- Parameters
- elem_type (ElementType | None) -- The element type.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:1064
- getFieldName(field)
- Return the name of an individual field component.
Not collective.
- Parameters
- field (int) -- The field number for the DMDA (0, 1, ..., dof-1), where dof indicates the number of degrees of freedom per node within the DMDA.
- Return type
- str
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:699
- getGhostCorners()
- Return the lower left corner and the size of the ghosted local region.
Not collective.
Returns the global (x,y,z) indices of the lower left corner (first tuple) and size of the local region (second tuple).
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:651
- Return type
- tuple[tuple[int, ...], tuple[int, ...]]
- getGhostRanges()
- Return the ranges of the local region in each dimension, including ghost
nodes.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:577
- Return type
- tuple[tuple[int, int], ...]
- getInterpolationType()
- Return the type of interpolation.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:1020
- Return type
- InterpolationType
- getOwnershipRanges()
- Return the ranges of indices in each dimension owned by each process.
Not collective.
These numbers are not multiplied by the number of DOFs per node.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:597
- Return type
- tuple[ArrayInt, ...]
- getProcSizes()
- Return the number of processes in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:361
- Return type
- tuple[int, ...]
- getRanges()
- Return the ranges of the owned local region in each dimension.
Not collective.
Excluding ghost nodes.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:555
- Return type
- tuple[tuple[int, int], ...]
- getRefinementFactor()
- Return the ratios that the DMDA grid is refined in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:981
- Return type
- tuple[int, ...]
- getScatter()
- Return the global-to-local, and local-to-local scatter contexts.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:930
- Return type
- tuple[Scatter, Scatter]
- getSizes()
- Return the number of grid points in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:311
- Return type
- tuple[int, ...]
- getStencil()
- Return the stencil type and width.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:532
- Return type
- tuple[StencilType, int]
- getStencilType()
- Return the stencil type.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:448
- Return type
- StencilType
- getStencilWidth()
- Return the stencil width.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:486
- Return type
- int
- getVecArray(vec, readonly=False)
- Get access to the vector as laid out on a N-d grid.
Logically collective.
- vec (Vec) -- The vector to which access is being requested.
- readonly (bool) -- Request read-only access.
- Return type
- Any
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:723
- globalToNatural(vg, vn, addv=None)
- Map values to the "natural" grid ordering.
Neighborwise collective.
You must call createNaturalVec before using this routine.
- vg (Vec) -- The global vector in a grid ordering.
- vn (Vec) -- The global vector in a "natural" ordering.
- addv (InsertMode | None) -- The insertion mode.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:849
- naturalToGlobal(vn, vg, addv=None)
- Map values the to grid ordering.
Neighborwise collective.
- vn (Vec) -- The global vector in a natural ordering.
- vg (Vec) -- the global vector in a grid ordering.
- addv (InsertMode | None) -- The insertion mode.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:879
- setBoundaryType(boundary_type)
- Set the type of ghost nodes on domain boundaries.
Not collective.
- Parameters
- boundary_type (tuple[BoundaryType | int | str | bool, ...]) -- The boundary type in (x), (x, y), or (x, y, z) dimensions.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:384
- setCoordinateName(index, name)
- Set the name of the coordinate dimension.
Logically collective.
- index (int) -- The coordinate number for the DMDA (0, 1, ..., dim-1).
- name (str) -- The name of the coordinate.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:788
- setDim(dim)
- Set the topological dimension.
Collective.
- Parameters
- dim (int) -- Topological dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:217
- setDof(dof)
- Set the number of degrees of freedom per vertex.
Not collective.
- Parameters
- dof (int) -- The number of degrees of freedom.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:246
- setElementType(elem_type)
- Set the element type to be returned by getElements.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:1036
- Parameters
- elem_type (ElementType | str)
- Return type
- None
- setFieldName(field, name)
- Set the name of individual field components.
Logically collective.
- field (int) -- The field number for the DMDA (0, 1, ..., dof-1), where dof indicates the number of degrees of freedom per node within the DMDA.
- name (str) -- The name of the field (component).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:675
- setInterpolationType(interp_type)
- Set the type of interpolation.
Logically collective.
You should call this on the coarser of the two DMDAs you pass to DM.createInterpolation.
- Parameters
- interp_type (InterpolationType) -- The interpolation type.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:999
- setProcSizes(proc_sizes)
- Set the number of processes in each dimension.
Logically collective.
- Parameters
- proc_sizes (DimsSpec) -- The number of processes in (x,), (x, y), or (x, y, z) dimensions.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:334
- setRefinementFactor(refine_x=2, refine_y=2, refine_z=2)
- Set the ratios for the DMDA grid refinement.
Logically collective.
- refine_x (int) -- Ratio of fine grid to coarse in x dimension.
- refine_y (int) -- Ratio of fine grid to coarse in y dimension.
- refine_z (int) -- Ratio of fine grid to coarse in z dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:949
- setSizes(sizes)
- Set the number of grid points in each dimension.
Logically collective.
- Parameters
- sizes (DimsSpec) -- The global (x,), (x, y), or (x, y, z) size.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:284
- setStencil(stencil_type, stencil_width)
- Set the stencil type and width.
Not collective.
- stencil_type (StencilType) -- The stencil type.
- stencil_width (int) -- The stencil width.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:506
- setStencilType(stencil_type)
- Set the stencil type.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:430
- setStencilWidth(stencil_width)
- Set the stencil width.
Logically collective.
- Parameters
- stencil_width (int) -- The stencil width.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:468
- setUniformCoordinates(xmin=0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1)
- Set the DMDA coordinates to be a uniform grid.
Collective.
- xmin (float) -- The minimum in the x dimension.
- xmax (float) -- The maximum in the x dimension.
- ymin (float) -- The minimum in the y dimension (value ignored for 1 dimensional problems).
- ymax (float) -- The maximum in the y dimension (value ignored for 1 dimensional problems).
- zmin (float) -- The minimum in the z dimension (value ignored for 1 or 2 dimensional problems).
- zmax (float) -- The maximum in the z dimension (value ignored for 1 or 2 dimensional problems).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMDA.pyx:744
Attributes Documentation
- boundary_type
- Boundary types in each dimension.
Source code at petsc4py/PETSc/DMDA.pyx:1123
- corners
- The lower left corner and size of local region in each dimension.
Source code at petsc4py/PETSc/DMDA.pyx:1153
- dim
- The grid dimension.
Source code at petsc4py/PETSc/DMDA.pyx:1103
- dof
- The number of DOFs associated with each stratum of the grid.
Source code at petsc4py/PETSc/DMDA.pyx:1108
- ghost_corners
- The lower left corner and size of local region in each dimension.
Source code at petsc4py/PETSc/DMDA.pyx:1158
- ghost_ranges
- Ranges of local region, including ghost nodes.
Source code at petsc4py/PETSc/DMDA.pyx:1148
- proc_sizes
- The number of processes in each dimension in the global decomposition.
Source code at petsc4py/PETSc/DMDA.pyx:1118
- ranges
- Ranges of the local region in each dimension.
Source code at petsc4py/PETSc/DMDA.pyx:1143
- sizes
- The global dimension.
Source code at petsc4py/PETSc/DMDA.pyx:1113
- stencil
- Stencil type and width.
Source code at petsc4py/PETSc/DMDA.pyx:1128
- stencil_type
- Stencil type.
Source code at petsc4py/PETSc/DMDA.pyx:1133
- stencil_width
- Elementwise stencil width.
Source code at petsc4py/PETSc/DMDA.pyx:1138
petsc4py.PETSc.DMInterpolation¶
- class petsc4py.PETSc.DMInterpolation
- Bases: object
Interpolation on a mesh.
Methods Summary
create([comm]) Create a DMInterpolation context. destroy() Destroy the DMInterpolation context. evaluate(dm, x[, v]) Calculate interpolated field values at the interpolation points. getCoordinates() Return the coordinates of each interpolation point. getDim() Return the spatial dimension of the interpolation context. getDof() Return the number of fields interpolated at a point. getVector() Return a Vec which can hold all the interpolated field values. restoreVector(vec) Restore a Vec which can hold all the interpolated field values. setDim(dim) Set the spatial dimension for the interpolation context. setDof(dof) Set the number of fields interpolated at a point. setUp(dm[, redundantPoints, ignoreOutsideDomain]) Compute spatial indices for point location during interpolation. Methods Documentation
- create(comm=None)
- Create a DMInterpolation context.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to COMM_SELF.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:13
- destroy()
- Destroy the DMInterpolation context.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:35
- Return type
- Self
- evaluate(dm, x, v=None)
- Calculate interpolated field values at the interpolation points.
Collective.
- dm (DM) -- The DM.
- x (Vec) -- The local vector containing the field to be interpolated.
- v (Vec | None) -- A vector capable of holding the interpolated field values.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:48
- getCoordinates()
- Return the coordinates of each interpolation point.
Collective.
The local vector entries correspond to interpolation points lying on this process, according to the associated DM.
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:74
- Return type
- Vec
- getDim()
- Return the spatial dimension of the interpolation context.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:92
- Return type
- int
- getDof()
- Return the number of fields interpolated at a point.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:106
- Return type
- int
- getVector()
- Return a Vec which can hold all the interpolated field values.
Collective.
This vector should be returned using restoreVector.
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:185
- Return type
- Vec
- restoreVector(vec)
- Restore a Vec which can hold all the interpolated field values.
Collective.
- Parameters
- vec (Vec) -- A vector capable of holding the interpolated field values.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:201
- setDim(dim)
- Set the spatial dimension for the interpolation context.
Not collective.
- Parameters
- dim (int) -- The spatial dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:120
- setDof(dof)
- Set the number of fields interpolated at a point.
Not collective.
- Parameters
- dof (int) -- The number of fields.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:138
- setUp(dm, redundantPoints=False, ignoreOutsideDomain=False)
- Compute spatial indices for point location during interpolation.
Collective.
- dm (DM) -- The DM for the function space used for interpolation.
- redundantPoints (bool) -- If True, all processes are passing in the same array of points. Otherwise, points need to be communicated among processes.
- ignoreOutsideDomain (bool) -- Ignore points outside of the domain if True; otherwise, return an error.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMUtils.pyx:156
petsc4py.PETSc.DMLabel¶
- class petsc4py.PETSc.DMLabel
- Bases: Object
An object representing a subset of mesh entities from a DM.
Methods Summary
addStrata(strata) Add new stratum values in a DMLabel. addStrataIS(iset) Add new stratum values in a DMLabel. addStratum(value) Add a new stratum value in a DMLabel. clearStratum(stratum) Remove a stratum. clearValue(point, value) Clear the value a label assigns to a point. computeIndex() Create an index structure for membership determination. convertToSection() Return a Section and IS that encode the label. create(name[, comm]) Create a DMLabel object, which is a multimap. createIndex(pStart, pEnd) Create an index structure for membership determination. destroy() Destroy the label. destroyIndex() Destroy the index structure. distribute(sf) Create a new label pushed forward over the SF. duplicate() Duplicate the DMLabel. filter(start, end) Remove all points outside of [start, end). gather(sf) Gather all label values from leaves into roots. getBounds() Return the smallest and largest point in the label. getDefaultValue() Return the default value returned by getValue. getNonEmptyStratumValuesIS() Return an IS of all values that the DMLabel takes. getNumValues() Return the number of values that the DMLabel takes. getStratumIS(stratum) Return an IS with the stratum points. getStratumSize(stratum) Return the size of a stratum. getValue(point) Return the value a label assigns to a point. getValueIS() Return an IS of all values that the DMLabel takes. hasPoint(point) Determine whether the label contains a point. hasStratum(value) Determine whether points exist with the given value. hasValue(value) Determine whether a label assigns the value to any point. insertIS(iset, value) Set all points in the IS to a value. permute(permutation) Create a new label with permuted points. reset() Destroy internal data structures in the DMLabel. setDefaultValue(value) Set the default value returned by getValue. setStratumIS(stratum, iset) Set the stratum points using an IS. setValue(point, value) Set the value a label assigns to a point. stratumHasPoint(value, point) Return whether the stratum contains a point. view([viewer]) View the label. Methods Documentation
- addStrata(strata)
- Add new stratum values in a DMLabel.
Not collective.
- Parameters
- strata (Sequence[int]) -- The stratum values.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:238
- addStrataIS(iset)
- Add new stratum values in a DMLabel.
Not collective.
- Parameters
- iset (IS) -- Index set with stratum values.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:258
- addStratum(value)
- Add a new stratum value in a DMLabel.
Not collective.
- Parameters
- value (int) -- The stratum value.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:220
- clearStratum(stratum)
- Remove a stratum.
Not collective.
- Parameters
- stratum (int) -- The stratum value.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:406
- clearValue(point, value)
- Clear the value a label assigns to a point.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:199
- computeIndex()
- Create an index structure for membership determination.
Not collective.
Automatically determines the bounds.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:424
- Return type
- None
- convertToSection()
- Return a Section and IS that encode the label.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:607
- Return type
- tuple[Section, IS]
- create(name, comm=None)
- Create a DMLabel object, which is a multimap.
Collective.
- name (str) -- The label name.
- comm (Comm | None) -- MPI communicator, defaults to COMM_SELF.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:40
- createIndex(pStart, pEnd)
- Create an index structure for membership determination.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:438
- destroy()
- Destroy the label.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:8
- Return type
- Self
- destroyIndex()
- Destroy the index structure.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:458
- Return type
- None
- distribute(sf)
- Create a new label pushed forward over the SF.
Collective.
- Parameters
- sf (SF) -- The map from old to new distribution.
- Return type
- DMLabel
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:567
- duplicate()
- Duplicate the DMLabel.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:65
- Return type
- DMLabel
- filter(start, end)
- Remove all points outside of [start, end).
Not collective.
- start (int) -- The first point kept.
- end (int) -- One more than the last point kept.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:528
- gather(sf)
- Gather all label values from leaves into roots.
Collective.
This is the inverse operation to distribute.
- Parameters
- sf (SF) -- The SF communication map.
- Return type
- DMLabel
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:586
- getBounds()
- Return the smallest and largest point in the label.
Not collective.
The returned values are the smallest point and the largest point + 1.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:512
- Return type
- tuple[int, int]
- getDefaultValue()
- Return the default value returned by getValue.
Not collective.
The default value is returned if a point has not been explicitly given a value. When a label is created, it is initialized to -1.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:161
- Return type
- int
- getNonEmptyStratumValuesIS()
- Return an IS of all values that the DMLabel takes.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:622
- Return type
- IS
- getNumValues()
- Return the number of values that the DMLabel takes.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:275
- Return type
- int
- getStratumIS(stratum)
- Return an IS with the stratum points.
Not collective.
- Parameters
- stratum (int) -- The stratum value.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:366
- getStratumSize(stratum)
- Return the size of a stratum.
Not collective.
- Parameters
- stratum (int) -- The stratum value.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:346
- getValue(point)
- Return the value a label assigns to a point.
Not collective.
If no value was assigned, a default value will be returned The default value, initially -1, can be changed with setDefaultValue.
- Parameters
- point (int) -- The point.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:137
- getValueIS()
- Return an IS of all values that the DMLabel takes.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:289
- Return type
- IS
- hasPoint(point)
- Determine whether the label contains a point.
Not collective.
The user must call createIndex before this function.
- Parameters
- point (int) -- The point.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:490
- hasStratum(value)
- Determine whether points exist with the given value.
Not collective.
- Parameters
- value (int) -- The stratum value.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:326
- hasValue(value)
- Determine whether a label assigns the value to any point.
Not collective.
- Parameters
- value (int) -- The value.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:470
- insertIS(iset, value)
- Set all points in the IS to a value.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:91
- permute(permutation)
- Create a new label with permuted points.
Not collective.
- Parameters
- permutation (IS) -- The point permutation.
- Return type
- DMLabel
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:548
- reset()
- Destroy internal data structures in the DMLabel.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:79
- Return type
- None
- setDefaultValue(value)
- Set the default value returned by getValue.
Not collective.
The value is used if a point has not been explicitly given a value. When a label is created, the default value is initialized to -1.
- Parameters
- value (int) -- The default value.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:178
- setStratumIS(stratum, iset)
- Set the stratum points using an IS.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:386
- setValue(point, value)
- Set the value a label assigns to a point.
Not collective.
If the value is the same as the label's default value (which is initially -1, and can be changed with setDefaultValue), this function will do nothing.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:112
- stratumHasPoint(value, point)
- Return whether the stratum contains a point.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:303
- view(viewer=None)
- View the label.
Collective.
- Parameters
- viewer (Viewer | None) -- A Viewer to display the graph.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMLabel.pyx:21
petsc4py.PETSc.DMPlex¶
- class petsc4py.PETSc.DMPlex
- Bases: DM
Encapsulate an unstructured mesh.
DMPlex encapsulates both topology and geometry. It is capable of parallel refinement and coarsening (using Pragmatic or ParMmg) and parallel redistribution for load balancing.
Methods Summary
computeCellGeometryFVM(cell) Compute the volume for a given cell. computeGradientClementInterpolant(locX, locC) Return the L2 projection of the cellwise gradient of a function onto P1. constructGhostCells([labelName]) Construct ghost cells which connect to every boundary face. coordinatesLoad(viewer, sfxc) Load coordinates into this DMPlex object. coordinatesView(viewer) Save DMPlex coordinates into a file. create([comm]) Create a DMPlex object, which encapsulates an unstructured mesh. createBoxMesh(faces[, lower, upper, ...]) Create a mesh on the tensor product of intervals. createBoxSurfaceMesh(faces[, lower, upper, ...]) Create a mesh on the surface of a box mesh using tensor cells. createCGNS(cgid[, interpolate, comm]) Create a DMPlex mesh from a CGNS file. createCGNSFromFile(filename[, interpolate, comm]) "Create a DMPlex mesh from a CGNS file. createClosureIndex(sec) Calculate an index for sec for the closure operation. createCoarsePointIS() Create an IS covering the coarse DMPlex chart with the fine points as data. createCohesiveSubmesh(hasLagrange, value) Extract the hypersurface defined by one face of the cohesive cells. createExodus(exoid[, interpolate, comm]) Create a DMPlex mesh from an ExodusII file ID. createExodusFromFile(filename[, ...]) Create a DMPlex mesh from an ExodusII file. createFromCellList(dim, cells, coords[, ...]) Create a DMPlex from a list of vertices for each cell on process 0. createFromFile(filename[, plexname, ...]) Create DMPlex from a file. createGmsh(viewer[, interpolate, comm]) Create a DMPlex mesh from a Gmsh file viewer. createPointNumbering() Create a global numbering for all points. createSection(numComp, numDof[, bcField, ...]) Create a Section based upon the DOF layout specification provided. distribute([overlap]) Distribute the mesh and any associated sections. distributeField(sf, sec, vec[, newsec, newvec]) Distribute field data with a with a given SF. distributeGetDefault() Return a flag indicating whether the DM should be distributed by default. distributeOverlap([overlap]) Add partition overlap to a distributed non-overlapping DMPlex. distributeSetDefault(flag) Set flag indicating whether the DMPlex should be distributed by default. distributionGetName() Retrieve the name of the specific parallel distribution. distributionSetName(name) Set the name of the specific parallel distribution. generate(boundary[, name, interpolate]) Generate a mesh. getAdjacency(p) Return all points adjacent to the given point. getAdjacencyUseAnchors() Query whether adjacency in the mesh uses the point-to-point constraints. getCellNumbering() Return a global cell numbering for all cells on this process. getCellType(p) Return the polytope type of a given cell. getCellTypeLabel() Return the DMLabel recording the polytope type of each cell. getChart() Return the interval for all mesh points [pStart, pEnd). getCone(p) Return the points on the in-edges for this point in the DAG. getConeOrientation(p) Return the orientations on the in-edges for this point in the DAG. getConeSize(p) Return the number of in-edges for this point in the DAG. getDepth() Return the depth of the DAG representing this mesh. getDepthStratum(svalue) Return the bounds [start, end) for all points at a certain depth. getFullJoin(points) Return an array for the join of the set of points. getHeightStratum(svalue) Return the bounds [start, end) for all points at a certain height. getJoin(points) Return an array for the join of the set of points. getMaxSizes() Return the maximum number of in-edges and out-edges of the DAG. getMeet(points) Return an array for the meet of the set of points. getMinRadius() Return the minimum distance from any cell centroid to a face. getOrdering(otype) Calculate a reordering of the mesh. getPartitioner() Return the mesh partitioner. getPointDepth(point) Return the depth of a given point. getPointGlobal(point) Return location of point data in global Vec. getPointGlobalField(point, field) Return location of point field data in global Vec. getPointHeight(point) Return the height of a given point. getPointLocal(point) Return location of point data in local Vec. getPointLocalField(point, field) Return location of point field data in local Vec. getRefinementLimit() Retrieve the maximum cell volume for refinement. getRefinementUniform() Retrieve the flag for uniform refinement. getSubpointIS() Return an IS covering the entire subdm chart. getSubpointMap() Return a DMLabel with point dimension as values. getSupport(p) Return the points on the out-edges for this point in the DAG. getSupportSize(p) Return the number of out-edges for this point in the DAG. getTransitiveClosure(p[, useCone]) Return the points and orientations on the transitive closure of this point. getVecClosure(sec, vec, point) Return an array of the values on the closure of a point. getVertexNumbering() Return a global vertex numbering for all vertices on this process. globalVectorLoad(viewer, sectiondm, sf, vec) Load on-disk vector data into a global vector. globalVectorView(viewer, sectiondm, vec) Save a global vector. insertCone(p, conePos, conePoint) DMPlexInsertCone - Insert a point into the in-edges for the point p in the DAG. insertConeOrientation(p, conePos, ...) Insert a point orientation for the in-edge for the point p in the DAG. interpolate() Convert to a mesh with all intermediate faces, edges, etc. isDistributed() Return the flag indicating if the mesh is distributed. isSimplex() Return the flag indicating if the first cell is a simplex. labelCohesiveComplete(label, bdlabel, ...) Add all other mesh pieces to complete the surface. labelComplete(label) Add the transitive closure to the surface. labelsLoad(viewer, sfxc) Load labels into this DMPlex object. labelsView(viewer) Save DMPlex labels into a file. localVectorLoad(viewer, sectiondm, sf, vec) Load on-disk vector data into a local vector. localVectorView(viewer, sectiondm, vec) Save a local vector. markBoundaryFaces(label[, value]) Mark all faces on the boundary. metricAverage2(metric1, metric2, metricAvg) Compute and return the unweighted average of two metrics. metricAverage3(metric1, metric2, metric3, ...) Compute and return the unweighted average of three metrics. metricCreate([field]) Create a Riemannian metric field. metricCreateIsotropic(indicator[, field]) Construct an isotropic metric from an error indicator. metricCreateUniform(alpha[, field]) Construct a uniform isotropic metric. metricDeterminantCreate([field]) Create the determinant field for a Riemannian metric. metricEnforceSPD(metric, ometric, determinant) Enforce symmetric positive-definiteness of a metric. metricGetGradationFactor() Return the metric gradation factor. metricGetHausdorffNumber() Return the metric Hausdorff number. metricGetMaximumAnisotropy() Return the maximum tolerated metric anisotropy. metricGetMaximumMagnitude() Return the maximum tolerated metric magnitude. metricGetMinimumMagnitude() Return the minimum tolerated metric magnitude. metricGetNormalizationOrder() Return the order p for L-p normalization. metricGetNumIterations() Return the number of parallel adaptation iterations. metricGetTargetComplexity() Return the target metric complexity. metricGetVerbosity() Return the verbosity of the mesh adaptation package. metricIntersection2(metric1, metric2, metricInt) Compute and return the intersection of two metrics. metricIntersection3(metric1, metric2, ...) Compute the intersection of three metrics. metricIsIsotropic() Return the flag indicating whether the metric is isotropic or not. metricIsUniform() Return the flag indicating whether the metric is uniform or not. metricNoInsertion() Return the flag indicating whether node insertion and deletion are turned off. metricNoMovement() Return the flag indicating whether node movement is turned off. metricNoSurf() Return the flag indicating whether surface modification is turned off. metricNoSwapping() Return the flag indicating whether facet swapping is turned off. metricNormalize(metric, ometric, determinant) Apply L-p normalization to a metric. metricRestrictAnisotropyFirst() Return true if anisotropy is restricted before normalization. metricSetFromOptions() Configure the object from the options database. metricSetGradationFactor(beta) Set the metric gradation factor. metricSetHausdorffNumber(hausd) Set the metric Hausdorff number. metricSetIsotropic(isotropic) Record whether the metric is isotropic or not. metricSetMaximumAnisotropy(a_max) Set the maximum tolerated metric anisotropy. metricSetMaximumMagnitude(h_max) Set the maximum tolerated metric magnitude. metricSetMinimumMagnitude(h_min) Set the minimum tolerated metric magnitude. metricSetNoInsertion(noInsert) Set the flag indicating whether node insertion should be turned off. metricSetNoMovement(noMove) Set the flag indicating whether node movement should be turned off. metricSetNoSurf(noSurf) Set the flag indicating whether surface modification should be turned off. metricSetNoSwapping(noSwap) Set the flag indicating whether facet swapping should be turned off. metricSetNormalizationOrder(p) Set the order p for L-p normalization. metricSetNumIterations(numIter) Set the number of parallel adaptation iterations. metricSetRestrictAnisotropyFirst(...) Record whether anisotropy is be restricted before normalization or after. metricSetTargetComplexity(targetComplexity) Set the target metric complexity. metricSetUniform(uniform) Record whether the metric is uniform or not. metricSetVerbosity(verbosity) Set the verbosity of the mesh adaptation package. orient() Give a consistent orientation to the input mesh. permute(perm) Reorder the mesh according to the input permutation. rebalanceSharedPoints([entityDepth, ...]) Redistribute shared points in order to achieve better balancing. reorderGetDefault() Return flag indicating whether the DMPlex should be reordered by default. reorderSetDefault(flag) Set flag indicating whether the DM should be reordered by default. sectionLoad(viewer, sectiondm, sfxc) Load section into a DM. sectionView(viewer, sectiondm) Save a section associated with a DMPlex. setAdjacencyUseAnchors([useAnchors]) Define adjacency in the mesh using the point-to-point constraints. setCellType(p, ctype) Set the polytope type of a given cell. setChart(pStart, pEnd) Set the interval for all mesh points [pStart, pEnd). setCone(p, cone[, orientation]) Set the points on the in-edges for this point in the DAG. setConeOrientation(p, orientation) Set the orientations on the in-edges for this point in the DAG. setConeSize(p, size) Set the number of in-edges for this point in the DAG. setMatClosure(sec, gsec, mat, point, values) Set an array of the values on the closure of point. setPartitioner(part) Set the mesh partitioner. setRefinementLimit(refinementLimit) Set the maximum cell volume for refinement. setRefinementUniform([refinementUniform]) Set the flag for uniform refinement. setSupport(p, supp) Set the points on the out-edges for this point in the DAG. setSupportSize(p, size) Set the number of out-edges for this point in the DAG. setTetGenOptions(opts) Set the options used for the Tetgen mesh generator. setTriangleOptions(opts) Set the options used for the Triangle mesh generator. setVecClosure(sec, vec, point, values[, addv]) Set an array of the values on the closure of point. stratify() Calculate the strata of DAG. symmetrize() Create support (out-edge) information from cone (in-edge) information. topologyLoad(viewer) Load a topology into this DMPlex object. topologyView(viewer) Save a DMPlex topology into a file. uninterpolate() Convert to a mesh with only cells and vertices. vecGetClosure(sec, vec, p) Return an array of values on the closure of p. Methods Documentation
- computeCellGeometryFVM(cell)
- Compute the volume for a given cell.
Not collective.
- Parameters
- cell (int) -- The cell.
- Returns
- volume (float) -- The cell volume.
- centroid (ArrayReal) -- The cell centroid.
- normal (ArrayReal) -- The cell normal, if appropriate.
- Return type
- tuple[float, ArrayReal, ArrayReal]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2217
- computeGradientClementInterpolant(locX, locC)
- Return the L2 projection of the cellwise gradient of a function onto P1.
Collective.
- locX (Vec) -- The coefficient vector of the function.
- locC (Vec) -- The output Vec which holds the Clement interpolant of the gradient.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3151
- constructGhostCells(labelName=None)
- Construct ghost cells which connect to every boundary face.
Collective.
- Parameters
- labelName (str | None) -- The name of the label specifying the boundary faces. Defaults to "Face Sets".
- Returns
- numGhostCells -- The number of ghost cells added to the DMPlex.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2249
- coordinatesLoad(viewer, sfxc)
- Load coordinates into this DMPlex object.
Collective.
- viewer (Viewer) -- The Viewer for the saved coordinates.
- sfxc (SF) -- The SF returned by topologyLoad.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3324
- coordinatesView(viewer)
- Save DMPlex coordinates into a file.
Collective.
- Parameters
- viewer (Viewer) -- The Viewer for saving.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3191
- create(comm=None)
- Create a DMPlex object, which encapsulates an unstructured mesh.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:14
- createBoxMesh(faces, lower=(0, 0, 0), upper=(1, 1, 1), simplex=True, periodic=False, interpolate=True, localizationHeight=0, sparseLocalize=True, comm=None)
- Create a mesh on the tensor product of intervals.
Collective.
- faces (Sequence[int]) -- Number of faces per dimension, or None for the default.
- lower (Sequence[float] | None) -- The lower left corner.
- upper (Sequence[float] | None) -- The upper right corner.
- simplex (bool | None) -- True for simplices, False for tensor cells.
- periodic (Sequence | str | int | bool | None) -- The boundary type for the X, Y, Z direction, or None for DM.BoundaryType.NONE.
- interpolate (bool | None) -- Flag to create intermediate mesh entities (edges, faces).
- localizationHeight (int | None) -- Flag to localize edges and faces in addition to cells; only significant for periodic meshes.
- sparseLocalize (bool | None) -- Flag to localize coordinates only for cells near the periodic boundary; only significant for periodic meshes.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:90
- createBoxSurfaceMesh(faces, lower=(0, 0, 0), upper=(1, 1, 1), interpolate=True, comm=None)
- Create a mesh on the surface of a box mesh using tensor cells.
Collective.
- faces (Sequence[int]) -- Number of faces per dimension, or None for the default.
- lower (Sequence[float] | None) -- The lower left corner.
- upper (Sequence[float] | None) -- The upper right corner.
- interpolate (bool | None) -- Flag to create intermediate mesh pieces (edges, faces).
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:149
- createCGNS(cgid, interpolate=True, comm=None)
- Create a DMPlex mesh from a CGNS file.
Collective.
- cgid (int) -- The CG id associated with a file and obtained using cg_open.
- interpolate (bool | None) -- Create faces and edges in the mesh.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:226
- createCGNSFromFile(filename, interpolate=True, comm=None)
- "Create a DMPlex mesh from a CGNS file.
Collective.
- filename (str) -- The name of the CGNS file.
- interpolate (bool | None) -- Create faces and edges in the mesh.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:254
- createClosureIndex(sec)
- Calculate an index for sec for the closure operation.
Not collective.
- Parameters
- sec (Section) -- The Section describing the layout in the local vector, or None to use the default section.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2031
- createCoarsePointIS()
- Create an IS covering the coarse DMPlex chart with the fine
points as data.
Collective.
- Returns
- fpointIS -- The IS of all the fine points which exist in the original coarse mesh.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1817
- createCohesiveSubmesh(hasLagrange, value)
- Extract the hypersurface defined by one face of the cohesive cells.
Collective.
- hasLagrange (bool) -- Flag indicating whether the mesh has Lagrange dofs in the cohesive cells.
- value (int) -- A label value.
- Return type
- DMPlex
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:377
- createExodus(exoid, interpolate=True, comm=None)
- Create a DMPlex mesh from an ExodusII file ID.
Collective.
- exoid (int) -- The ExodusII id associated with a file obtained using ex_open.
- interpolate (bool | None) -- Create faces and edges in the mesh,
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:312
- createExodusFromFile(filename, interpolate=True, comm=None)
- Create a DMPlex mesh from an ExodusII file.
Collective.
- filename (str) -- The name of the ExodusII file.
- interpolate (bool | None) -- Create faces and edges in the mesh.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:283
- createFromCellList(dim, cells, coords, interpolate=True, comm=None)
- Create a DMPlex from a list of vertices for each cell on process 0.
Collective.
- dim (int) -- The topological dimension of the mesh.
- cells (Sequence[int]) -- An array of number of cells times number of vertices on each cell.
- coords (Sequence[float]) -- An array of number of vertices times spatial dimension for coordinates.
- interpolate (bool | None) -- Flag to interpolate the mesh.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:35
- createFromFile(filename, plexname='unnamed', interpolate=True, comm=None)
- Create DMPlex from a file.
Collective.
- filename (str) -- A file name.
- plexname (str | None) -- The name of the resulting DMPlex, also used for intra-datafile lookup by some formats.
- interpolate (bool | None) -- Flag to create intermediate mesh pieces (edges, faces).
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:192
- createGmsh(viewer, interpolate=True, comm=None)
- Create a DMPlex mesh from a Gmsh file viewer.
Collective.
- viewer (Viewer) -- The Viewer associated with a Gmsh file.
- interpolate (bool | None) -- Create faces and edges in the mesh.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
Notes
-dm_plex_gmsh_hybrid forces triangular prisms to use tensor order.
-dm_plex_gmsh_periodic allows for reading Gmsh periodic section.
-dm_plex_gmsh_highorder allows for generating high-order coordinates.
-dm_plex_gmsh_project projects high-order coordinates to a different space, use the prefix -dm_plex_gmsh_project_ to define the space.
-dm_plex_gmsh_use_regions generates labels with region names.
-dm_plex_gmsh_mark_vertices adds vertices to generated labels.
-dm_plex_gmsh_multiple_tags allows multiple tags for default labels.
-dm_plex_gmsh_spacedim <d> embedding space dimension.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:339
- createPointNumbering()
- Create a global numbering for all points.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:915
- Return type
- IS
- createSection(numComp, numDof, bcField=None, bcComps=None, bcPoints=None, perm=None)
- Create a Section based upon the DOF layout specification provided.
Not collective.
- numComp (Sequence[int]) -- An array of size numFields holding the number of components per field.
- numDof (Sequence[int]) -- An array of size numFields*(dim+1) holding the number of DOFs per field on a mesh piece of dimension dim.
- bcField (Sequence[int] | None) -- An array of size numBC giving the field number for each boundary condition, where numBC is the number of boundary conditions.
- bcComps (Sequence[IS] | None) -- An array of size numBC giving an IS holding the field components to which each boundary condition applies.
- bcPoints (Sequence[IS] | None) -- An array of size numBC giving an IS holding the DMPlex points to which each boundary condition applies.
- perm (IS | None) -- Permutation of the chart.
- Return type
- Section
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1837
- distribute(overlap=0)
- Distribute the mesh and any associated sections.
Collective.
- Parameters
- overlap (int | None) -- The overlap of partitions.
- Returns
- sf -- The SF used for point distribution, or None if not distributed.
- Return type
- SF or None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1561
- distributeField(sf, sec, vec, newsec=None, newvec=None)
- Distribute field data with a with a given SF.
Collective.
- sf (SF) -- The SF describing the communication pattern.
- sec (Section) -- The Section for existing data layout.
- vec (Vec) -- The existing data in a local vector.
- newsec (Section | None) -- The SF describing the new data layout.
- newvec (Vec | None) -- The new data in a local vector.
- newSection (Section) -- The SF describing the new data layout.
- newVec (Vec) -- The new data in a local vector.
- Return type
- tuple[Section, Vec]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1758
- distributeGetDefault()
- Return a flag indicating whether the DM should be distributed by
default.
Not collective.
- Returns
- dist -- Flag indicating whether the DMPlex should be distributed by default.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1647
- distributeOverlap(overlap=0)
- Add partition overlap to a distributed non-overlapping DMPlex.
Collective.
- Parameters
- overlap (int | None) -- The overlap of partitions (the same on all ranks).
- Returns
- sf -- The SF used for point distribution.
- Return type
- SF
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1589
- distributeSetDefault(flag)
- Set flag indicating whether the DMPlex should be distributed by
default.
Logically collective.
- Parameters
- flag (bool) -- Flag indicating whether the DMPlex should be distributed by default.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1667
- distributionGetName()
- Retrieve the name of the specific parallel distribution.
Not collective.
- Returns
- name -- The name of the specific parallel distribution.
- Return type
- str
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1708
- distributionSetName(name)
- Set the name of the specific parallel distribution.
Logically collective.
- Parameters
- name (str) -- The name of the specific parallel distribution.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1687
- generate(boundary, name=None, interpolate=True)
- Generate a mesh.
Not collective.
- boundary (DMPlex) -- The DMPlex boundary object.
- name (str | None) -- The mesh generation package name.
- interpolate (bool | None) -- Flag to create intermediate mesh elements.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1284
- getAdjacency(p)
- Return all points adjacent to the given point.
Not collective.
- Parameters
- p (int) -- The point.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1467
- getAdjacencyUseAnchors()
- Query whether adjacency in the mesh uses the point-to-point constraints.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1452
- Return type
- bool
- getCellNumbering()
- Return a global cell numbering for all cells on this process.
Collective the first time it is called.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:885
- Return type
- IS
- getCellType(p)
- Return the polytope type of a given cell.
Not collective.
- Parameters
- p (int) -- The cell.
- Return type
- PolytopeType
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:685
- getCellTypeLabel()
- Return the DMLabel recording the polytope type of each cell.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:706
- Return type
- DMLabel
- getChart()
- Return the interval for all mesh points [pStart, pEnd).
Not collective.
- pStart (int) -- The first mesh point.
- pEnd (int) -- The upper bound for mesh points.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:400
- getCone(p)
- Return the points on the in-edges for this point in the DAG.
Not collective.
- Parameters
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:491
- getConeOrientation(p)
- Return the orientations on the in-edges for this point in the DAG.
Not collective.
- Parameters
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:606
- getConeSize(p)
- Return the number of in-edges for this point in the DAG.
Not collective.
- Parameters
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:442
- getDepth()
- Return the depth of the DAG representing this mesh.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:929
- Return type
- int
- getDepthStratum(svalue)
- Return the bounds [start, end) for all points at a certain
depth.
Not collective.
- Parameters
- svalue (int) -- The requested depth.
- Returns
- pStart (int) -- The first stratum point.
- pEnd (int) -- The upper bound for stratum points.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:944
- getFullJoin(points)
- Return an array for the join of the set of points.
Not collective.
- Parameters
- points (Sequence[int]) -- The input points.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1092
- getHeightStratum(svalue)
- Return the bounds [start, end) for all points at a certain
height.
Not collective.
- Parameters
- svalue (int) -- The requested height.
- Returns
- pStart (int) -- The first stratum point.
- pEnd (int) -- The upper bound for stratum points.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:971
- getJoin(points)
- Return an array for the join of the set of points.
Not collective.
- Parameters
- points (Sequence[int]) -- The input points.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1066
- getMaxSizes()
- Return the maximum number of in-edges and out-edges of the DAG.
Not collective.
- maxConeSize (int) -- The maximum number of in-edges.
- maxSupportSize (int) -- The maximum number of out-edges.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:826
- getMeet(points)
- Return an array for the meet of the set of points.
Not collective.
- Parameters
- points (Sequence[int]) -- The input points.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1040
- getMinRadius()
- Return the minimum distance from any cell centroid to a face.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1803
- Return type
- float
- getOrdering(otype)
- Calculate a reordering of the mesh.
Collective.
- Parameters
- otype (OrderingType) -- Type of reordering, see Mat.OrderingType.
- Returns
- perm -- The point permutation.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2130
- getPartitioner()
- Return the mesh partitioner.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1510
- Return type
- Partitioner
- getPointDepth(point)
- Return the depth of a given point.
Not collective.
- Parameters
- point (int) -- The point.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:998
- getPointGlobal(point)
- Return location of point data in global Vec.
Not collective.
- Parameters
- point (int) -- The topological point.
- Returns
- start (int) -- Start of point data; returns -(globalStart+1) if point is not owned.
- end (int) -- End of point data; returns -(globalEnd+1) if point is not owned.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1972
- getPointGlobalField(point, field)
- Return location of point field data in global Vec.
Not collective.
- point (int) -- The topological point.
- field (int) -- The field number.
- start (int) -- Start of point data; returns -(globalStart+1) if point is not owned.
- end (int) -- End of point data; returns -(globalEnd+1) if point is not owned.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2000
- getPointHeight(point)
- Return the height of a given point.
Not collective.
- Parameters
- point (int) -- The point.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1019
- getPointLocal(point)
- Return location of point data in local Vec.
Not collective.
- Parameters
- point (int) -- The topological point.
- Returns
- start (int) -- Start of point data.
- end (int) -- End of point data.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1913
- getPointLocalField(point, field)
- Return location of point field data in local Vec.
Not collective.
- point (int) -- The topological point.
- field (int) -- The field number.
- start (int) -- Start of point data.
- end (int) -- End of point data.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1941
- getRefinementLimit()
- Retrieve the maximum cell volume for refinement.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2114
- Return type
- float
- getRefinementUniform()
- Retrieve the flag for uniform refinement.
Not collective.
- Returns
- refinementUniform -- The flag for uniform refinement.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2073
- getSubpointIS()
- Return an IS covering the entire subdm chart.
Not collective.
- Returns
- iset -- The IS containing subdm's parent's points.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2278
- getSubpointMap()
- Return a DMLabel with point dimension as values.
Not collective.
- Returns
- label -- The DMLabel whose values are subdm's point dimensions.
- Return type
- DMLabel
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2298
- getSupport(p)
- Return the points on the out-edges for this point in the DAG.
Not collective.
- Parameters
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- Return type
- ArrayInt
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:771
- getSupportSize(p)
- Return the number of out-edges for this point in the DAG.
Not collective.
- Parameters
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:722
- getTransitiveClosure(p, useCone=True)
- Return the points and orientations on the transitive closure of this
point.
Not collective.
- p (int) -- The mesh point.
- useCone (bool | None) -- True for the closure, otherwise return the star.
- points (ArrayInt) -- The points.
- orientations (ArrayInt) -- The orientations.
- Return type
- tuple[ArrayInt, ArrayInt]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1118
- getVecClosure(sec, vec, point)
- Return an array of the values on the closure of a point.
Not collective.
- sec (Section) -- The Section describing the layout in vec or None to use the default section.
- vec (Vec) -- The local vector.
- point (int) -- The point in the DMPlex.
- Return type
- ArrayScalar
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1185
- getVertexNumbering()
- Return a global vertex numbering for all vertices on this process.
Collective the first time it is called.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:900
- Return type
- IS
- globalVectorLoad(viewer, sectiondm, sf, vec)
- Load on-disk vector data into a global vector.
Collective.
- viewer (Viewer) -- The Viewer that represents the on-disk vector data.
- sectiondm (DM) -- The DM that contains the global section on which vec is defined.
- sf (SF) -- The SF that migrates the on-disk vector data into vec.
- vec (Vec) -- The global vector to set values of.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3401
- globalVectorView(viewer, sectiondm, vec)
- Save a global vector.
Collective.
- viewer (Viewer) -- The Viewer to save data with.
- sectiondm (DM) -- The DM containing the global section on which vec is defined; may be the same as this DMPlex object.
- vec (Vec) -- The global vector to be saved.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3248
- insertCone(p, conePos, conePoint)
- DMPlexInsertCone - Insert a point into the in-edges for the point p in the
DAG.
Not collective.
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- conePos (int) -- The local index in the cone where the point should be put.
- conePoint (int) -- The mesh point to insert.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:556
- insertConeOrientation(p, conePos, coneOrientation)
- Insert a point orientation for the in-edge for the point p in the DAG.
Not collective.
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart
- conePos (int) -- The local index in the cone where the point should be put.
- coneOrientation (int) -- The point orientation to insert.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:581
- interpolate()
- Convert to a mesh with all intermediate faces, edges, etc.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1728
- Return type
- None
- isDistributed()
- Return the flag indicating if the mesh is distributed.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1618
- Return type
- bool
- isSimplex()
- Return the flag indicating if the first cell is a simplex.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1632
- Return type
- bool
- labelCohesiveComplete(label, bdlabel, bdvalue, flip, split, subdm)
- Add all other mesh pieces to complete the surface.
Not collective.
- label (DMLabel) -- A DMLabel marking the surface.
- bdlabel (DMLabel) -- A DMLabel marking the vertices on the boundary which will not be duplicated.
- bdvalue (int) -- Value of DMLabel marking the vertices on the boundary.
- flip (bool) -- Flag to flip the submesh normal and replace points on the other side.
- split (bool) -- Flag to split faces incident on the surface boundary, rather than clamping those faces to the boundary
- subdm (DMPlex) -- The DMPlex associated with the label.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1396
- labelComplete(label)
- Add the transitive closure to the surface.
Not collective.
- Parameters
- label (DMLabel) -- A DMLabel marking the surface points.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1379
- labelsLoad(viewer, sfxc)
- Load labels into this DMPlex object.
Collective.
- viewer (Viewer) -- The Viewer for the saved labels.
- sfxc (SF) -- The SF returned by topologyLoad.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3344
- labelsView(viewer)
- Save DMPlex labels into a file.
Collective.
- Parameters
- viewer (Viewer) -- The Viewer for saving.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3209
- localVectorLoad(viewer, sectiondm, sf, vec)
- Load on-disk vector data into a local vector.
Collective.
- viewer (Viewer) -- The Viewer that represents the on-disk vector data.
- sectiondm (DM) -- The DM that contains the local section on which vec is defined.
- sf (SF) -- The SF that migrates the on-disk vector data into vec.
- vec (Vec) -- The local vector to set values of.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3426
- localVectorView(viewer, sectiondm, vec)
- Save a local vector.
Collective.
- viewer (Viewer) -- The Viewer to save data with.
- sectiondm (DM) -- The DM that contains the local section on which vec is defined; may be the same as this DMPlex object.
- vec (Vec) -- The local vector to be saved.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3272
- markBoundaryFaces(label, value=None)
- Mark all faces on the boundary.
Not collective.
- value (int | None) -- The marker value, or DETERMINE or None to use some value in the closure (or 1 if none are found).
- label (str)
- Return type
- DMLabel
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1352
- metricAverage2(metric1, metric2, metricAvg)
- Compute and return the unweighted average of two metrics.
Collective.
- metric1 (Vec) -- The first metric to be averaged.
- metric2 (Vec) -- The second metric to be averaged.
- metricAvg (Vec) -- The output averaged metric.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3059
- metricAverage3(metric1, metric2, metric3, metricAvg)
- Compute and return the unweighted average of three metrics.
Collective.
- metric1 (Vec) -- The first metric to be averaged.
- metric2 (Vec) -- The second metric to be averaged.
- metric3 (Vec) -- The third metric to be averaged.
- metricAvg (Vec) -- The output averaged metric.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3081
- metricCreate(field=0)
- Create a Riemannian metric field.
Collective.
- Parameters
- field (int | None) -- The field number to use.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2890
- metricCreateIsotropic(indicator, field=0)
- Construct an isotropic metric from an error indicator.
Collective.
- indicator (Vec) -- The error indicator.
- field (int | None) -- The field number to use.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2935
- metricCreateUniform(alpha, field=0)
- Construct a uniform isotropic metric.
Collective.
- alpha (float) -- Scaling parameter for the diagonal.
- field (int | None) -- The field number to use.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2911
- metricDeterminantCreate(field=0)
- Create the determinant field for a Riemannian metric.
Collective.
- Parameters
- field (int | None) -- The field number to use.
- Returns
- determinant (Vec) -- The determinant field.
- dmDet (DM) -- The corresponding DM
- Return type
- tuple[Vec, DM]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2958
- metricEnforceSPD(metric, ometric, determinant, restrictSizes=False, restrictAnisotropy=False)
- Enforce symmetric positive-definiteness of a metric.
Collective.
- metric (Vec) -- The metric.
- ometric (Vec) -- The output metric.
- determinant (Vec) -- The output determinant.
- restrictSizes (bool | None) -- Flag indicating whether maximum/minimum magnitudes should be enforced.
- restrictAnisotropy (bool | None) -- Flag indicating whether maximum anisotropy should be enforced.
- ometric (Vec) -- The output metric.
- determinant (Vec) -- The output determinant.
- Return type
- tuple[Vec, Vec]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2987
- metricGetGradationFactor()
- Return the metric gradation factor.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2841
- Return type
- float
- metricGetHausdorffNumber()
- Return the metric Hausdorff number.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2875
- Return type
- float
- metricGetMaximumAnisotropy()
- Return the maximum tolerated metric anisotropy.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2739
- Return type
- float
- metricGetMaximumMagnitude()
- Return the maximum tolerated metric magnitude.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2705
- Return type
- float
- metricGetMinimumMagnitude()
- Return the minimum tolerated metric magnitude.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2671
- Return type
- float
- metricGetNormalizationOrder()
- Return the order p for L-p normalization.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2807
- Return type
- float
- metricGetNumIterations()
- Return the number of parallel adaptation iterations.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2637
- Return type
- int
- metricGetTargetComplexity()
- Return the target metric complexity.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2773
- Return type
- float
- metricGetVerbosity()
- Return the verbosity of the mesh adaptation package.
Not collective.
- Returns
- verbosity -- The verbosity, where -1 is silent and 10 is maximum.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2598
- metricIntersection2(metric1, metric2, metricInt)
- Compute and return the intersection of two metrics.
Collective.
- metric1 (Vec) -- The first metric to be intersected.
- metric2 (Vec) -- The second metric to be intersected.
- metricInt (Vec) -- The output intersected metric.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3105
- metricIntersection3(metric1, metric2, metric3, metricInt)
- Compute the intersection of three metrics.
Collective.
- metric1 (Vec) -- The first metric to be intersected.
- metric2 (Vec) -- The second metric to be intersected.
- metric3 (Vec) -- The third metric to be intersected.
- metricInt (Vec) -- The output intersected metric.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3127
- metricIsIsotropic()
- Return the flag indicating whether the metric is isotropic or not.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2386
- Return type
- bool
- metricIsUniform()
- Return the flag indicating whether the metric is uniform or not.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2352
- Return type
- bool
- metricNoInsertion()
- Return the flag indicating whether node insertion and deletion are turned
off.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2455
- Return type
- bool
- metricNoMovement()
- Return the flag indicating whether node movement is turned off.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2527
- Return type
- bool
- metricNoSurf()
- Return the flag indicating whether surface modification is turned off.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2563
- Return type
- bool
- metricNoSwapping()
- Return the flag indicating whether facet swapping is turned off.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2491
- Return type
- bool
- metricNormalize(metric, ometric, determinant, restrictSizes=True, restrictAnisotropy=True)
- Apply L-p normalization to a metric.
Collective.
- metric (Vec) -- The metric.
- ometric (Vec) -- The output metric.
- determinant (Vec) -- The output determinant.
- restrictSizes (bool | None) -- Flag indicating whether maximum/minimum magnitudes should be enforced.
- restrictAnisotropy (bool | None) -- Flag indicating whether maximum anisotropy should be enforced.
- ometric (Vec) -- The output normalized metric.
- determinant (Vec) -- The output determinant.
- Return type
- tuple[Vec, Vec]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3023
- metricRestrictAnisotropyFirst()
- Return true if anisotropy is restricted before normalization.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2420
- Return type
- bool
- metricSetFromOptions()
- Configure the object from the options database.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2320
- Return type
- None
- metricSetGradationFactor(beta)
- Set the metric gradation factor.
Logically collective.
- Parameters
- beta (float) -- The metric gradation factor.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2822
- metricSetHausdorffNumber(hausd)
- Set the metric Hausdorff number.
Logically collective.
- Parameters
- hausd (float) -- The metric Hausdorff number.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2856
- metricSetIsotropic(isotropic)
- Record whether the metric is isotropic or not.
Logically collective.
- Parameters
- isotropic (bool) -- Flag indicating whether the metric is isotropic or not.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2367
- metricSetMaximumAnisotropy(a_max)
- Set the maximum tolerated metric anisotropy.
Logically collective.
- Parameters
- a_max (float) -- The maximum tolerated metric anisotropy.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2720
- metricSetMaximumMagnitude(h_max)
- Set the maximum tolerated metric magnitude.
Logically collective.
- Parameters
- h_max (float) -- The maximum tolerated metric magnitude.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2686
- metricSetMinimumMagnitude(h_min)
- Set the minimum tolerated metric magnitude.
Logically collective.
- Parameters
- h_min (float) -- The minimum tolerated metric magnitude.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2652
- metricSetNoInsertion(noInsert)
- Set the flag indicating whether node insertion should be turned off.
Logically collective.
- Parameters
- noInsert (bool) -- Flag indicating whether node insertion and deletion should be turned off.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2435
- metricSetNoMovement(noMove)
- Set the flag indicating whether node movement should be turned off.
Logically collective.
- Parameters
- noMove (bool) -- Flag indicating whether node movement should be turned off.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2507
- metricSetNoSurf(noSurf)
- Set the flag indicating whether surface modification should be turned off.
Logically collective.
- Parameters
- noSurf (bool) -- Flag indicating whether surface modification should be turned off.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2543
- metricSetNoSwapping(noSwap)
- Set the flag indicating whether facet swapping should be turned off.
Logically collective.
- Parameters
- noSwap (bool) -- Flag indicating whether facet swapping should be turned off.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2471
- metricSetNormalizationOrder(p)
- Set the order p for L-p normalization.
Logically collective.
- Parameters
- p (float) -- The normalization order.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2788
- metricSetNumIterations(numIter)
- Set the number of parallel adaptation iterations.
Logically collective.
- Parameters
- numIter (int) -- The number of parallel adaptation iterations.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2618
- metricSetRestrictAnisotropyFirst(restrictAnisotropyFirst)
- Record whether anisotropy is be restricted before normalization or after.
Logically collective.
- Parameters
- restrictAnisotropyFirst (bool) -- Flag indicating if anisotropy is restricted before normalization or after.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2401
- metricSetTargetComplexity(targetComplexity)
- Set the target metric complexity.
Logically collective.
- Parameters
- targetComplexity (float) -- The target metric complexity.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2754
- metricSetUniform(uniform)
- Record whether the metric is uniform or not.
Logically collective.
- Parameters
- uniform (bool) -- Flag indicating whether the metric is uniform or not.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2333
- metricSetVerbosity(verbosity)
- Set the verbosity of the mesh adaptation package.
Logically collective.
- Parameters
- verbosity (int) -- The verbosity, where -1 is silent and 10 is maximum.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2579
- orient()
- Give a consistent orientation to the input mesh.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:873
- Return type
- None
- permute(perm)
- Reorder the mesh according to the input permutation.
Collective.
- Parameters
- perm (IS) -- The point permutation, perm[old point number] = new point number.
- Returns
- pdm -- The permuted DMPlex.
- Return type
- DMPlex
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2158
- Redistribute shared points in order to achieve better balancing.
Collective.
- entityDepth (int | None) -- Depth of the entity to balance (e.g., 0 -> balance vertices).
- useInitialGuess (bool | None) -- Whether to use the current distribution as initial guess.
- parallel (bool | None) -- Whether to use ParMETIS and do the partition in parallel or gather the graph onto a single process.
- Returns
- success -- Whether the graph partitioning was successful or not. Unsuccessful simply means no change to the partitioning.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1527
- reorderGetDefault()
- Return flag indicating whether the DMPlex should be reordered by
default.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2182
- Return type
- ReorderDefaultFlag
- reorderSetDefault(flag)
- Set flag indicating whether the DM should be reordered by default.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2196
- sectionLoad(viewer, sectiondm, sfxc)
- Load section into a DM.
Collective.
- viewer (Viewer) -- The Viewer that represents the on-disk section (sectionA).
- sectiondm (DM) -- The DM into which the on-disk section (sectionA) is migrated.
- sfxc (SF) -- The SF returned by topologyLoad.
- gsf (SF) -- The SF that migrates any on-disk Vec data associated with sectionA into a global Vec associated with the sectiondm's global section (None if not needed).
- lsf (SF) -- The SF that migrates any on-disk Vec data associated with sectionA into a local Vec associated with the sectiondm's local section (None if not needed).
- Return type
- tuple[SF, SF]
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3364
- sectionView(viewer, sectiondm)
- Save a section associated with a DMPlex.
Collective.
- viewer (Viewer) -- The Viewer for saving.
- sectiondm (DM) -- The DM that contains the section to be saved.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3227
- setAdjacencyUseAnchors(useAnchors=True)
- Define adjacency in the mesh using the point-to-point constraints.
Logically collective.
- Parameters
- useAnchors (bool) -- Flag to use the constraints. If True, then constrained points are omitted from DMPlex.getAdjacency, and their anchor points appear in their place.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1431
- setCellType(p, ctype)
- Set the polytope type of a given cell.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:663
- setChart(pStart, pEnd)
- Set the interval for all mesh points [pStart, pEnd).
Not collective.
- pStart (int) -- The first mesh point.
- pEnd (int) -- The upper bound for mesh points.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:421
- setCone(p, cone, orientation=None)
- Set the points on the in-edges for this point in the DAG.
Not collective.
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- cone (Sequence[int]) -- An array of points which are on the in-edges for point p.
- orientation (Sequence[int] | None) -- An array of orientations, defaults to None.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:517
- setConeOrientation(p, orientation)
- Set the orientations on the in-edges for this point in the DAG.
Not collective.
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- orientation (Sequence[int]) -- An array of orientations.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:632
- setConeSize(p, size)
- Set the number of in-edges for this point in the DAG.
Not collective.
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- size (int) -- The cone size for point p.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:466
- setMatClosure(sec, gsec, mat, point, values, addv=None)
- Set an array of the values on the closure of point.
Not collective.
- sec (Section) -- The section describing the layout in mat, or None to use the default section.
- gsec (Section) -- The section describing the layout in mat, or None to use the default global section.
- mat (Mat) -- The matrix.
- point (int) -- The point in the DMPlex.
- values (Sequence[Scalar]) -- The array of values.
- mode -- The insertion mode.
- addv (InsertModeSpec | None)
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1247
- setPartitioner(part)
- Set the mesh partitioner.
Logically collective.
- Parameters
- part (Partitioner) -- The partitioner.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1492
- setRefinementLimit(refinementLimit)
- Set the maximum cell volume for refinement.
Logically collective.
- Parameters
- refinementLimit (float) -- The maximum cell volume in the refined mesh.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2094
- setRefinementUniform(refinementUniform=True)
- Set the flag for uniform refinement.
Logically collective.
- Parameters
- refinementUniform (bool | None) -- The flag for uniform refinement.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:2053
- setSupport(p, supp)
- Set the points on the out-edges for this point in the DAG.
Not collective.
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- supp (Sequence[int]) -- An array of points which are on the out-edges for point p.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:797
- setSupportSize(p, size)
- Set the number of out-edges for this point in the DAG.
Not collective.
- p (int) -- The point, which must lie in the chart set with DMPlex.setChart.
- size (int) -- The support size for point p.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:746
- setTetGenOptions(opts)
- Set the options used for the Tetgen mesh generator.
Not collective.
- Parameters
- opts (str) -- The command line options.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1332
- setTriangleOptions(opts)
- Set the options used for the Triangle mesh generator.
Not collective.
- Parameters
- opts (str) -- The command line options.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1312
- setVecClosure(sec, vec, point, values, addv=None)
- Set an array of the values on the closure of point.
Not collective.
- sec (Section) -- The section describing the layout in vec, or None to use the default section.
- vec (Vec) -- The local vector.
- point (int) -- The point in the DMPlex.
- values (Sequence[Scalar]) -- The array of values.
- mode -- The insertion mode.
- addv (InsertModeSpec | None)
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1215
- stratify()
- Calculate the strata of DAG.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:861
- Return type
- None
- symmetrize()
- Create support (out-edge) information from cone (in-edge) information.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:848
- Return type
- None
- topologyLoad(viewer)
- Load a topology into this DMPlex object.
Collective.
- Parameters
- viewer (Viewer) -- The Viewer for the saved topology
- Returns
- sfxc -- The SF that pushes points in [0, N) to the associated points in the loaded DMPlex, where N is the global number of points.
- Return type
- SF
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3298
- topologyView(viewer)
- Save a DMPlex topology into a file.
Collective.
- Parameters
- viewer (Viewer) -- The Viewer for saving.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3173
- uninterpolate()
- Convert to a mesh with only cells and vertices.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1743
- Return type
- None
- vecGetClosure(sec, vec, p)
- Return an array of values on the closure of p.
Not collective.
- sec (Section) -- The section describing the layout in vec.
- vec (Vec) -- The local vector.
- p (int) -- The point in the DMPlex.
- Return type
- ArrayScalar
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:1157
petsc4py.PETSc.DMPlexTransform¶
- class petsc4py.PETSc.DMPlexTransform
- Bases: Object
Mesh transformations.
Methods Summary
apply(dm) Apply a mesh transformation. create([comm]) Create a mesh transformation. destroy() Destroy a mesh transformation. getType() Return the transformation type name. setDM(dm) Set the DM for the transformation. setFromOptions() Configure the transformation from the options database. setType(tr_type) Set the transformation type. setUp() Setup a mesh transformation. view([viewer]) View the mesh transformation. Methods Documentation
- apply(dm)
- Apply a mesh transformation.
Collective.
Source code at petsc4py/PETSc/DMPlex.pyx:3475
- Parameters
- dm (DM)
- Return type
- DM
- create(comm=None)
- Create a mesh transformation.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3486
- Parameters
- comm (Comm | None)
- Return type
- Self
- destroy()
- Destroy a mesh transformation.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3503
- Return type
- Self
- getType()
- Return the transformation type name.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3516
- Return type
- str
- setDM(dm)
- Set the DM for the transformation.
Logically collective.
Source code at petsc4py/PETSc/DMPlex.pyx:3554
- Parameters
- dm (DM)
- Return type
- None
- setFromOptions()
- Configure the transformation from the options database.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3563
- Return type
- None
- setType(tr_type)
- Set the transformation type.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3540
- Parameters
- tr_type (DMPlexTransformType | str)
- Return type
- None
- setUp()
- Setup a mesh transformation.
Collective.
Source code at petsc4py/PETSc/DMPlex.pyx:3530
- Return type
- Self
- view(viewer=None)
- View the mesh transformation.
Collective.
- Parameters
- viewer (Viewer | None) -- A Viewer instance or None for the default viewer.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMPlex.pyx:3575
petsc4py.PETSc.DMPlexTransformType¶
- class petsc4py.PETSc.DMPlexTransformType
- Bases: object
Transformation types.
Attributes Summary
EXTRUDE Object EXTRUDE of type str REFINE1D Object REFINE1D of type str REFINEALFELD Object REFINEALFELD of type str REFINEBOUNDARYLAYER Object REFINEBOUNDARYLAYER of type str REFINEPOWELLSABIN Object REFINEPOWELLSABIN of type str REFINEREGULAR Object REFINEREGULAR of type str REFINESBR Object REFINESBR of type str REFINETOBOX Object REFINETOBOX of type str REFINETOSIMPLEX Object REFINETOSIMPLEX of type str TRANSFORMFILTER Object TRANSFORMFILTER of type str Attributes Documentation
- EXTRUDE: str = EXTRUDE
- Object EXTRUDE of type str
- REFINE1D: str = REFINE1D
- Object REFINE1D of type str
- REFINEALFELD: str = REFINEALFELD
- Object REFINEALFELD of type str
- REFINEBOUNDARYLAYER: str = REFINEBOUNDARYLAYER
- Object REFINEBOUNDARYLAYER of type str
- REFINEPOWELLSABIN: str = REFINEPOWELLSABIN
- Object REFINEPOWELLSABIN of type str
- REFINEREGULAR: str = REFINEREGULAR
- Object REFINEREGULAR of type str
- REFINESBR: str = REFINESBR
- Object REFINESBR of type str
- REFINETOBOX: str = REFINETOBOX
- Object REFINETOBOX of type str
- REFINETOSIMPLEX: str = REFINETOSIMPLEX
- Object REFINETOSIMPLEX of type str
- TRANSFORMFILTER: str = TRANSFORMFILTER
- Object TRANSFORMFILTER of type str
petsc4py.PETSc.DMShell¶
- class petsc4py.PETSc.DMShell
- Bases: DM
A shell DM object, used to manage user-defined problem data.
Methods Summary
create([comm]) Creates a shell DM object. setCoarsen(coarsen[, args, kargs]) Set the routine used to coarsen the DMShell. setCreateDomainDecomposition(decomp[, args, ...]) Set the routine used to create a domain decomposition. setCreateDomainDecompositionScatters(scatter) Set the routine used to create the scatter contexts for domain decomposition. setCreateFieldDecomposition(decomp[, args, ...]) Set the routine used to create a field decomposition. setCreateGlobalVector(create_gvec[, args, kargs]) Set the routine to create a global vector. setCreateInjection(create_injection[, args, ...]) Set the routine used to create the injection operator. setCreateInterpolation(create_interpolation) Set the routine used to create the interpolation operator. setCreateLocalVector(create_lvec[, args, kargs]) Set the routine to create a local vector. setCreateMatrix(create_matrix[, args, kargs]) Set the routine to create a matrix. setCreateRestriction(create_restriction[, ...]) Set the routine used to create the restriction operator. setCreateSubDM(create_subdm[, args, kargs]) Set the routine used to create a sub DM from the DMShell. setGlobalToLocal(begin, end[, begin_args, ...]) Set the routines used to perform a global to local scatter. setGlobalToLocalVecScatter(gtol) Set a Scatter context for global to local communication. setGlobalVector(gv) Set a template global vector. setLocalToGlobal(begin, end[, begin_args, ...]) Set the routines used to perform a local to global scatter. setLocalToGlobalVecScatter(ltog) Set a Scatter context for local to global communication. setLocalToLocal(begin, end[, begin_args, ...]) Set the routines used to perform a local to local scatter. setLocalToLocalVecScatter(ltol) Set a Scatter context for local to local communication. setLocalVector(lv) Set a template local vector. setMatrix(mat) Set a template matrix. setRefine(refine[, args, kargs]) Set the routine used to refine the DMShell. Methods Documentation
- create(comm=None)
- Creates a shell DM object.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:4
- setCoarsen(coarsen, args=None, kargs=None)
- Set the routine used to coarsen the DMShell.
Logically collective.
- coarsen (Callable[[DM, Comm], DM] | None) -- The routine which coarsens the DM.
- args (tuple[Any, ...] | None) -- Additional positional arguments for coarsen.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for coarsen.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:368
- setCreateDomainDecomposition(decomp, args=None, kargs=None)
- Set the routine used to create a domain decomposition.
Logically collective.
- decomp (Callable[[DM], tuple[list[str] | None, list[IS] | None, list[IS] | None, list[DM] | None]] | None) -- The routine to create the decomposition.
- args (tuple[Any, ...] | None) -- Additional positional arguments for decomp.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for decomp.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:560
- setCreateDomainDecompositionScatters(scatter, args=None, kargs=None)
- Set the routine used to create the scatter contexts for domain
decomposition.
Logically collective.
- scatter (Callable[[DM, list[DM]], tuple[list[Scatter], list[Scatter], list[Scatter]]] | None) -- The routine to create the scatters.
- args (tuple[Any, ...] | None) -- Additional positional arguments for scatter.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for scatter.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:592
- setCreateFieldDecomposition(decomp, args=None, kargs=None)
- Set the routine used to create a field decomposition.
Logically collective.
- decomp (Callable[[DM], tuple[list[str] | None, list[IS] | None, list[DM] | None]] | None) -- The routine to create the decomposition.
- args (tuple[Any, ...] | None) -- Additional positional arguments for decomp.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for decomp.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:528
- setCreateGlobalVector(create_gvec, args=None, kargs=None)
- Set the routine to create a global vector.
Logically collective.
- create_gvec (Callable[[DM], Vec] | None) -- The creation routine.
- args (tuple[Any, ...] | None) -- Additional positional arguments for create_gvec.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for create_gvec.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:76
- setCreateInjection(create_injection, args=None, kargs=None)
- Set the routine used to create the injection operator.
Logically collective.
- create_injection (Callable[[DM, DM], Mat] | None) -- The routine to create the injection.
- args (tuple[Any, ...] | None) -- Additional positional arguments for create_injection.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for create_injection.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:464
- setCreateInterpolation(create_interpolation, args=None, kargs=None)
- Set the routine used to create the interpolation operator.
Logically collective.
- create_interpolation (Callable[[DM, DM], tuple[Mat, Vec]] | None) -- The routine to create the interpolation.
- args (tuple[Any, ...] | None) -- Additional positional arguments for create_interpolation.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for create_interpolation.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:432
- setCreateLocalVector(create_lvec, args=None, kargs=None)
- Set the routine to create a local vector.
Logically collective.
- create_lvec (Callable[[DM], Vec] | None) -- The creation routine.
- args (tuple[Any, ...] | None) -- Additional positional arguments for create_lvec.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for create_lvec.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:108
- setCreateMatrix(create_matrix, args=None, kargs=None)
- Set the routine to create a matrix.
Logically collective.
- create_matrix (Callable[[DM], Mat] | None) -- The function to create a matrix.
- args (tuple[Any, ...] | None) -- Additional positional arguments for create_matrix.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for create_matrix.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:336
- setCreateRestriction(create_restriction, args=None, kargs=None)
- Set the routine used to create the restriction operator.
Logically collective.
- create_restriction (Callable[[DM, DM], Mat] | None) -- The routine to create the restriction
- args (tuple[Any, ...] | None) -- Additional positional arguments for create_restriction.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for create_restriction.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:496
- setCreateSubDM(create_subdm, args=None, kargs=None)
- Set the routine used to create a sub DM from the DMShell.
Logically collective.
- subdm -- The routine to create the decomposition.
- args (tuple[Any, ...] | None) -- Additional positional arguments for subdm.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for subdm.
- create_subdm (Callable[[DM, Sequence[int]], tuple[IS, DM]] | None)
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:624
- setGlobalToLocal(begin, end, begin_args=None, begin_kargs=None, end_args=None, end_kargs=None)
- Set the routines used to perform a global to local scatter.
Logically collective.
- dm -- The DMShell.
- begin (Callable[[DM, Vec, InsertMode, Vec], None] | None) -- The routine which begins the global to local scatter.
- end (Callable[[DM, Vec, InsertMode, Vec], None] | None) -- The routine which ends the global to local scatter.
- begin_args (tuple[Any, ...] | None) -- Additional positional arguments for begin.
- begin_kargs (dict[str, Any] | None) -- Additional keyword arguments for begin.
- end_args (tuple[Any, ...] | None) -- Additional positional arguments for end.
- end_kargs (dict[str, Any] | None) -- Additional keyword arguments for end.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:140
- setGlobalToLocalVecScatter(gtol)
- Set a Scatter context for global to local communication.
Logically collective.
- Parameters
- gtol (Scatter) -- The global to local Scatter context.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:189
- setGlobalVector(gv)
- Set a template global vector.
Logically collective.
- Parameters
- gv (Vec) -- Template vector.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:42
- setLocalToGlobal(begin, end, begin_args=None, begin_kargs=None, end_args=None, end_kargs=None)
- Set the routines used to perform a local to global scatter.
Logically collective.
- begin (Callable[[DM, Vec, InsertMode, Vec], None] | None) -- The routine which begins the local to global scatter.
- end (Callable[[DM, Vec, InsertMode, Vec], None] | None) -- The routine which ends the local to global scatter.
- begin_args (tuple[Any, ...] | None) -- Additional positional arguments for begin.
- begin_kargs (dict[str, Any] | None) -- Additional keyword arguments for begin.
- end_args (tuple[Any, ...] | None) -- Additional positional arguments for end.
- end_kargs (dict[str, Any] | None) -- Additional keyword arguments for end.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:206
- setLocalToGlobalVecScatter(ltog)
- Set a Scatter context for local to global communication.
Logically collective.
- Parameters
- ltog (Scatter) -- The local to global Scatter context.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:253
- setLocalToLocal(begin, end, begin_args=None, begin_kargs=None, end_args=None, end_kargs=None)
- Set the routines used to perform a local to local scatter.
Logically collective.
- begin (Callable[[DM, Vec, InsertMode, Vec], None] | None) -- The routine which begins the local to local scatter.
- end (Callable[[DM, Vec, InsertMode, Vec], None] | None) -- The routine which ends the local to local scatter.
- begin_args (tuple[Any, ...] | None) -- Additional positional arguments for begin.
- begin_kargs (dict[str, Any] | None) -- Additional keyword arguments for begin.
- end_args (tuple[Any, ...] | None) -- Additional positional arguments for end.
- end_kargs (dict[str, Any] | None) -- Additional keyword arguments for end.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:270
- setLocalToLocalVecScatter(ltol)
- Set a Scatter context for local to local communication.
Logically collective.
- Parameters
- ltol (Scatter) -- The local to local Scatter context.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:319
- setLocalVector(lv)
- Set a template local vector.
Logically collective.
- Parameters
- lv (Vec) -- Template vector.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:59
- setMatrix(mat)
- Set a template matrix.
Collective.
- Parameters
- mat (Mat) -- The template matrix.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:25
- setRefine(refine, args=None, kargs=None)
- Set the routine used to refine the DMShell.
Logically collective.
- refine (Callable[[DM, Comm], DM] | None) -- The routine which refines the DM.
- args (tuple[Any, ...] | None) -- Additional positional arguments for refine.
- kargs (dict[str, Any] | None) -- Additional keyword arguments for refine.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMShell.pyx:400
petsc4py.PETSc.DMStag¶
- class petsc4py.PETSc.DMStag
- Bases: DM
A DM object representing a "staggered grid" or a structured cell complex.
Enumerations
StencilLocation Stencil location types. StencilType Stencil types.
petsc4py.PETSc.DMStag.StencilLocation¶
- class petsc4py.PETSc.DMStag.StencilLocation
- Bases: object
Stencil location types.
Attributes Summary
BACK Constant BACK of type int BACK_DOWN Constant BACK_DOWN of type int BACK_DOWN_LEFT Constant BACK_DOWN_LEFT of type int BACK_DOWN_RIGHT Constant BACK_DOWN_RIGHT of type int BACK_LEFT Constant BACK_LEFT of type int BACK_RIGHT Constant BACK_RIGHT of type int BACK_UP Constant BACK_UP of type int BACK_UP_LEFT Constant BACK_UP_LEFT of type int BACK_UP_RIGHT Constant BACK_UP_RIGHT of type int DOWN Constant DOWN of type int DOWN_LEFT Constant DOWN_LEFT of type int DOWN_RIGHT Constant DOWN_RIGHT of type int ELEMENT Constant ELEMENT of type int FRONT Constant FRONT of type int FRONT_DOWN Constant FRONT_DOWN of type int FRONT_DOWN_LEFT Constant FRONT_DOWN_LEFT of type int FRONT_DOWN_RIGHT Constant FRONT_DOWN_RIGHT of type int FRONT_LEFT Constant FRONT_LEFT of type int FRONT_RIGHT Constant FRONT_RIGHT of type int FRONT_UP Constant FRONT_UP of type int FRONT_UP_LEFT Constant FRONT_UP_LEFT of type int FRONT_UP_RIGHT Constant FRONT_UP_RIGHT of type int LEFT Constant LEFT of type int NULLLOC Constant NULLLOC of type int RIGHT Constant RIGHT of type int UP Constant UP of type int UP_LEFT Constant UP_LEFT of type int UP_RIGHT Constant UP_RIGHT of type int Attributes Documentation
- BACK: int = BACK
- Constant BACK of type int
- BACK_DOWN: int = BACK_DOWN
- Constant BACK_DOWN of type int
- BACK_DOWN_LEFT: int = BACK_DOWN_LEFT
- Constant BACK_DOWN_LEFT of type int
- BACK_DOWN_RIGHT: int = BACK_DOWN_RIGHT
- Constant BACK_DOWN_RIGHT of type int
- BACK_LEFT: int = BACK_LEFT
- Constant BACK_LEFT of type int
- BACK_RIGHT: int = BACK_RIGHT
- Constant BACK_RIGHT of type int
- BACK_UP: int = BACK_UP
- Constant BACK_UP of type int
- BACK_UP_LEFT: int = BACK_UP_LEFT
- Constant BACK_UP_LEFT of type int
- BACK_UP_RIGHT: int = BACK_UP_RIGHT
- Constant BACK_UP_RIGHT of type int
- DOWN: int = DOWN
- Constant DOWN of type int
- DOWN_LEFT: int = DOWN_LEFT
- Constant DOWN_LEFT of type int
- DOWN_RIGHT: int = DOWN_RIGHT
- Constant DOWN_RIGHT of type int
- ELEMENT: int = ELEMENT
- Constant ELEMENT of type int
- FRONT: int = FRONT
- Constant FRONT of type int
- FRONT_DOWN: int = FRONT_DOWN
- Constant FRONT_DOWN of type int
- FRONT_DOWN_LEFT: int = FRONT_DOWN_LEFT
- Constant FRONT_DOWN_LEFT of type int
- FRONT_DOWN_RIGHT: int = FRONT_DOWN_RIGHT
- Constant FRONT_DOWN_RIGHT of type int
- FRONT_LEFT: int = FRONT_LEFT
- Constant FRONT_LEFT of type int
- FRONT_RIGHT: int = FRONT_RIGHT
- Constant FRONT_RIGHT of type int
- FRONT_UP: int = FRONT_UP
- Constant FRONT_UP of type int
- FRONT_UP_LEFT: int = FRONT_UP_LEFT
- Constant FRONT_UP_LEFT of type int
- FRONT_UP_RIGHT: int = FRONT_UP_RIGHT
- Constant FRONT_UP_RIGHT of type int
- LEFT: int = LEFT
- Constant LEFT of type int
- NULLLOC: int = NULLLOC
- Constant NULLLOC of type int
- RIGHT: int = RIGHT
- Constant RIGHT of type int
- UP: int = UP
- Constant UP of type int
- UP_LEFT: int = UP_LEFT
- Constant UP_LEFT of type int
- UP_RIGHT: int = UP_RIGHT
- Constant UP_RIGHT of type int
petsc4py.PETSc.DMStag.StencilType¶
- class petsc4py.PETSc.DMStag.StencilType
- Bases: object
Stencil types.
Attributes Summary
BOX Constant BOX of type int NONE Constant NONE of type int STAR Constant STAR of type int Attributes Documentation
- BOX: int = BOX
- Constant BOX of type int
- NONE: int = NONE
- Constant NONE of type int
- STAR: int = STAR
- Constant STAR of type int
Methods Summary
VecSplitToDMDA(vec, loc, c) | Return DMDA, Vec from a subgrid of a DMStag, its Vec. |
create(dim[, dofs, sizes, boundary_types, ...]) | Create a DMDA object. |
createCompatibleDMStag(dofs) | Create a compatible DMStag with different DOFs/stratum. |
get1dCoordinatecArrays() | Not implemented. |
getBoundaryTypes() | Return boundary types in each dimension. |
getCorners() | Return starting element index, width and number of partial elements. |
getDim() | Return the number of dimensions. |
getDof() | Get number of DOFs associated with each stratum of the grid. |
getEntriesPerElement() | Return the number of entries per element in the local representation. |
getGhostCorners() | Return starting element index and width of local region. |
getGlobalSizes() | Return global element counts in each dimension. |
getIsFirstRank() | Return whether this process is first in each dimension in the process grid. |
getIsLastRank() | Return whether this process is last in each dimension in the process grid. |
getLocalSizes() | Return local elementwise sizes in each dimension. |
getLocationDof(loc) | Return number of DOFs associated with a given point on the grid. |
getLocationSlot(loc, c) | Return index to use in accessing raw local arrays. |
getOwnershipRanges() | Return elements per process in each dimension. |
getProcSizes() | Return number of processes in each dimension. |
getProductCoordinateLocationSlot(loc) | Return slot for use with local product coordinate arrays. |
getStencilType() | Return elementwise ghost/halo stencil type. |
getStencilWidth() | Return elementwise stencil width. |
getVecArray(vec) | Not implemented. |
migrateVec(vec, dmTo, vecTo) | Transfer a vector between two DMStag objects. |
setBoundaryTypes(boundary_types) | Set the boundary types. |
setCoordinateDMType(dmtype) | Set the type to store coordinates. |
setDof(dofs) | Set DOFs/stratum. |
setGlobalSizes(sizes) | Set global element counts in each dimension. |
setOwnershipRanges(ranges) | Set elements per process in each dimension. |
setProcSizes(sizes) | Set the number of processes in each dimension in the global process grid. |
setStencilType(stenciltype) | Set elementwise ghost/halo stencil type. |
setStencilWidth(swidth) | Set elementwise stencil width. |
setUniformCoordinates([xmin, xmax, ymin, ...]) | Set the coordinates to be a uniform grid.. |
setUniformCoordinatesExplicit([xmin, xmax, ...]) | Set coordinates to be a uniform grid, storing all values. |
setUniformCoordinatesProduct([xmin, xmax, ...]) | Create uniform coordinates, as a product of 1D arrays. |
Attributes Summary
boundary_types | Boundary types in each dimension. |
corners | The lower left corner and size of local region in each dimension. |
dim | The dimension. |
dofs | The number of DOFs associated with each stratum of the grid. |
entries_per_element | The number of entries per element in the local representation. |
ghost_corners | The lower left corner and size of local region in each dimension. |
global_sizes | Global element counts in each dimension. |
local_sizes | Local elementwise sizes in each dimension. |
proc_sizes | The number of processes in each dimension in the global decomposition. |
stencil_type | Stencil type. |
stencil_width | Elementwise stencil width. |
Methods Documentation
- VecSplitToDMDA(vec, loc, c)
- Return DMDA, Vec from a subgrid of a DMStag, its
Vec.
Collective.
If a c value of -k is provided, the first k DOFs for that position are extracted, padding with zero values if needed. If a non-negative value is provided, a single DOF is extracted.
- vec (Vec) -- The Vec object.
- loc (StencilLocation) -- Which subgrid to extract.
- c (int) -- Which component to extract.
- Return type
- tuple[DMDA, Vec]
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:790
- create(dim, dofs=None, sizes=None, boundary_types=None, stencil_type=None, stencil_width=None, proc_sizes=None, ownership_ranges=None, comm=None, setUp=False)
- Create a DMDA object.
Collective.
Creates an object to manage data living on the elements and vertices / the elements, faces, and vertices / the elements, faces, edges, and vertices of a parallelized regular 1D / 2D / 3D grid.
- dim (int) -- The number of dimensions.
- dofs (tuple[int, ...] | None) -- The number of degrees of freedom per vertex, element (1D); vertex, face, element (2D); or vertex, edge, face, element (3D).
- sizes (tuple[int, ...] | None) -- The number of elements in each dimension.
- boundary_types (tuple[DM.BoundaryType | int | str | bool, ...] | None) -- The boundary types.
- stencil_type (StencilType | None) -- The ghost/halo stencil type.
- stencil_width (int | None) -- The width of the ghost/halo region.
- proc_sizes (tuple[int, ...] | None) -- The number of processes in x, y, z dimensions.
- ownership_ranges (tuple[Sequence[int], ...] | None) -- Local x, y, z element counts, of length equal to proc_sizes, summing to sizes.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- setUp (bool | None) -- Whether to call the setup routine after creating the object.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:50
- createCompatibleDMStag(dofs)
- Create a compatible DMStag with different DOFs/stratum.
Collective.
- Parameters
- dofs (tuple[int, ...]) -- The number of DOFs on the strata in the new DMStag.
- Return type
- DM
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:766
- get1dCoordinatecArrays()
- Not implemented.
Source code at petsc4py/PETSc/DMStag.pyx:832
- Return type
- None
- getBoundaryTypes()
- Return boundary types in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:478
- Return type
- tuple[str, ...]
- getCorners()
- Return starting element index, width and number of partial elements.
Not collective.
The returned value is calculated excluding ghost points.
The number of extra partial elements is either 1 or 0. The value is 1 on right, top, and front non-periodic domain ("physical") boundaries, in the x, y, and z dimensions respectively, and otherwise 0.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:363
- Return type
- tuple[tuple[int, ...], tuple[int, ...], tuple[int, ...]]
- getDim()
- Return the number of dimensions.
Not collective.
Source code at petsc4py/PETSc/DMStag.pyx:310
- Return type
- int
- getDof()
- Get number of DOFs associated with each stratum of the grid.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:348
- Return type
- tuple[int, ...]
- getEntriesPerElement()
- Return the number of entries per element in the local representation.
Not collective.
This is the natural block size for most local operations.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:318
- Return type
- int
- getGhostCorners()
- Return starting element index and width of local region.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:385
- Return type
- tuple[tuple[int, ...], tuple[int, ...]]
- getGlobalSizes()
- Return global element counts in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:417
- Return type
- tuple[int, ...]
- getIsFirstRank()
- Return whether this process is first in each dimension in the process
grid.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:496
- Return type
- tuple[int, ...]
- getIsLastRank()
- Return whether this process is last in each dimension in the process grid.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:512
- Return type
- tuple[int, ...]
- getLocalSizes()
- Return local elementwise sizes in each dimension.
Not collective.
The returned value is calculated excluding ghost points.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:400
- Return type
- tuple[int, ...]
- getLocationDof(loc)
- Return number of DOFs associated with a given point on the grid.
Not collective.
- Parameters
- loc (StencilLocation) -- The grid point.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:721
- getLocationSlot(loc, c)
- Return index to use in accessing raw local arrays.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:678
- getOwnershipRanges()
- Return elements per process in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:461
- Return type
- tuple[Sequence[int], ...]
- getProcSizes()
- Return number of processes in each dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:432
- Return type
- tuple[int, ...]
- getProductCoordinateLocationSlot(loc)
- Return slot for use with local product coordinate arrays.
Not collective.
- Parameters
- loc (StencilLocation) -- The grid location.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:701
- getStencilType()
- Return elementwise ghost/halo stencil type.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:447
- Return type
- str
- getStencilWidth()
- Return elementwise stencil width.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:334
- Return type
- int
- getVecArray(vec)
- Not implemented.
Source code at petsc4py/PETSc/DMStag.pyx:828
- Parameters
- vec (Vec)
- Return type
- None
- migrateVec(vec, dmTo, vecTo)
- Transfer a vector between two DMStag objects.
Collective.
Currently only implemented to migrate global vectors to global vectors.
- vec (Vec) -- The source vector.
- dmTo (DM) -- The compatible destination object.
- vecTo (Vec) -- The destination vector.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:743
- setBoundaryTypes(boundary_types)
- Set the boundary types.
Logically collective.
- Parameters
- boundary_types (tuple[BoundaryType | int | str | bool, ...]) -- Boundary types for one/two/three dimensions.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:201
- setCoordinateDMType(dmtype)
- Set the type to store coordinates.
Logically collective.
- Parameters
- dmtype (Type) -- The type to store coordinates.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:657
- setDof(dofs)
- Set DOFs/stratum.
Logically collective.
- Parameters
- dofs (tuple[int, ...]) -- The number of points per 0-cell (vertex/node), 1-cell (element in 1D, edge in 2D and 3D), 2-cell (element in 2D, face in 3D), or 3-cell (element in 3D).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:224
- setGlobalSizes(sizes)
- Set global element counts in each dimension.
Logically collective.
- Parameters
- sizes (tuple[int, ...]) -- Global elementwise size in the one/two/three dimensions.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:246
- setOwnershipRanges(ranges)
- Set elements per process in each dimension.
Logically collective.
- Parameters
- ranges (tuple[Sequence[int], ...]) -- Element counts for each process in one/two/three dimensions.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:286
- setProcSizes(sizes)
- Set the number of processes in each dimension in the global process grid.
Logically collective.
- Parameters
- sizes (tuple[int, ...]) -- Number of processes in one/two/three dimensions.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:266
- setStencilType(stenciltype)
- Set elementwise ghost/halo stencil type.
Logically collective.
- Parameters
- stenciltype (StencilType | str) -- The elementwise ghost stencil type.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:183
- setStencilWidth(swidth)
- Set elementwise stencil width.
Logically collective.
The width value is not used when StencilType.NONE is specified.
- Parameters
- swidth (int) -- Stencil/halo/ghost width in elements.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:163
- setUniformCoordinates(xmin=0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1)
- Set the coordinates to be a uniform grid..
Collective.
Local coordinates are populated, linearly extrapolated to ghost cells, including those outside the physical domain. This is also done in case of periodic boundaries, meaning that the same global point may have different coordinates in different local representations, which are equivalent assuming a periodicity implied by the arguments to this function, i.e., two points are equivalent if their difference is a multiple of xmax-xmin in the x dimension, ymax-ymin in the y dimension, and zmax-zmin in the z dimension.
- xmin (float) -- The minimum global coordinate value in the x dimension.
- xmax (float) -- The maximum global coordinate value in the x dimension.
- ymin (float) -- The minimum global coordinate value in the y dimension.
- ymax (float) -- The maximum global coordinate value in the y dimension.
- zmin (float) -- The minimum global coordinate value in the z dimension.
- zmax (float) -- The maximum global coordinate value in the z dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:610
- setUniformCoordinatesExplicit(xmin=0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1)
- Set coordinates to be a uniform grid, storing all values.
Collective.
- xmin (float) -- The minimum global coordinate value in the x dimension.
- xmax (float) -- The maximum global coordinate value in the x dimension.
- ymin (float) -- The minimum global coordinate value in the y dimension.
- ymax (float) -- The maximum global coordinate value in the y dimension.
- zmin (float) -- The minimum global coordinate value in the z dimension.
- zmax (float) -- The maximum global coordinate value in the z dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:530
- setUniformCoordinatesProduct(xmin=0, xmax=1, ymin=0, ymax=1, zmin=0, zmax=1)
- Create uniform coordinates, as a product of 1D arrays.
Collective.
The per-dimension 1-dimensional DMStag objects that comprise the product always have active 0-cells (vertices, element boundaries) and 1-cells (element centers).
- xmin (float) -- The minimum global coordinate value in the x dimension.
- xmax (float) -- The maximum global coordinate value in the x dimension.
- ymin (float) -- The minimum global coordinate value in the y dimension.
- ymax (float) -- The maximum global coordinate value in the y dimension.
- zmin (float) -- The minimum global coordinate value in the z dimension.
- zmax (float) -- The maximum global coordinate value in the z dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMStag.pyx:568
Attributes Documentation
- boundary_types
- Boundary types in each dimension.
Source code at petsc4py/PETSc/DMStag.pyx:866
- corners
- The lower left corner and size of local region in each dimension.
Source code at petsc4py/PETSc/DMStag.pyx:881
- dim
- The dimension.
Source code at petsc4py/PETSc/DMStag.pyx:836
- dofs
- The number of DOFs associated with each stratum of the grid.
Source code at petsc4py/PETSc/DMStag.pyx:841
- entries_per_element
- The number of entries per element in the local representation.
Source code at petsc4py/PETSc/DMStag.pyx:846
- ghost_corners
- The lower left corner and size of local region in each dimension.
Source code at petsc4py/PETSc/DMStag.pyx:886
- global_sizes
- Global element counts in each dimension.
Source code at petsc4py/PETSc/DMStag.pyx:851
- local_sizes
- Local elementwise sizes in each dimension.
Source code at petsc4py/PETSc/DMStag.pyx:856
- proc_sizes
- The number of processes in each dimension in the global decomposition.
Source code at petsc4py/PETSc/DMStag.pyx:861
- stencil_type
- Stencil type.
Source code at petsc4py/PETSc/DMStag.pyx:871
- stencil_width
- Elementwise stencil width.
Source code at petsc4py/PETSc/DMStag.pyx:876
petsc4py.PETSc.DMSwarm¶
- class petsc4py.PETSc.DMSwarm
- Bases: DM
A DM object used to represent arrays of data (fields) of arbitrary type.
Enumerations
CollectType Swarm collection types. MigrateType Swarm migration types. PICLayoutType Swarm PIC layout types. Type Swarm types.
petsc4py.PETSc.DMSwarm.CollectType¶
- class petsc4py.PETSc.DMSwarm.CollectType
- Bases: object
Swarm collection types.
Attributes Summary
COLLECT_BASIC Constant COLLECT_BASIC of type int COLLECT_DMDABOUNDINGBOX Constant COLLECT_DMDABOUNDINGBOX of type int COLLECT_GENERAL Constant COLLECT_GENERAL of type int COLLECT_USER Constant COLLECT_USER of type int Attributes Documentation
- COLLECT_BASIC: int = COLLECT_BASIC
- Constant COLLECT_BASIC of type int
- COLLECT_DMDABOUNDINGBOX: int = COLLECT_DMDABOUNDINGBOX
- Constant COLLECT_DMDABOUNDINGBOX of type int
- COLLECT_GENERAL: int = COLLECT_GENERAL
- Constant COLLECT_GENERAL of type int
- COLLECT_USER: int = COLLECT_USER
- Constant COLLECT_USER of type int
petsc4py.PETSc.DMSwarm.MigrateType¶
- class petsc4py.PETSc.DMSwarm.MigrateType
- Bases: object
Swarm migration types.
Attributes Summary
MIGRATE_BASIC Constant MIGRATE_BASIC of type int MIGRATE_DMCELLEXACT Constant MIGRATE_DMCELLEXACT of type int MIGRATE_DMCELLNSCATTER Constant MIGRATE_DMCELLNSCATTER of type int MIGRATE_USER Constant MIGRATE_USER of type int Attributes Documentation
- MIGRATE_BASIC: int = MIGRATE_BASIC
- Constant MIGRATE_BASIC of type int
- MIGRATE_DMCELLEXACT: int = MIGRATE_DMCELLEXACT
- Constant MIGRATE_DMCELLEXACT of type int
- MIGRATE_DMCELLNSCATTER: int = MIGRATE_DMCELLNSCATTER
- Constant MIGRATE_DMCELLNSCATTER of type int
- MIGRATE_USER: int = MIGRATE_USER
- Constant MIGRATE_USER of type int
petsc4py.PETSc.DMSwarm.PICLayoutType¶
- class petsc4py.PETSc.DMSwarm.PICLayoutType
- Bases: object
Swarm PIC layout types.
Attributes Summary
LAYOUT_GAUSS Constant LAYOUT_GAUSS of type int LAYOUT_REGULAR Constant LAYOUT_REGULAR of type int LAYOUT_SUBDIVISION Constant LAYOUT_SUBDIVISION of type int Attributes Documentation
- LAYOUT_GAUSS: int = LAYOUT_GAUSS
- Constant LAYOUT_GAUSS of type int
- LAYOUT_REGULAR: int = LAYOUT_REGULAR
- Constant LAYOUT_REGULAR of type int
- LAYOUT_SUBDIVISION: int = LAYOUT_SUBDIVISION
- Constant LAYOUT_SUBDIVISION of type int
petsc4py.PETSc.DMSwarm.Type¶
- class petsc4py.PETSc.DMSwarm.Type
- Bases: object
Swarm types.
Attributes Summary
BASIC Constant BASIC of type int PIC Constant PIC of type int Attributes Documentation
- BASIC: int = BASIC
- Constant BASIC of type int
- PIC: int = PIC
- Constant PIC of type int
Methods Summary
addNPoints(npoints) | Add space for a number of new points in the DMSwarm. |
addPoint() | Add space for one new point in the DMSwarm. |
collectViewCreate() | Apply a collection method and gather points in neighbor ranks. |
collectViewDestroy() | Reset the DMSwarm to the size prior to calling collectViewCreate. |
copyPoint(pi, pj) | Copy point pi to point pj in the DMSwarm. |
create([comm]) | Create an empty DM object and set its type to DM.Type.SWARM. |
createGlobalVectorFromField(fieldname) | Create a global Vec object associated with a given field. |
createLocalVectorFromField(fieldname) | Create a local Vec object associated with a given field. |
destroyGlobalVectorFromField(fieldname) | Destroy the global Vec object associated with a given field. |
destroyLocalVectorFromField(fieldname) | Destroy the local Vec object associated with a given field. |
finalizeFieldRegister() | Finalize the registration of fields to a DMSwarm. |
getCellDM() | Return DM cell attached to DMSwarm. |
getField(fieldname) | Return arrays storing all entries associated with a field. |
getLocalSize() | Return the local length of fields registered. |
getSize() | Return the total length of fields registered. |
initializeFieldRegister() | Initiate the registration of fields to a DMSwarm. |
insertPointUsingCellDM(layoutType, fill_param) | Insert point coordinates within each cell. |
migrate([remove_sent_points]) | Relocate points defined in the DMSwarm to other MPI ranks. |
projectFields(dm, fieldnames, vecs[, mode]) | Project a set of DMSwarm fields onto the cell DM. |
registerField(fieldname, blocksize[, dtype]) | Register a field to a DMSwarm with a native PETSc data type. |
removePoint() | Remove the last point from the DMSwarm. |
removePointAtIndex(index) | Remove a specific point from the DMSwarm. |
restoreField(fieldname) | Restore accesses associated with a registered field. |
setCellDM(dm) | Attach a DM to a DMSwarm. |
setLocalSizes(nlocal, buffer) | Set the length of all registered fields on the DMSwarm. |
setPointCoordinates(coordinates[, ...]) | Set point coordinates in a DMSwarm from a user-defined list. |
setPointCoordinatesCellwise(coordinates) | Insert point coordinates within each cell. |
setPointsUniformCoordinates(min, max, npoints) | Set point coordinates in a DMSwarm on a regular (ijk) grid. |
setType(dmswarm_type) | Set particular flavor of DMSwarm. |
sortGetAccess() | Setup up a DMSwarm point sort context. |
sortGetIsValid() | Return whether the sort context is up-to-date. |
sortGetNumberOfPointsPerCell(e) | Return the number of points in a cell. |
sortGetPointsPerCell(e) | Create an array of point indices for all points in a cell. |
sortGetSizes() | Return the sizes associated with a DMSwarm point sorting context. |
sortRestoreAccess() | Invalidate the DMSwarm point sorting context. |
vectorDefineField(fieldname) | Set the field from which to define a Vec object. |
viewFieldsXDMF(filename, fieldnames) | Write a selection of DMSwarm fields to an XDMF3 file. |
viewXDMF(filename) | Write this DMSwarm fields to an XDMF3 file. |
Methods Documentation
- addNPoints(npoints)
- Add space for a number of new points in the DMSwarm.
Not collective.
- Parameters
- npoints (int) -- The number of new points to add.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:329
- addPoint()
- Add space for one new point in the DMSwarm.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:317
- Return type
- None
- collectViewCreate()
- Apply a collection method and gather points in neighbor ranks.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:445
- Return type
- None
- collectViewDestroy()
- Reset the DMSwarm to the size prior to calling
collectViewCreate.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:457
- Return type
- None
- copyPoint(pi, pj)
- Copy point pi to point pj in the DMSwarm.
Not collective.
- pi (int) -- The index of the point to copy (source).
- pj (int) -- The point index where the copy should be located (destination).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:377
- create(comm=None)
- Create an empty DM object and set its type to DM.Type.SWARM.
Collective.
DMs are the abstract objects in PETSc that mediate between meshes and discretizations and the algebraic solvers, time integrators, and optimization algorithms.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:39
- createGlobalVectorFromField(fieldname)
- Create a global Vec object associated with a given field.
Collective.
The vector must be returned to the DMSwarm using a matching call to destroyGlobalVectorFromField.
- Parameters
- fieldname (str) -- The textual name given to a registered field.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:65
- createLocalVectorFromField(fieldname)
- Create a local Vec object associated with a given field.
Collective.
The vector must be returned to the DMSwarm using a matching call to destroyLocalVectorFromField.
- Parameters
- fieldname (str) -- The textual name given to a registered field.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:109
- destroyGlobalVectorFromField(fieldname)
- Destroy the global Vec object associated with a given field.
Collective.
- Parameters
- fieldname (str) -- The textual name given to a registered field.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:89
- destroyLocalVectorFromField(fieldname)
- Destroy the local Vec object associated with a given field.
Collective.
- Parameters
- fieldname (str) -- The textual name given to a registered field.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:133
- finalizeFieldRegister()
- Finalize the registration of fields to a DMSwarm.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:167
- Return type
- None
- getCellDM()
- Return DM cell attached to DMSwarm.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:486
- Return type
- DM
- getField(fieldname)
- Return arrays storing all entries associated with a field.
Not collective.
The returned array contains underlying values of the field.
The array must be returned to the DMSwarm using a matching call to restoreField.
- Parameters
- fieldname (str) -- The textual name to identify this field.
- Returns
- The type of the entries in the array will match the type of the field.
- Return type
- numpy.ndarray
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:231
- getLocalSize()
- Return the local length of fields registered.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:398
- Return type
- int
- getSize()
- Return the total length of fields registered.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:412
- Return type
- int
- initializeFieldRegister()
- Initiate the registration of fields to a DMSwarm.
Collective.
After all fields have been registered, you must call finalizeFieldRegister.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:153
- Return type
- None
- insertPointUsingCellDM(layoutType, fill_param)
- Insert point coordinates within each cell.
Not collective.
- layout_type -- Method used to fill each cell with the cell DM.
- fill_param (int) -- Parameter controlling how many points per cell are added (the meaning of this parameter is dependent on the layout type).
- layoutType (PICLayoutType)
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:601
- migrate(remove_sent_points=False)
- Relocate points defined in the DMSwarm to other MPI ranks.
Collective.
- Parameters
- remove_sent_points (bool) -- Flag indicating if sent points should be removed from the current MPI rank.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:426
- projectFields(dm, fieldnames, vecs, mode=None)
- Project a set of DMSwarm fields onto the cell DM.
Collective.
- dm (DM) -- The continuum DM.
- fieldnames (Sequence[str]) -- The textual names of the swarm fields to project.
- vecs (Sequence[Vec])
- mode (ScatterModeSpec)
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:810
- registerField(fieldname, blocksize, dtype=ScalarType)
- Register a field to a DMSwarm with a native PETSc data type.
Collective.
- fieldname (str) -- The textual name to identify this field.
- blocksize (int) -- The number of each data type.
- dtype (dtype) -- A valid PETSc data type.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:201
- removePoint()
- Remove the last point from the DMSwarm.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:347
- Return type
- None
- removePointAtIndex(index)
- Remove a specific point from the DMSwarm.
Not collective.
- Parameters
- index (int) -- Index of point to remove
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:359
- restoreField(fieldname)
- Restore accesses associated with a registered field.
Not collective.
- Parameters
- fieldname (str) -- The textual name to identify this field.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:274
- setCellDM(dm)
- Attach a DM to a DMSwarm.
Collective.
- Parameters
- dm (DM) -- The DM to attach to the DMSwarm.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:469
- setLocalSizes(nlocal, buffer)
- Set the length of all registered fields on the DMSwarm.
Not collective.
- nlocal (int) -- The length of each registered field.
- buffer (int) -- The length of the buffer used for efficient dynamic resizing.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:179
- setPointCoordinates(coordinates, redundant=False, mode=None)
- Set point coordinates in a DMSwarm from a user-defined list.
Collective.
- coordinates (Sequence[float]) -- The coordinate values.
- redundant (bool) -- If set to True, it is assumed that coordinates are only valid on rank 0 and should be broadcast to other ranks.
- mode (InsertMode | None) -- Indicates whether to append points to the swarm (InsertMode.ADD), or override existing points (InsertMode.INSERT).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:565
- setPointCoordinatesCellwise(coordinates)
- Insert point coordinates within each cell.
Not collective.
Point coordinates are defined over the reference cell.
- Parameters
- coordinates (Sequence[float]) -- The coordinates (defined in the local coordinate system for each cell) to insert.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:623
- setPointsUniformCoordinates(min, max, npoints, mode=None)
- Set point coordinates in a DMSwarm on a regular (ijk) grid.
Collective.
- min (Sequence[float]) -- Minimum coordinate values in the x, y, z directions (array of length dim).
- max (Sequence[float]) -- Maximum coordinate values in the x, y, z directions (array of length dim).
- npoints (Sequence[int]) -- Number of points in each spatial direction (array of length dim).
- mode (InsertMode | None) -- Indicates whether to append points to the swarm (InsertMode.ADD), or override existing points (InsertMode.INSERT).
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:521
- setType(dmswarm_type)
- Set particular flavor of DMSwarm.
Collective.
- Parameters
- dmswarm_type (Type | str) -- The DMSwarm type.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:503
- sortGetAccess()
- Setup up a DMSwarm point sort context.
Not collective.
The point sort context is used for efficient traversal of points within a cell.
You must call sortRestoreAccess when you no longer need access to the sort context.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:698
- Return type
- None
- sortGetIsValid()
- Return whether the sort context is up-to-date.
Not collective.
Returns the flag associated with a DMSwarm point sorting context.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:772
- Return type
- bool
- sortGetNumberOfPointsPerCell(e)
- Return the number of points in a cell.
Not collective.
- Parameters
- e (int) -- The index of the cell.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:752
- sortGetPointsPerCell(e)
- Create an array of point indices for all points in a cell.
Not collective.
- Parameters
- e (int) -- The index of the cell.
- Return type
- list[int]
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:728
- sortGetSizes()
- Return the sizes associated with a DMSwarm point sorting context.
Not collective.
- ncells (int) -- Number of cells within the sort context.
- npoints (int) -- Number of points used to create the sort context.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:788
- sortRestoreAccess()
- Invalidate the DMSwarm point sorting context.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:716
- Return type
- None
- vectorDefineField(fieldname)
- Set the field from which to define a Vec object.
Collective.
The field will be used when DM.createLocalVec, or DM.createGlobalVec is called.
- Parameters
- fieldname (str) -- The textual name given to a registered field.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:295
- viewFieldsXDMF(filename, fieldnames)
- Write a selection of DMSwarm fields to an XDMF3 file.
Collective.
- filename (str) -- The file name of the XDMF file (must have the extension .xmf).
- fieldnames (Sequence[str]) -- Array containing the textual names of fields to write.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:650
- viewXDMF(filename)
- Write this DMSwarm fields to an XDMF3 file.
Collective.
- Parameters
- filename (str) -- The file name of the XDMF file (must have the extension .xmf).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DMSwarm.pyx:679
petsc4py.PETSc.DS¶
- class petsc4py.PETSc.DS
- Bases: Object
Discrete System object.
Enumerations
Type The Discrete System types.
petsc4py.PETSc.DS.Type¶
- class petsc4py.PETSc.DS.Type
- Bases: object
The Discrete System types.
Attributes Summary
BASIC Object BASIC of type str Attributes Documentation
- BASIC: str = BASIC
- Object BASIC of type str
Methods Summary
create([comm]) | Create an empty DS. |
destroy() | Destroy the discrete system. |
getComponents() | Return the number of components for each field on an evaluation point. |
getCoordinateDimension() | Return the coordinate dimension of the DS. |
getDimensions() | Return the size of the space for each field on an evaluation point. |
getFieldIndex(disc) | Return the index of the given field. |
getNumFields() | Return the number of fields in the DS. |
getSpatialDimension() | Return the spatial dimension of the DS. |
getTotalComponents() | Return the total number of components in this system. |
getTotalDimensions() | Return the total size of the approximation space for this system. |
getType() | Return the type of the discrete system. |
setDiscretisation(f, disc) | Set the discretization object for the given field. |
setFromOptions() | Set parameters in a DS from the options database. |
setType(ds_type) | Build a particular type of a discrete system. |
setUp() | Construct data structures for the discrete system. |
view([viewer]) | View a discrete system. |
Methods Documentation
- create(comm=None)
- Create an empty DS.
Collective.
The type can then be set with setType.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:53
- destroy()
- Destroy the discrete system.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:40
- Return type
- Self
- getComponents()
- Return the number of components for each field on an evaluation point.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:246
- Return type
- ArrayInt
- getCoordinateDimension()
- Return the coordinate dimension of the DS.
Not collective.
The coordinate dimension of the DS is the dimension of the space into which the discretiaztions are embedded.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:153
- Return type
- int
- getDimensions()
- Return the size of the space for each field on an evaluation point.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:231
- Return type
- ArrayInt
- getFieldIndex(disc)
- Return the index of the given field.
Not collective.
- Parameters
- disc (Object) -- The discretization object.
- Return type
- int
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:184
- getNumFields()
- Return the number of fields in the DS.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:170
- Return type
- int
- getSpatialDimension()
- Return the spatial dimension of the DS.
Not collective.
The spatial dimension of the DS is the topological dimension of the discretizations.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:136
- Return type
- int
- getTotalComponents()
- Return the total number of components in this system.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:217
- Return type
- int
- getTotalDimensions()
- Return the total size of the approximation space for this system.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:203
- Return type
- int
- getType()
- Return the type of the discrete system.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:95
- Return type
- str
- setDiscretisation(f, disc)
- Set the discretization object for the given field.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:261
- setFromOptions()
- Set parameters in a DS from the options database.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:109
- Return type
- None
- setType(ds_type)
- Build a particular type of a discrete system.
Collective.
- Parameters
- ds_type (Type | str) -- The type of the discrete system.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:76
- setUp()
- Construct data structures for the discrete system.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:121
- Return type
- Self
- view(viewer=None)
- View a discrete system.
Collective.
- Parameters
- viewer (Viewer | None) -- A Viewer to display the system.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/DS.pyx:21
petsc4py.PETSc.Device¶
- class petsc4py.PETSc.Device
- Bases: object
The device object.
Represents a handle to an accelerator (which may be the host).
SEE ALSO:
Enumerations
Type | The type of device. |
petsc4py.PETSc.Device.Type¶
- class petsc4py.PETSc.Device.Type
- Bases: object
The type of device.
SEE ALSO:
Attributes Summary
CUDA | Constant CUDA of type int |
DEFAULT | Constant DEFAULT of type int |
HIP | Constant HIP of type int |
HOST | Constant HOST of type int |
SYCL | Constant SYCL of type int |
Attributes Documentation
- CUDA: int = CUDA
- Constant CUDA of type int
- DEFAULT: int = DEFAULT
- Constant DEFAULT of type int
- HIP: int = HIP
- Constant HIP of type int
- HOST: int = HOST
- Constant HOST of type int
- SYCL: int = SYCL
- Constant SYCL of type int
Methods Summary
configure() | Configure and setup a device object. |
create([dtype, device_id]) | Create a device object. |
destroy() | Destroy a device object. |
getDeviceId() | Return the device id. |
getDeviceType() | Return the type of the device. |
setDefaultType(device_type) | Set the device type to be used as the default in subsequent calls to create. |
view([viewer]) | View a device object. |
Attributes Summary
device_id | The device id. |
type | The device type. |
Methods Documentation
- configure()
- Configure and setup a device object.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:132
- Return type
- None
- classmethod create(dtype=None, device_id=DECIDE)
- Create a device object.
Not collective.
- dtype (Type | None) -- The type of device to create (or None for the default).
- device_id (int) -- The numeric id of the device to create.
- Return type
- Device
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:94
- destroy()
- Destroy a device object.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:120
- Return type
- None
- getDeviceId()
- Return the device id.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:180
- Return type
- int
- getDeviceType()
- Return the type of the device.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:165
- Return type
- str
- static setDefaultType(device_type)
- Set the device type to be used as the default in subsequent calls to
create.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:195
- Parameters
- device_type (Type | str)
- Return type
- None
- view(viewer=None)
- View a device object.
Collective.
- Parameters
- viewer (Viewer | None) -- A Viewer instance or None for the default viewer.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:144
Attributes Documentation
- device_id
- The device id.
Source code at petsc4py/PETSc/Device.pyx:215
- type
- The device type.
Source code at petsc4py/PETSc/Device.pyx:210
petsc4py.PETSc.DeviceContext¶
- class petsc4py.PETSc.DeviceContext
- Bases: Object
DeviceContext object.
Represents an abstract handle to a device context.
SEE ALSO:
Enumerations
DeviceJoinMode | The type of join to perform. |
StreamType | The type of stream. |
petsc4py.PETSc.DeviceContext.DeviceJoinMode¶
- class petsc4py.PETSc.DeviceContext.DeviceJoinMode
- Bases: object
The type of join to perform.
SEE ALSO:
Attributes Summary
DESTROY | Constant DESTROY of type int |
NO_SYNC | Constant NO_SYNC of type int |
SYNC | Constant SYNC of type int |
Attributes Documentation
- DESTROY: int = DESTROY
- Constant DESTROY of type int
- NO_SYNC: int = NO_SYNC
- Constant NO_SYNC of type int
- SYNC: int = SYNC
- Constant SYNC of type int
petsc4py.PETSc.DeviceContext.StreamType¶
- class petsc4py.PETSc.DeviceContext.StreamType
- Bases: object
The type of stream.
SEE ALSO:
Attributes Summary
DEFAULT | Constant DEFAULT of type int |
DEFAULT_WITH_BARRIER | Constant DEFAULT_WITH_BARRIER of type int |
NONBLOCKING | Constant NONBLOCKING of type int |
NONBLOCKING_WITH_BARRIER | Constant NONBLOCKING_WITH_BARRIER of type int |
Attributes Documentation
- DEFAULT: int = DEFAULT
- Constant DEFAULT of type int
- DEFAULT_WITH_BARRIER: int = DEFAULT_WITH_BARRIER
- Constant DEFAULT_WITH_BARRIER of type int
- NONBLOCKING: int = NONBLOCKING
- Constant NONBLOCKING of type int
- NONBLOCKING_WITH_BARRIER: int = NONBLOCKING_WITH_BARRIER
- Constant NONBLOCKING_WITH_BARRIER of type int
Methods Summary
create() | Create an empty DeviceContext. |
destroy() | Destroy a device context. |
duplicate() | Duplicate a the device context. |
fork(n[, stream_type]) | Create multiple device contexts which are all logically dependent on this one. |
getCurrent() | Return the current device context. |
getDevice() | Get the Device which this instance is attached to. |
getStreamType() | Return the StreamType. |
idle() | Return whether the underlying stream for the device context is idle. |
join(join_mode, py_sub_ctxs) | Join a set of device contexts on this one. |
setCurrent(dctx) | Set the current device context. |
setDevice(device) | Set the Device which this DeviceContext is attached to. |
setFromOptions([comm]) | Configure the DeviceContext from the options database. |
setStreamType(stream_type) | Set the StreamType. |
setUp() | Set up the internal data structures for using the device context. |
synchronize() | Synchronize a device context. |
waitFor(other) | Make this instance wait for other. |
Attributes Summary
current | The current global device context. |
device | The device associated to the device context. |
stream_type | The stream type. |
Methods Documentation
- create()
- Create an empty DeviceContext.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:240
- Return type
- Self
- destroy()
- Destroy a device context.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:255
- Return type
- Self
- duplicate()
- Duplicate a the device context.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:348
- Return type
- DeviceContext
- fork(n, stream_type=None)
- Create multiple device contexts which are all logically dependent on this
one.
Not collective.
- n (int) -- The number of device contexts to create.
- stream_type (StreamType | str | None) -- The type of stream of the forked device context.
- Return type
- list[DeviceContext]
Examples
The device contexts created must be destroyed using join.
>>> dctx = PETSc.DeviceContext().getCurrent() >>> dctxs = dctx.fork(4) >>> ... # perform computations >>> # we can mix various join modes >>> dctx.join(PETSc.DeviceContext.JoinMode.SYNC, dctxs[0:2]) >>> dctx.join(PETSc.DeviceContext.JoinMode.SYNC, dctxs[2:]) >>> ... # some more computations and joins >>> # dctxs must be all destroyed with joinMode.DESTROY >>> dctx.join(PETSc.DeviceContext.JoinMode.DESTROY, dctxs)
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:399
- static getCurrent()
- Return the current device context.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:519
- Return type
- DeviceContext
- getDevice()
- Get the Device which this instance is attached to.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:302
- Return type
- Device
- getStreamType()
- Return the StreamType.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:268
- Return type
- str
- idle()
- Return whether the underlying stream for the device context is idle.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:363
- Return type
- bool
- join(join_mode, py_sub_ctxs)
- Join a set of device contexts on this one.
Not collective.
- join_mode (DeviceJoinMode | str) -- The type of join to perform.
- py_sub_ctxs (list[DeviceContext]) -- The list of device contexts to join.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:448
- static setCurrent(dctx)
- Set the current device context.
Not collective.
- Parameters
- dctx (DeviceContext | None) -- The DeviceContext to set as current (or None to use the default context).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:535
- setDevice(device)
- Set the Device which this DeviceContext is attached to.
Collective.
- Parameters
- device (Device) -- The Device to which this instance is attached to.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:317
- setFromOptions(comm=None)
- Configure the DeviceContext from the options database.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:500
- setStreamType(stream_type)
- Set the StreamType.
Not collective.
- Parameters
- stream_type (StreamType | str) -- The type of stream to set
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:283
- setUp()
- Set up the internal data structures for using the device context.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:336
- Return type
- None
- synchronize()
- Synchronize a device context.
Not collective.
Notes
The underlying stream is considered idle after this routine returns, i.e. idle will return True.
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:483
- Return type
- None
- waitFor(other)
- Make this instance wait for other.
Not collective.
- Parameters
- other (DeviceContext | None) -- The other DeviceContext to wait for
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Device.pyx:378
Attributes Documentation
- current
- The current global device context.
Source code at petsc4py/PETSc/Device.pyx:574
- device
- The device associated to the device context.
Source code at petsc4py/PETSc/Device.pyx:566
- stream_type
- The stream type.
Source code at petsc4py/PETSc/Device.pyx:558
petsc4py.PETSc.DualSpace¶
- class petsc4py.PETSc.DualSpace
- Bases: Object
Dual space to a linear space.
Enumerations
Type The dual space types.
petsc4py.PETSc.DualSpace.Type¶
- class petsc4py.PETSc.DualSpace.Type
- Bases: object
The dual space types.
Attributes Summary
BDM Object BDM of type str LAGRANGE Object LAGRANGE of type str REFINED Object REFINED of type str SIMPLE Object SIMPLE of type str Attributes Documentation
- BDM: str = BDM
- Object BDM of type str
- LAGRANGE: str = LAGRANGE
- Object LAGRANGE of type str
- REFINED: str = REFINED
- Object REFINED of type str
- SIMPLE: str = SIMPLE
- Object SIMPLE of type str
Methods Summary
create([comm]) | Create an empty DualSpace object. |
destroy() | Destroy the DualSpace object. |
duplicate() | Create a duplicate DualSpace object that is not set up. |
getDM() | Return the DM representing the reference cell of a DualSpace. |
getDimension() | Return the dimension of the dual space. |
getFunctional(i) | Return the i-th basis functional in the dual space. |
getInteriorDimension() | Return the interior dimension of the dual space. |
getLagrangeContinuity() | Return whether the element is continuous. |
getLagrangeTensor() | Return the tensor nature of the dual space. |
getLagrangeTrimmed() | Return the trimmed nature of the dual space. |
getNumComponents() | Return the number of components for this space. |
getNumDof() | Return the number of degrees of freedom for each spatial dimension. |
getOrder() | Return the order of the dual space. |
getType() | Return the type of the dual space object. |
setDM(dm) | Set the DM representing the reference cell. |
setLagrangeContinuity(continuous) | Indicate whether the element is continuous. |
setLagrangeTensor(tensor) | Set the tensor nature of the dual space. |
setLagrangeTrimmed(trimmed) | Set the trimmed nature of the dual space. |
setNumComponents(nc) | Set the number of components for this space. |
setOrder(order) | Set the order of the dual space. |
setSimpleDimension(dim) | Set the number of functionals in the dual space basis. |
setSimpleFunctional(func, functional) | Set the given basis element for this dual space. |
setType(dualspace_type) | Build a particular type of dual space. |
setUp() | Construct a basis for a DualSpace. |
view([viewer]) | View a DualSpace. |
Methods Documentation
- create(comm=None)
- Create an empty DualSpace object.
Collective.
The type can then be set with setType.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:593
- destroy()
- Destroy the DualSpace object.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:635
- Return type
- Self
- duplicate()
- Create a duplicate DualSpace object that is not set up.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:648
- Return type
- DualSpace
- getDM()
- Return the DM representing the reference cell of a
DualSpace.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:661
- Return type
- DM
- getDimension()
- Return the dimension of the dual space.
Not collective.
The dimension of the dual space, i.e. the number of basis functionals.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:692
- Return type
- int
- getFunctional(i)
- Return the i-th basis functional in the dual space.
Not collective.
- Parameters
- i (int) -- The basis number.
- Return type
- Quad
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:822
- getInteriorDimension()
- Return the interior dimension of the dual space.
Not collective.
The interior dimension of the dual space, i.e. the number of basis functionals assigned to the interior of the reference domain.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:842
- Return type
- int
- getLagrangeContinuity()
- Return whether the element is continuous.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:859
- Return type
- bool
- getLagrangeTensor()
- Return the tensor nature of the dual space.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:891
- Return type
- bool
- getLagrangeTrimmed()
- Return the trimmed nature of the dual space.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:923
- Return type
- bool
- getNumComponents()
- Return the number of components for this space.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:708
- Return type
- int
- getNumDof()
- Return the number of degrees of freedom for each spatial dimension.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:806
- Return type
- ArrayInt
- getOrder()
- Return the order of the dual space.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:774
- Return type
- int
- getType()
- Return the type of the dual space object.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:740
- Return type
- str
- setDM(dm)
- Set the DM representing the reference cell.
Not collective.
- Parameters
- dm (DM) -- The reference cell.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:675
- setLagrangeContinuity(continuous)
- Indicate whether the element is continuous.
Not collective.
- Parameters
- continuous (bool) -- The flag for element continuity.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:873
- setLagrangeTensor(tensor)
- Set the tensor nature of the dual space.
Not collective.
- Parameters
- tensor (bool) -- Whether the dual space has tensor layout (vs. simplicial).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:905
- setLagrangeTrimmed(trimmed)
- Set the trimmed nature of the dual space.
Not collective.
- Parameters
- trimmed (bool) -- Whether the dual space represents to dual basis of a trimmed polynomial space (e.g. Raviart-Thomas and higher order / other form degree variants).
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:937
- setNumComponents(nc)
- Set the number of components for this space.
Logically collective.
- Parameters
- nc (int) -- The number of components
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:722
- setOrder(order)
- Set the order of the dual space.
Not collective.
- Parameters
- order (int) -- The order.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:788
- setSimpleDimension(dim)
- Set the number of functionals in the dual space basis.
Logically collective.
- Parameters
- dim (int) -- The basis dimension.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:957
- setSimpleFunctional(func, functional)
- Set the given basis element for this dual space.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:975
- setType(dualspace_type)
- Build a particular type of dual space.
Collective.
- Parameters
- dualspace_type (Type | str) -- The kind of space.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:754
- setUp()
- Construct a basis for a DualSpace.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:581
- Return type
- None
- view(viewer=None)
- View a DualSpace.
Collective.
- Parameters
- viewer (Viewer | None) -- A Viewer to display the DualSpace.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/Space.pyx:616
petsc4py.PETSc.FE¶
- class petsc4py.PETSc.FE
- Bases: Object
A PETSc object that manages a finite element space.
Enumerations
Type The finite element types.
petsc4py.PETSc.FE.Type¶
- class petsc4py.PETSc.FE.Type
- Bases: object
The finite element types.
Attributes Summary
BASIC Object BASIC of type str COMPOSITE Object COMPOSITE of type str OPENCL Object OPENCL of type str Attributes Documentation
- BASIC: str = BASIC
- Object BASIC of type str
- COMPOSITE: str = COMPOSITE
- Object COMPOSITE of type str
- OPENCL: str = OPENCL
- Object OPENCL of type str
Methods Summary
create([comm]) | Create an empty FE object. |
createDefault(dim, nc, isSimplex[, qorder, ...]) | Create a FE for basic FEM computation. |
createLagrange(dim, nc, isSimplex, k[, ...]) | Create a FE for the basic Lagrange space of degree k. |
destroy() | Destroy the FE object. |
getBasisSpace() | Return the Space used for the approximation of the FE solution. |
getDimension() | Return the dimension of the finite element space on a cell. |
getDualSpace() | Return the DualSpace used to define the inner product for the FE. |
getFaceQuadrature() | Return the Quad used to calculate inner products on faces. |
getNumComponents() | Return the number of components in the element. |
getNumDof() | Return the number of DOFs. |
getQuadrature() | Return the Quad used to calculate inner products. |
getSpatialDimension() | Return the spatial dimension of the element. |
getTileSizes() | Return the tile sizes for evaluation. |
setBasisSpace(sp) | Set the Space used for the approximation of the solution. |
setDualSpace(dspace) | Set the DualSpace used to define the inner product. |
setFaceQuadrature(quad) | Set the Quad used to calculate inner products on faces. |
setFromOptions() | Set parameters in a FE from the options database. |
setNumComponents(comp) | Set the number of field components in the element. |
setQuadrature(quad) | Set the Quad used to calculate inner products. |
setTileSizes(blockSize, numBlocks, ...) | Set the tile sizes for evaluation. |
setType(fe_type) | Build a particular FE. |
setUp() | Construct data structures for the FE after the Type has been set. |
view([viewer]) | View a FE object. |
Methods Documentation
- create(comm=None)
- Create an empty FE object.
Collective.
The type can then be set with setType.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:53
- createDefault(dim, nc, isSimplex, qorder=DETERMINE, prefix=None, comm=None)
- Create a FE for basic FEM computation.
Collective.
- dim (int) -- The spatial dimension.
- nc (int) -- The number of components.
- isSimplex (bool) -- Flag for simplex reference cell, otherwise it's a tensor product.
- qorder (int) -- The quadrature order or DETERMINE to use Space polynomial degree.
- prefix (str) -- The options prefix, or None.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:76
- createLagrange(dim, nc, isSimplex, k, qorder=DETERMINE, comm=None)
- Create a FE for the basic Lagrange space of degree k.
Collective.
- dim (int) -- The spatial dimension.
- nc (int) -- The number of components.
- isSimplex (bool) -- Flag for simplex reference cell, otherwise it's a tensor product.
- k (int) -- The degree of the space.
- qorder (int) -- The quadrature order or DETERMINE to use Space polynomial degree.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:122
- destroy()
- Destroy the FE object.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:40
- Return type
- Self
- getBasisSpace()
- Return the Space used for the approximation of the FE
solution.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:385
- Return type
- Space
- getDimension()
- Return the dimension of the finite element space on a cell.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:180
- Return type
- int
- getDualSpace()
- Return the DualSpace used to define the inner product for the
FE.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:440
- Return type
- DualSpace
- getFaceQuadrature()
- Return the Quad used to calculate inner products on faces.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:315
- Return type
- Quad
- getNumComponents()
- Return the number of components in the element.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:208
- Return type
- int
- getNumDof()
- Return the number of DOFs.
Not collective.
Return the number of DOFs (dual basis vectors) associated with mesh points on the reference cell of a given dimension.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:240
- Return type
- ndarray
- getQuadrature()
- Return the Quad used to calculate inner products.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:166
- Return type
- Quad
- getSpatialDimension()
- Return the spatial dimension of the element.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:194
- Return type
- int
- getTileSizes()
- Return the tile sizes for evaluation.
Not collective.
- blockSize (int) -- The number of elements in a block.
- numBlocks (int) -- The number of blocks in a batch.
- batchSize (int) -- The number of elements in a batch.
- numBatches (int) -- The number of batches in a chunk.
- Return type
- tuple(int, int, int, int)
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:259
- setBasisSpace(sp)
- Set the Space used for the approximation of the solution.
Not collective.
- Parameters
- sp (Space) -- The Space object.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:399
- setDualSpace(dspace)
- Set the DualSpace used to define the inner product.
Not collective.
- Parameters
- dspace (DualSpace) -- The DualSpace object.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:454
- setFaceQuadrature(quad)
- Set the Quad used to calculate inner products on faces.
Not collective.
- Parameters
- quad (Quad) -- The Quad object.
- Return type
- Quad
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:347
- setFromOptions()
- Set parameters in a FE from the options database.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:416
- Return type
- None
- setNumComponents(comp)
- Set the number of field components in the element.
Not collective.
- Parameters
- comp (int) -- The number of field components.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:222
- setQuadrature(quad)
- Set the Quad used to calculate inner products.
Not collective.
- Parameters
- quad (Quad) -- The Quad object.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:329
- setTileSizes(blockSize, numBlocks, batchSize, numBatches)
- Set the tile sizes for evaluation.
Not collective.
- blockSize (int) -- The number of elements in a block.
- numBlocks (int) -- The number of blocks in a batch.
- batchSize (int) -- The number of elements in a batch.
- numBatches (int) -- The number of batches in a chunk.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:285
- setType(fe_type)
- Build a particular FE.
Collective.
- Parameters
- fe_type (Type | str) -- The kind of FEM space.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:365
- setUp()
- Construct data structures for the FE after the Type has been
set.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:428
- Return type
- None
- view(viewer=None)
- View a FE object.
Collective.
- Parameters
- viewer (Viewer | None) -- A Viewer to display the graph.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/FE.pyx:21
petsc4py.PETSc.IS¶
- class petsc4py.PETSc.IS
- Bases: Object
A collection of indices.
IS objects are used to index into vectors and matrices and to set up vector scatters.
SEE ALSO:
Enumerations
Type | The index set types. |
petsc4py.PETSc.IS.Type¶
- class petsc4py.PETSc.IS.Type
- Bases: object
The index set types.
Attributes Summary
BLOCK Object BLOCK of type str GENERAL Object GENERAL of type str STRIDE Object STRIDE of type str Attributes Documentation
- BLOCK: str = BLOCK
- Object BLOCK of type str
- GENERAL: str = GENERAL
- Object GENERAL of type str
- STRIDE: str = STRIDE
- Object STRIDE of type str
Methods Summary
allGather() | Concatenate index sets stored across processors. |
buildTwoSided([toindx]) | Create an index set describing a global mapping. |
complement(nmin, nmax) | Create a complement index set. |
copy([result]) | Copy the contents of the index set into another. |
create([comm]) | Create an IS. |
createBlock(bsize, indices[, comm]) | Create a blocked index set. |
createGeneral(indices[, comm]) | Create an IS with indices. |
createStride(size[, first, step, comm]) | Create an index set consisting of evenly spaced values. |
destroy() | Destroy the index set. |
difference(iset) | Return the difference between two index sets. |
duplicate() | Create a copy of the index set. |
embed(iset, drop) | Embed self into iset. |
equal(iset) | Return whether the index sets have the same set of indices or not. |
expand(iset) | Return the union of two (possibly unsorted) index sets. |
getBlockIndices() | Return the indices of an index set with type IS.Type.BLOCK. |
getBlockSize() | Return the number of elements in a block. |
getIndices() | Return the indices of the index set. |
getInfo() | Return stride information for an index set with type IS.Type.STRIDE. |
getLocalSize() | Return the process-local length of the index set. |
getSize() | Return the global length of an index set. |
getSizes() | Return the local and global sizes of the index set. |
getStride() | Return size and stride information. |
getType() | Return the index set type associated with the IS. |
invertPermutation([nlocal]) | Invert the index set. |
isIdentity() | Return whether the index set has been declared as an identity. |
isPermutation() | Return whether an index set has been declared to be a permutation. |
isSorted() | Return whether the indices have been sorted. |
load(viewer) | Load a stored index set. |
renumber([mult]) | Renumber the non-negative entries of an index set, starting from 0. |
setBlockIndices(bsize, indices) | Set the indices for an index set with type IS.Type.BLOCK. |
setBlockSize(bs) | Set the block size of the index set. |
setIdentity() | Mark the index set as being an identity. |
setIndices(indices) | Set the indices of an index set. |
setPermutation() | Mark the index set as being a permutation. |
setStride(size[, first, step]) | Set the stride information for an index set with type IS.Type.STRIDE. |
setType(is_type) | Set the type of the index set. |
sort() | Sort the indices of an index set. |
sum(iset) | Return the union of two (sorted) index sets. |
toGeneral() | Convert the index set type to IS.Type.GENERAL. |
union(iset) | Return the union of two (possibly unsorted) index sets. |
view([viewer]) | Display the index set. |
Attributes Summary
array | View of the index set as an array of integers. |
block_size | The number of elements in a block. |
identity | True if index set is an identity, False otherwise. |
indices | The indices of the index set. |
local_size | The local size of the index set. |
permutation | True if index set is a permutation, False otherwise. |
size | The global size of the index set. |
sizes | The local and global sizes of the index set. |
sorted | True if index set is sorted, False otherwise. |
Methods Documentation
- allGather()
- Concatenate index sets stored across processors.
Collective.
The returned index set will be the same on every processor.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:304
- Return type
- IS
- buildTwoSided(toindx=None)
- Create an index set describing a global mapping.
Collective.
This function generates an index set that contains new numbers from remote or local on the index set.
- Parameters
- toindx (IS | None) -- Index set describing which indices to send, default is to send natural numbering.
- Returns
- New index set containing the new numbers from remote or local.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:333
- complement(nmin, nmax)
- Create a complement index set.
Collective.
The complement set of indices is all indices that are not in the provided set (and within the provided bounds).
- nmin (int) -- Minimum index that can be found in the local part of the complement index set.
- nmax (int) -- One greater than the maximum index that can be found in the local part of the complement index set.
- Return type
- IS
Notes
For a parallel index set, this will generate the local part of the complement on each process.
To generate the entire complement (on each process) of a parallel index set, first call IS.allGather and then call this method.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:674
- copy(result=None)
- Copy the contents of the index set into another.
Collective.
- Parameters
- result (IS | None) -- The target index set. If None then IS.duplicate is called first.
- Returns
- The copied index set. If result is not None then this is returned here.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:253
- create(comm=None)
- Create an IS.
Collective.
- Parameters
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:88
- createBlock(bsize, indices, comm=None)
- Create a blocked index set.
Collective.
- bsize (int) -- Block size.
- indices (Sequence[int]) -- Integer array of indices.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:171
- createGeneral(indices, comm=None)
- Create an IS with indices.
Collective.
- indices (Sequence[int]) -- Integer array.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:142
- createStride(size, first=0, step=0, comm=None)
- Create an index set consisting of evenly spaced values.
Collective.
- size (int) -- The length of the locally owned portion of the index set.
- first (int) -- The first element of the index set.
- step (int) -- The difference between adjacent indices.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:204
- destroy()
- Destroy the index set.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:75
- Return type
- Self
- difference(iset)
- Return the difference between two index sets.
Collective.
- Parameters
- iset (IS) -- Index set to compute the difference with.
- Returns
- Index set representing the difference between self and iset.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:650
- duplicate()
- Create a copy of the index set.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:239
- Return type
- IS
- embed(iset, drop)
- Embed self into iset.
Not collective.
The embedding is performed by finding the locations in iset that have the same indices as self.
- iset (IS) -- The index set to embed into.
- drop (bool) -- Flag indicating whether to drop indices from self that are not in iset.
- Returns
- The embedded index set.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:710
- equal(iset)
- Return whether the index sets have the same set of indices or not.
Collective.
- Parameters
- iset (IS) -- The index set to compare indices with.
- Return type
- bool
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:550
- expand(iset)
- Return the union of two (possibly unsorted) index sets.
Collective.
To compute the union, expand concatenates the two index sets and removes any duplicates.
- Parameters
- iset (IS) -- Index set to compute the union with.
- Returns
- The new, combined, index set.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:588
- getBlockIndices()
- Return the indices of an index set with type IS.Type.BLOCK.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:833
- Return type
- ArrayInt
- getBlockSize()
- Return the number of elements in a block.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:437
- Return type
- int
- getIndices()
- Return the indices of the index set.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:789
- Return type
- ArrayInt
- getInfo()
- Return stride information for an index set with type
IS.Type.STRIDE.
Not collective.
- first (int) -- First element of the index set.
- step (int) -- Difference between adjacent indices.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:903
- getLocalSize()
- Return the process-local length of the index set.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:401
- Return type
- int
- getSize()
- Return the global length of an index set.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:387
- Return type
- int
- getSizes()
- Return the local and global sizes of the index set.
Not collective.
- local_size (int) -- The local size.
- global_size (int) -- The global size.
- Return type
- tuple[int, int]
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:415
- getStride()
- Return size and stride information.
Not collective.
- size (int) -- Length of the locally owned portion of the index set.
- first (int) -- First element of the index set.
- step (int) -- Difference between adjacent indices.
- Return type
- tuple[int, int, int]
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:879
- getType()
- Return the index set type associated with the IS.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:128
- Return type
- str
- invertPermutation(nlocal=None)
- Invert the index set.
Collective.
For this to be correct the index set must be a permutation.
- Parameters
- nlocal (int | None) -- The number of indices on this processor in the resulting index set, defaults to PETSC_DECIDE.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:363
- isIdentity()
- Return whether the index set has been declared as an identity.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:536
- Return type
- bool
- isPermutation()
- Return whether an index set has been declared to be a permutation.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:509
- Return type
- bool
- isSorted()
- Return whether the indices have been sorted.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:482
- Return type
- bool
- load(viewer)
- Load a stored index set.
Collective.
- Parameters
- viewer (Viewer) -- Binary file viewer, either Viewer.Type.BINARY or Viewer.Type.HDF5.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:281
- renumber(mult=None)
- Renumber the non-negative entries of an index set, starting from 0.
Collective.
- Parameters
- mult (IS | None) -- The multiplicity of each entry in self, default implies a multiplicity of 1.
- Returns
- int -- One past the largest entry of the new index set.
- IS -- The renumbered index set.
- Return type
- tuple[int, IS]
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:741
- setBlockIndices(bsize, indices)
- Set the indices for an index set with type IS.Type.BLOCK.
Collective.
- bsize (int) -- Number of elements in each block.
- indices (Sequence[int]) -- List of integers.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:810
- setBlockSize(bs)
- Set the block size of the index set.
Logically collective.
- Parameters
- bs (int) -- Block size.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:451
- setIdentity()
- Mark the index set as being an identity.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:523
- Return type
- Self
- setIndices(indices)
- Set the indices of an index set.
Logically collective.
The index set is assumed to be of type IS.Type.GENERAL.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:772
- Parameters
- indices (Sequence[int])
- Return type
- None
- setPermutation()
- Mark the index set as being a permutation.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:496
- Return type
- Self
- setStride(size, first=0, step=1)
- Set the stride information for an index set with type
IS.Type.STRIDE.
Logically collective.
- size (int) -- Length of the locally owned portion of the index set.
- first (int) -- First element of the index set.
- step (int) -- Difference between adjacent indices.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:855
- setType(is_type)
- Set the type of the index set.
Collective.
- Parameters
- is_type (Type | str) -- The index set type.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:109
- sort()
- Sort the indices of an index set.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:469
- Return type
- Self
- sum(iset)
- Return the union of two (sorted) index sets.
Collective.
- Parameters
- iset (IS) -- The index set to compute the union with.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:569
- toGeneral()
- Convert the index set type to IS.Type.GENERAL.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:320
- Return type
- Self
- union(iset)
- Return the union of two (possibly unsorted) index sets.
Collective.
This function will call either ISSum or ISExpand depending on whether or not the input sets are already sorted.
Sequential only (as ISSum is sequential only).
- Parameters
- iset (IS) -- Index set to compute the union with.
- Returns
- The new, combined, index set.
- Return type
- IS
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:615
- view(viewer=None)
- Display the index set.
Collective.
- Parameters
- viewer (Viewer | None) -- Viewer used to display the IS.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:56
Attributes Documentation
- array
- View of the index set as an array of integers.
Not collective.
Source code at petsc4py/PETSc/IS.pyx:1032
- block_size
- The number of elements in a block.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:1006
- identity
- True if index set is an identity, False otherwise.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:939
- indices
- The indices of the index set.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:1019
- local_size
- The local size of the index set.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:993
- permutation
- True if index set is a permutation, False otherwise.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:926
- size
- The global size of the index set.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:980
- sizes
- The local and global sizes of the index set.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:967
- sorted
- True if index set is sorted, False otherwise.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/IS.pyx:952
petsc4py.PETSc.InsertMode¶
- class petsc4py.PETSc.InsertMode
- Bases: object
Insertion mode.
Most commonly used insertion modes are:
SEE ALSO:
Attributes Summary
ADD | Constant ADD of type int |
ADD_ALL | Constant ADD_ALL of type int |
ADD_ALL_VALUES | Constant ADD_ALL_VALUES of type int |
ADD_BC | Constant ADD_BC of type int |
ADD_BC_VALUES | Constant ADD_BC_VALUES of type int |
ADD_VALUES | Constant ADD_VALUES of type int |
INSERT | Constant INSERT of type int |
INSERT_ALL | Constant INSERT_ALL of type int |
INSERT_ALL_VALUES | Constant INSERT_ALL_VALUES of type int |
INSERT_BC | Constant INSERT_BC of type int |
INSERT_BC_VALUES | Constant INSERT_BC_VALUES of type int |
INSERT_VALUES | Constant INSERT_VALUES of type int |
MAX | Constant MAX of type int |
MAX_VALUES | Constant MAX_VALUES of type int |
NOT_SET_VALUES | Constant NOT_SET_VALUES of type int |
Attributes Documentation
- ADD: int = ADD
- Constant ADD of type int
- ADD_ALL: int = ADD_ALL
- Constant ADD_ALL of type int
- ADD_ALL_VALUES: int = ADD_ALL_VALUES
- Constant ADD_ALL_VALUES of type int
- ADD_BC: int = ADD_BC
- Constant ADD_BC of type int
- ADD_BC_VALUES: int = ADD_BC_VALUES
- Constant ADD_BC_VALUES of type int
- ADD_VALUES: int = ADD_VALUES
- Constant ADD_VALUES of type int
- INSERT: int = INSERT
- Constant INSERT of type int
- INSERT_ALL: int = INSERT_ALL
- Constant INSERT_ALL of type int
- INSERT_ALL_VALUES: int = INSERT_ALL_VALUES
- Constant INSERT_ALL_VALUES of type int
- INSERT_BC: int = INSERT_BC
- Constant INSERT_BC of type int
- INSERT_BC_VALUES: int = INSERT_BC_VALUES
- Constant INSERT_BC_VALUES of type int
- INSERT_VALUES: int = INSERT_VALUES
- Constant INSERT_VALUES of type int
- MAX: int = MAX
- Constant MAX of type int
- MAX_VALUES: int = MAX_VALUES
- Constant MAX_VALUES of type int
- NOT_SET_VALUES: int = NOT_SET_VALUES
- Constant NOT_SET_VALUES of type int
petsc4py.PETSc.KSP¶
- class petsc4py.PETSc.KSP
- Bases: Object
Abstract PETSc object that manages all Krylov methods.
This is the object that manages the linear solves in PETSc (even those such as direct solvers that do no use Krylov accelerators).
Notes
When a direct solver is used, but no Krylov solver is used, the KSP object is still used but with a Type.PREONLY, meaning that only application of the preconditioner is used as the linear solver.
SEE ALSO:
Enumerations
ConvergedReason | KSP Converged Reason. |
HPDDMType | The HPDDM Krylov solver type. |
NormType | KSP norm type. |
Type | KSP Type. |
petsc4py.PETSc.KSP.ConvergedReason¶
- class petsc4py.PETSc.KSP.ConvergedReason
- Bases: object
KSP Converged Reason.
- CONVERGED_ITERATING
- Still iterating
- ITERATING
- Still iterating
- CONVERGED_RTOL_NORMAL
- Undocumented.
- CONVERGED_ATOL_NORMAL
- Undocumented.
- CONVERGED_RTOL
- ∥r∥ <= rtolnorm(b) or rtolnorm(b - Ax₀)
- CONVERGED_ATOL
- ∥r∥ <= atol
- CONVERGED_ITS
- Used by the Type.PREONLY solver after the single iteration of the preconditioner is applied. Also used when the KSPConvergedSkip convergence test routine is set in KSP.
- CONVERGED_NEG_CURVE
- Undocumented.
- CONVERGED_STEP_LENGTH
- Undocumented.
- CONVERGED_HAPPY_BREAKDOWN
- Undocumented.
- DIVERGED_NULL
- Undocumented.
- DIVERGED_MAX_IT
- Ran out of iterations before any convergence criteria was reached.
- DIVERGED_DTOL
- norm(r) >= dtol*norm(b)
- DIVERGED_BREAKDOWN
- A breakdown in the Krylov method was detected so the method could not continue to enlarge the Krylov space. Could be due to a singular matrix or preconditioner. In KSPHPDDM, this is also returned when some search directions within a block are colinear.
- DIVERGED_BREAKDOWN_BICG
- A breakdown in the KSPBICG method was detected so the method could not continue to enlarge the Krylov space.
- DIVERGED_NONSYMMETRIC
- It appears the operator or preconditioner is not symmetric and this Krylov method (Type.CG, Type.MINRES, Type.CR) requires symmetry.
- DIVERGED_INDEFINITE_PC
- It appears the preconditioner is indefinite (has both positive and negative eigenvalues) and this Krylov method (Type.CG) requires it to be positive definite.
- DIVERGED_NANORINF
- Undocumented.
- DIVERGED_INDEFINITE_MAT
- Undocumented.
- DIVERGED_PCSETUP_FAILED
- It was not possible to build or use the requested preconditioner. This is usually due to a zero pivot in a factorization. It can also result from a failure in a subpreconditioner inside a nested preconditioner such as PC.Type.FIELDSPLIT.
SEE ALSO:
Attributes Summary
CONVERGED_ATOL | Constant CONVERGED_ATOL of type int |
CONVERGED_ATOL_NORMAL | Constant CONVERGED_ATOL_NORMAL of type int |
CONVERGED_HAPPY_BREAKDOWN | Constant CONVERGED_HAPPY_BREAKDOWN of type int |
CONVERGED_ITERATING | Constant CONVERGED_ITERATING of type int |
CONVERGED_ITS | Constant CONVERGED_ITS of type int |
CONVERGED_NEG_CURVE | Constant CONVERGED_NEG_CURVE of type int |
CONVERGED_RTOL | Constant CONVERGED_RTOL of type int |
CONVERGED_RTOL_NORMAL | Constant CONVERGED_RTOL_NORMAL of type int |
CONVERGED_STEP_LENGTH | Constant CONVERGED_STEP_LENGTH of type int |
DIVERGED_BREAKDOWN | Constant DIVERGED_BREAKDOWN of type int |
DIVERGED_BREAKDOWN_BICG | Constant DIVERGED_BREAKDOWN_BICG of type int |
DIVERGED_DTOL | Constant DIVERGED_DTOL of type int |
DIVERGED_INDEFINITE_MAT | Constant DIVERGED_INDEFINITE_MAT of type int |
DIVERGED_INDEFINITE_PC | Constant DIVERGED_INDEFINITE_PC of type int |
DIVERGED_MAX_IT | Constant DIVERGED_MAX_IT of type int |
DIVERGED_NANORINF | Constant DIVERGED_NANORINF of type int |
DIVERGED_NONSYMMETRIC | Constant DIVERGED_NONSYMMETRIC of type int |
DIVERGED_NULL | Constant DIVERGED_NULL of type int |
DIVERGED_PCSETUP_FAILED | Constant DIVERGED_PCSETUP_FAILED of type int |
ITERATING | Constant ITERATING of type int |
Attributes Documentation
- CONVERGED_ATOL: int = CONVERGED_ATOL
- Constant CONVERGED_ATOL of type int
- CONVERGED_ATOL_NORMAL: int = CONVERGED_ATOL_NORMAL
- Constant CONVERGED_ATOL_NORMAL of type int
- CONVERGED_HAPPY_BREAKDOWN: int = CONVERGED_HAPPY_BREAKDOWN
- Constant CONVERGED_HAPPY_BREAKDOWN of type int
- CONVERGED_ITERATING: int = CONVERGED_ITERATING
- Constant CONVERGED_ITERATING of type int
- CONVERGED_ITS: int = CONVERGED_ITS
- Constant CONVERGED_ITS of type int
- CONVERGED_NEG_CURVE: int = CONVERGED_NEG_CURVE
- Constant CONVERGED_NEG_CURVE of type int
- CONVERGED_RTOL: int = CONVERGED_RTOL
- Constant CONVERGED_RTOL of type int
- CONVERGED_RTOL_NORMAL: int = CONVERGED_RTOL_NORMAL
- Constant CONVERGED_RTOL_NORMAL of type int
- CONVERGED_STEP_LENGTH: int = CONVERGED_STEP_LENGTH
- Constant CONVERGED_STEP_LENGTH of type int
- DIVERGED_BREAKDOWN: int = DIVERGED_BREAKDOWN
- Constant DIVERGED_BREAKDOWN of type int
- DIVERGED_BREAKDOWN_BICG: int = DIVERGED_BREAKDOWN_BICG
- Constant DIVERGED_BREAKDOWN_BICG of type int
- DIVERGED_DTOL: int = DIVERGED_DTOL
- Constant DIVERGED_DTOL of type int
- DIVERGED_INDEFINITE_MAT: int = DIVERGED_INDEFINITE_MAT
- Constant DIVERGED_INDEFINITE_MAT of type int
- DIVERGED_INDEFINITE_PC: int = DIVERGED_INDEFINITE_PC
- Constant DIVERGED_INDEFINITE_PC of type int
- DIVERGED_MAX_IT: int = DIVERGED_MAX_IT
- Constant DIVERGED_MAX_IT of type int
- DIVERGED_NANORINF: int = DIVERGED_NANORINF
- Constant DIVERGED_NANORINF of type int
- DIVERGED_NONSYMMETRIC: int = DIVERGED_NONSYMMETRIC
- Constant DIVERGED_NONSYMMETRIC of type int
- DIVERGED_NULL: int = DIVERGED_NULL
- Constant DIVERGED_NULL of type int
- DIVERGED_PCSETUP_FAILED: int = DIVERGED_PCSETUP_FAILED
- Constant DIVERGED_PCSETUP_FAILED of type int
- ITERATING: int = ITERATING
- Constant ITERATING of type int
petsc4py.PETSc.KSP.HPDDMType¶
- class petsc4py.PETSc.KSP.HPDDMType
- Bases: object
The HPDDM Krylov solver type.
Attributes Summary
BCG Constant BCG of type int BFBCG Constant BFBCG of type int BGCRODR Constant BGCRODR of type int BGMRES Constant BGMRES of type int CG Constant CG of type int GCRODR Constant GCRODR of type int GMRES Constant GMRES of type int PREONLY Constant PREONLY of type int Attributes Documentation
- BCG: int = BCG
- Constant BCG of type int
- BFBCG: int = BFBCG
- Constant BFBCG of type int
- BGCRODR: int = BGCRODR
- Constant BGCRODR of type int
- BGMRES: int = BGMRES
- Constant BGMRES of type int
- CG: int = CG
- Constant CG of type int
- GCRODR: int = GCRODR
- Constant GCRODR of type int
- GMRES: int = GMRES
- Constant GMRES of type int
- PREONLY: int = PREONLY
- Constant PREONLY of type int
petsc4py.PETSc.KSP.NormType¶
- class petsc4py.PETSc.KSP.NormType
- Bases: object
KSP norm type.
The available norm types are:
- NONE
- Skips computing the norm, this should generally only be used if you are using the Krylov method as a smoother with a fixed small number of iterations. Implicitly sets KSPConvergedSkip as KSP convergence test. Note that certain algorithms such as Type.GMRES ALWAYS require the norm calculation, for these methods the norms are still computed, they are just not used in the convergence test.
- PRECONDITIONED
- The default for left preconditioned solves, uses the l₂ norm of the preconditioned residual P⁻¹(b - Ax).
- UNPRECONDITIONED
- Uses the l₂ norm of the true b - Ax residual.
- NATURAL
- Supported by Type.CG, Type.CR, Type.CGNE, Type.CGS.
Attributes Summary
DEFAULT | Constant DEFAULT of type int |
NATURAL | Constant NATURAL of type int |
NO | Constant NO of type int |
NONE | Constant NONE of type int |
NORM_DEFAULT | Constant NORM_DEFAULT of type int |
NORM_NATURAL | Constant NORM_NATURAL of type int |
NORM_NONE | Constant NORM_NONE of type int |
NORM_PRECONDITIONED | Constant NORM_PRECONDITIONED of type int |
NORM_UNPRECONDITIONED | Constant NORM_UNPRECONDITIONED of type int |
PRECONDITIONED | Constant PRECONDITIONED of type int |
UNPRECONDITIONED | Constant UNPRECONDITIONED of type int |
Attributes Documentation
- DEFAULT: int = DEFAULT
- Constant DEFAULT of type int
- NATURAL: int = NATURAL
- Constant NATURAL of type int
- NO: int = NO
- Constant NO of type int
- NONE: int = NONE
- Constant NONE of type int
- NORM_DEFAULT: int = NORM_DEFAULT
- Constant NORM_DEFAULT of type int
- NORM_NATURAL: int = NORM_NATURAL
- Constant NORM_NATURAL of type int
- NORM_NONE: int = NORM_NONE
- Constant NORM_NONE of type int
- NORM_PRECONDITIONED: int = NORM_PRECONDITIONED
- Constant NORM_PRECONDITIONED of type int
- NORM_UNPRECONDITIONED: int = NORM_UNPRECONDITIONED
- Constant NORM_UNPRECONDITIONED of type int
- PRECONDITIONED: int = PRECONDITIONED
- Constant PRECONDITIONED of type int
- UNPRECONDITIONED: int = UNPRECONDITIONED
- Constant UNPRECONDITIONED of type int
petsc4py.PETSc.KSP.Type¶
- class petsc4py.PETSc.KSP.Type
- Bases: object
KSP Type.
The available types are:
- RICHARDSON
- The preconditioned Richardson iterative method KSPRICHARDSON.
- CHEBYSHEV
- The preconditioned Chebyshev iterative method. KSPCHEBYSHEV.
- CG
- The Preconditioned Conjugate Gradient (PCG) iterative method. KSPCG
- GROPPCG
- A pipelined conjugate gradient method (Gropp). KSPGROPPCG
- PIPECG
- A pipelined conjugate gradient method. KSPPIPECG
- PIPECGRR
- Pipelined Conjugate Gradients with Residual Replacement. KSPPIPECGRR
- PIPELCG
- Deep pipelined (length l) Conjugate Gradient method. KSPPIPELCG
- PIPEPRCG
- Pipelined predict-and-recompute conjugate gradient method. KSPPIPEPRCG
- PIPECG2
- Pipelined conjugate gradient method with a single non-blocking reduction per two iterations. KSPPIPECG2
- CGNE
- Applies the preconditioned conjugate gradient method to the normal equations without explicitly forming AᵀA. KSPCGNE
- NASH
- Conjugate gradient method subject to a constraint on the solution norm. KSPNASH
- STCG
- Conjugate gradient method subject to a constraint on the solution norm. KSPSTCG
- GLTR
- Conjugate gradient method subject to a constraint on the solution norm. KSPGLTR
- FCG
- Flexible Conjugate Gradient method (FCG). Unlike most KSP methods this allows the preconditioner to be nonlinear. KSPFCG
- PIPEFCG
- Pipelined, Flexible Conjugate Gradient method. KSPPIPEFCG
- GMRES
- Generalized Minimal Residual method with restart. KSPGMRES
- PIPEFGMRES
- Pipelined (1-stage) Flexible Generalized Minimal Residual method. KSPPIPEFGMRES
- FGMRES
- Implements the Flexible Generalized Minimal Residual method. KSPFGMRES
- LGMRES
- Augments the standard Generalized Minimal Residual method approximation space with approximations to the error from previous restart cycles. KSPLGMRES
- DGMRES
- Deflated Generalized Minimal Residual method. In this implementation, the adaptive strategy allows to switch to the deflated GMRES when the stagnation occurs. KSPDGMRES
- PGMRES
- Pipelined Generalized Minimal Residual method. KSPPGMRES
- TCQMR
- A variant of Quasi Minimal Residual (QMR). KSPTCQMR
- BCGS
- Stabilized version of Biconjugate Gradient (BiCGStab) method. KSPBCGS
- IBCGS
- Improved Stabilized version of BiConjugate Gradient (IBiCGStab) method in an alternative form to have only a single global reduction operation instead of the usual 3 (or 4). KSPIBCGS
- QMRCGS
- Quasi- Minimal Residual variant of the Bi-CGStab algorithm (QMRCGStab) method. KSPQMRCGS
- FBCGS
- Flexible Stabilized version of BiConjugate Gradient (BiCGStab) method. KSPFBCGS
- FBCGSR
- A mathematically equivalent variant of flexible stabilized BiConjugate Gradient (BiCGStab). KSPFBCGSR
- BCGSL
- Variant of the L-step stabilized BiConjugate Gradient (BiCGStab(L)) algorithm. Uses "L-step" Minimal Residual (MR) polynomials. The variation concerns cases when some parameters are negative due to round-off. KSPBCGSL
- PIPEBCGS
- Pipelined stabilized BiConjugate Gradient (BiCGStab) method. KSPPIPEBCGS
- CGS
- Conjugate Gradient Squared method. KSPCGS
- TFQMR
- A Transpose Tree Quasi- Minimal Residual (QMR). KSPCR
- CR
- (Preconditioned) Conjugate Residuals (CR) method. KSPCR
- PIPECR
- Pipelined Conjugate Residual (CR) method. KSPPIPECR
- LSQR
- Least squares solver. KSPLSQR
- PREONLY
- Applies ONLY the preconditioner exactly once. This may be used in inner iterations, where it is desired to allow multiple iterations as well as the "0-iteration" case. It is commonly used with the direct solver preconditioners like PCLU and PCCHOLESKY. There is an alias of KSPNONE. KSPPREONLY
- NONE
- No solver KSPNONE
- QCG
- Conjugate Gradient (CG) method subject to a constraint on the solution norm. KSPQCG
- BICG
- Implements the Biconjugate gradient method (BiCG). Similar to running the conjugate gradient on the normal equations. KSPBICG
- MINRES
- Minimum Residual (MINRES) method. KSPMINRES
- SYMMLQ
- Symmetric LQ method (SymmLQ). Uses LQ decomposition (lower trapezoidal). KSPSYMMLQ
- LCD
- Left Conjugate Direction (LCD) method. KSPLCD
- PYTHON
- Python shell solver. Call Python function to implement solver. KSPPYTHON
- GCR
- Preconditioned flexible Generalized Conjugate Residual (GCR) method. KSPGCR
- PIPEGCR
- Pipelined Generalized Conjugate Residual method. KSPPIPEGCR
- TSIRM
- Two-Stage Iteration with least-squares Residual Minimization method. KSPTSIRM
- CGLS
- Conjugate Gradient method for Least-Squares problems. Supports non-square (rectangular) matrices. KSPCGLS
- FETIDP
- Dual-Primal (DP) Finite Element Tearing and Interconnect (FETI) method. KSPFETIDP
- HPDDM
- Interface with the HPDDM library. This KSP may be used to further select methods that are currently not implemented natively in PETSc, e.g., GCRODR, a recycled Krylov method which is similar to KSPLGMRES. KSPHPDDM
SEE ALSO:
Attributes Summary
BCGS | Object BCGS of type str |
BCGSL | Object BCGSL of type str |
BICG | Object BICG of type str |
CG | Object CG of type str |
CGLS | Object CGLS of type str |
CGNE | Object CGNE of type str |
CGS | Object CGS of type str |
CHEBYSHEV | Object CHEBYSHEV of type str |
CR | Object CR of type str |
DGMRES | Object DGMRES of type str |
FBCGS | Object FBCGS of type str |
FBCGSR | Object FBCGSR of type str |
FCG | Object FCG of type str |
FETIDP | Object FETIDP of type str |
FGMRES | Object FGMRES of type str |
GCR | Object GCR of type str |
GLTR | Object GLTR of type str |
GMRES | Object GMRES of type str |
GROPPCG | Object GROPPCG of type str |
HPDDM | Object HPDDM of type str |
IBCGS | Object IBCGS of type str |
LCD | Object LCD of type str |
LGMRES | Object LGMRES of type str |
LSQR | Object LSQR of type str |
MINRES | Object MINRES of type str |
NASH | Object NASH of type str |
NONE | Object NONE of type str |
PGMRES | Object PGMRES of type str |
PIPEBCGS | Object PIPEBCGS of type str |
PIPECG | Object PIPECG of type str |
PIPECG2 | Object PIPECG2 of type str |
PIPECGRR | Object PIPECGRR of type str |
PIPECR | Object PIPECR of type str |
PIPEFCG | Object PIPEFCG of type str |
PIPEFGMRES | Object PIPEFGMRES of type str |
PIPEGCR | Object PIPEGCR of type str |
PIPELCG | Object PIPELCG of type str |
PIPEPRCG | Object PIPEPRCG of type str |
PREONLY | Object PREONLY of type str |
PYTHON | Object PYTHON of type str |
QCG | Object QCG of type str |
QMRCGS | Object QMRCGS of type str |
RICHARDSON | Object RICHARDSON of type str |
STCG | Object STCG of type str |
SYMMLQ | Object SYMMLQ of type str |
TCQMR | Object TCQMR of type str |
TFQMR | Object TFQMR of type str |
TSIRM | Object TSIRM of type str |
Attributes Documentation
- BCGS: str = BCGS
- Object BCGS of type str
- BCGSL: str = BCGSL
- Object BCGSL of type str
- BICG: str = BICG
- Object BICG of type str
- CG: str = CG
- Object CG of type str
- CGLS: str = CGLS
- Object CGLS of type str
- CGNE: str = CGNE
- Object CGNE of type str
- CGS: str = CGS
- Object CGS of type str
- CHEBYSHEV: str = CHEBYSHEV
- Object CHEBYSHEV of type str
- CR: str = CR
- Object CR of type str
- DGMRES: str = DGMRES
- Object DGMRES of type str
- FBCGS: str = FBCGS
- Object FBCGS of type str
- FBCGSR: str = FBCGSR
- Object FBCGSR of type str
- FCG: str = FCG
- Object FCG of type str
- FETIDP: str = FETIDP
- Object FETIDP of type str
- FGMRES: str = FGMRES
- Object FGMRES of type str
- GCR: str = GCR
- Object GCR of type str
- GLTR: str = GLTR
- Object GLTR of type str
- GMRES: str = GMRES
- Object GMRES of type str
- GROPPCG: str = GROPPCG
- Object GROPPCG of type str
- HPDDM: str = HPDDM
- Object HPDDM of type str
- IBCGS: str = IBCGS
- Object IBCGS of type str
- LCD: str = LCD
- Object LCD of type str
- LGMRES: str = LGMRES
- Object LGMRES of type str
- LSQR: str = LSQR
- Object LSQR of type str
- MINRES: str = MINRES
- Object MINRES of type str
- NASH: str = NASH
- Object NASH of type str
- NONE: str = NONE
- Object NONE of type str
- PGMRES: str = PGMRES
- Object PGMRES of type str
- PIPEBCGS: str = PIPEBCGS
- Object PIPEBCGS of type str
- PIPECG: str = PIPECG
- Object PIPECG of type str
- PIPECG2: str = PIPECG2
- Object PIPECG2 of type str
- PIPECGRR: str = PIPECGRR
- Object PIPECGRR of type str
- PIPECR: str = PIPECR
- Object PIPECR of type str
- PIPEFCG: str = PIPEFCG
- Object PIPEFCG of type str
- PIPEFGMRES: str = PIPEFGMRES
- Object PIPEFGMRES of type str
- PIPEGCR: str = PIPEGCR
- Object PIPEGCR of type str
- PIPELCG: str = PIPELCG
- Object PIPELCG of type str
- PIPEPRCG: str = PIPEPRCG
- Object PIPEPRCG of type str
- PREONLY: str = PREONLY
- Object PREONLY of type str
- PYTHON: str = PYTHON
- Object PYTHON of type str
- QCG: str = QCG
- Object QCG of type str
- QMRCGS: str = QMRCGS
- Object QMRCGS of type str
- RICHARDSON: str = RICHARDSON
- Object RICHARDSON of type str
- STCG: str = STCG
- Object STCG of type str
- SYMMLQ: str = SYMMLQ
- Object SYMMLQ of type str
- TCQMR: str = TCQMR
- Object TCQMR of type str
- TFQMR: str = TFQMR
- Object TFQMR of type str
- TSIRM: str = TSIRM
- Object TSIRM of type str
Methods Summary
addConvergenceTest(converged[, args, kargs, ...]) | Add the function to be used to determine convergence. |
appendOptionsPrefix(prefix) | Append to prefix used for all KSP options in the database. |
buildResidual([r]) | Return the residual of the linear system. |
buildSolution([x]) | Return the solution vector. |
callConvergenceTest(its, rnorm) | Call the convergence test callback. |
computeEigenvalues() | Compute the extreme eigenvalues for the preconditioned operator. |
computeExtremeSingularValues() | Compute the extreme singular values for the preconditioned operator. |
create([comm]) | Create the KSP context. |
createPython([context, comm]) | Create a linear solver of Python type. |
destroy() | Destroy KSP context. |
getAppCtx() | Return the user-defined context for the linear solver. |
getCGObjectiveValue() | Return the CG objective function value. |
getComputeEigenvalues() | Return flag indicating whether eigenvalues will be calculated. |
getComputeSingularValues() | Return flag indicating whether singular values will be calculated. |
getConvergedReason() | Use reason property. |
getConvergenceHistory() | Return array containing the residual history. |
getConvergenceTest() | Return the function to be used to determine convergence. |
getDM() | Return the DM that may be used by some preconditioners. |
getErrorIfNotConverged() | Return the flag indicating the solver will error if divergent. |
getHPDDMType() | Return the Krylov solver type. |
getInitialGuessKnoll() | Determine whether the KSP solver is using the Knoll trick. |
getInitialGuessNonzero() | Determine whether the KSP solver uses a zero initial guess. |
getIterationNumber() | Use its property. |
getMonitor() | Return function used to monitor the residual. |
getNormType() | Return the norm that is used for convergence testing. |
getOperators() | Return the matrix associated with the linear system. |
getOptionsPrefix() | Return the prefix used for all KSP options in the database. |
getPC() | Return the preconditioner. |
getPCSide() | Return the preconditioning side. |
getPythonContext() | Return the instance of the class implementing Python methods. |
getPythonType() | Return the fully qualified Python name of the class used by the solver. |
getResidualNorm() | Use norm property. |
getRhs() | Return the right-hand side vector for the linear system. |
getSolution() | Return the solution for the linear system to be solved. |
getTolerances() | Return various tolerances used by the KSP convergence tests. |
getType() | Return the KSP type as a string from the KSP object. |
getWorkVecs([right, left]) | Create working vectors. |
logConvergenceHistory(rnorm) | Add residual to convergence history. |
matSolve(B, X) | Solve a linear system with multiple right-hand sides. |
matSolveTranspose(B, X) | Solve the transpose of a linear system with multiple RHS. |
monitor(its, rnorm) | Run the user provided monitor routines, if they exist. |
monitorCancel() | Clear all monitors for a KSP object. |
reset() | Resets a KSP context. |
setAppCtx(appctx) | Set the optional user-defined context for the linear solver. |
setComputeEigenvalues(flag) | Set a flag to compute eigenvalues. |
setComputeOperators(operators[, args, kargs]) | Set routine to compute the linear operators. |
setComputeRHS(rhs[, args, kargs]) | Set routine to compute the right-hand side of the linear system. |
setComputeSingularValues(flag) | Set flag to calculate singular values. |
setConvergedReason(reason) | Use reason property. |
setConvergenceHistory([length, reset]) | Set the array used to hold the residual history. |
setConvergenceTest(converged[, args, kargs]) | Set the function to be used to determine convergence. |
setDM(dm) | Set the DM that may be used by some preconditioners. |
setDMActive(flag) | DM should be used to generate system matrix & RHS vector. |
setErrorIfNotConverged(flag) | Cause solve to generate an error if not converged. |
setFromOptions() | Set KSP options from the options database. |
setGMRESRestart(restart) | Set number of iterations at which KSP restarts. |
setHPDDMType(hpddm_type) | Set the Krylov solver type. |
setInitialGuessKnoll(flag) | Tell solver to use PC.apply to compute the initial guess. |
setInitialGuessNonzero(flag) | Tell the iterative solver that the initial guess is nonzero. |
setIterationNumber(its) | Use its property. |
setMonitor(monitor[, args, kargs]) | Set additional function to monitor the residual. |
setNormType(normtype) | Set the norm that is used for convergence testing. |
setOperators([A, P]) | Set matrix associated with the linear system. |
setOptionsPrefix(prefix) | Set the prefix used for all KSP options in the database. |
setPC(pc) | Set the preconditioner. |
setPCSide(side) | Set the preconditioning side. |
setPostSolve(postsolve[, args, kargs]) | Set the function that is called at the end of each KSP.solve. |
setPreSolve(presolve[, args, kargs]) | Set the function that is called at the beginning of each KSP.solve. |
setPythonContext([context]) | Set the instance of the class implementing Python methods. |
setPythonType(py_type) | Set the fully qualified Python name of the class to be used. |
setResidualNorm(rnorm) | Use norm property. |
setTolerances([rtol, atol, divtol, max_it]) | Set various tolerances used by the KSP convergence testers. |
setType(ksp_type) | Build the KSP data structure for a particular Type. |
setUp() | Set up internal data structures for an iterative solver. |
setUpOnBlocks() | Set up the preconditioner for each block in a block method. |
setUseFischerGuess(model, size) | Use the Paul Fischer algorithm to compute initial guesses. |
solve(b, x) | Solve the linear system. |
solveTranspose(b, x) | Solve the transpose of a linear system. |
view([viewer]) | Print the KSP data structure. |
Attributes Summary
appctx | The solver application context. |
atol | The absolute tolerance of the solver. |
divtol | The divergence tolerance of the solver. |
dm | The solver DM. |
guess_knoll | Whether solver uses Knoll trick. |
guess_nonzero | Whether guess is non-zero. |
history | The convergence history of the solver. |
is_converged | Boolean indicating if the solver has converged. |
is_diverged | Boolean indicating if the solver has failed. |
is_iterating | Boolean indicating if the solver has not converged yet. |
its | The current number of iterations the solver has taken. |
mat_op | The system matrix operator. |
mat_pc | The preconditioner operator. |
max_it | The maximum number of iteration the solver may take. |
norm | The norm of the residual at the current iteration. |
norm_type | The norm used by the solver. |
pc | The PC of the solver. |
pc_side | The side on which preconditioning is performed. |
reason | The converged reason. |
rtol | The relative tolerance of the solver. |
vec_rhs | The right-hand side vector. |
vec_sol | The solution vector. |
Methods Documentation
- addConvergenceTest(converged, args=None, kargs=None, prepend=False)
- Add the function to be used to determine convergence.
Logically collective.
- converged (KSPConvergenceTestFunction) -- Callback which computes the convergence.
- args (tuple[Any, ...] | None) -- Positional arguments for callback function.
- kargs (dict[str, Any] | None) -- Keyword arguments for callback function.
- prepend (bool) -- Whether to prepend this call before the default convergence test or call it after.
- Return type
- None
Notes
Cannot be mixed with a call to setConvergenceTest. It can only be called once. If called multiple times, it will generate an error.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1065
- appendOptionsPrefix(prefix)
- Append to prefix used for all KSP options in the database.
Logically collective.
- Parameters
- prefix (str | None) -- The options prefix to append.
- Return type
- None
Notes
A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:575
- buildResidual(r=None)
- Return the residual of the linear system.
Collective.
- Parameters
- r (Vec | None) -- Optional vector to use for the result.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2063
- buildSolution(x=None)
- Return the solution vector.
Collective.
- Parameters
- x (Vec | None) -- Optional vector to store the solution.
- Return type
- Vec
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2041
- callConvergenceTest(its, rnorm)
- Call the convergence test callback.
Collective.
Notes
This functionality is implemented in petsc4py.
Source code at petsc4py/PETSc/KSP.pyx:1121
- computeEigenvalues()
- Compute the extreme eigenvalues for the preconditioned operator.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2085
- Return type
- ArrayComplex
- computeExtremeSingularValues()
- Compute the extreme singular values for the preconditioned operator.
Collective.
- smax (float) -- The maximum singular value.
- smin (float) -- The minimum singular value.
- Return type
- tuple[float, float]
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2108
- create(comm=None)
- Create the KSP context.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:457
- Parameters
- comm (Comm | None)
- Return type
- Self
- createPython(context=None, comm=None)
- Create a linear solver of Python type.
Collective.
- context (Any) -- An instance of the Python class implementing the required methods.
- comm (Comm | None) -- MPI communicator, defaults to Sys.getDefaultComm.
- Return type
- Self
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2154
- destroy()
- Destroy KSP context.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:444
- Return type
- Self
- getAppCtx()
- Return the user-defined context for the linear solver.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:640
- Return type
- Any
- getCGObjectiveValue()
- Return the CG objective function value.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1882
- Return type
- float
- getComputeEigenvalues()
- Return flag indicating whether eigenvalues will be calculated.
Not collective.
Return the flag indicating that the extreme eigenvalues values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1430
- Return type
- bool
- getComputeSingularValues()
- Return flag indicating whether singular values will be calculated.
Not collective.
Return the flag indicating whether the extreme singular values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1474
- Return type
- bool
- getConvergedReason()
- Use reason property.
Source code at petsc4py/PETSc/KSP.pyx:1876
- Return type
- ConvergedReason
- getConvergenceHistory()
- Return array containing the residual history.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1188
- Return type
- ArrayReal
- getConvergenceTest()
- Return the function to be used to determine convergence.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1108
- Return type
- KSPConvergenceTestFunction
- getDM()
- Return the DM that may be used by some preconditioners.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:654
- Return type
- DM
- getErrorIfNotConverged()
- Return the flag indicating the solver will error if divergent.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1946
- Return type
- bool
- getHPDDMType()
- Return the Krylov solver type.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1914
- Return type
- HPDDMType
- getInitialGuessKnoll()
- Determine whether the KSP solver is using the Knoll trick.
Not collective.
This uses the Knoll trick; using PC.apply to compute the initial guess.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1550
- Return type
- bool
- getInitialGuessNonzero()
- Determine whether the KSP solver uses a zero initial guess.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1516
- Return type
- bool
- getMonitor()
- Return function used to monitor the residual.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1266
- Return type
- KSPMonitorFunction
- getNormType()
- Return the norm that is used for convergence testing.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1390
- Return type
- NormType
- getOperators()
- Return the matrix associated with the linear system.
Collective.
Return the matrix associated with the linear system and a (possibly) different one used to construct the preconditioner.
- A (Mat) -- Matrix that defines the linear system.
- P (Mat) -- Matrix to be used in constructing the preconditioner, usually the same as A.
- Return type
- tuple[Mat, Mat]
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:850
- getOptionsPrefix()
- Return the prefix used for all KSP options in the database.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:561
- Return type
- str
- getPC()
- Return the preconditioner.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:897
- Return type
- PC
- getPCSide()
- Return the preconditioning side.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1349
- Return type
- Side
- getPythonContext()
- Return the instance of the class implementing Python methods.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2195
- Return type
- Any
- getPythonType()
- Return the fully qualified Python name of the class used by the solver.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2225
- Return type
- str
- getRhs()
- Return the right-hand side vector for the linear system.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1960
- Return type
- Vec
- getSolution()
- Return the solution for the linear system to be solved.
Not collective.
Note that this may not be the solution that is stored during the iterative process.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1975
- Return type
- Vec
- getTolerances()
- Return various tolerances used by the KSP convergence tests.
Not collective.
Return the relative, absolute, divergence, and maximum iteration tolerances used by the default KSP convergence tests.
- rtol (float) -- The relative convergence tolerance
- atol (float) -- The absolute convergence tolerance
- dtol (float) -- The divergence tolerance
- maxits (int) -- Maximum number of iterations
- Return type
- tuple[float, float, float, int]
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:971
- getType()
- Return the KSP type as a string from the KSP object.
Not collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:509
- Return type
- str
- getWorkVecs(right=None, left=None)
- Create working vectors.
Collective.
- right (int | None) -- Number of right hand vectors to allocate.
- left (int | None) -- Number of left hand vectors to allocate.
- R (list of Vec) -- List of correctly allocated right hand vectors.
- L (list of Vec) -- List of correctly allocated left hand vectors.
- Return type
- tuple[list[Vec], list[Vec]] | list[Vec] | None
Source code at petsc4py/PETSc/KSP.pyx:1993
- logConvergenceHistory(rnorm)
- Add residual to convergence history.
Logically collective.
- Parameters
- rnorm (float) -- Residual norm to be added to convergence history.
- Return type
- None
Source code at petsc4py/PETSc/KSP.pyx:1203
- matSolve(B, X)
- Solve a linear system with multiple right-hand sides.
Collective.
These are stored as a Mat.Type.DENSE. Unlike solve, B and X must be different matrices.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1808
- matSolveTranspose(B, X)
- Solve the transpose of a linear system with multiple RHS.
Collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1830
- monitor(its, rnorm)
- Run the user provided monitor routines, if they exist.
Collective.
Notes
This routine is called by the KSP implementations. It does not typically need to be called by the user.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1294
- monitorCancel()
- Clear all monitors for a KSP object.
Logically collective.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1279
- Return type
- None
- reset()
- Resets a KSP context.
Collective.
Resets a KSP context to the kspsetupcalled = 0 state and removes any allocated Vecs and Mats.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1607
- Return type
- None
- setAppCtx(appctx)
- Set the optional user-defined context for the linear solver.
Not collective.
- Parameters
- appctx (Any) -- The user defined context
- Return type
- None
Notes
The user context is a way for users to attach any information to the KSP that they may need later when interacting with the solver.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:617
- setComputeEigenvalues(flag)
- Set a flag to compute eigenvalues.
Logically collective.
Set a flag so that the extreme eigenvalues values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
- Parameters
- flag (bool) -- Boolean whether to compute eigenvalues (or not).
- Return type
- None
Notes
Currently this option is not valid for all iterative methods.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1404
- setComputeOperators(operators, args=None, kargs=None)
- Set routine to compute the linear operators.
Logically collective.
- operators (KSPOperatorsFunction) -- Function which computes the operators.
- args (tuple[Any, ...] | None) -- Positional arguments for callback function operators.
- kargs (dict[str, Any] | None) -- Keyword arguments for callback function operators.
- Return type
- None
Notes
The user provided function Operators will be called automatically at the very next call to solve. It will NOT be called at future solve calls unless either setComputeOperators or setOperators is called before that solve is called. This allows the same system to be solved several times with different right-hand side functions, but is a confusing API since one might expect it to be called for each solve.
To reuse the same preconditioner for the next solve and not compute a new one based on the most recently computed matrix call KSPSetReusePreconditioner.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:764
- setComputeRHS(rhs, args=None, kargs=None)
- Set routine to compute the right-hand side of the linear system.
Logically collective.
- rhs (KSPRHSFunction) -- Function which computes the right-hand side.
- args (tuple[Any, ...] | None) -- Positional arguments for callback function rhs.
- kargs (dict[str, Any] | None) -- Keyword arguments for callback function rhs.
- Return type
- None
Notes
The routine you provide will be called each time you call solve to prepare the new right-hand side for that solve.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:730
- setComputeSingularValues(flag)
- Set flag to calculate singular values.
Logically collective.
Set a flag so that the extreme singular values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
- Parameters
- flag (bool) -- Boolean whether to compute singular values (or not).
- Return type
- None
Notes
Currently this option is not valid for all iterative methods.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1448
- setConvergedReason(reason)
- Use reason property.
Source code at petsc4py/PETSc/KSP.pyx:1871
- Parameters
- reason (ConvergedReason)
- Return type
- None
- setConvergenceHistory(length=None, reset=False)
- Set the array used to hold the residual history.
Not collective.
If set, this array will contain the residual norms computed at each iteration of the solver.
- length (int | None) -- Length of array to store history in.
- reset (bool) -- True indicates the history counter is reset to zero for each new linear solve.
- Return type
- None
Notes
If length is not provided or None then a default array of length 10000 is allocated.
If the array is not long enough then once the iterations is longer than the array length solve stops recording the history.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1144
- setConvergenceTest(converged, args=None, kargs=None)
- Set the function to be used to determine convergence.
Logically collective.
- converged (KSPConvergenceTestFunction) -- Callback which computes the convergence.
- args (tuple[Any, ...] | None) -- Positional arguments for callback function.
- kargs (dict[str, Any] | None) -- Keyword arguments for callback function.
- Return type
- None
Notes
Must be called after the KSP type has been set so put this after a call to setType, or setFromOptions.
The default is a combination of relative and absolute tolerances. The residual value that is tested may be an approximation; routines that need exact values should compute them.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1000
- setDM(dm)
- Set the DM that may be used by some preconditioners.
Logically collective.
- Parameters
- dm (DM) -- The DM object, cannot be None.
- Return type
- None
Notes
If this is used then the KSP will attempt to use the DM to create the matrix and use the routine set with DM.setKSPComputeOperators. Use setDMActive(False) to instead use the matrix you have provided with setOperators.
A DM can only be used for solving one problem at a time because information about the problem is stored on the DM, even when not using interfaces like DM.setKSPComputeOperators. Use DM.clone to get a distinct DM when solving different problems using the same function space.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:671
- setDMActive(flag)
- DM should be used to generate system matrix & RHS vector.
Logically collective.
- Parameters
- flag (bool) -- Whether to use the DM.
- Return type
- None
Notes
By default setDM sets the DM as active, call setDMActive(False) after setDM(dm) to not have the KSP object use the DM to generate the matrices.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:704
- setErrorIfNotConverged(flag)
- Cause solve to generate an error if not converged.
Logically collective.
- Parameters
- flag (bool) -- True enables this behavior.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1928
- setFromOptions()
- Set KSP options from the options database.
Collective.
This routine must be called before setUp if the user is to be allowed to set the Krylov type.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:600
- Return type
- None
- setGMRESRestart(restart)
- Set number of iterations at which KSP restarts.
Logically collective.
Suitable KSPs are: KSPGMRES, KSPFGMRES and KSPLGMRES.
- Parameters
- restart (int) -- Integer restart value.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:2132
- setHPDDMType(hpddm_type)
- Set the Krylov solver type.
Collective.
- Parameters
- hpddm_type (HPDDMType) -- The type of Krylov solver to use.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1896
- setInitialGuessKnoll(flag)
- Tell solver to use PC.apply to compute the initial guess.
Logically collective.
This is the Knoll trick.
- Parameters
- flag (bool) -- True uses Knoll trick.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1530
- setInitialGuessNonzero(flag)
- Tell the iterative solver that the initial guess is nonzero.
Logically collective.
Otherwise KSP assumes the initial guess is to be zero (and thus zeros it out before solving).
- Parameters
- flag (bool) -- True indicates the guess is non-zero, False indicates the guess is zero.
- Return type
- None
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1494
- setIterationNumber(its)
- Use its property.
Source code at petsc4py/PETSc/KSP.pyx:1849
- Parameters
- its (int)
- Return type
- None
- setMonitor(monitor, args=None, kargs=None)
- Set additional function to monitor the residual.
Logically collective.
Set an ADDITIONAL function to be called at every iteration to monitor the residual/error etc.
- monitor (KSPMonitorFunction) -- Callback which monitors the convergence.
- args (tuple[Any, ...] | None) -- Positional arguments for callback function.
- kargs (dict[str, Any] | None) -- Keyword arguments for callback function.
- Return type
- None
Notes
The default is to do nothing. To print the residual, or preconditioned residual if setNormType(NORM_PRECONDITIONED) was called, use monitor as the monitoring routine, with a PETSc.Viewer.ASCII as the context.
Several different monitoring routines may be set by calling setMonitor multiple times; all will be called in the order in which they were set.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1219
- setNormType(normtype)
- Set the norm that is used for convergence testing.
Logically collective.
- Parameters
- normtype (NormType) -- The norm type to use (see NormType).
- Return type
- None
Notes
Not all combinations of preconditioner side (see setPCSide) and norm type are supported by all Krylov methods. If only one is set, PETSc tries to automatically change the other to find a compatible pair. If no such combination is supported, PETSc will generate an error.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:1363
- setOperators(A=None, P=None)
- Set matrix associated with the linear system.
Collective.
Set the matrix associated with the linear system and a (possibly) different one from which the preconditioner will be built.
- A (Mat | None) -- Matrix that defines the linear system.
- P (Mat | None) -- Matrix to be used in constructing the preconditioner, usually the same as A.
- Return type
- None
Notes
If you know the operator A has a null space you can use Mat.setNullSpace and Mat.setTransposeNullSpace to supply the null space to A and the KSP solvers will automatically use that null space as needed during the solution process.
All future calls to setOperators must use the same size matrices!
Passing None for A or P removes the matrix that is currently used.
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:809
- setOptionsPrefix(prefix)
- Set the prefix used for all KSP options in the database.
Logically collective.
- Parameters
- prefix (str | None) -- The options prefix.
- Return type
- None
Notes
A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen. For example, to distinguish between the runtime options for two different KSP contexts, one could call ` KSPSetOptionsPrefix(ksp1, "sys1_") KSPSetOptionsPrefix(ksp2, "sys2_") `
This would enable use of different options for each system, such as ` -sys1_ksp_type gmres -sys1_ksp_rtol 1.e-3 -sys2_ksp_type bcgs -sys2_ksp_rtol 1.e-4 `
SEE ALSO:
Source code at petsc4py/PETSc/KSP.pyx:523
- setPC(pc)
- Set the preconditioner.
Collective.
Set