GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ODEFunc.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_ODEFunc_h)
27#define octave_ODEFunc_h 1
28
29#include "octave-config.h"
30
31#include "mx-fwd.h"
32
33class
35{
36public:
37
38 typedef ColumnVector (*ODERHSFunc) (const ColumnVector&, double);
39 typedef Matrix (*ODEJacFunc) (const ColumnVector&, double);
40
41 ODEFunc (void)
42 : m_fun (nullptr), m_jac (nullptr), m_reset (true) { }
43
44 ODEFunc (ODERHSFunc f)
45 : m_fun (f), m_jac (nullptr), m_reset (true) { }
46
47 ODEFunc (ODERHSFunc f, ODEJacFunc j)
48 : m_fun (f), m_jac (j), m_reset (true) { }
49
50 ODEFunc (const ODEFunc& a)
51 : m_fun (a.m_fun), m_jac (a.m_jac), m_reset (true) { }
52
53 ODEFunc& operator = (const ODEFunc& a)
54 {
55 if (this != &a)
56 {
57 m_fun = a.m_fun;
58 m_jac = a.m_jac;
59 m_reset = a.m_reset;
60 }
61 return *this;
62 }
63
64 virtual ~ODEFunc (void) = default;
65
66 ODERHSFunc function (void) const { return m_fun; }
67
68 ODEFunc& set_function (ODERHSFunc f)
69 {
70 m_fun = f;
71 m_reset = true;
72 return *this;
73 }
74
75 ODEJacFunc jacobian_function (void) const { return m_jac; }
76
78 {
79 m_jac = j;
80 m_reset = true;
81 return *this;
82 }
83
84protected:
85
86 ODERHSFunc m_fun;
87 ODEJacFunc m_jac;
88
89 // This variable is TRUE when this object is constructed, and also
90 // after any internal data has changed. Derived classes may use
91 // this information (and change it) to know when to (re)initialize
92 // their own internal data related to this object.
93
94 bool m_reset;
95};
96
97#endif
ODEJacFunc m_jac
Definition: ODEFunc.h:87
virtual ~ODEFunc(void)=default
ODEFunc(ODERHSFunc f)
Definition: ODEFunc.h:44
ODEFunc(const ODEFunc &a)
Definition: ODEFunc.h:50
ODERHSFunc function(void) const
Definition: ODEFunc.h:66
ODEFunc(void)
Definition: ODEFunc.h:41
ODEFunc(ODERHSFunc f, ODEJacFunc j)
Definition: ODEFunc.h:47
ODEFunc & set_function(ODERHSFunc f)
Definition: ODEFunc.h:68
ODERHSFunc m_fun
Definition: ODEFunc.h:86
bool m_reset
Definition: ODEFunc.h:94
ODEFunc & set_jacobian_function(ODEJacFunc j)
Definition: ODEFunc.h:77
ODEJacFunc jacobian_function(void) const
Definition: ODEFunc.h:75
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