git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10925 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -1090,11 +1090,7 @@ void Image::write_PPM(FILE *fp)
|
||||
|
||||
int x,y;
|
||||
for (y = height-1; y >= 0; y --)
|
||||
for (x = 0; x < width; x ++)
|
||||
fprintf(fp,"%c%c%c",
|
||||
writeBuffer[0 + x*3 + y*width*3],
|
||||
writeBuffer[1 + x*3 + y*width*3],
|
||||
writeBuffer[2 + x*3 + y*width*3]);
|
||||
fwrite(&writeBuffer[y*width*3],3,width,fp);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
@ -28,42 +28,50 @@ using namespace LAMMPS_NS;
|
||||
|
||||
void WriteDump::command(int narg, char **arg)
|
||||
{
|
||||
|
||||
if (narg < 3) error->all(FLERR,"Illegal write_dump command");
|
||||
|
||||
if (atom->tag_enable == 0)
|
||||
error->all(FLERR,"Must have atom IDs for write_dump command");
|
||||
|
||||
// modindex = index in args of "modify", narg if doesn't exist
|
||||
// modindex = index in args of "modify" keyword
|
||||
// will be narg if "modify" is not present
|
||||
|
||||
int modindex;
|
||||
for (modindex = 0; modindex < narg; modindex++)
|
||||
if (strcmp(arg[modindex],"modify") == 0) break;
|
||||
|
||||
// create the Dump instance
|
||||
// create dump command line with extra required args
|
||||
|
||||
Dump *dump;
|
||||
|
||||
char **dumpargs = new char*[modindex+2];
|
||||
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
|
||||
dumpargs[1] = arg[0]; // group
|
||||
dumpargs[2] = arg[1]; // dump style
|
||||
dumpargs[3] = (char *) "0"; // dump frequency
|
||||
|
||||
for (int i = 2; i < modindex; ++i)
|
||||
dumpargs[i+2] = arg[i];
|
||||
|
||||
if (0) return; // dummy line to enable else-if macro expansion
|
||||
|
||||
#define DUMP_CLASS
|
||||
#define DumpStyle(key,Class) \
|
||||
else if (strcmp(arg[2],#key) == 0) dump = new Class(lmp,modindex,arg);
|
||||
else if (strcmp(arg[2],#key) == 0) dump = new Class(lmp,modindex+2,dumpargs);
|
||||
#include "style_dump.h"
|
||||
#undef DUMP_CLASS
|
||||
|
||||
else error->all(FLERR,"Invalid dump style");
|
||||
|
||||
// pass additional args to modify_params
|
||||
|
||||
if (modindex < narg) dump->modify_params(narg-modindex-1,&arg[modindex+1]);
|
||||
|
||||
// write the current snapshot to dump file
|
||||
// write out one frame and then delete the dump again
|
||||
|
||||
dump->init();
|
||||
dump->write();
|
||||
|
||||
// delete the Dump instance
|
||||
// delete the Dump instance and local storage
|
||||
|
||||
delete dump;
|
||||
delete[] dumpargs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user