From 9013e450749765f26d5ae1ce91e9c76c4ec282f9 Mon Sep 17 00:00:00 2001 From: Moritz Sallermann Date: Sun, 8 Oct 2023 13:06:53 +0000 Subject: [PATCH 1/3] agent::to_string print with fixed amount of decimals --- include/agent.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/agent.hpp b/include/agent.hpp index 9ab0fd1..92613ac 100644 --- a/include/agent.hpp +++ b/include/agent.hpp @@ -20,7 +20,7 @@ class Agent : public AgentBase std::string to_string() const override { - return fmt::format( "{}", data ); + return fmt::format( "{:.16f}", data ); } }; From 6be8d7b8aa58055bbc8a7db0d0318dac3062531c Mon Sep 17 00:00:00 2001 From: Moritz Sallermann Date: Sun, 8 Oct 2023 13:12:12 +0000 Subject: [PATCH 2/3] Header in output files is now also comma separated --- include/util/io.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/util/io.hpp b/include/util/io.hpp index 6b02d91..c19cc4c 100644 --- a/include/util/io.hpp +++ b/include/util/io.hpp @@ -47,7 +47,7 @@ inline void opinions_to_file( Simulation & simulation, const std::string & file_ auto & model = simulation.model; size_t n_agents = network->n_agents(); - fmt::print( fs, "# idx_agent opinion[...]\n" ); + fmt::print( fs, "# idx_agent, opinion[...]\n" ); for( size_t idx_agent = 0; idx_agent < n_agents; idx_agent++ ) { std::string row = fmt::format( "{:>5}, {:>25}\n", idx_agent, model->get_agent( idx_agent )->to_string() ); @@ -64,7 +64,7 @@ inline void network_to_file( Simulation & simulation, const std::string & file_p auto & network = *simulation.network; size_t n_agents = network.n_agents(); - fmt::print( fs, "# idx_agent n_neighbours_in indices_neighbours_in[...] weights_in[...]\n" ); + fmt::print( fs, "# idx_agent, n_neighbours_in, indices_neighbours_in[...], weights_in[...]\n" ); auto buffer_neighbours = std::vector(); auto buffer_weights = std::vector(); From 279265fcdcd9f4dd3bc5ad55abb646734583edba Mon Sep 17 00:00:00 2001 From: Moritz Sallermann Date: Sun, 8 Oct 2023 13:13:24 +0000 Subject: [PATCH 3/3] Default output directory now is ./output --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ee4be9d..71483c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,7 @@ int main( int argc, char * argv[] ) std::optional agent_file = program.present( "-a" ); std::optional network_file = program.present( "-n" ); std::optional output_dir_path_cli = program.present( "-o" ); - fs::path output_dir_path = output_dir_path_cli.value_or( config_file_path.parent_path() / fs::path( "output" ) ); + fs::path output_dir_path = output_dir_path_cli.value_or( fs::path( "./output" ) ); fmt::print( "Using input file: {}\n", config_file_path.string() ); fmt::print( "Output directory path set to: {}\n", output_dir_path.string() );