![]() |
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __RHS_H 00005 #define __RHS_H 00006 00007 #include <limits> 00008 #include <dolfin/constants.h> 00009 #include <dolfin/Vector.h> 00010 #include <dolfin/Event.h> 00011 00012 namespace dolfin { 00013 00014 class ODE; 00015 class Solution; 00016 class Function; 00017 00022 00023 class RHS { 00024 public: 00025 00027 RHS(ODE& ode, Solution& solution); 00028 00030 RHS(ODE& ode, Function& function); 00031 00033 ~RHS(); 00034 00036 unsigned int size() const; 00037 00039 real operator() (unsigned int index, real t); 00040 00042 real operator() (unsigned int index, unsigned int node, real t); 00043 00044 // Compute derivative dfi/duj 00045 real dfdu(unsigned int i, unsigned int j, real t); 00046 00047 private: 00048 00049 // Update components that influence the current component at time t 00050 void update(unsigned int index, unsigned int node, real t); 00051 00052 // Update when we use Solution 00053 void updateSolution(unsigned int index, unsigned int node, real t); 00054 00055 // Update when we use Solution 00056 void updateFunction(unsigned int index, real t); 00057 00058 // Check computed value 00059 inline real check(real value) 00060 { 00061 if ( value > -std::numeric_limits<real>::max() && 00062 value < std::numeric_limits<real>::max() ) 00063 return value; 00064 00065 illegal_number(); 00066 return 0.0; 00067 } 00068 00069 // Number of components 00070 unsigned int N; 00071 00072 // The ODE 00073 ODE& ode; 00074 00075 // Solution 00076 Solution* solution; 00077 00078 // Function 00079 Function* function; 00080 00081 // Solution vector 00082 Vector u; 00083 00084 // Event for illegal value of right-hand side 00085 Event illegal_number; 00086 00087 }; 00088 00089 } 00090 00091 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.