/[ascend]/trunk/pygtk/incidencematrix.h
ViewVC logotype

Contents of /trunk/pygtk/incidencematrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1110 - (show annotations) (download) (as text)
Thu Jan 11 04:23:27 2007 UTC (13 years, 7 months ago) by johnpye
File MIME type: text/x-chdr
File size: 1775 byte(s)
Fixed mfgraph binding
1 #ifndef ASCXX_INCIDENCEMATRIX_H
2 #define ASCXX_INCIDENCEMATRIX_H
3
4 #include <vector>
5
6 #include "variable.h"
7 #include "relation.h"
8 #include "simulation.h"
9
10 #include "config.h"
11
12 #ifdef ASC_WITH_MFGRAPH
13 # include <mfgraph/mfg_draw_graph.h>
14 #endif
15
16 extern "C"{
17 #include <solver/incidence.h>
18 }
19
20 typedef enum{
21 IM_NULL=0, IM_ACTIVE_FIXED, IM_ACTIVE_FREE, IM_DORMANT_FIXED, IM_DORMANT_FREE
22 } IncidencePointType;
23
24 class IncidencePoint{
25 public:
26 IncidencePoint(const int&row, const int&col, const IncidencePointType &type);
27 IncidencePoint(const IncidencePoint &);
28 IncidencePoint();
29
30 int row;
31 int col;
32 IncidencePointType type;
33 };
34
35 /**
36 Special class for plotting incidence matrices using matplotlib
37
38 GOAL: facilitate use of pylab 'spy2' function, but hopefully add extra
39 stuff for viewing blocks and fixed/free incidences, solved/active/unsolved
40 variables, etc.
41
42 This is going to be like a C++ified copy of MtxProc.c
43 */
44 class IncidenceMatrix{
45
46 private:
47 Simulation &sim;
48 slv_system_structure *sys;
49
50 std::vector<IncidencePoint> data;
51 incidence_vars_t i;
52 bool is_built;
53
54 void buildPlotData();
55 public:
56 explicit IncidenceMatrix(Simulation &sim);
57 ~IncidenceMatrix();
58
59 const std::vector<IncidencePoint> &getIncidenceData();
60 const int &getNumRows() const;
61 const int &getNumCols() const;
62 const Variable getVariable(const int &row) const;
63 const Relation getRelation(const int &col) const;
64 const int getBlockRow(const int & row) const;
65 const std::vector<Variable> getBlockVars(const int &block);
66 const std::vector<Relation> getBlockRels(const int &block);
67 const std::vector<int> getBlockLocation(const int &block) const;
68 const int getNumBlocks();
69 #ifdef ASC_WITH_MFGRAPH
70 mfg::DrawGraph getBlockGraph(const int &block) const;
71 #endif
72 };
73
74 #endif // ASCXX_INCIDENCEMATRIX_H

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