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

Contents of /trunk/pygtk/simulation.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 669 - (show annotations) (download) (as text)
Wed Jun 21 07:00:45 2006 UTC (17 years, 11 months ago) by johnpye
File MIME type: text/x-chdr
File size: 2082 byte(s)
Merged changes from DAE branch (revisions 702 to 819) back into trunk.
This adds the Integration API to the ASCEND solver (in base/generic).
Also provides pre-alpha support for 'IDA' from the SUNDIALS suite, a DAE solver.
Many other minor code clean-ups, including adoption of new 'ASC_NEW' and friends (to replace 'ascmalloc')
Added some very sketchy stuff providing 'DIFF(...)' syntax, although it is anticipated that this will be removed.
1 #ifndef ASCXX_SIMULATION_H
2 #define ASCXX_SIMULATION_H
3
4 #include <string>
5 #include <vector>
6 #include <map>
7
8 #include "symchar.h"
9 #include "type.h"
10 #include "instance.h"
11
12 class Variable;
13
14 #include "config.h"
15 extern "C"{
16 #include <compiler/createinst.h>
17 #include <solver/slv_types.h>
18 }
19
20 class Solver;
21 class SolverParameters;
22 class SolverStatus;
23 class IncidenceMatrix;
24 class SolverReporter;
25
26 /**
27 @TODO This class is for *Simulation* instances.
28
29 Handle instantiating, running initialisation functions, solving
30 and outputing results of solutions.
31
32 In ASCEND C-code, a simulation is a special type of Instance. It
33 has a 'simulation root' instance which often needs to be used for
34 solving, inspecting, etc, rather than the simulation instance itself.
35 */
36 class Simulation : public Instanc{
37 friend class IncidenceMatrix;
38 friend class SolverStatus;
39 friend class Integrator;
40
41 private:
42 Instanc simroot;
43 slv_system_structure *sys;
44 bool is_built;
45
46 // options to pass to BinTokenSetOptions
47 /// TODO these should probably be put somewhere else
48 std::string *bin_srcname;
49 std::string *bin_objname;
50 std::string *bin_libname;
51 std::string *bin_cmd;
52 std::string *bin_rm;
53
54 int activeblock;
55
56 protected:
57 slv_system_structure *getSystem();
58
59 public:
60 explicit Simulation(Instance *i, const SymChar &name);
61 Simulation(const Simulation &);
62 ~Simulation();
63
64 Instanc &getModel();
65 void run(const Method &method);
66 void checkDoF() const;
67 const bool check();
68 void build();
69 void solve(Solver s, SolverReporter &reporter);
70 std::vector<Variable> getFixableVariables();
71 std::vector<Variable> getVariablesNearBounds(const double &epsilon=1e-4);
72
73 void write();
74
75 void setSolver(Solver &s);
76 const Solver getSolver() const;
77
78 SolverParameters getSolverParameters() const;
79 void setSolverParameters(SolverParameters &);
80
81 IncidenceMatrix getIncidenceMatrix();
82
83 const std::string getInstanceName(const Instanc &) const;
84
85 void processVarStatus();
86 const int getNumVars();
87
88 const int getActiveBlock() const;
89
90 void checkConsistency() const;
91 void checkStructuralSingularity() const;
92 };
93
94
95 #endif

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