Commit fd031b2a authored by jclamber's avatar jclamber

fix bug when reading double gadget2 file

git-svn-id: http://svn.oamp.fr/repos/unsio/trunk@225 ce2cc22f-6084-46ce-a062-084b172ee5dc
parent a0b392c4
......@@ -224,13 +224,19 @@ template <class T> int CSnapshotGadgetIn::readCompData(T ** data, const int * in
*data = new T[dim*nsel];
}
T * ptr = *data;
float fskip; // file skip factor
if (array_vs_file_size<=1) {
fskip=float(array_vs_file_size+1);
} else {
fskip=0.5;
}
for(int k=0;k<6;k++) {
if (header.npart[k]>0) { // there are particles for the component
int idx=index2[npartOffset[k]];
if (idx != -1) {
readData((char *) &ptr[dim*idx], sizeof(T), dim*header.npart[k]);
} else {
skipData(sizeof(T)*dim*header.npart[k]);
skipData(fskip*sizeof(T)*dim*header.npart[k]);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment