4
using namespace dolfin;
8
/// Testing GraphEditor
9
std::cout << "Testing GraphEditor" << std::endl;
12
ge.open(graph, Graph::undirected);
30
void testMeshToGraph()
32
std::cout << "Testing Mesh to graph convertion" << std::endl;
33
UnitSquare mesh(2, 2);
35
Graph graph(mesh, "nodal");
38
void testInputOutput()
40
std::cout << "Testing InputOutput" << std::endl;
43
editor.open(graph, Graph::undirected);
44
editor.initVertices(3);
45
editor.addVertex(0, 2);
46
editor.addVertex(1, 2);
47
editor.addVertex(2, 2);
55
File file("graph_test.xml");
65
std::cout << "Testing editor closing" << std::endl;
68
editor.open(graph, Graph::undirected);
69
editor.initVertices(3);
70
editor.addVertex(0, 2);
71
editor.addVertex(1, 2);
72
editor.addVertex(2, 2);
79
void testOutOfOrderError()
81
std::cout << "Testing adding vertices out of order" << std::endl;
84
editor.open(graph, Graph::undirected);
85
editor.initVertices(3);
86
editor.addVertex(0, 2);
87
editor.addVertex(2, 2);
88
editor.addVertex(1, 2);
96
void testTooManyVerticesError()
98
std::cout << "Testing adding too many vertices" << std::endl;
101
editor.open(graph, Graph::undirected);
102
editor.initVertices(3);
103
editor.addVertex(0, 2);
104
editor.addVertex(1, 2);
105
editor.addVertex(2, 2);
106
editor.addVertex(3, 2);
108
editor.addEdge(0, 1);
109
editor.addEdge(0, 2);
110
editor.addEdge(1, 2);
114
void testInitEdgesError1()
116
std::cout << "Testing inititializing too few edges" << std::endl;
119
editor.open(graph, Graph::undirected);
120
editor.initVertices(4);
121
editor.addVertex(0, 2);
122
editor.addVertex(1, 3);
123
editor.addVertex(2, 2);
124
editor.addVertex(3, 2);
129
void testInitEdgesError2()
131
std::cout << "Testing inititializing too many edges" << std::endl;
134
editor.open(graph, Graph::undirected);
135
editor.initVertices(4);
136
editor.addVertex(0, 2);
137
editor.addVertex(1, 3);
138
editor.addVertex(2, 2);
139
editor.addVertex(3, 2);
158
editor.open(mesh, "triangle", 2, 2);
159
editor.initVertices(5);
160
editor.addVertex(0, 0.4, 0.4);
161
editor.addVertex(1, 0.7, 0.4);
162
editor.addVertex(2, 0.4, 0.7);
163
editor.addVertex(3, 0.7, 0.7);
164
editor.addVertex(4, 1.0, 0.4);
166
editor.addCell(0, 0, 1, 2);
167
editor.addCell(1, 2, 1, 3);
168
editor.addCell(2, 3, 1, 4);
174
for (CellIterator c0(mesh); !c0.end(); ++c0)
177
for (CellIterator c1(*c0); !c1.end(); ++c1)
178
cout << " " << *c1 << endl;
182
int main(int argc, char* argv[])
188
//testTooManyVerticesError();
189
//testInitEdgesError1();
190
//testInitEdgesError2();