GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
DAEFunc.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_DAEFunc_h)
27#define octave_DAEFunc_h 1
28
29#include "octave-config.h"
30
31#include "mx-fwd.h"
32
33class
35{
36public:
37
38 typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x,
39 const ColumnVector& xdot,
40 double t, octave_idx_type& ires);
41
42 // This is really the form used by DASSL:
43 //
44 // PD = DG/DY + CJ * DG/DYPRIME
45
46 typedef Matrix (*DAEJacFunc) (const ColumnVector& x,
47 const ColumnVector& xdot,
48 double t, double cj);
49
50 DAEFunc (void)
51 : m_fun (nullptr), m_jac (nullptr), m_reset (true) { }
52
53 DAEFunc (DAERHSFunc f)
54 : m_fun (f), m_jac (nullptr), m_reset (true) { }
55
56 DAEFunc (DAERHSFunc f, DAEJacFunc j)
57 : m_fun (f), m_jac (j), m_reset (true) { }
58
59 DAEFunc (const DAEFunc& a)
60 : m_fun (a.m_fun), m_jac (a.m_jac), m_reset (a.m_reset) { }
61
62 DAEFunc& operator = (const DAEFunc& a)
63 {
64 if (this != &a)
65 {
66 m_fun = a.m_fun;
67 m_jac = a.m_jac;
68 m_reset = a.m_reset;
69 }
70 return *this;
71 }
72
73 virtual ~DAEFunc (void) = default;
74
75 DAERHSFunc function (void) const { return m_fun; }
76
77 DAEFunc& set_function (DAERHSFunc f)
78 {
79 m_fun = f;
80 m_reset = true;
81 return *this;
82 }
83
84 DAEJacFunc jacobian_function (void) const { return m_jac; }
85
87 {
88 m_jac = j;
89 m_reset = true;
90 return *this;
91 }
92
93protected:
94
95 DAERHSFunc m_fun;
96 DAEJacFunc m_jac;
97
98 // This variable is TRUE when this object is constructed, and also
99 // after any internal data has changed. Derived classes may use
100 // this information (and change it) to know when to (re)initialize
101 // their own internal data related to this object.
102
104};
105
106#endif
DAEJacFunc jacobian_function(void) const
Definition: DAEFunc.h:84
DAEFunc(void)
Definition: DAEFunc.h:50
DAERHSFunc m_fun
Definition: DAEFunc.h:95
virtual ~DAEFunc(void)=default
bool m_reset
Definition: DAEFunc.h:103
DAEJacFunc m_jac
Definition: DAEFunc.h:96
DAEFunc & set_function(DAERHSFunc f)
Definition: DAEFunc.h:77
DAEFunc(DAERHSFunc f)
Definition: DAEFunc.h:53
DAEFunc & set_jacobian_function(DAEJacFunc j)
Definition: DAEFunc.h:86
DAEFunc(DAERHSFunc f, DAEJacFunc j)
Definition: DAEFunc.h:56
DAEFunc(const DAEFunc &a)
Definition: DAEFunc.h:59
DAERHSFunc function(void) const
Definition: DAEFunc.h:75
F77_RET_T const F77_DBLE * x
F77_RET_T const F77_DBLE const F77_DBLE * f
class OCTAVE_API Matrix
Definition: mx-fwd.h:31
class OCTAVE_API ColumnVector
Definition: mx-fwd.h:45