Loading...
Searching...
No Matches
terra::linalg::VectorFVScalar< ScalarT > Class Template Reference

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

#include <vector_fv.hpp>

Public Types

using ScalarType = ScalarT
 Scalar type of the vector.
 

Public Member Functions

 VectorFVScalar ()=default
 Default constructor.
 
 VectorFVScalar (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< VectorFVScalar > &x, const ScalarType c0)
 Linear combination implementation for VectorLike concept. Computes: \( y = c_0 + \sum_i c_i x_i \).
 
ScalarType dot_impl (const VectorFVScalar &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 VectorFVScalar &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 (VectorFVScalar &other)
 Swap implementation for VectorLike concept. Exchanges grid_data and mask_data with another vector.
 
const grid::Grid4DDataScalar< ScalarType > & grid_data () const
 Get const reference to grid data.
 
grid::Grid4DDataScalar< ScalarType > & 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>
class terra::linalg::VectorFVScalar< ScalarT >

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 scalar fields.

Member Typedef Documentation

◆ ScalarType

template<typename ScalarT >
using terra::linalg::VectorFVScalar< ScalarT >::ScalarType = ScalarT

Scalar type of the vector.

Constructor & Destructor Documentation

◆ VectorFVScalar() [1/2]

template<typename ScalarT >
terra::linalg::VectorFVScalar< ScalarT >::VectorFVScalar ( )
default

Default constructor.

◆ VectorFVScalar() [2/2]

template<typename ScalarT >
terra::linalg::VectorFVScalar< ScalarT >::VectorFVScalar ( 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 >
MPI_Comm terra::linalg::VectorFVScalar< ScalarT >::comm ( ) const
inline

MPI communicator this vector's reductions run on.

◆ dot_impl()

template<typename ScalarT >
ScalarType terra::linalg::VectorFVScalar< ScalarT >::dot_impl ( const VectorFVScalar< ScalarT > &  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 >
grid::Grid4DDataScalar< ScalarType > & terra::linalg::VectorFVScalar< ScalarT >::grid_data ( )
inline

Get mutable reference to grid data.

◆ grid_data() [2/2]

template<typename ScalarT >
const grid::Grid4DDataScalar< ScalarType > & terra::linalg::VectorFVScalar< ScalarT >::grid_data ( ) const
inline

Get const reference to grid data.

◆ has_nan_or_inf_impl()

template<typename ScalarT >
bool terra::linalg::VectorFVScalar< ScalarT >::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 >
void terra::linalg::VectorFVScalar< ScalarT >::invert_entries_impl ( )
inline

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

◆ lincomb_impl()

template<typename ScalarT >
void terra::linalg::VectorFVScalar< ScalarT >::lincomb_impl ( const std::vector< ScalarType > &  c,
const std::vector< VectorFVScalar< ScalarT > > &  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 >
ScalarType terra::linalg::VectorFVScalar< ScalarT >::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 >
void terra::linalg::VectorFVScalar< ScalarT >::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 >
void terra::linalg::VectorFVScalar< ScalarT >::scale_with_vector_impl ( const VectorFVScalar< ScalarT > &  x)
inline

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

Parameters
xScaling vector.

◆ swap_impl()

template<typename ScalarT >
void terra::linalg::VectorFVScalar< ScalarT >::swap_impl ( VectorFVScalar< ScalarT > &  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: