1 |
johnpye |
669 |
/* ASCEND modelling environment |
2 |
|
|
Copyright (C) 2006 Carnegie Mellon University |
3 |
|
|
|
4 |
|
|
This program is free software; you can redistribute it and/or modify |
5 |
|
|
it under the terms of the GNU General Public License as published by |
6 |
|
|
the Free Software Foundation; either version 2, or (at your option) |
7 |
|
|
any later version. |
8 |
|
|
|
9 |
|
|
This program is distributed in the hope that it will be useful, |
10 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
|
|
GNU General Public License for more details. |
13 |
|
|
|
14 |
|
|
You should have received a copy of the GNU General Public License |
15 |
|
|
along with this program; if not, write to the Free Software |
16 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, |
17 |
|
|
Boston, MA 02111-1307, USA. |
18 |
|
|
*//** @file |
19 |
|
|
C++ wrapper for the IntegratorReporter struct in the solver C-API. |
20 |
|
|
This class is intended to be exposed via the SWIG 'director' functionality |
21 |
|
|
which allows it to be overloaded in Python, so reporting of integration |
22 |
|
|
results can be done directly with python scripts of the user's design. |
23 |
|
|
*/ |
24 |
|
|
#ifndef ASCXX_INTEGRATORREPORTER_H |
25 |
|
|
#define ASCXX_INTEGRATORREPORTER_H |
26 |
|
|
|
27 |
|
|
extern "C"{ |
28 |
|
|
#include <utilities/ascConfig.h> |
29 |
|
|
#include <solver/integrator.h> |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
class Integrator; |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
Observer API to allow ASCEND to add rows/columbs to the observer panel |
36 |
|
|
in the Python interface. |
37 |
|
|
|
38 |
|
|
Should also be generalisable so that we can output observations to files |
39 |
|
|
etc. |
40 |
|
|
*/ |
41 |
|
|
class IntegratorReporterCxx{ |
42 |
|
|
friend int ascxx_integratorreporter_init(IntegratorSystem *); |
43 |
|
|
friend int ascxx_integratorreporter_write(IntegratorSystem *); |
44 |
|
|
friend int ascxx_integratorreporter_write_obs(IntegratorSystem *); |
45 |
|
|
friend int ascxx_integratorreporter_close(IntegratorSystem *); |
46 |
|
|
friend class Integrator; |
47 |
|
|
|
48 |
|
|
public: |
49 |
|
|
IntegratorReporterCxx(Integrator *); |
50 |
|
|
virtual ~IntegratorReporterCxx(); |
51 |
|
|
|
52 |
|
|
//virtual void addObservedVariable(Variable v); |
53 |
|
|
virtual int initOutput(); |
54 |
|
|
virtual int closeOutput(); |
55 |
|
|
virtual int updateStatus(); |
56 |
|
|
virtual int recordObservedValues(); |
57 |
|
|
|
58 |
|
|
Integrator *getIntegrator(); |
59 |
|
|
|
60 |
|
|
private: |
61 |
|
|
Integrator *integrator; /**< pointer back to integrator */ |
62 |
|
|
IntegratorReporter reporter; /**< for passing to C */ |
63 |
|
|
|
64 |
|
|
IntegratorReporter *getInternalType(); |
65 |
|
|
}; |
66 |
|
|
|
67 |
|
|
int ascxx_integratorreporter_init(IntegratorSystem *blsys); |
68 |
|
|
int ascxx_integratorreporter_write(IntegratorSystem *blsys); |
69 |
|
|
int ascxx_integratorreporter_write_obs(IntegratorSystem *blsys); |
70 |
|
|
int ascxx_integratorreporter_close(IntegratorSystem *blsys); |
71 |
|
|
|
72 |
|
|
#endif |