/[ascend]/trunk/pygtk/interface/solver.i
ViewVC logotype

Contents of /trunk/pygtk/interface/solver.i

Parent Directory Parent Directory | Revision Log Revision Log


Revision 227 - (show annotations) (download)
Sat Jan 28 04:44:15 2006 UTC (19 years, 3 months ago) by johnpye
File size: 2339 byte(s)
Added grouping of solver parameters into pages
1 /*
2 SWIG interface for accessing Solver and choosing solver parameters
3 */
4
5 class Solver{
6 public:
7 Solver(const std::string &name);
8 Solver(const Solver &);
9
10 const int &getIndex() const;
11 const std::string getName() const;
12 };
13
14 class Simulation : public Instanc{
15 public:
16 Simulation(Instance *&, const SymChar &name);
17 Instanc &getModel();
18 std::vector<Variable> getFixableVariables();
19 void build();
20 const bool check();
21 void checkDoF() const;
22 void run(const Method &);
23 void setSolver(Solver&);
24 const Solver getSolver() const;
25 void solve(Solver s);
26 SolverParameters getSolverParameters() const;
27 void setSolverParameters(SolverParameters&);
28 };
29
30 // SOLVE PARAMETERS
31
32 %pythoncode{
33 class SolverParameterIter:
34 def __init__(self, params):
35 self.params = params;
36 self.index = 0;
37
38 def next(self):
39 self.index = self.index + 1
40 if self.index >= self.params.getLength():
41 raise StopIteration
42 return self.params.getParameter(self.index)
43 }
44
45 class SolverParameters{
46 public:
47 const std::string toString();
48 SolverParameters(const SolverParameters &);
49 const int getLength() const;
50 SolverParameter getParameter(const int &) const;
51 };
52
53 %extend SolverParameters{
54 %pythoncode{
55 def __iter__(self):
56 return SolverParameterIter(self)
57 def getitem(self,index):
58 return
59 }
60 }
61
62 class SolverParameter{
63 public:
64 explicit SolverParameter(slv_parameter *);
65
66 const std::string getName() const;
67 const std::string getDescription() const;
68 const std::string getLabel() const;
69 const int &getNumber() const;
70 const int &getPage() const;
71
72 const bool isInt() const;
73 const bool isBool() const;
74 const bool isStr() const;
75 const bool isReal() const;
76
77 // The following throw execeptions unless the parameter type is correct
78 const int &getIntValue() const;
79 const int &getIntLowerBound() const;
80 const int &getIntUpperBound() const;
81 void setIntValue(const int&);
82
83 const bool getBoolValue() const;
84 void setBoolValue(const bool&);
85
86 const std::string getStrValue() const;
87 const std::vector<std::string> getStrOptions() const;
88 void setStrValue(const std::string &);
89 void setStrOption(const int &opt);
90
91 const double &getRealValue() const;
92 const double &getRealLowerBound() const;
93 const double &getRealUpperBound() const;
94 void setRealValue(const double&);
95
96 const bool isBounded() const;
97
98 const std::string toString() const;
99 };

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