Skip to content

Commit

Permalink
Simulation: Put agents_from_file outside of if
Browse files Browse the repository at this point in the history
Less code repetition, less confusing, less shitty

Co-authored-by: Amrita Goswami <[email protected]>
  • Loading branch information
MSallermann and amritagos committed Mar 22, 2024
1 parent 2ab75f9 commit 27e319d
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions include/simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ class Simulation : public SimulationInterface
auto model = std::make_unique<DeGrootModel>( degroot_settings, network );
return model;
}();

if( cli_agent_file.has_value() )
{
network.agents = agents_from_file<DeGrootModel::AgentT>( cli_agent_file.value() );
}
}
else if( options.model == Config::Model::DeffuantModel )
{
Expand All @@ -90,11 +85,6 @@ class Simulation : public SimulationInterface
deffuant_settings, network, gen, deffuant_settings.use_network );
return model;
}();

if( cli_agent_file.has_value() )
{
network.agents = agents_from_file<DeffuantModel::AgentT>( cli_agent_file.value() );
}
}
}
else if constexpr( std::is_same_v<AgentType, ActivityDrivenModel::AgentT> )
Expand All @@ -106,11 +96,11 @@ class Simulation : public SimulationInterface
auto model = std::make_unique<ActivityDrivenModel>( activitydriven_settings, network, gen );
return model;
}();
}

if( cli_agent_file.has_value() )
{
network.agents = agents_from_file<ActivityDrivenModel::AgentT>( cli_agent_file.value() );
}
if( cli_agent_file.has_value() )
{
network.agents = agents_from_file<AgentType>( cli_agent_file.value() );
}
}

Expand Down

0 comments on commit 27e319d

Please sign in to comment.