Chi-Tech
chi_math::GhostedParallelSTLVector Class Reference

#include <GhostedParallelSTLVector.h>

Inheritance diagram for chi_math::GhostedParallelSTLVector:
chi_math::ParallelSTLVector chi_math::ParallelVector

Public Member Functions

 GhostedParallelSTLVector (const uint64_t local_size, const uint64_t global_size, const std::vector< int64_t > &ghost_ids, const MPI_Comm communicator=MPI_COMM_WORLD)
 
 GhostedParallelSTLVector (const VectorGhostCommunicator &ghost_comm)
 Initialize a ghosted parallel vector from a ghost communicator. More...
 
 GhostedParallelSTLVector (const GhostedParallelSTLVector &other)
 
 GhostedParallelSTLVector (GhostedParallelSTLVector &&other) noexcept
 
std::unique_ptr< ParallelVectorMakeCopy () const override
 
std::unique_ptr< ParallelVectorMakeClone () const override
 
uint64_t NumGhosts () const
 Return the number of ghosts associated with the local vector. More...
 
uint64_t LocalSizeWithGhosts () const
 Return the total size of the local vector, including ghosts. More...
 
const std::vector< int64_t > & GhostIndices () const
 Return the ghost indices associated with the local vector. More...
 
int64_t MapGhostToLocal (const int64_t ghost_id) const
 Map a global ghost id to its respective local id. More...
 
std::vector< double > MakeGhostedLocalVector () const
 Return a vector containing the locally owned data and ghost data. More...
 
double GetGlobalValue (int64_t global_id) const
 
void CommunicateGhostEntries () override
 
- Public Member Functions inherited from chi_math::ParallelSTLVector
 ParallelSTLVector (uint64_t local_size, uint64_t global_size, MPI_Comm communicator)
 
 ParallelSTLVector (const ParallelSTLVector &other)
 
 ParallelSTLVector (ParallelSTLVector &&other) noexcept
 
std::unique_ptr< ParallelVectorMakeCopy () const override
 
std::unique_ptr< ParallelVectorMakeClone () const override
 
double * Data () override
 
const double * Data () const override
 
const std::vector< double > & LocalSTLData () const
 
std::vector< double > & LocalSTLData ()
 
double operator[] (int64_t local_id) const override
 
double & operator[] (int64_t local_id) override
 
std::vector< double > MakeLocalVector () override
 Return a vector containing the locally owned data. More...
 
void Set (double value) override
 
void Set (const std::vector< double > &local_vector) override
 
void BlockSet (const std::vector< double > &y, int64_t local_offset, int64_t num_values) override
 
void CopyLocalValues (const ParallelVector &y) override
 
void CopyLocalValues (Vec y) override
 
void BlockCopyLocalValues (const ParallelVector &y, int64_t y_offset, int64_t local_offset, int64_t num_values) override
 
void BlockCopyLocalValues (Vec y, int64_t y_offset, int64_t local_offset, int64_t num_values) override
 
void SetValue (int64_t global_id, double value, VecOpType op_type) override
 
void SetValues (const std::vector< int64_t > &global_ids, const std::vector< double > &values, VecOpType op_type) override
 
void operator+= (const ParallelVector &y) override
 
void PlusAY (const ParallelVector &y, double a) override
 
void AXPlusY (double a, const ParallelVector &y) override
 
void Scale (double a) override
 
void Shift (double a) override
 
double ComputeNorm (chi_math::NormType norm_type) const override
 
void Assemble () override
 
std::string PrintStr () const override
 Print the local vectors to stings. More...
 
- Public Member Functions inherited from chi_math::ParallelVector
 ParallelVector (uint64_t local_size, uint64_t global_size, MPI_Comm communicator)
 
 ParallelVector (const ParallelVector &other)
 
 ParallelVector (ParallelVector &&other) noexcept
 
virtual std::unique_ptr< ParallelVectorMakeCopy () const =0
 
virtual std::unique_ptr< ParallelVectorMakeClone () const =0
 
virtual double * Data ()=0
 
virtual const double * Data () const =0
 
uint64_t LocalSize () const
 Return the size of the locally owned portion of the parallel vector. More...
 
uint64_t GlobalSize () const
 Return the global size of the parallel vector. More...
 
virtual double operator[] (int64_t local_id) const =0
 
virtual double & operator[] (int64_t local_id)=0
 
virtual std::vector< double > MakeLocalVector ()=0
 Return a vector containing the locally owned data. More...
 
virtual void Set (double value)=0
 
virtual void Set (const std::vector< double > &local_vector)=0
 
virtual void BlockSet (const std::vector< double > &y, int64_t local_offset, int64_t num_values)=0
 
virtual void CopyLocalValues (const ParallelVector &y)=0
 
virtual void CopyLocalValues (Vec y)=0
 
virtual void BlockCopyLocalValues (const ParallelVector &y, int64_t y_offset, int64_t local_offset, int64_t num_values)=0
 
virtual void BlockCopyLocalValues (Vec y, int64_t y_offset, int64_t local_offset, int64_t num_values)=0
 
virtual void SetValue (int64_t global_id, double value, VecOpType op_type)=0
 
virtual void SetValues (const std::vector< int64_t > &global_ids, const std::vector< double > &values, VecOpType op_type)=0
 
virtual void operator+= (const ParallelVector &y)=0
 
virtual void PlusAY (const ParallelVector &y, double a)=0
 
virtual void AXPlusY (double a, const ParallelVector &y)=0
 
virtual void Scale (double a)=0
 
virtual void Shift (double a)=0
 
virtual double ComputeNorm (chi_math::NormType norm_type) const =0
 
virtual void Assemble ()=0
 
virtual std::string PrintStr () const =0
 Print the local vectors to stings. More...
 
virtual void CommunicateGhostEntries ()
 
virtual ~ParallelVector ()=default
 

Private Attributes

VectorGhostCommunicator ghost_comm_
 

Additional Inherited Members

- Protected Types inherited from chi_math::ParallelSTLVector
using Operation = std::pair< int64_t, double >
 
- Protected Attributes inherited from chi_math::ParallelSTLVector
const std::vector< uint64_t > extents_
 
std::vector< double > values_
 
std::vector< Operationset_cache_
 
std::vector< Operationadd_cache_
 
- Protected Attributes inherited from chi_math::ParallelVector
const uint64_t local_size_
 
const uint64_t global_size_
 
const int location_id_
 
const int process_count_
 
const MPI_Comm comm_
 

Detailed Description

Definition at line 11 of file GhostedParallelSTLVector.h.

Constructor & Destructor Documentation

◆ GhostedParallelSTLVector() [1/4]

chi_math::GhostedParallelSTLVector::GhostedParallelSTLVector ( const uint64_t  local_size,
const uint64_t  global_size,
const std::vector< int64_t > &  ghost_ids,
const MPI_Comm  communicator = MPI_COMM_WORLD 
)
inline

Initialize the ghosted parallel vector with the given local and global sizes, with the specified global ghost indices.

Definition at line 18 of file GhostedParallelSTLVector.h.

◆ GhostedParallelSTLVector() [2/4]

chi_math::GhostedParallelSTLVector::GhostedParallelSTLVector ( const VectorGhostCommunicator ghost_comm)
inlineexplicit

Initialize a ghosted parallel vector from a ghost communicator.

Definition at line 29 of file GhostedParallelSTLVector.h.

◆ GhostedParallelSTLVector() [3/4]

chi_math::GhostedParallelSTLVector::GhostedParallelSTLVector ( const GhostedParallelSTLVector other)
inline

Copy constructor.

Definition at line 39 of file GhostedParallelSTLVector.h.

◆ GhostedParallelSTLVector() [4/4]

chi_math::GhostedParallelSTLVector::GhostedParallelSTLVector ( GhostedParallelSTLVector &&  other)
inlinenoexcept

Move constructor.

Definition at line 46 of file GhostedParallelSTLVector.h.

Member Function Documentation

◆ CommunicateGhostEntries()

void chi_math::GhostedParallelSTLVector::CommunicateGhostEntries ( )
inlineoverridevirtual

Communicate the current ghost entries to all other processes to update the locally stored ghost data.

Reimplemented from chi_math::ParallelVector.

Definition at line 88 of file GhostedParallelSTLVector.h.

◆ GetGlobalValue()

double chi_math::GhostedParallelSTLVector::GetGlobalValue ( int64_t  global_id) const

Return the value of the parallel vector for the specified global index.

An error is thrown if the global index does not belong to a locally owned, or ghost entry.

Definition at line 24 of file GhostedParallelSTLVector.cc.

◆ GhostIndices()

const std::vector< int64_t > & chi_math::GhostedParallelSTLVector::GhostIndices ( ) const
inline

Return the ghost indices associated with the local vector.

Definition at line 62 of file GhostedParallelSTLVector.h.

◆ LocalSizeWithGhosts()

uint64_t chi_math::GhostedParallelSTLVector::LocalSizeWithGhosts ( ) const
inline

Return the total size of the local vector, including ghosts.

Definition at line 59 of file GhostedParallelSTLVector.h.

◆ MakeClone()

std::unique_ptr< ParallelVector > chi_math::GhostedParallelSTLVector::MakeClone ( ) const
overridevirtual

Creates a copy of the vector datastructures but NOT the values. The values are defaulted to zero. This routine requires no communication.

Implements chi_math::ParallelVector.

Definition at line 15 of file GhostedParallelSTLVector.cc.

◆ MakeCopy()

std::unique_ptr< ParallelVector > chi_math::GhostedParallelSTLVector::MakeCopy ( ) const
overridevirtual

Creates a copy of the vector datastructures AND values. This routine requires no communication.

Implements chi_math::ParallelVector.

Definition at line 10 of file GhostedParallelSTLVector.cc.

◆ MakeGhostedLocalVector()

std::vector< double > chi_math::GhostedParallelSTLVector::MakeGhostedLocalVector ( ) const
inline

Return a vector containing the locally owned data and ghost data.

Definition at line 74 of file GhostedParallelSTLVector.h.

◆ MapGhostToLocal()

int64_t chi_math::GhostedParallelSTLVector::MapGhostToLocal ( const int64_t  ghost_id) const
inline

Map a global ghost id to its respective local id.

Definition at line 68 of file GhostedParallelSTLVector.h.

◆ NumGhosts()

uint64_t chi_math::GhostedParallelSTLVector::NumGhosts ( ) const
inline

Return the number of ghosts associated with the local vector.

Definition at line 56 of file GhostedParallelSTLVector.h.

Field Documentation

◆ ghost_comm_

VectorGhostCommunicator chi_math::GhostedParallelSTLVector::ghost_comm_
private

Definition at line 94 of file GhostedParallelSTLVector.h.


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