GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
DAEFunc.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1993-2025 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
34{
35public:
36
38 const ColumnVector& xdot,
39 double t, octave_idx_type& ires);
40
41 // This is really the form used by DASSL:
42 //
43 // PD = DG/DY + CJ * DG/DYPRIME
44
45 typedef Matrix (*DAEJacFunc) (const ColumnVector& x,
46 const ColumnVector& xdot,
47 double t, double cj);
48
50 : m_fcn (nullptr), m_jac (nullptr), m_reset (true) { }
51
53 : m_fcn (f), m_jac (nullptr), m_reset (true) { }
54
56 : m_fcn (f), m_jac (j), m_reset (true) { }
57
58 DAEFunc (const DAEFunc& a)
59 : m_fcn (a.m_fcn), m_jac (a.m_jac), m_reset (a.m_reset) { }
60
62 {
63 if (this != &a)
64 {
65 m_fcn = a.m_fcn;
66 m_jac = a.m_jac;
67 m_reset = a.m_reset;
68 }
69 return *this;
70 }
71
72 virtual ~DAEFunc () = default;
73
74 DAERHSFunc function () const { return m_fcn; }
75
77 {
78 m_fcn = f;
79 m_reset = true;
80 return *this;
81 }
82
83 DAEJacFunc jacobian_function () const { return m_jac; }
84
86 {
87 m_jac = j;
88 m_reset = true;
89 return *this;
90 }
91
92protected:
93
96
97 // This variable is TRUE when this object is constructed, and also
98 // after any internal data has changed. Derived classes may use
99 // this information (and change it) to know when to (re)initialize
100 // their own internal data related to this object.
101
103};
104
105#endif
DAEFunc & operator=(const DAEFunc &a)
Definition DAEFunc.h:61
DAEJacFunc jacobian_function() const
Definition DAEFunc.h:83
Matrix(* DAEJacFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
Definition DAEFunc.h:45
bool m_reset
Definition DAEFunc.h:102
DAEJacFunc m_jac
Definition DAEFunc.h:95
DAEFunc & set_function(DAERHSFunc f)
Definition DAEFunc.h:76
DAERHSFunc function() const
Definition DAEFunc.h:74
DAEFunc(DAERHSFunc f)
Definition DAEFunc.h:52
virtual ~DAEFunc()=default
DAEFunc & set_jacobian_function(DAEJacFunc j)
Definition DAEFunc.h:85
ColumnVector(* DAERHSFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
Definition DAEFunc.h:37
DAERHSFunc m_fcn
Definition DAEFunc.h:94
DAEFunc(DAERHSFunc f, DAEJacFunc j)
Definition DAEFunc.h:55
DAEFunc()
Definition DAEFunc.h:49
DAEFunc(const DAEFunc &a)
Definition DAEFunc.h:58
F77_RET_T const F77_DBLE * x
F77_RET_T const F77_DBLE const F77_DBLE * f