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

Abstract view of a block vector. More...

#include <BlockVectorView.hpp>

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

Public Types

using Vector = VECTOR
 Alias for sub-vector type.
 

Public Member Functions

Constructors
BlockVectorViewoperator= (BlockVectorView const &rhs)=delete
 Deleted copy assignment. More...
 
BlockVectorViewoperator= (BlockVectorView &&rhs) noexcept=delete
 Deleted move assignment. More...
 
virtual ~BlockVectorView ()=default
 Destructor.
 
Setters
void copy (BlockVectorView const &src)
 Update vector y as y = x. More...
 
Linear Algebra Operations
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...
 
Accessors
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...
 

Protected Member Functions

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...
 
Constructor/assignment Methods
Note
Protected to prevent users from creating/copying/moving base class objects. Derived classes should still use them to size/copy/move pointer array.
 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::BlockVectorView< VECTOR >

Abstract view of a block vector.

Template Parameters
VECTORtype of sub-vectors

This class does not deal with constructing or storing sub-vectors, only provides high-level access functions. See derived classes BlockVector and BlockVectorWrapper for ways to construct a block vector.

Definition at line 35 of file BlockVectorView.hpp.

Constructor & Destructor Documentation

◆ BlockVectorView()

template<typename VECTOR>
geosx::BlockVectorView< VECTOR >::BlockVectorView ( localIndex const  nBlocks)
inlineexplicitprotected

Create a vector of nBlocks blocks.

Parameters
nBlocksnumber of blocks

Definition at line 218 of file BlockVectorView.hpp.

Member Function Documentation

◆ axpby()

template<typename VECTOR >
void geosx::BlockVectorView< VECTOR >::axpby ( real64 const  alpha,
BlockVectorView< VECTOR > const &  x,
real64 const  beta 
)

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

Note
The naming convention follows the logic of the BLAS library.
Parameters
alphascaling factor for added vector
xvector to add
betascaling factor for self vector

Definition at line 343 of file BlockVectorView.hpp.

◆ axpy()

template<typename VECTOR >
void geosx::BlockVectorView< VECTOR >::axpy ( real64 const  alpha,
BlockVectorView< VECTOR > const &  x 
)

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

Note
The naming convention follows the logic of the BLAS library.
Parameters
alphascaling factor for added vector
xvector to add

Definition at line 332 of file BlockVectorView.hpp.

◆ block() [1/2]

template<typename VECTOR>
VECTOR const& geosx::BlockVectorView< VECTOR >::block ( localIndex const  blockIndex) const
inline

Get a reference to the vector corresponding to block blockRowIndex.

Parameters
blockIndexindex of the block to return
Returns
a reference to the sub-block

Definition at line 171 of file BlockVectorView.hpp.

◆ block() [2/2]

template<typename VECTOR>
VECTOR& geosx::BlockVectorView< VECTOR >::block ( localIndex const  blockIndex)
inline

Get a reference to the vector corresponding to block blockRowIndex.

Parameters
blockIndexindex of the block to return
Returns
a reference to the sub-block

Definition at line 180 of file BlockVectorView.hpp.

◆ blockSize()

template<typename VECTOR >
localIndex geosx::BlockVectorView< VECTOR >::blockSize ( ) const

Get block size.

Returns
The block size.

Definition at line 355 of file BlockVectorView.hpp.

◆ copy()

template<typename VECTOR >
void geosx::BlockVectorView< VECTOR >::copy ( BlockVectorView< VECTOR > const &  src)

Update vector y as y = x.

Parameters
srcthe vector to copy

Definition at line 260 of file BlockVectorView.hpp.

◆ dot()

template<typename VECTOR >
real64 geosx::BlockVectorView< VECTOR >::dot ( BlockVectorView< VECTOR > const &  x) const

Dot product.

Parameters
xthe block vector to compute product with
Returns
the dot product

Definition at line 297 of file BlockVectorView.hpp.

◆ globalSize()

template<typename VECTOR >
globalIndex geosx::BlockVectorView< VECTOR >::globalSize ( ) const

Get global size.

Returns
The global size.

Definition at line 361 of file BlockVectorView.hpp.

◆ localSize()

template<typename VECTOR >
localIndex geosx::BlockVectorView< VECTOR >::localSize ( ) const

Get local size.

Returns
The local size.

Definition at line 372 of file BlockVectorView.hpp.

◆ norm2()

template<typename VECTOR >
real64 geosx::BlockVectorView< VECTOR >::norm2 ( ) const

2-norm of the block vector.

Returns
2-norm of the block vector

Definition at line 309 of file BlockVectorView.hpp.

◆ normInf()

template<typename VECTOR >
real64 geosx::BlockVectorView< VECTOR >::normInf ( ) const

Inf-norm of the block vector.

Returns
inf-norm of the block vector

Definition at line 321 of file BlockVectorView.hpp.

◆ operator()() [1/2]

template<typename VECTOR>
VECTOR const& geosx::BlockVectorView< VECTOR >::operator() ( localIndex const  blockIndex) const
inline

Get a reference to the vector corresponding to block blockRowIndex.

Parameters
blockIndexindex of the block to return
Returns
a reference to the sub-block

Definition at line 189 of file BlockVectorView.hpp.

◆ operator()() [2/2]

template<typename VECTOR>
VECTOR& geosx::BlockVectorView< VECTOR >::operator() ( localIndex const  blockIndex)
inline

Get a reference to the vector corresponding to block blockRowIndex.

Parameters
blockIndexindex of the block to return
Returns
a reference to the sub-block

Definition at line 197 of file BlockVectorView.hpp.

◆ operator=() [1/2]

template<typename VECTOR>
BlockVectorView& geosx::BlockVectorView< VECTOR >::operator= ( BlockVectorView< VECTOR > const &  rhs)
delete

Deleted copy assignment.

Parameters
rhsthe block vector to copy
Returns
reference to this object

◆ operator=() [2/2]

template<typename VECTOR>
BlockVectorView& geosx::BlockVectorView< VECTOR >::operator= ( BlockVectorView< VECTOR > &&  rhs)
deletenoexcept

Deleted move assignment.

Parameters
rhsthe block vector to move from
Returns
reference to this object

◆ print()

template<typename VECTOR >
void geosx::BlockVectorView< VECTOR >::print ( std::ostream &  os = std::cout) const

Print the block vector.

Parameters
osthe stream to print to

Definition at line 383 of file BlockVectorView.hpp.

◆ rand()

template<typename VECTOR >
void geosx::BlockVectorView< VECTOR >::rand ( unsigned const  seed = 1984)

Set vector elements to random entries.

Parameters
seedthe random seed to use

Definition at line 288 of file BlockVectorView.hpp.

◆ resize()

template<typename VECTOR>
void geosx::BlockVectorView< VECTOR >::resize ( localIndex const  size)
inlineprotected

Resize to a new number of blocks.

Parameters
sizethe new size

Definition at line 238 of file BlockVectorView.hpp.

◆ scale()

template<typename VECTOR >
void geosx::BlockVectorView< VECTOR >::scale ( real64 const  factor)

Scale the block vector with factor.

Parameters
factormultiplication factor

Definition at line 270 of file BlockVectorView.hpp.

◆ setPointer()

template<typename VECTOR>
void geosx::BlockVectorView< VECTOR >::setPointer ( localIndex  i,
VECTOR *  vec 
)
inlineprotected

Set pointer to a vector.

Parameters
iindex of vector
vecnew pointer to vector

Definition at line 248 of file BlockVectorView.hpp.


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