VTK
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 =========================================================================*/
38 #ifndef vtkRungeKutta45_h
39 #define vtkRungeKutta45_h
40 
41 #include "vtkCommonMathModule.h" // For export macro
43 
44 class VTKCOMMONMATH_EXPORT vtkRungeKutta45 : public vtkInitialValueProblemSolver
45 {
46 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
53  static vtkRungeKutta45 *New();
54 
56 
78  int ComputeNextStep(double* xprev, double* xnext,
79  double t, double& delT,
80  double maxError, double& error) override
81  {
82  double minStep = delT;
83  double maxStep = delT;
84  double delTActual;
85  return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
86  minStep, maxStep, maxError, error);
87  }
88  int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
89  double t, double& delT,
90  double maxError, double& error) override
91  {
92  double minStep = delT;
93  double maxStep = delT;
94  double delTActual;
95  return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
96  minStep, maxStep, maxError, error);
97  }
98  int ComputeNextStep(double* xprev, double* xnext,
99  double t, double& delT, double& delTActual,
100  double minStep, double maxStep,
101  double maxError, double& error) override
102  {
103  return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
104  minStep, maxStep, maxError, error);
105  }
106  int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
107  double t, double& delT, double& delTActual,
108  double minStep, double maxStep,
109  double maxError, double& error) override;
111 
112 protected:
113  vtkRungeKutta45();
114  ~vtkRungeKutta45() override;
115 
116  void Initialize() override;
117 
118  // Cash-Karp parameters
119  static double A[5];
120  static double B[5][5];
121  static double C[6];
122  static double DC[6];
123 
124  double* NextDerivs[6];
125 
126  int ComputeAStep(double* xprev, double* dxprev, double* xnext, double t,
127  double& delT, double& delTActual, double& error);
128 
129 private:
130  vtkRungeKutta45(const vtkRungeKutta45&) = delete;
131  void operator=(const vtkRungeKutta45&) = delete;
132 };
133 
134 #endif
135 
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...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int ComputeNextStep(double *xprev, double *xnext, double t, double &delT, double &delTActual, double minStep, double maxStep, double maxError, double &error) override
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...
a simple class to control print indentation
Definition: vtkIndent.h:39
Integrate an initial value problem using 5th order Runge-Kutta method with adaptive stepsize control...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
int ComputeNextStep(double *xprev, double *dxprev, double *xnext, double t, double &delT, double maxError, double &error) override
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...
Integrate a set of ordinary differential equations (initial value problem) in time.
int ComputeNextStep(double *xprev, double *xnext, double t, double &delT, double maxError, double &error) override
Given initial values, xprev , initial time, t and a requested time interval, delT calculate values of...