Merge pull request #907 from akohlmey/dump_maxfile

Implement 'dump_modify maxfiles' feature
This commit is contained in:
Steve Plimpton
2018-05-12 12:59:33 -06:00
committed by GitHub
13 changed files with 186 additions and 3 deletions

View File

@ -97,6 +97,19 @@ void DumpCustomMPIIO::openfile()
sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1);
}
*ptr = '*';
if (maxfiles > 0) {
if (numfiles < maxfiles) {
nameslist[numfiles] = new char[strlen(filecurrent)+1];
strcpy(nameslist[numfiles],filecurrent);
++numfiles;
} else {
remove(nameslist[fileidx]);
delete[] nameslist[fileidx];
nameslist[fileidx] = new char[strlen(filecurrent)+1];
strcpy(nameslist[fileidx],filecurrent);
fileidx = (fileidx + 1) % maxfiles;
}
}
}
if (append_flag) { // append open