Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4BulirschStoer.hh
이 파일의 문서화 페이지로 가기
1 // ********************************************************************
2 // * License and Disclaimer *
3 // * *
4 // * The Geant4 software is copyright of the Copyright Holders of *
5 // * the Geant4 Collaboration. It is provided under the terms and *
6 // * conditions of the Geant4 Software License, included in the file *
7 // * LICENSE and available at http://cern.ch/geant4/license . These *
8 // * include a list of copyright holders. *
9 // * *
10 // * Neither the authors of this software system, nor their employing *
11 // * institutes,nor the agencies providing financial support for this *
12 // * work make any representation or warranty, express or implied, *
13 // * regarding this software system or assume any liability for its *
14 // * use. Please see the license in the file LICENSE and URL above *
15 // * for the full disclaimer and the limitation of liability. *
16 // * *
17 // * This code implementation is the result of the scientific and *
18 // * technical work of the GEANT4 collaboration. *
19 // * By using, copying, modifying or distributing the software (or *
20 // * any work based on the software) you agree to acknowledge its *
21 // * use in resulting scientific publications, and indicate your *
22 // * acceptance of all terms of the Geant4 Software license. *
23 // ********************************************************************
24 //
25 //
26 // $Id: $
27 //
28 // Description:
29 // G4BulirschStoer class implementation by Dmitry Sorokin
30 // Implementation is based on bulirsch_stoer.hpp from boost
31 //
32 // The Bulirsch-Stoer is a controlled driver that adjusts both step size
33 // and order of the method. The algorithm uses the modified midpoint and
34 // a polynomial extrapolation compute the solution.
35 
36 // Implementation by Dmitry Sorokin - GSoC 2016
37 // Work supported by Google as part of Google Summer of Code 2016.
38 // Supervision / code review: John Apostolakis
39 //
41 
42 #ifndef G4BULIRSCH_STOER_HH
43 #define G4BULIRSCH_STOER_HH
44 
45 #include "G4ModifiedMidpoint.hh"
46 
47 #include "G4FieldTrack.hh"
48 
50 {
51  public:
52 
53  enum class step_result
54  {
55  success,
56  fail
57  };
58 
59  G4BulirschStoer( G4EquationOfMotion* equation, G4int nvar,
60  G4double eps_rel, G4double max_dt = DBL_MAX);
61 
62  inline void set_max_dt(G4double max_dt);
63  inline void set_max_relative_error(G4double eps_rel);
64 
65  // Stepper method
66  //
67  step_result try_step(const G4double in[], const G4double dxdt[],
68  G4double& t, G4double out[], G4double& dt);
69 
70  // Reset the internal state of the stepper
71  //
72  void reset();
73 
74  inline void SetEquationOfMotion(G4EquationOfMotion* equation);
76 
77  inline G4int GetNumberOfVariables() const;
78 
79  private:
80 
81  const static G4int m_k_max = 8;
82 
83  void extrapolate(size_t k, G4double xest[]);
84  G4double calc_h_opt(G4double h, G4double error, size_t k) const;
85 
86  G4bool set_k_opt(size_t k, G4double& dt);
89 
90  // Number of vars to be integrated
92 
93  // Relative tolerance
95 
96  // Modified midpoint algorithm
98 
101 
103  // G4double m_t_last;
104 
105  // Max allowed time step
107 
109 
110  // G4double m_xnew[G4FieldTrack::ncompSVEC];
112  // G4double m_dxdt[G4FieldTrack::ncompSVEC];
113 
114  // Stores the successive interval counts
116 
117  // Extrapolation coeffs (Neville’s algorithm)
119 
120  // Costs for interval count
122 
123  // Sequence of states for extrapolation
125 
126  // Optimal step size
128 
129  // Work per unit step
131 };
132 
133 #include "G4BulirschStoer.icc"
134 
135 #endif
G4double h_opt[m_k_max+1]
G4bool m_last_step_rejected
G4BulirschStoer(G4EquationOfMotion *equation, G4int nvar, G4double eps_rel, G4double max_dt=DBL_MAX)
G4double m_table[m_k_max][G4FieldTrack::ncompSVEC]
G4double work[m_k_max+1]
G4bool set_k_opt(size_t k, G4double &dt)
G4ModifiedMidpoint m_midpoint
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4int m_cost[m_k_max+1]
void set_max_relative_error(G4double eps_rel)
G4bool should_reject(G4double error, G4int k) const
G4EquationOfMotion * GetEquationOfMotion()
G4int m_interval_sequence[m_k_max+1]
G4double m_err[G4FieldTrack::ncompSVEC]
G4double calc_h_opt(G4double h, G4double error, size_t k) const
G4bool in_convergence_window(G4int k) const
void SetEquationOfMotion(G4EquationOfMotion *equation)
G4int GetNumberOfVariables() const
step_result try_step(const G4double in[], const G4double dxdt[], G4double &t, G4double out[], G4double &dt)
int G4int
Definition: G4Types.hh:78
ifstream in
Definition: comparison.C:7
G4double m_coeff[m_k_max+1][m_k_max]
static const G4int m_k_max
void extrapolate(size_t k, G4double xest[])
static PROLOG_HANDLER error
Definition: xmlrole.cc:112
void set_max_dt(G4double max_dt)
#define DBL_MAX
Definition: templates.hh:83