Changeset 7953
- Timestamp:
- Jul 24, 2006, 1:56:26 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/astrom/pmAstrometryObjects.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmAstrometryObjects.c
r7944 r7953 8 8 * @author EAM, IfA 9 9 * 10 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-07-2 0 13:02:19$10 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-07-24 23:56:26 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 136 136 return NULL; \ 137 137 } \ 138 /* 139 * sort both lists by X coord; 140 st1 first 141 */ \ 142 psVector *x1 = psVectorAlloc(st1->n, PS_TYPE_F64); 138 /* sort both lists by X coord; st1 first */ \ 139 psVector *x1 = psVectorAlloc(st1->n, PS_TYPE_F64); \ 143 140 \ 144 x1->n = x1->nalloc; 141 x1->n = x1->nalloc; \ 142 for (int i = 0; i < st1->n; i++) { \ 143 x1->data.F64[i] = ((pmAstromObj *)st1->data[i])->MEMBER->x; \ 144 } \ 145 const psVector *sorted1 = psVectorSortIndex(NULL, x1); \ 146 assert (sorted1->type.type == PS_TYPE_S32); \ 145 147 \ 146 for (int i = 0; i < st1->n; i++) 147 { 148 \ 149 x1->data.F64[i] = ((pmAstromObj *)st1->data[i])->MEMBER->x; 150 \ 151 } \ 152 const psVector *sorted1 = psVectorSortIndex(NULL, x1); 153 \ 154 assert (sorted1->type.type == PS_TYPE_S32); 155 \ 156 \ 157 psVector *y1 = psVectorAlloc(st1->n, PS_TYPE_F64); 158 \ 159 y1->n = y1->nalloc; 160 \ 161 for (int i = 0; i < st1->n; i++) 162 { 163 \ 164 x1->data.F64[i] = ((pmAstromObj *)st1->data[sorted1->data.S32[i]])->MEMBER->x; 165 \ 166 y1->data.F64[i] = ((pmAstromObj *)st1->data[sorted1->data.S32[i]])->MEMBER->y; 167 \ 148 psVector *y1 = psVectorAlloc(st1->n, PS_TYPE_F64); \ 149 y1->n = y1->nalloc; \ 150 for (int i = 0; i < st1->n; i++) { \ 151 x1->data.F64[i] = ((pmAstromObj *)st1->data[sorted1->data.S32[i]])->MEMBER->x; \ 152 y1->data.F64[i] = ((pmAstromObj *)st1->data[sorted1->data.S32[i]])->MEMBER->y; \ 168 153 } \ 169 154 \ 170 155 /* now st2 */ \ 171 psVector *x2 = psVectorAlloc(st2->n, PS_TYPE_F64); 156 psVector *x2 = psVectorAlloc(st2->n, PS_TYPE_F64); \ 157 x2->n = x2->nalloc; \ 158 for (int i = 0; i < st2->n; i++) { \ 159 x2->data.F64[i] = ((pmAstromObj *)st2->data[i])->MEMBER->x; \ 160 } \ 161 const psVector *sorted2 = psVectorSortIndex(NULL, x2); \ 172 162 \ 173 x2->n = x2->nalloc; 163 psVector *y2 = psVectorAlloc(st2->n, PS_TYPE_F64); \ 164 y2->n = y2->nalloc; \ 165 for (int i = 0; i < st2->n; i++) { \ 166 x2->data.F64[i] = ((pmAstromObj *)st2->data[sorted2->data.S32[i]])->MEMBER->x; \ 167 y2->data.F64[i] = ((pmAstromObj *)st2->data[sorted2->data.S32[i]])->MEMBER->y; \ 168 } \ 169 /* Do the work */ \ 170 psArray *matches = match_lists(x1, y1, x2, y2, sorted1, sorted2, RADIUS); \ 174 171 \ 175 for (int i = 0; i < st2->n; i++) 176 { 177 \ 178 x2->data.F64[i] = ((pmAstromObj *)st2->data[i])->MEMBER->x; 179 \ 180 } \ 181 const psVector *sorted2 = psVectorSortIndex(NULL, x2); 172 psFree(sorted1); \ 173 psFree(sorted2); \ 174 psFree(x1); \ 175 psFree(y1); \ 176 psFree(x2); \ 177 psFree(y2); \ 182 178 \ 183 \ 184 psVector *y2 = psVectorAlloc(st2->n, PS_TYPE_F64); 185 \ 186 y2->n = y2->nalloc; 187 \ 188 for (int i = 0; i < st2->n; i++) 189 { 190 \ 191 x2->data.F64[i] = ((pmAstromObj *)st2->data[sorted2->data.S32[i]])->MEMBER->x; 192 \ 193 y2->data.F64[i] = ((pmAstromObj *)st2->data[sorted2->data.S32[i]])->MEMBER->y; 194 \ 195 } \ 196 /* 197 * Do the work 198 */ \ 199 psArray *matches = match_lists(x1, y1, x2, y2, sorted1, sorted2, RADIUS); 200 \ 201 \ 202 psFree(sorted1); 203 \ 204 psFree(sorted2); 205 \ 206 psFree(x1); 207 \ 208 psFree(y1); 209 \ 210 psFree(x2); 211 \ 212 psFree(y2); 213 \ 214 \ 215 psLogMsg (__func__, 3, "radius match: %d pairs (radius: %f)\n", matches->n, RADIUS); 216 \ 217 return (matches); 218 \ 179 psLogMsg (__func__, 3, "radius match: %d pairs (radius: %f)\n", matches->n, RADIUS); \ 180 return (matches); \ 219 181 } 220 182
Note:
See TracChangeset
for help on using the changeset viewer.
