1 |
johnpye |
132 |
#ifndef ASCXX_SIMULATION_H |
2 |
|
|
#define ASCXX_SIMULATION_H |
3 |
|
|
|
4 |
|
|
#include <string> |
5 |
|
|
#include <vector> |
6 |
|
|
|
7 |
johnpye |
164 |
|
8 |
johnpye |
132 |
#include "symchar.h" |
9 |
|
|
#include "type.h" |
10 |
|
|
#include "instance.h" |
11 |
|
|
#include "variable.h" |
12 |
|
|
|
13 |
|
|
extern "C"{ |
14 |
|
|
#include <compiler/createinst.h> |
15 |
|
|
#include <solver/slv_types.h> |
16 |
|
|
} |
17 |
|
|
|
18 |
|
|
class Solver; |
19 |
johnpye |
208 |
class SolverParameters; |
20 |
johnpye |
233 |
class IncidenceMatrix; |
21 |
johnpye |
132 |
|
22 |
|
|
#ifndef ASCEND_INCDIR |
23 |
|
|
#define ASCEND_INCDIR "/home/john/src/ascend/trunk/base/generic/lib" |
24 |
|
|
#endif |
25 |
|
|
#ifndef ASCEND_LIBDIR |
26 |
|
|
#define ASCEND_LIBDIR "/home/john/src/ascend/trunk/base/jam/Release/linux" |
27 |
|
|
#endif |
28 |
|
|
#ifndef ASCEND_TMPDIR |
29 |
|
|
#define ASCEND_TMPDIR "/tmp" |
30 |
|
|
#endif |
31 |
|
|
#ifndef ASCEND_MAKEFILEDIR |
32 |
|
|
#define ASCEND_MAKEFILEDIR_1 "/home/john/src/ascend/trunk/pygtk/interface" |
33 |
|
|
#define ASCEND_MAKEFILEDIR "/home/john/src/ascend/trunk/base/generic/lib" |
34 |
|
|
#endif |
35 |
|
|
|
36 |
|
|
/** |
37 |
johnpye |
164 |
@TODO This class is for *Simulation* instances. |
38 |
johnpye |
132 |
|
39 |
|
|
Handle instantiating, running initialisation functions, solving |
40 |
|
|
and outputing results of solutions. |
41 |
|
|
|
42 |
|
|
In ASCEND C-code, a simulation is a special type of Instance. It |
43 |
|
|
has a 'simulation root' instance which often needs to be used for |
44 |
|
|
solving, inspecting, etc, rather than the simulation instance itself. |
45 |
|
|
*/ |
46 |
|
|
class Simulation : public Instanc{ |
47 |
johnpye |
233 |
friend class IncidenceMatrix; |
48 |
|
|
|
49 |
johnpye |
132 |
private: |
50 |
|
|
Instanc simroot; |
51 |
johnpye |
164 |
slv_system_structure *sys; |
52 |
johnpye |
153 |
bool is_built; |
53 |
johnpye |
132 |
|
54 |
|
|
// options to pass to BinTokenSetOptions |
55 |
johnpye |
164 |
/// TODO these should probably be put somewhere else |
56 |
johnpye |
132 |
std::string *bin_srcname; |
57 |
|
|
std::string *bin_objname; |
58 |
|
|
std::string *bin_libname; |
59 |
|
|
std::string *bin_cmd; |
60 |
|
|
std::string *bin_rm; |
61 |
|
|
|
62 |
johnpye |
233 |
protected: |
63 |
|
|
slv_system_structure *getSystem(); |
64 |
|
|
|
65 |
johnpye |
132 |
public: |
66 |
johnpye |
164 |
explicit Simulation(Instance *i, const SymChar &name); |
67 |
|
|
Simulation(const Simulation &); |
68 |
|
|
~Simulation(); |
69 |
|
|
|
70 |
johnpye |
132 |
Instanc &getModel(); |
71 |
|
|
void run(const Method &method); |
72 |
|
|
void checkDoF() const; |
73 |
|
|
const bool check(); |
74 |
|
|
void build(); |
75 |
|
|
void solve(Solver s); |
76 |
|
|
std::vector<Variable> getFixableVariables(); |
77 |
|
|
void write(); |
78 |
|
|
|
79 |
|
|
void setSolver(Solver &s); |
80 |
|
|
const Solver getSolver() const; |
81 |
johnpye |
196 |
|
82 |
johnpye |
208 |
SolverParameters getSolverParameters() const; |
83 |
johnpye |
225 |
void setSolverParameters(SolverParameters &); |
84 |
johnpye |
233 |
|
85 |
|
|
IncidenceMatrix getIncidenceMatrix(); |
86 |
johnpye |
132 |
}; |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
#endif |