ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
solution_transfer.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception or LGPL-2.1-or-later
3// Copyright (C) 2024 - 2024 by the ryujin authors
4//
5
6#pragma once
7
8#include <compile_time_options.h>
9
10#include "mpi_ensemble.h"
11#include "offline_data.h"
12#include "state_vector.h"
13
14#include <deal.II/base/parameter_acceptor.h>
15
16namespace ryujin
17{
28 template <typename Description, int dim, typename Number = double>
30 {
31 public:
36
39
40 using View =
41 typename Description::template HyperbolicSystemView<dim, Number>;
42
43 static constexpr auto problem_dimension = View::problem_dimension;
44
45 using state_type = typename View::state_type;
46
48 using HyperbolicVector = typename View::HyperbolicVector;
49
51
53
57
61 SolutionTransfer(const MPIEnsemble &mpi_ensemble,
62 typename Discretization<dim>::Triangulation &triangulation,
63 const OfflineData<dim, Number> &offline_data,
64 const HyperbolicSystem &hyperbolic_system,
65 const ParabolicSystem &parabolic_system);
66
70 ~SolutionTransfer() = default;
71
73
78
85 void prepare_projection(const StateVector &old_state_vector);
86
94 unsigned int get_handle() const
95 {
96 Assert(handle_ != dealii::numbers::invalid_unsigned_int,
97 dealii::ExcMessage("Invalid handle: Cannot retrieve a valid "
98 "handle because get_handle() can only be "
99 "called after a call to prepare_projection()"));
100 return handle_;
101 }
102
110 void set_handle(unsigned int handle)
111 {
112 Assert(handle_ == dealii::numbers::invalid_unsigned_int,
113 dealii::ExcMessage(
114 "Invalid state: Cannot set handle because we already have a "
115 "valid handle due to a prior call to prepare_projection()."));
116 handle_ = handle;
117 }
118
131 void project(StateVector &new_state_vector);
132
133 private:
135
139
140 const MPIEnsemble &mpi_ensemble_;
141
142 dealii::SmartPointer<typename Discretization<dim>::Triangulation>
143 triangulation_;
144 dealii::SmartPointer<const OfflineData<dim, Number>> offline_data_;
145 dealii::SmartPointer<const HyperbolicSystem> hyperbolic_system_;
146 dealii::SmartPointer<const ParabolicSystem> parabolic_system_;
147
148 unsigned int handle_;
149
160 state_type get_tensor(const HyperbolicVector &U,
161 const dealii::types::global_dof_index global_i);
162
168 void add_tensor(HyperbolicVector &U,
169 const state_type &U_i,
170 const dealii::types::global_dof_index global_i);
171 };
172} // namespace ryujin
typename Proxy< dim >::Triangulation Triangulation
typename View::HyperbolicVector HyperbolicVector
unsigned int get_handle() const
Vectors::ScalarVector< Number > ScalarVector
typename View::state_type state_type
typename Description::ParabolicSystem ParabolicSystem
typename Description::template HyperbolicSystemView< dim, Number > View
void prepare_projection(const StateVector &old_state_vector)
SolutionTransfer(const MPIEnsemble &mpi_ensemble, typename Discretization< dim >::Triangulation &triangulation, const OfflineData< dim, Number > &offline_data, const HyperbolicSystem &hyperbolic_system, const ParabolicSystem &parabolic_system)
static constexpr auto problem_dimension
void set_handle(unsigned int handle)
typename Description::HyperbolicSystem HyperbolicSystem
void project(StateVector &new_state_vector)
typename View::StateVector StateVector
dealii::LinearAlgebra::distributed::Vector< Number > ScalarVector
Definition: state_vector.h:31
std::tuple< MultiComponentVector< Number, problem_dim >, MultiComponentVector< Number, prec_dim >, BlockVector< Number > > StateVector
Definition: state_vector.h:51
Euler::ParabolicSystem ParabolicSystem
Definition: description.h:37
Euler::HyperbolicSystem HyperbolicSystem
Definition: description.h:32