Skip to content
Snippets Groups Projects
Commit b6170b09 authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Put in flush calls as a workaround for the stupid ofstream bug on ppc64

parent 98c7f7fa
No related branches found
No related tags found
No related merge requests found
......@@ -279,13 +279,19 @@ namespace MISCMATHS {
int write_ascii_matrix(const Matrix& mat, ofstream& fs, int precision)
{
if (precision>0) {
fs.setf(ios::scientific | ios::showpos);
fs.precision(precision);
}
#ifdef PPC64
int n=0;
#endif
for (int i=1; i<=mat.Nrows(); i++) {
for (int j=1; j<=mat.Ncols(); j++) {
if (precision>0) {
fs.setf(ios::scientific | ios::showpos);
fs.precision(precision+7);
fs.precision(precision); }
fs << mat(i,j) << " ";
#ifdef PPC64
if ((n++ % 50) == 0) fs.flush();
#endif
}
fs << endl;
}
......@@ -352,10 +358,16 @@ namespace MISCMATHS {
ny = mat.Ncols();
double val;
#ifdef PPC64
int n=0;
#endif
for (unsigned int y=1; y<=ny; y++) {
for (unsigned int x=1; x<=nx; x++) {
val = mat(x,y);
fs.write((char*)&val,sizeof(val));
#ifdef PPC64
if ((n++ % 50) == 0) fs.flush();
#endif
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment