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

Contents of /trunk/pygtk/integrator.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 941 - (show annotations) (download) (as text)
Fri Nov 24 10:46:32 2006 UTC (13 years, 11 months ago) by johnpye
File MIME type: text/x-chdr
File size: 2605 byte(s)
Changed integrator_set_engine to return 0 on success.
Fixed Integrator::setEngine to throw range_error / IndexError on invalid selection.
Test suite contains testIDA that works now (more tests yet to come)
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 Integrator interface. Intention is that this will allow
20 us to use the PyGTK 'observer' tab to receive the results of an integration
21 job, which can then be easily exported to a spreadsheet for plotting (or
22 we can implement ASCPLOT style plotting, perhaps).
23 */
24 #ifndef ASCXX_INTEGRATOR_H
25 #define ASCXX_INTEGRATOR_H
26
27 #include <string>
28 #include <map>
29 #include <vector>
30
31 #include "config.h"
32 extern "C"{
33 #include <solver/integrator.h>
34 #include <solver/samplelist.h>
35 }
36
37 const int LSODE = INTEG_LSODE;
38 const int IDA = INTEG_IDA;
39
40 #include "simulation.h"
41 #include "units.h"
42 #include "integratorreporter.h"
43 #include "variable.h"
44
45 class Integrator{
46 friend class IntegratorReporterCxx;
47
48 public:
49 Integrator(Simulation &);
50 ~Integrator();
51
52 static std::map<int,std::string> getEngines();
53 void setEngine(IntegratorEngine engine);
54 void setEngine(int engine);
55 void setEngine(const std::string &name);
56 std::string getEngineName() const;
57
58 void setReporter(IntegratorReporterCxx *reporter);
59
60 void setMinSubStep(double);
61 void setMaxSubStep(double);
62 void setInitialSubStep(double);
63 void setMaxSubSteps(int);
64
65 void setLinearTimesteps(UnitsM units, double start, double end, unsigned long num);
66 std::vector<double> getCurrentObservations();
67 Variable getObservedVariable(const long &i);
68 Variable getIndependentVariable();
69
70 int findIndependentVar(); /** find the independent variable (must not presume a certain choice of integration engine) */
71 int analyse(); /** analysis gives you details about what your variables are etc */
72 int solve();
73
74 double getCurrentTime();
75 long getCurrentStep();
76 long getNumSteps();
77 int getNumVars();
78 int getNumObservedVars();
79
80 protected:
81 IntegratorSystem *getInternalType();
82 private:
83 Simulation &simulation;
84 SampleList *samplelist;
85 IntegratorSystem *blsys;
86 };
87
88 #endif

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