Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/lamont/src/compiler/c-target/fragments/grid.in
ViewVC logotype

View of /branches/lamont/src/compiler/c-target/fragments/grid.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2084 - (download) (annotate)
Fri Nov 9 21:55:00 2012 UTC (8 years, 7 months ago) by lamonts
File size: 747 byte(s)
Fixed problem with foreach
void constructGrid (@STRANDTY@ ** strands, GridContext * ctx) 
{ 
    int size = ctx->gridSize[0] * ctx->gridSize[1]; 

    ctx->grid = (StrandItem_t **)malloc(sizeof(StrandItem_t *) * size);  

    for(int i = 0; i <size; i++){ 
        ctx->grid[i] = NULL; 
    }

    for(int id = 0; id < ctx->numberOfStrands; id++) 
    {
        //Retrieve the grid coordinates from the particle's position. 
        int cell[2]; 
        worldToGrid(strands[id]->pos,ctx,cell);
        uint32_t gridIdx = cellToCellIdx(ctx,cell); 

        StrandItem_t * newCell = (StrandItem_t *)malloc(sizeof(StrandItem_t)); 

        newCell->strandId = strands[id]->strandId; 
        newCell->next = ctx->grid[gridIdx];
        ctx->grid[gridIdx] = newCell; 
    }
} 

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0