ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
Public Types | Public Member Functions | List of all members
ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length > Class Template Reference

#include <source/multicomponent_vector.h>

Inheritance diagram for ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >:
Inheritance graph
[legend]
Collaboration diagram for ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >:
Collaboration graph
[legend]

Public Types

using VectorizedArray = dealii::VectorizedArray< Number, simd_length >
 
using ScalarVector = dealii::LinearAlgebra::distributed::Vector< Number >
 

Public Member Functions

void reinit_with_scalar_partitioner (const std::shared_ptr< const dealii::Utilities::MPI::Partitioner > &scalar_partitioner)
 
void extract_component (ScalarVector &scalar_vector, unsigned int component) const
 
void insert_component (const ScalarVector &scalar_vector, unsigned int component)
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
Tensor get_tensor (const unsigned int i) const
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
Tensor get_tensor (const unsigned int *js) const
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
void write_tensor (const Tensor &tensor, const unsigned int i)
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
void add_tensor (const Tensor &tensor, const unsigned int i)
 

Detailed Description

template<typename Number, int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
class ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >

A wrapper around dealii::LinearAlgebra::distributed::Vector<Number> that stores a vector element of n_comp components per entry (instead of a scalar value).

Note
reinit() has to be called with an appropriate "vector" MPI partitioner created by create_vector_partitioner().

Definition at line 58 of file multicomponent_vector.h.

Member Typedef Documentation

◆ VectorizedArray

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
using ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::VectorizedArray = dealii::VectorizedArray<Number, simd_length>

Shorthand typedef for the underlying dealii::VectorizedArray type used to insert and extract SIMD packed values from the MultiComponentVector.

Definition at line 67 of file multicomponent_vector.h.

◆ ScalarVector

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
using ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::ScalarVector = dealii::LinearAlgebra::distributed::Vector<Number>

Shorthand typedef for the underlying scalar dealii::LinearAlgebra::distributed::Vector<Number> used to insert and extract a single component of the MultiComponentVector.

Definition at line 74 of file multicomponent_vector.h.

Member Function Documentation

◆ reinit_with_scalar_partitioner()

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
void ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::reinit_with_scalar_partitioner ( const std::shared_ptr< const dealii::Utilities::MPI::Partitioner > &  scalar_partitioner)

Reinitializes the MultiComponentVector with a scalar MPI partitioner. The function calls create_vector_partitioner() internally to create and store a corresponding "vector" MPI partitioner.

◆ extract_component()

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
void ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::extract_component ( ScalarVector scalar_vector,
unsigned int  component 
) const

Extracts a single component out of the MultiComponentVector and stores it in scalar_vector. The destination vector must have a compatible corresponding (scalar) MPI partitioner, i.e., the "local size", the number of locally owned elements, has to match.

The function calls scalar_vector.update_ghost_values() before returning.

Note
This function is used in the VTUOutput module to unpack a single component out of our custom MultiComponentVector in order to call deal.II specific functions (that can only operate on scalar vectors).

◆ insert_component()

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
void ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::insert_component ( const ScalarVector scalar_vector,
unsigned int  component 
)

Inserts a single component into a MultiComponentVector. The source vector must have a compatible corresponding (scalar) MPI partitioner, i.e., the "local size", the number of locally owned elements, has to match.

The function does not call update_ghost_values() automatically. This has to be done by the user once all components are updated.

Note
This function is used in InitialValues to populate all components of the initial state that are returned component wise as single scalar vectors by deal.II interpolation functions.

◆ get_tensor() [1/2]

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
Tensor ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::get_tensor ( const unsigned int  i) const

Return a dealii::Tensor populated with the n_comp component vector stored at index i.

If the template parameter Number2 is a VectorizedArray then the function returns a SIMD vectorized dealii::Tensor populated with entries from the n_comp component vectors stored at indices i, i+1, ..., i+simd_length-1.

◆ get_tensor() [2/2]

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
Tensor ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::get_tensor ( const unsigned int *  js) const

Variant of above function.

Returns a SIMD vectorized dealii::Tensor populated with entries from the n_comp component vectors stored at indices *(js), *(js+1), ..., *(js+simd_length-1), i.e., js has to point to an array of size simd_length containing all indices.

◆ write_tensor()

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
void ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::write_tensor ( const Tensor &  tensor,
const unsigned int  i 
)

Update the values of the n_comp component vector at index i with the values supplied by tensor.

If the template parameter Number2 is a VectorizedArray then the function takes a SIMD vectorized tensor as argument instead and updates the values of the n_comp component vectors at indices i, i+1, ..., i+simd_length_1. with the values supplied by tensor.

Note
tensor can be an arbitrary indexable container, such as dealii::Tensor or std::array, that has an operator[]() returning a Number, and has a type trait value_type.

◆ add_tensor()

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
void ryujin::Vectors::MultiComponentVector< Number, n_comp, simd_length >::add_tensor ( const Tensor &  tensor,
const unsigned int  i 
)

Update the values of the n_comp component vector at index i by adding the values supplied by tensor.

If the template parameter Number2 is a VectorizedArray then the function takes a SIMD vectorized tensor as argument instead and updates the values of the n_comp component vectors at indices i, i+1, ..., i+simd_length_1. with the values supplied by tensor.

Note
tensor can be an arbitrary indexable container, such as dealii::Tensor or std::array, that has an operator[]() returning a Number, and has a type trait value_type.

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