git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5774 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2011-03-09 21:19:59 +00:00
parent 0dfb9bc4f9
commit b44d840bfb
2 changed files with 17 additions and 3 deletions

View File

@ -70,6 +70,7 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
clearstep = 0; clearstep = 0;
sort_flag = 0; sort_flag = 0;
append_flag = 0; append_flag = 0;
padflag = 0;
maxbuf = maxids = maxsort = maxproc = 0; maxbuf = maxids = maxsort = maxproc = 0;
buf = bufsort = NULL; buf = bufsort = NULL;
@ -359,8 +360,15 @@ void Dump::openfile()
filecurrent = new char[strlen(filename) + 16]; filecurrent = new char[strlen(filename) + 16];
char *ptr = strchr(filename,'*'); char *ptr = strchr(filename,'*');
*ptr = '\0'; *ptr = '\0';
sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", if (padflag == 0)
filename,update->ntimestep,ptr+1); sprintf(filecurrent,"%s" BIGINT_FORMAT "%s",
filename,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,filename,update->ntimestep,ptr+1);
}
*ptr = '*'; *ptr = '*';
} }
@ -666,6 +674,11 @@ void Dump::modify_params(int narg, char **arg)
strcpy(format_user,arg[iarg+1]); strcpy(format_user,arg[iarg+1]);
} }
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"pad") == 0) {
if (iarg+2 > narg) error->all("Illegal dump_modify command");
padflag = atoi(arg[iarg+1]);
if (padflag < 0) error->all("Illegal dump_modify command");
iarg += 2;
} else if (strcmp(arg[iarg],"sort") == 0) { } else if (strcmp(arg[iarg],"sort") == 0) {
if (iarg+2 > narg) error->all("Illegal dump_modify command"); if (iarg+2 > narg) error->all("Illegal dump_modify command");
if (strcmp(arg[iarg+1],"off") == 0) sort_flag = 0; if (strcmp(arg[iarg+1],"off") == 0) sort_flag = 0;

View File

@ -36,7 +36,7 @@ class Dump : protected Pointers {
Dump(class LAMMPS *, int, char **); Dump(class LAMMPS *, int, char **);
virtual ~Dump(); virtual ~Dump();
void init(); void init();
void write(); virtual void write();
void modify_params(int, char **); void modify_params(int, char **);
virtual double memory_usage(); virtual double memory_usage();
@ -53,6 +53,7 @@ class Dump : protected Pointers {
int flush_flag; // 0 if no flush, 1 if flush every dump int flush_flag; // 0 if no flush, 1 if flush every dump
int sort_flag; // 1 if sorted output int sort_flag; // 1 if sorted output
int append_flag; // 1 if open file in append mode, 0 if not int append_flag; // 1 if open file in append mode, 0 if not
int padflag; // timestep padding in filename
int singlefile_opened; // 1 = one big file, already opened, else 0 int singlefile_opened; // 1 = one big file, already opened, else 0
int sortcol; // 0 to sort on ID, 1-N on columns int sortcol; // 0 to sort on ID, 1-N on columns
int sortcolm1; // sortcol - 1 int sortcolm1; // sortcol - 1