VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkRungeKutta45.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00037 #ifndef __vtkRungeKutta45_h 00038 #define __vtkRungeKutta45_h 00039 00040 #include "vtkCommonMathModule.h" // For export macro 00041 #include "vtkInitialValueProblemSolver.h" 00042 00043 class VTKCOMMONMATH_EXPORT vtkRungeKutta45 : public vtkInitialValueProblemSolver 00044 { 00045 public: 00046 vtkTypeMacro(vtkRungeKutta45,vtkInitialValueProblemSolver); 00047 void PrintSelf(ostream& os, vtkIndent indent); 00048 00050 static vtkRungeKutta45 *New(); 00051 00053 00068 virtual int ComputeNextStep(double* xprev, double* xnext, double t, 00069 double& delT, double maxError, double& error) 00070 { 00071 double minStep = delT; 00072 double maxStep = delT; 00073 double delTActual; 00074 return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual, 00075 minStep, maxStep, maxError, error); 00076 } 00077 virtual int ComputeNextStep(double* xprev, double* dxprev, double* xnext, 00078 double t, double& delT, 00079 double maxError, double& error) 00080 { 00081 double minStep = delT; 00082 double maxStep = delT; 00083 double delTActual; 00084 return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual, 00085 minStep, maxStep, maxError, error); 00086 } 00087 virtual int ComputeNextStep(double* xprev, double* xnext, 00088 double t, double& delT, double& delTActual, 00089 double minStep, double maxStep, 00090 double maxError, double& error) 00091 { 00092 return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual, 00093 minStep, maxStep, maxError, error); 00094 } 00095 virtual int ComputeNextStep(double* xprev, double* dxprev, double* xnext, 00096 double t, double& delT, double& delTActual, 00097 double minStep, double maxStep, 00098 double maxError, double& error); 00100 00101 protected: 00102 vtkRungeKutta45(); 00103 ~vtkRungeKutta45(); 00104 00105 virtual void Initialize(); 00106 00107 // Cash-Karp parameters 00108 static double A[5]; 00109 static double B[5][5]; 00110 static double C[6]; 00111 static double DC[6]; 00112 00113 double* NextDerivs[6]; 00114 00115 int ComputeAStep(double* xprev, double* dxprev, double* xnext, double t, 00116 double& delT, double& error); 00117 00118 private: 00119 vtkRungeKutta45(const vtkRungeKutta45&); // Not implemented. 00120 void operator=(const vtkRungeKutta45&); // Not implemented. 00121 }; 00122 00123 #endif 00124