numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
rosenbrock_equation_solver.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
22#include <type_traits> // IWYU pragma: keep
23
25
27
33template <typename T>
34concept rosenbrock_equation_solver = requires() {
35 typename T::problem_type;
37
38 typename T::variable_type;
39 requires std::is_same_v<typename T::variable_type,
40 typename T::problem_type::variable_type>;
41
42 typename T::scalar_type;
43 requires std::is_same_v<typename T::scalar_type,
44 typename T::problem_type::scalar_type>;
45
46 requires requires(const typename T::scalar_type& inverted_jacobian_coeff) {
47 T(inverted_jacobian_coeff);
48 };
49
50 requires requires(T& obj, typename T::problem_type& problem,
51 const typename T::scalar_type& time,
52 const typename T::scalar_type& step_size,
53 const typename T::variable_type& variable) {
54 obj.evaluate_and_update_jacobian(problem, time, step_size, variable);
55 };
56
57 requires requires(T& obj, const typename T::variable_type& target,
58 typename T::variable_type& result) {
59 obj.apply_jacobian(target, result);
60 };
61
62 requires requires(T& obj, const typename T::scalar_type& step_size,
63 const typename T::scalar_type& coeff,
64 typename T::variable_type& target) {
65 obj.add_time_derivative_term(step_size, coeff, target);
66 };
67
68 requires requires(T& obj, const typename T::variable_type& rhs,
69 typename T::variable_type& result) { obj.solve(rhs, result); };
70};
71
72} // namespace num_collect::ode::concepts
Concept of problems of ordinary differential equations.
Definition problem.h:35
Concept of classes to solve equations in Rosenbrock method.
Namespace of C++ concepts.
Definition of problem concept.