1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include "library.h"
#include "simulation.h"
#include "solver.h"
#include "solverreporter.h"
#include "solverhooks.h"
#include <iostream>
using namespace std;
int main(void){
SolverReporter R; // contains methods to report solver progress;
SolverHooks H(&R); // hooks slvreq into Simulation
SolverHooksManager::Instance()->setHooks(&H); // register our SolverHooks
Library L;
L.load("test/slvreq/test2.a4c");
Type t = L.findType("test2");
// in here, there is a call to slvreq_assign_hooks.
Simulation S = t.getSimulation("S",1);
Method M = t.getMethod("on_load");
S.run(M);
CONSOLE_DEBUG("Completed OK");
// the test1 model contains SOLVE command, so the output will now show that
// the requested model has been solved.
}
|