#include <PetscVecTools.hpp>
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) |
A collection of static methods for working with PETSc vectors.
Definition at line 39 of file PetscVecTools.hpp.
static void PetscVecTools::AddMultipleValues | ( | Vec | vector, | |
unsigned * | vectorIndices, | |||
c_vector< double, VECTOR_SIZE > & | smallVector | |||
) | [inline, static] |
Add multiple values to a vector.
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 144 of file PetscVecTools.hpp.
References GetOwnershipRange().
Referenced by LinearSystem::AddRhsMultipleValues().
Computes y += ax, using the PETSc method VecAXPY (with appropriate arguments for the PETSc version).
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 >::ApplyDirichletBoundaryConditions(), BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), SimpleNewtonNonlinearSolver::Solve(), and OdeLinearSystemSolver::SolveOneTimeStep().
Add a value to an element of a vector.
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().
void PetscVecTools::Display | ( | Vec | vector | ) | [static] |
Display the given vector.
vector | the vector to display |
Definition at line 69 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.
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 229 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.
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 168 of file PetscVecTools.cpp.
void PetscVecTools::Finalise | ( | Vec | vector | ) | [static] |
Do parallel communication required to get the vector in a good state for further operations. This is a wrapper to PETSc functions like VecAssemblyBegin.
vector | the vector to assemble |
Definition at line 41 of file PetscVecTools.cpp.
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeResidual(), LinearSystem::FinaliseRhsVector(), and AbstractNonlinearElasticitySolver< DIM >::FinishAssembleSystem().
Return an element of a vector. May only be called for elements you own.
vector | the vector | |
row | the row index |
Definition at line 96 of file PetscVecTools.cpp.
References GetOwnershipRange().
Referenced by LinearSystem::GetRhsVectorElement().
void PetscVecTools::GetOwnershipRange | ( | Vec | vector, | |
PetscInt & | lo, | |||
PetscInt & | hi | |||
) | [static] |
Get this process's ownership range of the contents of the vector.
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().
Get the size of a vector.
vector | the vector |
Definition at line 84 of file PetscVecTools.cpp.
Referenced by AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::DoAssemble().
Scale the given vector. Calls VecScale (using the appropriate arguments for the PETSc version).
vector | the vector | |
scaleFactor | the scale factor |
Definition at line 120 of file PetscVecTools.cpp.
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically().
Set an element of a vector to a given value.
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 >::ApplyDirichletBoundaryConditions(), BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseForBath(), LinearSystem::SetRhsVectorElement(), and NodeBasedCellPopulationWithBuskeUpdate< DIM >::UpdateNodeLocations().
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.
interleavedVec | Source vector with interleaved values. | |
rFirstVariableScatterContext | Context for scattering/gathering first variable | |
rSecondVariableScatterContext | Context for scattering/gathering second variable |
Definition at line 138 of file PetscVecTools.cpp.
References PetscTools::CreateVec().
Referenced by PCBlockDiagonal::PCBlockDiagonalCreate(), and PCLDUFactorisation::PCLDUFactorisationCreate().
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.
w | the result vector | |
a | the scale factor | |
x | the scale vector | |
y | the other vector |
Definition at line 129 of file PetscVecTools.cpp.
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically(), and SimpleNewtonNonlinearSolver::Solve().
void PetscVecTools::Zero | ( | Vec | vector | ) | [static] |
Zero all entries of a given vector.
vector | the vector to be zero |
Definition at line 74 of file PetscVecTools.cpp.
Referenced by AbstractNonlinearElasticitySolver< DIM >::ApplyDirichletBoundaryConditions(), BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), IncompressibleNonlinearElasticitySolver< DIM >::AssembleSystem(), CompressibleNonlinearElasticitySolver< DIM >::AssembleSystem(), AbstractFeVolumeIntegralAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL >::DoAssemble(), AbstractFeCableIntegralAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX, INTERPOLATION_LEVEL >::DoAssemble(), AbstractContinuumMechanicsAssembler< DIM, CAN_ASSEMBLE_VECTOR, CAN_ASSEMBLE_MATRIX >::DoAssemble(), LinearSystem::Solve(), and LinearSystem::ZeroRhsVector().