Loading...
Searching...
No Matches
terra::linalg::VectorFVVec< ScalarT, VecDim > Class Template Reference

Static assertion: VectorQ1Scalar satisfies VectorLike concept. More...

#include <vector_fv.hpp>

Public Types

using ScalarType = ScalarT
 Scalar type of the vector.
 

Public Member Functions

 VectorFVVec ()=default
 Default constructor.
 
 VectorFVVec (const std::string &label, const grid::shell::DistributedDomain &distributed_domain)
 Construct a scalar finite volume vector with label and domain.
 
void lincomb_impl (const std::vector< ScalarType > &c, const std::vector< VectorFVVec > &x, const ScalarType c0)
 Linear combination implementation for VectorLike concept. Computes: \( y = c_0 + \sum_i c_i x_i \).
 
ScalarType dot_impl (const VectorFVVec &x) const
 Dot product implementation for VectorLike concept. Computes: \( \sum_{i} y_i \cdot x_i \) over owned nodes.
 
void invert_entries_impl ()
 Invert entries implementation for VectorLike concept. Computes: \( y_i = 1 / y_i \).
 
void scale_with_vector_impl (const VectorFVVec &x)
 Elementwise scaling implementation for VectorLike concept. Computes: \( y_i = y_i \cdot x_i \).
 
void randomize_impl ()
 Randomize entries implementation for VectorLike concept. Sets each entry of grid_data to a random value.
 
ScalarType max_abs_entry_impl () const
 Max absolute entry implementation for VectorLike concept. Computes: \( \max_i |y_i| \).
 
bool has_nan_or_inf_impl () const
 NaN/Inf check implementation for VectorLike concept. Returns true if any entry of grid_data is NaN or inf.
 
void swap_impl (VectorFVVec &other)
 Swap implementation for VectorLike concept. Exchanges grid_data and mask_data with another vector.
 
const grid::Grid4DDataVec< ScalarType, VecDim > & grid_data () const
 Get const reference to grid data.
 
grid::Grid4DDataVec< ScalarType, VecDim > & grid_data ()
 Get mutable reference to grid data.
 
MPI_Comm comm () const
 MPI communicator this vector's reductions run on.
 

Detailed Description

template<typename ScalarT, int VecDim = 3>
class terra::linalg::VectorFVVec< ScalarT, VecDim >

Static assertion: VectorQ1Scalar satisfies VectorLike concept.

Finite volume vector on distributed shell grid with one DoF per hex (merging 2 wedges) and ghost-layer in all directions.

Only non-ghost-layer cells can be expected to be up-to-date. Unlike nodal grids, communication has to be executed first in general, before running kernels (if ghost-layer data is required).

Satisfies the VectorLike concept (see vector.hpp). Provides operations for vector fields.

Member Typedef Documentation

◆ ScalarType

template<typename ScalarT , int VecDim = 3>
using terra::linalg::VectorFVVec< ScalarT, VecDim >::ScalarType = ScalarT

Scalar type of the vector.

Constructor & Destructor Documentation

◆ VectorFVVec() [1/2]

template<typename ScalarT , int VecDim = 3>
terra::linalg::VectorFVVec< ScalarT, VecDim >::VectorFVVec ( )
default

Default constructor.

◆ VectorFVVec() [2/2]

template<typename ScalarT , int VecDim = 3>
terra::linalg::VectorFVVec< ScalarT, VecDim >::VectorFVVec ( const std::string &  label,
const grid::shell::DistributedDomain distributed_domain 
)
inline

Construct a scalar finite volume vector with label and domain.

Parameters
labelName for the vector.
distributed_domainDistributed shell domain.

Member Function Documentation

◆ comm()

template<typename ScalarT , int VecDim = 3>
MPI_Comm terra::linalg::VectorFVVec< ScalarT, VecDim >::comm ( ) const
inline

MPI communicator this vector's reductions run on.

◆ dot_impl()

template<typename ScalarT , int VecDim = 3>
ScalarType terra::linalg::VectorFVVec< ScalarT, VecDim >::dot_impl ( const VectorFVVec< ScalarT, VecDim > &  x) const
inline

Dot product implementation for VectorLike concept. Computes: \( \sum_{i} y_i \cdot x_i \) over owned nodes.

Parameters
xOther vector.
Returns
Dot product value.

◆ grid_data() [1/2]

template<typename ScalarT , int VecDim = 3>
grid::Grid4DDataVec< ScalarType, VecDim > & terra::linalg::VectorFVVec< ScalarT, VecDim >::grid_data ( )
inline

Get mutable reference to grid data.

◆ grid_data() [2/2]

template<typename ScalarT , int VecDim = 3>
const grid::Grid4DDataVec< ScalarType, VecDim > & terra::linalg::VectorFVVec< ScalarT, VecDim >::grid_data ( ) const
inline

Get const reference to grid data.

◆ has_nan_or_inf_impl()

template<typename ScalarT , int VecDim = 3>
bool terra::linalg::VectorFVVec< ScalarT, VecDim >::has_nan_or_inf_impl ( ) const
inline

NaN/Inf check implementation for VectorLike concept. Returns true if any entry of grid_data is NaN or inf.

Returns
True if NaN or inf is present.

◆ invert_entries_impl()

template<typename ScalarT , int VecDim = 3>
void terra::linalg::VectorFVVec< ScalarT, VecDim >::invert_entries_impl ( )
inline

Invert entries implementation for VectorLike concept. Computes: \( y_i = 1 / y_i \).

◆ lincomb_impl()

template<typename ScalarT , int VecDim = 3>
void terra::linalg::VectorFVVec< ScalarT, VecDim >::lincomb_impl ( const std::vector< ScalarType > &  c,
const std::vector< VectorFVVec< ScalarT, VecDim > > &  x,
const ScalarType  c0 
)
inline

Linear combination implementation for VectorLike concept. Computes: \( y = c_0 + \sum_i c_i x_i \).

Parameters
cCoefficients.
xInput vectors.
c0Scalar to add.

◆ max_abs_entry_impl()

template<typename ScalarT , int VecDim = 3>
ScalarType terra::linalg::VectorFVVec< ScalarT, VecDim >::max_abs_entry_impl ( ) const
inline

Max absolute entry implementation for VectorLike concept. Computes: \( \max_i |y_i| \).

Returns
Maximum absolute value.

◆ randomize_impl()

template<typename ScalarT , int VecDim = 3>
void terra::linalg::VectorFVVec< ScalarT, VecDim >::randomize_impl ( )
inline

Randomize entries implementation for VectorLike concept. Sets each entry of grid_data to a random value.

◆ scale_with_vector_impl()

template<typename ScalarT , int VecDim = 3>
void terra::linalg::VectorFVVec< ScalarT, VecDim >::scale_with_vector_impl ( const VectorFVVec< ScalarT, VecDim > &  x)
inline

Elementwise scaling implementation for VectorLike concept. Computes: \( y_i = y_i \cdot x_i \).

Parameters
xScaling vector.

◆ swap_impl()

template<typename ScalarT , int VecDim = 3>
void terra::linalg::VectorFVVec< ScalarT, VecDim >::swap_impl ( VectorFVVec< ScalarT, VecDim > &  other)
inline

Swap implementation for VectorLike concept. Exchanges grid_data and mask_data with another vector.

Parameters
otherOther vector.

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