MCPcopy Create free account
hub / github.com/chrxh/alien / adaptLocationIndex

Method adaptLocationIndex

source/Gui/LocationHelper.cpp:91–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91std::map<int, int> LocationHelper::adaptLocationIndex(SimulationParameters& parameters, int fromLocationIndex, int offset)
92{
93 std::map<int, int> result;
94 result.emplace(0, 0);
95 for (int i = 0; i < parameters.numZones; ++i) {
96 auto& zone = parameters.zone[i];
97 if (zone.locationIndex >= fromLocationIndex) {
98 result.emplace(zone.locationIndex, zone.locationIndex + offset);
99 zone.locationIndex += offset;
100 } else {
101 result.emplace(zone.locationIndex, zone.locationIndex);
102 }
103 }
104 for (int i = 0; i < parameters.numRadiationSources; ++i) {
105 auto& source = parameters.radiationSource[i];
106 if (source.locationIndex >= fromLocationIndex) {
107 result.emplace(source.locationIndex, source.locationIndex + offset);
108 source.locationIndex += offset;
109 } else {
110 result.emplace(source.locationIndex, source.locationIndex);
111 }
112 }
113 return result;
114}
115
116std::string LocationHelper::generateZoneName(SimulationParameters& parameters)
117{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected