4 |
#include <iostream> |
#include <iostream> |
5 |
using namespace std; |
using namespace std; |
6 |
|
|
|
#ifdef ASC_WITH_MFGRAPH |
|
|
# include <mfg_draw_graph.h> |
|
|
# include <mfg_graph_drawer.h> |
|
|
#endif |
|
|
|
|
7 |
#include "variable.h" |
#include "variable.h" |
8 |
#include "relation.h" |
#include "relation.h" |
9 |
|
|
222 |
return bb->nblocks; |
return bb->nblocks; |
223 |
} |
} |
224 |
|
|
225 |
#if ASC_WITH_MFGRAPH |
#ifdef ASC_WITH_MFGRAPH |
226 |
void |
/** |
227 |
IncidenceMatrix::writeBlockGraph(ostream &os, const int &block){ |
Return an MFGRAPH object containing the incidence information for the |
228 |
|
local block. It is intended that this should be passed back to the python |
229 |
|
layer as a SWIGed object that Python can decode. It might prove easier |
230 |
|
just to write a .dot from this C++ layer however. |
231 |
|
*/ |
232 |
|
mfg::DrawGraph |
233 |
|
IncidenceMatrix::getBlockGraph(const int &block) const{ |
234 |
using namespace mfg; |
using namespace mfg; |
235 |
|
|
236 |
DrawGraph g; |
DrawGraph g; |
237 |
Node* a = g.CreateNode(); |
Node *a = g.CreateNode(); |
238 |
Node* x = g.CreateNode(); |
Node *x = g.CreateNode(); |
239 |
Edge* ax = g.CreateEdge(a, x); |
Edge *ax = g.CreateEdge(a, x); |
240 |
ax->Attribs()["color"] = "red"; |
ax->Attribs()["color"] = "red"; |
241 |
Subgraph* s = g.CreateSubgraph(); |
Subgraph *s = g.CreateSubgraph(); |
242 |
Node* b = g.CreateNode(s); |
Node *b = g.CreateNode(s); |
243 |
b->Attribs()["style"] = "filled"; |
b->Attribs()["style"] = "filled"; |
244 |
b->Attribs()["fillcolor"] = "green"; |
b->Attribs()["fillcolor"] = "green"; |
245 |
Edge* ab = g.CreateEdge(a, b); |
Edge *ab = g.CreateEdge(a, b); |
246 |
|
return g; |
|
g.PrintAsDot(os); |
|
247 |
} |
} |
248 |
#endif |
#endif |
249 |
|
|