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

#include <source/multicomponent_vector.h>

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

Public Types

using VectorizedArray = dealii::VectorizedArray< Number, simd_length >
 
using scalar_type = 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 (scalar_type &scalar_vector, unsigned int component) const
 
void insert_component (const scalar_type &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)
 

Detailed Description

template<typename Number, int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
class ryujin::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 56 of file multicomponent_vector.h.

Member Typedef Documentation

◆ VectorizedArray

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
using ryujin::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 65 of file multicomponent_vector.h.

◆ scalar_type

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
using ryujin::MultiComponentVector< Number, n_comp, simd_length >::scalar_type = 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 72 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::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.

Referenced by ryujin::InitialValues< Description, dim, Number >::interpolate_precomputed_initial_values(), and ryujin::TimeLoop< Description, dim, Number >::output().

◆ extract_component()

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
void ryujin::MultiComponentVector< Number, n_comp, simd_length >::extract_component ( scalar_type 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).

Referenced by ryujin::TimeLoop< Description, dim, Number >::compute_error(), ryujin::SolutionTransfer< Description, dim, Number >::prepare_for_interpolation(), ryujin::VTUOutput< ryujin::Euler::Description, dim, double >::VTUOutput(), and ryujin::Checkpointing::write_checkpoint().

◆ insert_component()

template<typename Number , int n_comp, int simd_length = dealii::VectorizedArray<Number>::size()>
void ryujin::MultiComponentVector< Number, n_comp, simd_length >::insert_component ( const scalar_type 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.

Referenced by ryujin::InitialValues< Description, dim, Number >::interpolate(), ryujin::SolutionTransfer< Description, dim, Number >::interpolate(), ryujin::InitialValues< Description, dim, Number >::interpolate_precomputed_initial_values(), and ryujin::Checkpointing::load_state_vector().

◆ 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::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.

Referenced by ryujin::InitialValues< Description, dim, Number >::interpolate().

◆ 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::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::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.

Referenced by ryujin::InitialValues< Description, dim, Number >::interpolate(), and ryujin::TimeLoop< Description, dim, Number >::run().


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