(cosmetic) Personalized RunParameters for stochastic Gillespie simulation (SS).
authorDariusz Murakowski <murakdar@mit.edu>
Thu, 20 Nov 2014 21:51:58 +0000 (16:51 -0500)
committerDariusz Murakowski <murakdar@mit.edu>
Thu, 20 Nov 2014 21:52:10 +0000 (16:52 -0500)
ss.cpp
ss.h

diff --git a/ss.cpp b/ss.cpp
index 8f69a3c..caf5a3b 100644 (file)
--- a/ss.cpp
+++ b/ss.cpp
@@ -36,7 +36,7 @@ static unsigned sim_random_seed() {
 
 // Run the program
 
-void run(RunParameters &r, unsigned seed) {
+void run(RunParameters_SS &r, unsigned seed) {
     
     // Initialize RNG and set initial state, if importing from file
     
@@ -101,9 +101,9 @@ void run(RunParameters &r, unsigned seed) {
                 EpitopeHamiltonian H(r.couplingsInfile);
 
                 double penalty = 0.0;
-                if (r.penaltyType == RunParameters::PenaltyEACH)
+                if (r.penaltyType == RunParameters_SS::PenaltyEACH)
                     penalty = r.penalty;
-                else if (r.penaltyType == RunParameters::PenaltyTOTAL)
+                else if (r.penaltyType == RunParameters_SS::PenaltyTOTAL)
                     penalty = r.penalty / (double)r.numEpitopes;
                 for (unsigned ep=0; ep<r.numEpitopes; ++ep) {
                     H.set_epitope(r.eWT[ep], r.eMut[ep], penalty);
@@ -211,7 +211,7 @@ void run(RunParameters &r, unsigned seed) {
 
 // Import initial state from a state file
 
-void importState(RunParameters &r) {
+void importState(RunParameters_SS &r) {
 
     FILE *input=fopen(r.stateInfile.c_str(),"r");   // <infile>.st
     if (input == NULL) { perror((std::string("ERROR in importState: ") + r.stateInfile).c_str()); exit(1); }
@@ -259,7 +259,7 @@ void importState(RunParameters &r) {
 
 // load epitope definitions from file
 
-void importEpitope(RunParameters &r) {
+void importEpitope(RunParameters_SS &r) {
 
     std::ifstream input(r.epitopeInfile.c_str());   // <infile>.ep
     if (!input) { perror((std::string("ERROR in importEpitope: ") + r.epitopeInfile).c_str()); exit(1); }
@@ -314,7 +314,7 @@ void importEpitope(RunParameters &r) {
 
 // insert into initial state of population
 
-void add_to_two_site_pop(RunParameters &r, bool s1, bool s2, double frac) {
+void add_to_two_site_pop(RunParameters_SS &r, bool s1, bool s2, double frac) {
 
     r.initFrac.push_back(frac);
 
@@ -379,7 +379,7 @@ void usage()
 
 int main(int argc, char *argv[]) {
     
-    RunParameters r;
+    RunParameters_SS r;
 
     unsigned seed = sim_random_seed();
     
@@ -400,8 +400,8 @@ int main(int argc, char *argv[]) {
         else if (strcmp(argv[i],"-bh")==0) { if (++i==argc) break; else r.bh=strtodouble(argv[i]);              }
         else if (strcmp(argv[i],"-bJ")==0) { if (++i==argc) break; else r.bJ=strtodouble(argv[i]);              }
 
-        else if (strcmp(argv[i],"-penaltyEach")==0) { if (++i==argc) break; else { r.penalty=strtodouble(argv[i]); r.penaltyType=RunParameters::PenaltyEACH; } }
-        else if (strcmp(argv[i],"-penaltyTotal")==0) { if (++i==argc) break; else { r.penalty=strtodouble(argv[i]); r.penaltyType=RunParameters::PenaltyTOTAL; } }
+        else if (strcmp(argv[i],"-penaltyEach")==0) { if (++i==argc) break; else { r.penalty=strtodouble(argv[i]); r.penaltyType=RunParameters_SS::PenaltyEACH; } }
+        else if (strcmp(argv[i],"-penaltyTotal")==0) { if (++i==argc) break; else { r.penalty=strtodouble(argv[i]); r.penaltyType=RunParameters_SS::PenaltyTOTAL; } }
         
         else if (strcmp(argv[i],"-r")==0)   { r.useRelative=true;    }
         else if (strcmp(argv[i],"-esc")==0) { r.runUntilEscape=true; }
diff --git a/ss.h b/ss.h
index a2192d7..ad52952 100644 (file)
--- a/ss.h
+++ b/ss.h
@@ -69,7 +69,7 @@ inline double strtodouble(const std::string &s) {
 
 // This class holds the parameters needed for running the simulation
 
-class RunParameters {
+class RunParameters_SS {
     
 public:
     
@@ -120,7 +120,7 @@ public:
     PenaltyTYPE penaltyType;
     
     
-    RunParameters() {
+    RunParameters_SS() {
     
         directory="";
         
@@ -179,14 +179,14 @@ public:
         //printf("%s\n%s\n%s\n",couplingsInfile.c_str(),trajectoryOutfile.c_str(),stateInfile.c_str());
     
     }
-    ~RunParameters() {}
+    ~RunParameters_SS() {}
     
 };
 
 
-void run(RunParameters &r);
-void importState(RunParameters &r);
-void importEpitope(RunParameters &r);
+void run(RunParameters_SS &r);
+void importState(RunParameters_SS &r);
+void importEpitope(RunParameters_SS &r);
 
 
 #endif