Changeset 32967
- Timestamp:
- Dec 16, 2011, 7:29:55 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/opihi
- Files:
-
- 2 edited
-
cmd.astro/spex1dgas.c (modified) (1 diff)
-
cmd.data/cursor.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.astro/spex1dgas.c
r32951 r32967 251 251 252 252 // save the result 253 char name[64]; 254 snprintf (name, 64, "output.%02d.dat", iter); 255 FILE *output = fopen (name, "w"); 256 for (i = 0; i < Nobject; i++) { 257 fprintf (output, "%f %f : %f %f\n", object[i].Xo, object[i].Yo, object[i].dPdX, object[i].dPdY); 258 } 259 fclose (output); 260 261 // measure (dP/dX),(dP/dY) for all objects 253 if (0) { 254 char name[64]; 255 snprintf (name, 64, "output.%02d.dat", iter); 256 FILE *output = fopen (name, "w"); 257 for (i = 0; i < Nobject; i++) { 258 fprintf (output, "%f %f : %f %f\n", object[i].Xo, object[i].Yo, object[i].dPdX, object[i].dPdY); 259 } 260 fclose (output); 261 } 262 263 // measure (dP/dX) & move object 262 264 for (i = 0; i < Nobject; i++) { 263 265 get_pressure_gradient (i, nCloseMax, farFrac, nearNeighbors, maxPressure); 264 266 move_object (i); 265 267 } 266 267 // given (dP/dX),(dP/dY), move each object 268 // for (i = 0; i < Nobject; i++) { 269 // } 268 } 269 270 // find the mean Xo, Yo positions for all objects 271 float XoSum = 0.0; 272 for (i = 0; i < Nobject; i++) { 273 float dY2sum = 0.0; 274 int Npts = 0; 275 for (j = 0; (j < nCloseMax) && (j < object[i].Nindex); j++) { 276 int idx = object[i].index[j]; 277 float dR2 = SQ(object[i].Dtgt[j]); 278 float dX2 = SQ(object[i].Xo - object[idx].Xo); 279 float dY2 = dR2 - dX2; 280 dY2sum += dY2; 281 Npts ++; 282 } 283 XoSum += object[i].Xo; 284 object[i].Yo = (dY2sum > 0.0) ? sqrt(dY2sum / Npts) : -sqrt(dY2sum / Npts); 285 } 286 float XoMean = XoSum / Nobject; 287 288 // remove the mean Xo (uninteresting) 289 for (i = 0; i < Nobject; i++) { 290 object[i].Xo -= XoMean; 270 291 } 271 292 272 293 // save the result 273 FILE *output = fopen ("output.dat", "w"); 274 for (i = 0; i < Nobject; i++) { 275 fprintf (output, "%f %f : %f %f\n", object[i].Xo, object[i].Yo, object[i].dPdX, object[i].dPdY); 276 } 277 fclose (output); 294 { 295 Vector *outindex = SelectVector ("sp1d_idx", ANYVECTOR, TRUE); if (!outindex) goto escape; 296 Vector *outXo = SelectVector ("sp1d_Xo", ANYVECTOR, TRUE); if (!outXo) goto escape; 297 Vector *outYo = SelectVector ("sp1d_Yo", ANYVECTOR, TRUE); if (!outYo) goto escape; 298 299 ResetVector (outindex, OPIHI_INT, Nobject); 300 ResetVector (outXo, OPIHI_FLT, Nobject); 301 ResetVector (outYo, OPIHI_FLT, Nobject); 302 303 for (i = 0; i < Nobject; i++) { 304 outindex->elements.Int[i] = i; 305 outXo->elements.Flt[i] = object[i].Xo; 306 outYo->elements.Flt[i] = object[i].Yo; 307 } 308 } 278 309 279 310 return TRUE; -
branches/eam_branches/ipp-20111122/Ohana/src/opihi/cmd.data/cursor.c
r31635 r32967 4 4 5 5 char string[20], key[20], *name; 6 int i, N, kapa ;6 int i, N, kapa, VERBOSE; 7 7 double X, Y, R, D, Z; 8 8 void *oldsignal; … … 13 13 // if ((N = get_argument (argc, argv, "-g"))) { 14 14 // if ((N = get_argument (argc, argv, "-i"))) { 15 16 VERBOSE = TRUE; 17 if ((N = get_argument (argc, argv, "-a"))) { 18 VERBOSE = FALSE; 19 } 15 20 16 21 name = NULL; … … 53 58 set_str_variable ("KEY", key); 54 59 55 gprint (GP_LOG, "%s %f %f %f %f %f\n", key, X, Y, Z, R, D);60 if (VERBOSE) gprint (GP_LOG, "%s %f %f %f %f %f\n", key, X, Y, Z, R, D); 56 61 57 62 if (!strcasecmp (key, "Q")) break;
Note:
See TracChangeset
for help on using the changeset viewer.
