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

odeprobl.h

Go to the documentation of this file.
00001 
00002 // FILE odeprobl.h
00003 
00004 
00005 #ifndef  INCLUDED_ODEPROBL_H
00006 #define  INCLUDED_ODEPROBL_H
00007 
00008 
00009 #include "vndinl.h"
00010 #include "vndobj.h"
00011 #include "odesol.h"
00012 
00013 
00019 typedef void (*FCN)( INTERVAL *yp, const INTERVAL *y );
00020 
00035 typedef void  (*EXACT_SOL)( INTERVAL_VECTOR & Yexact, 
00036                             const INTERVAL & t,
00037                             const INTERVAL_VECTOR & Y0, 
00038                             double t0 );
00039 
00040 
00049 class ODE_PROBLEM : private NAME
00050 {
00051   
00052 public:
00053   
00054   NAME::GetName;
00055   
00064   ODE_PROBLEM( int n, FCN fcn, const string & name );
00065 
00067   int GetSize() const;  
00068   
00070   void SetT0( double t0 );
00071     
00079   void SetInitCond( const INTERVAL_VECTOR & Y ); 
00080 
00089   void SetInitCond( const PtrSolution IC ); 
00090   
00096   double  GetT0() const;
00097   
00099   const INTERVAL_VECTOR & GetInitCond() const;
00100   
00102   const PtrSolution GetPtrInitCond() const;
00103     
00109   void  ConstCoeff( bool cc );
00110     
00116   bool  ExactSol()      const;
00117   
00123   bool  PointInitCond() const;
00124   
00130   bool  ScalarProblem() const;
00131     
00136   bool  ConstCoeff()    const;
00137                                    
00145   void CompRightSide( INTERVAL_VECTOR & YP, const INTERVAL_VECTOR & Y ) const;
00146   
00152   void SetCompExactSol( EXACT_SOL f );
00153   
00163   void CompExactSol( INTERVAL_VECTOR & Y, const INTERVAL & t );
00164   
00166   virtual ~ODE_PROBLEM();
00167   
00168 private:
00169   
00171   int   Size;             
00172   
00174   FCN   Fcn;             
00175   
00177   PtrSolution  InitCond;     
00178   
00180   EXACT_SOL CompSol;         
00181   
00183   class PROBLEM_INFO
00184   {
00185   public:
00187     bool ConstCoeff;   
00188     
00190     bool Scalar;       
00191     
00193     bool ExactSol;     
00194     
00196     bool PointInitCond;
00197     
00199     PROBLEM_INFO() : ConstCoeff(false), Scalar(false), 
00200       ExactSol(false), PointInitCond(true) {;}
00201   } 
00202   ProblemInfo; 
00203   
00204 };
00205 
00206 
00207 
00208 inline void ODE_PROBLEM :: SetT0( double t0 ) 
00209 { 
00210   assert( NotNull(InitCond) );
00211   InitCond->SetTcur(t0); 
00212 }
00213 
00214 
00215 inline void ODE_PROBLEM :: SetInitCond( const PtrSolution IC ) 
00216 { 
00217   assert( NotNull(IC) );
00218   assert( GetSize() == IC->GetDim() );
00219   DELETE(InitCond); 
00220   InitCond = IC; 
00221 }
00222 
00223 
00224 inline void  ODE_PROBLEM :: SetCompExactSol( EXACT_SOL f ) 
00225 { 
00226   assert(NotNull(f)); 
00227   CompSol = f; 
00228 }
00229 
00230 
00231 inline int ODE_PROBLEM :: GetSize() const 
00232 { 
00233   return Size;
00234 }
00235 
00236 
00237 inline double ODE_PROBLEM :: GetT0() const    
00238 { 
00239   assert( NotNull(InitCond) ); 
00240   return InitCond->GetTcur(); 
00241 }
00242 
00243 
00244 inline const INTERVAL_VECTOR & ODE_PROBLEM :: GetInitCond() const 
00245 { 
00246   assert( NotNull(InitCond) );
00247   return InitCond->GetTightEncl(); 
00248 }
00249 
00250 
00251 inline const PtrSolution ODE_PROBLEM :: GetPtrInitCond() const 
00252 { 
00253   assert( NotNull(InitCond) );
00254   return InitCond;
00255 }
00256 
00257 
00258 inline void ODE_PROBLEM :: ConstCoeff( bool cc ) 
00259 { 
00260   ProblemInfo.ConstCoeff = cc; 
00261 }
00262 
00263 
00264 inline bool ODE_PROBLEM :: ExactSol() const       
00265 { 
00266   return CompSol == NULL? false:true; 
00267 }
00268 
00269 
00270 inline bool ODE_PROBLEM :: PointInitCond() const  
00271 { 
00272   return  ProblemInfo.PointInitCond; 
00273 }
00274 
00275 
00276 inline bool ODE_PROBLEM :: ScalarProblem() const  
00277 { 
00278   return ProblemInfo.Scalar; 
00279 }  
00280 
00281 
00282 inline bool ODE_PROBLEM :: ConstCoeff() const  
00283 { 
00284   return ProblemInfo.ConstCoeff; 
00285 }
00286 
00287 
00288 inline void  ODE_PROBLEM :: CompExactSol( INTERVAL_VECTOR & Y, 
00289                                           const INTERVAL & t ) 
00290 { 
00291   assert(CompSol); 
00292   CompSol(Y,t, GetInitCond(), GetT0() ); 
00293 }
00294 
00295 
00296 inline void ODE_PROBLEM::
00297 CompRightSide( INTERVAL_VECTOR & YP, const INTERVAL_VECTOR & Y ) const
00298 {
00299   assert(Fcn);
00300   Fcn( THE_ELEM(YP), THE_ELEM(Y) );  
00301 }
00302 
00303 
00304 inline ODE_PROBLEM :: ~ODE_PROBLEM()  
00305 { 
00306   DELETE(InitCond); 
00307 }
00308 
00309 
00310 #endif 

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