From dee1ae6dd0855b5cfbcabc27c0193dc69765897e Mon Sep 17 00:00:00 2001 From: Amrita Goswami Date: Sat, 23 Mar 2024 18:01:17 +0000 Subject: [PATCH] InertialModel: Init of actual instantiation Co-authored-by: Moritz Sallermann --- include/config_parser.hpp | 6 ++++++ include/models/InertialModel.hpp | 2 ++ src/models/InertialModel.cpp | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/include/config_parser.hpp b/include/config_parser.hpp index 208e27d..6099a3f 100644 --- a/include/config_parser.hpp +++ b/include/config_parser.hpp @@ -25,6 +25,7 @@ enum class Model { DeGroot, ActivityDrivenModel, + InertialModel, DeffuantModel }; @@ -81,6 +82,11 @@ struct ActivityDrivenSettings double covariance_factor = 0.0; }; +struct InertialSettings : public ActivityDrivenSettings +{ + double friction_coefficient = 1.0; +}; + struct InitialNetworkSettings { std::optional file; diff --git a/include/models/InertialModel.hpp b/include/models/InertialModel.hpp index 8f5577d..70b83ef 100644 --- a/include/models/InertialModel.hpp +++ b/include/models/InertialModel.hpp @@ -24,6 +24,8 @@ class InertialModel : public ActivityDrivenModelAbstract using NetworkT = Network; using WeightT = typename NetworkT::WeightT; + InertialModel( const Config::InertialSettings & settings, NetworkT & network, std::mt19937 & gen ); + void iteration() override; private: diff --git a/src/models/InertialModel.cpp b/src/models/InertialModel.cpp index 62a5795..0d982c2 100644 --- a/src/models/InertialModel.cpp +++ b/src/models/InertialModel.cpp @@ -9,6 +9,12 @@ namespace Seldon { +InertialModel::InertialModel( const Config::InertialSettings & settings, NetworkT & network, std::mt19937 & gen ) + : ActivityDrivenModelAbstract( settings, network, gen ), + friction_coefficient( settings.friction_coefficient ) +{ +} + // X(t+dt) // Also updates the position void InertialModel::calc_position()