Template Numerical Library version\ main:9e7b0f4
Loading...
Searching...
No Matches
TNL::Containers::HypreParVector Class Reference

Wrapper for Hypre's parallel vector. More...

#include <TNL/Containers/HypreParVector.h>

Collaboration diagram for TNL::Containers::HypreParVector:

Public Types

using ConstLocalViewType = typename LocalVectorType::ConstViewType
using ConstViewType = typename VectorType::ConstViewType
using DeviceType = HYPRE_Device
using IndexType = HYPRE_Int
using LocalRangeType = Subrange< IndexType >
using LocalVectorType = Containers::Vector< RealType, DeviceType, IndexType >
using LocalViewType = typename LocalVectorType::ViewType
using RealType = HYPRE_Real
using SynchronizerType = typename ViewType::SynchronizerType
using ValueType = RealType
using VectorType = Containers::DistributedVector< RealType, DeviceType, IndexType >
using ViewType = typename VectorType::ViewType

Public Member Functions

 HypreParVector (const HypreParVector &other)=delete
 HypreParVector (const LocalRangeType &localRange, IndexType ghosts, IndexType globalSize, MPI_Comm communicator, LocalViewType localData)
 Initialization by raw data.
 HypreParVector (hypre_ParVector *handle, bool take_ownership=true)
 Convert Hypre's format to HypreParVector.
 HypreParVector (HypreParVector &&other) noexcept
void bind (const LocalRangeType &localRange, IndexType ghosts, IndexType globalSize, MPI_Comm communicator, LocalViewType localData)
 Drop previously set data (deallocate if the vector was the owner) and bind to the given data (i.e., the vector does not become the owner).
void bind (hypre_ParVector *handle, bool take_ownership=true)
 Convert Hypre's format to HypreParVector.
void bind (HypreParVector &vector)
void bind (VectorType &vector)
void bind (ViewType view)
MPI_Comm getCommunicator () const
 Return the MPI communicator.
ConstLocalViewType getConstLocalView () const
ConstLocalViewType getConstLocalViewWithGhosts () const
ConstViewType getConstView () const
IndexType getGhosts () const
LocalRangeType getLocalRange () const
LocalViewType getLocalView ()
LocalViewType getLocalViewWithGhosts ()
HYPRE_Int getSize () const
 Returns the global size of the vector.
std::shared_ptr< SynchronizerType > getSynchronizer () const
int getValuesPerElement () const
ViewType getView ()
 operator hypre_ParVector * () const
 Typecasting to Hypre's hypre_ParVector* (which is equivalent to HYPRE_ParVector*)
HypreParVectoroperator= (const HypreParVector &other)=delete
HypreParVectoroperator= (HypreParVector &&other) noexcept
void reset ()
 Reset the vector to empty state.
void setDistribution (LocalRangeType localRange, IndexType ghosts, IndexType globalSize, const MPI::Comm &communicator)
void setSynchronizer (std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement=1)
void setValue (RealType value)
 Set all elements of the vector to value.
void startSynchronization ()
void waitForSynchronization () const

Protected Attributes

HYPRE_Int ghosts = 0
HypreVector localData
bool owns_handle = true
std::shared_ptr< SynchronizerType > synchronizer = nullptr
hypre_ParVector * v = nullptr
int valuesPerElement = 1

Detailed Description

Constructor & Destructor Documentation

◆ HypreParVector()

TNL::Containers::HypreParVector::HypreParVector ( hypre_ParVector * handle,
bool take_ownership = true )
inlineexplicit

Convert Hypre's format to HypreParVector.

Parameters
handleis the Hypre vector handle.
take_ownershipindicates if the vector should take ownership of the handle, i.e. whether to call hypre_VectorDestroy when it does not need it anymore.

Member Function Documentation

◆ bind()

void TNL::Containers::HypreParVector::bind ( hypre_ParVector * handle,
bool take_ownership = true )
inline

Convert Hypre's format to HypreParVector.

Parameters
handleis the Hypre vector handle.
take_ownershipindicates if the vector should take ownership of the handle, i.e. whether to call hypre_VectorDestroy when it does not need it anymore.

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