The UFZ services GitLab and Mattermost will be unavailable on Monday, October 25 from 06:00 AM to 08:00 AM due to maintenance work.

Commit 176e7395 authored by Johannes Leins's avatar Johannes Leins
Browse files

keeping emigration flows to dead cells to gain simulation speed

parent aa444784
Pipeline #29391 passed with stage
in 29 seconds
......@@ -424,34 +424,11 @@ void Population::init(Environment* environment, PopulationAtts* atts) {
}
void Population::resetEmigration(Environment *environment) {
if((atts->getDispersalType() != DISPERSAL && atts->getDispersalType() != BOTH) // if no dispersal is active OR
if(emigrationFlows.size() > 0 // if emigration was set up already (following comparisons might be obsolete now)
|| (atts->getDispersalType() != DISPERSAL && atts->getDispersalType() != BOTH) // if no dispersal is active OR
|| vitality == DEAD || vitality == ALIVE) { // if population already was DEAD/ALIVE nothing needs to be done
return;
}
if(vitality == DIED) {
vector<Flow*> reducedFlows;
unordered_map<FlowType,vector<Flow*>> reducedFlowsByTyp;
for(auto flow : flows) {
for(auto emFlow : emigrationFlows) {
if(*flow == *emFlow) {
flow->getFrom()->removeOutput(emFlow);
if(emFlow->getTo()) {
flow->getTo()->removeInput(emFlow);
}
break;
}
if(emFlow == emigrationFlows.back()) {
reducedFlows.push_back(flow);
reducedFlowsByTyp[flow->getType()].push_back(flow);
}
}
}
flows = reducedFlows;
flowsByType = reducedFlowsByTyp;
// clear emigration flows
emigrationFlows.clear();
return;
}
// Otherwise the population was revived and the emigration edges need to be constructed
// get neighborhood (full grid) of this population
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment