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

Block vector consisting of a Q1 vector and a Q1 scalar vector on distributed shell grids. More...

#include <vector_q1isoq2_q1.hpp>

Public Types

using ScalarType = ScalarT
 Scalar type of the block vector.
 
using Block1Type = VectorQ1Vec< ScalarType, VecDim >
 Type of the first block (vector field).
 
using Block2Type = VectorQ1Scalar< ScalarType >
 Type of the second block (scalar field).
 

Public Member Functions

 VectorQ1IsoQ2Q1 ()=default
 Default constructor.
 
 VectorQ1IsoQ2Q1 (const std::string &label, const grid::shell::DistributedDomain &distributed_domain_fine, const grid::shell::DistributedDomain &distributed_domain_coarse, const grid::Grid4DDataScalar< grid::NodeOwnershipFlag > &mask_data_fine, const grid::Grid4DDataScalar< grid::NodeOwnershipFlag > &mask_data_coarse)
 Construct a block vector with labels, domains, and mask data for both blocks.
 
void lincomb_impl (const std::vector< ScalarType > &c, const std::vector< VectorQ1IsoQ2Q1 > &x, const ScalarType c0)
 Linear combination implementation for Block2VectorLike concept. Computes: ( \text{block}_1 = c_0 + \sum_i c_i x_i.\text{block}_1 ), ( \text{block}_2 = c_0 + \sum_i c_i x_i.\text{block}_2 )
 
ScalarType dot_impl (const VectorQ1IsoQ2Q1 &x) const
 Dot product implementation for Block2VectorLike concept. Computes: ( \text{block}_1 \cdot x.\text{block}_1 + \text{block}_2 \cdot x.\text{block}_2 )
 
void invert_entries_impl ()
 Invert entries implementation for Block2VectorLike concept. Computes: ( \text{block}_1 = 1 / \text{block}_1 ), ( \text{block}_2 = 1 / \text{block}_2 )
 
void scale_with_vector_impl (const VectorQ1IsoQ2Q1 &x)
 Elementwise scaling implementation for Block2VectorLike concept. Computes: ( \text{block}_1 = \text{block}_1 \cdot x.\text{block}_1 ), ( \text{block}_2 = \text{block}_2 \cdot x.\text{block}_2 )
 
void randomize_impl ()
 Randomize entries implementation for Block2VectorLike concept. Sets each entry of both blocks to a random value.
 
ScalarType max_abs_entry_impl () const
 Max absolute entry implementation for Block2VectorLike concept. Computes: ( \max( \max_i |\text{block}_1|, \max_j |\text{block}_2| ) )
 
bool has_nan_or_inf_impl () const
 NaN/inf check implementation for Block2VectorLike concept. Returns true if any entry of either block is NaN/inf.
 
void swap_impl (VectorQ1IsoQ2Q1 &other)
 Swap implementation for Block2VectorLike concept. Exchanges the contents of both blocks with another block vector.
 
void add_mask_data (const grid::Grid4DDataScalar< unsigned char > &mask_data_block_1, const grid::Grid4DDataScalar< unsigned char > &mask_data_block_2)
 Add mask data to both blocks.
 
const Block1Typeblock_1 () const
 Get const reference to block 1 (vector field).
 
const Block2Typeblock_2 () const
 Get const reference to block 2 (scalar field).
 
Block1Typeblock_1 ()
 Get mutable reference to block 1 (vector field).
 
Block2Typeblock_2 ()
 Get mutable reference to block 2 (scalar field).
 

Detailed Description

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

Block vector consisting of a Q1 vector and a Q1 scalar vector on distributed shell grids.

Same layout as required for tensor-product wedge elements.

Satisfies the Block2VectorLike concept (see vector.hpp). Used for mixed finite element methods (e.g., Q1isoQ2-Q1).

Member Typedef Documentation

◆ Block1Type

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

Type of the first block (vector field).

◆ Block2Type

template<typename ScalarT , int VecDim = 3>
using terra::linalg::VectorQ1IsoQ2Q1< ScalarT, VecDim >::Block2Type = VectorQ1Scalar< ScalarType >

Type of the second block (scalar field).

◆ ScalarType

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

Scalar type of the block vector.

Constructor & Destructor Documentation

◆ VectorQ1IsoQ2Q1() [1/2]

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

Default constructor.

◆ VectorQ1IsoQ2Q1() [2/2]

template<typename ScalarT , int VecDim = 3>
terra::linalg::VectorQ1IsoQ2Q1< ScalarT, VecDim >::VectorQ1IsoQ2Q1 ( const std::string &  label,
const grid::shell::DistributedDomain distributed_domain_fine,
const grid::shell::DistributedDomain distributed_domain_coarse,
const grid::Grid4DDataScalar< grid::NodeOwnershipFlag > &  mask_data_fine,
const grid::Grid4DDataScalar< grid::NodeOwnershipFlag > &  mask_data_coarse 
)
inline

Construct a block vector with labels, domains, and mask data for both blocks.

Parameters
labelName for the vector.
distributed_domain_fineDistributed shell domain for the vector block.
distributed_domain_coarseDistributed shell domain for the scalar block.
mask_data_fineMask data for the vector block.
mask_data_coarseMask data for the scalar block.

Member Function Documentation

◆ add_mask_data()

template<typename ScalarT , int VecDim = 3>
void terra::linalg::VectorQ1IsoQ2Q1< ScalarT, VecDim >::add_mask_data ( const grid::Grid4DDataScalar< unsigned char > &  mask_data_block_1,
const grid::Grid4DDataScalar< unsigned char > &  mask_data_block_2 
)
inline

Add mask data to both blocks.

Parameters
mask_data_block_1Mask data for block 1.
mask_data_block_2Mask data for block 2.

◆ block_1() [1/2]

template<typename ScalarT , int VecDim = 3>
Block1Type & terra::linalg::VectorQ1IsoQ2Q1< ScalarT, VecDim >::block_1 ( )
inline

Get mutable reference to block 1 (vector field).

◆ block_1() [2/2]

template<typename ScalarT , int VecDim = 3>
const Block1Type & terra::linalg::VectorQ1IsoQ2Q1< ScalarT, VecDim >::block_1 ( ) const
inline

Get const reference to block 1 (vector field).

◆ block_2() [1/2]

template<typename ScalarT , int VecDim = 3>
Block2Type & terra::linalg::VectorQ1IsoQ2Q1< ScalarT, VecDim >::block_2 ( )
inline

Get mutable reference to block 2 (scalar field).

◆ block_2() [2/2]

template<typename ScalarT , int VecDim = 3>
const Block2Type & terra::linalg::VectorQ1IsoQ2Q1< ScalarT, VecDim >::block_2 ( ) const
inline

Get const reference to block 2 (scalar field).

◆ dot_impl()

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

Dot product implementation for Block2VectorLike concept. Computes: ( \text{block}_1 \cdot x.\text{block}_1 + \text{block}_2 \cdot x.\text{block}_2 )

Parameters
xOther block vector.
Returns
Dot product value.

◆ has_nan_or_inf_impl()

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

NaN/inf check implementation for Block2VectorLike concept. Returns true if any entry of either block is NaN/inf.

Returns
True if NaN/inf is present.

◆ invert_entries_impl()

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

Invert entries implementation for Block2VectorLike concept. Computes: ( \text{block}_1 = 1 / \text{block}_1 ), ( \text{block}_2 = 1 / \text{block}_2 )

◆ lincomb_impl()

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

Linear combination implementation for Block2VectorLike concept. Computes: ( \text{block}_1 = c_0 + \sum_i c_i x_i.\text{block}_1 ), ( \text{block}_2 = c_0 + \sum_i c_i x_i.\text{block}_2 )

Parameters
cCoefficients.
xInput block vectors.
c0Scalar to add.

◆ max_abs_entry_impl()

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

Max absolute entry implementation for Block2VectorLike concept. Computes: ( \max( \max_i |\text{block}_1|, \max_j |\text{block}_2| ) )

Returns
Maximum absolute value across both blocks.

◆ randomize_impl()

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

Randomize entries implementation for Block2VectorLike concept. Sets each entry of both blocks to a random value.

◆ scale_with_vector_impl()

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

Elementwise scaling implementation for Block2VectorLike concept. Computes: ( \text{block}_1 = \text{block}_1 \cdot x.\text{block}_1 ), ( \text{block}_2 = \text{block}_2 \cdot x.\text{block}_2 )

Parameters
xScaling block vector.

◆ swap_impl()

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

Swap implementation for Block2VectorLike concept. Exchanges the contents of both blocks with another block vector.

Parameters
otherOther block vector.

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