| 117 | } |
| 118 | |
| 119 | auto PatternAnalysisDialog::getAnalysisDescription(ClusterDescription const& cluster) const -> ClusterAnalysisDescription |
| 120 | { |
| 121 | ClusterAnalysisDescription result; |
| 122 | std::map<uint64_t, CellAnalysisDescription> cellAnalysisDescById; |
| 123 | auto insertCellAnalysisDescription = [&cellAnalysisDescById](CellDescription const& cell) { |
| 124 | if (cellAnalysisDescById.find(cell.id) == cellAnalysisDescById.end()) { |
| 125 | CellAnalysisDescription result; |
| 126 | result.maxConnections = cell.maxConnections; |
| 127 | result.numConnections = cell.connections.size(); |
| 128 | result.constructionState = cell.livingState; |
| 129 | result.inputExecutionOrderNumber = cell.inputExecutionOrderNumber; |
| 130 | result.outputBlocked = cell.outputBlocked; |
| 131 | result.executionOrderNumber = cell.executionOrderNumber; |
| 132 | result.color = cell.color; |
| 133 | result.cellFunction = cell.getCellFunctionType(); |
| 134 | |
| 135 | cellAnalysisDescById.insert_or_assign(cell.id, result); |
| 136 | } |
| 137 | }; |
| 138 | |
| 139 | std::map<uint64_t, int> cellDescIndexById; |
| 140 | for (auto const& [index, cell] : cluster.cells | boost::adaptors::indexed(0)) { |
| 141 | cellDescIndexById.insert_or_assign(cell.id, toInt(index)); |
| 142 | } |
| 143 | |
| 144 | for (auto const& cell : cluster.cells) { |
| 145 | insertCellAnalysisDescription(cell); |
| 146 | for (auto const& connection : cell.connections) { |
| 147 | auto connectingCellId = connection.cellId; |
| 148 | insertCellAnalysisDescription(cluster.cells.at(cellDescIndexById.at(connectingCellId))); |
| 149 | result.connectedCells.insert(std::set<CellAnalysisDescription>{cellAnalysisDescById.at(cell.id), cellAnalysisDescById.at(connectingCellId)}); |
| 150 | } |
| 151 | } |
| 152 | return result; |
| 153 | } |
nothing calls this directly
no test coverage detected