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 |
#include "simulation.h" |
38 |
#include "units.h" |
39 |
#include "integratorreporter.h" |
40 |
#include "variable.h" |
41 |
|
42 |
class Integrator{ |
43 |
friend class IntegratorReporterCxx; |
44 |
|
45 |
public: |
46 |
Integrator(Simulation &); |
47 |
~Integrator(); |
48 |
|
49 |
std::map<int,std::string> getEngines() const; |
50 |
int setEngine(IntegratorEngine engine); |
51 |
int setEngine(int engine); |
52 |
std::string getEngineName() const; |
53 |
|
54 |
void setReporter(IntegratorReporterCxx *reporter); |
55 |
|
56 |
void setMinSubStep(double); |
57 |
void setMaxSubStep(double); |
58 |
void setInitialSubStep(double); |
59 |
void setMaxSubSteps(int); |
60 |
|
61 |
void setLinearTimesteps(UnitsM units, double start, double end, unsigned long num); |
62 |
std::vector<double> getCurrentObservations(); |
63 |
Variable getObservedVariable(const long &i); |
64 |
Variable getIndependentVariable(); |
65 |
|
66 |
int findIndependentVar(); /** find the independent variable (must not presume a certain choice of integration engine) */ |
67 |
int analyse(); /** analysis gives you details about what your variables are etc */ |
68 |
int solve(); |
69 |
|
70 |
double getCurrentTime(); |
71 |
long getCurrentStep(); |
72 |
long getNumSteps(); |
73 |
int getNumVars(); |
74 |
int getNumObservedVars(); |
75 |
|
76 |
protected: |
77 |
IntegratorSystem *getInternalType(); |
78 |
private: |
79 |
Simulation &simulation; |
80 |
SampleList *samplelist; |
81 |
IntegratorSystem *blsys; |
82 |
}; |
83 |
|
84 |
#endif |