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

Abstract view of a block vector. More...

#include <BlockVectorView.hpp>

Inheritance diagram for geos::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)
 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 geos::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 37 of file BlockVectorView.hpp.

Constructor & Destructor Documentation

◆ BlockVectorView()

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

Create a vector of nBlocks blocks.

Parameters
nBlocksnumber of blocks

Definition at line 220 of file BlockVectorView.hpp.

Member Function Documentation

◆ axpby()

template<typename VECTOR >
void geos::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 345 of file BlockVectorView.hpp.

◆ axpy()

template<typename VECTOR >
void geos::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 334 of file BlockVectorView.hpp.

◆ block() [1/2]

template<typename VECTOR >
VECTOR& geos::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 182 of file BlockVectorView.hpp.

◆ block() [2/2]

template<typename VECTOR >
VECTOR const& geos::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 173 of file BlockVectorView.hpp.

◆ blockSize()

template<typename VECTOR >
localIndex geos::BlockVectorView< VECTOR >::blockSize

Get block size.

Returns
The block size.

Definition at line 357 of file BlockVectorView.hpp.

◆ copy()

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

Update vector y as y = x.

Parameters
srcthe vector to copy

Definition at line 262 of file BlockVectorView.hpp.

◆ dot()

template<typename VECTOR >
real64 geos::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 299 of file BlockVectorView.hpp.

◆ globalSize()

template<typename VECTOR >
globalIndex geos::BlockVectorView< VECTOR >::globalSize

Get global size.

Returns
The global size.

Definition at line 363 of file BlockVectorView.hpp.

◆ localSize()

template<typename VECTOR >
localIndex geos::BlockVectorView< VECTOR >::localSize

Get local size.

Returns
The local size.

Definition at line 374 of file BlockVectorView.hpp.

◆ norm2()

template<typename VECTOR >
real64 geos::BlockVectorView< VECTOR >::norm2

2-norm of the block vector.

Returns
2-norm of the block vector

Definition at line 311 of file BlockVectorView.hpp.

◆ normInf()

template<typename VECTOR >
real64 geos::BlockVectorView< VECTOR >::normInf

Inf-norm of the block vector.

Returns
inf-norm of the block vector

Definition at line 323 of file BlockVectorView.hpp.

◆ operator()() [1/2]

template<typename VECTOR >
VECTOR& geos::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 199 of file BlockVectorView.hpp.

◆ operator()() [2/2]

template<typename VECTOR >
VECTOR const& geos::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 191 of file BlockVectorView.hpp.

◆ operator=() [1/2]

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

Deleted move assignment.

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

◆ operator=() [2/2]

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

Deleted copy assignment.

Parameters
rhsthe block vector to copy
Returns
reference to this object

◆ print()

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

Print the block vector.

Parameters
osthe stream to print to

Definition at line 385 of file BlockVectorView.hpp.

◆ rand()

template<typename VECTOR >
void geos::BlockVectorView< VECTOR >::rand ( unsigned const  seed)

Set vector elements to random entries.

Parameters
seedthe random seed to use

Definition at line 290 of file BlockVectorView.hpp.

◆ resize()

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

Resize to a new number of blocks.

Parameters
sizethe new size

Definition at line 240 of file BlockVectorView.hpp.

◆ scale()

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

Scale the block vector with factor.

Parameters
factormultiplication factor

Definition at line 272 of file BlockVectorView.hpp.

◆ setPointer()

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

Set pointer to a vector.

Parameters
iindex of vector
vecnew pointer to vector

Definition at line 250 of file BlockVectorView.hpp.


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