![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsODESolver.hpp 00003 ******************************************************************************/ 00027 /****************************************************************************** 00028 SUKITTI PUNAK (07/10/2005) 00029 UPDATE (08/18/2010) 00030 ******************************************************************************/ 00031 #ifndef TAPs_ODE_SOLVER_HPP 00032 #define TAPs_ODE_SOLVER_HPP 00033 00034 #include "TAPsVectorSet.hpp" 00035 00036 BEGIN_NAMESPACE_TAPs__Simulation 00037 //============================================================================= 00038 //----------------------------------------------------------------------------- 00039 template <typename T, typename T_SET = T> 00040 class ODESolver 00041 { 00042 //------------------------------------------------------------------- 00043 protected: 00044 00045 // For Array of type VectorSet 00046 //--------------------------------------------------------------- 00047 // Derivative Function 00048 // compute and return d/dt(X(t)) in the array xdot 00049 typedef bool (*DerivFunc) ( 00050 T t, // i/p: time step 00051 VectorSet<T_SET> &x, // i/p: array x, e.g. x = {position, velocity} 00052 VectorSet<T_SET> &xdot, // o/p: array xdot, e.g. xdot = {velocity, acceleration} 00053 void *userData // o/p: array of user data 00054 ); 00055 00056 //typedef bool (*DerivFunc_ForPtrData) ( 00057 // T t, // i/p: time step 00058 // VectorSetPtr<T_SET,T> &x, // i/p: array x, e.g. x = {position, velocity} 00059 // VectorSetPtr<T_SET,T> &xdot, // o/p: array xdot, e.g. xdot = {velocity, acceleration} 00060 // void *userData // o/p: array of user data 00061 //); 00062 00063 //------------------------------------------------------------------- 00064 public: 00065 00066 ODESolver () {} 00067 00068 virtual ~ODESolver () {} 00069 00070 // Abstract Member Fns 00071 virtual void SetSize ( int vectorSize ) = 0; // set data size 00072 00073 virtual void Solve ( 00074 VectorSet<T_SET> &x0, // i/p: x(t_0) an initial state vector 00075 VectorSet<T_SET> &xEnd, // o/p: x(t_1) an end state vector 00076 T t0, T t1, // i/p: starting and ending times 00077 DerivFunc dxdt, // i/p: a derivative function 00078 void *userData // o/p: array of user data 00079 ) = 0; 00080 00081 //virtual void Solve_ForPtrData ( 00082 // VectorSetPtr<T_SET,T> &x0, // i/p: x(t_0) an initial state vector 00083 // VectorSetPtr<T_SET,T> &xEnd, // o/p: x(t_1) an end state vector 00084 // T t0, T t1, // i/p: starting and ending times 00085 // DerivFunc_ForPtrData dxdt, // i/p: a derivative function 00086 // void *userData // o/p: array of user data 00087 //) = 0; 00088 }; 00089 //----------------------------------------------------------------------------- 00090 //============================================================================= 00091 END_NAMESPACE_TAPs__Simulation 00092 //----------------------------------------------------------------------------- 00093 // Include definition if TAPs_USE_EXPORT is not defined 00094 //#if !defined( TAPs_USE_EXPORT ) 00095 #include "TAPsODESolver.cpp" 00096 //#endif 00097 //----------------------------------------------------------------------------- 00098 #endif 00099 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00100 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----