JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGRungeKutta Class Referenceabstract

Detailed Description

Abstract base.

Definition at line 78 of file FGRungeKutta.h.

#include <FGRungeKutta.h>

+ Inheritance diagram for FGRungeKutta:
+ Collaboration diagram for FGRungeKutta:

Public Types

enum  eStates {
  eNoError =0 , eMathError =1 , eFaultyInit =2 , eEvolve =4 ,
  eUnknown =8
}
 

Public Member Functions

void clearStatus ()
 
double evolve (double y_0, FGRungeKuttaProblem *pf)
 
double getError ()
 
int getIterations ()
 
int getStatus ()
 
double getXEnd ()
 
int init (double x_start, double x_end, int intervals=4)
 
void setTrace (bool t)
 

Protected Attributes

double err
 
double h
 
double h05
 
FGRungeKuttaProblempfo
 

Member Enumeration Documentation

◆ eStates

enum eStates

Definition at line 82 of file FGRungeKutta.h.

82{ eNoError=0, eMathError=1, eFaultyInit=2, eEvolve=4, eUnknown=8} ;

Constructor & Destructor Documentation

◆ FGRungeKutta()

FGRungeKutta ( )
inlineprotected

Definition at line 98 of file FGRungeKutta.h.

98: status(eNoError), trace_values(false), iterations(0) {};

◆ ~FGRungeKutta()

~FGRungeKutta ( )
protectedvirtual

Definition at line 52 of file FGRungeKutta.cpp.

52{ };

Member Function Documentation

◆ clearStatus()

void clearStatus ( )
inline

Definition at line 93 of file FGRungeKutta.h.

93{ status = eNoError; }

◆ evolve()

double evolve ( double  y_0,
FGRungeKuttaProblem pf 
)

Definition at line 87 of file FGRungeKutta.cpp.

88{
89 double x = x0;
90 double y = y_0;
91 pfo = pf;
92
93 iterations = 0;
94
95 if (!trace_values) {
96 while (x<safer_x1) {
97 y = approximate(x,y);
98 if (!sane_val(y)) { status &= eMathError; }
99 x += h;
100 iterations++;
101 }
102 } else {
103 FGLogging log(LogLevel::DEBUG);
104 while (x<safer_x1) {
105 log << x << " " << y << "\n";
106 y = approximate(x,y);
107 if (!sane_val(y)) { status &= eMathError; }
108 x += h;
109 iterations++;
110 }
111 log << x << " " << y << "\n";
112 }
113
114 x_end = x; // twimc, store the last x used.
115 return y;
116}

◆ getError()

double getError ( )
inline

Definition at line 89 of file FGRungeKutta.h.

89{ return err; }

◆ getIterations()

int getIterations ( )
inline

Definition at line 92 of file FGRungeKutta.h.

92{ return iterations; }

◆ getStatus()

int getStatus ( )
inline

Definition at line 91 of file FGRungeKutta.h.

91{ return status; }

◆ getXEnd()

double getXEnd ( )
inline

Definition at line 88 of file FGRungeKutta.h.

88{ return x_end; }

◆ init()

int init ( double  x_start,
double  x_end,
int  intervals = 4 
)

Definition at line 54 of file FGRungeKutta.cpp.

55{
56 x0 = x_start;
57 x1 = x_end;
58 h = (x_end - x_start)/intervals;
59 safer_x1 = x1 - h*1e-6; // avoid 'intervals*h < x1'
60 h05 = h*0.5;
61 err = 0.0;
62
63 if (x0>=x1) {
64 status &= eFaultyInit;
65 }
66 return status;
67}

◆ setTrace()

void setTrace ( bool  t)
inline

Definition at line 94 of file FGRungeKutta.h.

94{ trace_values = t; }

Member Data Documentation

◆ err

double err
protected

Definition at line 105 of file FGRungeKutta.h.

◆ h

double h
protected

Definition at line 103 of file FGRungeKutta.h.

◆ h05

double h05
protected

Definition at line 104 of file FGRungeKutta.h.

◆ pfo

FGRungeKuttaProblem* pfo
protected

Definition at line 101 of file FGRungeKutta.h.


The documentation for this class was generated from the following files: