1 |
#ifndef ASCXX_SIMULATION_H |
2 |
#define ASCXX_SIMULATION_H |
3 |
|
4 |
#include <string> |
5 |
#include <vector> |
6 |
|
7 |
|
8 |
#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 |
class SolverParameters; |
20 |
class IncidenceMatrix; |
21 |
|
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 |
@TODO This class is for *Simulation* instances. |
38 |
|
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 |
friend class IncidenceMatrix; |
48 |
|
49 |
private: |
50 |
Instanc simroot; |
51 |
slv_system_structure *sys; |
52 |
bool is_built; |
53 |
|
54 |
// options to pass to BinTokenSetOptions |
55 |
/// TODO these should probably be put somewhere else |
56 |
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 |
protected: |
63 |
slv_system_structure *getSystem(); |
64 |
|
65 |
public: |
66 |
explicit Simulation(Instance *i, const SymChar &name); |
67 |
Simulation(const Simulation &); |
68 |
~Simulation(); |
69 |
|
70 |
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 |
|
82 |
SolverParameters getSolverParameters() const; |
83 |
void setSolverParameters(SolverParameters &); |
84 |
|
85 |
IncidenceMatrix getIncidenceMatrix(); |
86 |
}; |
87 |
|
88 |
|
89 |
#endif |