Skip to content

Commit

Permalink
InertialModel: Init of actual instantiation
Browse files Browse the repository at this point in the history
Co-authored-by: Moritz Sallermann <[email protected]>
  • Loading branch information
amritagos and MSallermann committed Mar 23, 2024
1 parent 1d7e838 commit dee1ae6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/config_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ enum class Model
{
DeGroot,
ActivityDrivenModel,
InertialModel,
DeffuantModel
};

Expand Down Expand Up @@ -81,6 +82,11 @@ struct ActivityDrivenSettings
double covariance_factor = 0.0;
};

struct InertialSettings : public ActivityDrivenSettings
{
double friction_coefficient = 1.0;
};

struct InitialNetworkSettings
{
std::optional<std::string> file;
Expand Down
2 changes: 2 additions & 0 deletions include/models/InertialModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class InertialModel : public ActivityDrivenModelAbstract<InertialAgent>
using NetworkT = Network<AgentT>;
using WeightT = typename NetworkT::WeightT;

InertialModel( const Config::InertialSettings & settings, NetworkT & network, std::mt19937 & gen );

void iteration() override;

private:
Expand Down
6 changes: 6 additions & 0 deletions src/models/InertialModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
namespace Seldon
{

InertialModel::InertialModel( const Config::InertialSettings & settings, NetworkT & network, std::mt19937 & gen )
: ActivityDrivenModelAbstract<InertialAgent>( settings, network, gen ),
friction_coefficient( settings.friction_coefficient )
{
}

// X(t+dt)
// Also updates the position
void InertialModel::calc_position()
Expand Down

0 comments on commit dee1ae6

Please sign in to comment.