numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
autonomous_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
27
28namespace num_prob_collect::ode {
29
49public:
51 using variable_type = Eigen::Vector3d;
52
54 using scalar_type = double;
55
57 using jacobian_type = Eigen::Matrix3d;
58
63 jacobian_ = Eigen::Matrix3d::Zero();
64 jacobian_(1, 0) = 1.0;
65 }
66
68 static constexpr auto allowed_evaluations =
69 num_collect::ode::evaluation_type{.diff_coeff = true, .jacobian = true};
70
76 void evaluate_on(scalar_type /*time*/, const variable_type& variable,
77 num_collect::ode::evaluation_type /*evaluations*/) {
78 diff_coeff_(0) = std::sin(variable(2));
79 diff_coeff_(1) = variable(0);
80 diff_coeff_(2) = 1.0;
81 jacobian_(0, 2) = std::cos(variable(2));
82 }
83
89 [[nodiscard]] auto diff_coeff() const noexcept -> const variable_type& {
90 return diff_coeff_;
91 }
92
98 [[nodiscard]] auto jacobian() const noexcept -> const jacobian_type& {
99 return jacobian_;
100 }
101
102private:
105
108};
109
110} // namespace num_prob_collect::ode
Class of test problem of vibration with external force (autonomous version).
auto diff_coeff() const noexcept -> const variable_type &
Get the differential coefficient.
void evaluate_on(scalar_type, const variable_type &variable, num_collect::ode::evaluation_type)
Evaluate on a (time, variable) pair.
auto jacobian() const noexcept -> const jacobian_type &
Get the Jacobian.
Definition of evaluation_type enumeration.
Namespace of ordinary differential equation problems.
Definition namespaces.h:28
Struct to specify types of evaluations.