ryujin 2.1.1 revision 71cbe157f0746717db03d7e1e977da66a7d7bfb5
Loading...
Searching...
No Matches
List of all members
ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable > Class Template Reference

#include <source/multicomponent_vector.h>

Public Types

Typedefs and constexpr constants
using ScalarVector = dealii::LinearAlgebra::distributed::Vector< Number, MemorySpace >
 

Public Member Functions

Constructor and initialization
 MultiComponentVectorView ()=default
 
 MultiComponentVectorView (MultiComponentVector< Number > &multi_component_vector)
 
 MultiComponentVectorView (const MultiComponentVector< Number > &multi_component_vector)
 
template<bool other_writable>
requires (!writable && other_writable)
DEAL_II_HOST_DEVICE MultiComponentVectorView (const MultiComponentVectorView< Number, n_comp, MemorySpace, other_writable > &other)
 
template<typename MultiComponentVector >
requires (writable != std::is_const_v<MultiComponentVector>)
void reinit (MultiComponentVector &multi_component_vector)
 
Extracting and inserting components
template<typename Functor = std::identity>
void extract_component (ScalarVector &scalar_vector, unsigned int component, const Functor &functor=std::identity{}) const
 
template<typename Functor = std::identity>
requires writable
void insert_component (const ScalarVector &scalar_vector, unsigned int component, const Functor &functor=std::identity{}) const
 
template<typename Functor = std::identity>
requires writable
void insert_component (const dealii::Vector< Number > &scalar_vector, unsigned int component, const Functor &functor=std::identity{}) const
 
Access to scalar or tensor-valued entries from various

contexts (scalar, SIMD, GPU):

template<typename Number2 = Number>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number2 read_entry (const unsigned int i) const
 
template<typename Number2 = Number>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number2 read_entry (const unsigned int *js) const
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor read_tensor (const unsigned int i) const
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor read_tensor (const unsigned int *js) const
 
template<typename Number2 = Number>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void write_entry (const Number2 &entry, const unsigned int i) const
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void write_tensor (const Tensor &tensor, const unsigned int i) const
 
template<typename Number2 = Number>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void add_entry (const Number2 &entry, const unsigned int i) const
 
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void add_tensor (const Tensor &tensor, const unsigned int i) const
 
MPI synchronization
void zero_out_ghost_values () const
 
void update_ghost_values () const
 
void compress (dealii::VectorOperation::values operation) const
 

Internal fields

template<typename , int , typename , bool >
class MultiComponentVectorView
 

Detailed Description

template<typename Number, int n_comp, typename MemorySpace, bool writable>
class ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >

A "view" of a MultiComponentVector that lives in the host or device memory space. It provides a number of methods for reading and writing scalar and tensor-valued entries.

Note
This class is designed to be captured by value in computation loops with access to either the host or device memory space. As such we do not store a reference to the underlying MultiComponentVector but rather raw pointers into the corresponding memory. The view is only valid as long as the underlying MultiComponentVector object is not modified.

Definition at line 259 of file multicomponent_vector.h.

Member Typedef Documentation

◆ ScalarVector

template<typename Number , int n_comp, typename MemorySpace , bool writable>
using ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::ScalarVector = dealii::LinearAlgebra::distributed::Vector<Number, MemorySpace>

Shorthand typedef for the underlying scalar deal.II vector used to insert and extract a single component of the MultiComponentVector.

Definition at line 335 of file multicomponent_vector.h.

Constructor & Destructor Documentation

◆ MultiComponentVectorView() [1/4]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::MultiComponentVectorView ( )
default

◆ MultiComponentVectorView() [2/4]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::MultiComponentVectorView ( MultiComponentVector< Number > &  multi_component_vector)
inline

Definition at line 269 of file multicomponent_vector.h.

◆ MultiComponentVectorView() [3/4]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::MultiComponentVectorView ( const MultiComponentVector< Number > &  multi_component_vector)
inline

Definition at line 276 of file multicomponent_vector.h.

◆ MultiComponentVectorView() [4/4]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<bool other_writable>
requires (!writable && other_writable)
DEAL_II_HOST_DEVICE ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::MultiComponentVectorView ( const MultiComponentVectorView< Number, n_comp, MemorySpace, other_writable > &  other)
inline

Converting constructor creating a read only view from a writable view (mirroring the conversion from T * to const T *).

Note
We need to make this a templated constructor, otherwise the writable-converting constructor here would suppress the default copy constructor.

Definition at line 292 of file multicomponent_vector.h.

Member Function Documentation

◆ reinit()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename MultiComponentVector >
requires (writable != std::is_const_v<MultiComponentVector>)
void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::reinit ( MultiComponentVector &  multi_component_vector)
inline

Definition at line 306 of file multicomponent_vector.h.

◆ extract_component()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Functor = std::identity>
void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::extract_component ( ScalarVector &  scalar_vector,
unsigned int  component,
const Functor &  functor = std::identity{} 
) const
inline

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.

Optionally, a third argument functor can be supplied that is applied to each (scalar) value individually before stored in scalar_vector.

Note
The operation is performed on the memory space of the view. Correspondingly, functor has to be callable on the selected memory space.
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).

Definition at line 367 of file multicomponent_vector.h.

◆ insert_component() [1/2]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Functor = std::identity>
requires writable
void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::insert_component ( const ScalarVector &  scalar_vector,
unsigned int  component,
const Functor &  functor = std::identity{} 
) const
inline

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.

Optionally, a third argument functor can be supplied that is applied to each (scalar) value individually before stored in the corresponding component.

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.

Definition at line 414 of file multicomponent_vector.h.

◆ insert_component() [2/2]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Functor = std::identity>
requires writable
void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::insert_component ( const dealii::Vector< Number > &  scalar_vector,
unsigned int  component,
const Functor &  functor = std::identity{} 
) const
inline

Variant of the method above that reads values out of a dealii::Vector in (rank-) local numbering.

Definition at line 444 of file multicomponent_vector.h.

◆ read_entry() [1/2]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number2 ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::read_entry ( const unsigned int  i) const
inline

Return the entry indexed by 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+n-1, where n is the SIMD width.

Note
This function is only available if n_comp is equal to 1.

Definition at line 487 of file multicomponent_vector.h.

◆ read_entry() [2/2]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Number2 ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::read_entry ( const unsigned int *  js) const
inline

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+n-1), i.e., js has to point to an array of size n (the SIMD width) containing all indices.

Note
This function is only available if n_comp is equal to 1.

Definition at line 511 of file multicomponent_vector.h.

◆ read_tensor() [1/2]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::read_tensor ( const unsigned int  i) const
inline

Return the tensor-valued entry indexed by i.

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

Definition at line 532 of file multicomponent_vector.h.

◆ read_tensor() [2/2]

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::read_tensor ( const unsigned int *  js) const
inline

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+n-1), i.e., js has to point to an array of size n (the SIMD width) containing all indices.

Definition at line 575 of file multicomponent_vector.h.

◆ write_entry()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::write_entry ( const Number2 &  entry,
const unsigned int  i 
) const
inline

Write a (scalar valued) entry to the vector at position by i.

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+n-1 (n being the SIMD width) with the values supplied by tensor.

Note
This function is only available if n_comp is equal to 1.

Definition at line 624 of file multicomponent_vector.h.

◆ write_tensor()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::write_tensor ( const Tensor &  tensor,
const unsigned int  i 
) const
inline

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+n-1 (n being the SIMD width) 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.

Definition at line 656 of file multicomponent_vector.h.

◆ add_entry()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::add_entry ( const Number2 &  entry,
const unsigned int  i 
) const
inline

Add a (scalar valued) entry to the vector at position 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+n-1 (n being the SIMD width) with the values supplied by tensor.

Note
This function is only available if n_comp is equal to 1.

Definition at line 677 of file multicomponent_vector.h.

◆ add_tensor()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>>
requires writable
DEAL_II_HOST_DEVICE_ALWAYS_INLINE void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::add_tensor ( const Tensor &  tensor,
const unsigned int  i 
) const
inline

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+n-1 (n being the SIMD width) 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.

Definition at line 710 of file multicomponent_vector.h.

◆ zero_out_ghost_values()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::zero_out_ghost_values ( ) const
inline

MPI synchronization: Zero out all ghost values stored in the vector.

Definition at line 725 of file multicomponent_vector.h.

◆ update_ghost_values()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::update_ghost_values ( ) const
inline

MPI synchronization: Import all ghost values from neighboring MPI ranks on the templated memory space.

Definition at line 739 of file multicomponent_vector.h.

◆ compress()

template<typename Number , int n_comp, typename MemorySpace , bool writable>
void ryujin::MultiComponentVectorView< Number, n_comp, MemorySpace, writable >::compress ( dealii::VectorOperation::values  operation) const
inline

MPI synchronization: Copy the data that has accumulated in the ghost range to the owning processor. This function operates on the templated memory space.

Definition at line 754 of file multicomponent_vector.h.

Friends And Related Symbol Documentation

◆ MultiComponentVectorView

template<typename Number , int n_comp, typename MemorySpace , bool writable>
template<typename , int , typename , bool >
friend class MultiComponentVectorView
friend

Definition at line 779 of file multicomponent_vector.h.


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