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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 225 - (show annotations) (download)
Fri Jan 27 14:55:43 2006 UTC (14 years, 10 months ago) by johnpye
File size: 2306 byte(s)
Added const-ness to 2nd parameter of slv_set_char_parameter.
Implemented setting of int, real and string parameters via PyGTK interface.
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 void solve(Solver s);
25 SolverParameters getSolverParameters() const;
26 void setSolverParameters(SolverParameters&);
27 };
28
29 // SOLVE PARAMETERS
30
31 %pythoncode{
32 class SolverParameterIter:
33 def __init__(self, params):
34 self.params = params;
35 self.index = 0;
36
37 def next(self):
38 if self.index >= self.params.getLength():
39 raise StopIteration
40 self.index = self.index + 1
41 return self.params.getParameter(self.index)
42 }
43
44 class SolverParameters{
45 public:
46 const std::string toString();
47 SolverParameters(const SolverParameters &);
48 const int getLength() const;
49 SolverParameter getParameter(const int &) const;
50 };
51
52 %extend SolverParameters{
53 %pythoncode{
54 def __iter__(self):
55 return SolverParameterIter(self)
56 def getitem(self,index):
57 return
58 }
59 }
60
61 class SolverParameter{
62 public:
63 explicit SolverParameter(slv_parameter *);
64
65 const std::string getName() const;
66 const std::string getDescription() const;
67 const std::string getLabel() const;
68 const int &getNumber() const;
69 const int &getPage() const;
70
71 const bool isInt() const;
72 const bool isBool() const;
73 const bool isStr() const;
74 const bool isReal() const;
75
76 // The following throw execeptions unless the parameter type is correct
77 const int &getIntValue() const;
78 const int &getIntLowerBound() const;
79 const int &getIntUpperBound() const;
80 void setIntValue(const int&);
81
82 const bool getBoolValue() const;
83 void setBoolValue(const bool&);
84
85 const std::string getStrValue() const;
86 const std::vector<std::string> getStrOptions() const;
87 void setStrValue(const std::string &);
88 void setStrOption(const int &opt);
89
90 const double &getRealValue() const;
91 const double &getRealLowerBound() const;
92 const double &getRealUpperBound() const;
93 void setRealValue(const double&);
94
95 const bool isBounded() const;
96
97 const std::string toString() const;
98 };

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