#include <DistributedVectorFactory.hpp>
Public Member Functions | |
DistributedVectorFactory (Vec vec) | |
DistributedVectorFactory (unsigned size, PetscInt local=PETSC_DECIDE) | |
Vec | CreateVec () |
Vec | CreateVec (unsigned stride) |
DistributedVector | CreateDistributedVector (Vec vec) |
bool | IsGlobalIndexLocal (unsigned globalIndex) |
unsigned | GetLocalOwnership () const |
unsigned | GetHigh () const |
unsigned | GetLow () const |
unsigned | GetProblemSize () const |
Private Member Functions | |
void | CheckForPetsc () |
void | CalculateOwnership (Vec vec) |
template<class Archive> | |
void | serialize (Archive &archive, const unsigned int version) |
Private Attributes | |
unsigned | mLo |
unsigned | mHi |
unsigned | mProblemSize |
bool | mPetscStatusKnown |
Friends | |
class | boost::serialization::access |
Replacement for the vector creation portions of DistributedVector (which was implemented using static methods and data), the factory class allows several patterns of PETSc vector length (and distributions among processes) to co-exist.
All vectors created by a factory instance will have the same base size and parallelisation pattern.
Definition at line 53 of file DistributedVectorFactory.hpp.
DistributedVectorFactory::DistributedVectorFactory | ( | Vec | vec | ) |
Set the problem with an existing PETSc vector -- must have stride=1.
vec | is a PETSc vector which we want to use as the pattern for future vectors produced by this factory |
Definition at line 52 of file DistributedVectorFactory.cpp.
References CalculateOwnership().
DistributedVectorFactory::DistributedVectorFactory | ( | unsigned | size, | |
PetscInt | local = PETSC_DECIDE | |||
) |
Set the problem size specifying distribution over local processor.
size | the problem size | |
local | defaults to PETSc's default |
Definition at line 57 of file DistributedVectorFactory.cpp.
References CalculateOwnership(), CheckForPetsc(), and mPetscStatusKnown.
void DistributedVectorFactory::CheckForPetsc | ( | ) | [private] |
Double check (in debug code) that PETSc has been initialised properly
Definition at line 74 of file DistributedVectorFactory.cpp.
References mPetscStatusKnown.
Referenced by CalculateOwnership(), and DistributedVectorFactory().
void DistributedVectorFactory::CalculateOwnership | ( | Vec | vec | ) | [private] |
Helper method for the constructors
vec | the sample PETSc vector from which to calculate ownerships |
Definition at line 33 of file DistributedVectorFactory.cpp.
References CheckForPetsc(), mHi, mLo, mPetscStatusKnown, and mProblemSize.
Referenced by DistributedVectorFactory().
void DistributedVectorFactory::serialize | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, private] |
Archive the member variables.
archive | the archive | |
version | the current version of this class |
Definition at line 88 of file DistributedVectorFactory.hpp.
Vec DistributedVectorFactory::CreateVec | ( | ) |
Create a PETSc vector of the problem size
Definition at line 92 of file DistributedVectorFactory.cpp.
References mHi, mLo, and mProblemSize.
Referenced by AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::GenerateNullBasis(), MonodomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::MonodomainMatrixBasedAssembler(), MonodomainRhsMatrixAssembler< ELEM_DIM, SPACE_DIM >::MonodomainRhsMatrixAssembler(), ParallelColumnDataWriter::PutVectorStripe(), and Hdf5ToMeshalyzerConverter::Write().
Vec DistributedVectorFactory::CreateVec | ( | unsigned | stride | ) |
Create a striped PETSc vector of size: stride * problem size
stride |
Definition at line 101 of file DistributedVectorFactory.cpp.
References mHi, mLo, and mProblemSize.
DistributedVector DistributedVectorFactory::CreateDistributedVector | ( | Vec | vec | ) |
Create a distributed vector which wraps a given petsc vector
vec | is the vector |
Definition at line 108 of file DistributedVectorFactory.cpp.
Referenced by BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToNonlinearResidual(), BidomainWithBathMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::ConstructVectorForMatrixBasedRhsAssembly(), BidomainMatrixBasedAssembler< ELEMENT_DIM, SPACE_DIM >::ConstructVectorForMatrixBasedRhsAssembly(), BidomainProblem< DIM >::CreateInitialCondition(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::GenerateNullBasis(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::GetSolutionDistributedVector(), ParallelColumnDataWriter::PutVectorStripe(), and AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::SolveCellSystems().
bool DistributedVectorFactory::IsGlobalIndexLocal | ( | unsigned | globalIndex | ) |
Test if the given global index is owned by the current process, i.e. is local to it.
globalIndex | a global index |
Definition at line 87 of file DistributedVectorFactory.cpp.
unsigned DistributedVectorFactory::GetLocalOwnership | ( | ) | const [inline] |
Definition at line 142 of file DistributedVectorFactory.hpp.
Referenced by AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::AbstractCardiacPde(), Hdf5DataWriter::DefineFixedDimension(), and Electrodes< DIM >::Electrodes().
unsigned DistributedVectorFactory::GetHigh | ( | ) | const [inline] |
Definition at line 150 of file DistributedVectorFactory.hpp.
References mHi.
Referenced by AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::AbstractCardiacPde(), Hdf5DataWriter::DefineFixedDimension(), DistributedVector::DistributedVector(), ParallelTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::DumbNodePartitioning(), AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::GetCardiacCell(), and AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::ReplicateCaches().
unsigned DistributedVectorFactory::GetLow | ( | ) | const [inline] |
Definition at line 158 of file DistributedVectorFactory.hpp.
References mLo.
Referenced by AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::AbstractCardiacPde(), Hdf5DataWriter::DefineFixedDimension(), DistributedVector::DistributedVector(), ParallelTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::DumbNodePartitioning(), AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::GetCardiacCell(), and AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::ReplicateCaches().
unsigned DistributedVectorFactory::GetProblemSize | ( | ) | const [inline] |
Definition at line 166 of file DistributedVectorFactory.hpp.
References mProblemSize.
Referenced by DistributedVector::DistributedVector(), and Electrodes< DIM >::Electrodes().
friend class boost::serialization::access [friend] |
Needed for serialization.
Definition at line 79 of file DistributedVectorFactory.hpp.
unsigned DistributedVectorFactory::mLo [private] |
The first entry owned by the current processor.
Definition at line 58 of file DistributedVectorFactory.hpp.
Referenced by CalculateOwnership(), CreateVec(), GetLocalOwnership(), GetLow(), and IsGlobalIndexLocal().
unsigned DistributedVectorFactory::mHi [private] |
One above the last entry owned by the current processor.
Definition at line 60 of file DistributedVectorFactory.hpp.
Referenced by CalculateOwnership(), CreateVec(), GetHigh(), GetLocalOwnership(), and IsGlobalIndexLocal().
unsigned DistributedVectorFactory::mProblemSize [private] |
The problem size, i.e. the number of nodes in the mesh (the number of unknowns may be larger in a Stripe).
Definition at line 62 of file DistributedVectorFactory.hpp.
Referenced by CalculateOwnership(), CreateVec(), and GetProblemSize().
bool DistributedVectorFactory::mPetscStatusKnown [private] |
Whether we've checked that PETSc is initialised.
Definition at line 64 of file DistributedVectorFactory.hpp.
Referenced by CalculateOwnership(), CheckForPetsc(), and DistributedVectorFactory().