GEOSX
Public Types | Public Member Functions | List of all members
geosx::BlockVector< VECTOR > Class Template Reference

Concrete representation of a block vector. More...

#include <BlockVector.hpp>

Inheritance diagram for geosx::BlockVector< VECTOR >:
Inheritance graph
[legend]

Public Types

using Base = BlockVectorView< VECTOR >
 Alias for base type.
 
- Public Types inherited from geosx::BlockVectorView< VECTOR >
using Vector = VECTOR
 Alias for sub-vector type.
 

Public Member Functions

 BlockVector (localIndex const nBlocks)
 Create a vector of nBlocks blocks. More...
 
 BlockVector ()
 Create a vector of nBlocks blocks.
 
 BlockVector (BlockVector const &rhs)
 Copy constructor that performs a deep copy of each sub-vector. More...
 
 BlockVector (BlockVector &&rhs)
 Move constructor. More...
 
 BlockVector (BlockVectorView< VECTOR > const &rhs)
 Conversion constructor from a compatible view with a deep copy of each sub-vector. More...
 
BlockVectoroperator= (BlockVector const &x)
 Copy assignment. More...
 
BlockVectoroperator= (BlockVector &&x) noexcept
 Move assignment. More...
 
virtual ~BlockVector () override=default
 Destructor.
 
void resize (localIndex const nBlocks)
 Resize to a different number of blocks. More...
 
- Public Member Functions inherited from geosx::BlockVectorView< VECTOR >
BlockVectorViewoperator= (BlockVectorView const &rhs)=delete
 Deleted copy assignment. More...
 
BlockVectorViewoperator= (BlockVectorView &&rhs) noexcept=delete
 Deleted move assignment. More...
 
virtual ~BlockVectorView ()=default
 Destructor.
 
void copy (BlockVectorView const &src)
 Update vector y as y = x. More...
 
void scale (real64 const factor)
 Scale the block vector with factor. More...
 
void zero ()
 Set the vector to zero.
 
void rand (unsigned const seed=1984)
 Set vector elements to random entries. More...
 
real64 dot (BlockVectorView const &x) const
 Dot product. More...
 
real64 norm2 () const
 2-norm of the block vector. More...
 
real64 normInf () const
 Inf-norm of the block vector. More...
 
void axpy (real64 const alpha, BlockVectorView const &x)
 Update vector y as y = alpha*x + y. More...
 
void axpby (real64 const alpha, BlockVectorView const &x, real64 const beta)
 Update vector y as y = alpha*x + beta*y. More...
 
localIndex blockSize () const
 Get block size. More...
 
globalIndex globalSize () const
 Get global size. More...
 
localIndex localSize () const
 Get local size. More...
 
void print (std::ostream &os=std::cout) const
 Print the block vector. More...
 
VECTOR const & block (localIndex const blockIndex) const
 Get a reference to the vector corresponding to block blockRowIndex. More...
 
VECTOR & block (localIndex const blockIndex)
 Get a reference to the vector corresponding to block blockRowIndex. More...
 
VECTOR const & operator() (localIndex const blockIndex) const
 Get a reference to the vector corresponding to block blockRowIndex. More...
 
VECTOR & operator() (localIndex const blockIndex)
 Get a reference to the vector corresponding to block blockRowIndex. More...
 

Additional Inherited Members

- Protected Member Functions inherited from geosx::BlockVectorView< VECTOR >
void resize (localIndex const size)
 Resize to a new number of blocks. More...
 
void setPointer (localIndex i, VECTOR *vec)
 Set pointer to a vector. More...
 
 BlockVectorView (localIndex const nBlocks)
 Create a vector of nBlocks blocks. More...
 
 BlockVectorView (BlockVectorView const &)=default
 Copy constructor.
 
 BlockVectorView (BlockVectorView &&)=default
 Move constructor.
 

Detailed Description

template<typename VECTOR>
class geosx::BlockVector< VECTOR >

Concrete representation of a block vector.

Template Parameters
VECTORtype of sub-vectors

This extends BlockVectorView class by providing storage for sub-block vectors. The VECTOR type needs to be default-constructible.

Definition at line 35 of file BlockVector.hpp.

Constructor & Destructor Documentation

◆ BlockVector() [1/4]

template<typename VECTOR>
geosx::BlockVector< VECTOR >::BlockVector ( localIndex const  nBlocks)
inlineexplicit

Create a vector of nBlocks blocks.

Parameters
nBlocksNumber of blocks

Definition at line 46 of file BlockVector.hpp.

◆ BlockVector() [2/4]

template<typename VECTOR>
geosx::BlockVector< VECTOR >::BlockVector ( BlockVector< VECTOR > const &  rhs)
inline

Copy constructor that performs a deep copy of each sub-vector.

Parameters
rhsthe block vector to copy

Definition at line 64 of file BlockVector.hpp.

◆ BlockVector() [3/4]

template<typename VECTOR>
geosx::BlockVector< VECTOR >::BlockVector ( BlockVector< VECTOR > &&  rhs)
inline

Move constructor.

Parameters
rhsthe block vector to move from

Definition at line 75 of file BlockVector.hpp.

◆ BlockVector() [4/4]

template<typename VECTOR>
geosx::BlockVector< VECTOR >::BlockVector ( BlockVectorView< VECTOR > const &  rhs)
inlineexplicit

Conversion constructor from a compatible view with a deep copy of each sub-vector.

Parameters
rhsthe block vector view to copy from
Note
declared explicit to avoid unintended deep copying

Definition at line 87 of file BlockVector.hpp.

Member Function Documentation

◆ operator=() [1/2]

template<typename VECTOR>
BlockVector& geosx::BlockVector< VECTOR >::operator= ( BlockVector< VECTOR > const &  x)
inline

Copy assignment.

Parameters
xthe vector to copy
Returns
reference to this

Definition at line 102 of file BlockVector.hpp.

◆ operator=() [2/2]

template<typename VECTOR>
BlockVector& geosx::BlockVector< VECTOR >::operator= ( BlockVector< VECTOR > &&  x)
inlinenoexcept

Move assignment.

Parameters
xthe vector to move from
Returns
reference to this

Definition at line 114 of file BlockVector.hpp.

◆ resize()

template<typename VECTOR>
void geosx::BlockVector< VECTOR >::resize ( localIndex const  nBlocks)
inline

Resize to a different number of blocks.

Parameters
nBlocksthe new number of blocks
Note
If the new number of blocks is larger than the previous, new vectors will not be initialized. It is the user's responsibility to do that.

Definition at line 133 of file BlockVector.hpp.


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