![]() |
ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
|
#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, n_comp, simd_length > &multi_component_vector) | |
| MultiComponentVectorView (const MultiComponentVector< Number, n_comp, simd_length > &multi_component_vector) | |
| template<bool other_writable> requires (!writable && other_writable) | |
| DEAL_II_HOST_DEVICE | MultiComponentVectorView (const MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, other_writable > &other) |
| template<typename MultiComponentVector > requires (writable != std::is_const_v<MultiComponentVector>) | |
| void | reinit (MultiComponentVector &multi_component_vector) |
Extracting and inserting components, scaled addition | |
| 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 |
| void | sadd (const Number s, const Number a, const MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, false > &v) const |
Access to scalar or tensor-valued entries from various | |
contexts (scalar, SIMD, GPU): | |
| template<typename Number2 = Number> | |
| DEAL_II_HOST_DEVICE Number2 | read_entry (const unsigned int i) const |
| template<typename Number2 = Number> | |
| DEAL_II_HOST_DEVICE Number2 | read_entry (const unsigned int *js) const |
| template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>> | |
| DEAL_II_HOST_DEVICE Tensor | read_tensor (const unsigned int i) const |
| template<typename Number2 = Number, typename Tensor = dealii::Tensor<1, n_comp, Number2>> | |
| DEAL_II_HOST_DEVICE Tensor | read_tensor (const unsigned int *js) const |
| template<typename Number2 = Number> requires writable | |
| DEAL_II_HOST_DEVICE 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 void | write_tensor (const Tensor &tensor, const unsigned int i) const |
| template<typename Number2 = Number> requires writable | |
| DEAL_II_HOST_DEVICE 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 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 , int , typename , bool > | |
| class | MultiComponentVectorView |
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.
Definition at line 253 of file multicomponent_vector.h.
| using ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::ScalarVector = dealii::LinearAlgebra::distributed::Vector<Number, MemorySpace> |
Shorthand typedef for the underlying scalar dealii::LinearAlgebra::distributed::Vector<Number, MemorySpace> used to insert and extract a single component of the MultiComponentVector.
Definition at line 304 of file multicomponent_vector.h.
|
default |
| ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::MultiComponentVectorView | ( | MultiComponentVector< Number, n_comp, simd_length > & | multi_component_vector | ) |
| ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::MultiComponentVectorView | ( | const MultiComponentVector< Number, n_comp, simd_length > & | multi_component_vector | ) |
| DEAL_II_HOST_DEVICE ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::MultiComponentVectorView | ( | const MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, other_writable > & | other | ) |
Converting constructor creating a read only view from a writable view (mirroring the conversion from T * to const T *).
| void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::reinit | ( | MultiComponentVector & | multi_component_vector | ) |
| void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::extract_component | ( | ScalarVector & | scalar_vector, |
| unsigned int | component, | ||
| const Functor & | functor = std::identity{} |
||
| ) | 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.
Optionally, a third argument functor can be supplied that is applied to each (scalar) value individually before stored in scalar_vector.
| void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::insert_component | ( | const ScalarVector & | scalar_vector, |
| unsigned int | component, | ||
| const Functor & | functor = std::identity{} |
||
| ) | const |
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.
| void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::insert_component | ( | const dealii::Vector< Number > & | scalar_vector, |
| unsigned int | component, | ||
| const Functor & | functor = std::identity{} |
||
| ) | const |
Variant of the method above that reads values out of a dealii::Vector in (rank-) local numbering.
| void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::sadd | ( | const Number | s, |
| const Number | a, | ||
| const MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, false > & | v | ||
| ) | const |
Scaled addition of the given vector $U$ and the argument vector $V$: $U\leftarrow s\,U+a\,V$.
| DEAL_II_HOST_DEVICE Number2 ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::read_entry | ( | const unsigned int | i | ) | const |
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+simd_length-1.
n_comp is equal to 1. | DEAL_II_HOST_DEVICE Number2 ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::read_entry | ( | 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.
n_comp is equal to 1. | DEAL_II_HOST_DEVICE Tensor ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::read_tensor | ( | const unsigned int | i | ) | const |
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+simd_length-1.
| DEAL_II_HOST_DEVICE Tensor ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::read_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.
| DEAL_II_HOST_DEVICE void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::write_entry | ( | const Number2 & | entry, |
| const unsigned int | i | ||
| ) | const |
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+simd_length_1. with the values supplied by tensor.
n_comp is equal to 1. | DEAL_II_HOST_DEVICE void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::write_tensor | ( | const Tensor & | tensor, |
| const unsigned int | i | ||
| ) | const |
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.
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. | DEAL_II_HOST_DEVICE void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::add_entry | ( | const Number2 & | entry, |
| const unsigned int | i | ||
| ) | const |
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+simd_length_1. with the values supplied by tensor.
n_comp is equal to 1. | DEAL_II_HOST_DEVICE void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::add_tensor | ( | const Tensor & | tensor, |
| const unsigned int | i | ||
| ) | const |
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.
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. | void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::zero_out_ghost_values | ( | ) | const |
MPI synchronization: Zero out all ghost values stored in the vector.
| void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::update_ghost_values | ( | ) | const |
MPI synchronization: Import all ghost values from neighboring MPI ranks on the templated memory space.
| void ryujin::Vectors::MultiComponentVectorView< Number, n_comp, simd_length, MemorySpace, writable >::compress | ( | dealii::VectorOperation::values | operation | ) | const |
MPI synchronization: Copy the data that has accumulated in the ghost range to the owning processor. This function operates on the templated memory space.
|
friend |
Definition at line 556 of file multicomponent_vector.h.