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

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

#include <vector_q1.hpp>

Public Types

using ScalarType = ScalarT
 Scalar type of the vector.
 

Public Member Functions

 VectorQ1Vec ()=default
 Default constructor.
 
 VectorQ1Vec (const std::string &label, const grid::shell::DistributedDomain &distributed_domain, const grid::Grid4DDataScalar< grid::NodeOwnershipFlag > &mask_data)
 Construct a Q1 vector with label, domain, and mask data.
 
void lincomb_impl (const std::vector< ScalarType > &c, const std::vector< VectorQ1Vec > &x, const ScalarType c0)
 Linear combination implementation for VectorLike concept. Computes: \( y = c_0 + \sum_i c_i x_i \).
 
ScalarType dot_impl (const VectorQ1Vec &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 VectorQ1Vec &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/inf.
 
void swap_impl (VectorQ1Vec &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.
 
const grid::Grid4DDataScalar< grid::NodeOwnershipFlag > & mask_data () const
 Get const reference to mask data.
 
grid::Grid4DDataScalar< grid::NodeOwnershipFlag > & mask_data ()
 Get mutable reference to mask data.
 

Static Public Attributes

static const int Dim = VecDim
 Dimension of the vector field.
 

Detailed Description

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

Static assertion: VectorQ1Scalar satisfies VectorLike concept.

Q1 vector finite element vector on a distributed shell grid.

Same layout as required for tensor-product wedge elements.

Satisfies the VectorLike concept (see vector.hpp). Provides masked grid data and operations for vector fields.

Member Typedef Documentation

◆ ScalarType

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

Scalar type of the vector.

Constructor & Destructor Documentation

◆ VectorQ1Vec() [1/2]

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

Default constructor.

◆ VectorQ1Vec() [2/2]

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

Construct a Q1 vector with label, domain, and mask data.

Parameters
labelName for the vector.
distributed_domainDistributed shell domain.
mask_dataMask data grid.

Member Function Documentation

◆ dot_impl()

template<typename ScalarT , int VecDim = 3>
ScalarType terra::linalg::VectorQ1Vec< ScalarT, VecDim >::dot_impl ( const VectorQ1Vec< 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::VectorQ1Vec< 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::VectorQ1Vec< 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::VectorQ1Vec< 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/inf.

Returns
True if NaN/inf is present.

◆ invert_entries_impl()

template<typename ScalarT , int VecDim = 3>
void terra::linalg::VectorQ1Vec< 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::VectorQ1Vec< ScalarT, VecDim >::lincomb_impl ( const std::vector< ScalarType > &  c,
const std::vector< VectorQ1Vec< 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.

◆ mask_data() [1/2]

template<typename ScalarT , int VecDim = 3>
grid::Grid4DDataScalar< grid::NodeOwnershipFlag > & terra::linalg::VectorQ1Vec< ScalarT, VecDim >::mask_data ( )
inline

Get mutable reference to mask data.

◆ mask_data() [2/2]

template<typename ScalarT , int VecDim = 3>
const grid::Grid4DDataScalar< grid::NodeOwnershipFlag > & terra::linalg::VectorQ1Vec< ScalarT, VecDim >::mask_data ( ) const
inline

Get const reference to mask data.

◆ max_abs_entry_impl()

template<typename ScalarT , int VecDim = 3>
ScalarType terra::linalg::VectorQ1Vec< 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::VectorQ1Vec< 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::VectorQ1Vec< ScalarT, VecDim >::scale_with_vector_impl ( const VectorQ1Vec< 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::VectorQ1Vec< ScalarT, VecDim >::swap_impl ( VectorQ1Vec< ScalarT, VecDim > &  other)
inline

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

Parameters
otherOther vector.

Member Data Documentation

◆ Dim

template<typename ScalarT , int VecDim = 3>
const int terra::linalg::VectorQ1Vec< ScalarT, VecDim >::Dim = VecDim
static

Dimension of the vector field.


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