1 #include "LineElement.h" 20 std::vector<std::vector<int>>
cycles;
21 std::vector<std::vector<int>>
graph;
23 typedef std::pair<int, int>
Edge;
24 std::vector<std::vector<Edge>>
edges;
26 std::vector<int> sequence;
32 bool equals(std::vector<int> a, std::vector<int> b);
33 std::vector<int>
invert(std::vector<int> path);
34 std::vector<int>
normalize(std::vector<int> path);
35 bool isNew(std::vector<int> path);
36 bool visited(
int n, std::vector<int> path);
46 std::vector<LineElement*>
getOpenElements(std::vector<LineElement*> elements);
std::pair< int, int > Edge
Defining an Edge to consist of to vertices (start and end) in the format of int's.
Definition: CycleDetection.h:23
Performs cycle detection on the cross section.
Definition: CycleDetection.h:7
void calculateCellArea()
Calculates the areas of the cells and insert the numerical value into the area-vector.
Definition: CycleDetection.cpp:301
void printEdgeCycles(std::vector< std::vector< Edge >> edges)
Prints the cycles with their edges. Used for debugging and verification.
Definition: CycleDetection.cpp:32
std::vector< std::vector< int > > cycles
Vector containing cycles in vertex form.
Definition: CycleDetection.h:20
void sortCycles()
Uses std::sort to sort the cycles of std::vector<std::vector<Edge>> edges from largest to smallest...
Definition: CycleDetection.cpp:201
std::vector< std::vector< int > > graph
Graph that is created from vertices and edges.
Definition: CycleDetection.h:21
bool visited(int n, std::vector< int > path)
Returns true if vertex is not already in path, otherwise false. Helper method of findNewCycles() ...
Definition: CycleDetection.cpp:187
bool isNew(std::vector< int > path)
Returns true if found cycle is not already discovered, otherwise false. Helper method of findNewCycle...
Definition: CycleDetection.cpp:173
std::vector< LineElement * > getOpenElements(std::vector< LineElement * > elements)
Returns all LineElements that are open i.e are not part of any cycle.
Definition: CycleDetection.cpp:290
void findAllCycles()
method using findNewCycles() to find all cycles and without duplicates
Definition: CycleDetection.cpp:59
void findNewCycles(std::vector< int > path)
Finds all cycles in the graph consisting of vertices , avoiding duplicates.
Definition: CycleDetection.cpp:71
int findSmallestElement(std::vector< int > path)
Returns the smallest element of the path. Helper method of findNewCycles()
Definition: CycleDetection.cpp:160
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 ...
Definition: CycleDetection.cpp:241
void convertCyclesToEdges()
Convert cycles of vertices to a vector containing cycles of edges, that is necessary to perform remov...
Definition: CycleDetection.cpp:269
std::vector< double > cycleArea
Vector containing the areas of all the cycles not containing other cycles.
Definition: CycleDetection.h:25
CycleDetection(std::vector< LineElement * > elements)
Constructor that takes is a vector of LineElement pointers.
Definition: CycleDetection.cpp:4
void reverseCycle(int i)
Reverses the cycle.
Definition: CycleDetection.cpp:383
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()
Definition: CycleDetection.cpp:113
std::vector< std::vector< Edge > > edges
Vector containing edges.
Definition: CycleDetection.h:24
std::vector< int > normalize(std::vector< int > path)
Rotate path such that the smallest element occurs first. Helper method of findNewCycles() ...
Definition: CycleDetection.cpp:144
std::vector< std::vector< LineElement * > > elementCycles
Vector containing only the line elements that are a part of a cell (sub-cycle)
Definition: CycleDetection.h:22
void constructGraph(std::vector< LineElement * > element)
Creates graph based on the elements provided to the parser.
Definition: CycleDetection.cpp:46
void removeSuperCycles()
Original routine removing all super cycles, that is cycles containing at least one other cycle but it...
Definition: CycleDetection.cpp:205
std::vector< std::vector< LineElement * > > getAllCycles()
Returns all LineElements that are found to be part of a cell.
Definition: CycleDetection.cpp:286
std::vector< int > invert(std::vector< int > path)
Returns an array that is reverted compared to the vector argument. Helper method of findNewCycles() ...
Definition: CycleDetection.cpp:131
void printCells()
Helper method for debugging, that prints the cells.
Definition: CycleDetection.cpp:390