#include <simulationManager.hpp>
Collaboration diagram for SimulationManager:
Public Member Functions | |
SimulationManager (MainController *controller, TruthTableManager *tableManager, ForbiddenPatternManager *FPManager, RuleManager *ruleManager, LayoutManager *layoutManager) | |
Constructor. | |
virtual | ~SimulationManager () |
Destructor. | |
void | prepareSimulation () |
Prepares and starts a simulation. | |
void | startSimulation () |
Starts a simulation. | |
bool | nextRow () |
Asks for new rows to simulate. | |
void | simulateRow () |
Simulates the current row. | |
void | finishedRow () |
Gathers the simulation data from the simulated row. | |
void | results () |
Shows the simulation results. | |
void | rowSelected (int row) |
Selects a row to show it's results. | |
void | informationSelected (int information) |
Selects a row event to show it's results. | |
void | pathSelected (int path) |
Selects a simulation step to show it's results. | |
Private Member Functions | |
void | addRule (Rule newRule) |
Adds a rule and its rotations to the rule list. | |
void | addPattern (ForbiddenPattern newPattern) |
Adds a pattern and its rotations to the pattern list. | |
bool | findRule (Rule rule) |
Finds a rule in the collection. | |
bool | findPattern (ForbiddenPattern pattern) |
Finds a pattern in the collection. | |
void | printRule (Rule rule) |
Prints a rule to the standard output. | |
void | printPattern (Grid pattern) |
Prints a pattern to the standard output. | |
bool | rotateGrid (Grid originalGrid, Grid *destGrid) |
Rotates a grid 60 degrees. | |
void | rotateHexCoordinate (int center, int i, int j, int *ii, int *jj) |
Rotates a coordinate of a grid 60 degrees. | |
void | updateRowList () |
Updates the results view row list. | |
void | updateInformationList () |
Updates the results view event list. | |
void | updatePathList () |
Updates the results view simulation step list. | |
void | updateGrid () |
Sets the results view grid corresponding to the simulation step selected. | |
bool | verifyRow (int row) |
Checks if a row simulation verifies the truth table. | |
bool | verifyGrid (int row, Grid g) |
Verifies if a grid has the correct output values for a table and a row. | |
Private Attributes | |
TruthTableManager * | tableManager |
Truth table controller. | |
ForbiddenPatternManager * | FPManager |
Forbidden pattern controller. | |
RuleManager * | ruleManager |
Rule controller. | |
LayoutManager * | layoutManager |
Space controller. | |
MainController * | controller |
Main application controller. | |
list< Rule > | rules |
Rules to use for simulating. | |
list< ForbiddenPattern > | patterns |
Forbidden patterns to use for simulating. | |
TruthTable | table |
Truth table to simulate. | |
matrix | layout |
Space to be simulated. | |
vector< coordinate > | tableInputs |
Input coordinates for the truth table. | |
vector< coordinate > | tableOutputs |
Output coordinates for the truth table. | |
vector< list< Grid > > | processedLayouts |
List of simulated spaces for every table row. | |
vector< list< simulationStep > > | finalLayouts |
List of stable spaces reached for every table row. | |
vector< list< simulationStep > > | forbiddenLayouts |
List of forbidden pattern spaces reached for every table row. | |
vector< list< simulationStep > > | cycles |
List of cycles found for every table row. | |
int | row |
Row being simulated. | |
SimulationView * | view |
Simulation presentation layer. | |
ResultsView * | resultsView |
Results presentation layer. | |
Simulation * | simulation |
Simulation. | |
int | rRow |
Results row selected. | |
int | rInformation |
Results event selected. | |
int | rPath |
Results simulation step selected. | |
Grid | initialGrid |
Initial space. |
This class manages the simulation. Basically it prepares and checks the simulations and creates the necessary Simulation objects to proceed. It also controlls them and shows the results for the simulations.
Definition at line 54 of file simulationManager.hpp.
|
Constructor.
Definition at line 31 of file simulationManager.cpp. References controller, FPManager, layoutManager, ruleManager, and tableManager. |
|
Destructor.
Definition at line 42 of file simulationManager.cpp. |
|
Adds a pattern and its rotations to the pattern list.
Definition at line 146 of file simulationManager.cpp. References findPattern(), Grid::getHeight(), Grid::getWidth(), patterns, and rotateGrid(). Here is the call graph for this function: ![]() |
|
Adds a rule and its rotations to the rule list.
Definition at line 102 of file simulationManager.cpp. References findRule(), Grid::getHeight(), Grid::getWidth(), rotateGrid(), and rules. Referenced by prepareSimulation(). Here is the call graph for this function: ![]() |
|
Finds a pattern in the collection.
Definition at line 202 of file simulationManager.cpp. References patterns. Referenced by addPattern(). |
|
Finds a rule in the collection.
Definition at line 184 of file simulationManager.cpp. References rules. Referenced by addRule(). |
|
Gathers the simulation data from the simulated row.
Definition at line 417 of file simulationManager.cpp. References cycles, finalLayouts, forbiddenLayouts, Simulation::getCycles(), Simulation::getForbiddenLayouts(), Simulation::getProcessedLayouts(), Simulation::getStableLayouts(), processedLayouts, row, and simulation. Here is the call graph for this function: ![]() |
|
Selects a row event to show it's results.
Definition at line 469 of file simulationManager.cpp. References rInformation, rPath, updateGrid(), updateInformationList(), and updatePathList(). Referenced by ResultsView::OnInformationSelected(). Here is the call graph for this function: ![]() |
|
Asks for new rows to simulate.
Definition at line 370 of file simulationManager.cpp. References row, and tableInputs. Referenced by Simulation::nextRow(), Simulation::simulateAll(), simulateRow(), and Simulation::updateView(). |
|
Selects a simulation step to show it's results.
Definition at line 483 of file simulationManager.cpp. References rPath, updateGrid(), and updatePathList(). Referenced by ResultsView::OnPathSelected(). Here is the call graph for this function: ![]() |
|
Prepares and starts a simulation. This method gathers all the information needed to do a simulation and initializes all the important data structures to do a simulation, and then it starts it. Definition at line 53 of file simulationManager.cpp. References addRule(), LayoutConfig::getGrid(), LayoutManager::getLayout(), LayoutManager::getListFPEnabled(), LayoutManager::getListRuleEnabled(), LayoutConfig::getMatrix(), TruthTable::getName(), LayoutManager::getTableInput(), LayoutManager::getTableOutput(), LayoutManager::getTableSelected(), initialGrid, layout, layoutManager, patterns, rules, table, tableInputs, and tableOutputs. Referenced by MainController::startSimulation(). Here is the call graph for this function: ![]() |
|
Prints a pattern to the standard output.
Definition at line 256 of file simulationManager.cpp. References Grid::getWidth(). Here is the call graph for this function: ![]() |
|
Prints a rule to the standard output.
Definition at line 219 of file simulationManager.cpp. References Rule::getWidth(). Here is the call graph for this function: ![]() |
|
Shows the simulation results.
Definition at line 428 of file simulationManager.cpp. References controller, MainController::getNanoFrame(), initialGrid, resultsView, rInformation, rPath, rRow, ResultsView::setInputs(), ResultsView::setOutputs(), ResultsView::setTable(), table, tableInputs, tableOutputs, updateGrid(), updateInformationList(), ResultsView::updateInitialGrid(), updatePathList(), and updateRowList(). Referenced by Simulation::results(). Here is the call graph for this function: ![]() |
|
Rotates a grid 60 degrees.
Definition at line 279 of file simulationManager.cpp. References Grid::getWidth(), and nDONTCARE. Referenced by addPattern(), and addRule(). Here is the call graph for this function: ![]() |
|
Rotates a coordinate of a grid 60 degrees.
Definition at line 329 of file simulationManager.cpp. |
|
Selects a row to show it's results.
Definition at line 453 of file simulationManager.cpp. References rInformation, rPath, rRow, updateGrid(), updateInformationList(), updatePathList(), and updateRowList(). Referenced by ResultsView::OnRowsSelected(). Here is the call graph for this function: ![]() |
|
Simulates the current row.
Definition at line 377 of file simulationManager.cpp. References finalLayouts, LayoutManager::getLayout(), LayoutConfig::getMatrix(), layout, layoutManager, nDISABLED, nENABLED, nextRow(), row, tableInputs, and tableOutputs. Referenced by Simulation::nextRow(), Simulation::simulateAll(), and startSimulation(). Here is the call graph for this function: ![]() |
|
Starts a simulation. This MUST NOT be called if all the simulation information is prepared and valid. Definition at line 359 of file simulationManager.cpp. References simulateRow(). Here is the call graph for this function: ![]() |
|
Sets the results view grid corresponding to the simulation step selected.
Definition at line 600 of file simulationManager.cpp. References forbiddenLayouts, and rInformation. Referenced by informationSelected(), pathSelected(), results(), and rowSelected(). |
|
Updates the results view event list.
Definition at line 517 of file simulationManager.cpp. References forbiddenLayouts, and rRow. Referenced by informationSelected(), results(), and rowSelected(). |
|
Updates the results view simulation step list.
Definition at line 549 of file simulationManager.cpp. References forbiddenLayouts, simulationStep::path, and rInformation. Referenced by informationSelected(), pathSelected(), results(), and rowSelected(). |
|
Updates the results view row list.
Definition at line 492 of file simulationManager.cpp. References tableInputs, and verifyRow(). Referenced by results(), and rowSelected(). Here is the call graph for this function: ![]() |
|
Verifies if a grid has the correct output values for a table and a row.
Definition at line 684 of file simulationManager.cpp. References TruthTable::getOutput(), nDISABLED, nENABLED, table, tableInputs, and tableOutputs. Referenced by verifyRow(). Here is the call graph for this function: ![]() |
|
Checks if a row simulation verifies the truth table.
Definition at line 656 of file simulationManager.cpp. References finalLayouts, forbiddenLayouts, and verifyGrid(). Referenced by updateRowList(). Here is the call graph for this function: ![]() |
|
Main application controller.
Definition at line 94 of file simulationManager.hpp. Referenced by results(), and SimulationManager(). |
|
List of cycles found for every table row.
Definition at line 115 of file simulationManager.hpp. Referenced by finishedRow(). |
|
List of stable spaces reached for every table row.
Definition at line 111 of file simulationManager.hpp. Referenced by finishedRow(), simulateRow(), and verifyRow(). |
|
List of forbidden pattern spaces reached for every table row.
Definition at line 113 of file simulationManager.hpp. Referenced by finishedRow(), updateGrid(), updateInformationList(), updatePathList(), and verifyRow(). |
|
Forbidden pattern controller.
Definition at line 88 of file simulationManager.hpp. Referenced by SimulationManager(). |
|
Initial space.
Definition at line 131 of file simulationManager.hpp. Referenced by prepareSimulation(), and results(). |
|
Space to be simulated.
Definition at line 103 of file simulationManager.hpp. Referenced by prepareSimulation(), and simulateRow(). |
|
Space controller.
Definition at line 92 of file simulationManager.hpp. Referenced by prepareSimulation(), simulateRow(), and SimulationManager(). |
|
Forbidden patterns to use for simulating.
Definition at line 99 of file simulationManager.hpp. Referenced by addPattern(), findPattern(), and prepareSimulation(). |
|
List of simulated spaces for every table row.
Definition at line 109 of file simulationManager.hpp. Referenced by finishedRow(). |
|
Results presentation layer.
Definition at line 121 of file simulationManager.hpp. Referenced by results(). |
|
Results event selected.
Definition at line 127 of file simulationManager.hpp. Referenced by informationSelected(), results(), rowSelected(), updateGrid(), and updatePathList(). |
|
Row being simulated.
Definition at line 117 of file simulationManager.hpp. Referenced by finishedRow(), nextRow(), and simulateRow(). |
|
Results simulation step selected.
Definition at line 129 of file simulationManager.hpp. Referenced by informationSelected(), pathSelected(), results(), and rowSelected(). |
|
Results row selected.
Definition at line 125 of file simulationManager.hpp. Referenced by results(), rowSelected(), and updateInformationList(). |
|
Rule controller.
Definition at line 90 of file simulationManager.hpp. Referenced by SimulationManager(). |
|
Rules to use for simulating.
Definition at line 97 of file simulationManager.hpp. Referenced by addRule(), findRule(), and prepareSimulation(). |
|
Definition at line 123 of file simulationManager.hpp. Referenced by finishedRow(). |
|
Truth table to simulate.
Definition at line 101 of file simulationManager.hpp. Referenced by prepareSimulation(), results(), and verifyGrid(). |
|
Input coordinates for the truth table.
Definition at line 105 of file simulationManager.hpp. Referenced by nextRow(), prepareSimulation(), results(), simulateRow(), updateRowList(), and verifyGrid(). |
|
Truth table controller.
Definition at line 86 of file simulationManager.hpp. Referenced by SimulationManager(). |
|
Output coordinates for the truth table.
Definition at line 107 of file simulationManager.hpp. Referenced by prepareSimulation(), results(), simulateRow(), and verifyGrid(). |
|
Simulation presentation layer.
Definition at line 119 of file simulationManager.hpp. |