VTK  9.4.20241219
vtkRungeKutta45.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
26#ifndef vtkRungeKutta45_h
27#define vtkRungeKutta45_h
28
29#include "vtkCommonMathModule.h" // For export macro
31
32VTK_ABI_NAMESPACE_BEGIN
33class VTKCOMMONMATH_EXPORT vtkRungeKutta45 : public vtkInitialValueProblemSolver
34{
35public:
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
43
44 using Superclass::ComputeNextStep;
46
68 int ComputeNextStep(double* xprev, double* xnext, double t, double& delT, double maxError,
69 double& error, void* userData) override
70 {
71 double minStep = delT;
72 double maxStep = delT;
73 double delTActual;
74 return this->ComputeNextStep(
75 xprev, nullptr, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, userData);
76 }
77 int ComputeNextStep(double* xprev, double* dxprev, double* xnext, double t, double& delT,
78 double maxError, double& error, void* userData) override
79 {
80 double minStep = delT;
81 double maxStep = delT;
82 double delTActual;
83 return this->ComputeNextStep(
84 xprev, dxprev, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, userData);
85 }
86 int ComputeNextStep(double* xprev, double* xnext, double t, double& delT, double& delTActual,
87 double minStep, double maxStep, double maxError, double& error, void* userData) override
88 {
89 return this->ComputeNextStep(
90 xprev, nullptr, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, userData);
91 }
92 int ComputeNextStep(double* xprev, double* dxprev, double* xnext, double t, double& delT,
93 double& delTActual, double minStep, double maxStep, double maxError, double& estErr,
94 void* userData) override;
96
97protected:
99 ~vtkRungeKutta45() override;
100
101 void Initialize() override;
102
103 // Cash-Karp parameters
104 static double A[5];
105 static double B[5][5];
106 static double C[6];
107 static double DC[6];
108
109 double* NextDerivs[6];
110
111 int ComputeAStep(double* xprev, double* dxprev, double* xnext, double t, double& delT,
112 double& delTActual, double& error, void* userData);
113
114private:
115 vtkRungeKutta45(const vtkRungeKutta45&) = delete;
116 void operator=(const vtkRungeKutta45&) = delete;
117};
118
119VTK_ABI_NAMESPACE_END
120#endif
a simple class to control print indentation
Definition vtkIndent.h:108
Integrate a set of ordinary differential equations (initial value problem) in time.
virtual int ComputeNextStep(double *xprev, double *xnext, double t, double &delT, double maxError, double &error)
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...
Integrate an initial value problem using 5th order Runge-Kutta method with adaptive stepsize control.
~vtkRungeKutta45() override
int ComputeNextStep(double *xprev, double *dxprev, double *xnext, double t, double &delT, double maxError, double &error, void *userData) override
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...
int ComputeNextStep(double *xprev, double *xnext, double t, double &delT, double maxError, double &error, void *userData) override
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...
int ComputeAStep(double *xprev, double *dxprev, double *xnext, double t, double &delT, double &delTActual, double &error, void *userData)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkRungeKutta45 * New()
Construct a vtkRungeKutta45 with no initial FunctionSet.
int ComputeNextStep(double *xprev, double *xnext, double t, double &delT, double &delTActual, double minStep, double maxStep, double maxError, double &error, void *userData) override
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...
void Initialize() override
int ComputeNextStep(double *xprev, double *dxprev, double *xnext, double t, double &delT, double &delTActual, double minStep, double maxStep, double maxError, double &estErr, void *userData) override
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...