numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
step_size_controller.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
30
32
38template <typename T>
39concept step_size_controller = requires() {
40 typename T::formula_type;
42
43 typename T::problem_type;
45 requires std::is_same_v<typename T::formula_type::problem_type,
46 typename T::problem_type>;
47
48 typename T::variable_type;
49 requires std::is_same_v<typename T::problem_type::variable_type,
50 typename T::variable_type>;
51
52 typename T::scalar_type;
53 requires std::is_same_v<typename T::problem_type::scalar_type,
54 typename T::scalar_type>;
55
56 requires requires() { T(); };
57
58 requires requires(T& obj) { obj.init(); };
59
60 requires requires(T& obj, typename T::scalar_type& step_size,
61 const typename T::variable_type& variable,
62 const typename T::variable_type& error) {
63 {
64 obj.check_and_calc_next(step_size, variable, error)
66 };
67
68 requires requires(
69 T& obj, const step_size_limits<typename T::scalar_type>& limits) {
70 obj.limits(limits);
71 };
72
73 requires requires(const T& obj) {
74 {
75 obj.limits()
77 step_size_limits<typename T::scalar_type>>;
78 };
79
80 requires requires(
81 T& obj, const error_tolerances<typename T::variable_type>& tolerances) {
82 obj.tolerances(tolerances);
83 };
84
85 requires requires(const T& obj) {
86 {
87 obj.tolerances()
89 error_tolerances<typename T::variable_type>>;
90 };
91};
92
93} // namespace num_collect::ode::concepts
Concept of problems of ordinary differential equations.
Definition problem.h:35
Concept of classes to control step sizes.
Definition of const_reference_of concept.
Definition of decayed_to concept.
Definition of error_tolerances class.
Definition of formula concept.
Namespace of C++ concepts.
Definition of problem concept.
Definition of step_size_limits class.