//printf("(%d) new star (a) i=%d id=%d (StPi=%d PIdx=%d)\n",ThisTask,N_gas+N_stars+i,P[N_gas+N_stars+i].ID,P[N_gas+N_stars+i].StPIdx,StP[P[N_gas+N_stars+i].StPIdx].PIdx);
#endif
}
}
else /* move other particles outwards */
{
if (NumPart-N_gas-N_stars>0) /* there is other particles */
{
for(i=N_gas+N_stars;i<NumPart;i++)
{
Psave = P[i];
P[i] = P[i+NumNewStars];
P[i+NumNewStars] = Psave;
#ifdef STELLAR_PROP
/* set new index for StP */
StP[P[i].StPIdx].PIdx = i;
#ifdef CHECK_ID_CORRESPONDENCE
StP[P[i].StPIdx].ID = P[i].ID;
#endif
#endif
//printf("(%d) new star (b) i=%d id=%d\n",ThisTask,N_gas+N_stars+i,P[N_gas+N_stars+i].ID);
}
/* now, set new index for the StP that where untouched */
for(i=N_gas+N_stars+1;i<N_gas+N_stars+NumNewStars;i++) /* here, we should move up to <N_gas+N_stars+NumNewStars */
{ /* however, if there is only one particle, it will not be counted */
#ifdef STELLAR_PROP
/* set new index for StP */
StP[P[i].StPIdx].PIdx = i;
#ifdef CHECK_ID_CORRESPONDENCE
StP[P[i].StPIdx].ID = P[i].ID;
#endif
#endif
}
}
else /* there is no other particles outside, i.e, new particles are already the last ones */