Opm::Linear::TpsaVector< ScalarT > Class Template Reference

Vector type for TPSA linear elasticity. More...

#include <TpsaVector.hpp>

Classes

class  EntryProxy
 Mutable reference to the seven equations of a single cell. More...
 

Public Types

using Scalar = ScalarT
 Field type of the vector entries. More...
 
using field_type = ScalarT
 Field type of the vector entries. More...
 
using EqVector = Dune::FieldVector< Scalar, numTpsaEq >
 Dense block holding the seven equations of a single cell. More...
 
using block_type = EqVector
 Dense block holding the seven equations of a single cell. More...
 
using IstlVector = TpsaMultiVector< Scalar >
 What the linear solver operates on. More...
 
using size_type = std::size_t
 Type used for sizes and indices. More...
 

Public Member Functions

 TpsaVector ()=default
 Construct an empty vector; call resize() before use. More...
 
 TpsaVector (std::size_t numDof)
 Construct a vector sized for the given number of cells. More...
 
void resize (std::size_t numDof)
 Resize every sub-vector to the given number of cells. More...
 
std::size_t size () const
 Number of cells the vector holds equations for. More...
 
std::size_t N () const
 Number of cells the vector holds equations for. More...
 
TpsaVectoroperator= (Scalar value)
 Set every entry of every field to a scalar. More...
 
TpsaVectoroperator+= (const TpsaVector &other)
 Add another vector field by field. More...
 
TpsaVectoroperator-= (const TpsaVector &other)
 Subtract another vector field by field. More...
 
TpsaVectoroperator*= (Scalar factor)
 Scale every entry of every field. More...
 
void scaleFields (const std::array< Scalar, numTpsaFields > &factors)
 Multiply each field by factor. More...
 
Scalar one_norm () const
 Sum of the absolute values of all entries. More...
 
Scalar two_norm2 () const
 Sum of the squares of all entries. More...
 
Scalar two_norm () const
 Euclidean norm of the vector. More...
 
Scalar infinity_norm () const
 Largest absolute value over all entries. More...
 
EqVector operator[] (std::size_t dofIdx) const
 The seven equations of cell dofIdx, gathered into a dense block. More...
 
EntryProxy operator[] (std::size_t dofIdx)
 Writable handle on the seven equations of cell dofIdx. More...
 
IstlVectoristlVector ()
 The underlying multi-type vector handed to the linear solver. More...
 
const IstlVectoristlVector () const
 The underlying multi-type vector handed to the linear solver. More...
 

Detailed Description

template<class ScalarT>
class Opm::Linear::TpsaVector< ScalarT >

Vector type for TPSA linear elasticity.

Companion to TpsaMatrix class. This is a wrapper around Dune::MultiTypeBlockVector type to distribute a 7x1 dense vector to sub-vector fields corresponding to the sub-matrix fields in TpsaMatrix

Template Parameters
ScalarTField type of the vector entries.

Member Typedef Documentation

◆ block_type

template<class ScalarT >
using Opm::Linear::TpsaVector< ScalarT >::block_type = EqVector

Dense block holding the seven equations of a single cell.

◆ EqVector

template<class ScalarT >
using Opm::Linear::TpsaVector< ScalarT >::EqVector = Dune::FieldVector<Scalar, numTpsaEq>

Dense block holding the seven equations of a single cell.

◆ field_type

template<class ScalarT >
using Opm::Linear::TpsaVector< ScalarT >::field_type = ScalarT

Field type of the vector entries.

◆ IstlVector

template<class ScalarT >
using Opm::Linear::TpsaVector< ScalarT >::IstlVector = TpsaMultiVector<Scalar>

What the linear solver operates on.

◆ Scalar

template<class ScalarT >
using Opm::Linear::TpsaVector< ScalarT >::Scalar = ScalarT

Field type of the vector entries.

◆ size_type

template<class ScalarT >
using Opm::Linear::TpsaVector< ScalarT >::size_type = std::size_t

Type used for sizes and indices.

Constructor & Destructor Documentation

◆ TpsaVector() [1/2]

template<class ScalarT >
Opm::Linear::TpsaVector< ScalarT >::TpsaVector ( )
default

Construct an empty vector; call resize() before use.

◆ TpsaVector() [2/2]

template<class ScalarT >
Opm::Linear::TpsaVector< ScalarT >::TpsaVector ( std::size_t  numDof)
inlineexplicit

Construct a vector sized for the given number of cells.

Parameters
[in]numDofNumber of degrees of freedom, i.e. cells.

References Opm::Linear::TpsaVector< ScalarT >::resize().

Member Function Documentation

◆ infinity_norm()

template<class ScalarT >
Scalar Opm::Linear::TpsaVector< ScalarT >::infinity_norm ( ) const

Largest absolute value over all entries.

Returns
The infinity norm of the vector.

◆ istlVector() [1/2]

template<class ScalarT >
IstlVector & Opm::Linear::TpsaVector< ScalarT >::istlVector ( )
inline

The underlying multi-type vector handed to the linear solver.

Returns
Reference to the multi-type block vector holding the five sub-vectors.

◆ istlVector() [2/2]

template<class ScalarT >
const IstlVector & Opm::Linear::TpsaVector< ScalarT >::istlVector ( ) const
inline

The underlying multi-type vector handed to the linear solver.

Returns
Reference to the multi-type block vector holding the five sub-vectors.

◆ N()

template<class ScalarT >
std::size_t Opm::Linear::TpsaVector< ScalarT >::N ( ) const
inline

Number of cells the vector holds equations for.

Returns
Number of degrees of freedom.

◆ one_norm()

template<class ScalarT >
Scalar Opm::Linear::TpsaVector< ScalarT >::one_norm ( ) const

Sum of the absolute values of all entries.

Returns
The 1-norm of the vector.

◆ operator*=()

template<class ScalarT >
TpsaVector & Opm::Linear::TpsaVector< ScalarT >::operator*= ( Scalar  factor)

Scale every entry of every field.

Parameters
[in]factorFactor all entries are multiplied by.
Returns
Reference to this vector.

◆ operator+=()

template<class ScalarT >
TpsaVector & Opm::Linear::TpsaVector< ScalarT >::operator+= ( const TpsaVector< ScalarT > &  other)

Add another vector field by field.

Parameters
[in]otherVector added to this one. Must have the same size.
Returns
Reference to this vector.

◆ operator-=()

template<class ScalarT >
TpsaVector & Opm::Linear::TpsaVector< ScalarT >::operator-= ( const TpsaVector< ScalarT > &  other)

Subtract another vector field by field.

Parameters
[in]otherVector subtracted from this one. Must have the same size.
Returns
Reference to this vector.

◆ operator=()

template<class ScalarT >
TpsaVector & Opm::Linear::TpsaVector< ScalarT >::operator= ( Scalar  value)

Set every entry of every field to a scalar.

Parameters
[in]valueValue assigned to all entries.
Returns
Reference to this vector.

◆ operator[]() [1/2]

template<class ScalarT >
EntryProxy Opm::Linear::TpsaVector< ScalarT >::operator[] ( std::size_t  dofIdx)
inline

Writable handle on the seven equations of cell dofIdx.

Parameters
[in]dofIdxIndex of the cell.
Returns
Proxy scattering reads and writes over the five sub-vectors.

◆ operator[]() [2/2]

template<class ScalarT >
EqVector Opm::Linear::TpsaVector< ScalarT >::operator[] ( std::size_t  dofIdx) const

The seven equations of cell dofIdx, gathered into a dense block.

Parameters
[in]dofIdxIndex of the cell.
Returns
Dense block holding the seven equations of that cell.

◆ resize()

template<class ScalarT >
void Opm::Linear::TpsaVector< ScalarT >::resize ( std::size_t  numDof)

Resize every sub-vector to the given number of cells.

Parameters
[in]numDofNumber of degrees of freedom, i.e. cells.

Referenced by Opm::Linear::TpsaVector< ScalarT >::TpsaVector().

◆ scaleFields()

template<class ScalarT >
void Opm::Linear::TpsaVector< ScalarT >::scaleFields ( const std::array< Scalar, numTpsaFields > &  factors)

Multiply each field by factor.

The counterpart of TpsaMatrix::scaleFields().

Parameters
[in]factorsFactor for each field, in field order.
Note
Scales in place.

◆ size()

template<class ScalarT >
std::size_t Opm::Linear::TpsaVector< ScalarT >::size ( ) const
inline

Number of cells the vector holds equations for.

Returns
Number of degrees of freedom.

◆ two_norm()

template<class ScalarT >
Scalar Opm::Linear::TpsaVector< ScalarT >::two_norm ( ) const
inline

Euclidean norm of the vector.

Returns
The 2-norm of the vector.

References Opm::Linear::TpsaVector< ScalarT >::two_norm2().

◆ two_norm2()

template<class ScalarT >
Scalar Opm::Linear::TpsaVector< ScalarT >::two_norm2 ( ) const

Sum of the squares of all entries.

Returns
The squared 2-norm of the vector.

Referenced by Opm::Linear::TpsaVector< ScalarT >::two_norm().


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