OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkInitialValueProblemSolver.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkInitialValueProblemSolver.h,v $
5   Language:  C++
6   Date:      $Date: 2002/12/11 22:47:41 $
7   Version:   $Revision: 1.14 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
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.
16
17 =========================================================================*/
18 // .NAME vtkInitialValueProblemSolver - Integrate a set of ordinary
19 // differential equations (initial value problem) in time.
20
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.
24
25 // .SECTION Warning
26 // vtkInitialValueProblemSolver and it's subclasses are not thread-safe.
27 // You should create a new integrator for each thread.
28
29 // .SECTION See Also
30 // vtkRungeKutta2 vtkRungeKutta4
31
32 #ifndef __vtkInitialValueProblemSolver_h
33 #define __vtkInitialValueProblemSolver_h
34
35 #include "vtkObject.h"
36
37 class vtkFunctionSet;
38
39 class VTK_COMMON_EXPORT vtkInitialValueProblemSolver : public vtkObject
40 {
41 public:
42   vtkTypeRevisionMacro(vtkInitialValueProblemSolver,vtkObject);
43   virtual void PrintSelf(ostream& os, vtkIndent indent);
44
45   // Description:
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
56   // integration step.
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
61   // the failure:
62   // OutOfDomain = 1,
63   // NotInitialized = 2,
64   // UnexpectedValue = 3
65   virtual int ComputeNextStep(float* xprev, float* xnext, float t,
66                               float& delT, float maxError, 
67                               float& error) 
68     {
69       float minStep = delT;
70       float maxStep = delT;
71       float delTActual;
72       return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual,
73                                    minStep, maxStep, maxError, error);
74     }
75   virtual int ComputeNextStep(float* xprev, float* dxprev, float* xnext, 
76                               float t, float& delT, float maxError, 
77                               float& error)
78     {
79       float minStep = delT;
80       float maxStep = delT;
81       float delTActual;
82       return this->ComputeNextStep(xprev, dxprev, xnext, t, delT, delTActual,
83                                    minStep, maxStep, maxError, error);
84     }
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)
89     {
90       return this->ComputeNextStep(xprev, 0, xnext, t, delT, delTActual,
91                                    minStep, maxStep, maxError, error);
92     }
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;
97
98   // Description:
99   // Set / get the dataset used for the implicit function evaluation.
100   virtual void SetFunctionSet(vtkFunctionSet* functionset);
101   vtkGetObjectMacro(FunctionSet,vtkFunctionSet);
102
103   // Description:
104   // Returns 1 if the solver uses adaptive stepsize control,
105   // 0 otherwise
106   virtual int IsAdaptive() { return this->Adaptive; }
107   
108 //BTX
109   enum ErrorCodes
110   {
111     OUT_OF_DOMAIN = 1,
112     NOT_INITIALIZED = 2,
113     UNEXPECTED_VALUE = 3
114   };
115 //ETX
116
117 protected:
118   vtkInitialValueProblemSolver();
119   ~vtkInitialValueProblemSolver();
120
121   virtual void Initialize();
122
123   vtkFunctionSet* FunctionSet;
124
125   float* Vals;
126   float* Derivs;
127   int Initialized;
128   int Adaptive;
129
130 private:
131   vtkInitialValueProblemSolver(const vtkInitialValueProblemSolver&);  // Not implemented.
132   void operator=(const vtkInitialValueProblemSolver&);  // Not implemented.
133 };
134
135 #endif
136
137
138
139