1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkInitialValueProblemSolver.h,v $
6 Date: $Date: 2002/12/11 22:47:41 $
7 Version: $Revision: 1.14 $
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 vtkInitialValueProblemSolver - Integrate a set of ordinary
19 // differential equations (initial value problem) in time.
21 // .SECTION Description
22 // Given a vtkFunctionSet which returns dF_i(x_j, t)/dt given x_j and
23 // t, vtkInitialValueProblemSolver computes the value of F_i at t+deltat.
26 // vtkInitialValueProblemSolver and it's subclasses are not thread-safe.
27 // You should create a new integrator for each thread.
30 // vtkRungeKutta2 vtkRungeKutta4
32 #ifndef __vtkInitialValueProblemSolver_h
33 #define __vtkInitialValueProblemSolver_h
35 #include "vtkObject.h"
39 class VTK_COMMON_EXPORT vtkInitialValueProblemSolver : public vtkObject
42 vtkTypeRevisionMacro(vtkInitialValueProblemSolver,vtkObject);
43 virtual void PrintSelf(ostream& os, vtkIndent indent);
46 // Given initial values, xprev , initial time, t and a requested time
47 // interval, delT calculate values of x at t+delTActual (xnext).
48 // For certain concrete sub-classes delTActual != delT. This occurs
49 // when the solver supports adaptive stepsize control. If this
50 // is the case, the solver tries to change to stepsize such that
51 // the (estimated) error of the integration is less than maxError.
52 // The solver will not set the stepsize smaller than minStep or
53 // larger than maxStep.
54 // Also note that delT is an in/out argument. Adaptive solvers
55 // will modify delT to reflect the best (estimated) size for the next
57 // An estimated value for the error is returned (by reference) in error.
58 // Note that only some concrete sub-classes support this. Otherwise,
59 // the error is set to 0.
60 // This method returns an error code representing the nature of
63 // NotInitialized = 2,
64 // UnexpectedValue = 3
65 virtual int ComputeNextStep(float* xprev, float* xnext, float t,
66 float& delT, float maxError,
72 return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual,
73 minStep, maxStep, maxError, error);
75 virtual int ComputeNextStep(float* xprev, float* dxprev, float* xnext,
76 float t, float& delT, float maxError,
82 return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
83 minStep, maxStep, maxError, error);
85 virtual int ComputeNextStep(float* xprev, float* xnext,
86 float t, float& delT, float& delTActual,
87 float minStep, float maxStep,
88 float maxError, float& error)
90 return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual,
91 minStep, maxStep, maxError, error);
93 virtual int ComputeNextStep(float* xprev, float* dxprev, float* xnext,
94 float t, float& delT, float& delTActual,
95 float minStep, float maxStep,
96 float maxError, float& error) = 0;
99 // Set / get the dataset used for the implicit function evaluation.
100 virtual void SetFunctionSet(vtkFunctionSet* functionset);
101 vtkGetObjectMacro(FunctionSet,vtkFunctionSet);
104 // Returns 1 if the solver uses adaptive stepsize control,
106 virtual int IsAdaptive() { return this->Adaptive; }
118 vtkInitialValueProblemSolver();
119 ~vtkInitialValueProblemSolver();
121 virtual void Initialize();
123 vtkFunctionSet* FunctionSet;
131 vtkInitialValueProblemSolver(const vtkInitialValueProblemSolver&); // Not implemented.
132 void operator=(const vtkInitialValueProblemSolver&); // Not implemented.