/[ascend]/trunk/ascxx/testslvreq.cpp
ViewVC logotype

Contents of /trunk/ascxx/testslvreq.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2579 - (show annotations) (download) (as text)
Wed Mar 14 23:05:32 2012 UTC (10 years, 3 months ago) by jpye
File MIME type: text/x-c++src
File size: 743 byte(s)
Workaround for bug 494. Very close to the changes that Grivan suggested in changeset 3482.
ASCEND now working in Fedora 16 with SWIG 2.0.4.
1 #include "library.h"
2 #include "simulation.h"
3 #include "solver.h"
4 #include "solverreporter.h"
5 #include "solverhooks.h"
6
7 #include <iostream>
8 using namespace std;
9
10 int main(void){
11 SolverReporter R; // contains methods to report solver progress;
12 SolverHooks H(&R); // hooks slvreq into Simulation
13 SolverHooksManager::Instance()->setHooks(&H); // register our SolverHooks
14
15 Library L;
16 L.load("test/slvreq/test2.a4c");
17 Type t = L.findType("test2");
18
19 // in here, there is a call to slvreq_assign_hooks.
20 Simulation S = t.getSimulation("S",1);
21
22 Method M = t.getMethod("on_load");
23 S.run(M);
24
25 CONSOLE_DEBUG("Completed OK");
26 // the test1 model contains SOLVE command, so the output will now show that
27 // the requested model has been solved.
28 }

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