simplify processing for "*" in filenames for embedding timestep by using utility function

This commit is contained in:
Axel Kohlmeyer
2022-03-29 06:06:48 -04:00
parent 015257889d
commit 27d2fab951
22 changed files with 102 additions and 446 deletions

View File

@ -549,20 +549,7 @@ void Dump::openfile()
if (multiproc) filecurrent = multiname;
if (multifile) {
char *filestar = filecurrent;
filecurrent = new char[strlen(filestar) + 16];
char *ptr = strchr(filestar,'*');
*ptr = '\0';
if (padflag == 0)
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s",
filestar,update->ntimestep,ptr+1);
else {
char bif[8],pad[16];
strcpy(bif,BIGINT_FORMAT);
sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]);
sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1);
}
*ptr = '*';
filecurrent = utils::strdup(utils::star_subst(filecurrent, update->ntimestep, padflag));
if (maxfiles > 0) {
if (numfiles < maxfiles) {
nameslist[numfiles] = utils::strdup(filecurrent);
@ -594,7 +581,7 @@ void Dump::openfile()
// delete string with timestep replaced
if (multifile) delete [] filecurrent;
if (multifile) delete[] filecurrent;
}
/* ----------------------------------------------------------------------