Merge pull request #16 from FYS3150-G2-2023/coryab/code

Fix small bug
This commit is contained in:
Cory Balaton 2023-12-07 16:35:18 +01:00 committed by GitHub Enterprise
commit e3469b9cc5

View File

@ -23,7 +23,7 @@ void usage(std::string filename)
{ {
std::cout << "Usage: " << filename std::cout << "Usage: " << filename
<< " <temperature> <lattice size> " << " <temperature> <lattice size> "
"<cycles> <burn-in-time> <output file>\n\n" "<cycles> <burn-in-time> <output file> <ordered? (1|0)>\n\n"
<< "\t[ -h | --help ]\n"; << "\t[ -h | --help ]\n";
exit(-1); exit(-1);
} }
@ -57,17 +57,11 @@ int main(int argc, char **argv)
usage(argv[0]); usage(argv[0]);
} }
} }
// Check that the number of arguments is at least 6. // Check that the number of arguments is at least 7.
if (argc < 6) { if (argc < 7) {
usage(argv[0]); usage(argv[0]);
} }
bool ordered = false;
if (argc == 7) {
ordered = true;
}
// Timing variables // Timing variables
double t0, t1; double t0, t1;
t0 = omp_get_wtime(); t0 = omp_get_wtime();
@ -77,6 +71,8 @@ int main(int argc, char **argv)
int L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]); int L = atoi(argv[2]), cycles = atoi(argv[3]), burn_in_time = atoi(argv[4]);
std::string outfile = argv[5]; std::string outfile = argv[5];
bool ordered = atoi(argv[6]) == 1 ? true : false;
if (ordered) { if (ordered) {
DEBUG("Hello"); DEBUG("Hello");
montecarlo::progression(temp, L, cycles, 1, outfile, burn_in_time); montecarlo::progression(temp, L, cycles, 1, outfile, burn_in_time);