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

SCM Repository

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

Diff of /branches/lamont/src/compiler/c-target/fragments/grid2D.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2297, Fri Mar 15 22:05:31 2013 UTC revision 2298, Fri Mar 15 22:18:22 2013 UTC
# Line 4  Line 4 
4  //! \param cellSize the size of the cells  //! \param cellSize the size of the cells
5  //! \param window the viewing window (i.e. [XMIN,XMAX,YMIN,YMAX])  //! \param window the viewing window (i.e. [XMIN,XMAX,YMIN,YMAX])
6  //! \return the address of the grid context  //! \return the address of the grid context
7  GridContext * Diderot_GridAllocGrid2D(Diderot_vec2_t * gridSize,  GridContext * Diderot_GridAllocGrid2D (
8        Diderot_vec2_t *gridSize,
9                                        uint32_t numberOfStrands,                                        uint32_t numberOfStrands,
10                                        Diderot_vec2_t * cellSize,                                        Diderot_vec2_t * cellSize,
11                                        Diderot_vec4_t  * window)                                        Diderot_vec4_t  * window)
12  {  {
   
13          GridContext * newGridContext = CheckedAlloc (sizeof(GridContext));          GridContext * newGridContext = CheckedAlloc (sizeof(GridContext));
14    
15      newGridContext->gridSize = gridSize;      newGridContext->gridSize = gridSize;
# Line 27  Line 27 
27    
28      return newGridContext;      return newGridContext;
29  }  }
30    
31  void Diderot_GridAdd2D(Diderot_vec2_t pos, uint32_t id, GridContext * ctx)  void Diderot_GridAdd2D(Diderot_vec2_t pos, uint32_t id, GridContext * ctx)
32  {  {
33     uint32_t gridIdx = worldToGridIdx2D(pos,ctx);     uint32_t gridIdx = worldToGridIdx2D(pos,ctx);
# Line 42  Line 43 
43    
44     ctx->grid[gridIdx].poolIdx = newPoolIdx;     ctx->grid[gridIdx].poolIdx = newPoolIdx;
45  }  }
46    
47  void Diderot_GridBuild2D(@STRANDTY@ ** strands, GridContext * ctx)  void Diderot_GridBuild2D(@STRANDTY@ ** strands, GridContext * ctx)
48  {  {
49      Diderot_GridClear(ctx);      Diderot_GridClear(ctx);
# Line 50  Line 52 
52          Diderot_GridAdd2D(strands[id]->pos,strands[id]->strandId,ctx);          Diderot_GridAdd2D(strands[id]->pos,strands[id]->strandId,ctx);
53      }      }
54  }  }
55    
56  /************* Query Functions *******************/  /************* Query Functions *******************/
57   Diderot_DynSeq_t * spherical_query2D(@STRANDTY@ ** strands,  Diderot_DynSeq_t *spherical_query2D (
58        @STRANDTY@ **strands,
59                                        @STRANDTY@  * qStrand,                                        @STRANDTY@  * qStrand,
60                                        GridContext * ctx,                                        GridContext * ctx,
61                                        QueryPool_t * queryPool,                                        QueryPool_t * queryPool,
# Line 76  Line 80 
80                                  0,                                  0,
81                                  gridSize.r[0]));                                  gridSize.r[0]));
82    
   
83      Diderot_iunion2_t  yBounds;      Diderot_iunion2_t  yBounds;
84      yBounds.v = vec2i(clamp_int((gridPos.i[1] - ceil(radius/(float)cellSize.r[1])) - 1,      yBounds.v = vec2i(clamp_int((gridPos.i[1] - ceil(radius/(float)cellSize.r[1])) - 1,
85                                  0,                                  0,

Legend:
Removed from v.2297  
changed lines
  Added in v.2298

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