Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

odenum.h

Go to the documentation of this file.
00001 
00002 // FILE odenum.h
00003 
00004 
00005 #ifndef  INCLUDED_ODENUM_H
00006 #define  INCLUDED_ODENUM_H
00007 
00008 
00009 #include "odeprobl.h"
00010 
00011 #define DEFAULT_ABS_TOL 1e-12
00012 #define DEFAULT_REL_TOL 1e-12
00013 
00014 
00023 class ODE_NUMERIC : public ODE_PROBLEM
00024 {
00025 
00026 public:
00027   
00039   ODE_NUMERIC( int n, FCN fcn, const string & name );
00040 
00045   void SetTend( double tEnd );
00046   
00051   void SetAtol( double abstol );
00052   
00057   void SetRtol( double reltol );
00058   
00064   void SetTcur( double t );  
00065   
00070   void SetInitEncl( const INTERVAL_VECTOR & Y );
00071   
00076   void SetTightEncl( const INTERVAL_VECTOR & Y );
00077   
00083   void SetSolution( const PtrSolution Sol );
00084   
00086   double GetTend() const; 
00087   
00089   double GetAtol() const;
00090   
00092   double GetRtol() const; 
00093   
00095   double  GetTcur() const;
00096 
00098   double  GetTprev() const;
00099   
00101   const INTERVAL_VECTOR & GetInitEncl() const;
00102   
00104   const INTERVAL_VECTOR & GetTightEncl() const;
00105   
00107   const PtrSolution GetSolution() const ; 
00108   
00114   virtual void  LoadProblemParam( int ParamSet );
00115   
00126   void DisplaySolution( int comp, const char *file = 0 ) const ;
00127     
00140   void DisplayPhase( int comp1, int comp2, const char * file = 0 ) const ;
00141   
00143   virtual ~ODE_NUMERIC();
00144   
00145 private:
00146 
00148   double atol;
00149 
00151   double rtol;
00152 
00154   double Tend;
00155 
00157   PtrSolution  Solution;  
00158 
00159 };
00160 
00161 
00163 typedef ODE_NUMERIC* PtrODENumeric;
00164 
00172 template <class T>  
00173 T * GetSolution( PtrODENumeric ODE )
00174 {
00175   assert( NotNull(ODE) );
00176   return static_cast<T*>(ODE->GetSolution());
00177 }
00178 
00179 
00187 template <class T>  
00188 void InitSolution( PtrODENumeric ODE )
00189 {
00190   assert( NotNull(ODE) );
00191   assert( NotNull(ODE->GetSolution()) );
00192 
00193   *GetSolution<T>(ODE) = *ODE->GetPtrInitCond();
00194 }
00195 
00196 
00197 inline ODE_NUMERIC :: ODE_NUMERIC( int n, FCN fcn, const string & name )
00198   : ODE_PROBLEM( n, fcn, name ),
00199   atol(DEFAULT_ABS_TOL), 
00200   rtol(DEFAULT_REL_TOL)
00201 {
00202   ;
00203 }  
00204 
00205 
00206 inline void ODE_NUMERIC :: SetTend( double tEnd )   
00207 { 
00208   assert( tEnd != GetT0() ||
00209           NotNull(Solution) && tEnd != Solution->GetTcur() );
00210   Tend = tEnd;
00211 }
00212 
00213 
00214 inline void ODE_NUMERIC :: SetAtol( double abstol )    
00215 { 
00216   assert(abstol>=0); 
00217   atol = abstol; 
00218 }
00219 
00220 
00221 inline void ODE_NUMERIC :: SetRtol( double reltol ) 
00222 { 
00223   assert(reltol>=0); 
00224   rtol = reltol; 
00225 }
00226 
00227 
00228 inline void ODE_NUMERIC :: SetTcur( double t ) 
00229 {
00230   assert( NotNull(Solution) );
00231   assert( (GetTcur() <= t && t <= GetTend()) ||
00232           (GetTend() <= t && t <= GetTcur()) );
00233   
00234   Solution->SetTcur(t); 
00235 }
00236 
00237 
00238 inline void ODE_NUMERIC :: SetInitEncl( const INTERVAL_VECTOR & Y )
00239 {
00240   assert( NotNull(Solution) );  
00241   assert( GetSize() == Dimension(Y) );
00242   Solution->SetInitEncl(Y); 
00243 }
00244 
00245 
00246 inline void ODE_NUMERIC :: SetTightEncl( const INTERVAL_VECTOR & Y )
00247 {
00248   assert( NotNull(Solution) ); 
00249   assert( GetSize() == Dimension(Y) );
00250   Solution->SetTightEncl(Y); 
00251 }   
00252   
00253 
00254 inline void ODE_NUMERIC :: SetSolution( const PtrSolution Sol )
00255 {
00256   assert( NotNull(Sol) && GetSize() == Sol->GetDim() );
00257   
00258   DELETE(Solution); 
00259   Solution = Sol; 
00260 }
00261 
00262 
00263 inline double ODE_NUMERIC :: GetTend() const 
00264 { 
00265   return Tend; 
00266 }  
00267 
00268 
00269 inline double ODE_NUMERIC :: GetRtol() const 
00270 { 
00271   return rtol;
00272 }  
00273 
00274 
00275 inline double ODE_NUMERIC :: GetAtol() const 
00276 { 
00277   return atol;
00278 }  
00279 
00280 inline double ODE_NUMERIC :: GetTcur() const
00281 {
00282   assert( NotNull(Solution) );
00283   return Solution->GetTcur();
00284 }
00285 
00286 
00287 inline double ODE_NUMERIC :: GetTprev() const
00288 {
00289   assert( NotNull(Solution) );
00290   return Solution->GetTprev();
00291 }
00292 
00293 
00294 inline const INTERVAL_VECTOR & ODE_NUMERIC :: GetTightEncl() const 
00295 {
00296   assert( NotNull(Solution) );
00297   return Solution->GetTightEncl(); 
00298 }
00299 
00300 
00301 inline const INTERVAL_VECTOR & ODE_NUMERIC :: GetInitEncl() const 
00302 {
00303   assert( NotNull(Solution) );
00304   return Solution->GetInitEncl(); 
00305 }
00306 
00307 
00308 inline const PtrSolution ODE_NUMERIC :: GetSolution() const 
00309 {
00310   assert( NotNull(Solution) );
00311   return Solution; 
00312 }
00313 
00314 
00315 inline void ODE_NUMERIC :: LoadProblemParam( int )
00316 {
00317   assert(0);
00318 }
00319 
00320 
00321 inline ODE_NUMERIC :: ~ODE_NUMERIC() 
00322 { 
00323   DELETE(Solution); 
00324 }
00325 
00326 #endif 

Generated at Sun Oct 14 12:45:40 2001 for VNODE by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000