HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Classes | Typedefs | Functions | Variables
MeshCoarsen

The DirectedGraph class as well as classes that make it up and the NodeArray class. More...

Classes

class  DirectedEdge
 
class  DirectedCell
 
class  NodeArray
 
class  DirectedGraph
 

Typedefs

typedef std::vector< std::vector< std::size_t > > Array
 Type definition for a matrix of unsigned ints. More...
 

Functions

 DirectedEdge::DirectedEdge ()
 Null constructor. More...
 
 DirectedEdge::~DirectedEdge ()
 Destructor. More...
 
 DirectedEdge::DirectedEdge (size_t, size_t)
 Class Constructor: Initialises the edge with the two nodes that form the edge. More...
 
DirectedEdge DirectedEdge::anti_edge ()
 Returns the edge consisting of the same nodes, pointing in the opposite direction. More...
 
bool operator== (const DirectedEdge &, const DirectedEdge &)
 Boolean operation to test if two edges are equal. More...
 
 DirectedCell::DirectedCell ()
 Null Constructor. More...
 
 DirectedCell::DirectedCell (std::size_t)
 Constructor. More...
 
 DirectedCell::~DirectedCell ()
 Destructor. More...
 
 DirectedCell::DirectedCell (std::vector< DirectedEdge > &, std::size_t)
 Class Constructor: Initialises the cell with a vector of edges and the cell ID. More...
 
void DirectedCell::add_edge (DirectedEdge &)
 Method to append an edge to the end of the cell. More...
 
void DirectedCell::remove_edge (std::size_t)
 Remove edge at a given position. More...
 
void DirectedCell::append_cell (DirectedCell &)
 
bool DirectedCell::check_nodes ()
 Checks for repeated or lone nodes. More...
 
bool DirectedCell::is_ordered ()
 Tests if the edges of the cell are ordered. More...
 
void DirectedCell::remove_duplicate_edges ()
 Method to remove all edge - antiedge pairs. More...
 
std::vector< DirectedEdgeDirectedCell::order_edges ()
 Orders the cell edges - returns vector of edges to be removed. More...
 
bool DirectedCell::has_edge (DirectedEdge)
 Tests if cell has an edge. More...
 
void DirectedCell::print ()
 Prints all the edges of the cell. More...
 
 NodeArray::NodeArray ()
 Null constructor. More...
 
 NodeArray::~NodeArray ()
 Default constructor. More...
 
 NodeArray::NodeArray (Array &)
 Class Constructor: Initialises the NodeArray with the cell-node array. More...
 
bool NodeArray::node_exists (std::size_t)
 Test if a given node exists in the cell-node array. More...
 
void NodeArray::renum_nodes (std::size_t)
 Subtracts one from all nodes greater than a given node. More...
 
void NodeArray::print (std::ofstream *, std::size_t width=6)
 Prints the cell node array to an out file stream. More...
 
 DirectedGraph::DirectedGraph ()
 Null constructor. More...
 
 DirectedGraph::~DirectedGraph ()
 Default constructor. More...
 
 DirectedGraph::DirectedGraph (std::vector< DirectedCell > &)
 Class Constructor: Initialises the DirectedGraph with the cells. More...
 
void DirectedGraph::add_cell (DirectedCell &)
 Appends a cell to the end of the graph. More...
 
void DirectedGraph::remove_cell (std::size_t)
 Removes cell from a given position. More...
 
bool DirectedGraph::test_graph ()
 Test if graph has duplicate edges or unordered cells. More...
 
void DirectedGraph::randomise ()
 Randomise order of cells in graph. More...
 
void DirectedGraph::order ()
 Order cells in graph by the number of edges in each cell. More...
 
void DirectedGraph::coarsen ()
 Coarsen the graph by merging cells. More...
 
NodeArray DirectedGraph::graph_to_array ()
 Returns the cell-node array the graph corresponds to. More...
 
std::string DirectedGraph::get_partition ()
 Returns list of fine cells that each coarse cell consists of. More...
 
void DirectedGraph::plotfile (std::ofstream *, std::vector< Eigen::VectorXd > &)
 Outputs to a .dat file for gnuplot to read. More...
 
int main (int argc, char *argv[])
 Usage: mesh-coarsen <input file> <output file> <number of coarsening levels> More...
 

Variables

std::size_t DirectedEdge::a
 Node number of the edge tail. More...
 
std::size_t DirectedEdge::b
 Node number of the edge head. More...
 
std::vector< DirectedEdgeDirectedCell::T
 The edges the cell consists of. More...
 
std::vector< std::size_t > DirectedCell::part
 The cell ID's of the cell's that have formed this cell. More...
 
Array NodeArray::A
 The cell-node array. More...
 
std::vector< DirectedCellDirectedGraph::G
 Vector of cells that form the graph. More...
 

Detailed Description

The DirectedGraph class as well as classes that make it up and the NodeArray class.

Typedef Documentation

◆ Array

typedef std::vector<std::vector<std::size_t> > Array

Type definition for a matrix of unsigned ints.

Function Documentation

◆ add_cell()

void DirectedGraph::add_cell ( DirectedCell T)

Appends a cell to the end of the graph.

Parameters
TCell to be added

◆ add_edge()

void DirectedCell::add_edge ( DirectedEdge e)

Method to append an edge to the end of the cell.

Parameters
eEdge to be added

◆ anti_edge()

DirectedEdge DirectedEdge::anti_edge ( )

Returns the edge consisting of the same nodes, pointing in the opposite direction.

◆ append_cell()

void DirectedCell::append_cell ( DirectedCell K)

Appends the vector of edges and partition vector of a cell to the edges and partition of this cell

Parameters
KCell to be added

◆ check_nodes()

bool DirectedCell::check_nodes ( )

Checks for repeated or lone nodes.

◆ coarsen()

void DirectedGraph::coarsen ( )

Coarsen the graph by merging cells.

◆ DirectedCell() [1/3]

DirectedCell::DirectedCell ( )

Null Constructor.

◆ DirectedCell() [2/3]

DirectedCell::DirectedCell ( std::size_t  cell_num)

Constructor.

◆ DirectedCell() [3/3]

DirectedCell::DirectedCell ( std::vector< DirectedEdge > &  _T,
std::size_t  cell_num 
)

Class Constructor: Initialises the cell with a vector of edges and the cell ID.

Parameters
_TA reference to the edges that the cell consists of
cell_numInitial cell ID

◆ DirectedEdge() [1/2]

DirectedEdge::DirectedEdge ( )

Null constructor.

◆ DirectedEdge() [2/2]

DirectedEdge::DirectedEdge ( size_t  ,
size_t   
)

Class Constructor: Initialises the edge with the two nodes that form the edge.

◆ DirectedGraph() [1/2]

DirectedGraph::DirectedGraph ( )

Null constructor.

◆ DirectedGraph() [2/2]

DirectedGraph::DirectedGraph ( std::vector< DirectedCell > &  _G)

Class Constructor: Initialises the DirectedGraph with the cells.

Parameters
_GInitial cells

◆ get_partition()

std::string DirectedGraph::get_partition ( )

Returns list of fine cells that each coarse cell consists of.

◆ graph_to_array()

NodeArray DirectedGraph::graph_to_array ( )

Returns the cell-node array the graph corresponds to.

◆ has_edge()

bool DirectedCell::has_edge ( DirectedEdge  e)

Tests if cell has an edge.

Parameters
eEdge to check for

◆ is_ordered()

bool DirectedCell::is_ordered ( )

Tests if the edges of the cell are ordered.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Usage: mesh-coarsen <input file> <output file> <number of coarsening levels>

◆ node_exists()

bool NodeArray::node_exists ( std::size_t  node)

Test if a given node exists in the cell-node array.

Parameters
nodeNode to test for

◆ NodeArray() [1/2]

NodeArray::NodeArray ( )

Null constructor.

◆ NodeArray() [2/2]

NodeArray::NodeArray ( Array _A)

Class Constructor: Initialises the NodeArray with the cell-node array.

Parameters
_AThe cell-node array

◆ operator==()

bool operator== ( const DirectedEdge lhs,
const DirectedEdge rhs 
)

Boolean operation to test if two edges are equal.

◆ order()

void DirectedGraph::order ( )

Order cells in graph by the number of edges in each cell.

◆ order_edges()

std::vector< DirectedEdge > DirectedCell::order_edges ( )

Orders the cell edges - returns vector of edges to be removed.

◆ plotfile()

void DirectedGraph::plotfile ( std::ofstream *  out,
std::vector< Eigen::VectorXd > &  vertices 
)

Outputs to a .dat file for gnuplot to read.

Parameters
outPointer to the file stream to print to
verticesVertices

◆ print() [1/2]

void DirectedCell::print ( )

Prints all the edges of the cell.

◆ print() [2/2]

void NodeArray::print ( std::ofstream *  out,
std::size_t  width = 6 
)

Prints the cell node array to an out file stream.

Parameters
outPointer to the file stream to print to
widthOptional parameter to format output

◆ randomise()

void DirectedGraph::randomise ( )

Randomise order of cells in graph.

◆ remove_cell()

void DirectedGraph::remove_cell ( std::size_t  pos)

Removes cell from a given position.

Parameters
posCell to be removed

◆ remove_duplicate_edges()

void DirectedCell::remove_duplicate_edges ( )

Method to remove all edge - antiedge pairs.

◆ remove_edge()

void DirectedCell::remove_edge ( std::size_t  pos)

Remove edge at a given position.

Parameters
posPosition of edge to be removed

◆ renum_nodes()

void NodeArray::renum_nodes ( std::size_t  node)

Subtracts one from all nodes greater than a given node.

Parameters
nodeNode given

◆ test_graph()

bool DirectedGraph::test_graph ( )

Test if graph has duplicate edges or unordered cells.

◆ ~DirectedCell()

DirectedCell::~DirectedCell ( )

Destructor.

◆ ~DirectedEdge()

DirectedEdge::~DirectedEdge ( )

Destructor.

◆ ~DirectedGraph()

DirectedGraph::~DirectedGraph ( )

Default constructor.

◆ ~NodeArray()

NodeArray::~NodeArray ( )

Default constructor.

Variable Documentation

◆ a

std::size_t DirectedEdge::a

Node number of the edge tail.

◆ A

Array NodeArray::A

The cell-node array.

◆ b

std::size_t DirectedEdge::b

Node number of the edge head.

◆ G

std::vector<DirectedCell> DirectedGraph::G

Vector of cells that form the graph.

◆ part

std::vector<std::size_t> DirectedCell::part

The cell ID's of the cell's that have formed this cell.

◆ T

std::vector<DirectedEdge> DirectedCell::T

The edges the cell consists of.