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

Contents of /trunk/ascxx/incidencematrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2395 - (show annotations) (download) (as text)
Mon Feb 28 01:30:17 2011 UTC (13 years, 6 months ago) by jpye
File MIME type: text/x-chdr
File size: 1820 byte(s)
Add support for reporting block status in Diagnose window.
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 #include "solverstatus.h"
10
11 #include "config.h"
12
13 extern "C"{
14 #include <ascend/system/incidence.h>
15 }
16
17 typedef enum{
18 IM_NULL=0, IM_ACTIVE_FIXED, IM_ACTIVE_FREE, IM_DORMANT_FIXED, IM_DORMANT_FREE
19 } IncidencePointType;
20
21 typedef enum{
22 IM_CONVERGED=0, IM_OVER_ITER, IM_OVER_TIME, IM_DIVERGED, IM_NOT_YET_ATTEMPTED
23 } BlockStatusType;
24
25 class IncidencePoint{
26 public:
27 IncidencePoint(const int&row, const int&col, const IncidencePointType &type);
28 IncidencePoint(const IncidencePoint &);
29 IncidencePoint();
30
31 int row;
32 int col;
33 IncidencePointType type;
34 };
35
36 /**
37 Special class for plotting incidence matrices using matplotlib
38
39 GOAL: facilitate use of pylab 'spy2' function, but hopefully add extra
40 stuff for viewing blocks and fixed/free incidences, solved/active/unsolved
41 variables, etc.
42
43 This is going to be like a C++ified copy of MtxProc.c
44 */
45 class IncidenceMatrix{
46
47 private:
48 Simulation &sim;
49 slv_system_t sys;
50
51 std::vector<IncidencePoint> data;
52 incidence_vars_t i;
53 bool is_built;
54
55 void buildPlotData();
56 public:
57 explicit IncidenceMatrix(Simulation &sim);
58 ~IncidenceMatrix();
59
60 const std::vector<IncidencePoint> &getIncidenceData();
61 const int &getNumRows() const;
62 const int &getNumCols() const;
63 const Variable getVariable(const int &row) const;
64 const Relation getRelation(const int &col) const;
65 const int getBlockRow(const int & row) const;
66 const std::vector<Variable> getBlockVars(const int &block);
67 const std::vector<Relation> getBlockRels(const int &block);
68 const std::vector<int> getBlockLocation(const int &block) const;
69 const BlockStatusType getBlockStatus(const int &block) const;
70 const int getNumBlocks();
71 };
72
73 #endif // ASCXX_INCIDENCEMATRIX_H

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