List of all functions
Here a summary of all functions:
PETSc.AbstractOptionsPETSc.AbstractViewerPETSc.DMGlobalVecPETSc.DMLocalVecPETSc.Fn_KSPComputeOperatorsPETSc.Fn_KSPComputeRHSPETSc.GlobalOptionsPETSc.KSPPETSc.KSPPETSc.MatPETSc.MatNullSpacePETSc.MatSeqAIJPETSc.MatSeqDensePETSc.MatShellPETSc.MatStencilPETSc.OptionsPETSc.PetscLibTypePETSc.SNESPETSc.VecPETSc.VecSeqPETSc.ViewerStdoutBase.emptyBase.emptyPETSc.DMDACreate1dPETSc.DMDACreate2dPETSc.DMDACreate3dPETSc.DMLocalToGlobalPETSc.DMStagCreate1dPETSc.DMStagCreate2dPETSc.DMStagCreate3dPETSc.DMStagCreateCompatibleDMStagPETSc.DMStagGetBoundaryTypesPETSc.DMStagGetDOFPETSc.DMStagGetEntriesPerElementPETSc.DMStagGetGhostArrayLocationSlotPETSc.DMStagGetGlobalSizesPETSc.DMStagGetIndicesPETSc.DMStagGetIsFirstRankPETSc.DMStagGetIsLastRankPETSc.DMStagGetLocalSizesPETSc.DMStagGetLocationSlotPETSc.DMStagGetNumRanksPETSc.DMStagGetProductCoordinateLocationSlotPETSc.DMStagGetStencilTypePETSc.DMStagGetStencilWidthPETSc.DMStagMatGetValuesStencilPETSc.DMStagMatSetValuesStencilPETSc.DMStagSetUniformCoordinatesExplicitPETSc.DMStagVecGetArrayPETSc.DMStagVecGetArrayReadPETSc.DMStagVecGetValuesStencilPETSc.DMStagVecSetValuesStencilPETSc.InitializePETSc.InitializedPETSc.KSPSetComputeOperators!PETSc.KSPSetComputeRHS!PETSc.LocalInGlobalIndicesPETSc.MatNullSpaceRemove!PETSc.MatSetNullSpace!PETSc.MatSetValuesStencil!PETSc.createglobalvectorPETSc.createlocalvectorPETSc.creatematrixPETSc.decrefPETSc.destroyPETSc.finalizePETSc.finalizedPETSc.getcoordinateDMPETSc.getcoordinateslocalPETSc.getcornersPETSc.getcornersPETSc.getdimensionPETSc.getghostcornersPETSc.getghostcornersPETSc.getinfoPETSc.gettypePETSc.getvalues!PETSc.increfPETSc.inttypePETSc.itersPETSc.map_unsafe_localarray!PETSc.nrefsPETSc.ownershiprangePETSc.parse_optionsPETSc.realtypePETSc.resnormPETSc.scalartypePETSc.setfromoptions!PETSc.setuniformcoordinates!PETSc.setuniformcoordinates!PETSc.setuniformcoordinatesproduct!PETSc.setup!PETSc.setvalues!PETSc.unsafe_localarrayPETSc.update!PETSc.update!PETSc.update!PETSc.update!PETSc.update!PETSc.update_global2local!PETSc.update_local2global!PETSc.viewPETSc.with
PETSc.AbstractOptions — TypeAbstractOptions{PetscLib <: PetscLibType}Abstract type of PETSc solver options.
PETSc.AbstractViewer — TypeAbstractViewer{PetscLib <: PetscLibType}Abstract type of PETSc viewer.
External Links
- PETSc Manual:
Viewer/PetscViewer
PETSc.DMGlobalVec — TypeDMGlobalVec(v::CVec, dm::AbstractDM)Container for an PETSc vector we know is "global"
External Links
- PETSc Manual:
Vec/Vec
PETSc.DMLocalVec — TypeDMLocalVec(v::CVec, dm::AbstractDM)Container for an PETSc vector we know is "local"
External Links
- PETSc Manual:
Vec/Vec
PETSc.GlobalOptions — TypeGlobalOptions{PetscLib <: PetscLibType}The PETSc global options database.
PETSc.Mat — TypePETSc.MatNullSpace — TypeMatNullSpace{T}Object that removes a null space from a vector, i.e. orthogonalizes the vector to a subspace; see MatNullSpace and MatNullSpaceCreate
!!! Note The caller is responsible for calling destroy on this object
PETSc.MatSeqAIJ — TypeMatSeqAIJ{T}PETSc sparse array using AIJ format (also known as a compressed sparse row or CSR format).
Memory allocation is handled by PETSc.
PETSc.MatSeqDense — TypeMatSeqDense{T}PETSc dense array. This wraps a Julia Matrix{T} object.
PETSc.MatShell — TypeMatShell{T}(obj, m, n)Create a m×n PETSc shell matrix object wrapping obj.
If obj is a Function, then the multiply action obj(y,x); otherwise it calls mul!(y, obj, x). This can be changed by defining PETSc._mul!.
PETSc.MatStencil — TypePETSc.Options — TypeOptions{PetscLib <: PetscLibType}(kw -> arg, ...)
Options(petsclib, kw -> arg, ...)Create a PETSc options data structure for the petsclib.
For construction a set of keyword argment pairs should be given. If the option has no value it should be set to nothing or true. Setting an option to false will cause the option not to be set on the PETSc options table.
Examples
julia> using PETSc
julia> petsclib = PETSc.petsclibs[1];
julia> PETSc.initialize(petsclib)
julia> opt = PETSc.Options(
petsclib,
ksp_monitor = nothing,
ksp_view = true,
pc_type = "mg",
pc_mg_levels = 1,
false_opt = false,
)
#PETSc Option Table entries:
-ksp_monitor
-ksp_view
-pc_mg_levels 1
-pc_type mg
#End of PETSc Option Table entries
julia> opt["ksp_monitor"]
""
julia> opt["pc_type"]
"mg"
julia> opt["pc_type"] = "ilu"
"ilu"
julia> opt["pc_type"]
"ilu"
julia> opt["false_opt"]
ERROR: KeyError: key "bad_key" not found
julia> opt["bad_key"]
ERROR: KeyError: key "bad_key" not foundExternal Links
- PETSc Manual:
Sys/PetscOptionsCreate
PETSc.PetscLibType — TypePetscLibType{PetscScalar, PetscInt}(petsc_library)A container for specific PETSc libraries.
All other containers for PETSc objects should be typed on this to ensure that dispatch is correct.
PETSc.SNES — MethodSNES{PetscScalar}(
::UnionPetscLib,
comm::MPI.Comm;
snessetfromoptions = true,
options...)Initializes a SNES nonlinear solver object
PETSc.Vec — TypePETSc.VecSeq — TypeVecSeq(v::Vector)A standard, sequentially-stored serial PETSc vector, wrapping the Julia vector v.
This reuses the array v as storage, and so v should not be resize!-ed or otherwise have its length modified while the PETSc object exists.
This should only be need to be called for more advanced uses, for most simple usecases, users should be able to pass Vectors directly and have the wrapping performed automatically
External Links
- PETSc Manual:
Vec/VecCreateSeqWithArray
PETSc.ViewerStdout — TypeViewerStdout(petsclib, comm = MPI.COMM_SELF)Create an ASCII PetscViewer for the comm
External Links
- PETSc Manual:
Viewer/PETSC_VIEWER_STDOUT_
Base.empty — Methodempty(da::DMDA)return an uninitialized DMDA struct.
PETSc.DMDACreate1d — FunctionDMDACreate1d(
::PetscLib
comm::MPI.Comm,
boundary_type::DMBoundaryType,
global_dim,
dof_per_node,
stencil_width,
points_per_proc::Union{Nothing, Vector{PetscInt}};
dmsetfromoptions=true,
dmsetup=true,
options...
)Creates a 1-D distributed array with the options specified using keyword arguments.
If keyword argument dmsetfromoptions == true then setfromoptions! called. If keyword argument dmsetup == true then setup! is called.
External Links
- PETSc Manual:
DMDA/DMDACreate1d
PETSc.DMDACreate2d — FunctionDMDACreate2d(
::PetscLib
comm::MPI.Comm,
boundary_type_x::DMBoundaryType,
boundary_type_y::DMBoundaryType,
stencil_type::DMDAStencilType,
global_dim_x,
global_dim_y,
procs_x,
procs_y,
dof_per_node,
stencil_width,
points_per_proc_x::Union{Nothing, Vector{PetscInt}};
points_per_proc_y::Union{Nothing, Vector{PetscInt}};
dmsetfromoptions=true,
dmsetup=true,
options...
)Creates a 2-D distributed array with the options specified using keyword arguments.
If keyword argument dmsetfromoptions == true then setfromoptions! called. If keyword argument dmsetup == true then setup! is called.
External Links
- PETSc Manual:
DMDA/DMDACreate2d
PETSc.DMDACreate3d — FunctionDMDACreate3d(
::PetscLib
comm::MPI.Comm,
boundary_type_x::DMBoundaryType,
boundary_type_y::DMBoundaryType,
boundary_type_z::DMBoundaryType,
stencil_type::DMDAStencilType,
global_dim_x,
global_dim_y,
global_dim_z,
procs_x,
procs_y,
procs_z,
global_dim_z,
dof_per_node,
stencil_width,
points_per_proc_x::Union{Nothing, Vector{PetscInt}};
points_per_proc_y::Union{Nothing, Vector{PetscInt}};
points_per_proc_z::Union{Nothing, Vector{PetscInt}};
dmsetfromoptions=true,
dmsetup=true,
options...
)Creates a 3-D distributed array with the options specified using keyword arguments.
If keyword argument dmsetfromoptions == true then setfromoptions! called. If keyword argument dmsetup == true then setup! is called.
External Links
- PETSc Manual:
DMDA/DMDACreate3d
PETSc.Initialize — Functioninitialize([petsclib])
Initialized the petsclib, if no petsclib is given then all PETSc.petsclibs will be initialized.
Additionally:
This will initialize MPI if it has not already been initialized.
It will disable the PETSc signal handler (via
Sys/PetscPopSignalHandlerAdd an
atexithook to callPETSc.finalize.
External Links
- PETSc Manual:
Sys/PetscInitializeNoArguments
PETSc.Initialized — Functioninitialized(petsclib)
Check if petsclib is initialized
External Links
- PETSc Manual:
Sys/PetscInitialized
PETSc.MatNullSpaceRemove! — FunctionMatNullSpaceRemove!(nullspace, vec)Removes all the components of a nullspace from vec
see PETSc manual
PETSc.MatSetNullSpace! — FunctionPETSc.MatSetValuesStencil! — FunctionMatSetValuesStencil!(mat::AbstractMat{PetscScalar},
rows::Vector{MatStencil{PetscInt}},
cols::Vector{MatStencil{PetscInt}},
vals::Vector{PetscScalar},
mode;
num_cols = length(col),
num_rows = length(row)
)Insert the vals specified by rows and cols stencil indices into the mat. The optional arguments num_cosl and num_rows allow the limiting of the elements of the rows and cols vectors.
see PETSc manual
PETSc.createglobalvector — Functioncreateglobalvector(dm::DM; write::Bool = true, read::Bool = true)returns a global vector from the dm object.
External Links
- PETSc Manual:
DM/DMCreateGlobalVector
PETSc.createlocalvector — Functioncreatelocalvector(dm::AbstractDM)returns a local vector from the dm object.
External Links
- PETSc Manual:
DM/DMCreateLocalVector
PETSc.creatematrix — Functioncreatematrix(dm::AbstractDM)Generates a matrix from the dm object.
External Links
- PETSc Manual:
DM/DMCreateMatrix
PETSc.decref — Methoddecref(obj)Decrement the reference counter for obj.
In general we don't need to use this, as we can call destroy instead.
PETSc.finalize — Functionfinalize(petsclib)
Finalize the petsclib, if no petsclib is given then all PETSc.petsclibs will be finalized.
External Links
- PETSc Manual:
Sys/PetscFinalize
PETSc.finalized — FunctionPETSc.getcoordinateDM — FunctiongetcoordinateDM(dm::AbstractDM)Create a coord_dm for the coordinates of dm.
External Links
- PETSc Manual:
DM/DMGetCoordinateDM
PETSc.getcoordinateslocal — Functiongetcoordinateslocal(dm::AbstractDM)Gets a local vector with the coordinates associated with dm.
External Links
- PETSc Manual:
DM/DMGetCoordinatesLocal
PETSc.getcorners — Methodgetcorners(da::DMDA)Returns a NamedTuple with the global indices (excluding ghost points) of the lower and upper corners as well as the size.
External Links
- PETSc Manual:
DMDA/DMDAGetCorners
PETSc.getdimension — Methodgetdimension(dm::AbstractDM)Return the topological dimension of the dm
External Links
- PETSc Manual:
DM/DMGetDimension
PETSc.getghostcorners — Methodgetghostcorners(da::DMDA)Returns a NamedTuple with the global indices (including ghost points) of the lower and upper corners as well as the size.
External Links
- PETSc Manual:
DMDA/DMDAGetGhostCorners
PETSc.getinfo — Methodgetinfo(da::DMDA)Get the info associated with the distributed array da.
External Links
- PETSc Manual:
DMDA/DMDAGetInfo
PETSc.gettype — MethodPETSc.getvalues! — Methodgetvalues!(
vector::AbstractVec{PetscScalar},
indices::Vector{PetscInt},
vals::Vector{PetscScalar};
num_vals = length(inds)
)Get a set of values from the vector. Equivalent to one of the following
vals[1:num_vals] .= vector[indices[1:num_vals]]indices should use 0-based indexing!
External Links
- PETSc Manual:
Vec/VecGetValues
PETSc.incref — Methodincref(obj)Increment the reference counter fo obj. This usually only needs to be called when accessing objects owned by other objects, e.g. via KSPGetPC.
PETSc.inttype — Methodinttype(petsclib::PetscLibType)return the int type for the associated petsclib
PETSc.map_unsafe_localarray! — Methodmap_unsafe_localarray!(f!, x::AbstractVec{T}; read=true, write=true)Convert x to an Array{T} and apply the function f!.
Use read=false if the array is write-only; write=false if read-only.
Examples
```julia-repl julia> mapunsafelocalarray(x; write=true) do x @. x .*= 2 end
Base.finalize should is automatically called on the array.
PETSc.nrefs — Methodnrefs(obj)The current reference count for obj.
PETSc.ownershiprange — Functionownershiprange(vec::AbstractVec)The range of indices owned by this processor, assuming that the vectors are laid out with the first n1 elements on the first processor, next n2 elements on the second, etc. For certain parallel layouts this range may not be well defined.
Note: unlike the C function, the range returned is inclusive (idx_first:idx_last)
External Links
- PETSc Manual:
Vec/VecGetOwnershipRange
PETSc.parse_options — Methodparse_options(args::Vector{String})Parse the args vector into a NamedTuple that can be used as the options for the PETSc solvers.
julia --project file.jl -ksp_monitor -pc_type mg -ksp_viewPETSc.realtype — Methodrealtype(petsclib::PetscLibType)return the real type for the associated petsclib
PETSc.scalartype — Methodscalartype(petsclib::PetscLibType)return the scalar type for the associated petsclib
PETSc.setfromoptions! — FunctionPETSc.setuniformcoordinates! — Functionsetuniformcoordinates!(
da::DMDA
xyzmin::NTuple{N, Real},
xyzmax::NTuple{N, Real},
) where {N}Set uniform coordinates for the da using the lower and upper corners defined by the NTuples xyzmin and xyzmax. If N is less than the dimension of the da then the value of the trailing coordinates is set to 0.
External Links
- PETSc Manual:
DMDA/DMDASetUniformCoordinates
PETSc.setup! — FunctionPETSc.setvalues! — Methodsetvalues!(
vector::AbstractVec{PetscScalar},
indices::Vector{PetscInt},
vals::Vector{PetscScalar},
mode::InsertMode;
num_vals = length(ind)
)Insert a set of values into the vector. Equivalent to one of the following depending on the mode
vector[indices[1:num_vals]] .= vals[1:num_vals]
vector[indices[1:num_vals]] .+= vals[1:num_vals]indices should use 0-based indexing!
External Links
- PETSc Manual:
Vec/VecSetValues
PETSc.unsafe_localarray — Functionunsafe_localarray(PetscScalar, ptr:CVec; read=true, write=true)
unsafe_localarray(ptr:AbstractVec; read=true, write=true)Return an Array{PetscScalar} containing local portion of the PETSc data.
Use read=false if the array is write-only; write=false if read-only.
Base.finalize should be called on the Array before the data can be used.
PETSc.update! — Methodupdate!(
global_vec::DMGlobalVec,
local_vec::DMLocalVec,
mode::InsertMode,
)Updates global_vec from local_vec with insert mode
External Links
- PETSc Manual:
DM/DMLocalToGlobal
PETSc.update! — Methodupdate!(
global_ptr::CVec,
local_vec::DMLocalVec,
mode::InsertMode,
)Updates pointer to global vec global_ptr from local_vec with insert mode
External Links
- PETSc Manual:
DM/DMLocalToGlobal
PETSc.update! — Methodupdate!(
local_vec::DMLocalVec,
global_vec::DMGlobalVec,
mode::InsertMode
)Updates local_vec from a pointer to a global vec global_ptr with insert mode
External Links
- PETSc Manual:
DM/DMGlobalToLocal
PETSc.update! — Methodupdate!(
local_vec::DMLocalVec,
global_ptr::CVec,
mode::InsertMode,
)Updates local_vec from pointer to global vec global_ptr with insert mode
External Links
- PETSc Manual:
DM/DMGlobalToLocal
PETSc.update! — Methodupdate!(
local_ptr::CVec,
global_vec::DMGlobalVec
mode::InsertMode,
)Updates pointer to local vec local_ptr from global_vec with insert mode
External Links
- PETSc Manual:
DM/DMGlobalToLocal
PETSc.update_global2local! — Functionupdate_global2local!(
local_ptr::CVec,
global_ptr::CVec,
mode::InsertMode,
dm::AbstractDM
)Updates pointer to local vector from pointer to global vector with insert mode, assuming that both belong to the same dm
This is a low-level routine that is typically called by update!
PETSc.update_local2global! — Functionupdate_local2global!(
global_ptr::CVec,
local_ptr::CVec,
mode::InsertMode,
dm::AbstractDM
)Updates pointer of global_vec from pointer of local_vec with insert mode. Both vectors should belong to the same dm
This is a low-level routine that is typically called by update!
PETSc.view — Methodview(dm::AbstractDM, viewer::Viewer=ViewerStdout(petsclib, getcomm(dm)))view a dm with viewer
External Links
- PETSc Manual:
DM/DMView
PETSc.with — Methodwith(f, opts::Options)Call f() with the Options opts set temporarily (in addition to any global options).