PetscVecTools Class Reference

#include <PetscVecTools.hpp>

List of all members.

Static Public Member Functions

static void Assemble (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 40 of file PetscVecTools.hpp.


Member Function Documentation

void PetscVecTools::Assemble ( Vec  vector  )  [static]

Do parallel communication required to get the vector in a good state for further operations.

Parameters:
vector the vector to assemble

Definition at line 41 of file PetscVecTools.cpp.

Referenced by LinearSystem::AssembleRhsVector(), AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeResidual(), and AbstractNonlinearElasticitySolver< DIM >::FinishAssembleSystem().

void PetscVecTools::Display ( Vec  vector  )  [static]

Display the given vector.

Parameters:
vector the vector to display

Definition at line 69 of file PetscVecTools.cpp.

Referenced by LinearSystem::DisplayRhs().

void PetscVecTools::Zero ( Vec  vector  )  [static]

void PetscVecTools::SetElement ( Vec  vector,
PetscInt  row,
double  value 
) [static]

Set an element of a vector to a given value.

Parameters:
vector the vector to modify
row the row index
value the value to set this entry

Definition at line 47 of file PetscVecTools.cpp.

References GetOwnershipRange().

Referenced by AbstractNonlinearElasticitySolver< DIM >::ApplyBoundaryConditions(), BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseForBath(), and LinearSystem::SetRhsVectorElement().

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

Add a value to an element of a vector.

Parameters:
vector the vector to modify
row the row index
value the value to set this entry

Definition at line 58 of file PetscVecTools.cpp.

References GetOwnershipRange().

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

unsigned PetscVecTools::GetSize ( Vec  vector  )  [static]

Get the size of a vector.

Parameters:
vector the vector

Definition at line 84 of file PetscVecTools.cpp.

void PetscVecTools::GetOwnershipRange ( Vec  vector,
PetscInt &  lo,
PetscInt &  hi 
) [static]

Get this process's ownership range of the contents of the vector.

Parameters:
vector the vector
lo lowest index owned by this process
hi highest index owned by this process

Definition at line 91 of file PetscVecTools.cpp.

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

double PetscVecTools::GetElement ( Vec  vector,
PetscInt  row 
) [static]

Return an element of a vector. May only be called for elements you own.

Parameters:
vector the vector
row the row index

Definition at line 96 of file PetscVecTools.cpp.

References GetOwnershipRange().

Referenced by LinearSystem::GetRhsVectorElement().

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:
y the vector which is added to
x the vector which is scaled and added to y
scaleFactor the value 'a' above, the factor x is multiplied by.

Definition at line 111 of file PetscVecTools.cpp.

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

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

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

Parameters:
vector the vector
scaleFactor the scale factor

Definition at line 123 of file PetscVecTools.cpp.

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

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:
w the result vector
a the scale factor
x the scale vector
y the other vector

Definition at line 132 of file PetscVecTools.cpp.

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

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

Add multiple values to a vector.

Parameters:
vector the vector to modify
vectorIndices mapping from index of the ublas vector (see param below) to index of the vector of this linear system
smallVector Ublas 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 142 of file PetscVecTools.hpp.

References GetOwnershipRange().

Referenced by LinearSystem::AddRhsMultipleValues().

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:
interleavedVec Source vector with interleaved values.
rFirstVariableScatterContext Context for scattering/gathering first variable
rSecondVariableScatterContext Context for scattering/gathering second variable

Definition at line 142 of file PetscVecTools.cpp.

References PetscTools::CreateVec().

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

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:
interleavedVec Source vector with interleaved values.
firstVariableScatterContext Context for scattering/gathering first variable
firstVariableVec Destination vector for first variable
secondVariableScatterContext Context for scattering/gathering second variable
secondVariableVec Destination vector for second variable

Definition at line 172 of file PetscVecTools.cpp.

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:
interleavedVec Destination vector for interleaved values.
firstVariableScatterContext Context for scattering/gathering first variable
firstVariableVec Source vector with first variable
secondVariableScatterContext Context for scattering/gathering second variable
secondVariableVec Source vector with second variable

Definition at line 234 of file PetscVecTools.cpp.


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

Generated on Tue May 31 14:34:04 2011 for Chaste by  doxygen 1.5.5