numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
external_force_vibration_problem.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 <cmath>
23
24#include <Eigen/Core>
25
28
29namespace num_prob_collect::ode {
30
49public:
51 using variable_type = Eigen::Vector2d;
52
54 using scalar_type = double;
55
57 using jacobian_type = Eigen::Matrix2d;
58
62 external_force_vibration_problem() { jacobian_ << 0.0, 0.0, 1.0, 0.0; }
63
65 static constexpr auto allowed_evaluations =
67 .diff_coeff = true, .jacobian = true, .time_derivative = true};
68
75 void evaluate_on(scalar_type time, const variable_type& variable,
76 num_collect::ode::evaluation_type /*evaluations*/) {
77 diff_coeff_[0] = std::sin(time);
78 diff_coeff_[1] = variable[0];
79 time_derivative_[0] = std::cos(time);
80 time_derivative_[1] = 0.0;
81 }
82
88 [[nodiscard]] auto diff_coeff() const noexcept -> const variable_type& {
89 return diff_coeff_;
90 }
91
97 [[nodiscard]] auto jacobian() const noexcept -> const jacobian_type& {
98 return jacobian_;
99 }
100
106 [[nodiscard]] auto time_derivative() const noexcept
107 -> const variable_type& {
108 return time_derivative_;
109 }
110
111private:
114
117
120};
121
123 external_force_vibration_problem>);
124
125} // namespace num_prob_collect::ode
Class of test problem of vibration with external force.
variable_type time_derivative_
Partial derivative with respect to time.
void evaluate_on(scalar_type time, const variable_type &variable, num_collect::ode::evaluation_type)
Evaluate on a (time, variable) pair.
auto diff_coeff() const noexcept -> const variable_type &
Get the differential coefficient.
auto time_derivative() const noexcept -> const variable_type &
Get the partial derivative with respect to time.
auto jacobian() const noexcept -> const jacobian_type &
Get the Jacobian.
Concept of problems of ordinary differential equations differentiable by time variable.
Definition of evaluation_type enumeration.
Namespace of ordinary differential equation problems.
Definition namespaces.h:28
Struct to specify types of evaluations.
Definition of time_differentiable_problem concept.