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

Contents of /trunk/ascxx/integrator.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2327 - (show annotations) (download) (as text)
Wed Dec 22 07:17:24 2010 UTC (8 years, 9 months ago) by jpye
File MIME type: text/x-chdr
File size: 2815 byte(s)
Merging in refactor of the C++ code, which is moved out of 'pygtk' and into 'ascxx'.
Adding support for IPOPT 3.9.1, the current latest version.
Support in dtar for parallel builds (possibly needs some testing still).
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 <ascend/integrator/integrator.h>
34 #include <ascend/integrator/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::vector<std::string> getEngines();
56 void setEngine(const std::string &name);
57 std::string getName() const;
58
59 SolverParameters getParameters() const;
60 void setParameters(const SolverParameters &);
61
62 void setReporter(IntegratorReporterCxx *reporter);
63
64 void setMinSubStep(double);
65 void setMaxSubStep(double);
66 void setInitialSubStep(double);
67 void setMaxSubSteps(int);
68
69 void setLinearTimesteps(UnitsM units, double start, double end, unsigned long num);
70 void setLogTimesteps(UnitsM units, double start, double end, unsigned long num);
71 std::vector<double> getCurrentObservations();
72 Variable getObservedVariable(const long &i);
73 Variable getIndependentVariable();
74
75 void findIndependentVar(); /**< find the independent variable (must not presume a certain choice of integration engine) */
76 void analyse();
77 void solve();
78 void writeMatrix(FILE *fp,const char *type=NULL) const;
79 void writeDebug(FILE *fp) const;
80
81 double getCurrentTime();
82 long getCurrentStep();
83 long getNumSteps();
84 int getNumVars();
85 int getNumObservedVars();
86
87 protected:
88 IntegratorSystem *getInternalType();
89 private:
90 Simulation &simulation;
91 SampleList *samplelist;
92 IntegratorSystem *blsys;
93 };
94
95 #endif

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