3
|
1 // DAEFunc.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1992, 1993 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (_DAEFunc_h) |
|
25 #define _DAEFunc_h 1 |
|
26 |
|
27 #ifdef __GNUG__ |
|
28 #pragma interface |
|
29 #endif |
|
30 |
|
31 #include <iostream.h> |
|
32 #include "Matrix.h" |
|
33 |
|
34 #ifndef Vector |
|
35 #define Vector ColumnVector |
|
36 #endif |
|
37 |
|
38 #ifndef _DAEFunc_typedefs |
|
39 #define _DAEFunc_typedefs 1 |
|
40 |
|
41 typedef struct DAEJac |
|
42 { |
|
43 Matrix *dfdxdot; |
|
44 Matrix *dfdx; |
|
45 }; |
|
46 |
|
47 typedef Vector (*DAERHSFunc) (const Vector& x, const Vector& xdot, double); |
|
48 typedef DAEJac (*DAEJacFunc) (const Vector& x, const Vector& xdot, double); |
|
49 |
|
50 #endif |
|
51 |
|
52 class DAEFunc |
|
53 { |
|
54 public: |
|
55 |
|
56 DAEFunc (void); |
|
57 DAEFunc (DAERHSFunc f); |
|
58 DAEFunc (DAERHSFunc f, DAEJacFunc j); |
|
59 |
|
60 DAEFunc (const DAEFunc& a); |
|
61 |
|
62 DAEFunc& operator = (const DAEFunc& a); |
|
63 |
|
64 DAERHSFunc function (void) const; |
|
65 |
|
66 DAEFunc& set_function (DAERHSFunc f); |
|
67 |
|
68 DAEJacFunc jacobian_function (void) const; |
|
69 |
|
70 DAEFunc& set_jacobian_function (DAEJacFunc f); |
|
71 |
|
72 protected: |
|
73 |
|
74 DAERHSFunc fun; |
|
75 |
|
76 DAEJacFunc jac; |
|
77 }; |
|
78 |
|
79 #endif |