DistributedVector Class Reference

#include <DistributedVector.hpp>

Collaboration diagram for DistributedVector:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

Gives access to the local portion of a PETSc vector via an iterator.

It also provides two nested classes for accessing vectors with particular memory layouts: striped and chunked.

Definition at line 45 of file DistributedVector.hpp.


Constructor & Destructor Documentation

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.

Parameters:
vec PETSc vector of which this class shall be a portion.

Definition at line 117 of file DistributedVector.cpp.

References mGlobalHi, mNumChunks, and mpVec.


Member Function Documentation

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]

void DistributedVector::SetProblemSize ( unsigned  size  )  [static]

void DistributedVector::SetProblemSize ( Vec  vec  )  [static]

Set the problem with an existing PETSc vector -- must have stride=1.

Parameters:
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.

Parameters:
globalIndex 

Definition at line 96 of file DistributedVector.cpp.

References mHi, and mLo.

Referenced by BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToNonlinearResidual().

Vec DistributedVector::CreateVec (  )  [static]

Vec DistributedVector::CreateVec ( unsigned  stride  )  [static]

Create a striped PETSc vector of size: stride * problem size

Parameters:
stride 

Definition at line 110 of file DistributedVector.cpp.

References mGlobalHi, mHi, and mLo.

double & DistributedVector::operator[] ( unsigned  globalIndex  )  throw (DistributedVectorException)

Parameters:
globalIndex 
Returns:
value of distributed vector at globalIndex Do not use if stride>1. For use in tests. Will throw a DistributedVectorException if the specified element is not on this process.

Definition at line 126 of file DistributedVector.cpp.

References mHi, mLo, mNumChunks, and mpVec.

void DistributedVector::Restore (  ) 

DistributedVector::Iterator DistributedVector::Begin (  )  [static]

DistributedVector::Iterator DistributedVector::End (  )  [static]

double & DistributedVector::operator[] ( Iterator  index  )  throw (DistributedVectorException)

Parameters:
index 
Returns:
value of distributed vector pointed to by index. Do not use if stride>1.

Definition at line 171 of file DistributedVector.cpp.

References mNumChunks, and mpVec.


Member Data Documentation

unsigned DistributedVector::mLo = 0 [static, private]

unsigned DistributedVector::mHi = 0 [static, private]

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().


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

Generated on Wed Mar 18 12:52:29 2009 for Chaste by  doxygen 1.5.5