git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@4798 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
27
src/dump.cpp
27
src/dump.cpp
@ -68,7 +68,7 @@ Dump::Dump(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
sort_flag = 0;
|
sort_flag = 0;
|
||||||
append_flag = 0;
|
append_flag = 0;
|
||||||
|
|
||||||
maxbuf = maxsort = maxproc = 0;
|
maxbuf = maxids = maxsort = maxproc = 0;
|
||||||
buf = bufsort = NULL;
|
buf = bufsort = NULL;
|
||||||
ids = idsort = index = proclist = NULL;
|
ids = idsort = index = proclist = NULL;
|
||||||
irregular = NULL;
|
irregular = NULL;
|
||||||
@ -156,7 +156,7 @@ void Dump::init()
|
|||||||
memory->sfree(proclist);
|
memory->sfree(proclist);
|
||||||
delete irregular;
|
delete irregular;
|
||||||
|
|
||||||
maxsort = maxproc = 0;
|
maxids = maxsort = maxproc = 0;
|
||||||
bufsort = NULL;
|
bufsort = NULL;
|
||||||
ids = idsort = index = proclist = NULL;
|
ids = idsort = index = proclist = NULL;
|
||||||
irregular = NULL;
|
irregular = NULL;
|
||||||
@ -229,10 +229,11 @@ void Dump::write()
|
|||||||
memory->sfree(buf);
|
memory->sfree(buf);
|
||||||
buf = (double *)
|
buf = (double *)
|
||||||
memory->smalloc(maxbuf*size_one*sizeof(double),"dump:buf");
|
memory->smalloc(maxbuf*size_one*sizeof(double),"dump:buf");
|
||||||
if (sort_flag && sortcol == 0) {
|
}
|
||||||
memory->sfree(ids);
|
if (sort_flag && sortcol == 0 && nmax > maxids) {
|
||||||
ids = (int *) memory->smalloc(maxbuf*sizeof(int),"dump:ids");
|
maxids = nmax;
|
||||||
}
|
memory->sfree(ids);
|
||||||
|
ids = (int *) memory->smalloc(maxids*sizeof(int),"dump:ids");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sort_flag && sortcol == 0) pack(ids);
|
if (sort_flag && sortcol == 0) pack(ids);
|
||||||
@ -454,7 +455,7 @@ void Dump::sort()
|
|||||||
if (sortcol == 0) qsort(index,nme,sizeof(int),idcompare);
|
if (sortcol == 0) qsort(index,nme,sizeof(int),idcompare);
|
||||||
else qsort(index,nme,sizeof(int),bufcompare);
|
else qsort(index,nme,sizeof(int),bufcompare);
|
||||||
|
|
||||||
// copy data from bufsort to buf using index
|
// reset buf size and maxbuf to largest of any post-sort nme values
|
||||||
|
|
||||||
int nmax;
|
int nmax;
|
||||||
if (multiproc) nmax = nme;
|
if (multiproc) nmax = nme;
|
||||||
@ -465,11 +466,9 @@ void Dump::sort()
|
|||||||
memory->sfree(buf);
|
memory->sfree(buf);
|
||||||
buf = (double *)
|
buf = (double *)
|
||||||
memory->smalloc(maxbuf*size_one*sizeof(double),"dump:buf");
|
memory->smalloc(maxbuf*size_one*sizeof(double),"dump:buf");
|
||||||
if (sortcol == 0) {
|
|
||||||
memory->sfree(ids);
|
|
||||||
ids = (int *) memory->smalloc(maxbuf*sizeof(int),"dump:ids");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copy data from bufsort to buf using index
|
||||||
|
|
||||||
int nbytes = size_one*sizeof(double);
|
int nbytes = size_one*sizeof(double);
|
||||||
for (i = 0; i < nme; i++)
|
for (i = 0; i < nme; i++)
|
||||||
@ -595,12 +594,12 @@ void Dump::modify_params(int narg, char **arg)
|
|||||||
|
|
||||||
double Dump::memory_usage()
|
double Dump::memory_usage()
|
||||||
{
|
{
|
||||||
double bytes = maxbuf*size_one * sizeof(double);
|
double bytes = maxbuf*size_one * sizeof(double); // buf
|
||||||
if (sort_flag) {
|
if (sort_flag) {
|
||||||
if (sortcol == 0) bytes += maxbuf * sizeof(int); // ids
|
if (sortcol == 0) bytes += maxids * sizeof(int); // ids
|
||||||
bytes += maxsort*size_one * sizeof(double); // bufsort
|
bytes += maxsort*size_one * sizeof(double); // bufsort
|
||||||
bytes += maxsort * sizeof(int); // index
|
|
||||||
if (sortcol == 0) bytes += maxsort * sizeof(int); // idsort
|
if (sortcol == 0) bytes += maxsort * sizeof(int); // idsort
|
||||||
|
bytes += maxsort * sizeof(int); // index
|
||||||
bytes += maxproc * sizeof(int); // proclist
|
bytes += maxproc * sizeof(int); // proclist
|
||||||
if (irregular) bytes += irregular->memory_usage();
|
if (irregular) bytes += irregular->memory_usage();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,10 +68,12 @@ class Dump : protected Pointers {
|
|||||||
double boxzlo,boxzhi;
|
double boxzlo,boxzhi;
|
||||||
double boxxy,boxxz,boxyz;
|
double boxxy,boxxz,boxyz;
|
||||||
|
|
||||||
int maxbuf; // size of buf and ids
|
int maxbuf; // size of buf
|
||||||
|
double *buf; // memory for atom quantities
|
||||||
|
|
||||||
|
int maxids; // size of ids
|
||||||
int maxsort; // size of bufsort, idsort, index
|
int maxsort; // size of bufsort, idsort, index
|
||||||
int maxproc; // size of proclist
|
int maxproc; // size of proclist
|
||||||
double *buf; // memory for atom quantities
|
|
||||||
int *ids; // list of atom IDs, if sorting on IDs
|
int *ids; // list of atom IDs, if sorting on IDs
|
||||||
double *bufsort;
|
double *bufsort;
|
||||||
int *idsort,*index,*proclist;
|
int *idsort,*index,*proclist;
|
||||||
|
|||||||
Reference in New Issue
Block a user