Fix BSSN-EM runtime crash
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
|
||||
#ifdef newc
|
||||
#include <cstdio>
|
||||
using namespace std;
|
||||
#ifdef newc
|
||||
#include <cstdio>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
@@ -77,16 +78,17 @@ monitor::monitor(const char fname[], int myrank, string head)
|
||||
parameters::str_par.insert(map<string, string>::value_type("output dir", out_dir));
|
||||
}
|
||||
// considering checkpoint run
|
||||
char filename[50];
|
||||
sprintf(filename, "%s/%s", out_dir.c_str(), fname);
|
||||
int i = 1;
|
||||
while ((access(filename, F_OK)) != -1)
|
||||
{
|
||||
sprintf(filename, "%s/%d_%s", out_dir.c_str(), i, fname);
|
||||
i++;
|
||||
}
|
||||
|
||||
outfile.open(filename, ios::trunc);
|
||||
string filename = out_dir + "/" + fname;
|
||||
int i = 1;
|
||||
while ((access(filename.c_str(), F_OK)) != -1)
|
||||
{
|
||||
stringstream ss;
|
||||
ss << out_dir << "/" << i << "_" << fname;
|
||||
filename = ss.str();
|
||||
i++;
|
||||
}
|
||||
|
||||
outfile.open(filename.c_str(), ios::trunc);
|
||||
|
||||
time_t tnow;
|
||||
time(&tnow);
|
||||
@@ -107,16 +109,17 @@ monitor::monitor(const char fname[], int myrank, const int out_rank, string head
|
||||
if (I_Print)
|
||||
{
|
||||
// considering checkpoint run
|
||||
char filename[50];
|
||||
sprintf(filename, "%s/%s", out_dir.c_str(), fname);
|
||||
int i = 1;
|
||||
while ((access(filename, F_OK)) != -1)
|
||||
{
|
||||
sprintf(filename, "%s/%d_%s", out_dir.c_str(), i, fname);
|
||||
i++;
|
||||
}
|
||||
|
||||
outfile.open(filename, ios::trunc);
|
||||
string filename = out_dir + "/" + fname;
|
||||
int i = 1;
|
||||
while ((access(filename.c_str(), F_OK)) != -1)
|
||||
{
|
||||
stringstream ss;
|
||||
ss << out_dir << "/" << i << "_" << fname;
|
||||
filename = ss.str();
|
||||
i++;
|
||||
}
|
||||
|
||||
outfile.open(filename.c_str(), ios::trunc);
|
||||
|
||||
time_t tnow;
|
||||
time(&tnow);
|
||||
|
||||
Reference in New Issue
Block a user