VTK  9.1.0
vtkRungeKutta45.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkRungeKutta45.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
35#ifndef vtkRungeKutta45_h
36#define vtkRungeKutta45_h
37
38#include "vtkCommonMathModule.h" // For export macro
40
41class VTKCOMMONMATH_EXPORT vtkRungeKutta45 : public vtkInitialValueProblemSolver
42{
43public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
51
52 using Superclass::ComputeNextStep;
54
76 int ComputeNextStep(double* xprev, double* xnext, double t, double& delT, double maxError,
77 double& error, void* userData) override
78 {
79 double minStep = delT;
80 double maxStep = delT;
81 double delTActual;
82 return this->ComputeNextStep(
83 xprev, nullptr, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, userData);
84 }
85 int ComputeNextStep(double* xprev, double* dxprev, double* xnext, double t, double& delT,
86 double maxError, double& error, void* userData) override
87 {
88 double minStep = delT;
89 double maxStep = delT;
90 double delTActual;
91 return this->ComputeNextStep(
92 xprev, dxprev, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, userData);
93 }
94 int ComputeNextStep(double* xprev, double* xnext, double t, double& delT, double& delTActual,
95 double minStep, double maxStep, double maxError, double& error, void* userData) override
96 {
97 return this->ComputeNextStep(
98 xprev, nullptr, xnext, t, delT, delTActual, minStep, maxStep, maxError, error, userData);
99 }
100 int ComputeNextStep(double* xprev, double* dxprev, double* xnext, double t, double& delT,
101 double& delTActual, double minStep, double maxStep, double maxError, double& estErr,
102 void* userData) override;
104
105protected:
108
109 void Initialize() override;
110
111 // Cash-Karp parameters
112 static double A[5];
113 static double B[5][5];
114 static double C[6];
115 static double DC[6];
116
117 double* NextDerivs[6];
118
119 int ComputeAStep(double* xprev, double* dxprev, double* xnext, double t, double& delT,
120 double& delTActual, double& error, void* userData);
121
122private:
123 vtkRungeKutta45(const vtkRungeKutta45&) = delete;
124 void operator=(const vtkRungeKutta45&) = delete;
125};
126
127#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
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...