12#ifndef _DIRECTEDGRAPH_HPP
13#define _DIRECTEDGRAPH_HPP
30typedef std::vector<std::vector<std::size_t>>
Array;
79 std::vector<DirectedEdge>
T;
82 std::vector<std::size_t>
part;
96 std::vector<DirectedEdge> &,
177 std::size_t width = 6
185 std::vector<DirectedCell>
G;
196 std::vector<DirectedCell> &
230 std::vector<Eigen::VectorXd> &
239 bool can_merge(std::size_t, std::size_t, std::vector<size_t> &);
245 void merge_cells(std::size_t, std::size_t, std::vector<size_t> &);
248 std::knuth_b rand_engine;
249 bool random_bool(
double);
Definition DirectedGraph.hpp:76
Definition DirectedGraph.hpp:41
Definition DirectedGraph.hpp:182
Definition DirectedGraph.hpp:147
~DirectedGraph()
Default constructor.
Definition DirectedGraph.cpp:257
DirectedCell()
Null Constructor.
Definition DirectedGraph.cpp:25
Array A
The cell-node array.
Definition DirectedGraph.hpp:150
DirectedEdge(size_t, size_t)
Class Constructor: Initialises the edge with the two nodes that form the edge.
void plotfile(std::ofstream *, std::vector< Eigen::VectorXd > &)
Outputs to a .dat file for gnuplot to read.
Definition DirectedGraph.cpp:403
bool check_nodes()
Checks for repeated or lone nodes.
Definition DirectedGraph.cpp:148
void remove_edge(std::size_t)
Remove edge at a given position.
Definition DirectedGraph.cpp:38
bool has_edge(DirectedEdge)
Tests if cell has an edge.
Definition DirectedGraph.cpp:182
NodeArray()
Null constructor.
Definition DirectedGraph.cpp:207
void add_cell(DirectedCell &)
Appends a cell to the end of the graph.
Definition DirectedGraph.cpp:260
std::size_t b
Node number of the edge head.
Definition DirectedGraph.hpp:47
void randomise()
Randomise order of cells in graph.
Definition DirectedGraph.cpp:291
void remove_duplicate_edges()
Method to remove all edge - antiedge pairs.
Definition DirectedGraph.cpp:49
std::vector< DirectedCell > G
Vector of cells that form the graph.
Definition DirectedGraph.hpp:185
void remove_cell(std::size_t)
Removes cell from a given position.
Definition DirectedGraph.cpp:265
bool operator==(const DirectedEdge &, const DirectedEdge &)
Boolean operation to test if two edges are equal.
Definition DirectedGraph.cpp:16
~NodeArray()
Default constructor.
Definition DirectedGraph.cpp:208
bool is_ordered()
Tests if the edges of the cell are ordered.
Definition DirectedGraph.cpp:68
~DirectedCell()
Destructor.
Definition DirectedGraph.cpp:27
std::vector< std::size_t > part
The cell ID's of the cell's that have formed this cell.
Definition DirectedGraph.hpp:82
void order()
Order cells in graph by the number of edges in each cell.
Definition DirectedGraph.cpp:301
std::vector< std::vector< std::size_t > > Array
Type definition for a matrix of unsigned ints.
Definition DirectedGraph.hpp:30
DirectedGraph()
Null constructor.
Definition DirectedGraph.cpp:256
bool test_graph()
Test if graph has duplicate edges or unordered cells.
Definition DirectedGraph.cpp:270
std::string get_partition()
Returns list of fine cells that each coarse cell consists of.
Definition DirectedGraph.cpp:388
NodeArray graph_to_array()
Returns the cell-node array the graph corresponds to.
Definition DirectedGraph.cpp:374
~DirectedEdge()
Destructor.
Definition DirectedGraph.cpp:8
void renum_nodes(std::size_t)
Subtracts one from all nodes greater than a given node.
Definition DirectedGraph.cpp:222
DirectedEdge anti_edge()
Returns the edge consisting of the same nodes, pointing in the opposite direction.
Definition DirectedGraph.cpp:11
void add_edge(DirectedEdge &)
Method to append an edge to the end of the cell.
Definition DirectedGraph.cpp:33
void append_cell(DirectedCell &)
Definition DirectedGraph.cpp:43
std::vector< DirectedEdge > order_edges()
Orders the cell edges - returns vector of edges to be removed.
Definition DirectedGraph.cpp:84
DirectedEdge()
Null constructor.
Definition DirectedGraph.cpp:7
void print(std::ofstream *, std::size_t width=6)
Prints the cell node array to an out file stream.
Definition DirectedGraph.cpp:236
std::size_t a
Node number of the edge tail.
Definition DirectedGraph.hpp:44
void coarsen()
Coarsen the graph by merging cells.
Definition DirectedGraph.cpp:315
void print()
Prints all the edges of the cell.
Definition DirectedGraph.cpp:194
bool node_exists(std::size_t)
Test if a given node exists in the cell-node array.
Definition DirectedGraph.cpp:210
std::vector< DirectedEdge > T
The edges the cell consists of.
Definition DirectedGraph.hpp:79