Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
Explicit.hxx
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2 * Copyright (c) 2025, Davide Stocco and Enrico Bertolazzi. *
3 * *
4 * The Sandals project is distributed under the BSD 2-Clause License. *
5 * *
6 * Davide Stocco Enrico Bertolazzi *
7 * University of Trento University of Trento *
8 * e-mail: davide.stocco@unitn.it e-mail: enrico.bertolazzi@unitn.it *
9\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
11#pragma once
12
13#ifndef SANDALS_EXPLICIT_SYSTEM_HXX
14#define SANDALS_EXPLICIT_SYSTEM_HXX
15
16namespace Sandals {
17
18 /*\
19 | _____ _ _ _ _
20 | | ____|_ ___ __ | (_) ___(_) |_
21 | | _| \ \/ / '_ \| | |/ __| | __|
22 | | |___ > <| |_) | | | (__| | |_
23 | |_____/_/\_\ .__/|_|_|\___|_|\__|
24 | |_|
25 \*/
26
36 template <Integer N, Integer M>
37 class Explicit : public Implicit<N, M>
38 {
39 public:
40 using Pointer = std::shared_ptr<Explicit<N, M>>;
43 using Type = typename Implicit<N, M>::Type;
44
45 protected:
46
52 Explicit(Type t_type, std::string t_name) : Implicit<N, M>(t_type, t_name) {}
53
54 public:
55
59 Explicit() : Implicit<N, M>(Type::EXPLICIT, "(missing name)") {}
60
65 Explicit(std::string t_name) : Implicit<N, M>(Type::EXPLICIT, t_name) {}
66
80 VectorF F(VectorF const &x, VectorF const &x_dot, Real t) const override
81 {
82 return x_dot - this->f(x, t);
83 }
84
101 MatrixJF JF_x(VectorF const &x, VectorF const &/*x_dot*/, Real t) const override
102 {
103 return -this->Jf_x(x, t);
104 }
105
121 MatrixJF JF_x_dot(VectorF const &/*x*/, VectorF const &/*x_dot*/, Real /*t*/) const override
122 {
123 return MatrixJF::Identity();
124 }
125
132 virtual VectorF f(VectorF const &x, Real t) const = 0;
133
147 virtual MatrixJF Jf_x(VectorF const &x, Real t) const = 0;
148
156 VectorF f_reverse(VectorF const &x, Real t) const
157 {
158 return -this->f(x, -t);
159 }
160
169 {
170 return -this->Jf_x(x, -t);
171 }
172
181 VectorF F_reverse(VectorF const &x, VectorF const &x_dot, Real t) const
182 {
183 return -x_dot - this->f(x, -t);
184 }
185
196 MatrixJF JF_x_reverse(VectorF const &x, VectorF const &/*x_dot*/, Real t) const
197 {
198 return -this->Jf_x(x, -t);
199 }
200
211 MatrixJF JF_x_dot_reverse(VectorF const &/*x*/, VectorF const &/*x_dot*/, Real /*t*/) const
212 {
213 return -MatrixJF::Identity();
214 }
215
216 }; // class Explicit
217
218} // namespace Sandals
219
220#endif // SANDALS_EXPLICIT_SYSTEM_HXX
MatrixJF JF_x(VectorF const &x, VectorF const &, Real t) const override
Definition Explicit.hxx:101
MatrixJF JF_x_dot_reverse(VectorF const &, VectorF const &, Real) const
Definition Explicit.hxx:211
VectorF f_reverse(VectorF const &x, Real t) const
Definition Explicit.hxx:156
MatrixJF Jf_x_reverse(VectorF const &x, Real t) const
Definition Explicit.hxx:168
Explicit(std::string t_name)
Definition Explicit.hxx:65
typename Implicit< N, M >::MatrixJF MatrixJF
Definition Explicit.hxx:42
MatrixJF JF_x_reverse(VectorF const &x, VectorF const &, Real t) const
Definition Explicit.hxx:196
VectorF F_reverse(VectorF const &x, VectorF const &x_dot, Real t) const
Definition Explicit.hxx:181
VectorF F(VectorF const &x, VectorF const &x_dot, Real t) const override
Definition Explicit.hxx:80
std::shared_ptr< Explicit< N, M > > Pointer
Definition Explicit.hxx:40
Explicit(Type t_type, std::string t_name)
Definition Explicit.hxx:52
virtual VectorF f(VectorF const &x, Real t) const =0
MatrixJF JF_x_dot(VectorF const &, VectorF const &, Real) const override
Definition Explicit.hxx:121
typename Implicit< N, M >::Type Type
Definition Explicit.hxx:43
typename Implicit< N, M >::VectorF VectorF
Definition Explicit.hxx:41
virtual MatrixJF Jf_x(VectorF const &x, Real t) const =0
Explicit()
Definition Explicit.hxx:59
Eigen::Vector< Real, N > VectorF
Definition Implicit.hxx:43
Eigen::Matrix< Real, N, N > MatrixJF
Definition Implicit.hxx:44
enum class Type :Integer {IMPLICIT=0, EXPLICIT=1, SEMIEXPLICIT=1} Type
Definition Implicit.hxx:41
Implicit(Type t_type, std::string t_name)
Definition Implicit.hxx:59
The namespace for the Sandals library.
Definition Sandals.hh:73
double Real
Definition Sandals.hh:84