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

Annotation of /trunk/pygtk/incidencematrix.h

Parent Directory Parent Directory | Revision Log Revision Log


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

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