Chaste  Release::2018.1
PetscVecTools Class Reference

#include <PetscVecTools.hpp>

+ Collaboration diagram for PetscVecTools:

Static Public Member Functions

static void Finalise (Vec vector)
 
static void Display (Vec vector)
 
static void Zero (Vec vector)
 
static void SetElement (Vec vector, PetscInt row, double value)
 
static void AddToElement (Vec vector, PetscInt row, double value)
 
static unsigned GetSize (Vec vector)
 
static void GetOwnershipRange (Vec vector, PetscInt &lo, PetscInt &hi)
 
static double GetElement (Vec vector, PetscInt row)
 
static void AddScaledVector (Vec y, Vec x, double scaleFactor)
 
static void Scale (Vec vector, double scaleFactor)
 
static void WAXPY (Vec w, double a, Vec x, Vec y)
 
template<size_t VECTOR_SIZE>
static void AddMultipleValues (Vec vector, unsigned *vectorIndices, c_vector< double, VECTOR_SIZE > &smallVector)
 
static void SetupInterleavedVectorScatterGather (Vec interleavedVec, VecScatter &rFirstVariableScatterContext, VecScatter &rSecondVariableScatterContext)
 
static void DoInterleavedVecScatter (Vec interleavedVec, VecScatter firstVariableScatterContext, Vec firstVariableVec, VecScatter secondVariableScatterContext, Vec secondVariableVec)
 
static void DoInterleavedVecGather (Vec interleavedVec, VecScatter firstVariableScatterContext, Vec firstVariableVec, VecScatter secondVariableScatterContext, Vec secondVariableVec)
 

Detailed Description

A collection of static methods for working with PETSc vectors.

Definition at line 46 of file PetscVecTools.hpp.

Member Function Documentation

template<size_t VECTOR_SIZE>
static void PetscVecTools::AddMultipleValues ( Vec  vector,
unsigned vectorIndices,
c_vector< double, VECTOR_SIZE > &  smallVector 
)
inlinestatic

Add multiple values to a vector.

Parameters
vectorthe vector to modify
vectorIndicesmapping from index of the ublas vector (see param below) to index of the vector of this linear system
smallVectorUblas vector containing the values to be added

N.B. Values which are not local (ie the row is not owned) will be skipped.

Definition at line 151 of file PetscVecTools.hpp.

References GetOwnershipRange().

Referenced by LinearSystem::AddRhsMultipleValues().

void PetscVecTools::AddScaledVector ( Vec  y,
Vec  x,
double  scaleFactor 
)
static

Computes y += ax, using the PETSc method VecAXPY (with appropriate arguments for the PETSc version).

Parameters
ythe vector which is added to
xthe vector which is scaled and added to y
scaleFactorthe value 'a' above, the factor x is multiplied by.

Definition at line 127 of file PetscVecTools.cpp.

Referenced by AbstractContinuumMechanicsSolver< DIM >::ApplyDirichletBoundaryConditions(), BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), SimpleNewtonNonlinearSolver::Solve(), and OdeLinearSystemSolver::SolveOneTimeStep().

void PetscVecTools::AddToElement ( Vec  vector,
PetscInt  row,
double  value 
)
static

Add a value to an element of a vector.

Parameters
vectorthe vector to modify
rowthe row index
valuethe value to set this entry

Definition at line 65 of file PetscVecTools.cpp.

References GetOwnershipRange().

Referenced by LinearSystem::AddToRhsVectorElement(), and AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically().

void PetscVecTools::Display ( Vec  vector)
static

Display the given vector.

Parameters
vectorthe vector to display

Definition at line 76 of file PetscVecTools.cpp.

Referenced by LinearSystem::DisplayRhs().

void PetscVecTools::DoInterleavedVecGather ( Vec  interleavedVec,
VecScatter  firstVariableScatterContext,
Vec  firstVariableVec,
VecScatter  secondVariableScatterContext,
Vec  secondVariableVec 
)
static

Performs scatter operation from a bidomain-like vector of interleaved values into two separate PETSc Vec.

Parameters
interleavedVecDestination vector for interleaved values.
firstVariableScatterContextContext for scattering/gathering first variable
firstVariableVecSource vector with first variable
secondVariableScatterContextContext for scattering/gathering second variable
secondVariableVecSource vector with second variable

Definition at line 254 of file PetscVecTools.cpp.

void PetscVecTools::DoInterleavedVecScatter ( Vec  interleavedVec,
VecScatter  firstVariableScatterContext,
Vec  firstVariableVec,
VecScatter  secondVariableScatterContext,
Vec  secondVariableVec 
)
static

Performs scatter operation from a bidomain-like vector of interleaved values into two separate PETSc Vec.

Parameters
interleavedVecSource vector with interleaved values. (The source vector is treated as read-only.)
firstVariableScatterContextContext for scattering/gathering first variable
firstVariableVecDestination vector for first variable
secondVariableScatterContextContext for scattering/gathering second variable
secondVariableVecDestination vector for second variable

Definition at line 184 of file PetscVecTools.cpp.

void PetscVecTools::Finalise ( Vec  vector)
static
double PetscVecTools::GetElement ( Vec  vector,
PetscInt  row 
)
static
Returns
an element of a vector. May only be called for elements you own.
Parameters
vectorthe vector
rowthe row index

Definition at line 112 of file PetscVecTools.cpp.

References GetOwnershipRange().

Referenced by LinearSystem::GetRhsVectorElement(), and MonodomainPurkinjeSolver< ELEMENT_DIM, SPACE_DIM >::SetIdentityBlockToLhsMatrix().

void PetscVecTools::GetOwnershipRange ( Vec  vector,
PetscInt lo,
PetscInt hi 
)
static
Returns
this process's ownership range of the contents of the vector.
Parameters
vectorthe vector
lolowest index owned by this process
hihighest index owned by this process

Definition at line 107 of file PetscVecTools.cpp.

Referenced by AddMultipleValues(), AddToElement(), GetElement(), and SetElement().

void PetscVecTools::Scale ( Vec  vector,
double  scaleFactor 
)
static

Scale the given vector. Calls VecScale (using the appropriate arguments for the PETSc version).

Parameters
vectorthe vector
scaleFactorthe scale factor

Definition at line 136 of file PetscVecTools.cpp.

Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically().

void PetscVecTools::SetupInterleavedVectorScatterGather ( Vec  interleavedVec,
VecScatter &  rFirstVariableScatterContext,
VecScatter &  rSecondVariableScatterContext 
)
static

Set up scatter/gather PETSc context for splitting a bidomain-like vector with interleaved values for two variables into two separate PETSc Vec containing each of them.

Parameters
interleavedVecSource vector with interleaved values.
rFirstVariableScatterContextContext for scattering/gathering first variable
rSecondVariableScatterContextContext for scattering/gathering second variable

Definition at line 154 of file PetscVecTools.cpp.

References PetscTools::CreateVec(), PetscTools::Destroy(), and PETSC_DESTROY_PARAM.

Referenced by PCBlockDiagonal::PCBlockDiagonalCreate(), and PCLDUFactorisation::PCLDUFactorisationCreate().

void PetscVecTools::WAXPY ( Vec  w,
double  a,
Vec  x,
Vec  y 
)
static

Calls the PETSc function VecWAXPY (using the appropriate arguments for the PETSc version), which does w = ax+y, where x,y,w are distinct vectors and a is scalar.

Parameters
wthe result vector
athe scale factor
xthe scale vector
ythe other vector

Definition at line 145 of file PetscVecTools.cpp.

Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically(), and SimpleNewtonNonlinearSolver::Solve().


The documentation for this class was generated from the following files: