forked from moebiusband/NuSiF-Solver
		
	Fix bug. Add output for compression.
This commit is contained in:
		@@ -33,6 +33,6 @@ typedef struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static inline int gridIsFluid(Grid* g, int i, int j)
 | 
					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_
 | 
					#endif // __GRID_H_
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,6 +110,8 @@ static void compress(ParticleTracer* p)
 | 
				
			|||||||
    Particle tempPool[p->totalParticles];
 | 
					    Particle tempPool[p->totalParticles];
 | 
				
			||||||
    int totalParticles = 0;
 | 
					    int totalParticles = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf("Performing compression ...");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (int i = 0; i < p->totalParticles; i++) {
 | 
					    for (int i = 0; i < p->totalParticles; i++) {
 | 
				
			||||||
        if (memPool[i].flag == 1) {
 | 
					        if (memPool[i].flag == 1) {
 | 
				
			||||||
            tempPool[totalParticles].x    = memPool[i].x;
 | 
					            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->totalParticles   = totalParticles;
 | 
				
			||||||
    p->removedParticles = 0;
 | 
					    p->removedParticles = 0;
 | 
				
			||||||
    p->pointer          = totalParticles + 1;
 | 
					    p->pointer          = totalParticles + 1;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user