Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
GaussLegendre4.hh
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_GAUSSLEGENDRE4_HH
14#define SANDALS_GAUSSLEGENDRE4_HH
15
16#include <Sandals.hh>
17#include <Sandals/RungeKutta.hh>
18
19namespace Sandals
20{
21 /*
22 Symplectic Runge-Kutta Methods of High Order Based on W-Transformation, Kaifeng Xia, Yuhao Cong
23 and Geng Sun. Journal of Applied Analysis ans Computation, Volume 7, Number 3, 2017(8), 1185-1199
24 http://www.jaac-online.com/data/article/jaac/preview/pdf/20170325.pdf
25 */
26
44 template <typename Real>
45 class GaussLegendre4Tableau : public Tableau<Real, 2>
46 {
47 public:
48 using typename Tableau<Real, 2>::Type;
49 using typename Tableau<Real, 2>::Vector;
50 using typename Tableau<Real, 2>::Matrix;
51
56 this->name = "GaussLegendre4";
57 this->type = Type::IRK;
58 this->order = 4;
59 Real t{std::sqrt(3.0)/6.0};
60 this->A << 1.0/4.0, 1.0/4.0-t,
61 1.0/4.0+t, 1.0/4.0;
62 this->b << 1.0/2.0, 1.0/2.0;
63 this->c << 1.0/2.0-t, 1.0/2.0+t;
64 }
65 }; // class GaussLegendre4Tableau
66
75 template <typename Real, Integer N, Integer M = 0>
76 class GaussLegendre4 : public RungeKutta<Real, 2, N, M>
77 {
78 public:
80
84 GaussLegendre4() : RungeKutta<Real, 2, N, M>(GaussLegendre4Tableau<Real>()) {}
85
90 GaussLegendre4(System t_system) : RungeKutta<Real, 2, N, M>(GaussLegendre4Tableau<Real>(), t_system) {}
91
92 }; // class GaussLegendre4
93
94} // namespace Sandals
95
96#endif // SANDALS_GAUSSLEGENDRE4_HH
GaussLegendre4()
Definition GaussLegendre4.hh:84
typename Implicit< Real, N, M >::Pointer System
Definition GaussLegendre4.hh:79
GaussLegendre4(System t_system)
Definition GaussLegendre4.hh:90
Butcher Tableau for the Gauss-Legendre order 4 method.
Definition GaussLegendre4.hh:46
GaussLegendre4Tableau()
Definition GaussLegendre4.hh:55
std::shared_ptr< Implicit< Real, N, M > > Pointer
Definition Implicit.hh:47
RungeKutta(const RungeKutta &)=delete
The namespace for the Sandals library.
Definition Sandals.hh:89
Struct container for the Butcher tableau of a Runge-Kutta method.
Definition Tableau.hh:38
enum class type :Integer {ERK=0, IRK=1, DIRK=2} Type
Definition Tableau.hh:42
Type type
Definition Tableau.hh:47
Integer order
Definition Tableau.hh:48
std::string name
Definition Tableau.hh:46
Eigen::Matrix< Real, S, S > Matrix
Definition Tableau.hh:44
Matrix A
Definition Tableau.hh:50
Eigen::Vector< Real, S > Vector
Definition Tableau.hh:43
Vector c
Definition Tableau.hh:53
Vector b
Definition Tableau.hh:51