ryujin 2.1.1 revision 71cdc42292164f8095c0bd62c4ea75ebcfac58fa
Loading...
Searching...
No Matches
Classes | List of all members
ryujin::SelectedComponentsExtractor< Description, dim, Number > Class Template Reference

#include <source/selected_components_extractor.h>

Public Member Functions

Constructor and setup
 SelectedComponentsExtractor (const OfflineData< dim, Number > &offline_data, const HyperbolicSystem &hyperbolic_system, const ParabolicSystem &parabolic_system, const InitialPrecomputedVector &initial_precomputed, const std::vector< std::string > &additional_names={}, const std::vector< std::reference_wrapper< const ScalarVector > > &additional_vectors={})
 
void prepare (const std::vector< std::string > &selected)
 
template<typename MemorySpace = dealii::MemorySpace::Host>
void prepare_extraction (const StateVector &state_vector) const
 
Queries
std::size_t n_selected () const
 
Memory space access
template<typename MemorySpace = dealii::MemorySpace::Host>
SelectedComponentsExtractorView< Description, dim, Number, MemorySpace > view () const
 

Typedefs and constexpr constants

using HyperbolicSystem = typename Description::HyperbolicSystem
 
using ParabolicSystem = typename Description::ParabolicSystem
 
using View = typename HyperbolicSystem::template View< dim, Number >
 
using StateVector = typename View::StateVector
 
using InitialPrecomputedVector = typename View::InitialPrecomputedVector
 
using ScalarVector = Vectors::ScalarVector< Number >
 
using HyperbolicVector = std::tuple_element_t< 0, StateVector >
 
using PrecomputedVector = std::tuple_element_t< 1, StateVector >
 
using ParabolicVector = std::tuple_element_t< 2, StateVector >
 
template<typename MemorySpace >
using HyperbolicVectorView = auto
 
template<typename MemorySpace >
using PrecomputedVectorView = auto
 
template<typename MemorySpace >
using InitialPrecomputedVectorView = auto
 
template<typename MemorySpace >
using ScalarVectorView = auto
 
static constexpr unsigned int conserved_offset = 0
 
static constexpr unsigned int primitive_offset = View::problem_dimension
 
static constexpr unsigned int precomputed_offset
 
static constexpr unsigned int initial_offset
 
static constexpr unsigned int parabolic_offset
 

Internal fields and friends

template<typename , int , typename , typename >
class SelectedComponentsExtractorView
 

Detailed Description

template<typename Description, int dim, typename Number>
class ryujin::SelectedComponentsExtractor< Description, dim, Number >

A helper class that extracts a selection of named components from a state vector into a vector of scalar vectors suitable for output and postprocessing.

A component can be selected by any of its conserved, primitive, precomputed, initial-precomputed, or parabolic name, or by one of the additional names supplied by the caller.

Intended usage:

offline_data, hyperbolic_system, parabolic_system,
initial_precomputed, {"alpha"}, {alpha});
extractor.prepare(selected_component_names);
// ...
extractor.prepare_extraction(state_vector);
const auto components = extractor.view().extract();
void prepare(const std::vector< std::string > &selected)

The extract() call populates one full scalar vector per selected component. Alternatively, all selected components can be read for a single degree of freedom - in a computation loop running on the host, or on the device:

extractor.template prepare_extraction<MemorySpace>(state_vector);
const auto extractor_view = extractor.template view<MemorySpace>();
const auto body = [=](auto sentinel, unsigned int i) {
using T = decltype(sentinel);
T values[n_selected];
extractor_view.extract_element(values, i);
// ...
};

All bookkeeping and all memory space transfers happen in prepare() and prepare_extraction(); a view is a cheap, copyable collection of pointers, indices, and booleans.

Note
A view is only valid as long as neither prepare(), nor prepare_extraction() is called again, and as long as the state vector the extraction was prepared with is not modified.

Definition at line 79 of file selected_components_extractor.h.

Member Typedef Documentation

◆ HyperbolicSystem

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::HyperbolicSystem = typename Description::HyperbolicSystem

Definition at line 87 of file selected_components_extractor.h.

◆ ParabolicSystem

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::ParabolicSystem = typename Description::ParabolicSystem

Definition at line 88 of file selected_components_extractor.h.

◆ View

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::View = typename HyperbolicSystem::template View<dim, Number>

Definition at line 90 of file selected_components_extractor.h.

◆ StateVector

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::StateVector = typename View::StateVector

Definition at line 92 of file selected_components_extractor.h.

◆ InitialPrecomputedVector

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::InitialPrecomputedVector = typename View::InitialPrecomputedVector

Definition at line 93 of file selected_components_extractor.h.

◆ ScalarVector

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::ScalarVector = Vectors::ScalarVector<Number>

Definition at line 95 of file selected_components_extractor.h.

◆ HyperbolicVector

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::HyperbolicVector = std::tuple_element_t<0, StateVector>

Definition at line 97 of file selected_components_extractor.h.

◆ PrecomputedVector

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::PrecomputedVector = std::tuple_element_t<1, StateVector>

Definition at line 98 of file selected_components_extractor.h.

◆ ParabolicVector

template<typename Description , int dim, typename Number >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::ParabolicVector = std::tuple_element_t<2, StateVector>

Definition at line 99 of file selected_components_extractor.h.

◆ HyperbolicVectorView

template<typename Description , int dim, typename Number >
template<typename MemorySpace >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::HyperbolicVectorView = auto

Definition at line 102 of file selected_components_extractor.h.

◆ PrecomputedVectorView

template<typename Description , int dim, typename Number >
template<typename MemorySpace >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::PrecomputedVectorView = auto

Definition at line 106 of file selected_components_extractor.h.

◆ InitialPrecomputedVectorView

template<typename Description , int dim, typename Number >
template<typename MemorySpace >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::InitialPrecomputedVectorView = auto

Definition at line 110 of file selected_components_extractor.h.

◆ ScalarVectorView

template<typename Description , int dim, typename Number >
template<typename MemorySpace >
using ryujin::SelectedComponentsExtractor< Description, dim, Number >::ScalarVectorView = auto

Definition at line 114 of file selected_components_extractor.h.

Constructor & Destructor Documentation

◆ SelectedComponentsExtractor()

template<typename Description , int dim, typename Number >
ryujin::SelectedComponentsExtractor< Description, dim, Number >::SelectedComponentsExtractor ( const OfflineData< dim, Number > &  offline_data,
const HyperbolicSystem &  hyperbolic_system,
const ParabolicSystem &  parabolic_system,
const InitialPrecomputedVector &  initial_precomputed,
const std::vector< std::string > &  additional_names = {},
const std::vector< std::reference_wrapper< const ScalarVector > > &  additional_vectors = {} 
)

Constructor.

In addition to the conserved, primitive, precomputed, initial-precomputed, and parabolic components a caller can supply a list of additional_names with corresponding additional_vectors that can be selected as well.

Member Function Documentation

◆ prepare()

template<typename Description , int dim, typename Number >
void ryujin::SelectedComponentsExtractor< Description, dim, Number >::prepare ( const std::vector< std::string > &  selected)

Validate the list of selected component names and set up all internal index bookkeeping that is independent of a state vector. A call to prepare() is necessary before an extraction can be prepared.

Note
A call to this function invalidates all views previously returned by view().

◆ prepare_extraction()

template<typename Description , int dim, typename Number >
template<typename MemorySpace = dealii::MemorySpace::Host>
void ryujin::SelectedComponentsExtractor< Description, dim, Number >::prepare_extraction ( const StateVector &  state_vector) const

Set up all internal data structures necessary for reading the selected components out of state_vector on the selected memory space. This function creates a view for all selected components of the state vector (and all selected additional vectors) on the selected memory space. Depending on the transfer policy of the individual vectors this either asserts that the memory space is resident, or triggers an implicit memory transfer.

A call to prepare_extraction() is necessary before a view for the selected memory space can be created with view().

Note
A call to this function invalidates all views for the selected memory space previously returned by view().

◆ n_selected()

template<typename Description , int dim, typename Number >
std::size_t ryujin::SelectedComponentsExtractor< Description, dim, Number >::n_selected ( ) const

Return the number of selected components, i.e., the number of entries of the vector returned by extract() and the number of values written by extract_element().

◆ view()

template<typename Description , int dim, typename Number >
template<typename MemorySpace = dealii::MemorySpace::Host>
SelectedComponentsExtractorView< Description, dim, Number, MemorySpace > ryujin::SelectedComponentsExtractor< Description, dim, Number >::view ( ) const

Return a view on the extractor for the selected memory space that reads all selected components out of the state vector the extraction has been prepared with.

Friends And Related Symbol Documentation

◆ SelectedComponentsExtractorView

template<typename Description , int dim, typename Number >
template<typename , int , typename , typename >
friend class SelectedComponentsExtractorView
friend

Definition at line 308 of file selected_components_extractor.h.

Member Data Documentation

◆ conserved_offset

template<typename Description , int dim, typename Number >
constexpr unsigned int ryujin::SelectedComponentsExtractor< Description, dim, Number >::conserved_offset = 0
staticconstexpr

Definition at line 127 of file selected_components_extractor.h.

◆ primitive_offset

template<typename Description , int dim, typename Number >
constexpr unsigned int ryujin::SelectedComponentsExtractor< Description, dim, Number >::primitive_offset = View::problem_dimension
staticconstexpr

Definition at line 128 of file selected_components_extractor.h.

◆ precomputed_offset

template<typename Description , int dim, typename Number >
constexpr unsigned int ryujin::SelectedComponentsExtractor< Description, dim, Number >::precomputed_offset
staticconstexpr
Initial value:
=
2 * View::problem_dimension

Definition at line 129 of file selected_components_extractor.h.

◆ initial_offset

template<typename Description , int dim, typename Number >
constexpr unsigned int ryujin::SelectedComponentsExtractor< Description, dim, Number >::initial_offset
staticconstexpr
Initial value:
=
precomputed_offset + View::n_precomputed_values

Definition at line 131 of file selected_components_extractor.h.

◆ parabolic_offset

template<typename Description , int dim, typename Number >
constexpr unsigned int ryujin::SelectedComponentsExtractor< Description, dim, Number >::parabolic_offset
staticconstexpr
Initial value:
=
initial_offset + View::n_initial_precomputed_values

Definition at line 133 of file selected_components_extractor.h.


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