Skip to content

Commit

Permalink
Used delegating constructor and added SimulationMessage::create() call
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeByDrescher committed Jan 26, 2024
1 parent 0a55ca6 commit c7b7847
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Stochastic/VCellStoch/src/Gibson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cstdint>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <random>
using namespace std;

Expand All @@ -32,10 +33,13 @@ const string Gibson::MY_T_STR = "t";
*/
Gibson::Gibson()
: savedSampleCount(1), lastTime (std::numeric_limits<long>::min()) {
Tree=NULL;
currvals=NULL;
Tree = NULL;
currvals = NULL;
generator = new std::mt19937_64();
distribution = new std::uniform_real_distribution<double>(0.0,1.0);
#ifdef USE_MESSAGING
SimulationMessaging::create();
#endif
}//end of constructor Gibson()

/*
Expand All @@ -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<long>::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;
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit c7b7847

Please sign in to comment.