Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
|
#include <ReplicatableVector.hpp>
Public Member Functions | |
ReplicatableVector () | |
ReplicatableVector (Vec vec) | |
ReplicatableVector (unsigned size) | |
~ReplicatableVector () | |
unsigned | GetSize () |
void | Resize (unsigned size) |
double & | operator[] (unsigned index) |
void | Replicate (unsigned lo, unsigned hi) |
void | ReplicatePetscVector (Vec vec) |
Private Member Functions | |
void | RemovePetscContext () |
Private Attributes | |
double * | mpData |
unsigned | mSize |
VecScatter | mToAll |
Vec | mReplicated |
Helper class for replicating a PETSc vector.
Definition at line 45 of file ReplicatableVector.hpp.
ReplicatableVector::ReplicatableVector | ( | ) |
Default constructor. Note that the vector will need to be resized before it can be used.
Definition at line 68 of file ReplicatableVector.cpp.
ReplicatableVector::ReplicatableVector | ( | Vec | vec | ) |
Constructor taking in PETSc vector, which is immediately replicated into the internal data
vec | a PETSc vector |
Definition at line 76 of file ReplicatableVector.cpp.
References ReplicatePetscVector().
ReplicatableVector::ReplicatableVector | ( | unsigned | size | ) |
Constructor to make a vector of given size.
size | the size of the vector |
Definition at line 85 of file ReplicatableVector.cpp.
References Resize().
ReplicatableVector::~ReplicatableVector | ( | ) |
Default destructor. Remove PETSc context.
Definition at line 94 of file ReplicatableVector.cpp.
References RemovePetscContext().
unsigned ReplicatableVector::GetSize | ( | ) |
Definition at line 101 of file ReplicatableVector.cpp.
References mSize.
Referenced by Hdf5ToTxtConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToTxtConverter(), AbstractNonlinearElasticitySolver< DIM >::ComputeJacobian(), AbstractNonlinearElasticitySolver< DIM >::ComputeResidual(), Replicate(), ReplicatePetscVector(), AbstractNonlinearElasticitySolver< DIM >::VectorSum(), Hdf5ToCmguiConverter< ELEMENT_DIM, SPACE_DIM >::Write(), and Hdf5ToMeshalyzerConverter< ELEMENT_DIM, SPACE_DIM >::Write().
Access the vector.
index | the index of the vector to return |
Definition at line 129 of file ReplicatableVector.cpp.
|
private |
Clear data. Used in resize method and destructor.
Definition at line 45 of file ReplicatableVector.cpp.
References PetscTools::Destroy(), mpData, mReplicated, mToAll, and PETSC_DESTROY_PARAM.
Referenced by ~ReplicatableVector(), and Resize().
Replicate this vector over all processes.
Each process knows its local part of the vector. This method shares that knowledge across all the processes.
lo | The start of our ownership range |
hi | One past the end of our ownership range |
Definition at line 137 of file ReplicatableVector.cpp.
References PetscTools::Destroy(), GetSize(), mpData, and ReplicatePetscVector().
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.
vec | The PETSc vector to replicate. |
Definition at line 160 of file ReplicatableVector.cpp.
References GetSize(), mpData, mReplicated, mToAll, and Resize().
Referenced by Hdf5ToTxtConverter< ELEMENT_DIM, SPACE_DIM >::Hdf5ToTxtConverter(), ReplicatableVector(), Replicate(), and Hdf5ToMeshalyzerConverter< ELEMENT_DIM, SPACE_DIM >::Write().
void ReplicatableVector::Resize | ( | unsigned | size | ) |
Resize the vector.
size | The number of elements to allocate memory for. |
Definition at line 106 of file ReplicatableVector.cpp.
References mpData, mSize, RemovePetscContext(), and PetscTools::ReplicateException().
Referenced by AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::AbstractCardiacTissue(), ExtendedBidomainTissue< SPACE_DIM >::ExtendedBidomainTissue(), ExtendedBidomainTissue< SPACE_DIM >::ExtendedBidomainTissue(), ReplicatableVector(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::load(), and ReplicatePetscVector().
|
private |
The wrapped PeTSc vector.
Definition at line 49 of file ReplicatableVector.hpp.
Referenced by operator[](), RemovePetscContext(), Replicate(), ReplicatePetscVector(), and Resize().
|
private |
Vector to hold concentrated copy of replicated vector.
Definition at line 52 of file ReplicatableVector.hpp.
Referenced by RemovePetscContext(), and ReplicatePetscVector().
|
private |
The length of the vector.
Definition at line 50 of file ReplicatableVector.hpp.
Referenced by GetSize(), operator[](), and Resize().
|
private |
Variable holding information for replicating a PETSc vector.
Definition at line 51 of file ReplicatableVector.hpp.
Referenced by RemovePetscContext(), and ReplicatePetscVector().