1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkRungeKutta4.h,v $
6 Date: $Date: 2002/11/06 20:10:00 $
7 Version: $Revision: 1.13 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkRungeKutta4 - Integrate an initial value problem using 4th
19 // order Runge-Kutta method.
21 // .SECTION Description
22 // This is a concrete sub-class of vtkInitialValueProblemSolver.
23 // It uses a 4th order Runge-Kutta method to obtain the values of
24 // a set of functions at the next time step.
27 // vtkInitialValueProblemSolver vtkRungeKutta45 vtkRungeKutta2 vtkFunctionSet
29 #ifndef __vtkRungeKutta4_h
30 #define __vtkRungeKutta4_h
32 #include "vtkInitialValueProblemSolver.h"
34 class VTK_COMMON_EXPORT vtkRungeKutta4 : public vtkInitialValueProblemSolver
37 vtkTypeRevisionMacro(vtkRungeKutta4,vtkInitialValueProblemSolver);
38 virtual void PrintSelf(ostream& os, vtkIndent indent);
41 // Construct a vtkRungeKutta4 with no initial FunctionSet.
42 static vtkRungeKutta4 *New();
46 // Given initial values, xprev , initial time, t and a requested time
47 // interval, delT calculate values of x at t+delT (xnext).
48 // delTActual is always equal to delT.
49 // Since this class can not provide an estimate for the error error
51 // maxStep, minStep and maxError are unused.
52 // This method returns an error code representing the nature of
55 // NotInitialized = 2,
56 // UnexpectedValue = 3
57 virtual int ComputeNextStep(float* xprev, float* xnext, float t,
58 float& delT, float maxError, float& error)
63 return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual,
64 minStep, maxStep, maxError, error);
66 virtual int ComputeNextStep(float* xprev, float* dxprev, float* xnext,
68 float maxError, float& error)
73 return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
74 minStep, maxStep, maxError, error);
76 virtual int ComputeNextStep(float* xprev, float* xnext,
77 float t, float& delT, float& delTActual,
78 float minStep, float maxStep,
79 float maxError, float& error)
81 return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual,
82 minStep, maxStep, maxError, error);
84 virtual int ComputeNextStep(float* xprev, float* dxprev, float* xnext,
85 float t, float& delT, float& delTActual,
86 float minStep, float maxStep,
87 float maxError, float& error);
93 virtual void Initialize();
97 vtkRungeKutta4(const vtkRungeKutta4&); // Not implemented.
98 void operator=(const vtkRungeKutta4&); // Not implemented.