#include <DistributedVector.hpp>
Public Member Functions | |
DistributedVector (Vec vec) | |
double & | operator[] (unsigned globalIndex) throw (DistributedVectorException) |
void | Restore () |
double & | operator[] (Iterator index) throw (DistributedVectorException) |
Static Public Member Functions | |
static void | SetProblemSizePerProcessor (unsigned size, PetscInt local) |
static void | SetProblemSize (unsigned size) |
static void | SetProblemSize (Vec vec) |
static unsigned | GetProblemSize () |
static bool | IsGlobalIndexLocal (unsigned globalIndex) |
static Vec | CreateVec () |
static Vec | CreateVec (unsigned stride) |
static Iterator | Begin () |
static Iterator | End () |
Static Private Member Functions | |
static void | CheckForPetsc () |
Private Attributes | |
unsigned | mNumChunks |
Vec | mVec |
double * | mpVec |
Static Private Attributes | |
static unsigned | mLo = 0 |
static unsigned | mHi = 0 |
static unsigned | mGlobalHi = 0 |
static bool | mPetscStatusKnown = false |
Classes | |
class | Chunk |
class | Iterator |
class | Stripe |
It also provides two nested classes for accessing vectors with particular memory layouts: striped and chunked.
Definition at line 45 of file DistributedVector.hpp.
DistributedVector::DistributedVector | ( | Vec | vec | ) |
Constructor. This class represents the portion of a distributed PETSc vector on this process.
Note that this class does NOT take over responsibility for destroying the Vec.
vec | PETSc vector of which this class shall be a portion. |
Definition at line 117 of file DistributedVector.cpp.
References mGlobalHi, mNumChunks, and mpVec.
void DistributedVector::CheckForPetsc | ( | ) | [static, private] |
Double check (in debug code) that PETSc has been initialised properly
Definition at line 38 of file DistributedVector.cpp.
References mPetscStatusKnown.
Referenced by SetProblemSize(), and SetProblemSizePerProcessor().
void DistributedVector::SetProblemSizePerProcessor | ( | unsigned | size, | |
PetscInt | local | |||
) | [static] |
Set the problem size specifying distribution over local processor.
size | ||
local |
Definition at line 51 of file DistributedVector.cpp.
References CheckForPetsc(), mPetscStatusKnown, and SetProblemSize().
Referenced by AbstractCardiacPde< SPACE_DIM >::AbstractCardiacPde(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, MonodomainRhsMatrixAssembler< DIM > >::PrepareForSolve(), and SetProblemSize().
void DistributedVector::SetProblemSize | ( | unsigned | size | ) | [static] |
Set the problem size.
size |
Definition at line 67 of file DistributedVector.cpp.
References SetProblemSizePerProcessor().
Referenced by AbstractCardiacPde< SPACE_DIM >::AbstractCardiacPde(), AbstractLinearAssembler< DIM, DIM, 1, false, MonodomainRhsMatrixAssembler< DIM > >::InitialiseForSolve(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, MonodomainRhsMatrixAssembler< DIM > >::PrepareForSolve(), SetProblemSizePerProcessor(), and Hdf5ToMeshalyzerConverter::Write().
void DistributedVector::SetProblemSize | ( | Vec | vec | ) | [static] |
Set the problem with an existing PETSc vector -- must have stride=1.
vec |
Definition at line 72 of file DistributedVector.cpp.
References CheckForPetsc(), mGlobalHi, mHi, mLo, and mPetscStatusKnown.
unsigned DistributedVector::GetProblemSize | ( | ) | [static] |
Get the global problem size.
Definition at line 91 of file DistributedVector.cpp.
References mGlobalHi.
Referenced by Hdf5ToMeshalyzerConverter::Write().
bool DistributedVector::IsGlobalIndexLocal | ( | unsigned | globalIndex | ) | [static] |
Test if the given global index is owned by the current process, i.e. is local to it.
globalIndex |
Definition at line 96 of file DistributedVector.cpp.
Referenced by BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToNonlinearResidual().
Vec DistributedVector::CreateVec | ( | ) | [static] |
Create a PETSc vector of the problem size
Definition at line 101 of file DistributedVector.cpp.
References mGlobalHi, mHi, and mLo.
Referenced by BidomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::BidomainMatrixBasedAssembler(), BidomainRhsMatrixAssembler< DIM >::BidomainRhsMatrixAssembler(), BidomainWithBathRhsMatrixAssembler< DIM >::BidomainWithBathRhsMatrixAssembler(), MonodomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::ConstructVectorForMatrixBasedRhsAssembly(), AbstractCardiacProblem< SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem(), AbstractLinearAssembler< DIM, DIM, 1, false, MonodomainRhsMatrixAssembler< DIM > >::InitialiseForSolve(), MonodomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::MonodomainMatrixBasedAssembler(), MonodomainRhsMatrixAssembler< DIM >::MonodomainRhsMatrixAssembler(), and Hdf5ToMeshalyzerConverter::Write().
Vec DistributedVector::CreateVec | ( | unsigned | stride | ) | [static] |
Create a striped PETSc vector of size: stride * problem size
stride |
Definition at line 110 of file DistributedVector.cpp.
double & DistributedVector::operator[] | ( | unsigned | globalIndex | ) | throw (DistributedVectorException) |
globalIndex |
Definition at line 126 of file DistributedVector.cpp.
References mHi, mLo, mNumChunks, and mpVec.
void DistributedVector::Restore | ( | ) |
Store elements that have been written to back into the PETSc vector. Call after you have finished writing. It appears that you do not need to call this if you only read from the vector.
Definition at line 136 of file DistributedVector.cpp.
Referenced by BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToNonlinearResidual(), BidomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::ConstructVectorForMatrixBasedRhsAssembly(), BidomainProblem< DIM >::CreateInitialCondition(), AbstractCardiacProblem< SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem().
DistributedVector::Iterator DistributedVector::Begin | ( | ) | [static] |
Definition at line 155 of file DistributedVector.cpp.
References DistributedVector::Iterator::Global, DistributedVector::Iterator::Local, and mLo.
Referenced by AbstractCardiacPde< SPACE_DIM >::AbstractCardiacPde(), BidomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::ConstructVectorForMatrixBasedRhsAssembly(), BidomainProblem< DIM >::CreateInitialCondition(), AbstractCardiacProblem< SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem(), AbstractCardiacPde< SPACE_DIM >::GetCardiacCell(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, MonodomainRhsMatrixAssembler< DIM > >::PrepareForSolve(), AbstractCardiacPde< SPACE_DIM >::ReplicateCaches(), and AbstractCardiacPde< SPACE_DIM >::SolveCellSystems().
DistributedVector::Iterator DistributedVector::End | ( | ) | [static] |
Definition at line 163 of file DistributedVector.cpp.
References DistributedVector::Iterator::Global, DistributedVector::Iterator::Local, mHi, and mLo.
Referenced by AbstractCardiacPde< SPACE_DIM >::AbstractCardiacPde(), BidomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::ConstructVectorForMatrixBasedRhsAssembly(), BidomainProblem< DIM >::CreateInitialCondition(), AbstractCardiacProblem< SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem(), AbstractCardiacPde< SPACE_DIM >::GetCardiacCell(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, MonodomainRhsMatrixAssembler< DIM > >::PrepareForSolve(), AbstractCardiacPde< SPACE_DIM >::ReplicateCaches(), and AbstractCardiacPde< SPACE_DIM >::SolveCellSystems().
double & DistributedVector::operator[] | ( | Iterator | index | ) | throw (DistributedVectorException) |
index |
Definition at line 171 of file DistributedVector.cpp.
References mNumChunks, and mpVec.
unsigned DistributedVector::mLo = 0 [static, private] |
The first entry owned by the current processor.
Definition at line 50 of file DistributedVector.hpp.
Referenced by Begin(), DistributedVector::Chunk::Chunk(), CreateVec(), End(), IsGlobalIndexLocal(), DistributedVector::Chunk::operator[](), DistributedVector::Stripe::operator[](), operator[](), and SetProblemSize().
unsigned DistributedVector::mHi = 0 [static, private] |
One above the last entry owned by the current processor.
Definition at line 52 of file DistributedVector.hpp.
Referenced by DistributedVector::Chunk::Chunk(), CreateVec(), End(), IsGlobalIndexLocal(), DistributedVector::Chunk::operator[](), DistributedVector::Stripe::operator[](), operator[](), and SetProblemSize().
unsigned DistributedVector::mGlobalHi = 0 [static, private] |
The problem size, i.e. the length of the vector of unknowns.
Definition at line 54 of file DistributedVector.hpp.
Referenced by CreateVec(), DistributedVector(), GetProblemSize(), and SetProblemSize().
bool DistributedVector::mPetscStatusKnown = false [static, private] |
Whether we've checked that PETSc is initialised.
Definition at line 56 of file DistributedVector.hpp.
Referenced by CheckForPetsc(), SetProblemSize(), and SetProblemSizePerProcessor().
unsigned DistributedVector::mNumChunks [private] |
How many processors own parts of this vector.
Definition at line 60 of file DistributedVector.hpp.
Referenced by DistributedVector::Chunk::Chunk(), DistributedVector(), operator[](), and DistributedVector::Stripe::Stripe().
Vec DistributedVector::mVec [private] |
The underlying PETSc vector.
Definition at line 62 of file DistributedVector.hpp.
Referenced by Restore().
double* DistributedVector::mpVec [private] |
The local part of the underlying PETSc vector.
Definition at line 64 of file DistributedVector.hpp.
Referenced by DistributedVector::Chunk::Chunk(), DistributedVector(), operator[](), Restore(), and DistributedVector::Stripe::Stripe().