suanPan
BatheTwoStep.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2017-2024 Theodore Chang
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  ******************************************************************************/
29 #ifndef BATHETWOSTEP_H
30 #define BATHETWOSTEP_H
31 
32 #include "Integrator.h"
33 
34 class BatheTwoStep final : public ImplicitIntegrator {
35  enum class FLAG {
36  TRAP,
37  EULER
38  };
39 
40  FLAG step_flag = FLAG::TRAP;
41 
42  const double GM;
43 
44  const double Q1, Q2, Q0, Q02 = Q0 / Q2, Q12 = Q1 / Q2;
45 
46  double P0{0.}, P1{0.}, P2{0.}, P3{0.}, P4{0.}, P5{0.}, P6{0.}, P7{0.}, P8{0.}, P9{0.};
47 
48 public:
49  BatheTwoStep(unsigned, double, double);
50 
51  void assemble_resistance() override;
52  void assemble_matrix() override;
53 
54  void update_incre_time(double) override;
55 
56  int update_trial_status() override;
57 
58  void commit_status() override;
59  void clear_status() override;
60 
61  void update_parameter(double) override;
62 
63  vec from_incre_velocity(const vec&, const uvec&) override;
64  vec from_incre_acceleration(const vec&, const uvec&) override;
65  vec from_total_velocity(const vec&, const uvec&) override;
66  vec from_total_acceleration(const vec&, const uvec&) override;
67 
68  void print() override;
69 };
70 
71 #endif
72 
A BatheTwoStep class defines a solver using BatheTwoStep algorithm.
Definition: BatheTwoStep.h:34
void update_incre_time(double) override
Definition: BatheTwoStep.cpp:71
void commit_status() override
Definition: BatheTwoStep.cpp:92
void clear_status() override
Definition: BatheTwoStep.cpp:112
vec from_incre_acceleration(const vec &, const uvec &) override
Definition: BatheTwoStep.cpp:125
vec from_total_acceleration(const vec &, const uvec &) override
Definition: BatheTwoStep.cpp:139
void update_parameter(double) override
Definition: BatheTwoStep.cpp:149
BatheTwoStep(unsigned, double, double)
Definition: BatheTwoStep.cpp:22
vec from_total_velocity(const vec &, const uvec &) override
Definition: BatheTwoStep.cpp:131
void assemble_matrix() override
Definition: BatheTwoStep.cpp:46
void assemble_resistance() override
Definition: BatheTwoStep.cpp:29
vec from_incre_velocity(const vec &, const uvec &) override
Definition: BatheTwoStep.cpp:119
void print() override
Definition: BatheTwoStep.cpp:166
int update_trial_status() override
Definition: BatheTwoStep.cpp:77
Definition: Integrator.h:149