ryujin 2.1.1 revision b04fb4aba7bd97ddfa5994a6b4b6e8586eb15db2
Loading...
Searching...
No Matches
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 Interface::ParabolicSystem &parabolic_system, const MultiComponentVector< Number > &initial_precomputed, const std::vector< std::string > &additional_names={}, const std::vector< std::reference_wrapper< const ScalarVector< Number > > > &additional_vectors={})
 
void prepare (const std::vector< std::string > &selected)
 
template<typename MemorySpace = dealii::MemorySpace::Host>
void prepare_extraction (const StateVector< Number > &state_vector) const
 
Queries
unsigned int 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 View = typename HyperbolicSystem::template View< dim, Number >
 
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
 

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);
extractor_view.template extract_element<T>(
i, [&](unsigned int k, const T &value) {
// ...
});
};
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.

◆ View

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

Definition at line 89 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 Interface::ParabolicSystem &  parabolic_system,
const MultiComponentVector< Number > &  initial_precomputed,
const std::vector< std::string > &  additional_names = {},
const std::vector< std::reference_wrapper< const ScalarVector< Number > > > &  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< Number > &  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 discards all information stored for a previous extraction and invalidates all views previously returned by view().

◆ n_selected()

template<typename Description , int dim, typename Number >
unsigned int 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 passed to the writer 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.

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 100 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 101 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 102 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 104 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 106 of file selected_components_extractor.h.


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