My Project
Public Types | Public Member Functions | Public Attributes | List of all members
CycleDetection Class Reference

Performs cycle detection on the cross section. More...

#include <CycleDetection.h>

Public Types

typedef std::pair< int, int > Edge
 Defining an Edge to consist of to vertices (start and end) in the format of int's.
 

Public Member Functions

 CycleDetection (std::vector< LineElement * > elements)
 Constructor that takes is a vector of LineElement pointers. More...
 
void constructGraph (std::vector< LineElement * > element)
 Creates graph based on the elements provided to the parser.
 
void findAllCycles ()
 method using findNewCycles() to find all cycles and without duplicates
 
void findNewCycles (std::vector< int > path)
 Finds all cycles in the graph consisting of vertices , avoiding duplicates.
 
bool equals (std::vector< int > a, std::vector< int > b)
 Determines if two vectors are equal, i.e. contains the same vertices in the same order. Helper method of findNewCycles()
 
std::vector< int > invert (std::vector< int > path)
 Returns an array that is reverted compared to the vector argument. Helper method of findNewCycles()
 
std::vector< int > normalize (std::vector< int > path)
 Rotate path such that the smallest element occurs first. Helper method of findNewCycles()
 
bool isNew (std::vector< int > path)
 Returns true if found cycle is not already discovered, otherwise false. Helper method of findNewCycles()
 
bool visited (int n, std::vector< int > path)
 Returns true if vertex is not already in path, otherwise false. Helper method of findNewCycles()
 
int findSmallestElement (std::vector< int > path)
 Returns the smallest element of the path. Helper method of findNewCycles()
 
void printEdgeCycles (std::vector< std::vector< Edge >> edges)
 Prints the cycles with their edges. Used for debugging and verification.
 
void convertCyclesToEdges ()
 Convert cycles of vertices to a vector containing cycles of edges, that is necessary to perform removeSuperCycles()
 
void removeSuperCycles ()
 Original routine removing all super cycles, that is cycles containing at least one other cycle but itself (opposite is sub-cycle)
 
void sortCycles ()
 Uses std::sort to sort the cycles of std::vector<std::vector<Edge>> edges from largest to smallest.
 
void convertEdgesToElements (std::vector< LineElement * > elements)
 Converts all edges that are part of a cell (sub-cycle) to lineElements, which later on are passed on to LineMesh.
 
std::vector< std::vector< LineElement * > > getAllCycles ()
 Returns all LineElements that are found to be part of a cell.
 
std::vector< LineElement * > getOpenElements (std::vector< LineElement * > elements)
 Returns all LineElements that are open i.e are not part of any cycle.
 
void printCells ()
 Helper method for debugging, that prints the cells.
 
void calculateCellArea ()
 Calculates the areas of the cells and insert the numerical value into the area-vector.
 
void reverseCycle (int i)
 Reverses the cycle.
 

Public Attributes

std::vector< std::vector< int > > cycles
 Vector containing cycles in vertex form.
 
std::vector< std::vector< int > > graph
 Graph that is created from vertices and edges.
 
std::vector< std::vector< LineElement * > > elementCycles
 Vector containing only the line elements that are a part of a cell (sub-cycle)
 
std::vector< std::vector< Edge > > edges
 Vector containing edges.
 
std::vector< double > cycleArea
 Vector containing the areas of all the cycles not containing other cycles.
 
std::vector< int > sequence
 

Detailed Description

Performs cycle detection on the cross section.

Constructor & Destructor Documentation

CycleDetection::CycleDetection ( std::vector< LineElement * >  elements)

Constructor that takes is a vector of LineElement pointers.

Takes a vector of all the LineElement pointers in the mesh and performs cycle detection on them based on depth first search.

Parameters
elementsis a vector of all LineElement pointers in the mesh.

The documentation for this class was generated from the following files: