From c7b78472bf6e2dc0752c79c2b33a8046f80d3b32 Mon Sep 17 00:00:00 2001 From: Logan Drescher Date: Fri, 26 Jan 2024 14:57:41 -0500 Subject: [PATCH] Used delegating constructor and added SimulationMessage::create() call --- Stochastic/VCellStoch/src/Gibson.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Stochastic/VCellStoch/src/Gibson.cpp b/Stochastic/VCellStoch/src/Gibson.cpp index 32099cb2..1461c119 100644 --- a/Stochastic/VCellStoch/src/Gibson.cpp +++ b/Stochastic/VCellStoch/src/Gibson.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include using namespace std; @@ -32,10 +33,13 @@ const string Gibson::MY_T_STR = "t"; */ Gibson::Gibson() : savedSampleCount(1), lastTime (std::numeric_limits::min()) { - Tree=NULL; - currvals=NULL; + Tree = NULL; + currvals = NULL; generator = new std::mt19937_64(); distribution = new std::uniform_real_distribution(0.0,1.0); +#ifdef USE_MESSAGING + SimulationMessaging::create(); +#endif }//end of constructor Gibson() /* @@ -44,13 +48,7 @@ Gibson::Gibson() *Input para: srting, the input file(name), where the model info. is read. * string, the output file(name), where the results are saved. */ -Gibson::Gibson(const char* arg_infilename, const char* arg_outfilename) - : savedSampleCount(1), lastTime (std::numeric_limits::min( )) { - // TODO: Call basic constructor rather than duplicate lines - this->Tree = NULL; - this->currvals = NULL; - this->generator = new std::mt19937_64(); - this->distribution = new std::uniform_real_distribution<>(0.0,1.0); +Gibson::Gibson(const char* arg_infilename, const char* arg_outfilename) : Gibson(){ // Use delegating constructor this->outfilename = arg_outfilename; ifstream infile; @@ -691,6 +689,7 @@ void Gibson::march(){ this->outfile.close(); #ifdef USE_MESSAGING + std::cout << "Arrived at goalpost 6" << std::endl; if (!SimulationMessaging::getInstVar()->isStopRequested()) { SimulationMessaging::getInstVar()->setWorkerEvent(new WorkerEvent(JOB_COMPLETED, 1, ENDING_TIME)); }