Vec - Low-level Interface

This page documents the low-level, automatically wrapped PETSc Vec functions available through LibPETSc. These functions provide direct access to the PETSc C API.

For the high-level Julia interface, see Vec.

Overview

The Vec interface includes:

  • Core Vec operations: Creation, manipulation, and mathematical operations on vectors (~186 functions in Vec_wrappers.jl)
  • Vec utilities: Scatter operations, FFTW integration, and advanced vector operations (~76 functions in Vecs_wrappers.jl)
  • VecTagger: Tools for tagging/marking vector elements based on criteria (~31 functions in VecTagger_wrappers.jl)

Usage

All low-level Vec functions require a petsclib parameter as the first argument:

using PETSc

# Get the library instance
petsclib = PETSc.petsclibs[1]
PETSc.initialize(petsclib)

# Get PETSc types
PetscInt = petsclib.PetscInt

# Create a vector
vec = LibPETSc.VecCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
LibPETSc.VecSetSizes(petsclib, vec, PetscInt(10), PetscInt(10))
LibPETSc.VecSetType(petsclib, vec, "seq")  # Set vector type
LibPETSc.VecSetFromOptions(petsclib, vec)

# Set values
LibPETSc.VecSet(petsclib, vec, 1.0)

# Query the vector
size = LibPETSc.VecGetSize(petsclib, vec)
println("Vector size: $size")

# Get values (0-based indexing!)
idx = PetscInt(0)
val = LibPETSc.VecGetValues(petsclib, vec, PetscInt(1), [idx])
println("Value at index 0: $(val[1])")

# Clean up
LibPETSc.VecDestroy(petsclib, vec)
PETSc.finalize(petsclib)

Function Reference

PETSc.LibPETSc.VecAXPBYMethod
VecAXPBY(petsclib::PetscLibType,y::PetscVec, alpha::PetscScalar, beta::PetscScalar, x::PetscVec)

Computes y = alpha x + beta y.

Logically Collective

Input Parameters:

  • alpha - first scalar
  • beta - second scalar
  • x - the first scaled vector
  • y - the second scaled vector

Output Parameter:

  • y - output vector

Level: intermediate

-seealso: , Vec, VecAYPX(), VecMAXPY(), VecWAXPY(), VecAXPY(), VecAXPBYPCZ()

External Links

source
PETSc.LibPETSc.VecAXPBYPCZMethod
VecAXPBYPCZ(petsclib::PetscLibType,z::PetscVec, alpha::PetscScalar, beta::PetscScalar, gamma::PetscScalar, x::PetscVec, y::PetscVec)

Computes z = alpha x + beta y + gamma z

Logically Collective

Input Parameters:

  • alpha - first scalar
  • beta - second scalar
  • gamma - third scalar
  • x - first vector
  • y - second vector
  • z - third vector

Output Parameter:

  • z - output vector

Level: intermediate

-seealso: , Vec, VecAYPX(), VecMAXPY(), VecWAXPY(), VecAXPY(), VecAXPBY()

External Links

source
PETSc.LibPETSc.VecAXPYMethod
VecAXPY(petsclib::PetscLibType,y::PetscVec, alpha::PetscScalar, x::PetscVec)

Computes y = alpha x + y.

Logically Collective

Input Parameters:

  • alpha - the scalar
  • x - vector scale by alpha
  • y - vector accumulated into

Output Parameter:

  • y - output vector

Level: intermediate

-seealso: , Vec, VecAYPX(), VecMAXPY(), VecWAXPY(), VecAXPBYPCZ(), VecAXPBY()

External Links

source
PETSc.LibPETSc.VecAYPXMethod
VecAYPX(petsclib::PetscLibType,y::PetscVec, beta::PetscScalar, x::PetscVec)

Computes y = x + beta y.

Logically Collective

Input Parameters:

  • beta - the scalar
  • x - the unscaled vector
  • y - the vector to be scaled

Output Parameter:

  • y - output vector

Level: intermediate

-seealso: , Vec, VecMAXPY(), VecWAXPY(), VecAXPY(), VecAXPBYPCZ(), VecAXPBY()

External Links

source
PETSc.LibPETSc.VecAbsMethod
VecAbs(petsclib::PetscLibType,v::PetscVec)

Replaces every element in a vector with its absolute value.

Logically Collective

Input Parameter:

  • v - the vector

Level: intermediate

-seealso: Vec, VecExp(), VecSqrtAbs(), VecReciprocal(), VecLog()

External Links

source
PETSc.LibPETSc.VecAppendOptionsPrefixMethod
VecAppendOptionsPrefix(petsclib::PetscLibType,v::PetscVec, prefix::Vector{Cchar})

Appends to the prefix used for searching for all Vec options in the database.

Logically Collective

Input Parameters:

  • v - the Vec context
  • prefix - the prefix to prepend to all option names

Level: advanced

-seealso: , Vec, VecGetOptionsPrefix()

External Links

source
PETSc.LibPETSc.VecAssemblyBeginMethod
VecAssemblyBegin(petsclib::PetscLibType,vec::PetscVec)

Begins assembling the vector; that is ensuring all the vector's entries are stored on the correct MPI process. This routine should be called after completing all calls to VecSetValues().

Collective

Input Parameter:

  • vec - the vector

Level: beginner

-seealso: , Vec, VecAssemblyEnd(), VecSetValues()

External Links

source
PETSc.LibPETSc.VecAssemblyEndMethod
VecAssemblyEnd(petsclib::PetscLibType,vec::PetscVec)

Completes assembling the vector. This routine should be called after VecAssemblyBegin().

Collective

Input Parameter:

  • vec - the vector

Options Database Keys:

  • -vec_view - Prints vector in PETSC_VIEWER_DEFAULT format
  • -vec_view ::ascii_matlab - Prints vector in PETSC_VIEWER_ASCII_MATLAB format to stdout
  • -vec_view matlab:filename - Prints vector in MATLAB .mat file to filename (requires PETSc configured with –with-matlab)
  • -vec_view draw - Activates vector viewing using drawing tools
  • -display <name> - Sets display name (default is host)
  • -draw_pause <sec> - Sets number of seconds to pause after display
  • -vec_view socket - Activates vector viewing using a socket

Level: beginner

-seealso: , Vec, VecAssemblyBegin(), VecSetValues()

External Links

source
PETSc.LibPETSc.VecBindToCPUMethod
VecBindToCPU(petsclib::PetscLibType,v::PetscVec, flg::PetscBool)

marks a vector to temporarily stay on the CPU and perform computations on the CPU

Logically collective

Input Parameters:

  • v - the vector
  • flg - bind to the CPU if value of PETSC_TRUE

Level: intermediate

-seealso: , Vec, VecBoundToCPU()

External Links

source
PETSc.LibPETSc.VecBoundGradientProjectionMethod
VecBoundGradientProjection(petsclib::PetscLibType,G::PetscVec, X::PetscVec, XL::PetscVec, XU::PetscVec, GP::PetscVec)

Projects vector according to this definition. If XL[i] < X[i] < XU[i], then GP[i] = G[i]; If X[i] <= XL[i], then GP[i] = min(G[i],0); If X[i] >= XU[i], then GP[i] = max(G[i],0);

Input Parameters:

  • G - current gradient vector
  • X - current solution vector with XL[i] <= X[i] <= XU[i]
  • XL - lower bounds
  • XU - upper bounds

Output Parameter:

  • GP - gradient projection vector

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecBoundToCPUMethod
flg::PetscBool = VecBoundToCPU(petsclib::PetscLibType,v::PetscVec)

query if a vector is bound to the CPU

Not collective

Input Parameter:

  • v - the vector

Output Parameter:

  • flg - the logical flag

Level: intermediate

-seealso: , Vec, VecBindToCPU()

External Links

source
PETSc.LibPETSc.VecConcatenateMethod
VecConcatenate(petsclib::PetscLibType,nx::PetscInt, X::Vector{PetscVec}, Y::PetscVec, x_is::Vector{IS})

Creates a new vector that is a vertical concatenation of all the given array of vectors in the order they appear in the array. The concatenated vector resides on the same communicator and is the same type as the source vectors.

Collective

Input Parameters:

  • nx - number of vectors to be concatenated
  • X - array containing the vectors to be concatenated in the order of concatenation

Output Parameters:

  • Y - concatenated vector
  • x_is - array of index sets corresponding to the concatenated components of Y (pass NULL if not needed)

Level: advanced

-seealso: , Vec, VECNEST, VECSCATTER, VecScatterCreate()

External Links

source
PETSc.LibPETSc.VecConjugateMethod
VecConjugate(petsclib::PetscLibType,x::PetscVec)

Conjugates a vector. That is, replace every entry in a vector with its complex conjugate

Logically Collective

Input Parameter:

  • x - the vector

Level: intermediate

-seealso: , Vec, VecSet()

External Links

source
PETSc.LibPETSc.VecCopyMethod
VecCopy(petsclib::PetscLibType,x::PetscVec, y::PetscVec)

Copies a vector y = x

Logically Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • y - the copy

Level: beginner

-seealso: , Vec, VecDuplicate()

External Links

source
PETSc.LibPETSc.VecCreateMethod
vec::PetscVec = VecCreate(petsclib::PetscLibType,comm::MPI_Comm)

Creates an empty vector object. The type can then be set with VecSetType(), or VecSetFromOptions().

Collective

Input Parameter:

  • comm - The communicator for the vector object

Output Parameter:

  • vec - The vector object

Level: beginner

-seealso: , Vec, VecSetType(), VecSetSizes(), VecCreateMPIWithArray(), VecCreateMPI(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost(), VecCreateSeq(), VecPlaceArray()

External Links

source
PETSc.LibPETSc.VecCreateFromOptionsMethod
vec::PetscVec = VecCreateFromOptions(petsclib::PetscLibType,comm::MPI_Comm, prefix::Vector{Cchar}, bs::PetscInt, m::PetscInt, n::PetscInt)

Creates a vector whose type is set from the options database

Collective

Input Parameters:

  • comm - The communicator for the vector object
  • prefix - [optional] prefix for the options database
  • bs - the block size (commonly 1)
  • m - the local size (or PETSC_DECIDE)
  • n - the global size (or PETSC_DETERMINE)

Output Parameter:

  • vec - The vector object

Options Database Keys:

  • -vec_type - see VecType, for example seq, mpi, cuda, defaults to mpi

Level: beginner

-seealso: , Vec, VecSetType(), VecSetSizes(), VecCreateMPIWithArray(), VecCreateMPI(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost(), VecCreateSeq(), VecPlaceArray(), VecCreate(), VecType

External Links

source
PETSc.LibPETSc.VecCreateGhostMethod
vv::PetscVec = VecCreateGhost(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt, nghost::PetscInt, ghosts::Vector{PetscInt})

Creates a parallel vector with ghost padding on each processor.

Collective

Input Parameters:

  • comm - the MPI communicator to use
  • n - local vector length
  • N - global vector length (or PETSC_DETERMINE to have calculated if n is given)
  • nghost - number of local ghost points
  • ghosts - global indices of ghost points, these do not need to be in increasing order (sorted)

Output Parameter:

  • vv - the global vector representation (without ghost points as part of vector)

Level: advanced

-seealso: , Vec, VecType, VecCreateSeq(), VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateMPI(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(), VecGhostUpdateBegin(), VecCreateGhostWithArray(), VecCreateMPIWithArray(), VecGhostUpdateEnd(), VecCreateGhostBlock(), VecCreateGhostBlockWithArray(), VecMPISetGhost()

External Links

source
PETSc.LibPETSc.VecCreateGhostBlockMethod
vv::PetscVec = VecCreateGhostBlock(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, n::PetscInt, N::PetscInt, nghost::PetscInt, ghosts::Vector{PetscInt})

Creates a parallel vector with ghost padding on each processor. The indicing of the ghost points is done with blocks.

Collective

Input Parameters:

  • comm - the MPI communicator to use
  • bs - the block size
  • n - local vector length
  • N - global vector length (or PETSC_DETERMINE to have calculated if n is given)
  • nghost - number of local ghost blocks
  • ghosts - global indices of ghost blocks, counts are by block, not by individual index, these do not need to be in increasing order (sorted)

Output Parameter:

  • vv - the global vector representation (without ghost points as part of vector)

Level: advanced

-seealso: , Vec, VecType, VecCreateSeq(), VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateMPI(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(), VecGhostUpdateBegin(), VecGhostUpdateEnd() VecCreateGhostWithArray(), VecCreateMPIWithArray(), VecCreateGhostBlockWithArray()

External Links

source
PETSc.LibPETSc.VecCreateGhostBlockWithArrayMethod
vv::PetscVec = VecCreateGhostBlockWithArray(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, n::PetscInt, N::PetscInt, nghost::PetscInt, ghosts::Vector{PetscInt}, array::Vector{PetscScalar})

Creates a parallel vector with ghost padding on each processor; the caller allocates the array space. Indices in the ghost region are based on blocks.

Collective

Input Parameters:

  • comm - the MPI communicator to use
  • bs - block size
  • n - local vector length
  • N - global vector length (or PETSC_DETERMINE to have calculated if n is given)
  • nghost - number of local ghost blocks
  • ghosts - global indices of ghost blocks (or NULL if not needed), counts are by block not by index, these do not need to be in increasing order (sorted)
  • array - the space to store the vector values (as long as n + nghost*bs)

Output Parameter:

  • vv - the global vector representation (without ghost points as part of vector)

Level: advanced

-seealso: , Vec, VecType, VecCreate(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(), VecCreateGhost(), VecCreateSeqWithArray(), VecCreateMPIWithArray(), VecCreateGhostWithArray(), VecCreateGhostBlock(), VecGhostUpdateBegin(), VecGhostUpdateEnd()

External Links

source
PETSc.LibPETSc.VecCreateGhostWithArrayMethod
vv::PetscVec = VecCreateGhostWithArray(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt, nghost::PetscInt, ghosts::Vector{PetscInt}, array::Vector{PetscScalar})

Creates a parallel vector with ghost padding on each processor; the caller allocates the array space.

Collective

Input Parameters:

  • comm - the MPI communicator to use
  • n - local vector length
  • N - global vector length (or PETSC_DETERMINE to have calculated if n is given)
  • nghost - number of local ghost points
  • ghosts - global indices of ghost points (or NULL if not needed), these do not need to be in increasing order (sorted)
  • array - the space to store the vector values (as long as n + nghost)

Output Parameter:

  • vv - the global vector representation (without ghost points as part of vector)

Level: advanced

-seealso: , Vec, VecType, VecCreate(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(), VecCreateGhost(), VecCreateSeqWithArray(), VecCreateMPIWithArray(), VecCreateGhostBlock(), VecCreateGhostBlockWithArray(), VecMPISetGhost(), VecGhostUpdateBegin(), VecGhostUpdateEnd()

External Links

source
PETSc.LibPETSc.VecCreateLocalVectorMethod
w::PetscVec = VecCreateLocalVector(petsclib::PetscLibType,v::PetscVec)

Creates a vector object suitable for use with VecGetLocalVector() and friends. You must call VecDestroy() when the vector is no longer needed.

Not Collective.

Input Parameter:

  • v - The vector for which the local vector is desired.

Output Parameter:

  • w - Upon exit this contains the local vector.

Level: beginner

-seealso: , Vec, VecGetLocalVectorRead(), VecRestoreLocalVectorRead(), VecGetLocalVector(), VecRestoreLocalVector()

External Links

source
PETSc.LibPETSc.VecCreateMPIMethod
v::PetscVec = VecCreateMPI(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a parallel vector.

Collective

Input Parameters:

  • comm - the MPI communicator to use
  • n - local vector length (or PETSC_DECIDE to have calculated if N is given)
  • N - global vector length (or PETSC_DETERMINE to have calculated if n is given)

Output Parameter:

  • v - the vector

Level: intermediate

-seealso: , Vec, VecType, VecCreateSeq(), VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost(), VecCreateMPIWithArray(), VecCreateGhostWithArray(), VecMPISetGhost(), PetscLayout, VecGetOwnershipRange(), VecGetOwnershipRanges()

External Links

source
PETSc.LibPETSc.VecCreateMPIWithArrayMethod
vv::PetscVec = VecCreateMPIWithArray(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, n::PetscInt, N::PetscInt, array::Vector{PetscScalar})

Creates a parallel, array where the user provides the array space to store the vector values.

Collective

Input Parameters:

  • comm - the MPI communicator to use
  • bs - block size, same meaning as VecSetBlockSize()
  • n - local vector length, cannot be PETSC_DECIDE
  • N - global vector length (or PETSC_DETERMINE to have calculated)
  • array - the user provided array to store the vector values

Output Parameter:

  • vv - the vector

Level: intermediate

-seealso: , Vec, VecType, VecCreateSeqWithArray(), VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost(), VecCreateMPI(), VecCreateGhostWithArray(), VecPlaceArray()

External Links

source
PETSc.LibPETSc.VecCreateNestMethod
Y::PetscVec = VecCreateNest(petsclib::PetscLibType,comm::MPI_Comm, nb::PetscInt, is::Vector{IS}, x::Vector{PetscVec})

Creates a new vector containing several nested subvectors, each stored separately

Collective

Input Parameters:

  • comm - Communicator for the new Vec
  • nb - number of nested blocks
  • is - array of nb index sets describing each nested block, or NULL to pack subvectors contiguously
  • x - array of nb sub-vectors

Output Parameter:

  • Y - new vector

Level: advanced

-seealso: VECNEST, , Vec, VecType, VecCreate(), MatCreateNest(), DMSetVecType()

External Links

source
PETSc.LibPETSc.VecCreateSeqMethod
v::PetscVec = VecCreateSeq(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt)

Creates a standard, sequential array

Collective

Input Parameters:

  • comm - the communicator, should be PETSC_COMM_SELF
  • n - the vector length

Output Parameter:

  • v - the vector

Level: intermediate

-seealso: , Vec, VecType, VecCreateMPI(), VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost()

External Links

source
PETSc.LibPETSc.VecCreateSeqWithArrayMethod
V::PetscVec = VecCreateSeqWithArray(petsclib::PetscLibType,comm::MPI_Comm, bs::PetscInt, n::PetscInt, array::Vector{PetscScalar})

Creates a standard,sequential array where the user provides the array space to store the vector values.

Collective

Input Parameters:

  • comm - the communicator, should be PETSC_COMM_SELF
  • bs - the block size
  • n - the vector length
  • array - memory where the vector elements are to be stored.

Output Parameter:

  • V - the vector

Level: intermediate

-seealso: VecCreateMPIWithArray(), VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost(), VecCreateSeq(), VecPlaceArray()

External Links

source
PETSc.LibPETSc.VecCreateSharedMethod
v::PetscVec = VecCreateShared(petsclib::PetscLibType,comm::MPI_Comm, n::PetscInt, N::PetscInt)

Creates a parallel vector that uses shared memory.

Collective

Input Parameters:

  • comm - the MPI communicator to use
  • n - local vector length (or PETSC_DECIDE to have calculated if N is given)
  • N - global vector length (or PETSC_DECIDE to have calculated if n is given)

Output Parameter:

  • v - the vector

Level: advanced

-seealso: , Vec, VecType, VecCreateSeq(), VecCreate(), VecCreateMPI(), VecDuplicate(), VecDuplicateVecs(), VecCreateGhost(), VecCreateMPIWithArray(), VecCreateGhostWithArray()

External Links

source
PETSc.LibPETSc.VecDestroyMethod
VecDestroy(petsclib::PetscLibType,v::PetscVec)

Destroys a vector.

Collective

Input Parameter:

  • v - the vector

Level: beginner

-seealso: , Vec, VecCreate(), VecDuplicate(), VecDestroyVecs()

External Links

source
PETSc.LibPETSc.VecDestroyVecsMethod
VecDestroyVecs(petsclib::PetscLibType,m::PetscInt, vv::Vector{PetscVec})

Frees a block of vectors obtained with VecDuplicateVecs().

Collective

Input Parameters:

  • m - the number of vectors previously obtained, if zero no vectors are destroyed
  • vv - pointer to pointer to array of vector pointers, if NULL no vectors are destroyed

Level: intermediate

-seealso: , Vec, , VecDuplicateVecs(), VecDestroyVecsf90()

External Links

source
PETSc.LibPETSc.VecDotMethod
val::PetscScalar = VecDot(petsclib::PetscLibType,x::PetscVec, y::PetscVec)

Computes the vector dot product.

Collective

Input Parameters:

  • x - first vector
  • y - second vector

Output Parameter:

  • val - the dot product

Level: intermediate

Notes for Users of Complex Numbers: For complex vectors, VecDot() computes -seealso: , Vec, VecMDot(), VecTDot(), VecNorm(), VecDotBegin(), VecDotEnd(), VecDotRealPart()

External Links

source
PETSc.LibPETSc.VecDotBeginMethod
VecDotBegin(petsclib::PetscLibType,x::PetscVec, y::PetscVec, result::PetscScalar)

Starts a split phase dot product computation.

Input Parameters:

  • x - the first vector
  • y - the second vector
  • result - where the result will go (can be NULL)

Level: advanced

-seealso: VecDotEnd(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecTDotBegin(), VecTDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecDotEndMethod
VecDotEnd(petsclib::PetscLibType,x::PetscVec, y::PetscVec, result::PetscScalar)

Ends a split phase dot product computation.

Input Parameters:

  • x - the first vector (can be NULL)
  • y - the second vector (can be NULL)
  • result - where the result will go

Level: advanced

-seealso: VecDotBegin(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecTDotBegin(), VecTDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecDotNorm2Method
dp::PetscScalar,nm::PetscReal = VecDotNorm2(petsclib::PetscLibType,s::PetscVec, t::PetscVec)

computes the inner product of two vectors and the 2

Collective

Input Parameters:

  • s - first vector
  • t - second vector

Output Parameters:

  • dp - s'conj(t)
  • nm - t'conj(t)

Level: advanced

-seealso: Vec, VecDot(), VecNorm(), VecDotBegin(), VecNormBegin(), VecDotEnd(), VecNormEnd()

External Links

source
PETSc.LibPETSc.VecDotRealPartMethod
val::PetscReal = VecDotRealPart(petsclib::PetscLibType,x::PetscVec, y::PetscVec)

Computes the real part of the vector dot product.

Collective

Input Parameters:

  • x - first vector
  • y - second vector

Output Parameter:

  • val - the real part of the dot product;

Level: intermediate

Notes for Users of Complex Numbers: See VecDot() for more details on the definition of the dot product for complex numbers

For real numbers this returns the same value as VecDot()

For complex numbers in C^n (that is a vector of n components with a complex number for each component) this is equal to the usual real dot product on the the space R^{2n} (that is a vector of 2n components with the real or imaginary part of the complex numbers for components)

-seealso: , Vec, VecMDot(), VecTDot(), VecNorm(), VecDotBegin(), VecDotEnd(), VecDot(), VecDotNorm2()

External Links

source
PETSc.LibPETSc.VecDuplicateMethod
newv::PetscVec = VecDuplicate(petsclib::PetscLibType,v::PetscVec)

Creates a new vector of the same type as an existing vector.

Collective

Input Parameter:

  • v - a vector to mimic

Output Parameter:

  • newv - location to put new vector

Level: beginner

-seealso: , Vec, VecDestroy(), VecDuplicateVecs(), VecCreate(), VecCopy()

External Links

source
PETSc.LibPETSc.VecDuplicateVecsMethod
V::Vector{PetscVec} = VecDuplicateVecs(petsclib::PetscLibType,v::PetscVec, m::PetscInt)

Creates several vectors of the same type as an existing vector.

Collective

Input Parameters:

  • m - the number of vectors to obtain
  • v - a vector to mimic

Output Parameter:

  • V - location to put pointer to array of vectors

Level: intermediate

-seealso: , Vec, , VecDestroyVecs(), VecDuplicate(), VecCreate(), VecMDot(), VecMAXPY(), KSPGMRES, KSPGMRESSetPreAllocateVectors()

External Links

source
PETSc.LibPETSc.VecEqualMethod
flg::PetscBool = VecEqual(petsclib::PetscLibType,vec1::PetscVec, vec2::PetscVec)

Compares two vectors. Returns true if the two vectors are either pointing to the same memory buffer, or if the two vectors have the same local and global layout as well as bitwise equality of all entries. Does NOT take round-off errors into account.

Collective

Input Parameters:

  • vec1 - the first vector
  • vec2 - the second vector

Output Parameter:

  • flg - PETSC_TRUE if the vectors are equal; PETSC_FALSE otherwise.

Level: intermediate

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecErrorWeightedNormsMethod
norm::PetscReal,norm_loc::PetscInt,norma::PetscReal,norma_loc::PetscInt,normr::PetscReal,normr_loc::PetscInt = VecErrorWeightedNorms(petsclib::PetscLibType,U::PetscVec, Y::PetscVec, E::PetscVec, wnormtype::NormType, atol::PetscReal, vatol::PetscVec, rtol::PetscReal, vrtol::PetscVec, ignore_max::PetscReal)

compute a weighted norm of the difference between two vectors

Collective

Input Parameters:

  • U - first vector to be compared
  • Y - second vector to be compared
  • E - optional third vector representing the error (if not provided, the error is ||U-Y||)
  • wnormtype - norm type
  • atol - scalar for absolute tolerance
  • vatol - vector representing per-entry absolute tolerances (can be NULL)
  • rtol - scalar for relative tolerance
  • vrtol - vector representing per-entry relative tolerances (can be NULL)
  • ignore_max - ignore values smaller than this value in absolute terms.

Output Parameters:

  • norm - weighted norm
  • norm_loc - number of vector locations used for the weighted norm
  • norma - weighted norm based on the absolute tolerance
  • norma_loc - number of vector locations used for the absolute weighted norm
  • normr - weighted norm based on the relative tolerance
  • normr_loc - number of vector locations used for the relative weighted norm

Level: developer

-seealso: , Vec, NormType, TSErrorWeightedNorm(), TSErrorWeightedENorm()

External Links

source
PETSc.LibPETSc.VecExpMethod
VecExp(petsclib::PetscLibType,v::PetscVec)

Replaces each component of a vector by e^x_i

Not Collective

Input Parameter:

  • v - The vector

Output Parameter:

  • v - The vector of exponents

Level: beginner

-seealso: Vec, VecLog(), VecAbs(), VecSqrtAbs(), VecReciprocal()

External Links

source
PETSc.LibPETSc.VecFilterMethod
VecFilter(petsclib::PetscLibType,v::PetscVec, tol::PetscReal)

Set all values in the vector with an absolute value less than or equal to the tolerance to zero

Input Parameters:

  • v - The vector
  • tol - The zero tolerance

Output Parameter:

  • v - The filtered vector

Level: intermediate

-seealso: VecCreate(), VecSet(), MatFilter()

External Links

source
PETSc.LibPETSc.VecFischerMethod
VecFischer(petsclib::PetscLibType,X::PetscVec, F::PetscVec, L::PetscVec, U::PetscVec, FB::PetscVec)

Evaluates the Fischer problems.

Logically Collective

Input Parameters:

  • X - current point
  • F - function evaluated at x
  • L - lower bounds
  • U - upper bounds

Output Parameter:

  • FB - The Fischer-Burmeister function vector

Level: developer

-seealso: Vec, VecSFischer(), MatDFischer(), MatDSFischer()

External Links

source
PETSc.LibPETSc.VecFlagMethod
VecFlag(petsclib::PetscLibType,xin::PetscVec, flg::PetscInt)

set infinity into the local part of the vector on any subset of MPI processes

Logically Collective

Input Parameters:

  • xin - the vector, can be NULL but only if on all processes
  • flg - indicates if this processes portion of the vector should be set to infinity

Level: developer

-seealso: , Vec, PetscLayout, VecGetLayout(), VecGetSize(), VecGetOwnershipRange(), VecGetOwnershipRanges()

External Links

source
PETSc.LibPETSc.VecGetArrayMethod
a::Vector{PetscScalar} = VecGetArray(petsclib::PetscLibType,x::PetscVec)

Returns a pointer to a contiguous array that contains this MPI processes's portion of the vector data

Logically Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • a - location to put pointer to the array

Level: beginner

-seealso: , Vec, VecRestoreArray(), VecGetArrayRead(), VecGetArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArrayPair(), VecRestoreArrayPair(), VecGetArrayWrite(), VecRestoreArrayWrite(), VecGetArrayAndMemType()

External Links

source
PETSc.LibPETSc.VecGetArray1dMethod
a::PetscArray = VecGetArray1d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, mstart::PetscInt)

Returns a pointer to a 1d contiguous array that contains this processor's portion of the vector data. You MUST call VecRestoreArray1d() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetArray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray2d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray1dWriteMethod
a::PetscArray = VecGetArray1dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, mstart::PetscInt)

Returns a pointer to a 1d contiguous array that will contain this processor's portion of the vector data. You MUST call VecRestoreArray1dWrite() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetArray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray2d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray2dMethod
a::Vector{PetscScalar} = VecGetArray2d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, mstart::PetscInt, nstart::PetscInt)

Returns a pointer to a 2d contiguous array that contains this processor's portion of the vector data. You MUST call VecRestoreArray2d() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • n - second dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetArray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray2dReadMethod
a::Vector{PetscScalar} = VecGetArray2dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, mstart::PetscInt, nstart::PetscInt)

Returns a pointer to a 2d contiguous array that contains this processor's portion of the vector data. You MUST call VecRestoreArray2dRead() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • n - second dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetArray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray2dWriteMethod
a::Vector{PetscScalar} = VecGetArray2dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, mstart::PetscInt, nstart::PetscInt)

Returns a pointer to a 2d contiguous array that will contain this processor's portion of the vector data. You MUST call VecRestoreArray2dWrite() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • n - second dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetArray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray3dMethod
a::PetscArray = VecGetArray3d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt)

Returns a pointer to a 3d contiguous array that contains this processor's portion of the vector data. You MUST call VecRestoreArray3d() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of three dimensional array
  • n - second dimension of three dimensional array
  • p - third dimension of three dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetarray(), DMDAVecRestoreArray(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray3dReadMethod
a::PetscArray = VecGetArray3dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt)

Returns a pointer to a 3d contiguous array that contains this processor's portion of the vector data. You MUST call VecRestoreArray3dRead() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of three dimensional array
  • n - second dimension of three dimensional array
  • p - third dimension of three dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetarray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray3dWriteMethod
a::PetscArray = VecGetArray3dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt)

Returns a pointer to a 3d contiguous array that will contain this processor's portion of the vector data. You MUST call VecRestoreArray3dWrite() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of three dimensional array
  • n - second dimension of three dimensional array
  • p - third dimension of three dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetarray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray4dMethod
a::PetscArray = VecGetArray4d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, q::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, qstart::PetscInt)

Returns a pointer to a 4d contiguous array that contains this processor's portion of the vector data. You MUST call VecRestoreArray4d() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of four dimensional array
  • n - second dimension of four dimensional array
  • p - third dimension of four dimensional array
  • q - fourth dimension of four dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • qstart - first index in the fourth coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetarray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray4dReadMethod
a::PetscArray = VecGetArray4dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, q::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, qstart::PetscInt)

Returns a pointer to a 4d contiguous array that contains this processor's portion of the vector data. You MUST call VecRestoreArray4dRead() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of four dimensional array
  • n - second dimension of four dimensional array
  • p - third dimension of four dimensional array
  • q - fourth dimension of four dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • qstart - first index in the fourth coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: beginner

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetarray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArray4dWriteMethod
a::PetscArray = VecGetArray4dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, q::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, qstart::PetscInt)

Returns a pointer to a 4d contiguous array that will contain this processor's portion of the vector data. You MUST call VecRestoreArray4dWrite() when you no longer need access to the array.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of four dimensional array
  • n - second dimension of four dimensional array
  • p - third dimension of four dimensional array
  • q - fourth dimension of four dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • qstart - first index in the fourth coordinate direction (often 0)

Output Parameter:

  • a - location to put pointer to the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrays(), VecPlaceArray(), VecRestoreArray2d(), DMDAVecGetarray(), DMDAVecRestoreArray(), VecGetArray3d(), VecRestoreArray3d(), VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecGetArrayAndMemTypeMethod
a::Vector{PetscScalar},mtype::PetscMemType = VecGetArrayAndMemType(petsclib::PetscLibType,x::PetscVec)

Like VecGetArray(), but if this is a standard device vector (e.g., VECCUDA), the returned pointer will be a device pointer to the device memory that contains this MPI processes's portion of the vector data.

Logically Collective; No Fortran Support

Input Parameter:

  • x - the vector

Output Parameters:

  • a - location to put pointer to the array
  • mtype - memory type of the array

Level: beginner

-seealso: , Vec, VecRestoreArrayAndMemType(), VecGetArrayReadAndMemType(), VecGetArrayWriteAndMemType(), VecRestoreArray(), VecGetArrayRead(), VecGetArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArrayPair(), VecRestoreArrayPair(), VecGetArrayWrite(), VecRestoreArrayWrite()

External Links

source
PETSc.LibPETSc.VecGetArrayReadMethod
a::Vector{PetscScalar} = VecGetArrayRead(petsclib::PetscLibType,x::PetscVec)

Get read

Not Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • a - the array

Level: beginner

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair(), VecGetArrayAndMemType()

External Links

source
PETSc.LibPETSc.VecGetArrayReadAndMemTypeMethod
a::Vector{PetscScalar},mtype::PetscMemType = VecGetArrayReadAndMemType(petsclib::PetscLibType,x::PetscVec)

Like VecGetArrayRead(), but if the input vector is a device vector, it will return a read The returned pointer is guaranteed to point to up-to-date data. For host vectors, it functions as VecGetArrayRead().

Not Collective; No Fortran Support

Input Parameter:

  • x - the vector

Output Parameters:

  • a - the array
  • mtype - memory type of the array

Level: beginner

-seealso: , Vec, VecRestoreArrayReadAndMemType(), VecGetArrayAndMemType(), VecGetArrayWriteAndMemType(), VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair()

External Links

source
PETSc.LibPETSc.VecGetArrayWriteMethod
a::Vector{PetscScalar} = VecGetArrayWrite(petsclib::PetscLibType,x::PetscVec)

Returns a pointer to a contiguous array that WILL contain this MPI processes's portion of the vector data.

Logically Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • a - location to put pointer to the array

Level: intermediate

-seealso: , Vec, VecRestoreArray(), VecGetArrayRead(), VecGetArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArrayPair(), VecRestoreArrayPair(), VecGetArray(), VecRestoreArrayWrite(), VecGetArrayAndMemType()

External Links

source
PETSc.LibPETSc.VecGetArrayWriteAndMemTypeMethod
a::Vector{PetscScalar},mtype::PetscMemType = VecGetArrayWriteAndMemType(petsclib::PetscLibType,x::PetscVec)

Like VecGetArrayWrite(), but if this is a device vector it will always return a device pointer to the device memory that contains this processor's portion of the vector data.

Logically Collective; No Fortran Support

Input Parameter:

  • x - the vector

Output Parameters:

  • a - the array
  • mtype - memory type of the array

Level: beginner

-seealso: , Vec, VecRestoreArrayWriteAndMemType(), VecGetArrayReadAndMemType(), VecGetArrayAndMemType(), VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair(),

External Links

source
PETSc.LibPETSc.VecGetArraysMethod
a::Vector{PetscScalar} = VecGetArrays(petsclib::PetscLibType,x::Vector{PetscVec}, n::PetscInt)

Returns a pointer to the arrays in a set of vectors that were created by a call to VecDuplicateVecs().

Logically Collective; No Fortran Support

Input Parameters:

  • x - the vectors
  • n - the number of vectors

Output Parameter:

  • a - location to put pointer to the array

Level: intermediate

-seealso: , Vec, VecGetArray(), VecRestoreArrays()

External Links

source
PETSc.LibPETSc.VecGetBindingPropagatesMethod
flg::PetscBool = VecGetBindingPropagates(petsclib::PetscLibType,v::PetscVec)

Gets whether the state of being bound to the CPU for a GPU vector type propagates to child and some other associated objects

Input Parameter:

  • v - the vector

Output Parameter:

  • flg - flag indicating whether the boundtocpu flag will be propagated

Level: developer

-seealso: , Vec, VecSetBindingPropagates()

External Links

source
PETSc.LibPETSc.VecGetBlockSizeMethod
bs::PetscInt = VecGetBlockSize(petsclib::PetscLibType,v::PetscVec)

Gets the blocksize for the vector, i.e. what is used for VecSetValuesBlocked() and VecSetValuesBlockedLocal().

Not Collective

Input Parameter:

  • v - the vector

Output Parameter:

  • bs - the blocksize

Level: advanced

-seealso: , Vec, VecSetValuesBlocked(), VecSetLocalToGlobalMapping(), VecSetBlockSize()

External Links

source
PETSc.LibPETSc.VecGetDMMethod
dm::PetscDM = VecGetDM(petsclib::PetscLibType,v::PetscVec)

Gets the DM defining the data layout of the vector

Not Collective

Input Parameter:

  • v - The Vec

Output Parameter:

  • dm - The DM

Level: intermediate

Note: A Vec may not have a DM associated with it.

See also:

DM, VecSetDM(), DMGetLocalVector(), DMGetGlobalVector(), DMSetVecType()

External Links

source
PETSc.LibPETSc.VecGetLayoutMethod
VecGetLayout(petsclib::PetscLibType,x::PetscVec, map::PetscLayout)

get PetscLayout describing a vector layout

Not Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • map - the layout

Level: developer

-seealso: , PetscLayout, Vec, VecGetSize(), VecGetOwnershipRange(), VecGetOwnershipRanges()

External Links

source
PETSc.LibPETSc.VecGetLocalSizeMethod
size::PetscInt = VecGetLocalSize(petsclib::PetscLibType,x::PetscVec)

Returns the number of elements of the vector stored in local memory (that is on this MPI process)

Not Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • size - the length of the local piece of the vector

Level: beginner

-seealso: , Vec, VecGetSize()

External Links

source
PETSc.LibPETSc.VecGetLocalToGlobalMappingMethod
VecGetLocalToGlobalMapping(petsclib::PetscLibType,X::PetscVec, mapping::ISLocalToGlobalMapping)

Gets the local

Not Collective

Input Parameter:

  • X - the vector

Output Parameter:

  • mapping - the mapping

Level: advanced

-seealso: , Vec, VecSetValuesLocal(), VecSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.VecGetLocalVectorMethod
VecGetLocalVector(petsclib::PetscLibType,v::PetscVec, w::PetscVec)

Maps the local portion of a vector into a vector.

Collective

Input Parameter:

  • v - The vector for which the local vector is desired.

Output Parameter:

  • w - Upon exit this contains the local vector.

Level: beginner

-seealso: , Vec, VecCreateLocalVector(), VecRestoreLocalVector(), VecGetLocalVectorRead(), VecGetArrayRead(), VecGetArray()

External Links

source
PETSc.LibPETSc.VecGetLocalVectorReadMethod
VecGetLocalVectorRead(petsclib::PetscLibType,v::PetscVec, w::PetscVec)

Maps the local portion of a vector into a vector.

Not Collective.

Input Parameter:

  • v - The vector for which the local vector is desired.

Output Parameter:

  • w - Upon exit this contains the local vector.

Level: beginner

-seealso: , Vec, VecCreateLocalVector(), VecRestoreLocalVectorRead(), VecGetLocalVector(), VecGetArrayRead(), VecGetArray()

External Links

source
PETSc.LibPETSc.VecGetOffloadMaskMethod
VecGetOffloadMask(petsclib::PetscLibType,v::PetscVec, mask::PetscOffloadMask)

Get the offload mask of a Vec

Not Collective

Input Parameter:

  • v - the vector

Output Parameter:

  • mask - corresponding PetscOffloadMask enum value.

Level: intermediate

-seealso: , Vec, VecCreateSeqCUDA(), VecCreateSeqViennaCL(), VecGetArray(), VecGetType()

External Links

source
PETSc.LibPETSc.VecGetOptionsPrefixMethod
VecGetOptionsPrefix(petsclib::PetscLibType,v::PetscVec, prefix::Vector{Cchar})

Sets the prefix used for searching for all Vec options in the database.

Not Collective

Input Parameter:

  • v - the Vec context

Output Parameter:

  • prefix - pointer to the prefix string used

Level: advanced

-seealso: , Vec, VecAppendOptionsPrefix()

External Links

source
PETSc.LibPETSc.VecGetOwnershipRangeMethod
low::PetscInt,high::PetscInt = VecGetOwnershipRange(petsclib::PetscLibType,x::PetscVec)

Returns the range of indices owned by this process. The vector is 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.

Not Collective

Input Parameter:

  • x - the vector

Output Parameters:

  • low - the first local element, pass in NULL if not interested
  • high - one more than the last local element, pass in NULL if not interested

Level: beginner

-seealso: , Vec, MatGetOwnershipRange(), MatGetOwnershipRanges(), VecGetOwnershipRanges(), PetscSplitOwnership(), VecSetSizes(), VecCreateMPI(), PetscLayout, DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.VecGetOwnershipRangesMethod
ranges::Vector{PetscInt} = VecGetOwnershipRanges(petsclib::PetscLibType,x::PetscVec)

Returns the range of indices owned by EACH processor, The vector is 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.

Not Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • ranges - array of length size + 1 with the start and end+1 for each process

Level: beginner

-seealso: , Vec, MatGetOwnershipRange(), MatGetOwnershipRanges(), VecGetOwnershipRange(), PetscSplitOwnership(), VecSetSizes(), VecCreateMPI(), PetscLayout, DMDAGetGhostCorners(), DM

External Links

source
PETSc.LibPETSc.VecGetPinnedMemoryMinMethod
VecGetPinnedMemoryMin(petsclib::PetscLibType,v::PetscVec, mbytes::Csize_t)

Get the minimum data size for which pinned memory will be used for host (CPU) allocations.

Logically Collective

Input Parameter:

  • v - the vector

Output Parameter:

  • mbytes - minimum data size in bytes

Level: developer

-seealso: , Vec, VecSetPinnedMemoryMin()

External Links

source
PETSc.LibPETSc.VecGetSizeMethod
size::PetscInt = VecGetSize(petsclib::PetscLibType,x::PetscVec)

Returns the global number of elements of the vector.

Not Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • size - the global length of the vector

Level: beginner

-seealso: , Vec, VecGetLocalSize()

External Links

source
PETSc.LibPETSc.VecGetStateMethod
VecGetState(petsclib::PetscLibType,v::PetscVec, state::PetscObjectState)

Gets the state of a Vec.

Not Collective

Input Parameter:

  • v - the Vec context

Output Parameter:

  • state - the object state

Level: advanced

-seealso: , Vec, VecCreate(), PetscObjectStateGet()

External Links

source
PETSc.LibPETSc.VecGetSubVectorMethod
VecGetSubVector(petsclib::PetscLibType,X::PetscVec, is::IS, Y::PetscVec)

Gets a vector representing part of another vector

Collective

Input Parameters:

  • X - vector from which to extract a subvector
  • is - index set representing portion of X to extract

Output Parameter:

  • Y - subvector corresponding to is

Level: advanced

-seealso: , Vec, IS, VECNEST, MatCreateSubMatrix()

External Links

source
PETSc.LibPETSc.VecGetTypeMethod
type::VecType = VecGetType(petsclib::PetscLibType,vec::PetscVec)

Gets the vector type name (as a string) from a Vec.

Not Collective

Input Parameter:

  • vec - The vector

Output Parameter:

  • type - The VecType of the vector

Level: intermediate

-seealso: , Vec, VecType, VecCreate(), VecDuplicate(), VecDuplicateVecs()

External Links

source
PETSc.LibPETSc.VecGetValuesMethod
y::Vector{PetscScalar} = VecGetValues(petsclib::PetscLibType,x::PetscVec, ni::PetscInt, ix::Vector{PetscInt})

Gets values from certain locations of a vector. Currently can only get values on the same processor on which they are owned

Not Collective

Input Parameters:

  • x - vector to get values from
  • ni - number of elements to get
  • ix - indices where to get them from (in global 1d numbering)

Output Parameter:

  • y - array of values, must be passed in with a length of ni

Level: beginner

-seealso: , Vec, VecAssemblyBegin(), VecAssemblyEnd(), VecSetValues()

External Links

source
PETSc.LibPETSc.VecGetValuesSectionMethod
values::Vector{PetscScalar} = VecGetValuesSection(petsclib::PetscLibType,v::PetscVec, s::PetscSection, point::PetscInt)

Gets all the values associated with a given point, according to the section, in the given Vec

Not Collective

Input Parameters:

  • v - the Vec
  • s - the organizing PetscSection
  • point - the point

Output Parameter:

  • values - the array of output values

Level: developer

-seealso: PetscSection, PetscSectionCreate(), VecSetValuesSection()

External Links

source
PETSc.LibPETSc.VecGhostGetGhostISMethod
VecGhostGetGhostIS(petsclib::PetscLibType,X::PetscVec, ghost::IS)

Return ghosting indices of a ghost vector

Input Parameters:

  • X - ghost vector

Output Parameter:

  • ghost - ghosting indices

Level: beginner

-seealso: VecCreateGhostWithArray(), VecCreateMPIWithArray()

External Links

source
PETSc.LibPETSc.VecGhostGetLocalFormMethod
l::PetscVec = VecGhostGetLocalForm(petsclib::PetscLibType,g::PetscVec)

Obtains the local ghosted representation of a parallel vector (obtained with VecCreateGhost(), VecCreateGhostWithArray() or VecCreateSeq()).

Logically Collective

Input Parameter:

  • g - the global vector

Output Parameter:

  • l - the local (ghosted) representation,NULL if g is not ghosted

Level: advanced

-seealso: , VecGhostUpdateBegin(), VecGhostUpdateEnd(), Vec, VecType, VecCreateGhost(), VecGhostRestoreLocalForm(), VecCreateGhostWithArray()

External Links

source
PETSc.LibPETSc.VecGhostIsLocalFormMethod
flg::PetscBool = VecGhostIsLocalForm(petsclib::PetscLibType,g::PetscVec, l::PetscVec)

Checks if a given vector is the local form of a global vector

Not Collective

Input Parameters:

  • g - the global vector
  • l - the local vector

Output Parameter:

  • flg - PETSC_TRUE if l is the local form

Level: advanced

-seealso: , Vec, VecType, VecCreateGhost(), VecGhostRestoreLocalForm(), VecCreateGhostWithArray(), VecGhostGetLocalForm()

External Links

source
PETSc.LibPETSc.VecGhostRestoreLocalFormMethod
VecGhostRestoreLocalForm(petsclib::PetscLibType,g::PetscVec, l::PetscVec)

Restores the local ghosted representation of a parallel vector obtained with VecGhostGetLocalForm().

Logically Collective

Input Parameters:

  • g - the global vector
  • l - the local (ghosted) representation

Level: advanced

-seealso: , VecGhostUpdateBegin(), VecGhostUpdateEnd(), Vec, VecType, VecCreateGhost(), VecGhostGetLocalForm(), VecCreateGhostWithArray()

External Links

source
PETSc.LibPETSc.VecGhostUpdateBeginMethod
VecGhostUpdateBegin(petsclib::PetscLibType,g::PetscVec, insertmode::InsertMode, scattermode::ScatterMode)

Begins the vector scatter to update the vector from local representation to global or global representation to local.

Neighbor-wise Collective

Input Parameters:

  • g - the vector (obtained with VecCreateGhost() or VecDuplicate())
  • insertmode - one of ADD_VALUES, MAX_VALUES, MIN_VALUES or INSERT_VALUES
  • scattermode - one of SCATTER_FORWARD (update ghosts) or SCATTER_REVERSE (update local values from ghosts)

Level: advanced

-seealso: , Vec, VecType, VecCreateGhost(), VecGhostUpdateEnd(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(), VecCreateGhostWithArray()

External Links

source
PETSc.LibPETSc.VecGhostUpdateEndMethod
VecGhostUpdateEnd(petsclib::PetscLibType,g::PetscVec, insertmode::InsertMode, scattermode::ScatterMode)

End the vector scatter to update the vector from local representation to global or global representation to local.

Neighbor-wise Collective

Input Parameters:

  • g - the vector (obtained with VecCreateGhost() or VecDuplicate())
  • insertmode - one of ADD_VALUES, MAX_VALUES, MIN_VALUES or INSERT_VALUES
  • scattermode - one of SCATTER_FORWARD (update ghosts) or SCATTER_REVERSE (update local values from ghosts)

Level: advanced

-seealso: , Vec, VecType, VecCreateGhost(), VecGhostUpdateBegin(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(), VecCreateGhostWithArray()

External Links

source
PETSc.LibPETSc.VecISAXPYMethod
VecISAXPY(petsclib::PetscLibType,vfull::PetscVec, is::IS, alpha::PetscScalar, vreduced::PetscVec)

Adds a reduced vector to the appropriate elements of a full vfull[is[i]] += alpha*vreduced[i]

Logically Collective

Input Parameters:

  • vfull - the full-space vector
  • is - the index set for the reduced space
  • alpha - the scalar coefficient
  • vreduced - the reduced-space vector

Output Parameter:

  • vfull - the sum of the full-space vector and reduced-space vector

Level: advanced

-seealso: VecISCopy(), VecISSet(), VecAXPY()

External Links

source
PETSc.LibPETSc.VecISCopyMethod
VecISCopy(petsclib::PetscLibType,vfull::PetscVec, is::IS, mode::ScatterMode, vreduced::PetscVec)

Copies between a reduced vector and the appropriate elements of a full

Logically Collective

Input Parameters:

  • vfull - the full-space vector
  • is - the index set for the reduced space
  • mode - the direction of copying, SCATTER_FORWARD or SCATTER_REVERSE
  • vreduced - the reduced-space vector

Output Parameter:

  • vfull - the sum of the full-space vector and reduced-space vector

Level: advanced

-seealso: VecISSet(), VecISAXPY(), VecCopy()

External Links

source
PETSc.LibPETSc.VecISSetMethod
VecISSet(petsclib::PetscLibType,V::PetscVec, S::IS, c::PetscScalar)

Sets the elements of a vector, specified by an index set, to a constant

Logically Collective

Input Parameters:

  • V - the vector
  • S - index set for the locations in the vector
  • c - the constant

Level: advanced

-seealso: VecISCopy(), VecISAXPY(), VecISShift(), VecSet()

External Links

source
PETSc.LibPETSc.VecISShiftMethod
VecISShift(petsclib::PetscLibType,V::PetscVec, S::IS, c::PetscScalar)

Shifts the elements of a vector, specified by an index set, by a constant

Logically Collective

Input Parameters:

  • V - the vector
  • S - index set for the locations in the vector
  • c - the constant

Level: advanced

-seealso: VecISCopy(), VecISAXPY(), VecISSet(), VecShift()

External Links

source
PETSc.LibPETSc.VecImaginaryPartMethod
VecImaginaryPart(petsclib::PetscLibType,v::PetscVec)

Replaces a complex vector with its imginary part

Collective

Input Parameter:

  • v - the vector

Level: beginner

-seealso: Vec, VecNorm(), VecRealPart()

External Links

source
PETSc.LibPETSc.VecInitializePackageMethod
VecInitializePackage(petsclib::PetscLibType)

This function initializes everything in the Vec package. It is called from PetscDLLibraryRegister_petscvec() when using dynamic libraries, and on the first call to VecCreate() when using shared or static libraries.

Level: developer

-seealso: PetscInitialize()

External Links

source
PETSc.LibPETSc.VecLoadMethod
VecLoad(petsclib::PetscLibType,vec::PetscVec, viewer::PetscViewer)

Loads a vector that has been stored in binary or HDF5 format with VecView().

Collective

Input Parameters:

  • vec - the newly loaded vector, this needs to have been created with VecCreate() or

some related function before the call to VecLoad().

  • viewer - binary file viewer, obtained from PetscViewerBinaryOpen() or

HDF5 file viewer, obtained from PetscViewerHDF5Open()

Level: intermediate

-seealso: , Vec, PetscViewerBinaryOpen(), VecView(), MatLoad()

External Links

source
PETSc.LibPETSc.VecLockGetMethod
state::PetscInt = VecLockGet(petsclib::PetscLibType,x::PetscVec)

Get the current lock status of a vector

Logically Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • state - greater than zero indicates the vector is locked for read; less than zero indicates the vector is

locked for write; equal to zero means the vector is unlocked, that is, it is free to read or write.

Level: advanced

-seealso: , Vec, VecRestoreArray(), VecGetArrayRead(), VecLockReadPush(), VecLockReadPop()

External Links

source
PETSc.LibPETSc.VecLockReadPopMethod
VecLockReadPop(petsclib::PetscLibType,x::PetscVec)

Pop a read

Logically Collective

Input Parameter:

  • x - the vector

Level: intermediate

-seealso: , Vec, VecRestoreArray(), VecGetArrayRead(), VecLockReadPush(), VecLockGet()

External Links

source
PETSc.LibPETSc.VecLockReadPushMethod
VecLockReadPush(petsclib::PetscLibType,x::PetscVec)

Push a read

Logically Collective

Input Parameter:

  • x - the vector

Level: intermediate

-seealso: , Vec, VecRestoreArray(), VecGetArrayRead(), VecLockReadPop(), VecLockGet()

External Links

source
PETSc.LibPETSc.VecLockWriteSetMethod
VecLockWriteSet(petsclib::PetscLibType,x::PetscVec, flg::PetscBool)

Lock or unlock a vector for exclusive read/write access

Logically Collective

Input Parameters:

  • x - the vector
  • flg - PETSC_TRUE to lock the vector for exclusive read/write access; PETSC_FALSE to unlock it.

Level: intermediate

-seealso: , Vec, VecRestoreArray(), VecGetArrayRead(), VecLockReadPush(), VecLockReadPop(), VecLockGet()

External Links

source
PETSc.LibPETSc.VecLogMethod
VecLog(petsclib::PetscLibType,v::PetscVec)

Replaces each component of a vector by log(x_i), the natural logarithm

Not Collective

Input Parameter:

  • v - The vector

Output Parameter:

  • v - The vector of logs

Level: beginner

-seealso: Vec, VecExp(), VecAbs(), VecSqrtAbs(), VecReciprocal()

External Links

source
PETSc.LibPETSc.VecMAXPBYMethod
VecMAXPBY(petsclib::PetscLibType,y::PetscVec, nv::PetscInt, alpha::Vector{PetscScalar}, beta::PetscScalar, x::Vector{PetscVec})

Computes y = beta y + sum alpha[i] x[i]

Logically Collective

Input Parameters:

  • nv - number of scalars and x vectors
  • alpha - array of scalars
  • beta - scalar
  • y - one vector
  • x - array of vectors

Level: intermediate

-seealso: , Vec, VecMAXPY(), VecAYPX(), VecWAXPY(), VecAXPY(), VecAXPBYPCZ(), VecAXPBY()

External Links

source
PETSc.LibPETSc.VecMAXPYMethod
VecMAXPY(petsclib::PetscLibType,y::PetscVec, nv::PetscInt, alpha::Vector{PetscScalar}, x::Vector{PetscVec})

Computes y = y + sum alpha[i] x[i]

Logically Collective

Input Parameters:

  • nv - number of scalars and x vectors
  • alpha - array of scalars
  • y - one vector
  • x - array of vectors

Level: intermediate

-seealso: , Vec, VecMAXPBY(),VecAYPX(), VecWAXPY(), VecAXPY(), VecAXPBYPCZ(), VecAXPBY(), VecDuplicateVecs()

External Links

source
PETSc.LibPETSc.VecMDotMethod
val::Vector{PetscScalar} = VecMDot(petsclib::PetscLibType,x::PetscVec, nv::PetscInt, y::Vector{PetscVec})

Computes multiple vector dot products.

Collective

Input Parameters:

  • x - one vector
  • nv - number of vectors
  • y - array of vectors.

Output Parameter:

  • val - array of the dot products (does not allocate the array)

Level: intermediate

Notes for Users of Complex Numbers: For complex vectors, VecMDot() computes -seealso: , Vec, VecMTDot(), VecDot(), VecDuplicateVecs()

External Links

source
PETSc.LibPETSc.VecMDotBeginMethod
VecMDotBegin(petsclib::PetscLibType,x::PetscVec, nv::PetscInt, y::Vector{PetscVec}, result::Vector{PetscScalar})

Starts a split phase multiple dot product computation.

Input Parameters:

  • x - the first vector
  • nv - number of vectors
  • y - array of vectors
  • result - where the result will go (can be NULL)

Level: advanced

-seealso: VecMDotEnd(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecTDotBegin(), VecTDotEnd(), VecMTDotBegin(), VecMTDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecMDotEndMethod
result::Vector{PetscScalar} = VecMDotEnd(petsclib::PetscLibType,x::PetscVec, nv::PetscInt, y::Vector{PetscVec})

Ends a split phase multiple dot product computation.

Input Parameters:

  • x - the first vector (can be NULL)
  • nv - number of vectors
  • y - array of vectors (can be NULL)

Output Parameter:

  • result - where the result will go

Level: advanced

-seealso: VecMDotBegin(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecTDotBegin(), VecTDotEnd(), VecMTDotBegin(), VecMTDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecMPISetGhostMethod
VecMPISetGhost(petsclib::PetscLibType,vv::PetscVec, nghost::PetscInt, ghosts::Vector{PetscInt})

Sets the ghost points for an MPI ghost vector

Collective

Input Parameters:

  • vv - the MPI vector
  • nghost - number of local ghost points
  • ghosts - global indices of ghost points, these do not need to be in increasing order (sorted)

Level: advanced

-seealso: , Vec, VecType, VecCreateSeq(), VecCreate(), VecDuplicate(), VecDuplicateVecs(), VecCreateMPI(), VecGhostGetLocalForm(), VecGhostRestoreLocalForm(), VecGhostUpdateBegin(), VecCreateGhostWithArray(), VecCreateMPIWithArray(), VecGhostUpdateEnd(), VecCreateGhostBlock(), VecCreateGhostBlockWithArray()

External Links

source
PETSc.LibPETSc.VecMTDotMethod
val::Vector{PetscScalar} = VecMTDot(petsclib::PetscLibType,x::PetscVec, nv::PetscInt, y::Vector{PetscVec})

Computes indefinite vector multiple dot products. That is, it does NOT use the complex conjugate.

Collective

Input Parameters:

  • x - one vector
  • nv - number of vectors
  • y - array of vectors. Note that vectors are pointers

Output Parameter:

  • val - array of the dot products

Level: intermediate

Notes for Users of Complex Numbers: For complex vectors, VecMTDot() computes the indefinite form -seealso: , Vec, VecMDot(), VecTDot()

External Links

source
PETSc.LibPETSc.VecMTDotBeginMethod
VecMTDotBegin(petsclib::PetscLibType,x::PetscVec, nv::PetscInt, y::Vector{PetscVec}, result::Vector{PetscScalar})

Starts a split phase transpose multiple dot product computation.

Input Parameters:

  • x - the first vector
  • nv - number of vectors
  • y - array of vectors
  • result - where the result will go (can be NULL)

Level: advanced

-seealso: VecMTDotEnd(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecDotBegin(), VecDotEnd(), VecMDotBegin(), VecMDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecMTDotEndMethod
result::Vector{PetscScalar} = VecMTDotEnd(petsclib::PetscLibType,x::PetscVec, nv::PetscInt, y::Vector{PetscVec})

Ends a split phase transpose multiple dot product computation.

Input Parameters:

  • x - the first vector (can be NULL)
  • nv - number of vectors
  • y - array of vectors (can be NULL)

Output Parameter:

  • result - where the result will go

Level: advanced

-seealso: VecMTDotBegin(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecDotBegin(), VecDotEnd(), VecMDotBegin(), VecMDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecMaxMethod
p::PetscInt,val::PetscReal = VecMax(petsclib::PetscLibType,x::PetscVec)

Determines the vector component with maximum real part and its location.

Collective

Input Parameter:

  • x - the vector

Output Parameters:

  • p - the index of val (pass NULL if you don't want this) in the vector
  • val - the maximum component

Level: intermediate

-seealso: , Vec, VecNorm(), VecMin()

External Links

source
PETSc.LibPETSc.VecMaxPointwiseDivideMethod
max::PetscReal = VecMaxPointwiseDivide(petsclib::PetscLibType,x::PetscVec, y::PetscVec)

Computes the maximum of the componentwise division max = max_i abs(x[i]/y[i]).

Logically Collective

Input Parameters:

  • x - the numerators
  • y - the denominators

Output Parameter:

  • max - the result

Level: advanced

-seealso: , Vec, VecPointwiseDivide(), VecPointwiseMult(), VecPointwiseMax(), VecPointwiseMin(), VecPointwiseMaxAbs()

External Links

source
PETSc.LibPETSc.VecMeanMethod
mean::PetscScalar = VecMean(petsclib::PetscLibType,v::PetscVec)

Computes the arithmetic mean of all the components of a vector.

Collective

Input Parameter:

  • v - the vector

Output Parameter:

  • mean - the result

Level: beginner

-seealso: Vec, VecSum(), VecNorm()

External Links

source
PETSc.LibPETSc.VecMedianMethod
VecMedian(petsclib::PetscLibType,Vec1::PetscVec, Vec2::PetscVec, Vec3::PetscVec, VMedian::PetscVec)

Computes the componentwise median of three vectors and stores the result in this vector. Used primarily for projecting a vector within upper and lower bounds.

Logically Collective

Input Parameters:

  • Vec1 - The first vector
  • Vec2 - The second vector
  • Vec3 - The third vector

Output Parameter:

  • VMedian - The median vector (this can be any one of the input vectors)

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecMinMethod
p::PetscInt,val::PetscReal = VecMin(petsclib::PetscLibType,x::PetscVec)

Determines the vector component with minimum real part and its location.

Collective

Input Parameter:

  • x - the vector

Output Parameters:

  • p - the index of val (pass NULL if you don't want this location) in the vector
  • val - the minimum component

Level: intermediate

-seealso: , Vec, VecMax()

External Links

source
PETSc.LibPETSc.VecNestGetSizeMethod
N::PetscInt = VecNestGetSize(petsclib::PetscLibType,X::PetscVec)

Returns the size of the nest vector.

Not Collective

Input Parameter:

  • X - nest vector

Output Parameter:

  • N - number of nested vecs

Level: developer

-seealso: VECNEST, , Vec, VecType, VecNestGetSubVec(), VecNestGetSubVecs()

External Links

source
PETSc.LibPETSc.VecNestGetSubVecMethod
VecNestGetSubVec(petsclib::PetscLibType,X::PetscVec, idxm::PetscInt, sx::PetscVec)

Returns a single, sub

Not Collective

Input Parameters:

  • X - nest vector
  • idxm - index of the vector within the nest

Output Parameter:

  • sx - vector at index idxm within the nest

Level: developer

-seealso: VECNEST, , Vec, VecType, VecNestGetSize(), VecNestGetSubVecs()

External Links

source
PETSc.LibPETSc.VecNestGetSubVecsMethod
N::PetscInt = VecNestGetSubVecs(petsclib::PetscLibType,X::PetscVec, sx::Vector{PetscVec})

Returns the entire array of vectors defining a nest vector.

Not Collective

Input Parameter:

  • X - nest vector

Output Parameters:

  • N - number of nested vecs
  • sx - array of vectors, can pass in NULL

Level: developer

-seealso: VECNEST, , Vec, VecType, VecNestGetSize(), VecNestGetSubVec()

External Links

source
PETSc.LibPETSc.VecNestSetSubVecMethod
VecNestSetSubVec(petsclib::PetscLibType,X::PetscVec, idxm::PetscInt, sx::PetscVec)

Set a single component vector in a nest vector at specified index.

Not Collective

Input Parameters:

  • X - nest vector
  • idxm - index of the vector within the nest vector
  • sx - vector at index idxm within the nest vector

Level: developer

-seealso: VECNEST, , Vec, VecType, VecNestSetSubVecs(), VecNestGetSubVec()

External Links

source
PETSc.LibPETSc.VecNestSetSubVecsMethod
VecNestSetSubVecs(petsclib::PetscLibType,X::PetscVec, N::PetscInt, idxm::Vector{PetscInt}, sx::Vector{PetscVec})

Sets the component vectors at the specified indices in a nest vector.

Not Collective

Input Parameters:

  • X - nest vector
  • N - number of component vecs in sx
  • idxm - indices of component vectors that are to be replaced
  • sx - array of vectors

Level: developer

-seealso: VECNEST, , Vec, VecType, VecNestGetSize(), VecNestGetSubVec()

External Links

source
PETSc.LibPETSc.VecNormMethod
val::PetscReal = VecNorm(petsclib::PetscLibType,x::PetscVec, type::NormType)

Computes the vector norm.

Collective

Input Parameters:

  • x - the vector
  • type - the type of the norm requested

Output Parameter:

  • val - the norm

Level: intermediate

-seealso: , Vec, NormType, VecDot(), VecTDot(), VecDotBegin(), VecDotEnd(), VecNormAvailable(), VecNormBegin(), VecNormEnd(), NormType()

External Links

source
PETSc.LibPETSc.VecNormAvailableMethod
available::PetscBool,val::PetscReal = VecNormAvailable(petsclib::PetscLibType,x::PetscVec, type::NormType)

Returns the vector norm if it is already known. That is, it has been previously computed and cached in the vector

Not Collective

Input Parameters:

  • x - the vector
  • type - one of NORM_1 (sumi |x[i]|), `NORM2sqrt(sum_i (x[i])^2),NORMINFINITY` maxi |x[i]|. Also available

NORM_1_AND_2, which computes both norms and stores them in a two element array.

Output Parameters:

  • available - PETSC_TRUE if the val returned is valid
  • val - the norm

Level: intermediate

-seealso: , Vec, VecDot(), VecTDot(), VecNorm(), VecDotBegin(), VecDotEnd(), VecNormBegin(), VecNormEnd()

External Links

source
PETSc.LibPETSc.VecNormBeginMethod
VecNormBegin(petsclib::PetscLibType,x::PetscVec, ntype::NormType, result::PetscReal)

Starts a split phase norm computation.

Input Parameters:

  • x - the first vector
  • ntype - norm type, one of NORM_1, NORM_2, NORM_MAX, NORM_1_AND_2
  • result - where the result will go (can be NULL)

Level: advanced

-seealso: VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecDotBegin(), VecDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecNormEndMethod
VecNormEnd(petsclib::PetscLibType,x::PetscVec, ntype::NormType, result::PetscReal)

Ends a split phase norm computation.

Input Parameters:

  • x - the first vector
  • ntype - norm type, one of NORM_1, NORM_2, NORM_MAX, NORM_1_AND_2
  • result - where the result will go

Level: advanced

-seealso: VecNormBegin(), VecNorm(), VecDot(), VecMDot(), VecDotBegin(), VecDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecNormalizeMethod
val::PetscReal = VecNormalize(petsclib::PetscLibType,x::PetscVec)

Normalizes a vector by its 2

Collective

Input Parameter:

  • x - the vector

Output Parameter:

  • val - the vector norm before normalization. May be NULL if the value is not needed.

Level: intermediate

-seealso: , Vec, VecNorm(), NORM_2, NormType

External Links

source
PETSc.LibPETSc.VecPermuteMethod
VecPermute(petsclib::PetscLibType,x::PetscVec, row::IS, inv::PetscBool)

Permutes a vector in place using the given ordering.

Input Parameters:

  • x - The vector
  • row - The ordering
  • inv - The flag for inverting the permutation

Level: beginner

-seealso: Vec, MatPermute()

External Links

source
PETSc.LibPETSc.VecPlaceArrayMethod
VecPlaceArray(petsclib::PetscLibType,vec::PetscVec, array::Vector{PetscScalar})

Allows one to replace the array in a vector with an array provided by the user. This is useful to avoid copying an array into a vector.

Logically Collective; No Fortran Support

Input Parameters:

  • vec - the vector
  • array - the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecReplaceArray(), VecResetArray()

External Links

source
PETSc.LibPETSc.VecPointwiseDivideMethod
VecPointwiseDivide(petsclib::PetscLibType,w::PetscVec, x::PetscVec, y::PetscVec)

Computes the component

Logically Collective

Input Parameters:

  • x - the numerator vector
  • y - the denominator vector

Output Parameter:

  • w - the result

Level: advanced

-seealso: , Vec, VecPointwiseMult(), VecPointwiseMax(), VecPointwiseMin(), VecPointwiseMaxAbs(), VecMaxPointwiseDivide()

External Links

source
PETSc.LibPETSc.VecPointwiseMaxMethod
VecPointwiseMax(petsclib::PetscLibType,w::PetscVec, x::PetscVec, y::PetscVec)

Computes the component

Logically Collective

Input Parameters:

  • x - the first input vector
  • y - the second input vector

Output Parameter:

  • w - the result

Level: advanced

-seealso: , Vec, VecPointwiseDivide(), VecPointwiseMult(), VecPointwiseMin(), VecPointwiseMaxAbs(), VecMaxPointwiseDivide()

External Links

source
PETSc.LibPETSc.VecPointwiseMaxAbsMethod
VecPointwiseMaxAbs(petsclib::PetscLibType,w::PetscVec, x::PetscVec, y::PetscVec)

Computes the component

Logically Collective

Input Parameters:

  • x - the first input vector
  • y - the second input vector

Output Parameter:

  • w - the result

Level: advanced

-seealso: , Vec, VecPointwiseDivide(), VecPointwiseMult(), VecPointwiseMin(), VecPointwiseMax(), VecMaxPointwiseDivide()

External Links

source
PETSc.LibPETSc.VecPointwiseMinMethod
VecPointwiseMin(petsclib::PetscLibType,w::PetscVec, x::PetscVec, y::PetscVec)

Computes the component

Logically Collective

Input Parameters:

  • x - the first input vector
  • y - the second input vector

Output Parameter:

  • w - the result

Level: advanced

-seealso: , Vec, VecPointwiseDivide(), VecPointwiseMult(), VecPointwiseMaxAbs(), VecMaxPointwiseDivide()

External Links

source
PETSc.LibPETSc.VecPointwiseMultMethod
VecPointwiseMult(petsclib::PetscLibType,w::PetscVec, x::PetscVec, y::PetscVec)

Computes the component

Logically Collective

Input Parameters:

  • x - the first vector
  • y - the second vector

Output Parameter:

  • w - the result

Level: advanced

-seealso: , Vec, VecPointwiseDivide(), VecPointwiseMax(), VecPointwiseMin(), VecPointwiseMaxAbs(), VecMaxPointwiseDivide()

External Links

source
PETSc.LibPETSc.VecPowMethod
VecPow(petsclib::PetscLibType,v::PetscVec, p::PetscScalar)

Replaces each component of a vector by x_i^p

Logically Collective

Input Parameters:

  • v - the vector
  • p - the exponent to use on each element

Level: intermediate

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecRealPartMethod
VecRealPart(petsclib::PetscLibType,v::PetscVec)

Replaces a complex vector with its real part

Collective

Input Parameter:

  • v - the vector

Level: beginner

-seealso: Vec, VecNorm(), VecImaginaryPart()

External Links

source
PETSc.LibPETSc.VecReciprocalMethod
VecReciprocal(petsclib::PetscLibType,vec::PetscVec)

Replaces each component of a vector by its reciprocal.

Logically Collective

Input Parameter:

  • vec - the vector

Output Parameter:

  • vec - the vector reciprocal

Level: intermediate

-seealso: , Vec, VecLog(), VecExp(), VecSqrtAbs()

External Links

source
PETSc.LibPETSc.VecRegisterMethod
VecRegister(petsclib::PetscLibType,sname::Vector{Cchar}, fnc::external)

Adds a new vector component implementation

Not Collective, No Fortran Support

Input Parameters:

  • sname - The name of a new user-defined creation routine
  • function - The creation routine

-seealso: VecRegisterAll(), VecRegisterDestroy()

External Links

source
PETSc.LibPETSc.VecRegisterAllMethod
VecRegisterAll(petsclib::PetscLibType)

Registers all of the vector types in the Vec package.

Not Collective

Level: advanced

-seealso: , Vec, VecType, VecRegister(), VecRegisterDestroy()

External Links

source
PETSc.LibPETSc.VecReplaceArrayMethod
VecReplaceArray(petsclib::PetscLibType,vec::PetscVec, array::Vector{PetscScalar})

Allows one to replace the array in a vector with an array provided by the user. This is useful to avoid copying an array into a vector.

Logically Collective; No Fortran Support

Input Parameters:

  • vec - the vector
  • array - the array

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecPlaceArray(), VecResetArray()

External Links

source
PETSc.LibPETSc.VecResetArrayMethod
VecResetArray(petsclib::PetscLibType,vec::PetscVec)

Resets a vector to use its default memory. Call this after the use of VecPlaceArray().

Not Collective

Input Parameter:

  • vec - the vector

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecReplaceArray(), VecPlaceArray()

External Links

source
PETSc.LibPETSc.VecRestoreArrayMethod
VecRestoreArray(petsclib::PetscLibType,x::PetscVec, a::Vector{PetscScalar})

Restores a vector after VecGetArray() has been called and the array is no longer needed

Logically Collective

Input Parameters:

  • x - the vector
  • a - location of pointer to array obtained from VecGetArray()

Level: beginner

-seealso: , Vec, VecGetArray(), VecRestoreArrayRead(), VecRestoreArrays(), VecPlaceArray(), VecRestoreArray2d(), VecGetArrayPair(), VecRestoreArrayPair()

External Links

source
PETSc.LibPETSc.VecRestoreArray1dMethod
VecRestoreArray1d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, mstart::PetscInt, a::PetscArray{PetscScalar, 1})

Restores a vector after VecGetArray1d() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray1d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray2d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray1dReadMethod
VecRestoreArray1dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, mstart::PetscInt, a::PetscArray{PetscScalar, 1})

Restores a vector after VecGetArray1dRead() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray1dRead()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray2d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray1dReadMethod
VecRestoreArray1dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, mstart::PetscInt, a::Vector{PetscScalar})

Restores a vector after VecGetArray1dRead() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray1dRead()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray2d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray1dWriteMethod
VecRestoreArray1dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, mstart::PetscInt, a::PetscArray{PetscScalar, 1})

Restores a vector after VecGetArray1dWrite() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray1d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray2d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray2dMethod
VecRestoreArray2d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, mstart::PetscInt, nstart::PetscInt, a::PetscArray{PetscScalar, 2})

Restores a vector after VecGetArray2d() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • n - second dimension of the two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray2d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray2dReadMethod
VecRestoreArray2dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, mstart::PetscInt, nstart::PetscInt, a::PetscArray{PetscScalar, 2})

Restores a vector after VecGetArray2dRead() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • n - second dimension of the two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray2d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray2dWriteMethod
VecRestoreArray2dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, mstart::PetscInt, nstart::PetscInt, a::PetscArray{PetscScalar, 2})

Restores a vector after VecGetArray2dWrite() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of two dimensional array
  • n - second dimension of the two dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray2d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray3dMethod
VecRestoreArray3d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, a::PetscArray{PetscScalar, 3})

Restores a vector after VecGetArray3d() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of three dimensional array
  • n - second dimension of the three dimensional array
  • p - third dimension of the three dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray3d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray3dReadMethod
VecRestoreArray3dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, a::PetscArray{PetscScalar, 3})

Restores a vector after VecGetArray3dRead() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of three dimensional array
  • n - second dimension of the three dimensional array
  • p - third dimension of the three dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray3dRead()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray3dWriteMethod
VecRestoreArray3dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, a::PetscArray{PetscScalar, 3})

Restores a vector after VecGetArray3dWrite() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of three dimensional array
  • n - second dimension of the three dimensional array
  • p - third dimension of the three dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray3d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray4dMethod
VecRestoreArray4d(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, q::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, qstart::PetscInt, a::PetscArray{PetscScalar, 4})

Restores a vector after VecGetArray4d() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of four dimensional array
  • n - second dimension of the four dimensional array
  • p - third dimension of the four dimensional array
  • q - fourth dimension of the four dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • qstart - first index in the fourth coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray4d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray4dReadMethod
VecRestoreArray4dRead(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, q::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, qstart::PetscInt, a::PetscArray{PetscScalar, 4})

Restores a vector after VecGetArray4d() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of four dimensional array
  • n - second dimension of the four dimensional array
  • p - third dimension of the four dimensional array
  • q - fourth dimension of the four dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • qstart - first index in the fourth coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray4dRead()

Level: beginner

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArray4dWriteMethod
VecRestoreArray4dWrite(petsclib::PetscLibType,x::PetscVec, m::PetscInt, n::PetscInt, p::PetscInt, q::PetscInt, mstart::PetscInt, nstart::PetscInt, pstart::PetscInt, qstart::PetscInt, a::PetscArray{PetscScalar, 4})

Restores a vector after VecGetArray4dWrite() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • m - first dimension of four dimensional array
  • n - second dimension of the four dimensional array
  • p - third dimension of the four dimensional array
  • q - fourth dimension of the four dimensional array
  • mstart - first index you will use in first coordinate direction (often 0)
  • nstart - first index in the second coordinate direction (often 0)
  • pstart - first index in the third coordinate direction (often 0)
  • qstart - first index in the fourth coordinate direction (often 0)
  • a - location of pointer to array obtained from VecGetArray4d()

Level: developer

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecRestoreArrays(), VecPlaceArray(), VecGetArray2d(), VecGetArray3d(), VecRestoreArray3d(), DMDAVecGetArray(), DMDAVecRestoreArray() VecGetArray1d(), VecRestoreArray1d(), VecGetArray4d(), VecRestoreArray4d()

External Links

source
PETSc.LibPETSc.VecRestoreArrayAndMemTypeMethod
VecRestoreArrayAndMemType(petsclib::PetscLibType,x::PetscVec, a::Vector{PetscScalar})

Restores a vector after VecGetArrayAndMemType() has been called.

Logically Collective; No Fortran Support

Input Parameters:

  • x - the vector
  • a - location of pointer to array obtained from VecGetArrayAndMemType()

Level: beginner

-seealso: , Vec, VecGetArrayAndMemType(), VecGetArray(), VecRestoreArrayRead(), VecRestoreArrays(), VecPlaceArray(), VecRestoreArray2d(), VecGetArrayPair(), VecRestoreArrayPair()

External Links

source
PETSc.LibPETSc.VecRestoreArrayReadMethod
VecRestoreArrayRead(petsclib::PetscLibType,x::PetscVec, a::Vector{PetscScalar})

Restore array obtained with VecGetArrayRead()

Not Collective

Input Parameters:

  • x - the vector
  • a - the array

Level: beginner

-seealso: , Vec, VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair()

External Links

source
PETSc.LibPETSc.VecRestoreArrayReadAndMemTypeMethod
VecRestoreArrayReadAndMemType(petsclib::PetscLibType,x::PetscVec, a::Vector{PetscScalar})

Restore array obtained with VecGetArrayReadAndMemType()

Not Collective; No Fortran Support

Input Parameters:

  • x - the vector
  • a - the array

Level: beginner

-seealso: , Vec, VecGetArrayReadAndMemType(), VecRestoreArrayAndMemType(), VecRestoreArrayWriteAndMemType(), VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair()

External Links

source
PETSc.LibPETSc.VecRestoreArrayWriteMethod
VecRestoreArrayWrite(petsclib::PetscLibType,x::PetscVec, a::Vector{PetscScalar})

Restores a vector after VecGetArrayWrite() has been called.

Logically Collective

Input Parameters:

  • x - the vector
  • a - location of pointer to array obtained from VecGetArray()

Level: beginner

-seealso: , Vec, VecGetArray(), VecRestoreArrayRead(), VecRestoreArrays(), VecPlaceArray(), VecRestoreArray2d(), VecGetArrayPair(), VecRestoreArrayPair(), VecGetArrayWrite()

External Links

source
PETSc.LibPETSc.VecRestoreArrayWriteAndMemTypeMethod
VecRestoreArrayWriteAndMemType(petsclib::PetscLibType,x::PetscVec, a::Vector{PetscScalar})

Restore array obtained with VecGetArrayWriteAndMemType()

Logically Collective; No Fortran Support

Input Parameters:

  • x - the vector
  • a - the array

Level: beginner

-seealso: , Vec, VecGetArrayWriteAndMemType(), VecRestoreArrayAndMemType(), VecGetArray(), VecRestoreArray(), VecGetArrayPair(), VecRestoreArrayPair()

External Links

source
PETSc.LibPETSc.VecRestoreArraysMethod
VecRestoreArrays(petsclib::PetscLibType,x::Vector{PetscVec}, n::PetscInt, a::Vector{PetscScalar})

Restores a group of vectors after VecGetArrays() has been called.

Logically Collective; No Fortran Support

Input Parameters:

  • x - the vector
  • n - the number of vectors
  • a - location of pointer to arrays obtained from VecGetArrays()

-seealso: , Vec, VecGetArrays(), VecRestoreArray()

External Links

source
PETSc.LibPETSc.VecRestoreLocalVectorMethod
VecRestoreLocalVector(petsclib::PetscLibType,v::PetscVec, w::PetscVec)

Unmaps the local portion of a vector previously mapped into a vector using VecGetLocalVector().

Logically Collective.

Input Parameters:

  • v - The local portion of this vector was previously mapped into w using VecGetLocalVector().
  • w - The vector into which the local portion of v was mapped.

Level: beginner

-seealso: , Vec, VecCreateLocalVector(), VecGetLocalVector(), VecGetLocalVectorRead(), VecRestoreLocalVectorRead(), LocalVectorRead(), VecGetArrayRead(), VecGetArray()

External Links

source
PETSc.LibPETSc.VecRestoreLocalVectorReadMethod
VecRestoreLocalVectorRead(petsclib::PetscLibType,v::PetscVec, w::PetscVec)

Unmaps the local portion of a vector previously mapped into a vector using VecGetLocalVectorRead().

Not Collective.

Input Parameters:

  • v - The local portion of this vector was previously mapped into w using VecGetLocalVectorRead().
  • w - The vector into which the local portion of v was mapped.

Level: beginner

-seealso: , Vec, VecCreateLocalVector(), VecGetLocalVectorRead(), VecGetLocalVector(), VecGetArrayRead(), VecGetArray()

External Links

source
PETSc.LibPETSc.VecRestoreSubVectorMethod
VecRestoreSubVector(petsclib::PetscLibType,X::PetscVec, is::IS, Y::PetscVec)

Restores a subvector extracted using VecGetSubVector()

Collective

Input Parameters:

  • X - vector from which subvector was obtained
  • is - index set representing the subset of X
  • Y - subvector being restored

Level: advanced

-seealso: , Vec, IS, VecGetSubVector()

External Links

source
PETSc.LibPETSc.VecTDotMethod
val::PetscScalar = VecTDot(petsclib::PetscLibType,x::PetscVec, y::PetscVec)

Computes an indefinite vector dot product. That is, this routine does NOT use the complex conjugate.

Collective

Input Parameters:

  • x - first vector
  • y - second vector

Output Parameter:

  • val - the dot product

Level: intermediate

Notes for Users of Complex Numbers: For complex vectors, VecTDot() computes the indefinite form -seealso: , Vec, VecDot(), VecMTDot()

External Links

source
PETSc.LibPETSc.VecTDotBeginMethod
VecTDotBegin(petsclib::PetscLibType,x::PetscVec, y::PetscVec, result::PetscScalar)

Starts a split phase transpose dot product computation.

Input Parameters:

  • x - the first vector
  • y - the second vector
  • result - where the result will go (can be NULL)

Level: advanced

-seealso: VecTDotEnd(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecDotBegin(), VecDotEnd(), PetscCommSplitReductionBegin()

External Links

source
PETSc.LibPETSc.VecTDotEndMethod
VecTDotEnd(petsclib::PetscLibType,x::PetscVec, y::PetscVec, result::PetscScalar)

Ends a split phase transpose dot product computation.

Input Parameters:

  • x - the first vector (can be NULL)
  • y - the second vector (can be NULL)
  • result - where the result will go

Level: advanced

-seealso: VecTDotBegin(), VecNormBegin(), VecNormEnd(), VecNorm(), VecDot(), VecMDot(), VecDotBegin(), VecDotEnd()

External Links

source
PETSc.LibPETSc.VecUniqueEntriesMethod
n::PetscInt,e::Vector{PetscScalar} = VecUniqueEntries(petsclib::PetscLibType,vec::PetscVec)

Compute the number of unique entries, and those entries

Collective

Input Parameter:

  • vec - the vector

Output Parameters:

  • n - The number of unique entries
  • e - The entries, each MPI process receives all the unique entries

Level: intermediate

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecViewMethod
VecView(petsclib::PetscLibType,vec::PetscVec, viewer::PetscViewer)

Views a vector object.

Collective

Input Parameters:

  • vec - the vector
  • viewer - an optional PetscViewer visualization context

Level: beginner

-seealso: , Vec, VecViewFromOptions(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscDrawLGCreate(), PetscViewerSocketOpen(), PetscViewerBinaryOpen(), VecLoad(), PetscViewerCreate(), PetscRealView(), PetscScalarView(), PetscIntView(), PetscViewerHDF5SetTimestep()

External Links

source
PETSc.LibPETSc.VecViewFromOptionsMethod
VecViewFromOptions(petsclib::PetscLibType,A::PetscVec, obj::PetscObject, name::Vector{Cchar})

View a vector based on values in the options database

Collective

Input Parameters:

  • A - the vector
  • obj - optional object that provides the options prefix for this viewing, use 'NULL' to use the prefix of A
  • name - command line option

Level: intermediate

-seealso: , Vec, VecView, PetscObjectViewFromOptions(), VecCreate()

External Links

source
PETSc.LibPETSc.VecViewNativeMethod
VecViewNative(petsclib::PetscLibType,vec::PetscVec, viewer::PetscViewer)

Views a vector object with the original type specific viewer

Collective

Input Parameters:

  • vec - the vector
  • viewer - an optional PetscViewer visualization context

Level: developer

-seealso: , Vec, PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscDrawLGCreate(), VecView() PetscViewerSocketOpen(), PetscViewerBinaryOpen(), VecLoad(), PetscViewerCreate(), PetscRealView(), PetscScalarView(), PetscIntView(), PetscViewerHDF5SetTimestep()

External Links

source
PETSc.LibPETSc.VecWAXPYMethod
VecWAXPY(petsclib::PetscLibType,w::PetscVec, alpha::PetscScalar, x::PetscVec, y::PetscVec)

Computes w = alpha x + y.

Logically Collective

Input Parameters:

  • alpha - the scalar
  • x - first vector, multiplied by alpha
  • y - second vector

Output Parameter:

  • w - the result

Level: intermediate

-seealso: , Vec, VecAXPY(), VecAYPX(), VecAXPBY(), VecMAXPY(), VecAXPBYPCZ()

External Links

source
PETSc.LibPETSc.VecWhichBetweenMethod
VecWhichBetween(petsclib::PetscLibType,VecLow::PetscVec, V::PetscVec, VecHigh::PetscVec, S::IS)

Creates an index set containing the indices where VecLow < V < VecHigh

Collective

Input Parameters:

  • VecLow - lower bound
  • V - Vector to compare
  • VecHigh - higher bound

Output Parameter:

  • S - The index set containing the indices i where veclow[i] < v[i] < vechigh[i]

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecWhichBetweenOrEqualMethod
VecWhichBetweenOrEqual(petsclib::PetscLibType,VecLow::PetscVec, V::PetscVec, VecHigh::PetscVec, S::IS)

Creates an index set containing the indices where VecLow <= V <= VecHigh

Collective

Input Parameters:

  • VecLow - lower bound
  • V - Vector to compare
  • VecHigh - higher bound

Output Parameter:

  • S - The index set containing the indices i where veclow[i] <= v[i] <= vechigh[i]

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecWhichEqualMethod
VecWhichEqual(petsclib::PetscLibType,Vec1::PetscVec, Vec2::PetscVec, S::IS)

Creates an index set containing the indices where the vectors Vec1 and Vec2 have identical elements.

Collective

Input Parameters:

  • Vec1 - the first vector to compare
  • Vec2 - the second two vector to compare

Output Parameter:

  • S - The index set containing the indices i where vec1[i] == vec2[i]

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecWhichGreaterThanMethod
VecWhichGreaterThan(petsclib::PetscLibType,Vec1::PetscVec, Vec2::PetscVec, S::IS)

Creates an index set containing the indices where the vectors Vec1 > Vec2

Collective

Input Parameters:

  • Vec1 - the first vector to compare
  • Vec2 - the second vector to compare

Output Parameter:

  • S - The index set containing the indices i where vec1[i] > vec2[i]

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecWhichInactiveMethod
VecWhichInactive(petsclib::PetscLibType,VecLow::PetscVec, V::PetscVec, D::PetscVec, VecHigh::PetscVec, Strong::PetscBool, S::IS)

Creates an IS based on a set of vectors

Collective

Input Parameters:

  • VecLow - lower bound
  • V - Vector to compare
  • D - Direction to compare
  • VecHigh - higher bound
  • Strong - indicator for applying strongly inactive test

Output Parameter:

  • S - The index set containing the indices i where the bound is inactive

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecWhichLessThanMethod
VecWhichLessThan(petsclib::PetscLibType,Vec1::PetscVec, Vec2::PetscVec, S::IS)

Creates an index set containing the indices where the vectors Vec1 < Vec2

Collective

Input Parameters:

  • Vec1 - the first vector to compare
  • Vec2 - the second vector to compare

Output Parameter:

  • S - The index set containing the indices i where vec1[i] < vec2[i]

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecZeroEntriesMethod
VecZeroEntries(petsclib::PetscLibType,vec::PetscVec)

puts a 0.0 in each element of a vector

Logically Collective

Input Parameter:

  • vec - The vector

Level: beginner

-seealso: , Vec, VecCreate(), VecSetOptionsPrefix(), VecSet(), VecSetValues()

External Links

source
PETSc.LibPETSc.VecSFischerMethod
VecSFischer(petsclib::PetscLibType,X::PetscVec, F::PetscVec, L::PetscVec, U::PetscVec, mu::PetscReal, FB::PetscVec)

Evaluates the Smoothed Fischer complementarity problems.

Logically Collective

Input Parameters:

  • X - current point
  • F - function evaluated at x
  • L - lower bounds
  • U - upper bounds
  • mu - smoothing parameter

Output Parameter:

  • FB - The Smoothed Fischer-Burmeister function vector

-seealso: Vec, VecFischer(), MatDFischer(), MatDSFischer()

External Links

source
PETSc.LibPETSc.VecScaleMethod
VecScale(petsclib::PetscLibType,x::PetscVec, alpha::PetscScalar)

Scales a vector.

Logically Collective

Input Parameters:

  • x - the vector
  • alpha - the scalar

Level: intermediate

-seealso: , Vec, VecSet()

External Links

source
PETSc.LibPETSc.VecScatterBeginMethod
VecScatterBegin(petsclib::PetscLibType,sf::VecScatter, x::PetscVec, y::PetscVec, addv::InsertMode, mode::ScatterMode)

Begins a generalized scatter from one vector to another. Complete the scattering phase with VecScatterEnd().

Neighbor-wise Collective

Input Parameters:

  • sf - scatter context generated by VecScatterCreate()
  • x - the vector from which we scatter
  • y - the vector to which we scatter
  • addv - either ADD_VALUES, MAX_VALUES, MIN_VALUES or INSERT_VALUES, with INSERT_VALUES mode any location

not scattered to retains its old value; i.e. the vector is NOT first zeroed.

  • mode - the scattering mode, usually SCATTER_FORWARD. The available modes are: SCATTER_FORWARD or SCATTER_REVERSE

Level: intermediate

-seealso: , VecScatter, VecScatterCreate(), VecScatterEnd(), InsertMode, ScatterMode

External Links

source
PETSc.LibPETSc.VecScatterCopyMethod
VecScatterCopy(petsclib::PetscLibType,sf::VecScatter, newsf::VecScatter)

Makes a copy of a scatter context.

Collective

Input Parameter:

  • sf - the scatter context

Output Parameter:

  • newsf - the context copy

Level: advanced

-seealso: , VecScatter, VecScatterType, VecScatterCreate(), VecScatterDestroy()

External Links

source
PETSc.LibPETSc.VecScatterCreateMethod
newsf::VecScatter = VecScatterCreate(petsclib::PetscLibType,x::PetscVec, ix::IS, y::PetscVec, iy::IS)

Creates a vector scatter VecScatter context that is used to communicate entries between two vectors Vec

Collective

Input Parameters:

  • x - a vector that defines the shape (parallel data layout of the vector) of vectors from which we scatter
  • y - a vector that defines the shape (parallel data layout of the vector) of vectors to which we scatter
  • ix - the indices of x to scatter (if NULL scatters all values)
  • iy - the indices of y to hold results (if NULL fills entire vector yin in order)

Output Parameter:

  • newsf - location to store the new scatter context

Options Database Keys:

  • -vecscatter_view - Prints detail of communications
  • -vecscatter_view ::ascii_info - Print less details about communication
  • -vecscatter_merge - VecScatterBegin() handles all of the communication, VecScatterEnd() is a nop

eliminates the chance for overlap of computation and communication

Level: intermediate

-seealso: , VecScatter, VecScatterDestroy(), VecScatterCreateToAll(), VecScatterCreateToZero(), PetscSFCreate(), VecScatterType, InsertMode, ScatterMode, VecScatterBegin(), VecScatterEnd()

External Links

source
PETSc.LibPETSc.VecScatterCreateToAllMethod
ctx::VecScatter,vout::PetscVec = VecScatterCreateToAll(petsclib::PetscLibType,vin::PetscVec)

Creates a vector and a scatter context that copies all vector values to each processor

Collective

Input Parameter:

  • vin - an MPIVEC

Output Parameters:

  • ctx - scatter context
  • vout - output SEQVEC that is large enough to scatter into

Level: intermediate

-seealso: , VecScatter, VecScatterCreate(), VecScatterCreateToZero(), VecScatterBegin(), VecScatterEnd()

External Links

source
PETSc.LibPETSc.VecScatterCreateToZeroMethod
ctx::VecScatter,vout::PetscVec = VecScatterCreateToZero(petsclib::PetscLibType,vin::PetscVec)

Creates an output vector and a scatter context used to copy all vector values into the output vector on the zeroth processor

Collective

Input Parameter:

  • vin - Vec of type MPIVEC

Output Parameters:

  • ctx - scatter context
  • vout - output SEQVEC that is large enough to scatter into on processor 0 and

of length zero on all other processors

Level: intermediate

-seealso: , VecScatter, VecScatterCreate(), VecScatterCreateToAll(), VecScatterBegin(), VecScatterEnd()

External Links

source
PETSc.LibPETSc.VecScatterDestroyMethod
VecScatterDestroy(petsclib::PetscLibType,sf::VecScatter)

Destroys a scatter context created by VecScatterCreate()

Collective

Input Parameter:

  • sf - the scatter context

Level: intermediate

-seealso: , VecScatter, VecScatterCreate(), VecScatterCopy()

External Links

source
PETSc.LibPETSc.VecScatterEndMethod
VecScatterEnd(petsclib::PetscLibType,sf::VecScatter, x::PetscVec, y::PetscVec, addv::InsertMode, mode::ScatterMode)

Ends a generalized scatter from one vector to another. Call after first calling VecScatterBegin().

Neighbor-wise Collective

Input Parameters:

  • sf - scatter context generated by VecScatterCreate()
  • x - the vector from which we scatter
  • y - the vector to which we scatter
  • addv - one of ADD_VALUES, MAX_VALUES, MIN_VALUES or INSERT_VALUES
  • mode - the scattering mode, usually SCATTER_FORWARD. The available modes are: SCATTER_FORWARD, SCATTER_REVERSE

Level: intermediate

-seealso: , VecScatter, VecScatterBegin(), VecScatterCreate()

External Links

source
PETSc.LibPETSc.VecScatterFFTWToPetscMethod
VecScatterFFTWToPetsc(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec)

Converts MATFFTW output vector to a PETSc vector.

Collective

Input Parameters:

  • A - MATFFTW matrix
  • x - FFTW vector

Output Parameter:

  • y - PETSc vector

Level: intermediate

-seealso: , Mat, VecScatterPetscToFFTW(), MATFFTW, MatCreateVecsFFTW()

External Links

source
PETSc.LibPETSc.VecScatterGetMergedMethod
flg::PetscBool = VecScatterGetMerged(petsclib::PetscLibType,sf::VecScatter)

Returns true if the scatter is completed in the VecScatterBegin() and the VecScatterEnd() does nothing

Not Collective

Input Parameter:

  • sf - scatter context created with VecScatterCreate()

Output Parameter:

  • flg - PETSC_TRUE if the VecScatterBegin()/VecScatterEnd() are all done during the VecScatterBegin()

Level: developer

-seealso: , VecScatter, VecScatterCreate(), VecScatterEnd(), VecScatterBegin()

External Links

source
PETSc.LibPETSc.VecScatterGetTypeMethod
type::VecScatterType = VecScatterGetType(petsclib::PetscLibType,sf::VecScatter)

Gets the vector scatter type name (as a string) from the VecScatter.

Not Collective

Input Parameter:

  • sf - The vector scatter

Output Parameter:

  • type - The vector scatter type name

Level: intermediate

-seealso: , VecScatter, VecScatterType, VecScatterSetType(), VecScatterCreate()

External Links

source
PETSc.LibPETSc.VecScatterPetscToFFTWMethod
VecScatterPetscToFFTW(petsclib::PetscLibType,A::PetscMat, x::PetscVec, y::PetscVec)

Copies a PETSc vector to the vector that goes into MATFFTW calls.

Collective

Input Parameters:

  • A - FFTW matrix
  • x - the PETSc vector

Output Parameter:

  • y - the FFTW vector

Level: intermediate

-seealso: , Mat, MATFFTW, VecScatterFFTWToPetsc(), MatCreateVecsFFTW()

External Links

source
PETSc.LibPETSc.VecScatterRegisterMethod
VecScatterRegister(petsclib::PetscLibType,sname::Vector{Cchar}, fnc::external)

Adds a new vector scatter component implementation

Not Collective

Input Parameters:

  • sname - The name of a new user-defined creation routine
  • function - The creation routine

Level: advanced

-seealso: , VecScatter, VecScatterType, VecRegister()

External Links

source
PETSc.LibPETSc.VecScatterRemapMethod
VecScatterRemap(petsclib::PetscLibType,sf::VecScatter, tomap::Vector{PetscInt}, frommap::Vector{PetscInt})

Remaps the "from" and "to" indices in a vector scatter context.

Collective

Input Parameters:

  • sf - vector scatter context
  • tomap - remapping plan for "to" indices (may be NULL).
  • frommap - remapping plan for "from" indices (may be NULL)

Level: developer

-seealso: , VecScatter, VecScatterCreate()

External Links

source
PETSc.LibPETSc.VecScatterSetFromOptionsMethod
VecScatterSetFromOptions(petsclib::PetscLibType,sf::VecScatter)

Configures the vector scatter from values in the options database.

Collective

Input Parameter:

  • sf - The vector scatter

-seealso: , VecScatter, VecScatterCreate(), VecScatterDestroy(), VecScatterSetUp()

External Links

source
PETSc.LibPETSc.VecScatterSetTypeMethod
VecScatterSetType(petsclib::PetscLibType,sf::VecScatter, type::VecScatterType)

Builds a vector scatter, for a particular vector scatter implementation.

Collective

Input Parameters:

  • sf - The VecScatter object
  • type - The name of the vector scatter type

Options Database Key:

  • -sf_type <type> - Sets the VecScatterType

Level: intermediate

-seealso: , VecScatter, VecScatterType, VecScatterGetType(), VecScatterCreate()

External Links

source
PETSc.LibPETSc.VecScatterSetUpMethod
VecScatterSetUp(petsclib::PetscLibType,sf::VecScatter)

Sets up the VecScatter to be able to actually scatter information between vectors

Collective

Input Parameter:

  • sf - the scatter context

Level: intermediate

-seealso: , VecScatter, VecScatterCreate(), VecScatterCopy()

External Links

source
PETSc.LibPETSc.VecScatterViewMethod
VecScatterView(petsclib::PetscLibType,sf::VecScatter, viewer::PetscViewer)

Views a vector scatter context.

Collective

Input Parameters:

  • sf - the scatter context
  • viewer - the viewer for displaying the context

Level: intermediate

-seealso: , VecScatter, PetscViewer, VecScatterViewFromOptions(), PetscObjectViewFromOptions(), VecScatterCreate()

External Links

source
PETSc.LibPETSc.VecScatterViewFromOptionsMethod
VecScatterViewFromOptions(petsclib::PetscLibType,sf::VecScatter, obj::PetscObject, name::Vector{Cchar})

View a VecScatter object based on values in the options database

Collective

Input Parameters:

  • sf - the scatter context
  • obj - Optional object
  • name - command line option

Level: intermediate

-seealso: , VecScatter, VecScatterView(), PetscObjectViewFromOptions(), VecScatterCreate()

External Links

source
PETSc.LibPETSc.VecSetMethod
VecSet(petsclib::PetscLibType,x::PetscVec, alpha::PetscScalar)

Sets all components of a vector to a single scalar value.

Logically Collective

Input Parameters:

  • x - the vector
  • alpha - the scalar

Level: beginner

-seealso: , Vec, VecSetValues(), VecSetValuesBlocked(), VecSetRandom()

External Links

source
PETSc.LibPETSc.VecSetBindingPropagatesMethod
VecSetBindingPropagates(petsclib::PetscLibType,v::PetscVec, flg::PetscBool)

Sets whether the state of being bound to the CPU for a GPU vector type propagates to child and some other associated objects

Input Parameters:

  • v - the vector
  • flg - flag indicating whether the boundtocpu flag should be propagated

Level: developer

-seealso: , Vec, MatSetBindingPropagates(), VecGetBindingPropagates()

External Links

source
PETSc.LibPETSc.VecSetBlockSizeMethod
VecSetBlockSize(petsclib::PetscLibType,v::PetscVec, bs::PetscInt)

Sets the block size for future calls to VecSetValuesBlocked() and VecSetValuesBlockedLocal().

Logically Collective

Input Parameters:

  • v - the vector
  • bs - the blocksize

Level: advanced

-seealso: , Vec, VecSetValuesBlocked(), VecSetLocalToGlobalMapping(), VecGetBlockSize()

External Links

source
PETSc.LibPETSc.VecSetDMMethod
VecSetDM(petsclib::PetscLibType,v::PetscVec, dm::PetscDM)

Sets the DM defining the data layout of the vector.

Not Collective

Input Parameters:

  • v - The Vec
  • dm - The DM

Level: developer

Notes: This is rarely used, generally one uses DMGetLocalVector() or DMGetGlobalVector() to create a vector associated with a given DM

This is NOT the same as DMCreateGlobalVector() since it does not change the view methods or perform other customization, but merely sets the DM member.

See also:

DM, VecGetDM(), DMGetLocalVector(), DMGetGlobalVector(), DMSetVecType()

External Links

source
PETSc.LibPETSc.VecSetFromOptionsMethod
VecSetFromOptions(petsclib::PetscLibType,vec::PetscVec)

Configures the vector from the options database.

Collective

Input Parameter:

  • vec - The vector

Level: beginner

-seealso: , Vec, VecCreate(), VecSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.VecSetLayoutMethod
VecSetLayout(petsclib::PetscLibType,x::PetscVec, map::PetscLayout)

set PetscLayout describing vector layout

Not Collective

Input Parameters:

  • x - the vector
  • map - the layout

Level: developer

-seealso: , Vec, PetscLayout, VecGetLayout(), VecGetSize(), VecGetOwnershipRange(), VecGetOwnershipRanges()

External Links

source
PETSc.LibPETSc.VecSetLocalToGlobalMappingMethod
VecSetLocalToGlobalMapping(petsclib::PetscLibType,x::PetscVec, mapping::ISLocalToGlobalMapping)

Sets a local numbering to global numbering used by the routine VecSetValuesLocal() to allow users to insert vector entries using a local (per-processor) numbering.

Logically Collective

Input Parameters:

  • x - vector
  • mapping - mapping created with ISLocalToGlobalMappingCreate() or ISLocalToGlobalMappingCreateIS()

Level: intermediate

-seealso: , Vec, VecAssemblyBegin(), VecAssemblyEnd(), VecSetValues(), VecSetValuesLocal(), VecGetLocalToGlobalMapping(), VecSetValuesBlockedLocal()

External Links

source
PETSc.LibPETSc.VecSetOptionMethod
VecSetOption(petsclib::PetscLibType,x::PetscVec, op::VecOption, flag::PetscBool)

Sets an option for controlling a vector's behavior.

Collective

Input Parameters:

  • x - the vector
  • op - the option
  • flag - turn the option on or off

Supported Options:

  • VEC_IGNORE_OFF_PROC_ENTRIES - which causes VecSetValues() to ignore

entries destined to be stored on a separate processor. This can be used to eliminate the global reduction in the VecAssemblyBegin() if you know that you have only used VecSetValues() to set local elements

  • VEC_IGNORE_NEGATIVE_INDICES - which means you can pass negative indices

in ix in calls to VecSetValues() or VecGetValues(). These rows are simply ignored.

  • VEC_SUBSET_OFF_PROC_ENTRIES - which causes VecAssemblyBegin() to assume that the off-process

entries will always be a subset (possibly equal) of the off-process entries set on the first assembly which had a true VEC_SUBSET_OFF_PROC_ENTRIES and the vector has not changed this flag afterwards. If this assembly is not such first assembly, then this assembly can reuse the communication pattern setup in that first assembly, thus avoiding a global reduction. Subsequent assemblies setting off-process values should use the same InsertMode as the first assembly.

Level: intermediate

-seealso: , Vec, VecSetValues()

External Links

source
PETSc.LibPETSc.VecSetOptionsPrefixMethod
VecSetOptionsPrefix(petsclib::PetscLibType,v::PetscVec, prefix::Vector{Cchar})

Sets the prefix used for searching for all Vec options in the database.

Logically Collective

Input Parameters:

  • v - the Vec context
  • prefix - the prefix to prepend to all option names

Level: advanced

-seealso: , Vec, VecSetFromOptions()

External Links

source
PETSc.LibPETSc.VecSetPinnedMemoryMinMethod
VecSetPinnedMemoryMin(petsclib::PetscLibType,v::PetscVec, mbytes::Csize_t)

Set the minimum data size for which pinned memory will be used for host (CPU) allocations.

Logically Collective

Input Parameters:

  • v - the vector
  • mbytes - minimum data size in bytes

Options Database Key:

  • -vec_pinned_memory_min <size> - minimum size (in bytes) for an allocation to use pinned memory on host.

Level: developer

-seealso: , Vec, VecGetPinnedMemoryMin()

External Links

source
PETSc.LibPETSc.VecSetPreallocationCOOMethod
VecSetPreallocationCOO(petsclib::PetscLibType,x::PetscVec, ncoo::PetscCount, coo_i::Vector{PetscInt})

set preallocation for a vector using a coordinate format of the entries with global indices

Collective

Input Parameters:

  • x - vector being preallocated
  • ncoo - number of entries
  • coo_i - entry indices

Level: beginner

-seealso: , Vec, VecSetValuesCOO(), VecSetPreallocationCOOLocal()

External Links

source
PETSc.LibPETSc.VecSetPreallocationCOOLocalMethod
VecSetPreallocationCOOLocal(petsclib::PetscLibType,x::PetscVec, ncoo::PetscCount, coo_i::Vector{PetscInt})

set preallocation for vectors using a coordinate format of the entries with local indices

Collective

Input Parameters:

  • x - vector being preallocated
  • ncoo - number of entries
  • coo_i - row indices (local numbering; may be modified)

Level: beginner

-seealso: , Vec, VecSetPreallocationCOO(), VecSetValuesCOO()

External Links

source
PETSc.LibPETSc.VecSetRandomMethod
VecSetRandom(petsclib::PetscLibType,x::PetscVec, rctx::PetscRandom)

Sets all components of a vector to random numbers.

Logically Collective

Input Parameters:

  • x - the vector
  • rctx - the random number context, formed by PetscRandomCreate(), or use NULL and it will create one internally.

Output Parameter:

  • x - the vector

Example of Usage: -seealso: , Vec, VecSet(), VecSetValues(), PetscRandomCreate(), PetscRandomDestroy()

External Links

source
PETSc.LibPETSc.VecSetSizesMethod
VecSetSizes(petsclib::PetscLibType,v::PetscVec, n::PetscInt, N::PetscInt)

Sets the local and global sizes, and checks to determine compatibility of the sizes

Collective

Input Parameters:

  • v - the vector
  • n - the local size (or PETSC_DECIDE to have it set)
  • N - the global size (or PETSC_DETERMINE to have it set)

Level: intermediate

-seealso: , Vec, VecCreate(), VecCreateSeq(), VecCreateMPI(), VecGetSize(), PetscSplitOwnership(), PetscLayout, VecGetOwnershipRange(), VecGetOwnershipRanges(), MatSetSizes()

External Links

source
PETSc.LibPETSc.VecSetTypeMethod
VecSetType(petsclib::PetscLibType,vec::PetscVec, newType::VecType)

Builds a vector, for a particular vector implementation.

Collective

Input Parameters:

  • vec - The vector object
  • newType - The name of the vector type

Options Database Key:

  • -vec_type <type> - Sets the vector type; use -help for a list

of available types

Level: intermediate

-seealso: , Vec, VecType, VecGetType(), VecCreate(), VecDuplicate(), VecDuplicateVecs()

External Links

source
PETSc.LibPETSc.VecSetUpMethod
VecSetUp(petsclib::PetscLibType,v::PetscVec)

Sets up the internal vector data structures for the later use.

Collective

Input Parameter:

  • v - the Vec context

Level: advanced

-seealso: , Vec, VecCreate(), VecDestroy()

External Links

source
PETSc.LibPETSc.VecSetValuesMethod
VecSetValues(petsclib::PetscLibType,x::PetscVec, ni::PetscInt, ix::Vector{PetscInt}, y::Vector{PetscScalar}, iora::InsertMode)

Inserts or adds values into certain locations of a vector.

Not Collective

Input Parameters:

  • x - vector to insert in
  • ni - number of elements to add
  • ix - indices where to add
  • y - array of values. Pass NULL to set all zeroes.
  • iora - either INSERT_VALUES to replace the current values or ADD_VALUES to add values to any existing entries

Level: beginner

-seealso: , Vec, VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesLocal(), VecSetValue(), VecSetValuesBlocked(), InsertMode, INSERT_VALUES, ADD_VALUES, VecGetValues()

External Links

source
PETSc.LibPETSc.VecSetValuesBlockedMethod
VecSetValuesBlocked(petsclib::PetscLibType,x::PetscVec, ni::PetscInt, ix::Vector{PetscInt}, y::Vector{PetscScalar}, iora::InsertMode)

Inserts or adds blocks of values into certain locations of a vector.

Not Collective

Input Parameters:

  • x - vector to insert in
  • ni - number of blocks to add
  • ix - indices where to add in block count, rather than element count
  • y - array of values. Pass NULL to set all zeroes.
  • iora - either INSERT_VALUES replaces existing entries with new values, ADD_VALUES, adds values to any existing entries

Level: intermediate

-seealso: , Vec, VecAssemblyBegin(), VecAssemblyEnd(), VecSetValuesBlockedLocal(), VecSetValues()

External Links

source
PETSc.LibPETSc.VecSetValuesBlockedLocalMethod
VecSetValuesBlockedLocal(petsclib::PetscLibType,x::PetscVec, ni::PetscInt, ix::Vector{PetscInt}, y::Vector{PetscScalar}, iora::InsertMode)

Inserts or adds values into certain locations of a vector, using a local ordering of the nodes.

Not Collective

Input Parameters:

  • x - vector to insert in
  • ni - number of blocks to add
  • ix - indices where to add in block count, not element count
  • y - array of values. Pass NULL to set all zeroes.
  • iora - either INSERT_VALUES replaces existing entries with new values, ADD_VALUES adds values to any existing entries

Level: intermediate

-seealso: , Vec, VecAssemblyBegin(), VecAssemblyEnd(), VecSetValues(), VecSetValuesBlocked(), VecSetLocalToGlobalMapping()

External Links

source
PETSc.LibPETSc.VecSetValuesCOOMethod
VecSetValuesCOO(petsclib::PetscLibType,x::PetscVec, coo_v::Vector{PetscScalar}, imode::InsertMode)

set values at once in a vector preallocated using VecSetPreallocationCOO()

Collective

Input Parameters:

  • x - vector being set
  • coo_v - the value array
  • imode - the insert mode

Level: beginner

-seealso: , Vec, VecSetPreallocationCOO(), VecSetPreallocationCOOLocal(), VecSetValues()

External Links

source
PETSc.LibPETSc.VecSetValuesLocalMethod
VecSetValuesLocal(petsclib::PetscLibType,x::PetscVec, ni::PetscInt, ix::Vector{PetscInt}, y::Vector{PetscScalar}, iora::InsertMode)

Inserts or adds values into certain locations of a vector, using a local ordering of the nodes.

Not Collective

Input Parameters:

  • x - vector to insert in
  • ni - number of elements to add
  • ix - indices where to add
  • y - array of values. Pass NULL to set all zeroes.
  • iora - either INSERT_VALUES replaces existing entries with new values, ADD_VALUES adds values to any existing entries

Level: intermediate

-seealso: , Vec, VecAssemblyBegin(), VecAssemblyEnd(), VecSetValues(), VecSetLocalToGlobalMapping(), VecSetValuesBlockedLocal()

External Links

source
PETSc.LibPETSc.VecSetValuesSectionMethod
VecSetValuesSection(petsclib::PetscLibType,v::PetscVec, s::PetscSection, point::PetscInt, values::Vector{PetscScalar}, mode::InsertMode)

Sets all the values associated with a given point, according to the section, in the given Vec

Not Collective

Input Parameters:

  • v - the Vec
  • s - the organizing PetscSection
  • point - the point
  • values - the array of input values
  • mode - the insertion mode, either ADD_VALUES or INSERT_VALUES

Level: developer

-seealso: PetscSection, PetscSectionCreate(), VecGetValuesSection()

External Links

source
PETSc.LibPETSc.VecShiftMethod
VecShift(petsclib::PetscLibType,v::PetscVec, shift::PetscScalar)

Shifts all of the components of a vector by computing x[i] = x[i] + shift.

Logically Collective

Input Parameters:

  • v - the vector
  • shift - the shift

Level: intermediate

-seealso: Vec, VecISShift()

External Links

source
PETSc.LibPETSc.VecSqrtAbsMethod
VecSqrtAbs(petsclib::PetscLibType,v::PetscVec)

Replaces each component of a vector by the square root of its magnitude.

Not Collective

Input Parameter:

  • v - The vector

Level: beginner

-seealso: Vec, VecLog(), VecExp(), VecReciprocal(), VecAbs()

External Links

source
PETSc.LibPETSc.VecStashGetInfoMethod
nstash::PetscInt,reallocs::PetscInt,bnstash::PetscInt,breallocs::PetscInt = VecStashGetInfo(petsclib::PetscLibType,vec::PetscVec)

Gets how many values are currently in the vector stash, i.e. need to be communicated to other processors during the VecAssemblyBegin()/VecAssemblyEnd() process

Not Collective

Input Parameter:

  • vec - the vector

Output Parameters:

  • nstash - the size of the stash
  • reallocs - the number of additional mallocs incurred in building the stash
  • bnstash - the size of the block stash
  • breallocs - the number of additional mallocs incurred in building the block stash (from VecSetValuesBlocked())

Level: advanced

-seealso: , Vec, VecAssemblyBegin(), VecAssemblyEnd(), VecStashSetInitialSize(), VecStashView()

External Links

source
PETSc.LibPETSc.VecStashSetInitialSizeMethod
VecStashSetInitialSize(petsclib::PetscLibType,vec::PetscVec, size::PetscInt, bsize::PetscInt)

sets the sizes of the vec used during the assembly process to store values that belong to other processors.

Not Collective, different processes can have different size stashes

Input Parameters:

  • vec - the vector
  • size - the initial size of the stash.
  • bsize - the initial size of the block-stash(if used).

Options Database Keys:

  • -vecstash_initial_size <size> or <size0,size1,...sizep-1> - set initial size
  • -vecstash_block_initial_size <bsize> or <bsize0,bsize1,...bsizep-1> - set initial block size

Level: intermediate

-seealso: , Vec, VecSetBlockSize(), VecSetValues(), VecSetValuesBlocked(), VecStashView()

External Links

source
PETSc.LibPETSc.VecStashViewMethod
VecStashView(petsclib::PetscLibType,v::PetscVec, viewer::PetscViewer)

Prints the entries in the vector stash and block stash.

Collective

Input Parameters:

  • v - the vector
  • viewer - the viewer

Level: advanced

-seealso: , Vec, VecSetBlockSize(), VecSetValues(), VecSetValuesBlocked()

External Links

source
PETSc.LibPETSc.VecStashViewFromOptionsMethod
VecStashViewFromOptions(petsclib::PetscLibType,obj::PetscVec, bobj::PetscObject, optionname::Vector{Cchar})

Processes command line options to determine if/how a VecStash object is to be viewed.

Collective

Input Parameters:

  • obj - the Vec containing a stash
  • bobj - optional other object that provides the prefix
  • optionname - option to activate viewing

Level: intermediate

-seealso: , Vec, VecStashSetInitialSize()

External Links

source
PETSc.LibPETSc.VecStepBoundInfoMethod
boundmin::PetscReal,wolfemin::PetscReal,boundmax::PetscReal = VecStepBoundInfo(petsclib::PetscLibType,X::PetscVec, DX::PetscVec, XL::PetscVec, XU::PetscVec)

See below

Collective

Input Parameters:

  • X - vector with no negative entries
  • XL - lower bounds
  • XU - upper bounds
  • DX - step direction, can have negative, positive or zero entries

Output Parameters:

  • boundmin - (may be NULL this it is not computed) maximum value so that XL[i] <= X[i] + boundmax*DX[i] <= XU[i]
  • wolfemin - (may be NULL this it is not computed)
  • boundmax - (may be NULL this it is not computed) minimum value so that X[i] + boundmaxDX[i] <= XL[i] or XU[i] <= X[i] + boundmaxDX[i]

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecStepMaxMethod
step::PetscReal = VecStepMax(petsclib::PetscLibType,X::PetscVec, DX::PetscVec)

Returns the largest value so that x[i] + step*DX[i] >= 0 for all i

Collective

Input Parameters:

  • X - vector with no negative entries
  • DX - a step direction, can have negative, positive or zero entries

Output Parameter:

  • step - largest value such that x[i] + step*DX[i] >= 0 for all i

Level: advanced

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecStepMaxBoundedMethod
stepmax::PetscReal = VecStepMaxBounded(petsclib::PetscLibType,X::PetscVec, DX::PetscVec, XL::PetscVec, XU::PetscVec)

See below

Collective

Input Parameters:

  • X - vector with no negative entries
  • XL - lower bounds
  • XU - upper bounds
  • DX - step direction, can have negative, positive or zero entries

Output Parameter:

  • stepmax - minimum value so that X[i] + stepmaxDX[i] <= XL[i] or XU[i] <= X[i] + stepmaxDX[i]

Level: intermediate

-seealso: Vec

External Links

source
PETSc.LibPETSc.VecStrideGatherMethod
VecStrideGather(petsclib::PetscLibType,v::PetscVec, start::PetscInt, s::PetscVec, addv::InsertMode)

Gathers a single component from a multi another vector.

Collective

Input Parameters:

  • v - the vector
  • start - starting point of the subvector (defined by a stride)
  • addv - one of ADD_VALUES, INSERT_VALUES, MAX_VALUES

Output Parameter:

  • s - the location where the subvector is stored

Level: advanced

-seealso: Vec, VecStrideNorm(), VecStrideScatter(), VecStrideMin(), VecStrideMax(), VecStrideGatherAll(), VecStrideScatterAll()

External Links

source
PETSc.LibPETSc.VecStrideGatherAllMethod
VecStrideGatherAll(petsclib::PetscLibType,v::PetscVec, s::Vector{PetscVec}, addv::InsertMode)

Gathers all the single components from a multi separate vectors.

Collective

Input Parameters:

  • v - the vector
  • addv - one of ADD_VALUES, INSERT_VALUES, MAX_VALUES

Output Parameter:

  • s - the location where the subvectors are stored

Level: advanced

-seealso: Vec, VecStrideNorm(), VecStrideScatter(), VecStrideMin(), VecStrideMax(), VecStrideGather(), VecStrideScatterAll()

External Links

source
PETSc.LibPETSc.VecStrideMaxMethod
idex::PetscInt,nrm::PetscReal = VecStrideMax(petsclib::PetscLibType,v::PetscVec, start::PetscInt)

Computes the maximum of subvector of a vector defined by a starting point and a stride and optionally its location.

Collective

Input Parameters:

  • v - the vector
  • start - starting point of the subvector (defined by a stride)

Output Parameters:

  • idex - the location where the maximum occurred (pass NULL if not required)
  • nrm - the maximum value in the subvector

Level: advanced

-seealso: Vec, VecMax(), VecStrideNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMin()

External Links

source
PETSc.LibPETSc.VecStrideMaxAllMethod
idex::Vector{PetscInt},nrm::Vector{PetscReal} = VecStrideMaxAll(petsclib::PetscLibType,v::PetscVec)

Computes the maximums of subvectors of a vector defined by a starting point and a stride and optionally its location.

Collective

Input Parameter:

  • v - the vector

Output Parameters:

  • idex - the location where the maximum occurred (not supported, pass NULL,

if you need this, send mail to petsc-maint@mcs.anl.gov to request it)

  • nrm - the maximum values of each subvector

Level: advanced

-seealso: Vec, VecMax(), VecStrideNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMin()

External Links

source
PETSc.LibPETSc.VecStrideMinMethod
idex::PetscInt,nrm::PetscReal = VecStrideMin(petsclib::PetscLibType,v::PetscVec, start::PetscInt)

Computes the minimum of subvector of a vector defined by a starting point and a stride and optionally its location.

Collective

Input Parameters:

  • v - the vector
  • start - starting point of the subvector (defined by a stride)

Output Parameters:

  • idex - the location where the minimum occurred. (pass NULL if not required)
  • nrm - the minimum value in the subvector

Level: advanced

-seealso: Vec, VecMin(), VecStrideNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecStrideMinAllMethod
idex::Vector{PetscInt},nrm::Vector{PetscReal} = VecStrideMinAll(petsclib::PetscLibType,v::PetscVec)

Computes the minimum of subvector of a vector defined by a starting point and a stride and optionally its location.

Collective

Input Parameter:

  • v - the vector

Output Parameters:

  • idex - the location where the minimum occurred (not supported, pass NULL,

if you need this, send mail to petsc-maint@mcs.anl.gov to request it)

  • nrm - the minimums of each subvector

Level: advanced

-seealso: Vec, VecMin(), VecStrideNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecStrideNormMethod
nrm::PetscReal = VecStrideNorm(petsclib::PetscLibType,v::PetscVec, start::PetscInt, ntype::NormType)

Computes the norm of subvector of a vector defined by a starting point and a stride.

Collective

Input Parameters:

  • v - the vector
  • start - starting point of the subvector (defined by a stride)
  • ntype - type of norm, one of NORM_1, NORM_2, NORM_INFINITY

Output Parameter:

  • nrm - the norm

Level: advanced

-seealso: Vec, VecNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMin(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecStrideNormAllMethod
nrm::Vector{PetscReal} = VecStrideNormAll(petsclib::PetscLibType,v::PetscVec, ntype::NormType)

Computes the norms of subvectors of a vector defined by a starting point and a stride.

Collective

Input Parameters:

  • v - the vector
  • ntype - type of norm, one of NORM_1, NORM_2, NORM_INFINITY

Output Parameter:

  • nrm - the norms

Level: advanced

-seealso: Vec, VecNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMin(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecStrideScaleMethod
VecStrideScale(petsclib::PetscLibType,v::PetscVec, start::PetscInt, scale::PetscScalar)

Scales a subvector of a vector defined by a starting point and a stride.

Logically Collective

Input Parameters:

  • v - the vector
  • start - starting point of the subvector (defined by a stride)
  • scale - value to multiply each subvector entry by

Level: advanced

-seealso: Vec, VecNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMin(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecStrideScaleAllMethod
VecStrideScaleAll(petsclib::PetscLibType,v::PetscVec, scales::PetscScalar)

Scales the subvectors of a vector defined by a starting point and a stride.

Logically Collective

Input Parameters:

  • v - the vector
  • scales - values to multiply each subvector entry by

Level: advanced

-seealso: Vec, VecNorm(), VecStrideScale(), VecScale(), VecStrideGather(), VecStrideScatter(), VecStrideMin(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecStrideScatterMethod
VecStrideScatter(petsclib::PetscLibType,s::PetscVec, start::PetscInt, v::PetscVec, addv::InsertMode)

Scatters a single component from a vector into a multi

Collective

Input Parameters:

  • s - the single-component vector
  • start - starting point of the subvector (defined by a stride)
  • addv - one of ADD_VALUES, INSERT_VALUES, MAX_VALUES

Output Parameter:

  • v - the location where the subvector is scattered (the multi-component vector)

Level: advanced

-seealso: Vec, VecStrideNorm(), VecStrideGather(), VecStrideMin(), VecStrideMax(), VecStrideGatherAll(), VecStrideScatterAll(), VecStrideSubSetScatter(), VecStrideSubSetGather()

External Links

source
PETSc.LibPETSc.VecStrideScatterAllMethod
VecStrideScatterAll(petsclib::PetscLibType,s::Vector{PetscVec}, v::PetscVec, addv::InsertMode)

Scatters all the single components from separate vectors into a multi-component vector.

Collective

Input Parameters:

  • s - the location where the subvectors are stored
  • addv - one of ADD_VALUES, INSERT_VALUES, MAX_VALUES

Output Parameter:

  • v - the multicomponent vector

Level: advanced

-seealso: Vec, VecStrideNorm(), VecStrideScatter(), VecStrideMin(), VecStrideMax(), VecStrideGather(),

External Links

source
PETSc.LibPETSc.VecStrideSetMethod
VecStrideSet(petsclib::PetscLibType,v::PetscVec, start::PetscInt, s::PetscScalar)

Sets a subvector of a vector defined by a starting point and a stride with a given value

Logically Collective

Input Parameters:

  • v - the vector
  • start - starting point of the subvector (defined by a stride)
  • s - value to set for each entry in that subvector

Level: advanced

-seealso: Vec, VecNorm(), VecStrideGather(), VecStrideScatter(), VecStrideMin(), VecStrideMax(), VecStrideScale()

External Links

source
PETSc.LibPETSc.VecStrideSubSetGatherMethod
VecStrideSubSetGather(petsclib::PetscLibType,v::PetscVec, nidx::PetscInt, idxv::Vector{PetscInt}, idxs::Vector{PetscInt}, s::PetscVec, addv::InsertMode)

Gathers a subset of components from a multi another vector.

Collective

Input Parameters:

  • v - the vector
  • nidx - the number of indices
  • idxv - the indices of the components 0 <= idxv[0] ...idxv[nidx-1] < bs(v), they need not be sorted
  • idxs - the indices of the components 0 <= idxs[0] ...idxs[nidx-1] < bs(s), they need not be sorted, may be null if nidx == bs(s) or is PETSC_DETERMINE
  • addv - one of ADD_VALUES, INSERT_VALUES, MAX_VALUES

Output Parameter:

  • s - the location where the subvector is stored

Level: advanced

-seealso: Vec, VecStrideNorm(), VecStrideScatter(), VecStrideGather(), VecStrideSubSetScatter(), VecStrideMin(), VecStrideMax(), VecStrideGatherAll(), VecStrideScatterAll()

External Links

source
PETSc.LibPETSc.VecStrideSubSetScatterMethod
VecStrideSubSetScatter(petsclib::PetscLibType,s::PetscVec, nidx::PetscInt, idxs::Vector{PetscInt}, idxv::Vector{PetscInt}, v::PetscVec, addv::InsertMode)

Scatters components from a vector into a subset of components of a multi

Collective

Input Parameters:

  • s - the smaller-component vector
  • nidx - the number of indices in idx
  • idxs - the indices of the components in the smaller-component vector, 0 <= idxs[0] ...idxs[nidx-1] < bs(s) they need not be sorted, may be null if nidx == bs(s) or is PETSC_DETERMINE
  • idxv - the indices of the components in the larger-component vector, 0 <= idx[0] ...idx[nidx-1] < bs(v) they need not be sorted
  • addv - one of ADD_VALUES, INSERT_VALUES, MAX_VALUES

Output Parameter:

  • v - the location where the subvector is into scattered (the multi-component vector)

Level: advanced

-seealso: Vec, VecStrideNorm(), VecStrideGather(), VecStrideSubSetGather(), VecStrideMin(), VecStrideMax(), VecStrideGatherAll(), VecStrideScatterAll()

External Links

source
PETSc.LibPETSc.VecStrideSumMethod
sum::PetscScalar = VecStrideSum(petsclib::PetscLibType,v::PetscVec, start::PetscInt)

Computes the sum of subvector of a vector defined by a starting point and a stride.

Collective

Input Parameters:

  • v - the vector
  • start - starting point of the subvector (defined by a stride)

Output Parameter:

  • sum - the sum

Level: advanced

-seealso: Vec, VecSum(), VecStrideGather(), VecStrideScatter(), VecStrideMin(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecStrideSumAllMethod
sums::Vector{PetscScalar} = VecStrideSumAll(petsclib::PetscLibType,v::PetscVec)

Computes the sums of subvectors of a vector defined by a stride.

Collective

Input Parameter:

  • v - the vector

Output Parameter:

  • sums - the sums

Level: advanced

-seealso: Vec, VecSum(), VecStrideGather(), VecStrideScatter(), VecStrideMin(), VecStrideMax()

External Links

source
PETSc.LibPETSc.VecSumMethod
sum::PetscScalar = VecSum(petsclib::PetscLibType,v::PetscVec)

Computes the sum of all the components of a vector.

Collective

Input Parameter:

  • v - the vector

Output Parameter:

  • sum - the result

Level: beginner

-seealso: Vec, VecMean(), VecNorm()

External Links

source
PETSc.LibPETSc.VecSwapMethod
VecSwap(petsclib::PetscLibType,x::PetscVec, y::PetscVec)

Swaps the values between two vectors, x and y.

Logically Collective

Input Parameters:

  • x - the first vector
  • y - the second vector

Level: advanced

-seealso: , Vec, VecSet()

External Links

source
PETSc.LibPETSc.VecTaggerAbsoluteGetBoxMethod
VecTaggerAbsoluteGetBox(petsclib::PetscLibType,tagger::VecTagger, box::Vector{VecTaggerBox})

Get the box defining the values to be tagged by the tagger.

Logically Collective

Input Parameter:

  • tagger - the VecTagger context

Output Parameter:

  • box - the box: a blocksize array of VecTaggerBox boxes

Level: advanced

-seealso: VecTagger, VecTaggerBox, VecTaggerAbsoluteSetBox()

External Links

source
PETSc.LibPETSc.VecTaggerAbsoluteSetBoxMethod
VecTaggerAbsoluteSetBox(petsclib::PetscLibType,tagger::VecTagger, box::Vector{VecTaggerBox})

Set the box defining the values to be tagged by the tagger.

Logically Collective

Input Parameters:

  • tagger - the VecTagger context
  • box - the box: a blocksize array of VecTaggerBox boxes

Level: advanced

-seealso: VecTagger, VecTaggerBox, VecTaggerAbsoluteGetBox()

External Links

source
PETSc.LibPETSc.VecTaggerAndGetSubsMethod
nsubs::PetscInt = VecTaggerAndGetSubs(petsclib::PetscLibType,tagger::VecTagger, subs::Vector{VecTagger})

Get the sub VecTaggers whose intersection defines the outer VecTagger

Not Collective

Input Parameter:

  • tagger - the VecTagger context

Output Parameters:

  • nsubs - the number of sub VecTaggers
  • subs - the sub VecTaggers

Level: advanced

-seealso: VecTagger, VecTaggerAndSetSubs()

External Links

source
PETSc.LibPETSc.VecTaggerAndSetSubsMethod
VecTaggerAndSetSubs(petsclib::PetscLibType,tagger::VecTagger, nsubs::PetscInt, subs::Vector{VecTagger}, mode::PetscCopyMode)

Set the sub VecTaggers whose intersection defines the outer VecTagger

Logically Collective

Input Parameters:

  • tagger - the VecTagger context
  • nsubs - the number of sub VecTaggers
  • subs - the sub VecTaggers
  • mode - the copy mode to use for subs

Level: advanced

-seealso: VecTagger

External Links

source
PETSc.LibPETSc.VecTaggerCDFGetBoxMethod
VecTaggerCDFGetBox(petsclib::PetscLibType,tagger::VecTagger, box::Vector{VecTaggerBox})

Get the cumulative box (multi are subsets of [0,1], where 0 indicates the smallest value present in the vector and 1 indicates the largest.

Logically Collective

Input Parameter:

  • tagger - the VecTagger context

Output Parameter:

  • box - a blocksize array of VecTaggerBox boxes

Level: advanced

-seealso: VecTagger, VecTaggerCDFSetBox(), VecTaggerBox

External Links

source
PETSc.LibPETSc.VecTaggerCDFGetMethodMethod
VecTaggerCDFGetMethod(petsclib::PetscLibType,tagger::VecTagger, method::VecTaggerCDFMethod)

Get the method used to compute absolute boxes from CDF boxes

Logically Collective

Input Parameter:

  • tagger - the VecTagger context

Output Parameter:

  • method - the method

Level: advanced

-seealso: Vec, VecTagger, VecTaggerCDFMethod

External Links

source
PETSc.LibPETSc.VecTaggerCDFIterativeGetTolerancesMethod
maxit::PetscInt,rtol::PetscReal,atol::PetscReal = VecTaggerCDFIterativeGetTolerances(petsclib::PetscLibType,tagger::VecTagger)

Get the tolerances for iterative computation of absolute boxes from CDF boxes.

Logically Collective

Input Parameter:

  • tagger - the VecTagger context

Output Parameters:

  • maxit - the maximum number of iterations: 0 indicates the absolute values will be estimated from an initial guess based only on the minimum, maximum,

mean, and standard deviation of the box endpoints.

  • rtol - the acceptable relative tolerance in the absolute values from the initial guess
  • atol - the acceptable absolute tolerance in the absolute values from the initial guess

Level: advanced

-seealso: VecTagger, VecTaggerCDFSetMethod()

External Links

source
PETSc.LibPETSc.VecTaggerCDFIterativeSetTolerancesMethod
VecTaggerCDFIterativeSetTolerances(petsclib::PetscLibType,tagger::VecTagger, maxit::PetscInt, rtol::PetscReal, atol::PetscReal)

Set the tolerances for iterative computation of absolute boxes from CDF boxes.

Logically Collective

Input Parameters:

  • tagger - the VecTagger context
  • maxit - the maximum number of iterations: 0 indicates the absolute values will be estimated from an initial guess based only on the minimum, maximum, mean,

and standard deviation of the box endpoints.

  • rtol - the acceptable relative tolerance in the absolute values from the initial guess
  • atol - the acceptable absolute tolerance in the absolute values from the initial guess

Level: advanced

-seealso: VecTagger, VecTaggerCDFSetMethod()

External Links

source
PETSc.LibPETSc.VecTaggerCDFSetBoxMethod
VecTaggerCDFSetBox(petsclib::PetscLibType,tagger::VecTagger, box::Vector{VecTaggerBox})

Set the cumulative box defining the values to be tagged by the tagger, where cumulative boxes are subsets of [0,1], where 0 indicates the smallest value present in the vector and 1 indicates the largest.

Logically Collective

Input Parameters:

  • tagger - the VecTagger context
  • box - a blocksize array of VecTaggerBox boxes

Level: advanced

-seealso: VecTagger, VecTaggerCDFGetBox(), VecTaggerBox

External Links

source
PETSc.LibPETSc.VecTaggerCDFSetMethodMethod
VecTaggerCDFSetMethod(petsclib::PetscLibType,tagger::VecTagger, method::VecTaggerCDFMethod)

Set the method used to compute absolute boxes from CDF boxes

Logically Collective

Input Parameters:

  • tagger - the VecTagger context
  • method - the method

Level: advanced

-seealso: Vec, VecTagger, VecTaggerCDFMethod

External Links

source
PETSc.LibPETSc.VecTaggerComputeBoxesMethod
numBoxes::PetscInt,listed::PetscBool = VecTaggerComputeBoxes(petsclib::PetscLibType,tagger::VecTagger, vec::PetscVec, boxes::Vector{VecTaggerBox})

If the tagged index set can be summarized as a list of boxes of values, returns that list, otherwise returns in listed PETSC_FALSE

Collective

Input Parameters:

  • tagger - the VecTagger context
  • vec - the vec to tag

Output Parameters:

  • numBoxes - the number of boxes in the tag definition
  • boxes - a newly allocated list of boxes. This is a flat array of (BlockSize * numBoxes) pairs that the user can free with PetscFree().
  • listed - PETSC_TRUE if a list was created, pass in NULL if not needed

Level: advanced

-seealso: VecTaggerComputeIS(), VecTagger, VecTaggerCreate()

External Links

source
PETSc.LibPETSc.VecTaggerComputeISMethod
listed::PetscBool = VecTaggerComputeIS(petsclib::PetscLibType,tagger::VecTagger, vec::PetscVec, is::Vector{IS})

Use a VecTagger context to tag a set of indices based on a vector's values

Collective

Input Parameters:

  • tagger - the VecTagger context
  • vec - the vec to tag

Output Parameters:

  • is - a list of the indices tagged by the tagger, i.e., if the number of local indices will be n / bs, where n is VecGetLocalSize() and bs is VecTaggerGetBlockSize().
  • listed - routine was able to compute the IS, pass in NULL if not needed

Level: advanced

-seealso: VecTaggerComputeBoxes(), VecTagger, VecTaggerCreate()

External Links

source
PETSc.LibPETSc.VecTaggerCreateMethod
tagger::VecTagger = VecTaggerCreate(petsclib::PetscLibType,comm::MPI_Comm)

create a VecTagger context.

Collective

Input Parameter:

  • comm - communicator on which the VecTagger will operate

Output Parameter:

  • tagger - new Vec tagger context

Level: advanced

-seealso: VecTagger, VecTaggerSetBlockSize(), VecTaggerSetFromOptions(), VecTaggerSetUp(), VecTaggerComputeIS(), VecTaggerComputeBoxes(), VecTaggerDestroy()

External Links

source
PETSc.LibPETSc.VecTaggerDestroyMethod
VecTaggerDestroy(petsclib::PetscLibType,tagger::VecTagger)

destroy a VecTagger context

Collective

Input Parameter:

  • tagger - address of tagger

Level: advanced

-seealso: VecTaggerCreate(), VecTaggerSetType(), VecTagger

External Links

source
PETSc.LibPETSc.VecTaggerGetBlockSizeMethod
blocksize::PetscInt = VecTaggerGetBlockSize(petsclib::PetscLibType,tagger::VecTagger)

get the block size of the indices created by VecTaggerComputeIS().

Logically Collective

Input Parameter:

  • tagger - vec tagger

Output Parameter:

  • blocksize - block size of the vectors the tagger operates on

Level: advanced

-seealso: VecTaggerComputeIS(), VecTaggerSetBlockSize(), VecTagger, VecTaggerCreate()

External Links

source
PETSc.LibPETSc.VecTaggerGetInvertMethod
invert::PetscBool = VecTaggerGetInvert(petsclib::PetscLibType,tagger::VecTagger)

get whether the set of indices returned by VecTaggerComputeIS() are inverted

Logically Collective

Input Parameter:

  • tagger - vec tagger

Output Parameter:

  • invert - PETSC_TRUE to invert, PETSC_FALSE to use the indices as is

Level: advanced

-seealso: VecTaggerComputeIS(), VecTaggerSetInvert(), VecTagger, VecTaggerCreate()

External Links

source
PETSc.LibPETSc.VecTaggerGetTypeMethod
type::VecTaggerType = VecTaggerGetType(petsclib::PetscLibType,tagger::VecTagger)

Gets the VecTaggerType name (as a string) from the VecTagger.

Not Collective

Input Parameter:

  • tagger - The VecTagger context

Output Parameter:

  • type - The VecTagger type name

Level: advanced

-seealso: VecTaggerSetType(), VecTaggerCreate(), VecTaggerSetFromOptions(), VecTagger, VecTaggerType

External Links

source
PETSc.LibPETSc.VecTaggerOrGetSubsMethod
nsubs::PetscInt = VecTaggerOrGetSubs(petsclib::PetscLibType,tagger::VecTagger, subs::Vector{VecTagger})

Get the sub VecTaggers whose union defines the outer VecTagger

Not Collective

Input Parameter:

  • tagger - the VecTagger context

Output Parameters:

  • nsubs - the number of sub VecTaggers
  • subs - the sub VecTaggers

Level: advanced

-seealso: VecTaggerOrSetSubs()

External Links

source
PETSc.LibPETSc.VecTaggerOrSetSubsMethod
VecTaggerOrSetSubs(petsclib::PetscLibType,tagger::VecTagger, nsubs::PetscInt, subs::Vector{VecTagger}, mode::PetscCopyMode)

Set the sub VecTaggers whose union defines the outer VecTagger

Logically Collective

Input Parameters:

  • tagger - the VecTagger context
  • nsubs - the number of sub VecTaggers
  • subs - the sub VecTaggers
  • mode - the copy mode to use for subs

Level: advanced

-seealso: VecTaggetOrGetStubs()

External Links

source
PETSc.LibPETSc.VecTaggerRegisterMethod
VecTaggerRegister(petsclib::PetscLibType,sname::String, fnc::external)

Adds an implementation of the VecTagger communication protocol.

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of a new user-defined implementation
  • function - routine to create method context

Level: advanced

-seealso: VecTaggerType, VecTaggerCreate(), VecTagger, VecTaggerRegisterAll(), VecTaggerRegisterDestroy()

External Links

source
PETSc.LibPETSc.VecTaggerRelativeGetBoxMethod
VecTaggerRelativeGetBox(petsclib::PetscLibType,tagger::VecTagger, box::Vector{VecTaggerBox})

Get the relative box defining the values to be tagged by the tagger, where relative boxess are subsets of [0,1] (or [0,1]+[0,1]i for complex scalars), where 0 indicates the smallest value present in the vector and 1 indicates the largest.

Logically Collective

Input Parameter:

  • tagger - the VecTagger context

Output Parameter:

  • box - a blocksize list of VecTaggerBox boxes

Level: advanced

-seealso: VecTaggerRelativeSetBox()

External Links

source
PETSc.LibPETSc.VecTaggerRelativeSetBoxMethod
VecTaggerRelativeSetBox(petsclib::PetscLibType,tagger::VecTagger, box::Vector{VecTaggerBox})

Set the relative box defining the values to be tagged by the tagger, where relative boxes are subsets of [0,1] (or [0,1]+[0,1]i for complex scalars), where 0 indicates the smallest value present in the vector and 1 indicates the largest.

Logically Collective

Input Parameters:

  • tagger - the VecTagger context
  • box - a blocksize list of VecTaggerBox boxes

Level: advanced

-seealso: VecTaggerRelativeGetBox()

External Links

source
PETSc.LibPETSc.VecTaggerSetBlockSizeMethod
VecTaggerSetBlockSize(petsclib::PetscLibType,tagger::VecTagger, blocksize::PetscInt)

set the block size of the set of indices returned by VecTaggerComputeIS().

Logically Collective

Input Parameters:

  • tagger - vec tagger
  • blocksize - block size of the criteria used to tagger vectors

Level: advanced

-seealso: VecTaggerComputeIS(), VecTaggerGetBlockSize(), VecSetBlockSize(), VecGetBlockSize(), VecTagger, VecTaggerCreate()

External Links

source
PETSc.LibPETSc.VecTaggerSetFromOptionsMethod
VecTaggerSetFromOptions(petsclib::PetscLibType,tagger::VecTagger)

set VecTagger options using the options database

Logically Collective

Input Parameter:

  • tagger - vec tagger

Options Database Keys:

  • -vec_tagger_type - implementation type, see VecTaggerSetType()
  • -vec_tagger_block_size - set the block size, see VecTaggerSetBlockSize()
  • -vec_tagger_invert - invert the index set returned by VecTaggerComputeIS()

Level: advanced

-seealso: VecTagger, VecTaggerCreate(), VecTaggerSetUp()

External Links

source
PETSc.LibPETSc.VecTaggerSetInvertMethod
VecTaggerSetInvert(petsclib::PetscLibType,tagger::VecTagger, invert::PetscBool)

If the tagged index sets are based on boxes that can be returned by VecTaggerComputeBoxes(), then this option inverts values used to compute the IS, i.e., from being in the union of the boxes to being in the intersection of their exteriors.

Logically Collective

Input Parameters:

  • tagger - vec tagger
  • invert - PETSC_TRUE to invert, PETSC_FALSE to use the indices as is

Level: advanced

-seealso: VecTaggerComputeIS(), VecTaggerGetInvert(), VecTagger, VecTaggerCreate()

External Links

source
PETSc.LibPETSc.VecTaggerSetTypeMethod
VecTaggerSetType(petsclib::PetscLibType,tagger::VecTagger, type::VecTaggerType)

set the Vec tagger implementation

Collective

Input Parameters:

  • tagger - the VecTagger context
  • type - a known method

Options Database Key:

  • -vec_tagger_type <type> - Sets the method; use -help for a list

of available methods (for instance, absolute, relative, cdf, or, and)

Level: advanced

-seealso: VecTaggerType, VecTaggerCreate(), VecTagger

External Links

source
PETSc.LibPETSc.VecTaggerSetUpMethod
VecTaggerSetUp(petsclib::PetscLibType,tagger::VecTagger)

set up a VecTagger context

Collective

Input Parameter:

  • tagger - Vec tagger object

Level: advanced

-seealso: VecTaggerSetFromOptions(), VecTaggerSetType(), VecTagger, VecTaggerCreate()

External Links

source
PETSc.LibPETSc.VecTaggerViewMethod
VecTaggerView(petsclib::PetscLibType,tagger::VecTagger, viewer::PetscViewer)

view a VecTagger context

Collective

Input Parameters:

  • tagger - vec tagger
  • viewer - viewer to display tagger, for example PETSC_VIEWER_STDOUT_WORLD

Level: advanced

-seealso: VecTaggerCreate(), VecTagger

External Links

source