comparison liboctave/DAEFunc.h @ 4049:a35a3c5d4740

[project @ 2002-08-16 08:54:31 by jwe]
author jwe
date Fri, 16 Aug 2002 08:54:31 +0000
parents 48d2bc4a3729
children 23b37da9fd5b
comparison
equal deleted inserted replaced
4048:c9991c59cf5c 4049:a35a3c5d4740
42 typedef Matrix (*DAEJacFunc) (const ColumnVector& x, 42 typedef Matrix (*DAEJacFunc) (const ColumnVector& x,
43 const ColumnVector& xdot, 43 const ColumnVector& xdot,
44 double t, double cj); 44 double t, double cj);
45 45
46 DAEFunc (void) 46 DAEFunc (void)
47 : fun (0), jac (0) { } 47 : fun (0), jac (0), reset (true) { }
48 48
49 DAEFunc (DAERHSFunc f) 49 DAEFunc (DAERHSFunc f)
50 : fun (f), jac (0) { } 50 : fun (f), jac (0), reset (true) { }
51 51
52 DAEFunc (DAERHSFunc f, DAEJacFunc j) 52 DAEFunc (DAERHSFunc f, DAEJacFunc j)
53 : fun (f), jac (j) { } 53 : fun (f), jac (j), reset (true) { }
54 54
55 DAEFunc (const DAEFunc& a) 55 DAEFunc (const DAEFunc& a)
56 : fun (a.fun), jac (a.jac) { } 56 : fun (a.fun), jac (a.jac), reset (a.reset) { }
57 57
58 DAEFunc& operator = (const DAEFunc& a) 58 DAEFunc& operator = (const DAEFunc& a)
59 { 59 {
60 if (this != &a) 60 if (this != &a)
61 { 61 {
62 fun = a.fun; 62 fun = a.fun;
63 jac = a.jac; 63 jac = a.jac;
64 reset = a.reset;
64 } 65 }
65 return *this; 66 return *this;
66 } 67 }
67 68
68 ~DAEFunc (void) { } 69 ~DAEFunc (void) { }
70 DAERHSFunc function (void) const { return fun; } 71 DAERHSFunc function (void) const { return fun; }
71 72
72 DAEFunc& set_function (DAERHSFunc f) 73 DAEFunc& set_function (DAERHSFunc f)
73 { 74 {
74 fun = f; 75 fun = f;
76 reset = true;
75 return *this; 77 return *this;
76 } 78 }
77 79
78 DAEJacFunc jacobian_function (void) const { return jac; } 80 DAEJacFunc jacobian_function (void) const { return jac; }
79 81
80 DAEFunc& set_jacobian_function (DAEJacFunc j) 82 DAEFunc& set_jacobian_function (DAEJacFunc j)
81 { 83 {
82 jac = j; 84 jac = j;
85 reset = true;
83 return *this; 86 return *this;
84 } 87 }
85 88
86 protected: 89 protected:
87 90
88 DAERHSFunc fun; 91 DAERHSFunc fun;
89 DAEJacFunc jac; 92 DAEJacFunc jac;
93
94 // This variable is TRUE when this object is constructed, and also
95 // after any internal data has changed. Derived classes may use
96 // this information (and change it) to know when to (re)initialize
97 // their own internal data related to this object.
98
99 bool reset;
90 }; 100 };
91 101
92 #endif 102 #endif
93 103
94 /* 104 /*