VTK
vtkRungeKutta4.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRungeKutta4.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 vtkRungeKutta4_h
36 #define vtkRungeKutta4_h
37 
38 #include "vtkCommonMathModule.h" // For export macro
40 
41 class VTKCOMMONMATH_EXPORT vtkRungeKutta4 : public vtkInitialValueProblemSolver
42 {
43 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  static vtkRungeKutta4 *New();
51 
52 
54 
67  int ComputeNextStep(double* xprev, double* xnext,
68  double t, double& delT,
69  double maxError, double& error) override
70  {
71  double minStep = delT;
72  double maxStep = delT;
73  double delTActual;
74  return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
75  minStep, maxStep, maxError, error);
76  }
77  int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
78  double t, double& delT,
79  double maxError, double& error) override
80  {
81  double minStep = delT;
82  double maxStep = delT;
83  double delTActual;
84  return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
85  minStep, maxStep, maxError, error);
86  }
87  int ComputeNextStep(double* xprev, double* xnext,
88  double t, double& delT, double& delTActual,
89  double minStep, double maxStep,
90  double maxError, double& error) override
91  {
92  return this->ComputeNextStep(xprev, nullptr, xnext, t, delT, delTActual,
93  minStep, maxStep, maxError, error);
94  }
95  int ComputeNextStep(double* xprev, double* dxprev, double* xnext,
96  double t, double& delT, double& delTActual,
97  double minStep, double maxStep,
98  double maxError, double& error) override;
100 
101 protected:
102  vtkRungeKutta4();
103  ~vtkRungeKutta4() override;
104 
105  void Initialize() override;
106 
107  double* NextDerivs[3];
108 private:
109  vtkRungeKutta4(const vtkRungeKutta4&) = delete;
110  void operator=(const vtkRungeKutta4&) = delete;
111 };
112 
113 #endif
114 
115 
116 
117 
118 
119 
120 
121 
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...
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...
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...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
Integrate an initial value problem using 4th order Runge-Kutta method.
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...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Integrate a set of ordinary differential equations (initial value problem) in time.