ryujin 2.5.0 revision 3a6c8d57210175dea14d8116e1fe878f349f8c1c
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
105
106 protected:
110 explicit SolutionTransfer(const std::string &subsection)
111 : ParameterAcceptor(subsection)
112 , handle_(dealii::numbers::invalid_unsigned_int)
113 {
114 }
115
123 unsigned int handle_;
124 };
125 } // namespace Interface
126} // 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)