Changeset 26190 for trunk/psModules/src/objects
- Timestamp:
- Nov 18, 2009, 4:35:54 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSourceGroups.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceGroups.c
r26182 r26190 60 60 pmSourceGroups *groups = psAlloc(sizeof(pmSourceGroups)); // Groups, to return 61 61 psMemSetDeallocator(groups, (psFreeFunc)sourceGroupsFree); 62 63 groups->Xo = readout->image->col0; 64 groups->Yo = readout->image->row0; 65 66 if (nThreads == 0 || nThreads == 1) { 67 // Trivial case 68 groups->Cx = groups->Cy = 1; 69 groups->Nx = readout->image->numCols; 70 groups->Ny = readout->image->numRows; 71 groups->groups = psArrayAlloc(1); 72 return groups; 73 } 62 74 63 75 int nCells = nThreads * 2*2; // number of cells in a single set … … 83 95 groups->Cx = Cx; 84 96 groups->Cy = Cy; 85 groups->Xo = readout->image->col0, groups->Yo = readout->image->row0; // Offsets86 97 groups->Nx = readout->image->numCols / (Cx*2); 87 98 groups->Ny = readout->image->numRows / (Cy*2); … … 155 166 PS_ASSERT_VECTORS_SIZE_EQUAL(x, y, NULL); 156 167 168 int numSources = x->n; // Number of sources 169 157 170 // Populate the groups 158 int numSources = x->n; // Number of sources159 171 long total = groups->Cx * groups->Cy; // Total size 160 172 for (int i = 0; i < groups->groups->n; i++) { … … 167 179 168 180 // Populate the cells 169 for (int i = 0; i < numSources; i++) { 170 int group = 0, cell = 0; // Group and cell index for source 171 pmSourceGroupsCoordToCell(&group, &cell, x->data.F32[i], y->data.F32[i], groups); 172 173 psArray *cells = groups->groups->data[group]; // Cells for group 174 psVector *cellSources = cells->data[cell]; // Indices of sources for cell within group 175 psVectorAppend(cellSources, i); 176 } 177 178 return groups; 179 } 181 if (total == 1) { 182 // Trivial case: Cx == Cy == 1 183 psArray *cells = groups->groups->data[0]; // Cell 184 psVector *cellSources = cells->data[0]; // Indices of sources for cell 185 for (int i = 0; i < numSources; i++) { 186 cellSources->data.S32[i] = i; 187 } 188 } else { 189 for (int i = 0; i < numSources; i++) { 190 int group = 0, cell = 0; // Group and cell index for source 191 pmSourceGroupsCoordToCell(&group, &cell, x->data.F32[i], y->data.F32[i], groups); 192 193 psArray *cells = groups->groups->data[group]; // Cells for group 194 psVector *cellSources = cells->data[cell]; // Indices of sources for cell within group 195 psVectorAppend(cellSources, i); 196 } 197 } 198 199 return groups; 200 }
Note:
See TracChangeset
for help on using the changeset viewer.
