ryujin 2.5.0 revision c64172211cf21344cb9b9b0f3a1266aa6400d392
Loading...
Searching...
No Matches
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) 2026 by the ryujin authors
4//
5
6#pragma once
7
8#include <ryujin/base/compile_time_options.h>
10
11#include <deal.II/base/exceptions.h>
12#include <deal.II/base/parameter_acceptor.h>
13#include <deal.II/base/types.h>
14
15#include <string>
16
17namespace ryujin
18{
19 namespace Interface
20 {
31 template <int dim, typename Number = double>
32 class SolutionTransfer : public dealii::ParameterAcceptor
33 {
34 public:
40
46 virtual void
47 prepare_projection(const StateVector<Number> &old_state_vector) = 0;
48
56 virtual void project(StateVector<Number> &new_state_vector) = 0;
57
59
63
69 unsigned int get_handle() const
70 {
71 Assert(handle_ != dealii::numbers::invalid_unsigned_int,
72 dealii::ExcMessage(
73 "Invalid handle: Cannot retrieve a valid handle. "
74 "get_handle() can only be called after a call to "
75 "prepare_projection(), or set_handle()."));
76 return handle_;
77 }
78
84 void set_handle(unsigned int handle)
85 {
86 Assert(handle_ == dealii::numbers::invalid_unsigned_int,
87 dealii::ExcMessage(
88 "Invalid state: Cannot set handle because we already "
89 "have a valid handle due to a prior call to "
90 "prepare_projection(), or set_handle()."));
91 handle_ = handle;
92 }
93
100 {
101 handle_ = dealii::numbers::invalid_unsigned_int;
102 }
103
108 bool has_handle() const
109 {
110 return handle_ != dealii::numbers::invalid_unsigned_int;
111 }
112
114
115 protected:
119 explicit SolutionTransfer(const std::string &subsection)
120 : ParameterAcceptor(subsection)
121 , handle_(dealii::numbers::invalid_unsigned_int)
122 {
123 }
124
132 unsigned int handle_;
133 };
134 } // namespace Interface
135} // namespace ryujin
virtual void prepare_projection(const StateVector< Number > &old_state_vector)=0
SolutionTransfer(const std::string &subsection)
virtual void project(StateVector< Number > &new_state_vector)=0
void set_handle(unsigned int handle)