GEOS
Public Member Functions | List of all members
geos::HypreVector Class Referencefinal

Wrapper class for hypre's ParVector. More...

#include <HypreVector.hpp>

Inheritance diagram for geos::HypreVector:
Inheritance graph
[legend]

Public Member Functions

HYPRE_ParVector const & unwrapped () const
 Returns a pointer to the implementation. More...
 
Constructor/Destructor Methods
 HypreVector ()
 Empty vector constructor. Create an empty (distributed) vector.
 
 HypreVector (HypreVector const &src)
 Copy constructor. More...
 
 HypreVector (HypreVector &&src) noexcept
 Move constructor. More...
 
HypreVectoroperator= (HypreVector const &src)
 Copy assignment. More...
 
HypreVectoroperator= (HypreVector &&src) noexcept
 Move assignment. More...
 
 ~HypreVector ()
 Destructor.
 
VectorBase interface
virtual bool created () const override
 Query vector creation status. More...
 
virtual void create (localIndex const localSize, MPI_Comm const &comm) override
 Create a vector based on local number of elements. More...
 
virtual void close () override
 Close vector for modification. More...
 
virtual void touch () override
 Notify the vector about external modification through direct data pointer. More...
 
virtual void reset () override
 Reset the vector to default state.
 
virtual void set (real64 const value) override
 Set all elements to a constant value. More...
 
virtual void rand (unsigned const seed) override
 Set vector elements to random entries. More...
 
virtual void scale (real64 const scalingFactor) override
 Multiply all elements by factor. More...
 
virtual void reciprocal () override
 Replace vector elements by their reciprocals. More...
 
virtual real64 dot (HypreVector const &vec) const override
 Dot product with the vector vec. More...
 
virtual void copy (HypreVector const &x) override
 Update vector y as y = x. More...
 
virtual void axpy (real64 const alpha, HypreVector const &x) override
 Update vector y as y = alpha*x + y. More...
 
virtual void axpby (real64 const alpha, HypreVector const &x, real64 const beta) override
 Update vector y as y = alpha*x + beta*y. More...
 
virtual void pointwiseProduct (HypreVector const &x, HypreVector &y) const override
 Compute the component-wise multiplication y = v * x. More...
 
virtual real64 norm1 () const override
 1-norm of the vector. More...
 
virtual real64 norm2 () const override
 2-norm of the vector. More...
 
virtual real64 normInf () const override
 Infinity-norm of the vector. More...
 
virtual globalIndex globalSize () const override
 Returns the global of the vector. More...
 
virtual localIndex localSize () const override
 Returns the local size of the vector. More...
 
virtual globalIndex ilower () const override
 Get lower bound of local partition. More...
 
virtual globalIndex iupper () const override
 Get upper bound of local partition. More...
 
virtual MPI_Comm comm () const override
 Get the communicator used by this vector. More...
 
virtual void print (std::ostream &os=std::cout) const override
 Print the vector in Trilinos format to the terminal. More...
 
virtual void write (string const &filename, LAIOutputFormat const format=LAIOutputFormat::MATRIX_MARKET) const override
 Write the vector to a file. More...
 
void setName (string const &name)
 Set a name for the vector (mainly used during various logging). More...
 
bool closed () const
 Query vector closed status. More...
 
bool ready () const
 Query vector ready status. More...
 
virtual arrayView1d< real64open ()
 Open the vector for modifying entries. More...
 
virtual void zero ()
 Set vector elements to zero.
 
arrayView1d< real64 const > values () const
 

Detailed Description

Wrapper class for hypre's ParVector.

This class creates and provides basic support for the HYPRE_ParVector object type used in Hypre using the linear-algebraic system interface (IJ interface).

Definition at line 50 of file HypreVector.hpp.

Constructor & Destructor Documentation

◆ HypreVector() [1/2]

geos::HypreVector::HypreVector ( HypreVector const &  src)

Copy constructor.

Parameters
srcvector to be copied

◆ HypreVector() [2/2]

geos::HypreVector::HypreVector ( HypreVector &&  src)
noexcept

Move constructor.

Parameters
srcvector to be moved

Member Function Documentation

◆ axpby()

virtual void geos::HypreVector::axpby ( real64 const  alpha,
HypreVector const &  x,
real64 const  beta 
)
overridevirtual

Update vector y as y = alpha*x + beta*y.

Parameters
alphascaling factor for added vector
xvector to add
betascaling factor for self vector

Implements geos::VectorBase< HypreVector >.

◆ axpy()

virtual void geos::HypreVector::axpy ( real64 const  alpha,
HypreVector const &  x 
)
overridevirtual

Update vector y as y = alpha*x + y.

Parameters
alphascaling factor for added vector
xvector to add

Implements geos::VectorBase< HypreVector >.

◆ close()

virtual void geos::HypreVector::close ( )
overridevirtual

Close vector for modification.

After calling this method, the view obtained via open() should not be used.

Implements geos::VectorBase< HypreVector >.

◆ closed()

bool geos::VectorBase< VECTOR >::closed
inline

Query vector closed status.

Returns
true if vector has been opened and has not been closed since; false otherwise

Definition at line 64 of file VectorBase.hpp.

◆ comm()

virtual MPI_Comm geos::HypreVector::comm ( ) const
overridevirtual

Get the communicator used by this vector.

Returns
the MPI communicator

Implements geos::VectorBase< HypreVector >.

◆ copy()

virtual void geos::HypreVector::copy ( HypreVector const &  x)
overridevirtual

Update vector y as y = x.

Parameters
xvector to copy
Note
Unlike copy assignment operator, this method expects both vectors to be created and have identical parallel distributions, and never reallocates memory.

Implements geos::VectorBase< HypreVector >.

◆ create()

virtual void geos::HypreVector::create ( localIndex const  localSize,
MPI_Comm const &  comm 
)
overridevirtual

Create a vector based on local number of elements.

Parameters
localSizelocal number of elements
commMPI communicator to use

Create a vector based on local number of elements. Global size is the sum across processors.

Reimplemented from geos::VectorBase< HypreVector >.

◆ created()

virtual bool geos::HypreVector::created ( ) const
overridevirtual

Query vector creation status.

Returns
true if vector has been created

Implements geos::VectorBase< HypreVector >.

◆ dot()

virtual real64 geos::HypreVector::dot ( HypreVector const &  vec) const
overridevirtual

Dot product with the vector vec.

Parameters
vecvector to dot-product with
Returns
dot product

Implements geos::VectorBase< HypreVector >.

◆ globalSize()

virtual globalIndex geos::HypreVector::globalSize ( ) const
overridevirtual

Returns the global of the vector.

Returns
the global size

Implements geos::VectorBase< HypreVector >.

◆ ilower()

virtual globalIndex geos::HypreVector::ilower ( ) const
overridevirtual

Get lower bound of local partition.

Returns
index of the first global row owned by this processor

Implements geos::VectorBase< HypreVector >.

◆ iupper()

virtual globalIndex geos::HypreVector::iupper ( ) const
overridevirtual

Get upper bound of local partition.

Returns
next index after last global row owned by that processor
Note
[ v.ilower(); v.iupper() ) is a half-open index range

Implements geos::VectorBase< HypreVector >.

◆ localSize()

virtual localIndex geos::HypreVector::localSize ( ) const
overridevirtual

Returns the local size of the vector.

Returns
the local size (on this processor)

Implements geos::VectorBase< HypreVector >.

◆ norm1()

virtual real64 geos::HypreVector::norm1 ( ) const
overridevirtual

1-norm of the vector.

Returns
the 1-norm value

Implements geos::VectorBase< HypreVector >.

◆ norm2()

virtual real64 geos::HypreVector::norm2 ( ) const
overridevirtual

2-norm of the vector.

Returns
the 2-norm value

Implements geos::VectorBase< HypreVector >.

◆ normInf()

virtual real64 geos::HypreVector::normInf ( ) const
overridevirtual

Infinity-norm of the vector.

Returns
the inf-norm value

Implements geos::VectorBase< HypreVector >.

◆ open()

virtual arrayView1d< real64 > geos::VectorBase< VECTOR >::open
inlinevirtual

Open the vector for modifying entries.

Returns
an array view to assemble local values into

Reimplemented from geos::VectorBase< HypreVector >.

Definition at line 129 of file VectorBase.hpp.

◆ operator=() [1/2]

HypreVector& geos::HypreVector::operator= ( HypreVector &&  src)
noexcept

Move assignment.

Parameters
srcHypreVector to be moved.
Returns
the new vector.

◆ operator=() [2/2]

HypreVector& geos::HypreVector::operator= ( HypreVector const &  src)

Copy assignment.

Parameters
srcHypreVector to be copied.
Returns
the new vector.

◆ pointwiseProduct()

virtual void geos::HypreVector::pointwiseProduct ( HypreVector const &  x,
HypreVector y 
) const
overridevirtual

Compute the component-wise multiplication y = v * x.

Parameters
xfirst vector (input)
ysecond vector (output)

Implements geos::VectorBase< HypreVector >.

◆ print()

virtual void geos::HypreVector::print ( std::ostream &  os = std::cout) const
overridevirtual

Print the vector in Trilinos format to the terminal.

Parameters
osthe output stream to print to

Implements geos::VectorBase< HypreVector >.

◆ rand()

virtual void geos::HypreVector::rand ( unsigned const  seed)
overridevirtual

Set vector elements to random entries.

Parameters
seedthe random number seed to use

Implements geos::VectorBase< HypreVector >.

◆ ready()

bool geos::VectorBase< VECTOR >::ready
inline

Query vector ready status.

Returns
true if vector has been created and is currently closed

Definition at line 76 of file VectorBase.hpp.

◆ reciprocal()

virtual void geos::HypreVector::reciprocal ( )
overridevirtual

Replace vector elements by their reciprocals.

Note
No guarding is done against division by zero.

Implements geos::VectorBase< HypreVector >.

◆ scale()

virtual void geos::HypreVector::scale ( real64 const  factor)
overridevirtual

Multiply all elements by factor.

Parameters
factorscaling factor

Implements geos::VectorBase< HypreVector >.

◆ set()

virtual void geos::HypreVector::set ( real64 const  value)
overridevirtual

Set all elements to a constant value.

Parameters
valuevalue to set vector elements to

Implements geos::VectorBase< HypreVector >.

◆ setName()

void geos::VectorBase< VECTOR >::setName
inline

Set a name for the vector (mainly used during various logging).

Parameters
namethe name

Definition at line 113 of file VectorBase.hpp.

◆ touch()

virtual void geos::HypreVector::touch ( )
overridevirtual

Notify the vector about external modification through direct data pointer.

This method MUST be called after any changes to vector values performed through direct pointer access, so that the underlying Array object can be made aware of external changes in a specific memory space.

Implements geos::VectorBase< HypreVector >.

◆ unwrapped()

HYPRE_ParVector const& geos::HypreVector::unwrapped ( ) const

Returns a pointer to the implementation.

Returns
the underlying HYPRE_ParVector object.

◆ values()

arrayView1d< real64 const > geos::VectorBase< VECTOR >::values
inline
Returns
a const access view to local vector values

Definition at line 305 of file VectorBase.hpp.

◆ write()

virtual void geos::HypreVector::write ( string const &  filename,
LAIOutputFormat const  format = LAIOutputFormat::MATRIX_MARKET 
) const
overridevirtual

Write the vector to a file.

Parameters
filenamename of the output file
[in]formatoutput format

Implements geos::VectorBase< HypreVector >.


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