ReplicatableVector Class Reference

#include <ReplicatableVector.hpp>

Collaboration diagram for ReplicatableVector:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ReplicatableVector ()
 ReplicatableVector (Vec vec)
 ReplicatableVector (unsigned size)
 ~ReplicatableVector ()
unsigned GetSize ()
void Resize (unsigned size)
doubleoperator[] (unsigned index)
void Replicate (unsigned lo, unsigned hi)
void ReplicatePetscVector (Vec vec)

Private Member Functions

void RemovePetscContext ()

Private Attributes

doublempData
unsigned mSize
VecScatter mToAll
Vec mReplicated

Detailed Description

Helper class for replicating a PETSc vector.

Definition at line 39 of file ReplicatableVector.hpp.


Constructor & Destructor Documentation

ReplicatableVector::ReplicatableVector (  ) 

Default constructor. Note that the vector will need to be resized before it can be used.

Definition at line 61 of file ReplicatableVector.cpp.

ReplicatableVector::ReplicatableVector ( Vec  vec  ) 

Constructor taking in Petsc vector, which is immediately replicated into the internal data

Parameters:
vec a Petsc vector

Definition at line 69 of file ReplicatableVector.cpp.

References ReplicatePetscVector().

ReplicatableVector::ReplicatableVector ( unsigned  size  ) 

Constructor to make a vector of given size.

Parameters:
size the size of the vector

Definition at line 78 of file ReplicatableVector.cpp.

References Resize().

ReplicatableVector::~ReplicatableVector (  ) 

Default destructor. Remove PETSc context.

Definition at line 87 of file ReplicatableVector.cpp.

References RemovePetscContext().


Member Function Documentation

unsigned ReplicatableVector::GetSize (  ) 
double & ReplicatableVector::operator[] ( unsigned  index  ) 

Access the vector.

Parameters:
index the index of the vector to return

Definition at line 122 of file ReplicatableVector.cpp.

References mpData, and mSize.

void ReplicatableVector::RemovePetscContext (  )  [private]

Clear data. Used in resize method and destructor.

Definition at line 38 of file ReplicatableVector.cpp.

References mpData, mReplicated, and mToAll.

Referenced by Resize(), and ~ReplicatableVector().

void ReplicatableVector::Replicate ( unsigned  lo,
unsigned  hi 
)

Replicate this vector over all processes.

Each process knows its local part of the vector. This method shares that knowledge across all the processes.

Parameters:
lo The start of our ownership range
hi One past the end of our ownership range

Definition at line 131 of file ReplicatableVector.cpp.

References GetSize(), mpData, and ReplicatePetscVector().

Referenced by AbstractCardiacPde< ELEMENT_DIM, SPACE_DIM >::ReplicateCaches().

void ReplicatableVector::ReplicatePetscVector ( Vec  vec  ) 

Replicate the given PETSc vector over all processes.

Each process knows its local part of the vector. This method shares that knowledge across all the processes, storing it in this object.

Our data vector will automatically be resized to fit the whole PETSc vector.

Parameters:
vec The PETSc vector to replicate.

Definition at line 144 of file ReplicatableVector.cpp.

References GetSize(), mpData, mReplicated, mToAll, and Resize().

Referenced by AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), AbstractFunctionalCalculator< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Calculate(), ReplicatableVector(), and Replicate().

void ReplicatableVector::Resize ( unsigned  size  ) 

Resize the vector.

Parameters:
size The number of elements to allocate memory for.

Definition at line 100 of file ReplicatableVector.cpp.

References mpData, mSize, RemovePetscContext(), and PetscTools::ReplicateException().

Referenced by AbstractCardiacPde< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacPde(), BidomainPde< SPACE_DIM >::BidomainPde(), ReplicatableVector(), and ReplicatePetscVector().


Member Data Documentation

The wrapped PeTSc vector.

Definition at line 43 of file ReplicatableVector.hpp.

Referenced by operator[](), RemovePetscContext(), Replicate(), ReplicatePetscVector(), and Resize().

Vector to hold concentrated copy of replicated vector.

Definition at line 46 of file ReplicatableVector.hpp.

Referenced by RemovePetscContext(), and ReplicatePetscVector().

The length of the vector.

Definition at line 44 of file ReplicatableVector.hpp.

Referenced by GetSize(), operator[](), and Resize().

VecScatter ReplicatableVector::mToAll [private]

Variable holding information for replicating a PETSc vector.

Definition at line 45 of file ReplicatableVector.hpp.

Referenced by RemovePetscContext(), and ReplicatePetscVector().


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

Generated by  doxygen 1.6.2