Fix bug. Add output for compression.

This commit is contained in:
Jan Eitzinger 2024-03-06 06:02:40 +01:00
parent 6f3d9e73ef
commit 7ce84e2773
2 changed files with 4 additions and 1 deletions

View File

@ -33,6 +33,6 @@ typedef struct {
static inline int gridIsFluid(Grid* g, int i, int j)
{
return g->s[j * (g->imax + 2) + i];
return g->s[j * (g->imax + 2) + i] == FLUID;
}
#endif // __GRID_H_

View File

@ -110,6 +110,8 @@ static void compress(ParticleTracer* p)
Particle tempPool[p->totalParticles];
int totalParticles = 0;
printf("Performing compression ...");
for (int i = 0; i < p->totalParticles; i++) {
if (memPool[i].flag == 1) {
tempPool[totalParticles].x = memPool[i].x;
@ -119,6 +121,7 @@ static void compress(ParticleTracer* p)
}
}
printf(" remove %d particles\n", p->totalParticles - totalParticles);
p->totalParticles = totalParticles;
p->removedParticles = 0;
p->pointer = totalParticles + 1;