comparison liboctave/ODEFunc.h @ 4049:a35a3c5d4740

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