/[ascend]/trunk/pygtk/integratorreporter.h
ViewVC logotype

Contents of /trunk/pygtk/integratorreporter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 944 - (show annotations) (download) (as text)
Sat Nov 25 10:46:13 2006 UTC (14 years, 2 months ago) by johnpye
File MIME type: text/x-chdr
File size: 3249 byte(s)
Implemented ATOLVECT, ATOL, RTOL parameters for the IDA integrator.
1 /* 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 #include <ostream>
33
34 class Integrator;
35
36 /**
37 Observer API to allow ASCEND to add rows/columbs to the observer panel
38 in the Python interface.
39
40 Should also be generalisable so that we can output observations to files
41 etc.
42 */
43 class IntegratorReporterCxx{
44 friend int ascxx_integratorreporter_init(IntegratorSystem *);
45 friend int ascxx_integratorreporter_write(IntegratorSystem *);
46 friend int ascxx_integratorreporter_write_obs(IntegratorSystem *);
47 friend int ascxx_integratorreporter_close(IntegratorSystem *);
48 friend class Integrator;
49
50 public:
51 IntegratorReporterCxx(Integrator *);
52 virtual ~IntegratorReporterCxx();
53
54 //virtual void addObservedVariable(Variable v);
55 virtual int initOutput();
56 virtual int closeOutput();
57 virtual int updateStatus();
58 virtual int recordObservedValues();
59
60 Integrator *getIntegrator();
61
62 protected:
63 Integrator *integrator; /**< pointer back to integrator */
64 IntegratorReporter reporter; /**< for passing to C */
65
66 IntegratorReporter *getInternalType();
67 };
68
69 /**
70 NULL integrator reporter. This reporter won't output ANYTHING at all.
71 */
72 class IntegratorReporterNull : public IntegratorReporterCxx{
73 public:
74 IntegratorReporterNull(Integrator *);
75 virtual ~IntegratorReporterNull();
76
77 virtual int initOutput();
78 virtual int closeOutput();
79 virtual int updateStatus();
80 virtual int recordObservedValues();
81 };
82
83 /**
84 Simple console based integrator reporter. Output the observed variables
85 to the console at each sample point.
86 */
87 class IntegratorReporterConsole : public IntegratorReporterCxx{
88 private:
89 std::ostream &f;
90 public:
91 IntegratorReporterConsole(Integrator *);
92 virtual ~IntegratorReporterConsole();
93
94 virtual int initOutput();
95 virtual int closeOutput();
96 virtual int updateStatus();
97 virtual int recordObservedValues();
98 };
99
100
101 int ascxx_integratorreporter_init(IntegratorSystem *blsys);
102 int ascxx_integratorreporter_write(IntegratorSystem *blsys);
103 int ascxx_integratorreporter_write_obs(IntegratorSystem *blsys);
104 int ascxx_integratorreporter_close(IntegratorSystem *blsys);
105
106 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22