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

Contents of /trunk/pygtk/integrator.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1129 - (show annotations) (download) (as text)
Sat Jan 13 11:40:59 2007 UTC (14 years ago) by johnpye
File MIME type: text/x-chdr
File size: 2815 byte(s)
Added integrator_write_matrix routine to allow integrator matrices to be written out.
Modified integrator in PyGTK to output this matrix to a file in /tmp in the case where Integrator::solve fails.
Fixed a bug in densematrix_write_mmio.
The current implementation of integrator_write_matrix might not be quite right yet... needs some more thought.
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 #ifdef ASC_WITH_IDA
39 const int IDA = INTEG_IDA;
40 #endif
41
42 #include "simulation.h"
43 #include "units.h"
44 #include "integratorreporter.h"
45 #include "variable.h"
46
47 class Integrator{
48 friend class IntegratorReporterCxx;
49 friend class IntegratorReporterConsole;
50
51 public:
52 Integrator(Simulation &);
53 ~Integrator();
54
55 static std::map<int,std::string> getEngines();
56 void setEngine(IntegratorEngine engine);
57 void setEngine(int engine);
58 void setEngine(const std::string &name);
59 std::string getEngineName() const;
60
61 SolverParameters getParameters() const;
62 void setParameters(const SolverParameters &);
63
64 void setReporter(IntegratorReporterCxx *reporter);
65
66 void setMinSubStep(double);
67 void setMaxSubStep(double);
68 void setInitialSubStep(double);
69 void setMaxSubSteps(int);
70
71 void setLinearTimesteps(UnitsM units, double start, double end, unsigned long num);
72 void setLogTimesteps(UnitsM units, double start, double end, unsigned long num);
73 std::vector<double> getCurrentObservations();
74 Variable getObservedVariable(const long &i);
75 Variable getIndependentVariable();
76
77 void findIndependentVar(); /**< find the independent variable (must not presume a certain choice of integration engine) */
78 void analyse();
79 void solve();
80 void writeMatrix(FILE *fp) const;
81
82 double getCurrentTime();
83 long getCurrentStep();
84 long getNumSteps();
85 int getNumVars();
86 int getNumObservedVars();
87
88 protected:
89 IntegratorSystem *getInternalType();
90 private:
91 Simulation &simulation;
92 SampleList *samplelist;
93 IntegratorSystem *blsys;
94 };
95
96 #endif

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