26 unsigned int hint = 0;
49 unsigned int dummy = 0;
51 std::vector<std::pair<unsigned int, unsigned int>>::const_iterator iter =
64 unsigned int endPathIndex)
const {
69 unsigned int moduleID)
const {
79 unsigned int dummy = 0;
81 std::vector<std::pair<unsigned int, unsigned int>>::const_iterator iter =
133 std::unordered_map<unsigned int, std::string> moduleIndexToNames;
135 std::unordered_map<std::string, unsigned int> pathStatusInserterModuleLabelToModuleID;
138 const std::string kTriggerResults(
"TriggerResults");
139 const std::string kPathStatusInserter(
"PathStatusInserter");
140 const std::string kEndPathStatusInserter(
"EndPathStatusInserter");
142 unsigned int largestIndex = 0;
143 unsigned int kPathToTriggerResultsDependencyLastIndex =
kInvalidIndex;
146 if (kTriggerResults ==
description->moduleLabel()) {
152 if (
description->moduleName() == kPathStatusInserter ||
description->moduleName() == kEndPathStatusInserter) {
156 kPathToTriggerResultsDependencyLastIndex = largestIndex;
204 std::unordered_map<unsigned int, std::vector<unsigned int>> moduleIndexToPathIndex;
208 const unsigned int kFirstEndPathIndex =
pathNames.size();
214 const std::string kFinishedProcessing(
"@FinishedProcessing");
215 const unsigned int kFinishedProcessingIndex{0};
216 moduleIndexToNames.insert(std::make_pair(kFinishedProcessingIndex, kFinishedProcessing));
219 std::vector<std::vector<unsigned int>> pathIndexToModuleIndexOrder(
pathNames.size());
221 for (
unsigned int pathIndex = 0; pathIndex !=
pathNames.size(); ++pathIndex) {
222 std::set<unsigned int> alreadySeenIndex;
224 std::vector<ModuleDescription const*>
const* moduleDescriptions;
225 if (pathIndex < kFirstEndPathIndex) {
228 moduleDescriptions = &(iPnC.
modulesOnEndPath(pathIndex - kFirstEndPathIndex));
231 auto& pathOrder = pathIndexToModuleIndexOrder[pathIndex];
232 pathOrder.reserve(moduleDescriptions->size() + 1);
233 for (
auto const&
description : *moduleDescriptions) {
237 unsigned int const moduleIndex =
description->id();
238 pathOrder.push_back(moduleIndex);
239 auto&
paths = moduleIndexToPathIndex[moduleIndex];
240 paths.push_back(pathIndex);
242 edgeToPathMap[std::make_pair(moduleIndex, lastModuleIndex)].push_back(pathIndex);
244 lastModuleIndex = moduleIndex;
249 auto labelToID = pathStatusInserterModuleLabelToModuleID.find(
pathNames[pathIndex]);
250 if (labelToID == pathStatusInserterModuleLabelToModuleID.end()) {
253 <<
"PathsAndConsumesOfModules::moduleDescription:checkForModuleDependencyCorrectness Could not find "
254 "PathStatusInserter\n";
256 unsigned int pathStatusInserterModuleID = labelToID->second;
257 if (pathIndex < kFirstEndPathIndex) {
259 edgeToPathMap[std::make_pair(pathStatusInserterModuleID, lastModuleIndex)].push_back(pathIndex);
260 moduleIndexToNames.insert(std::make_pair(pathStatusInserterModuleID, kPathEnded));
262 edgeToPathMap[std::make_pair(kTriggerResultsIndex, pathStatusInserterModuleID)].push_back(
266 edgeToPathMap[std::make_pair(kFinishedProcessingIndex, pathStatusInserterModuleID)].push_back(
268 pathOrder.push_back(pathStatusInserterModuleID);
271 if ((not moduleDescriptions->empty())) {
273 ++kPathToTriggerResultsDependencyLastIndex;
274 edgeToPathMap[std::make_pair(moduleDescriptions->front()->id(), kPathToTriggerResultsDependencyLastIndex)]
275 .push_back(pathIndex);
276 moduleIndexToNames.insert(std::make_pair(kPathToTriggerResultsDependencyLastIndex, kEndPathStart));
277 edgeToPathMap[std::make_pair(kPathToTriggerResultsDependencyLastIndex, kTriggerResultsIndex)].push_back(
279 pathOrder.insert(pathOrder.begin(), kPathToTriggerResultsDependencyLastIndex);
282 ++kPathToTriggerResultsDependencyLastIndex;
283 edgeToPathMap[std::make_pair(pathStatusInserterModuleID, lastModuleIndex)].push_back(pathIndex);
284 moduleIndexToNames.insert(std::make_pair(pathStatusInserterModuleID, kPathEnded));
285 edgeToPathMap[std::make_pair(kFinishedProcessingIndex, pathStatusInserterModuleID)].push_back(
287 pathOrder.push_back(pathStatusInserterModuleID);
295 unsigned int const moduleIndex =
description->id();
297 for (
auto const& depDescription : dependentModules) {
298 if (iPrintDependencies) {
300 <<
"ModuleDependency '" <<
description->moduleLabel() <<
"' depends on data products from module '"
301 << depDescription->moduleLabel() <<
"'";
306 auto depID = depDescription->id();
307 auto itPathsFound = moduleIndexToPathIndex.find(moduleIndex);
308 bool keepDataDependency =
true;
309 auto itDepsPathsFound = moduleIndexToPathIndex.find(depID);
310 if (itPathsFound != moduleIndexToPathIndex.end() and itDepsPathsFound != moduleIndexToPathIndex.end()) {
311 keepDataDependency =
false;
312 for (
auto const pathIndex : itPathsFound->second) {
313 for (
auto idToCheck : pathIndexToModuleIndexOrder[pathIndex]) {
314 if (idToCheck == depID) {
318 if (idToCheck == moduleIndex) {
321 keepDataDependency =
true;
325 if (keepDataDependency) {
330 if (keepDataDependency) {
340 if (not moduleIndexToPathIndex.empty()) {